• Register
Plug-in Tutorial Build an EC-CUBE plug-in

Top Commentators

114

1

EC Mike

SHOGUNSHOGUN

32

2

hrbabu

SAMURAISAMURAI

29

3

Sumant Jha

SAMURAISAMURAI

29

4

justcubed

SAMURAISAMURAI

21

5

Ashok Kafle

SAMURAISAMURAI

21

6

shahith

SAMURAISAMURAI

14

7

Jeemusu

KABUKIKABUKI

14

8

Yangsin

KABUKIKABUKI

9

9

Zaw Hlaing Bwar

GEISYAGEISYA

8

10

Fei Liu

GEISYAGEISYA

Ranking Key

  • FUJISANFUJISAN1,000+ posts
  • SAKURASAKURA500+ posts
  • SHOGUNSHOGUN100+ posts
  • NINJYANINJYA50+ posts
  • SAMURAISAMURAI20+ posts
  • KABUKIKABUKI10+ posts
  • GEISYAGEISYALess than 10 posts

View Session value in smarty file

+2 votes
Will you please tell me how to view session value in smarty file.

For eg. $this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity;   //addProductCharCode function in SC_CartSession.php;

In above line value is set to session and how to view above line value in smarty file;

Thanks in advance.
asked 2013-05-21 by shahith (850 points) SAMURAISAMURAI
edited 2013-05-21 by shahith

1 Answer

+1 vote

Which template do you want to access the session from (cart.tpl?), and can you add some more details about the functionality you hope to achieve?

Session variables can be accessed in templates using smarty:

<!--{$smarty.session.session_variable_name}-->

In the case of the cart session you would probably have to loop though $smarty.session.cart which is  seperated by the productTypeId (downloadable products and normal products) into two sub arrays. 


The productTypeId will either be 1 or 2:

$smarty.session.cart.1 (downloadable products array)
$smarty.session.cart.2  (normal products array)


If you are indeed attempting to access these values on the  cart.tpl template, you may be better off accessing them via the $cartItems array that is passed to the template via the LC_Page_Cart.php class. It contains the same values.

<!--{foreach from=$cartItems[$productTypeId] item=item}-->
   <!--{$item.quantity}-->
<!--{/foreach}-->
 
answered 2013-05-21 by Jeemusu (690 points) KABUKIKABUKI
edited 2013-05-21 by Jeemusu
James
    Thank you very much for answer.
...