/** * @depends testGetConfigurableAttributesAsArray */ public function testGetProductByAttributes() { $attributes = $this->_model->getConfigurableAttributesAsArray($this->_product); $attribute = reset($attributes); $optionValueId = $attribute['values'][0]['value_index']; $product = $this->_model->getProductByAttributes(array($attribute['attribute_id'] => $optionValueId), $this->_product); $this->assertInstanceOf('Mage_Catalog_Model_Product', $product); $this->assertEquals("simple_{$optionValueId}", $product->getSku()); }
public function getProductByAttributes($attributesInfo, $product = null) { $_result = parent::getProductByAttributes($attributesInfo, $product); if (is_object($_result)) { $_result = Mage::getModel('catalog/product')->load($_result->getId()); } return $_result; }