Public Member Functions | |
loadProductPrices ($product, $attribute) | |
deleteProductPrices ($product, $attribute) | |
insertProductPrice ($product, $data) | |
Protected Member Functions | |
_construct () |
Definition at line 35 of file Tierprice.php.
_construct | ( | ) | [protected] |
Resource initialization
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 38 of file Tierprice.php.
00039 { 00040 $this->_init('catalog/product_attribute_tier_price', 'value_id'); 00041 }
deleteProductPrices | ( | $ | product, | |
$ | attribute | |||
) |
Definition at line 70 of file Tierprice.php.
00071 { 00072 $condition = array(); 00073 00074 if (!$attribute->isScopeGlobal()) { 00075 if ($storeId = $product->getStoreId()) { 00076 $condition[] = $this->_getWriteAdapter()->quoteInto('website_id IN (?)', array(0, Mage::app()->getStore($storeId)->getWebsiteId())); 00077 } 00078 } 00079 00080 $condition[] = $this->_getWriteAdapter()->quoteInto('entity_id=?', $product->getId()); 00081 00082 $this->_getWriteAdapter()->delete($this->getMainTable(), implode(' AND ', $condition)); 00083 return $this; 00084 }
insertProductPrice | ( | $ | product, | |
$ | data | |||
) |
Definition at line 86 of file Tierprice.php.
00087 { 00088 $data['entity_id'] = $product->getId(); 00089 $this->_getWriteAdapter()->insert($this->getMainTable(), $data); 00090 return $this; 00091 }
loadProductPrices | ( | $ | product, | |
$ | attribute | |||
) |
Load product tier prices
Mage_Catalog_Model_Product | $product | |
Mage_Catalog_Model_Resource_Eav_Attribute | $attribute |
Definition at line 50 of file Tierprice.php.
00051 { 00052 $select = $this->_getReadAdapter()->select() 00053 ->from($this->getMainTable(), array( 00054 'website_id', 'all_groups', 'cust_group' => 'customer_group_id', 00055 'price_qty' => 'qty', 'price' => 'value' 00056 )) 00057 ->where('entity_id=?', $product->getId()) 00058 ->order('qty'); 00059 if ($attribute->isScopeGlobal()) { 00060 $select->where('website_id=?', 0); 00061 } 00062 else { 00063 if ($storeId = $product->getStoreId()) { 00064 $select->where('website_id IN (?)', array(0, Mage::app()->getStore($storeId)->getWebsiteId())); 00065 } 00066 } 00067 return $this->_getReadAdapter()->fetchAll($select); 00068 }