Hi, I'm not much of a PHP expert, but I want to display the 'Save Price' with each product where ever Price and Special Price are being displayed. I've written code to show the 'Saving Price' like this: (It is the difference of Actual price minus special price). <span class="productSavePrice">You Save: '. $currencies->display_price($product_info['products_price']-$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> PHP: Now I want to add a condition which displays a different tag line for every language. Like for French, I don't want to display 'You Save' as the text but use appropriate text for every language. Currently I'm just using 2 languages, to keep it simple, so you can give a solution for 2 languages only, English and French.
Look at the language code in OSCommerce script and there you will find how to choose different lang. Basically they use a variable in langugae file in each language file and display the value of that variable based on language selected ,so no need to put condition Just in place of text use variable name defined in language file regards Alex
Thanks for the reply. I've now defined the variable in danish.php and english.php files as given below respectively: //currency You Save Text define('CURRENCIES_SAVE_TEXT', 'Besparelse'); //currency You Save Text define('CURRENCIES_SAVE_TEXT', 'You Save'); PHP: I cannot access it directly or display it on the place where I want to: <span class="productSavePrice">.' CURRENCIES_SAVE_TEXT '. $currencies->display_price($product_info['products_price']-$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> PHP: I checked other texts, and they seem to use an array to display them. Will I need to use an array also? Sorry if it is a stupid question.
<span class="productSavePrice">.' CURRENCIES_SAVE_TEXT '. $currencies->display_price($product_info['products_price']-$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> Code (markup): The problem may be that you have wrapped your constant variable in single quotes... Is this what is displayed? : CURRENCIES_SAVE_TEXT $some_number Trying removing the single quotes from CURRENCIES_SAVE_TEXT; i.e. <span class="productSavePrice"> . ' ' . CURRENCIES_SAVE_TEXT . ' ' . $currencies->display_price($product_info['products_price']-$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> Code (markup):
Thanks Mike, I fixed the problem. There was PHP code right after I called the constant: <span class="productSavePrice"> ' . TEXT_YOU_SAVE .' : '. $currencies->display_price($product_info['products_price']-$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; PHP: