- Create attribute titled free_shipping_discount as a dropdown, use for promo codes, allow HTML. Admin title Free Shipping, Manage Options – add just one for Yes and title it Free Shipping.
- Add new attribute to Default Attribute set
- Add the following to app/design/frontend/default/YOUR THEME/template/catalog/product/view
<div class="freeshipcontain"> <?php if ($_product->getFreeShippingDiscount()) : echo '<p class="freeship">'.$_product->getAttributeText('free_shipping_discount').'</p>'; endif ?> </div>
- open skin/frontend/default/YOUR THEME/styles.css and add the following
p.freeship { display: block; width: 150px; height: 30px; text-align: -9999em; background: url(../images/freeshipping.png) no-repeat; padding-bottom:5px; background-size: contain; font-size: 1px;color: white;}
- Create and upload your Free Shipping image as
skin/frontend/default/YOUR THEME/images/freeshipping.png
10 comments. Leave new
Exactly what I was looking for, I was thinking about add an external image but doing it through an attribute is a great idea
Thanks Mike, I’m really glad that helped out.
Hi Chris,
Just before i implement the code, Will this add the image to every product or will it work with the free shipping module and add to product over the free shipping price?
Thanks
Mike
Hi Mike,
No, you’re safe. It doesn’t show unless you select ‘Yes’ on for the Free Shipping attribute in your product edit page. Also, it’s very easy to do this twice (just change the name of the attribute) if you want to add more than one free shipping image.
For example, I have a client that offers Free UPS shipping on some things and Free USPS shipping on others. He wanted to be able to display: none, or 1.
Hope that helps, let me know if you have any other questions or anything else and thanks for posting comments.
Perfect thank you, I was hoping for that method as i work on a database of over 4000 products so the best way for me to do this is run a dataflow profile with the free delivery attribute so it has 2 columns.
SKU and Free delivery and then put the sku code and then yes or no in the free delivery column
Exporting my database and then sorting the sheet by price I can then set it for over 4000 products in minutes. I just need to reimport then using dataflow profiles
Thought I would share how I am going to be doing it ha!
Could you tell me, how you would do this, with an existing attribute that is a ‘Yes/No’ type? I set this up ages ago with a Yes/No, and just can’t get your stage 2 code to work for me? Fingers crossed
Hi Matt,
It will be completely different code to display the yes/no. Here is a snippet of code that might help you but you will need to change it up a bit, not just paste it in.
getData('free_shipping');
if ($_Freeship >= 1) {
echo $this->getLayout()->createBlock('cms/block')->setBlockId('free-shipping-product')->toHtml();
}
else if ($_product->getPrice() > 45)
{
echo $this->getLayout()->createBlock('cms/block')->setBlockId('free-shipping-product')->toHtml();
}
else
{
echo "";
}
?>
What this says is that If the free_shipping attribute is yes OR if the price is greater than $45 THEN display the cms block free-shipping-product. This block would have your free shipping banner in it. Hope this helps and saves you some time.
This is great info, thanks guys. It halfway solved my problem. Your code seems to only look at the original price of the product, is there an easy fix to make it look at the price AFTER a catalog price rule adjusts it? For instance: we have a catalog price rule that lowers the price low enough for the customer to get free shipping… Thanks!
Hi,
It is a great post. Is it possible to put icons side by side, for example, I want to put a free shipping icon, a promotion icon and maybe some other icons if needed.
thanks.
Thank you very much for this tutorial. Allowed me to find and change our shipping threshold that an old developer had done for us.