Zen Cart Logo
Forums / General Questions / Conditionally changing some text based on product ID...

Conditionally changing some text based on product ID...

Locked

Views: 1,353

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
24 Apr 2007, 9:24 PM
#1
aaelghat avatar

aaelghat

Zen Follower

Join Date:
Feb 2007
Posts:
100
Plugin Contributions:
0

Conditionally changing some text based on product ID...

Hi, let's say I want to conditionally change some text in english.php depending on the product ID. For example, let's say that for most products, the "Add to Cart" text is fine, but for two products (product ID's 13 and 16) I'd want it to say "Enter months of service". Here's the line from english.php...

define('PRODUCTS_ORDER_QTY_TEXT','Add to Cart: ');

How would I construct my code to make the line above conditional on product ID? I'm not too clear on the syntax. Thanks!

24 Apr 2007, 9:39 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Conditionally changing some text based on product ID...

Changing the define in english.php would probably not be practical.

What would be practical is to make another define in english.php:

define('PRODUCTS_ORDER_QTY_TEXT_ALT','Enter months of service');

and use an if test to determine which one to use for input. Depending on the exact circumstances of use, you might need to set a variable like $qty_text_specific to the proper constant value just before use, and substitute the variable for the constant in PHP statements.

You can use the Developers Toolkit in admin > Tools to find all files where PRODUCTS_ORDER_QTY_TEXT is used.