0
我試圖在產品屬於某個類別時在產品頁面上顯示通知。丹麥語版本停止並僅加載半頁。瑞典版本似乎工作完美?!我的Magento安裝不會在日誌中顯示任何內容。需要在產品頁面上顯示通知,針對特定類別的產品
有沒有更好的方法來實現這一目標?
www.alldo.dk /時尚角度白/不工作!
www.alldo.se /時尚角度白/工作!
<!-- SHOW NOTICE -->
<?php
### GET THE FIRST CATEGORY ID FOR THIS PRODUCT ###
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds)){
$firstCategoryId = $categoryIds[0];
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
}
### ONLY RUN ON PRODUCT PAGES ###
if($this->getRequest()->getModuleName() == 'catalog' && $this->getRequest()->getControllerName() == 'product'){
### SHOW CORRECT NOTICE FOR EACH STORE ###
if (Mage::app() -> getStore() -> getCode() == 'domain_com' && $_category -> getId() == 5){
echo 'An important notice ...';
}
if (Mage::app() -> getStore() -> getCode() == 'domain_org' && $_category -> getId() == 5){
echo 'An important notice ...';
}
}
?>
<!-- SHOW NOTICE -->
在此先感謝!