get template variables on tpl

Hi,



I am working on the template in cs-cart.

This is the feature i want to implement, i want to add my own script(preivew.php) to preview songs on each music product(like amazon). so my approach will be adding the following include block within customer product_details.tpl

{php}

$test = ‘{$product.product_code}’;

$url = “http://localhost/cscart/preview.php?product=”.$product;

include $url;

{/php}



Here is the problem … i cannot retrieve the product code within that php block. is any way i can work around?



Please give me some advice, thanks!

Tommy

[quote name=‘diskfaktory’]

{php}

$test = ‘{$product.product_code}’;

$url = “http://localhost/cscart/preview.php?product=”.$product;

include $url;

{/php}

[/QUOTE]




{assign var=smarty_var_get value=$product.product_code}

{php}
$smarty_var = $this->get_template_vars('smarty_var_get');
$url = "http://localhost/cscart/preview.php?product=".$smarty_var;
include $url;
{/php}




there ya go buddy





i know this is only example code, but you should refrain from using static links…make your code robust and dynamic so it can be transfered to another server in the event of any issues you may have…this way you dont have to edit every file and static linking…make sense?

thanks! this is exactly what i want!

:stuck_out_tongue_winking_eye: of course it is…lol i only post “good” code on here

Hello,



I have a similar issue that maybe you could help me with.



I am trying to add some extra functionality to the credit card payment method I use. I have chosen the deltapay external processor. I need to add an extra option. Once a customer chooses credit card payment method a select box must show up so he can select the number of installments(number of months that his card will pay the cost) he wants.

I manage to do this by creating a custom_template.tpl(html code with a tag) in skins/[CUSTOMER_ACTIVE_SKIN]customer/views/orders/components/payments directory and assigned it in the cscart_payment_processors database table with the deltapay row, so any other external processor which uses cc_outside.tpl not to be affected.

So when someone selects credit card payment a select box field shows up. But my problem is how can I post this selection to the deltapay.php located in [root]/payments directory so the deltapay.php can send it to the bank?

Should I create a variable? How?

Should I use cookies or store it to the database?

I am not familiar with any of these three solutions…



I need a hint :confused:



thank you