/** * Return scope values for attribute and website * * @param Mage_Eav_Model_Attribute $object * @return array */ public function getScopeValues(Mage_Eav_Model_Attribute $object) { $adapter = $this->_getReadAdapter(); $bind = array('attribute_id' => (int) $object->getId(), 'website_id' => (int) $object->getWebsite()->getId()); $select = $adapter->select()->from($this->_getEavWebsiteTable())->where('attribute_id = :attribute_id')->where('website_id = :website_id')->limit(1); $result = $adapter->fetchRow($select, $bind); if (!$result) { $result = array(); } return $result; }
/** * Load counfigurable attribute by product and product's attribute * * @param Mage_Catalog_Model_Product $product * @param Mage_Eav_Model_Attribute $attribute */ public function loadByProductAndAttribute($product, $attribute) { $id = $this->_getResource()->getIdByProductIdAndAttributeId($this, $product->getId(), $attribute->getId()); if ($id) { $this->load($id); } }