Public Member Functions | |
addProduct ($product) | |
addProducts ($productIds) | |
getItemCollection () | |
removeProduct () | |
hasItems ($customerId, $visitorId) | |
Protected Member Functions | |
_addVisitorToItem ($item) |
Definition at line 34 of file List.php.
_addVisitorToItem | ( | $ | item | ) | [protected] |
Definition at line 70 of file List.php.
00071 { 00072 if (Mage::getSingleton('customer/session')->isLoggedIn()) { 00073 $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); 00074 } 00075 else { 00076 $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); 00077 } 00078 return $this; 00079 }
addProduct | ( | $ | product | ) |
Definition at line 36 of file List.php.
00037 { 00038 $item = Mage::getModel('catalog/product_compare_item'); 00039 $this->_addVisitorToItem($item); 00040 00041 $item->loadByProduct($product); 00042 00043 if (!$item->getId()) { 00044 $item->addProductData($product); 00045 $item->save(); 00046 } 00047 return $this; 00048 }
addProducts | ( | $ | productIds | ) |
Definition at line 50 of file List.php.
00051 { 00052 if (is_array($productIds)) { 00053 foreach ($productIds as $productId) { 00054 $this->addProduct($productId); 00055 } 00056 } 00057 return $this; 00058 }
getItemCollection | ( | ) |
Definition at line 60 of file List.php.
00061 { 00062 return Mage::getResourceModel('catalog/product_compare_item_collection'); 00063 }
hasItems | ( | $ | customerId, | |
$ | visitorId | |||
) |
Definition at line 81 of file List.php.
00082 { 00083 return Mage::getResourceSingleton('catalog/product_compare_item')->getCount($customerId, $visitorId); 00084 }