2012-10-15 60 views
2

基本上我有在Magento 3個類別頁面這些是男人,女人和配件在Magento添加爲每個類別頁面不同的滑塊

現在我通過編輯customtheme /模板/目錄/類別添加NIVO滑塊/ view.phtml

我刪除這些部分:

<?php 
$_helper = $this->helper('catalog/output'); 
$_category = $this->getCurrentCategory(); 
$_imgHtml = ''; 
if ($_imgUrl = $_category->getImageUrl()) { 
    $_imgHtml = '<p class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></p>'; 
    $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); 
} 

>

<?php if($_imgUrl): ?> 
    <?php echo $_imgHtml ?> 
<?php endif; ?> 

,然後插入NIVO滑塊

<div class="slider-wrapper theme-dark"> 
<div id="slider" class="nivoSlider"> 
    <img src="<?php echo $this->getSkinUrl('images/banner1.jpg') ?>" alt="" /> 
    <img src="<?php echo $this->getSkinUrl('images/banner2.png') ?>" alt="" /> 
    <img src="<?php echo $this->getSkinUrl('images/banner3.jpg') ?>" alt="" /> 
    <img src="<?php echo $this->getSkinUrl('images/banner4.png') ?>" alt="" /> 
</div> 

但現在我的問題是,我想每個類別頁面或不同的滑塊與其中圖像的每一頁變化,但只有它一個默認的相似滑塊。就像當我去男裝類別時,它會加載男士襯衫圖片和女士產品的html滑塊,當我去女裝類別。我通常可以通過編輯每個html頁面來做到這一點,但magento是不同的。我也認爲magento管理員會接受像首頁一樣的代碼,但它不會,它只會讓你上傳你想要的圖片。

IM在解釋如此糟糕,但如果這將有助於在我想要實現PLS有alook,它不是一個正確的代碼解釋,但請幫助我建立它

<?php 
$_category = $this->getCurrentCategory(); 
$_accessories = (code for nivoslider accessories a link to an external phtml file) 
$_mens = (code for nivoslider mens a link to an external phtml file) 
$_womens = (code for nivoslider womens or a link to an external phtml file) 

if ($_category == accessories) 
    { 
    echo $_accessories; 
    } 
    elseif ($_category == mens) 
    { 
    echo $_mens; 
    } 
    else 
    { 
    echo $_women; 
    } 
?> 

回答

相關問題