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

Pass Varialbles from another page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-18-2007, 08:06 AM
 
sharingsunshine sharingsunshine is offline
 

Senior Member
  
Join Date: Aug 2005
Location: Palmyra, VA
Posts: 149
 

Default Pass Varialbles from another page

Hello,

I have a sales page located at http://www.theherbsplace.com/sales.php where each product has a link to a page for more information.

I am trying to get the productcode and amount passed to the page with more info. So, I can then create a buy now button for each sale option available for that product.

I read about {include} can pass varialbles but I am not sure of the syntax of it or if that is the correct approach. I use include to add in content but I only need the variables Is there some way when I am trying to get the amount to display using {include file="currency.tpl" value=$sales[sale].amount} that I can pass the $sales values to the individual product page?

Thanks,

Randal
__________________
***********************
Visit Our Other Web Sites!
∙ Nutritional Herbs and Supplements
<a href="http://www.theherbsplace.com"> The Herbs Place </a>
∙ Frugal Ideas and a Forum To Submit Your Questions
<a href="http://www.thefrugallife.com"> The Frugal Life </a>
∙ Healthy and Natural Pet Products
<a href="http://www.healthypetcorner.com"> Healthy Pet Corner </a>
***********************

Joined 08/02/05
X-Cart Gold Version 4.3.2
Linux RedHat Enterprise
Reply With Quote
  #2  
Old 07-20-2007, 03:19 PM
 
sharingsunshine sharingsunshine is offline
 

Senior Member
  
Join Date: Aug 2005
Location: Palmyra, VA
Posts: 149
 

Default Re: Pass Varialbles from another page

I have taken a tutorial on smarty and the code on the sales.php page shows:

$smarty->assign('main', 'sale_products');
$smarty->display("rjw/specials.tpl");
func_display("customer/home.tpl",$smarty);

I have confirmed the array I need and the values I need thru webmaster mode can be found on the sales.php page but when I click on the links of one of the products the values aren't there. I know I need to set a display page for the smarty variables to be displayed. However, I don't know what page to display the variables at. In my example above I tried the specials.tpl page.

For example, the first link is for a $2 OFF product. When I access that page via webmaster mode the variables aren't present.

Following this tutorial:
http://www.codewalkers.com/c/a/Miscellaneous/Smarty-for-Beginners/1/

It shows the example of using the index.html to display the variable In my example I used the specials.tpl code. In my case what should I put in place of the specials.tpl code?

Please help me with this, I want to understand this concept.

Thanks,

Randal
__________________
***********************
Visit Our Other Web Sites!
∙ Nutritional Herbs and Supplements
<a href="http://www.theherbsplace.com"> The Herbs Place </a>
∙ Frugal Ideas and a Forum To Submit Your Questions
<a href="http://www.thefrugallife.com"> The Frugal Life </a>
∙ Healthy and Natural Pet Products
<a href="http://www.healthypetcorner.com"> Healthy Pet Corner </a>
***********************

Joined 08/02/05
X-Cart Gold Version 4.3.2
Linux RedHat Enterprise
Reply With Quote
  #3  
Old 09-23-2007, 01:29 PM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: Pass Varialbles from another page

Here are some links to other posts that show how to pass a Smarty variable to a PHP page. Hopefully one will do the trick for you:
http://forum.x-cart.com/showthread.php?t=13768
and
http://forum.x-cart.com/showthread.php?t=738

I also successfully passed a variable between PHP and Smarty Template pages via the instructions on my Post #60 in this thread:
http://forum.x-cart.com/showthread.php?t=6888&page=6

In that example, I'm appending the variable onto the end of the URL to get it from one page to another, so it's not safe for any sensitive information, but good for non-descript data.
__________________
X-cart 4.1.10
Reply With Quote
  #4  
Old 09-23-2007, 01:37 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Pass Varialbles from another page

you have the right idea in the original post, but the value needs to match up with the variable you use in the included page

say in the included page the variable you want to use is called $blah, but the variable in the current page you want to pass is $asdf...you would then type {include file="theincludepage.tpl" blah=$asdf}


...unless you want to pass variables between php pages, then you would use x_session_register
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
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 02:46 PM.

   

 
X-Cart forums © 2001-2020