<?php $productIds = array(1,2); $_productCollection = Mage::getModel('catalog/product')->getCollection(); $_productCollection->addAttributeToFilter('status', 1); //enabled $_productCollection->addAttributeToFilter('visibility', 4); //catalog, search $_productCollection->addAttributeToFilter('entity_id', array('in' => $productIds)); ?> <?php foreach ($_productCollection as $_product) { $model = Mage::getModel('catalog/product'); $product_id = $_product->getId(); $_product = $model->load($product_id); //echo $_product->getPrice().""; //echo $_product->getName().""; $_image=Mage::getModel('catalog/product')->load($product_id); //echo Mage::helper('catalog/image')->init($_image, 'image').""; ?> <div class="feature-product"> <div class="feature-product-price"><?php echo $_product->getPrice(); ?></div> <div class="feature-product-name"><?php echo $_product->getName(); ?></div> <div class="feature-product-image"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo Mage::helper('catalog/image')->init($_image, 'image')->resize(200,200); ?>"></a></div> </div> <?php } ?>
This blog is all about magento , php javescript ,mysql codes. In this i am trying to post the posts which i really feel to have these codes always with me and i am trying to publish most challenging codes which we need to use in daily development. I personally sometime needs to spent most of times to get the idea about these codes on net,thats why i thought to put all these codes on one place and i am trying to keep this work going on and in simple way which can help the communty
Thursday, 4 December 2014
Magento:: Product Collection with specific ids
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment