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

Smarty Global variables

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-09-2007, 06:46 AM
 
gerrick@ncs-online.com gerrick@ncs-online.com is offline
 

Member
  
Join Date: Sep 2004
Posts: 23
 

Default Smarty Global variables

I'd like to create a new variable usable on any of the xcart pages through smarty. For example, $basicmarkup with the value of 1.2;

Thanks!
__________________
X-Cart version 4.1.6
PHP 5.1.1
MySQL server 5.0.27
MySQL client 4.1.7
Web server Microsoft-IIS/6.0
Operation system Windows
Reply With Quote
  #2  
Old 03-12-2007, 04:56 AM
 
gerrick@ncs-online.com gerrick@ncs-online.com is offline
 

Member
  
Join Date: Sep 2004
Posts: 23
 

Default Re: Smarty Global variables

Anyone?
__________________
X-Cart version 4.1.6
PHP 5.1.1
MySQL server 5.0.27
MySQL client 4.1.7
Web server Microsoft-IIS/6.0
Operation system Windows
Reply With Quote
  #3  
Old 03-12-2007, 07:58 AM
  wjbrewer's Avatar 
wjbrewer wjbrewer is offline
Banned
 

X-Adept
  
Join Date: Feb 2005
Location: Pittsburgh, PA
Posts: 504
 

Default Re: Smarty Global variables

Add this to the auth.php file

PHP Code:
$smarty->assign('basicmarkup'1.2); 

Add it after this code:

PHP Code:
x_session_register("logout_user");
x_session_register("session_failed_transaction");
x_session_register("add_to_cart_time"); 
Reply With Quote
  #4  
Old 03-19-2007, 04:48 AM
 
gerrick@ncs-online.com gerrick@ncs-online.com is offline
 

Member
  
Join Date: Sep 2004
Posts: 23
 

Default Re: Smarty Global variables

Very helpful! This worked! I appreciate the help.

However, I've run into another issue. On the search results page when in debug mode it does not show any information about the user. What i'm trying to do is this.


{if $customer_info.membership eq "GSA"}
GSA Price:<br />
{math equation="price*markup" price=$products[product].taxed_price markup=$gsamarkup format="%.2f" assign=gsaprice}

{include file="currency.tpl" value=$gsaprice plain_text_message=true}
__________________
X-Cart version 4.1.6
PHP 5.1.1
MySQL server 5.0.27
MySQL client 4.1.7
Web server Microsoft-IIS/6.0
Operation system Windows
Reply With Quote
  #5  
Old 03-20-2007, 04:20 AM
 
gerrick@ncs-online.com gerrick@ncs-online.com is offline
 

Member
  
Join Date: Sep 2004
Posts: 23
 

Default Re: Smarty Global variables

bump
__________________
X-Cart version 4.1.6
PHP 5.1.1
MySQL server 5.0.27
MySQL client 4.1.7
Web server Microsoft-IIS/6.0
Operation system Windows
Reply With Quote
  #6  
Old 09-06-2007, 05:19 PM
 
espresso espresso is offline
 

eXpert
  
Join Date: Apr 2007
Location: Ontario, Canada
Posts: 227
 

Default Re: Smarty Global variables

Quote:
Originally Posted by wjbrewer
Add this to the auth.php file

PHP Code:
$smarty->assign('basicmarkup'1.2); 

Add it after this code:

PHP Code:
x_session_register("logout_user");
x_session_register("session_failed_transaction");
x_session_register("add_to_cart_time"); 

I can't get variables to show it's modified value in other templates. ex:

in template_decide.tpl:

Code:
{if $customer eq "A"} {assign var="basicmarkup" value=1.4} {else} {assign var="basicmarkup" value=1.6} {/if}

and then I use product.tpl to display the result like:

Code:
markup: {$basicmarkup}

The output will be "markup: 1.2" as it is assigned with $smarty->assign('basicmarkup', 1.2) in auth.php

How do I pass the variable between templates with a new modified value ?
__________________
Rene
End user - merchant
In the upgrade process 4.6.6 to 5.4.x


Mods I miss in 5.4.x:
xCMS, Create-A-Sale, On-Sale AC, Kit Builder AC, Manufacturer-A-Z BCSE, Product-Bundle BCSE, Pre-Order BCSE, Customer Quotes BCSE
Reply With Quote
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 07:44 AM.

   

 
X-Cart forums © 2001-2020