0

Sorry for confusing in Title. I added some code in "category/catalog/view.phtml page" to display the Sub category and the description.

<ul>
    <?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
        <li>
            <a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a>
            <? $current_cat = Mage::getModel('catalog/category')->load($_subcat->getId()); ?>
            <?php if($current_cat->getId()) { ?>
                <p><?php echo $current_cat->getDescription(); ?></p> 
            <?php }?>
            <a href="">Read More</a>
        </li>
    <?php endforeach ?>
</ul>

But now i want to give an link to the "Read More", so that i can create the page for display more description about the category. After that i want to give the <?php echo $_subcat->getUrl() ?> link for displaying the category product listing page as the default magento. Is it possible by creating a .phtml page? If yes, how can i give the link to the .phtml page.

1
  • Hey Ranjit, did you manage to resolve the issue? Commented Oct 7, 2013 at 8:42

1 Answer 1

1

One way to go about this is to add a new attribute to your categories, let's call it 'read more page' and fill that as a dropdown with all the CMS pages. The admin user would be able to choose a CMS page that he has created with more information about the category.

This approach would require minimal coding. Some documentation that might help you create something like this

Adding category attribute

Attribute options dropdown

Now you can retrieve the ID of the CMS page in the view.phtml, load the CMS page and retrieve a link to this page to display

<?php if ((int)$_category->getData('read_more_page')): ?>
<a href="<?php echo Mage::helper('cms/page')->getPageUrl((int)$_category->getData('read_more_page')); ?>"><?php $this->__('Read more');?></a>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.