public function loadByProductWishlist(Mage_Wishlist_Model_Item $item, $wishlistId, $productId, array $sharedStores) { $select = $this->_getReadAdapter()->select()->from(array('main_table' => $this->getTable('item')))->where('main_table.wishlist_id = ?', $wishlistId)->where('main_table.product_id = ?', $productId)->where('main_table.store_id in (?)', $sharedStores); if ($_data = $this->_getReadAdapter()->fetchRow($select)) { $item->setData($_data); } return $item; }
/** * Load item by wishlist, product and shared stores * * @param Mage_Wishlist_Model_Item $object * @param int $wishlistId * @param int $productId * @param array $sharedStores * @return Mage_Wishlist_Model_Mysql4_Item */ public function loadByProductWishlist($object, $wishlistId, $productId, $sharedStores) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from($this->getMainTable())->where('wishlist_id=?', $wishlistId)->where('product_id=?', $productId)->where('store_id IN(?)', $sharedStores); $data = $adapter->fetchRow($select); if ($data) { $object->setData($data); } $this->_afterLoad($object); return $this; }
/** * Load item by wishlist, product and shared stores * * @param Mage_Wishlist_Model_Item $object * @param int $wishlistId * @param int $productId * @param array $sharedStores * @return Mage_Wishlist_Model_Resource_Item */ public function loadByProductWishlist($object, $wishlistId, $productId, $sharedStores) { $adapter = $this->_getReadAdapter(); $storeWhere = $adapter->quoteInto('store_id IN (?)', $sharedStores); $select = $adapter->select()->from($this->getMainTable())->where('wishlist_id=:wishlist_id AND ' . 'product_id=:product_id AND ' . $storeWhere); $bind = array('wishlist_id' => $wishlistId, 'product_id' => $productId); $data = $adapter->fetchRow($select, $bind); if ($data) { $object->setData($data); } $this->_afterLoad($object); return $this; }