Public Member Functions | |
loadByProduct ($model) | |
Protected Member Functions | |
_construct () |
Definition at line 34 of file Item.php.
_construct | ( | ) | [protected] |
Resource initialization
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 36 of file Item.php.
00037 { 00038 $this->_init('googlebase/items', 'item_id'); 00039 }
loadByProduct | ( | $ | model | ) |
Load Item model by product
Mage_GoogleBase_Model_Item | $model |
Definition at line 47 of file Item.php.
00048 { 00049 if (!($model->getProduct() instanceof Varien_Object)) { 00050 return $this; 00051 } 00052 00053 $product = $model->getProduct(); 00054 $productId = $product->getId(); 00055 $storeId = $model->getStoreId() ? $model->getStoreId() : $product->getStoreId(); 00056 00057 $read = $this->_getReadAdapter(); 00058 $select = $read->select(); 00059 00060 if ($productId !== null) { 00061 $select->from($this->getMainTable()) 00062 ->where("product_id = ?", $productId) 00063 ->where('store_id = ?', (int)$storeId); 00064 00065 $data = $read->fetchRow($select); 00066 $data = is_array($data) ? $data : array(); 00067 $model->addData($data); 00068 } 00069 return $this; 00070 }