Results 1 to 10 of 11

Hybrid View

  1. #1
    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...

  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?

    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...

  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
    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

  4. #4
    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...

  5. #5
    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

  6. #6
    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

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

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

    Hi all,
    I noticed that there was a mistake in my previous code.

    in includes/modules/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 '' '') : ''); 
    and substitute with

    PHP Code:
    $clean_normal_price zen_get_products_base_price($listing->fields['products_id']);
    $clean_special_price zen_get_products_special_price($listing->fields['products_id']);
    if  (
    $clean_normal_price >= $clean_special_price) {
        
    $rcs_price $clean_special_price;
        }
    if (
    $clean_special_price == ''){
        
    $rcs_price $clean_normal_price;
        }
          
    $lc_text .= '' . (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'])|| (($rcs_price * [COLOR="#FF0000"]1.22[/COLOR]) >= (MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN)) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '' '') : ''); 
    in includes/templates/yourtemplate/tpl_product_info_display.php find

    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  -->
    and substitute with

    PHP Code:
    <!--bof free ship icon  -->
    <?php    
    $clean_normal_price 
    zen_get_products_base_price((int)$_GET['products_id']);
    $clean_special_price zen_get_products_special_price((int)$_GET['products_id']);

    if  (
    $clean_normal_price >= $clean_special_price) {
        
    $rcs_price $clean_special_price;
        }
    if (
    $clean_special_price == ''){
        
    $rcs_price $clean_normal_price;
        }
    ?>

    <?php if((zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping)|| $rcs_price * [COLOR="#FF0000"]1.22 [/COLOR]>=MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN){ ?>
    <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON?></div>
    <?php ?>
    <!--eof free ship icon  -->
    There is an hard coding that I did and it is the VAT adding (1.22 in red)
    It is needed to change this to your vat value or better if some knows how to get the value from the db (i spent hours but I did not make it out) please let me know so the code will be more automated for everyone.

    Ciao from Italy
    enzo

 

 

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