I am new to Magento so please forgive me if my question sounds foolish. I have the default Madison Island template which was there when i installed magento. I noticed that if you are looking on product list under men/ women section than it shows (View Details) on the listing enter image description here where as if you look under Accessories it shows (Add to Cart). enter image description here

I turned on Template Path Hints to check which file controls the Display ( with google's help)

and the file is


So my question is how does the same file show two different displays( View Products and Add to Chart )??

Or is there any thing else that controls such output ?

1 Answer 1


Well, the answer can be found in the template file, lines 89 to 95:

<?php if(!$_product->canConfigure() && $_product->isSaleable()): ?>
    <p class="action"><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php elseif($_product->getStockItem() && $_product->getStockItem()->getIsInStock()): ?>
    <p class="action"><a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a></p>
<?php else: ?>
    <p class="action availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>

The blazer is a configurable product, so you need to specify its options (e.g. size or colour) to add it to your cart. This can be done from the detail page.

The sunglasses are a simple product, and you can add them to your cart directly.

There would be a lot more to say about this, but I hope I answered your question more or less.

  • thanks a lot for the answer ... i just figured it out some time ago while i was going through every line of the code but I really appreciate your help. M new to magento so I appreciate all your help. Thanks again. Apr 21, 2015 at 21:45

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.