将变量从内联块传递到 magento 中的模板文件
Pass variable from inline block to template file in magento
我在magento首页有内容
{{block type="catalog/navigation" template="catalog/navigation/sub_navigation.phtml"}}
这是调用给定父类别 ID 的一组子类别。
现在我想影响我的 $parent_category
已经从这个给定的块。我找到了 How to pass variable from block to phtml in magento 但它们没有显示相同的表示法。
如何将 setData
动作集成到给定的块表示法中?
感谢您的帮助!
您可以像下面提到的方法一样传递数据
{{block type="catalog/product_list" name="Custom Block" category_id="68" column_count="3" product_count="3" template="catalog/navigation/sub_navigation.phtml"}}
之后在 phtml 文件中你可以通过下面提到的方法获取数据
$this->getCategoryId();
or $this->getData('category_id');
谢谢。
我在magento首页有内容
{{block type="catalog/navigation" template="catalog/navigation/sub_navigation.phtml"}}
这是调用给定父类别 ID 的一组子类别。
现在我想影响我的 $parent_category
已经从这个给定的块。我找到了 How to pass variable from block to phtml in magento 但它们没有显示相同的表示法。
如何将 setData
动作集成到给定的块表示法中?
感谢您的帮助!
您可以像下面提到的方法一样传递数据
{{block type="catalog/product_list" name="Custom Block" category_id="68" column_count="3" product_count="3" template="catalog/navigation/sub_navigation.phtml"}}
之后在 phtml 文件中你可以通过下面提到的方法获取数据
$this->getCategoryId();
or $this->getData('category_id');
谢谢。