Public Member Functions | |
loadByParam (Mage_Core_Model_Abstract $object) | |
deleteCustomer (Mage_Core_Model_Abstract $object, $customerId, $websiteId) | |
Protected Member Functions | |
_construct () | |
_beforeSave (Mage_Core_Model_Abstract $object) | |
_getAlertRow (Mage_Core_Model_Abstract $object) |
Definition at line 35 of file Stock.php.
_beforeSave | ( | Mage_Core_Model_Abstract $ | object | ) | [protected] |
Perform actions before object save
Varien_Object | $object |
Reimplemented from Mage_Core_Model_Mysql4_Abstract.
Definition at line 42 of file Stock.php.
00043 { 00044 if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) { 00045 if ($row = $this->_getAlertRow($object)) { 00046 $object->addData($row); 00047 $object->setStatus(0); 00048 } 00049 } 00050 if (is_null($object->getAddDate())) { 00051 $object->setAddDate(Mage::getModel('core/date')->gmtDate()); 00052 $object->setStatus(0); 00053 } 00054 return parent::_beforeSave($object); 00055 }
_construct | ( | ) | [protected] |
Resource initialization
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 37 of file Stock.php.
00038 { 00039 $this->_init('productalert/stock', 'alert_stock_id'); 00040 }
_getAlertRow | ( | Mage_Core_Model_Abstract $ | object | ) | [protected] |
Definition at line 57 of file Stock.php.
00058 { 00059 if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) { 00060 $sql = $this->_getWriteAdapter()->select() 00061 ->from($this->getMainTable()) 00062 ->where('customer_id=?', $object->getCustomerId()) 00063 ->where('product_id=?', $object->getProductId()) 00064 ->where('website_id=?', $object->getWebsiteId()); 00065 return $this->_getWriteAdapter()->fetchRow($sql); 00066 } 00067 return false; 00068 }
deleteCustomer | ( | Mage_Core_Model_Abstract $ | object, | |
$ | customerId, | |||
$ | websiteId | |||
) |
Definition at line 79 of file Stock.php.
00080 { 00081 $where = array(); 00082 $where[] = $this->_getWriteAdapter()->quoteInto('customer_id=?', $customerId); 00083 if ($websiteId) { 00084 $where[] = $this->_getWriteAdapter()->quoteInto('website_id=?', $websiteId); 00085 } 00086 $this->_getWriteAdapter()->delete($this->getMainTable(), $where); 00087 return $this; 00088 }
loadByParam | ( | Mage_Core_Model_Abstract $ | object | ) |