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

Smarty Assign Problem

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-13-2011, 03:20 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

Unhappy Smarty Assign Problem

I'm editing the products.php file in the cart root directory and have been having some issues outputting variables and the like in the products list.

For testing, in products.php, I have put the folowing:

PHP Code:
$foo 'BAR';
$smarty->assign('foo' $foo); 

Right at the bottom, with the other smarty assigns, then in skin/common_files/customer/main/products_list.tpl, I have put the following:

PHP Code:
{$foo

Right next to where the price is displayed, but alas, nothing shows up. It does not output anywhere on the page at all.
Am I doing something wrong? Can anyone suggest any solutions? I'd appreciate it.

Regards,

- Adam.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote
  #2  
Old 01-13-2011, 04:18 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Smarty Assign Problem

You should make sure that you are editing the right template.

skin/common_files/customer/main/products_list.tpl

The common_files are used if a skin has no specific template... e.g. fashion_mosaic_blue has its own template:
skin/fashion_mosaic_blue/customer/main/products_list.tpl

Thus the directory in green should be the active skin.
__________________
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
  #3  
Old 01-13-2011, 05:05 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

Default Re: Smarty Assign Problem

Thank you for your response.

I am currently using the 3-column template, which has only a couple of files in its directory.

I have edited the products_list.tpl before (to change the "Our Price" text to static text just for that page) and it worked fine, I have also used the {$product.productid} Smarty code in the same file to display the product's ID next to its name (merely as a test) and that has worked too.

I am pretty sure I'm editing the correct file, is there any thing else that may be causing the problem?

Kind Regards,

- Adam.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote
  #4  
Old 01-13-2011, 05:07 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Smarty Assign Problem

you may need to clear the cache - cleanup.php
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 01-13-2011, 05:17 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

Default Re: Smarty Assign Problem

I have done that once or twice, just did it again to make sure and it's still the same.

Seeing as the $foo variable is set in products.php, shouldn't I be able to see it in the debug window in Webmaster Mode, whether it's being echo'd or not? As I don't see it in there either.

Regards,

- Adam.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote
  #6  
Old 01-13-2011, 05:26 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Smarty Assign Problem

Another possible reason is that the variable appears in the code fragment that is not logically "active" on that page.

Have you tried inserting it at the beginning or at the very end of the template?
__________________
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
  #7  
Old 01-13-2011, 07:37 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

Default Re: Smarty Assign Problem

Thanks for your help, qualiteam. Greatly appreciated.
I have resolved this issue now and evrything seems to be in order.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote
  #8  
Old 01-13-2011, 09:03 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Smarty Assign Problem

I'm glad you've found the solutions provided useful.

Thank you.
__________________
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
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:05 PM.

   

 
X-Cart forums © 2001-2020