我创建了两个页面,第一个是“伦敦”,另一个是“牛津”。我还创建了两个具有相同名称的类别。“Oxford”类别具有标识符(ID:2),“London”具有标识符(ID:4)。我把这个
{{block type="catalog/product_list" category_id="2" template="catalog/product/list.phtml"}}
牛津内容部分中的代码。和
{{block type="catalog/product_list" category_id="4" template="catalog/product/list.phtml"}}
伦敦内容部分的代码。
我想在 list.phtml 上获取当前类别 ID。
我尝试了一些代码,例如
<?php echo $this->getLayer()->getCurrentCategory()->getId();?>
但无论我是在牛津页面还是伦敦页面上,它总是显示类别 id=2