如何在 magento 块中获取会话数据?

How get session data in magento block?

我正在设置 Magento 会话,但无法在我的块中获取它。

我有控制器,其中会话数据保存到 LB_Session

Mage::getSingleton('customer/session')->setLB_Session(serialize($_SESSION['LB_Session']));

我正在将其放入控制器中。

但是当我尝试将其放入块中时,它不起作用。

我在将产品添加到购物车页面上调用块,调用方式如下

<catalog_product_view>
<reference name="product.info.addtocart">
<block type="lb/lbblock" name="lbregistration_button_lbblock" template="lb/lbregistration_button.phtml" />
<reference name="content" >
<block type="lb/lbblock" name="lbregistration_popup_lbblock" template="lb/lbregistration_popup.phtml" />
</reference>
</reference>
</catalog_product_view>

提前致谢

我认为 setLB_Session() 不是 valid setter name 除非你自己在 customer/session 模型上定义了那个方法。它应该类似于 setLbSession(),然后您可以使用 getLbSession().

在应用程序的其他地方检索它