Automatically Rename Media On Upload Plugin

Automatically Rename Media on Upload plugin has just been released.

This plugin will automatically rename any media files you upload to the Media Library, by adding a prefix to the beginning of the filename based on the filetype.

For example, you can tell it to add the prefix “pic-” to the beginning of all .jpg files that you upload. So uploading an image called car.jpg would get renamed to pic-car.jpg

And since it changes the name of the file, it will also change the “slug” that wordpress uses based on this new name.

You can set an individual/unique prefix for each of the following filetypes:
jpg jpeg png bmp gif tif mp4 avi m4v mov flv mkv 3gp pdf doc docx xls xlsx ppt pptx mp3 ogg wav zip csv txt

You will need to go to the settings page and set the prefix you want to use for each of the filetypes.

The default behavior is that it will NOT rename any uploaded files until you have set the prefix on the settings page.

== Frequently Asked Questions ==

= Can I manually rename the files when I upload them? =
No. In the settings you can set how the filename will be renamed when it is uploaded. File will be automatically renamed during the upload process.

= Can I choose whether a file will be renamed when I upload it? =
No. In the settings you can set how the filename will be renamed when it is uploaded. File will be automatically renamed during the upload process.

= How do I disable renaming files of only certain types? =
On the settings page, you can remove the prefix from the textbox and set it empty/blank for any filetype that you do not want to be renamed when it is uploaded. If a particular filetype has an empty/blank textbox, then it will not be renamed when it is uploaded.

= How do I rename only files of one specific filetype, but not all the other filetypes? =
On the settings page, you can remove the prefix from the textbox and set it empty/blank for any filetype that you do not want to be renamed when it is uploaded. If a particular filetype has an empty/blank textbox, then it will not be renamed when it is uploaded.

= For what filetypes can I modify the prefix for the renaming of the file? =
You can set an individual/unique prefix for each of the following filetypes: jpg jpeg png bmp gif tif mp4 avi m4v mov flv mkv 3gp pdf doc docx xls xlsx ppt pptx mp3 ogg wav zip csv txt

= The filetype I need to rename is not listed. What can I do? =
Submit a support request and I will see if I can get that filetype added for you.

= I have uploaded a file to the Media Library, but it was not renamed? What happened? =
Make sure you go to the settings page and set the prefix you want to use for the particular filetype you are uploading and want renamed. And don’t forget to hit the SAVE button to make sure your changes are saved.

Shopify: How to add External Link Buy Now button and remove Add To Cart button

I have some products (eBooks) that are only available to purchase on Amazon so I needed a way to add a BUY NOW ON AMAZON button and also needed to remove the ADD TO CART button.

This solution requires an App that lets you add custom Metadata Fields to your products. I tested a few different free ones, and ended up going with Simple Admin https://apps.shopify.com/simple-meta

This solution also requires adding some custom code to your theme. In this example I am using the free theme called SIMPLE.

STEP 1
Add and install the Simple Admin app to your Shopify store.

STEP 2
Once installed, go to your Apps section and click on Simple Admin to go to its dashboard.

STEP 3
Click on PRODUCTS over in the top right corner.

STEP 4
Choose the product you want add the Buy Now External Link button too, and click the ID number of that product.

STEP 5
Click on the META tab.

STEP 6
Click ADD METAFIELD.

STEP 7
Enter the following information:
KEY: BuyNowText
VALUE: BUY NOW on Amazon.com
VALUE TYPE: String
NAMESPACE: CustomExternalLink
DESCRIPTION: The value is the text the customer will see on the button.
Click SAVE.

STEP 8
Click ADD METAFIELD again.

STEP 9
Enter the following information:
KEY: BuyNowLink
VALUE: https://anydomain.com/some/link/to/product
VALUE TYPE: String
NAMESPACE: CustomExternalLink
DESCRIPTION: Enter external link in the value field. To disable external link, enter the word “none” (without quotes) in the value field.
Click SAVE.

STEP 10
Now go to ONLINE STORE then THEMES then click on ACTIONS for your current theme and choose EDIT CODE.
NOTE: I am using the free SIMPLE theme.

STEP 11
Locate the SECTIONS / PRODUCT-TEMPLATE.LIQUID file and click on it so the file opens up in the editor.
NOTE: The following code that I am going to modify is specific to the SIMPLE theme and is located in the SECTIONS / PRODUCT-TEMPLATE.LIQUID file. The code you are looking for may be slightly different if you are using a different theme, and may also be located in a different file. Another file to check for the code would be the TEMPLATES / PRODUCT.LIQUID file.

STEP 12
Look for the following code:

<div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn{% endif %}{% if section.settings.add_to_cart_width == 'full_width' %} product-form--full{% endif %}">
  <button type="submit" name="add" id="AddToCart" class="btn product-single__cart-submit{% if section.settings.add_to_cart_width == 'full_width' %} btn--full{% endif %}{% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary{% endif %}">
    <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
  </button>
  {% if section.settings.enable_payment_button %}
    {{ form | payment_button }}
  {% endif %}
