2
votes

Basically i have 3 category pages in Magento these are MEN, WOMEN and ACCESSORIES

Now i added a nivo-slider by editing the customtheme/template/catalog/category/view.phtml

i deleted these parts:

<?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; ?>

and then inserted nivo-slider

<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>

but now my problem is i want a different slider for each category page or similar with the default where the images change for each page but only its a slider. Like when i go to Mens Category it would load the html slider with images of shirts for men and products for women when i go to womens category. I normally could do this in html by just editing each html page but magento is different. I also thought the magento admin would accept codes just like the homepage but it doesnt, it only lets you upload the image you want for that category.

im so bad at explaining but if this would help in explaining with what i'm trying to achieve pls have alook, its not a proper code but pls help me build it

<?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;
    }
?>
1

1 Answers

1
votes

You could have used static blocks to achieve this. Add Javascript/Jquery(Image Slider code) in the head section and call it anywhere on the website.

Use static blocks to feed data to Jquery. After that simply go to your category->display settings->choose the cms block or use custom design. Check out this link

http://benfrain.com/magento-how-to-add-a-jquery-image-and-content-carousel/