本文整理汇总了PHP中Mage_Wishlist_Model_Wishlist类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Wishlist_Model_Wishlist类的具体用法?PHP Mage_Wishlist_Model_Wishlist怎么用?PHP Mage_Wishlist_Model_Wishlist使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Wishlist_Model_Wishlist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchItemsCount
/**
* Fetch items count
*
* @param Mage_Wishlist_Model_Wishlist $wishlist
* @return int
*/
public function fetchItemsCount(Mage_Wishlist_Model_Wishlist $wishlist)
{
if (is_null($this->_itemsCount)) {
$collection = $wishlist->getItemCollection()->addStoreFilter()->setVisibilityFilter();
$this->_itemsCount = $collection->getSize();
}
return $this->_itemsCount;
}
示例2: testWishlistAction
/**
* @magentoConfigFixture current_store rss/wishlist/active 1
* @magentoDataFixture Mage/Wishlist/_files/wishlist.php
* @magentoAppIsolation enabled
*/
public function testWishlistAction()
{
$wishlist = new Mage_Wishlist_Model_Wishlist();
$wishlist->load('fixture_unique_code', 'sharing_code');
$this->getRequest()->setParam('wishlist_id', $wishlist->getId())->setParam('data', base64_encode('1'));
Mage::getSingleton('Mage_Customer_Model_Session')->login('customer@example.com', 'password');
$this->dispatch('rss/index/wishlist');
$this->assertContains('<![CDATA[Simple Product]]>', $this->getResponse()->getBody());
}
示例3: fetchItemsCount
public function fetchItemsCount(Mage_Wishlist_Model_Wishlist $wishlist)
{
if (is_null($this->_itemsCount)) {
$collection = $wishlist->getProductCollection()->addStoreFilter();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
$this->_itemsCount = $collection->getSize();
}
return $this->_itemsCount;
}
示例4: fetchItemsCount
/**
* Retrieve wishlist items count
*
* @deprecated after 1.6.0.0-rc2
* @see Mage_Wishlist_Model_Wishlist::getItemsCount()
*
* @param Mage_Wishlist_Model_Wishlist $wishlist
*
* @return int
*/
public function fetchItemsCount(Mage_Wishlist_Model_Wishlist $wishlist)
{
if (is_null($this->_itemsCount)) {
$this->_itemsCount = $wishlist->getItemsCount();
}
return $this->_itemsCount;
}
示例5: _getWishlist
/**
* Retrieve Wishlist model
*
* @return Mage_Wishlist_Model_Wishlist
*/
protected function _getWishlist()
{
if (is_null($this->_wishlist)) {
if (Mage::registry('shared_wishlist')) {
$this->_wishlist = Mage::registry('shared_wishlist');
} elseif (Mage::registry('wishlist')) {
$this->_wishlist = Mage::registry('wishlist');
} else {
$this->_wishlist = Mage::getModel('wishlist/wishlist');
if ($this->_getCustomerSession()->isLoggedIn()) {
$this->_wishlist->loadByCustomer($this->_getCustomerSession()->getCustomer());
}
}
}
return $this->_wishlist;
}
示例6: getCustomerWishlist
/**
* Retrieve customer wishlist model object
*
* @params bool $cacheReload pass cached wishlist object and get new one
* @return Mage_Wishlist_Model_Wishlist
*/
public function getCustomerWishlist($cacheReload = false)
{
if (!is_null($this->_wishlist) && !$cacheReload) {
return $this->_wishlist;
}
if ($this->getSession()->getCustomer()->getId()) {
$this->_wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($this->getSession()->getCustomer(), true);
$this->_wishlist->setStore($this->getSession()->getStore())->setSharedStoreIds($this->getSession()->getStore()->getWebsite()->getStoreIds());
} else {
$this->_wishlist = false;
}
return $this->_wishlist;
}
示例7: getCustomerWishlist
/**
* Retrieve customer wishlist model object
*
* @return Mage_Wishlist_Model_Wishlist
*/
public function getCustomerWishlist()
{
if (!is_null($this->_wishlist)) {
return $this->_wishlist;
}
if ($this->getSession()->getCustomer()->getId()) {
$this->_wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($this->getSession()->getCustomer(), true);
$this->_wishlist->setStore($this->getSession()->getStore());
} else {
$this->_wishlist = false;
}
return $this->_wishlist;
}
示例8: _getWishlist
/**
* Retrieve Wishlist model
*
* @return Mage_Wishlist_Model_Wishlist
*/
protected function _getWishlist()
{
if (is_null($this->_wishlist)) {
$this->_wishlist = Mage::getModel('wishlist/wishlist');
$wishlistId = $this->getRequest()->getParam('wishlist_id');
if ($wishlistId) {
$this->_wishlist->load($wishlistId);
} else {
if ($this->_getCustomer()->getId()) {
$this->_wishlist->loadByCustomer($this->_getCustomer());
}
}
}
return $this->_wishlist;
}
示例9: getWishlist
/**
* Retrieve wishlist by logged in customer
*
* @return Mage_Wishlist_Model_Wishlist
*/
public function getWishlist()
{
if (is_null($this->_wishlist)) {
if (Mage::registry('shared_wishlist')) {
$this->_wishlist = Mage::registry('shared_wishlist');
} elseif (Mage::registry('wishlist')) {
$this->_wishlist = Mage::registry('wishlist');
} else {
$this->_wishlist = Mage::getModel('wishlist/wishlist');
if ($this->getCustomer()) {
$this->_wishlist->loadByCustomer($this->getCustomer());
}
}
}
return $this->_wishlist;
}
示例10: getWishlistManagementUrl
/**
* Build wishlist management page url
*
* @param Mage_Wishlist_Model_Wishlist $wishlist
* @return string
*/
public function getWishlistManagementUrl(Mage_Wishlist_Model_Wishlist $wishlist)
{
return $this->getUrl('wishlist/*/*', array('wishlist_id' => $wishlist->getId()));
}
示例11: _moveItem
/**
* Move item to given wishlist.
* Check whether item belongs to one of customer's wishlists
*
* @param Mage_Wishlist_Model_Item $item
* @param Mage_Wishlist_Model_Wishlist $wishlist
* @param Mage_Wishlist_Model_Resource_Wishlist_Collection $customerWishlists
* @param int $qty
* @throws InvalidArgumentException|DomainException
*/
protected function _moveItem(Mage_Wishlist_Model_Item $item, Mage_Wishlist_Model_Wishlist $wishlist, Mage_Wishlist_Model_Resource_Wishlist_Collection $customerWishlists, $qty = null)
{
if (!$item->getId()) {
throw new InvalidArgumentException();
}
if ($item->getWishlistId() == $wishlist->getId()) {
throw new DomainException(null, 1);
}
if (!$customerWishlists->getItemById($item->getWishlistId())) {
throw new DomainException(null, 2);
}
$buyRequest = $item->getBuyRequest();
if ($qty) {
$buyRequest->setQty($qty);
}
$wishlist->addNewItem($item->getProduct(), $buyRequest);
$qtyDiff = $item->getQty() - $qty;
if ($qty && $qtyDiff > 0) {
$item->setQty($qtyDiff);
$item->save();
} else {
$item->delete();
}
}
示例12: addWishlistFilter
/**
* Add filter by wishlist object
*
* @param Mage_Wishlist_Model_Wishlist $wishlist
* @return Mage_Wishlist_Model_Resource_Item_Collection
*/
public function addWishlistFilter(Mage_Wishlist_Model_Wishlist $wishlist)
{
$this->addFieldToFilter('wishlist_id', $wishlist->getId());
return $this;
}
示例13: _filterWishlist
/**
* @param Mage_Wishlist_Model_Wishlist $wishlist
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterWishlist(Mage_Wishlist_Model_Wishlist $wishlist)
{
if (!in_array('wishlist', $this->_filteredObjects)) {
$index = 1;
foreach ($wishlist->getItemCollection() as $item) {
if (!$item->getParentItem()) {
$this->_filterWishlistItem($item, $index);
$index++;
}
}
// Add Related Content
$this->_items = $wishlist->getItemCollection();
$queryParams = $this->getQueryParams();
$queryParams['wishlist_id'] = urlencode(base64_encode(Mage::helper('core')->encrypt($wishlist->getId())));
if ($store = $this->getStore()) {
$this->setField('wishlistURL', $store->getUrl('reminder/load/index', $queryParams));
} else {
$this->setField('wishlistURL', Mage::getUrl('reminder/load/index', $queryParams));
}
// Setup wishlist items as a template
if (class_exists('Bronto_Reminder_Block_Wishlist_Items', false)) {
$layout = Mage::getSingleton('core/layout');
/* @var $items Mage_Sales_Block_Items_Abstract */
$items = $layout->createBlock('bronto/bronto_reminder_wishlist_items', 'items');
$items->setTemplate('bronto/reminder/items.phtml');
$items->setWishlist($item->getWishlist());
$this->_respectDesignTheme();
$this->setField("wishlistItems", $items->toHtml());
}
$this->_filteredObjects[] = 'wishlist';
}
return $this;
}
示例14: addWishlistFilter
public function addWishlistFilter(Mage_Wishlist_Model_Wishlist $wishlist)
{
$this->_joinFields['e_id'] = array('table' => 'e', 'field' => 'entity_id');
$this->joinTable('wishlist/item', 'product_id=e_id', array('product_id' => 'product_id', 'wishlist_item_description' => 'description', 'store_id' => 'store_id', 'added_at' => 'added_at', 'wishlist_id' => 'wishlist_id', 'wishlist_item_id' => 'wishlist_item_id'), array('wishlist_id' => $wishlist->getId()));
return $this;
}
示例15: _getCustomerId
/**
* 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;
}