Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Labels in Product description?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-22-2008, 11:55 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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 ... >
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #2  
Old 12-23-2008, 02:59 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Labels in Product description?

http://forum.x-cart.com/showthread.php?t=21027
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 12-23-2008, 03:31 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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?
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #4  
Old 12-23-2008, 03:34 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 12-23-2008, 03:49 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: Labels in Product description?

Ok. I will make a try. Thanks.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #6  
Old 12-23-2008, 11:34 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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?
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #7  
Old 12-23-2008, 11:38 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 12-26-2008, 09:32 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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!
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #9  
Old 01-13-2009, 12:41 PM
 
sbkp sbkp is offline
 

Advanced Member
  
Join Date: Jul 2005
Posts: 83
 

Default 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.
__________________
Gold 4.0.17
On Sale, Smart Search, X-AOM, X-SpecialOffers, XNews, DSEFU, and custom mods/tweaks
Reply With Quote

The following user thanks sbkp for this useful post:
ADDISON (10-28-2012)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:54 PM.

   

 
X-Cart forums © 2001-2020