</div>

STEP 13
Replace the code above with this code:

{% comment %}
  MOD by Jeff - Wrapped the DIV with the IF-ELSE statement to show External BUY NOW button.
              - When link is found, the ADD TO CART and BUY NOW buttons will disappear and this button will show instead.
              - Use Simple Admin app to add custom metafields.
              - NAMESPACE: CustomExternalLink
              - KEY: BuyNowLink = enter http link to external site or the word "none" without quotes to disable
              - KEY: BuyNowText = the text you want customer to see
{% endcomment %}
{% if product.metafields.CustomExternalLink.BuyNowLink == blank or product.metafields.CustomExternalLink.BuyNowLink == 'none' %}
<div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn{% endif %}{% if section.settings.add_to_cart_width == 'full_width' %} product-form--full{% endif %}">
  <button type="submit" name="add" id="AddToCart" class="btn product-single__cart-submit{% if section.settings.add_to_cart_width == 'full_width' %} btn--full{% endif %}{% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary{% endif %}">
    <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
  </button>
  {% if section.settings.enable_payment_button %}
    {{ form | payment_button }}
  {% endif %}
</div>
{% else %}
  <a href="{{ product.metafields.CustomExternalLink.BuyNowLink }}"><button class="btn" style="background-color:black; pointer-events: none;"><span>{{ product.metafields.CustomExternalLink.BuyNowText }}</span></button></a>
{% endif %}
{% comment %}
  END MOD by Jeff
{% endcomment %}

STEP 14
Click SAVE.

STEP 15
Go view your product and you should see the new BUY NOW button has been added and the ADD TO CART button has been removed.

 

Enjoy!!!

Beat your speeding ticket with an Expert Witness

In Ontario, speeding tickets are very hard to beat because the caselaw basically allows the Justice of the Peace and the Judge to simply accept what the officer says as fact. If the officer says you were speeding, then it must be true! If the officer says they were trained on the Radar or Lidar device, then it must be true! If the officer says the device was working properly at the time, then it must be true! Of course we know that just because the officer believes the Radar or Lidar was working properly, does not mean it actually was. With an expert witness, you can then challenge the credibility of the officers statements and bring evidence that shows the device may not have been accurate at the time it was used.

You should also read the following post on why you need an Expert Witness: Caselaw regarding the need for an Expert Witness

Caselaw regarding the need for an Expert Witness for Speeding Trials

This is not legal advice and is for informational purposes only.

The purpose of an expert witness is to bring unbiased information to the court so the Justice of the Peace or Judge can make a better informed decision. An expert witness possesses special knowledge and experience going beyond that of the trier of fact. (see R. v. Beland, [1987] 2 S.C.R. 398, at paragraph 16).

In Ontario, the courts simply take at face value the officers statement that they are a qualified radar/lidar operator and that they believe the device was working properly at the time, and therefore the speed reading was correct. Even cross-examination of the officer on these points is mostly useless because the court will say “there is no statuatory requirement as to what a qualified operator is, so they say they were trained, so it must be true, and they say it was working properly, so it must be true”.

The only way to you can beat it, is for the defence to put their own expert on the stand who can explain why the device has a very good chance of NOT being accurate (since they are NEVER calibrated in Ontario).
Continue reading

What to do when pulled over by police in Ontario or Canada

This is not legal advice and is for informational purposes only.

DRIVING A VEHICLE IN CANADA:
When you are detained by police (pulled over at the side of the road, DUI/RIDE checkpoint, etc), section 10(a) of the Canadian Charter of Rights and Freedoms requires them to tell you why. So whenever you are stopped, and they come to your vehicle window, immediately ask them:

* Why did you stop me?
* Am I being detained?

DO NOT ANSWER ANY QUESTIONS:
Be nice and be polite (they have guns), but remember you do not have to answer any questions. Always answer “I CHOOSE NOT TO ANSWER ANY QUESTIONS, THANK YOU” or “I DO NOT WISH TO MAKE A STATEMENT, THANK YOU” to everything they ask you. This is your fundamental right to be free from self-incrimination and therefore not provide police with evidence that may be used against you. Everything you say can and will be used against you in a court of law. Also remember that you should never lie to police. It much better to say “no comment” than to lie.
Continue reading

R vs Jordan- Right to a Speedy Trial- Charter Section 11b Argument

This is not legal advice and is for informational purposes only.

In Ontario, your right to a speedy trial used to kick in after 10 to 12 months, but with the Jordan decision, it was (sort of) raised to 18 months.

The following are my thoughts and comments on the R v Jordan 2016 SCC 27, [2016] 1 SCR 631 decision regarding the Right to a Speedy Trial under Charter Section 11b.

You can find it here if you want to read it yourself:
https://scc-csc.lexum.com/scc-csc/scc-c … 7/index.do
Continue reading