Mage_GoogleBase_Model_Mysql4_Item Class Reference

Inheritance diagram for Mage_GoogleBase_Model_Mysql4_Item:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 loadByProduct ($model)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 34 of file Item.php.


Member Function Documentation

_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

Parameters:
Mage_GoogleBase_Model_Item $model
Returns:
Mage_GoogleBase_Model_Mysql4_Item

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     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:15 2009 for Magento by  doxygen 1.5.8