Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Can I automatically Free Shipping Icon if product qualifies by price?

    Hi,
    I have finally completed the transition from 1.5.1 to 1.5.5
    It took me a lot of work, but I have learned a lot during the prepration.
    I have a question that I can not solve on my own.
    I want to have the free shipping icon to show automatically when a product costs more than the value set in the freeoption module.
    Is this possible? How can I do it?
    In tpl_product_info_display-php I can see
    PHP Code:
    <!--bof free ship icon  -->
    <?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
    <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
    <?php ?>
    <!--eof free ship icon  -->
    I think it could be possible to add something like
    <!--bof free ship icon -->
    <?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping or $products_price>I do not kno what ) { ?>
    <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
    <?php } ?>
    <!--eof free ship icon -->
    And it should work.
    Can someone help me?
    Thanks
    enzo from Italy
    ciao ciao

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    You can mark specific product as being free shipping in the catalog on the product's info page. This would spare you from modifying core code. Does that work for you?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Quote Originally Posted by mc12345678 View Post
    You can mark specific product as being free shipping in the catalog on the product's info page. This would spare you from modifying core code. Does that work for you?
    Thanks, but I already do that for products that I want to promote and would not be not be free shipping normally.
    I wanted to have it automated for all the other products also because prices may change and it would be much easier if the icon would appear and disappear when the price changes.
    ciao ciao

  4. #4
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    I think I got something that may work and it is as simple as changing

    PHP Code:
    <?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
    to

    PHP Code:
    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping || ($products_price >=MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN))
    ?>
    the problem I have is that $products_price output's is €&nbsp;90,10 and I think that the output is not recognized as a number in the || logical operator, therefore the free shipping icon is always shown.
    Is there any way to clean up the output for the logical operator so it can compare numbers with numbers? Also probably the value to compare is xx.xx while the
    $products_price number is xx,xx and this creates another problem I think.

    Thanks for help

    ciao from Italy
    enzo

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    If you're going to modify the core code (instead of perhaps adding a listener to modify the free_shipping flag of the product say in or off of the header_php.php or elsewhere) then there is already the $products_id_current variable that can be used to lookup the price (need to consider what aspect of the price you are really considering because you may want to take into account a product priced by attributes and the effect of one attribute causing the price to be below the threshold and another putting it over), but yes you would have an issue especially if you offer multiple currencies and the value of comparison in one currency is significantly different than that of another. (ie. Yen is likely to be *always* free shipping just because of conversion factors, if currency conversion is included in the price lookup function used.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Personally, I'd probably do something as say an admin init_ type file, check to see if a product was being updated and if so, then to run the comparison and make the database change for the product. That is at least if prices are updated through the admin. If not, and say using a bulk update program, then I would either incorporate such a switch into the updater (though a "shortcut" route and likely to cause a headache later when trying to troubleshoot why this keeps happening) or just incorporate into the price update process to set or clear that flag as approriate.


    Whatever the case, hopefully you will heavily document this change both in the code and in whatever notes you take/keep.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Quote Originally Posted by mc12345678 View Post
    If you're going to modify the core code (instead of perhaps adding a listener to modify the free_shipping flag of the product say in or off of the header_php.php or elsewhere) then there is already the $products_id_current variable that can be used to lookup the price (need to consider what aspect of the price you are really considering because you may want to take into account a product priced by attributes and the effect of one attribute causing the price to be below the threshold and another putting it over), but yes you would have an issue especially if you offer multiple currencies and the value of comparison in one currency is significantly different than that of another. (ie. Yen is likely to be *always* free shipping just because of conversion factors, if currency conversion is included in the price lookup function used.)
    Thanks a lot for your comments.
    I see what you mean and I agree.
    By now I just hacked the code and found the way to make it work in both product_listing.php and tpl_product_info_display.php
    I made notes about the mods on head of the files.
    Thanks again.
    enzo

  8. #8
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Glad it works.

    If you have the time, could you post your solution so that other interested individuals can reproduce your success?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Quote Originally Posted by mc12345678 View Post
    Glad it works.

    If you have the time, could you post your solution so that other interested individuals can reproduce your success?
    Here we go,
    provided you have enabled the freeoptions with a value that allows free shipping over a order value, if you mod (after backing up the original files) the two files, you will have the free shipping icon appear when the product price is over that limit.
    If it does not work, let me know.
    includes/templates/yourtemplate/templates/tpl_product_info_display.php
    find
    line 112
    PHP Code:
    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping){ ?>
        <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
        <?php ?>
    change
    PHP Code:
    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping)|| ($cleaned str_replace("€&nbsp;" "",$products_price) >=MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN)){ ?>
        <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
        <?php ?>
    includes/module/yourtemplate/product_listing.php
    find
    PHP Code:
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '' '') : ''); 
    change
    PHP Code:
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) || ((int)preg_replace('#[^0-9]+#'''$lc_price)/100 >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '' '') : ''); 
    If you try it and it works, let me know if it does not work, let me know,but I do not take responsibility about, however...
    ciao from Italy

  10. #10
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Can I automatically Free Shipping Icon if product qualifies by price?

    Quote Originally Posted by mc12345678 View Post
    Glad it works.

    If you have the time, could you post your solution so that other interested individuals can reproduce your success?
    Here we go,
    provided you have enabled the freeoptions with a value that allows free shipping over a order value, if you mod (after backing up the original files) the two files, you will have the free shipping icon appear when the product price is over that limit.
    If it does not work, let me know.
    includes/templates/yourtemplate/templates/tpl_product_info_display.php
    find
    line 112
    PHP Code:
    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping){ ?>
        <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
        <?php ?>
    change
    PHP Code:
    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping)|| ($cleaned str_replace("€&nbsp;" "",$products_price) >=MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN)){ ?>
        <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
        <?php ?>
    includes/module/yourtemplate/product_listing.php
    find
    line 149
    PHP Code:
        $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '' '') : ''); 
    change
    PHP Code:
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) || ((int)preg_replace('#[^0-9]+#'''$lc_price)/100 >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '' '') : ''); 
    If you try it and it works, let me know if it does not work, let me know,but I do not take responsibility about, however...
    ciao from Italy

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 23 Jul 2013, 07:54 AM
  2. I can't get 'Free shipping' icon displayed &
    By oavs in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 21 Oct 2010, 05:49 PM
  3. How to show free shipping icon when product weight is zero?
    By slitter in forum General Questions
    Replies: 4
    Last Post: 8 Aug 2009, 05:00 AM
  4. free shipping icon on each product?
    By rickiesdiscount in forum Addon Shipping Modules
    Replies: 2
    Last Post: 28 Sep 2008, 01:11 AM
  5. How to enable the FREE SHIPPING icon next to product listing?
    By kenix in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Aug 2008, 06:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg