Reversible Option

Locked

Views: 1,143

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
26 Sep 2009, 7:20 PM
#1
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Reversible Option

Greetings;

I have made a new field on the site that is called "reversible" what i would like it to do is that when this field has "Yes" in it, it will show an image on the product page.

The field works very well, it works in the admin section and alike, however i am just trying to get it to show up on the product page, can someone tell me what i have done wrong on this.

tpl_product_info_display.php

<?php if($product_info->fields['products_reversible'] ='Yes') { ?> <div id="reversibleIcon"></div> <?php } ?>

Thanks

27 Sep 2009, 5:36 AM
#2
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

okey, i have it so the image is showing, but there is something wrong with my if statement....

<?php if($product_info->fields['products_reversible'] != "Yes") { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCTS_REVERSIBLE_ICON; ?></div> <?php } ?>
27 Sep 2009, 10:12 AM
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Reversible Option

Is $product_info->fields['products_reversible'] actually set?

You can check by echoing its value to the page. I suspect that it is not. It's value is added from an sql query that is run in modules/pages/product_info/main_template_vars.php.

Basically, this part of this file selects the products are needed for that page and downloads the information for them into $product_info.

So, in order to use $product_info->fields['products_reversible'] you need to add your new field to the sql query. Have you done this?

Nick
iszent.com

27 Sep 2009, 10:38 AM
#4
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

niccol:

Is $product_info->fields['products_reversible'] actually set?

You can check by echoing its value to the page. I suspect that it is not. It's value is added from an sql query that is run in modules/pages/product_info/main_template_vars.php.

Basically, this part of this file selects the products are needed for that page and downloads the information for them into $product_info.

So, in order to use $product_info->fields['products_reversible'] you need to add your new field to the sql query. Have you done this?

nope, i dont think i have..... :(

I just added the following

p.products_reversible, p.products_plussize, p.products_packingtype,

to the line in the file main_template_vars.php

p.products_weight, p.products_height, p.products_width, p.products_length, p.products_itemlength, p.products_itemilength, p.products_itemcir, p.products_itemdia, p.products_rated, p.products_category, p.products_reversible, p.products_plussize, p.products_packingtype,

27 Sep 2009, 10:47 AM
#5
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

Sweet, that worked. Thanks for your help....

here is the complete line for the files incase anyone else wants it.

tpl_product_info_display.php

<?php if ($product_info->fields['products_reversible'] == "Yes" ) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCTS_REVERSIBLE_ICON; ?></div> <?php } ?>

product_info.php

define('TEXT_PRODUCTS_REVERSIBLE_ICON', zen_image(DIR_WS_TEMPLATE_IMAGES . 'reversible.jpg', 'Reversible: All styles denoted by the Reversible icon signifies that the costumes are completely reversible.'));

main_template_vars.php

p.products_reversible, p.products_plussize, p.products_packingtype,

(added to this line;)

p.products_weight, p.products_height, p.products_width, p.products_length, p.products_itemlength, p.products_itemilength, p.products_itemcir, p.products_itemdia, p.products_rated, p.products_category,

27 Sep 2009, 10:53 AM
#6
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

I have now extended the option to include a few more options, however i was wondering how to make them appear on the same line, atm they are

(reversible)
(plussize)
(packing)

i would like it like this;

(reversible) (plussize) (packing)

27 Sep 2009, 11:07 AM
#7
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Reversible Option

Well done - nice one!

As far as the layout goes - it really is going to help to have a URL to see what you are talking about!

In general, however, you want to apply a fixed width to those elements and then apply a float:left (or a class .back which is the zen cart way of doing it ) to those elements.

Try and get a clear:both in after the the elements to clear the floats.

More specific advice depends on a url!

Nick
iszent.com

27 Sep 2009, 11:07 AM
#8
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

I forgot to include an example of the coding;

<?php if ($product_info->fields['products_reversible'] == "Yes" ) { ?> <div id="reversibleIcon"><?php echo TEXT_PRODUCTS_REVERSIBLE_ICON; ?></div> <?php } ?> <?php if ($product_info->fields['products_plussize'] == "Yes" ) { ?> <div id="plussizeIcon"><?php echo TEXT_PRODUCTS_PLUSSIZE_ICON; ?></div> <?php } ?>
27 Sep 2009, 11:10 AM
#9
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

niccol:

Well done - nice one!

As far as the layout goes - it really is going to help to have a URL to see what you are talking about!

In general, however, you want to apply a fixed width to those elements and then apply a float:left (or a class .back which is the zen cart way of doing it ) to those elements.

Try and get a clear:both in after the the elements to clear the floats.

More specific advice depends on a url!

http://www.delightsoftheflesh.com/store/index.php?main_page=product_info&cPath=44_54&products_id=8067

27 Sep 2009, 12:05 PM
#10
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Reversible Option

You need a rule in stylesheet.css that looks like:

#plussizeIcon,#boxIcon{
width:60px;
float:left;
}

You need to add whatever other divs you are using into that rule.

Nick
iszent.com

27 Sep 2009, 12:15 PM
#11
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Reversible Option

Greetings;

Thanks, that actually worked, i thought there might have been something there that make it goto a new line, didnt even think of the stylesheet....

the following is the coding for anyone else that might be interested..

#reversibleIcon,#plussizeIcon,#boxIcon,#hangerIcon{
width:60px;
float:left;
}

Thanks for all your help, been excellent.