/** * Load item by registry id and product id * * @param Enterprise_GiftRegistry_Model_Item $object * @param int $registryId * @param int $productId * @return Enterprise_GiftRegistry_Model_Resource_Item */ public function loadByProductRegistry($object, $registryId, $productId) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from($this->getMainTable())->where('entity_id = :entity_id')->where('product_id = :product_id'); $bind = array(':entity_id' => (int) $registryId, ':product_id' => (int) $productId); $data = $adapter->fetchRow($select, $bind); if ($data) { $object->setData($data); } $this->_afterLoad($object); return $this; }
/** * Returns product price * * @param Enterprise_GiftRegistry_Model_Item $item * @return mixed */ public function getPrice($item) { $product = $item->getProduct(); $product->setCustomOptions($item->getOptionsByCode()); return Mage::helper('core')->currency($product->getFinalPrice(), true, true); }
/** * Set related gift registry item * * @param Enterprise_GiftRegistry_Model_Item $item * @return Enterprise_GiftRegistry_Model_Item_Option */ public function setItem($item) { $this->setItemId($item->getId()); $this->_item = $item; return $this; }
/** * Retrieve item fulfilled qty * * @param Enterprise_GiftRegistry_Model_Item $item * @return string */ public function getItemQtyFulfilled($item) { return $item->getQtyFulfilled() * 1; }