Note that there are some explanatory texts on larger screens.

plurals
  1. POFinding all products with the same attribute on magento
    primarykey
    data
    text
    <p>`I'm trying to do something that would seem simple but just dosn't work</p> <p>I'm running Magento 1.5.1.</p> <p>I would like to show on the product page all the items that have the same attribute set as the original item. for example:</p> <p>Item A has XYZ attributes, show me all the other items that have xyz attributes.</p> <p>Nothing I've tried worked so far...</p> <p>Thank you</p> <p>EDIT:</p> <p><code> $collection = Mage::getModel('catalog/product')->getCollection(); $collection->addAttributeToSelect('name');<br> $collection->addAttributeToSelect('orig_price'); </p> <p>//filter for products who name is equal (eq) to Widget A, or equal (eq) to Widget B $collection->addFieldToFilter(array( array('name'=>'orig_price','eq'=>'Widget A'), array('name'=>'orig_price','eq'=>'Widget B'),<br> ));</p> <p>foreach ($collection as $product) { //var_dump($product); var_dump($product->getData()); } </code></p> <p>sorry for the code in the comment. I'm new to this forum.</p> <p>EDIT 2: I tried :</p> <pre><code> $collection = Mage::getModel('catalog/product')-&gt;getCollection(); $collection-&gt;addAttributeToSelect('name'); $collection-&gt;addAttributeToSelect('color'); //filter for products who name is equal (eq) to Widget A, or equal (eq) to Widget B $collection-&gt;addAttributeToFilter(array( array('name'=&gt;'color','eq'=&gt;'red') )); foreach ($collection as $product) { //var_dump($product); var_dump($product-&gt;getData()); } </code></pre> <p>and nothing at all showed up</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload