/** * Ajax handler to response configuration fieldset of composite product in customer's wishlist * * @return Mage_Adminhtml_Customer_Wishlist_Product_Composite_WishlistController */ public function configureAction() { $configureResult = new Varien_Object(); try { $this->_initData(); $configureResult->setProductId($this->_wishlistItem->getProductId()); $configureResult->setBuyRequest($this->_wishlistItem->getBuyRequest()); $configureResult->setCurrentStoreId($this->_wishlistItem->getStoreId()); $configureResult->setCurrentCustomerId($this->_wishlist->getCustomerId()); $configureResult->setOk(true); } catch (Exception $e) { $configureResult->setError(true); $configureResult->setMessage($e->getMessage()); } /* @var $helper Mage_Adminhtml_Helper_Catalog_Product_Composite */ $helper = Mage::helper('adminhtml/catalog_product_composite'); $helper->renderConfigureResult($this, $configureResult); return $this; }
/** * Check whether given wishlist is default for it's customer * * @param Mage_Wishlist_Model_Wishlist $wishlist * @return bool */ public function isWishlistDefault(Mage_Wishlist_Model_Wishlist $wishlist) { return $this->getDefaultWishlist($wishlist->getCustomerId())->getId() == $wishlist->getId(); }
/** * Get Customer ID from Quote/Wishlist * * @param int $ruleId * @param Mage_Sales_Model_Quote $quote * @param Mage_Wishlist_Model_Wishlist $wishlist * * @return int */ protected function _getCustomerId($ruleId, $quote, $wishlist) { if (!$ruleId || !$quote && !$wishlist) { return 0; } if ($quote) { return $quote->getCustomerId() ? $quote->getCustomerId() : 0; } if ($wishlist) { return $wishlist->getCustomerId() ? $wishlist->getCustomerId() : 0; } return 0; }