Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Building an array, Using the Free ship Icon

    i want to show 3 different free ship images on certain products by conditions. see below

    i duplicated this 3 times to achieve this.
    in this instance i have to add all manufacturers that i dont want the image to show on.
    how can i build an array to simplify this?
    instead of using manufacturers_name, how can i use this my custom product field DropShipper?


    PHP Code:
    <!--bof free ship icon2  -->
    <?php if(zen_products_lookup((int)$_GET['products_id'], 'products_price') <= 199 && ($products_weight) <=20 && (($manufacturers_name) != SFIFloors && ($manufacturers_name) != Boone && ($manufacturers_name) != TaylorAdhesives && ($manufacturers_name) != MegatradeCorporation) || zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
    <div id="freeShippingIcon2"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON2?></div>
    <?php ?>
    <!--eof free ship icon2  -->
    thank you
    jimmie

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Building an array, Using the Free ship Icon

    First off, the manufacturer names need to be treated as text and not as PHP entities:
    PHP Code:
    <!--bof free ship icon2  -->
    <?php if(zen_products_lookup((int)$_GET['products_id'], 'products_price') <= 199 && ($products_weight) <=20 && (($manufacturers_name) != 'SFIFloors' && ($manufacturers_name) != 'Boone' && ($manufacturers_name) != 'TaylorAdhesives' && ($manufacturers_name) != 'MegatradeCorporation') || zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
    <div id="freeShippingIcon2"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON2?></div>
    To put the manufacturer names in an array and parse that, define a constant in a language define file (pick an appropriate/related one, or make a new file in /includes/languages/your_language/extra_definitions/your_template/free_ship_icon_defines.php.
    PHP Code:
    define('FREE_SHIP_ICON_MFRS_EX'''SFIFloors,Boone,TaylorAdhesives,MegatradeCorporation'); 
    Replace
    && (($manufacturers_name) != 'SFIFloors' && ($manufacturers_name) != 'Boone' && ($manufacturers_name) != 'TaylorAdhesives' && ($manufacturers_name) != 'MegatradeCorporation')
    with
    && !in_array($manufacturers_name, explode(',', FREE_SHIP_ICON_MFRS_EX))

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Building an array, Using the Free ship Icon

    If you want to use the value of the dropshipper field dynamically (if different manufacturers need to be excluded or included for different products), that becomes more complicated, and we need more detail on where the field is, how it is populated and what its values can be.

    In general, you would have to look up the values (once for a page, or for each product??) and insert those values into an array which you could then use as described above.

  4. #4
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: Building an array, Using the Free ship Icon

    Quote Originally Posted by gjh42 View Post
    If you want to use the value of the dropshipper field dynamically (if different manufacturers need to be excluded or included for different products), that becomes more complicated, and we need more detail on where the field is, how it is populated and what its values can be.

    In general, you would have to look up the values (once for a page, or for each product??) and insert those values into an array which you could then use as described above.
    i want to use advance shipper added funtionality Product field that resides in the product table
    the values can be anything i have there

  5. #5
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: Building an array, Using the Free ship Icon

    your code had to many apostrophes, but works good thank you

  6. #6
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: Building an array, Using the Free ship Icon

    on 1 i want to also remove products price and weight and show only on certain manufacturers
    heres the deal

    icon1 shows when over $200.00 and under 20 lbs. exclude certain manufacturers
    icon2 shows when under $200.00 and under 20 lbs. exclude certain manufacturers
    icon3 when under $200.00 and include certain manufacturers ---How to include and remove products price and only show on certain manufacturers
    if (in array)?

  7. #7
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: Building an array, Using the Free ship Icon

    1 more thing.
    when excluding whole manufacturers it also excludes items i want to show another icon for, how to also exclude items from that manufacturers lists
    thank you for all your help

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Building an array, Using the Free ship Icon

    Your include/exclude criteria appear to be very complex, and I'm not certain exactly what you want to show or not in which circumstances. Do you have different exclude lists, or are those all the same? Is the include list the same as the exclude list, or something else?
    when excluding whole manufacturers it also excludes items i want to show another icon for, how to also exclude items from that manufacturers lists
    Yes, the define should have been
    PHP Code:
    define('FREE_SHIP_ICON_MFRS_EX''SFIFloors,Boone,TaylorAdhesives,MegatradeCorporation'); 
    Missed the duplicate quote in the original.

  9. #9
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: Building an array, Using the Free ship Icon

    Advanced shipper by ceon will let me choose shipping by manufacturer.
    the method title is saved in the db.
    how can i write the code to look for method title and if (in db) show label 1
    else if show label 2
    else show label 3

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Building an array, Using the Free ship Icon

    You have never said whether you want these icons on the product listing page or the product info page, or both. The lookup would be more complex for the listing page, as it would have to be done in turn for each product.
    What is the database field name where the shipping method is stored, and what are the values it can have? Can it be null? What icon(s) do you want to show for what values?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Need some help building a looping SQL query to fill an array.
    By Chris Stackhouse in forum General Questions
    Replies: 2
    Last Post: 3 Sep 2015, 08:19 PM
  2. Reworking Free Ship Icon to my needs
    By jimmie in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 18 Apr 2014, 03:14 AM
  3. always free shipping icon in featured/special on the main page
    By Jerry5763837 in forum General Questions
    Replies: 10
    Last Post: 10 Mar 2009, 05:00 AM
  4. 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
  5. Missing Free Ship Icon
    By Decostyle in forum Addon Templates
    Replies: 1
    Last Post: 19 May 2008, 04:59 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR