I constructed a widget where you can input product sku's and then get a small preview.

Since more and more Elements are required, I was thinking of using the /app/design/frontend/base/default/template/catalog/product/list.phtmlto show within the widget. That would be much easier then calling attribute by attribute again an designing everything allover.

So I have built an array like this:

$_products = array($product_1,$product_2,$product_3,$product_4);
$_products =Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('sku', array('in' => $_products))
->addAttributeToFilter('status', 1)

Now I want to output this within a list.phtml file. Everything described so far happens in the widgets phtml file.

Is there a way to use list.phtml now? I tried with:

   <?php echo $_product->getChildHtml('prices'); ?>

Bu I guess I am still missing this block within the widget.

How do I load list.phtml into a new block which is working within the widgets?

EDIT: I tried this too

<?php echo $_product->getPriceHtml(); ?>

But it doesn't work.

  • You can extend Mage_Catalog_Block_Product_Abstract to use list.phtml file
    – Mufaddal
    Jul 29 '15 at 10:52
  • Hi Mufaddal, this sounds intresting. Could you explain a bit more? Or give a url hint? Jul 29 '15 at 12:09
  • irnux.com/blog/article/…, may be this link will useful to you.
    – Mufaddal
    Jul 31 '15 at 10:53

$product_block = new Mage_Catalog_Block_Product;

echo $product_block->getPriceHtml($product); // $product is product object

  • I get Fatal error: Call to a member function getStoreLabel() on a non-object in app/design/frontend/rwd/default/template/catalog/product/price.phtml on line 53 Jul 29 '15 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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