Forums / Templates, Stylesheets, Page Layout / Building an array, Using the Free ship Icon

Building an array, Using the Free ship Icon

Results 1 to 16 of 16
15 May 2014, 23:35
#1
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

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]<!--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 -->[/PHP]

thank you
jimmie
16 May 2014, 00:02
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

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

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]define('FREE_SHIP_ICON_MFRS_EX', ''SFIFloors,Boone,TaylorAdhesives,MegatradeCorporation');[/php] Replace
&& (($manufacturers_name) != 'SFIFloors' && ($manufacturers_name) != 'Boone' && ($manufacturers_name) != 'TaylorAdhesives' && ($manufacturers_name) != 'MegatradeCorporation')
with
&& !in_array($manufacturers_name, explode(',', FREE_SHIP_ICON_MFRS_EX))
16 May 2014, 00:11
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

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.
16 May 2014, 02:53
#4
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

gjh42:

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
16 May 2014, 03:17
#5
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

your code had to many apostrophes, but works good thank you
16 May 2014, 03:34
#6
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

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)?
16 May 2014, 03:43
#7
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

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
16 May 2014, 16:26
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

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]define('FREE_SHIP_ICON_MFRS_EX', 'SFIFloors,Boone,TaylorAdhesives,MegatradeCorporation'); [/PHP] Missed the duplicate quote in the original.
16 May 2014, 18:14
#9
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

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
16 May 2014, 21:54
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

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?
16 May 2014, 22:20
#11
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

db field name in products table is Dropshipper

type varchar
length/values 34
default null

icon 1 only shows when item is $200.00 + and under 20 lbs.Attachment 14070
icon 2 only shows when cart total is $200.00 - and under 20 lbs.(excluding certain DropShipper field names)Attachment 14071
icon 3 only shows on certain DropShipper field namesAttachment 14072


icon4 show only on quantity discount products only.Attachment 14073
16 May 2014, 22:24
#12
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

values that reside in DropShipper field
$advshipper_custom_product_field_options = array(
array(
'value' => 'Stock',
'title' => 'Stock'
),
array(
'value' => 'Crain',
'title' => 'Crain'
),
array(
'value' => 'Gundlach',
'title' => 'Gundlach'
),
array(
'value' => 'MTA',
'title' => 'MTA'
),
array(
'value' => 'TaylorTools',
'title' => 'TaylorTools'
),
array(
'value' => 'Leggett-Platt',
'title' => 'Leggett-Platt'
),
array(
'value' => 'Ready-To-Ship',
'title' => 'Ready-To-Ship'
),
array(
'value' => 'FloorDot',
'title' => 'FloorDot'
),
array(
'value' => 'SouthlandFloors',
'title' => 'SouthlandFloors'
),
array(
'value' => 'Henry',
'title' => 'Henry'
),
array(
'value' => 'Bostik',
'title' => 'Bostik'
),
array(
'value' => 'TaylorAdhesives',
'title' => 'TaylorAdhesives'
),
array(
'value' => 'Roberts',
'title' => 'Roberts'
)
);
16 May 2014, 23:30
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: Building an array, Using the Free ship Icon

So a particular product can have this field null, or one of the names listed. You still didn't say which page you want this icon for.
16 May 2014, 23:32
#14
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

product info is fine
i think it will be to many icons on product listing (Looks Ugly to me
16 May 2014, 23:39
#15
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

label 1 over 200.00 under 20 lbs. stock,crain,Gundlach,taylorTools,floordot, roberts
label 2 under 200.00 under 20 lbs. stock,crain,Gundlach,taylorTools,floordot, roberts
label 3 SouthlandFloors
label 4 Everything else that gets a discount through quantity
21 May 2014, 00:09
#16
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Building an array, Using the Free ship Icon

i have gotten this to work, But dont how to put it in an array or add under $200.00 and under 20 Pounds
[PHP]<?php if(zen_products_lookup((int)$_GET['products_id'], 'DropShipper') == 'Ready-To-Ship') { ?>[/PHP]