X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Labels in Product description? (https://forum.x-cart.com/showthread.php?t=44405)

ADDISON 12-22-2008 11:55 PM

Labels in Product description?
 
I have 100 products and in their product description I would like to define a text label. I am pretty sure I will modify the value of this text label in the future. Going and changing a word in 100 products is not the best option.


How can I inserted a variable in product description (html)? Just $lbl_ is enough or including it in <?php ... >

balinor 12-23-2008 02:59 AM

Re: Labels in Product description?
 
http://forum.x-cart.com/showthread.php?t=21027

ADDISON 12-23-2008 03:31 AM

Re: Labels in Product description?
 
Balinor: I know that link, but it is not what I need.

Let be more specific. I will define in language file a new text label for example "Not applicable". This label I want to insert it in Product long description. If I want to change "Not applicable" to "N/A" I should not go to edit every product which has "Not applicable" word in its description. Maybe I don't know which product has that word.

So, any idea?

balinor 12-23-2008 03:34 AM

Re: Labels in Product description?
 
It is what you need. Create a new language variable and insert it in your product description. Alter the description code as mentioned in that thread so that the language variable works in the product description.

ADDISON 12-23-2008 03:49 AM

Re: Labels in Product description?
 
Ok. I will make a try. Thanks.

ADDISON 12-23-2008 11:34 AM

Re: Labels in Product description?
 
Balinor: I made a tried as you suggested. It is not what I needed.

Let me explain you again. Every product has its own description. It is an html text inserted in a form. In this description (html text) I would like to insert a text label that will be easy to change after. For example:

Product long description

"This product has 12 [text_label] ... "

I will use this text_label in more then 60 product descriptions. If I would like to change the value of text_label I should go to Admin -> Language and change the set up value of the label.

I don't understand what you mean to go and change the template. As you may see there is no need to change the template. Only a set up value for a language label.

So, I would like to define a text label in Language and add it in product description. How can I do that?

balinor 12-23-2008 11:38 AM

Re: Labels in Product description?
 
You aren't understanding. That thread I linked is exactly what you need to do. There IS a need to change the product description code in product.tpl so that you can call the newly created smarty language variable, otherwise it will not show the language variable.

ADDISON 12-26-2008 09:32 AM

Re: Labels in Product description?
 
Balinor: Sorry for the misunderstanding. Using the "eval var" in tpl product full description worked great. This is a very good tip. Cheers!

sbkp 01-13-2009 12:41 PM

Re: Labels in Product description?
 
Maybe I missed something, or maybe it's that I'm on an old version. But in 4.0.17, to get access to $lng variables from product descriptions, I needed to insert the following in include/func.php:

after this code
Code:

  $page_content = $templater->get_template_vars("page_content");
  if (!empty($page_content)) {
    if (preg_match_all('/\$lng\.([\w\d_]+)[\}\s`\|]/US', $page_content, $preg))
      $variables = array_merge($variables, $preg[1]);
  }


added the following:

Code:

  $product = $templater->get_template_vars("product");
  if (!empty($product)) {
    if (preg_match_all('/\$lng\.([\w\d_]+)[\}\s`\|]/US', $product['fulldescr'], $preg))
      $variables = array_merge($variables, $preg[1]);
  }


Then I'm able to use any {$lng.xxxxx} in a product full description.


All times are GMT -8. The time now is 12:34 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.