00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_ProductAlert_Model_Mysql4_Price_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
00036 {
00037 protected function _construct()
00038 {
00039 $this->_init('productalert/price');
00040 }
00041
00042 public function addCustomerFilter($customer)
00043 {
00044 if (is_array($customer)) {
00045 $condition = $this->getConnection()->quoteInto('customer_id IN(?)', $customer);
00046 }
00047 elseif ($customer instanceof Mage_Customer_Model_Customer) {
00048 $condition = $this->getConnection()->quoteInto('customer_id=?', $customer->getId());
00049 }
00050 else {
00051 $condition = $this->getConnection()->quoteInto('customer_id=?', $customer);
00052 }
00053 $this->addFilter('customer_id', $condition, 'string');
00054 return $this;
00055 }
00056
00057 public function addWebsiteFilter($website)
00058 {
00059 if (is_null($website) || $website == 0) {
00060 return $this;
00061 }
00062 if (is_array($website)) {
00063 $condition = $this->getConnection()->quoteInto('website_id IN(?)', $website);
00064 }
00065 elseif ($website instanceof Mage_Core_Model_Website) {
00066 $condition = $this->getConnection()->quoteInto('website_id=?', $website->getId());
00067 }
00068 else {
00069 $condition = $this->getConnection()->quoteInto('website_id=?', $website);
00070 }
00071 $this->addFilter('website_id', $condition, 'string');
00072 return $this;
00073 }
00074
00075 public function setCustomerOrder($sort = 'ASC')
00076 {
00077 $this->getSelect()->order('customer_id ' . $sort);
00078 return $this;
00079 }
00080 }