Mage_Weee_Model_Mysql4_Attribute_Backend_Weee_Tax Class Reference

Inheritance diagram for Mage_Weee_Model_Mysql4_Attribute_Backend_Weee_Tax:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 loadProductData ($product, $attribute)
 deleteProductData ($product, $attribute)
 insertProductData ($product, $data)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 36 of file Tax.php.


Member Function Documentation

_construct (  )  [protected]

Resource initialization

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 38 of file Tax.php.

00039     {
00040         $this->_init('weee/tax', 'value_id');
00041     }

deleteProductData ( product,
attribute 
)

Definition at line 65 of file Tax.php.

00066     {
00067         $condition = array();
00068 
00069         if (!$attribute->isScopeGlobal()) {
00070             if ($storeId = $product->getStoreId()) {
00071                 $condition[] = $this->_getWriteAdapter()->quoteInto('website_id IN (?)', array(0, Mage::app()->getStore($storeId)->getWebsiteId()));
00072             }
00073         }
00074 
00075         $condition[] = $this->_getWriteAdapter()->quoteInto('entity_id=?', $product->getId());
00076         $condition[] = $this->_getWriteAdapter()->quoteInto('attribute_id=?', $attribute->getId());
00077         
00078         $this->_getWriteAdapter()->delete($this->getMainTable(), implode(' AND ', $condition));
00079         return $this;
00080     }

insertProductData ( product,
data 
)

Definition at line 82 of file Tax.php.

00083     {
00084         $data['entity_id'] = $product->getId();
00085         $data['entity_type_id'] = $product->getEntityTypeId();
00086 
00087         $this->_getWriteAdapter()->insert($this->getMainTable(), $data);
00088         return $this;
00089     }

loadProductData ( product,
attribute 
)

Definition at line 43 of file Tax.php.

00044     {
00045         $select = $this->_getReadAdapter()->select()
00046             ->from($this->getMainTable(), array(
00047                 'website_id',
00048                 'country',
00049                 'state',
00050                 'value'
00051             ))
00052             ->where('entity_id=?', $product->getId())
00053             ->where('attribute_id=?', $attribute->getId());
00054         if ($attribute->isScopeGlobal()) {
00055             $select->where('website_id=?', 0);
00056         }
00057         else {
00058             if ($storeId = $product->getStoreId()) {
00059                 $select->where('website_id IN (?)', array(0, Mage::app()->getStore($storeId)->getWebsiteId()));
00060             }
00061         }
00062         return $this->_getReadAdapter()->fetchAll($select);
00063     }


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

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