基本上我有在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;
}
?>