Skip to main content

Posts

Showing posts from April, 2015

Output more than one image per product on list (category page) of Magento.

//get images for product $product = Mage::getModel('catalog/product')->load($_product->getId()); $helper = Mage::Helper('catalog/image'); foreach ($product->getMediaGalleryImages() as $image) {     echo "<img src='" . $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $image->getFile())->resize(243) . "' />"; } ?>

Magento - Ajax add to cart and quantity box in list.phtml

 To add quantity box with increment + and - and also using ajax add to cart, you should first take the quantity increment box with CSS styling and also need to include a dynamic form (multiple forms per product) as shown in the below code : <ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">   <?php $i=0; foreach ($_productCollection as $_product): ?>   <?php if ($i++%$_columnCount==0): ?>   <?php endif ?>   <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">     <form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>       <script type="text/javascript">