View Single Post
  #2  
Old 11-17-2011, 12:08 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How can I use language variable in Extra Fields?

Unfortunately it is not possible in the default X-Cart.
But this feature can be custom programmed.

You should alter the "modules/Extra_Fields/extra_fields.php" script and replace this code:
PHP Code:
$smarty->assign('extra_fields'$extra_fields); 
with this one:
PHP Code:
if (in_array(AREA_TYPE, array('C''B'))) {
    foreach (
$extra_fields as $ef_k=>$ef_v) {
        if (
preg_match("/\{[$]{1}lng\.([a-z_]+)+\}/i"$extra_fields[$ef_k]['field_value'], $match)) {
            
$extra_fields[$ef_k]['field_value'] = str_replace($match[0], func_get_langvar_by_name($match[1]), $extra_fields[$ef_k]['field_value']);
        }
    }
}
$smarty->assign('extra_fields'$extra_fields); 

Note: use FTP to edit the PHP scripts.

Alternatively you can apply the attached Patch.

After the patch is applied you should be able using e.g. "{$lng.lbl_login}" as extra field value.
Attached Files
File Type: txt DIFF.patch.txt (538 Bytes, 93 views)
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote