Forums / General Questions / How to show free shipping icon when product weight is zero?

How to show free shipping icon when product weight is zero?

Locked

Views: 2,221

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
17 Jul 2009, 5:43 PM
#1
slitter avatar

slitter

New Zenner

Join Date:
Jun 2005
Posts:
39
Plugin Contributions:
0

How to show free shipping icon when product weight is zero?

I would like to show the free shipping icon on the product info page when the weight of the product is "0".
All Products are marked as:
Always Free Shipping NO

Shipping/Packaging I have chosen 0 weight does NOT mean Free shipping ...

I have the following shipping modules turned on:
Zones
Free Shipping Options freeoptions
I have set the total >= 0.00

How do I change the code to show the shipping icon when the product weight is "0"?
I have looked at a similar thread but here Ajeh forced the shipping icon to show on all product info pages.

Ajeh:

Okay ... this is very different ... :unsure:

If you want to see the Free Shipping icon, you need to force that by modifying the IF in the tpl_product_info_display.php ...

Copy that to your templates and overrides directory and edit this section:

<!--bof free ship icon --> <?php if(zen_get_product_is_always_free_shipping($products_id_current)) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon --> ``` > > Change to read: > ```php <!--bof free ship icon --> <?php if(true || zen_get_product_is_always_free_shipping($products_id_current)) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon --> ``` > > That makes it always true so the Free Shipping icon will show ... > > Then if you need this on the listings, you need to do something similar ...
19 Jul 2009, 3:54 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to show free shipping icon when product weight is zero?

Change the IF condition to check the Product's Weight and if 0, then the Free Shipping icon will show ...

You should be able to use:
$products_weight

Note: if you also use attribute weight then you will need to consider how you want to manage this for attributes that might add weight to a 0 weight product ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Aug 2009, 5:45 PM
#3
slitter avatar

slitter

New Zenner

Join Date:
Jun 2005
Posts:
39
Plugin Contributions:
0

Re: How to show free shipping icon when product weight is zero?

Thanks Ajeh,
I have tried the following code but it works the other way around; the freeshipping icon is showing up on products that weigh over 0 .
Can you help me out?

<!--bof free ship icon when weight is 0 --> <?php if ($products_weight !=0) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon when weight is 0 -->
8 Aug 2009, 12:26 AM
#4
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: How to show free shipping icon when product weight is zero?

slitter:

Thanks Ajeh,
I have tried the following code but it works the other way around; the freeshipping icon is showing up on products that weigh over 0 .
Can you help me out?

<!--bof free ship icon when weight is 0 --> <?php if ($products_weight !=0) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon when weight is 0 -->

You're asking to show the icon when the weight is NOT 0

You need to change it as follows:

<!--bof free ship icon when weight is 0 -->

<?php if ($products_weight ==0) { ?>

<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon when weight is 0 -->

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

8 Aug 2009, 4:00 AM
#5
slitter avatar

slitter

New Zenner

Join Date:
Jun 2005
Posts:
39
Plugin Contributions:
0

Re: How to show free shipping icon when product weight is zero?

Thanks a lot Clyde, that did the job. Zen Cart rocks...