Public Member Functions | |
__construct () | |
loadByCustomerId ($quote, $customerId) | |
getReservedOrderId ($quote) | |
Protected Member Functions | |
_getLoadRowSelect ($object, $rowId) |
Definition at line 34 of file Quote.php.
__construct | ( | ) |
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 37 of file Quote.php.
00038 { 00039 $resource = Mage::getSingleton('core/resource'); 00040 $this->setType('quote')->setConnection( 00041 $resource->getConnection('sales_read'), 00042 $resource->getConnection('sales_write') 00043 ); 00044 }
_getLoadRowSelect | ( | $ | object, | |
$ | rowId | |||
) | [protected] |
Retrieve select object for loading base entity row
Varien_Object | $object | |
mixed | $rowId |
Reimplemented from Mage_Eav_Model_Entity_Abstract.
Definition at line 53 of file Quote.php.
00054 { 00055 $select = parent::_getLoadRowSelect($object, $rowId); 00056 if ($object->getSharedStoreIds()) { 00057 $select->where('store_id IN (?)', $object->getSharedStoreIds()); 00058 } 00059 return $select; 00060 }
getReservedOrderId | ( | $ | quote | ) |
Definition at line 92 of file Quote.php.
00093 { 00094 return Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($quote->getStoreId()); 00095 }
loadByCustomerId | ( | $ | quote, | |
$ | customerId | |||
) |
Loading quote by customer identifier
Mage_Sales_Model_Quote | $quote | |
int | $customerId |
Definition at line 68 of file Quote.php.
00069 { 00070 $collection = Mage::getResourceModel('sales/quote_collection') 00071 ->addAttributeToSelect('entity_id') 00072 ->addAttributeToFilter('customer_id', $customerId) 00073 ->addAttributeToFilter('is_active', 1); 00074 00075 if ($quote->getSharedStoreIds()) { 00076 $collection->addAttributeToFilter('store_id', array('in', $quote->getSharedStoreIds())); 00077 } 00078 00079 $collection->setOrder('updated_at', 'desc') 00080 ->setPageSize(1) 00081 ->load(); 00082 00083 if ($collection->getSize()) { 00084 foreach ($collection as $item) { 00085 $this->load($quote, $item->getId()); 00086 return $this; 00087 } 00088 } 00089 return $this; 00090 }