我想在产品页面上显示magento静态块的内容,也可能在产品列表页面上显示.
静态块仅对于LOGGED IN USERS加入特定组(例如logged in,内部reseller,general而clients不是内部testing或内部的用户)可见guests.
PS我需要在侧边栏中添加它,我有分层导航.
$array =[1,2,3]; //your group ids array
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
$groupId = $customerData->getGroupId();
if(in_array($groupId,$array)){
echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml();
}
}
Run Code Online (Sandbox Code Playgroud)
将上面的代码放在下面的模板名称中
前端/[您的主题]/[您的包]/catalog/product/view.phtml
前端/[您的主题]/[您的包]/catalog/product/list.phtml
前端/[您的主题]/[您的包]/catalog/layer/view.phtml
| 归档时间: |
|
| 查看次数: |
1521 次 |
| 最近记录: |