I am trying to load a specific virtual products with its custom options, but instead I keep getting an empty array.
My attribute is 'part_identifier' in the attribute set 'boat_part' It is a drop-down type attribute with several options. The option I am trying to pull by is 'Look'.
Here is my code:
$attribute = 'msh_boat_part_identifier';
$boatLookProducts = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter($attribute, array('like'=>'Look'))
->load()
->getItems();
foreach($boatLookProducts as $boatLookProduct)
{
$return[] = array(
"id" => (int)$boatLookProduct->getEntityId(),
"name" => $boatLookProduct->getName(),
"type" => "profile",
"shortDesc" => $boatLookProduct->getShortDescription(),
"desc" => $boatLookProduct->getDescription(),
"active" => ($boatLookProduct->getStatus() === "2" ? false : true)
);
}
echo Mage::helper('pb')->ConvertToJson($return);
In my query for the collection, if I change the array to
->addAttributeToFilter($attribute, array('like'=>'%%'))
it will successfully return all proructs, but I cant get the specific one I want!