Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / How do I add a text statement if a attribute is selected?

How do I add a text statement if a attribute is selected?

Views: 669

Results 1 to 3 of 3
4 Feb 2014, 12:46 PM
#1
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

How do I add a text statement if a attribute is selected?

I have a attribute that requires a file upload.

I would like the product info page to display a general text statement if the attribute is an option on a product.

Example:
I have a attribute Named Your Photo ( required ) on certain products ( Attribute ID 1 )

What I want:
if the attribute is present on the product info page, then the page should display some text.

ie... When Uploading a image, when you select your image from your computer, your upload will begin when you <b>"Add To Cart"</b>. Please do <b>not</b> refresh your page. Depending on the size of the file, it could take a few minutes to complete the upload. When your upload is finished the site will automatically take you to the next page.

I am thinking I could add this statement to the language file "product_info.php" using something like "TEXT_PRODUCT_UPLOAD"
I am wondering what I need to add or change in the "tpl_product_info_display.php"

Any Help would be greatly appreciated

4 Feb 2014, 3:25 PM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: How do I add a text statement if a attribute is selected?

You need to put an if - else statement on the tpl_product_info_display.php

Something like this...

if ($your_photo_attribute == 'Your Photo') {
// print the page
// insert the text you want to see here
} else {
// do not print the page
}

Alternately you may use an existing $variable that looks at the attribute ID

4 Feb 2014, 6:36 PM
#3
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Re: How do I add a text statement if a attribute is selected?

Please forgive my ignorance,,, I have no clue on how to do this... by no means am I a script writer or understand what you just said...

where would I add the information on the page?
if($your_photo_attribute == 'Your Photo'){ - HUH?

I am sorry - I am lost already. :down:

so the line needs to be added - I understand that - but what does the line mean?
$your_photo_attribute --- would that be the attribute ID?
== 'Your Photo' I am assuming that is the Value Name defined the attribute manger?

the next question is where do I put it :blink: