本文整理汇总了PHP中Mage_Wishlist_Model_Item::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Wishlist_Model_Item::getId方法的具体用法?PHP Mage_Wishlist_Model_Item::getId怎么用?PHP Mage_Wishlist_Model_Item::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Wishlist_Model_Item
的用法示例。
在下文中一共展示了Mage_Wishlist_Model_Item::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUpdateUrl
/**
* Retrieve url for updating product in wishlist
*
* @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
*
* @return string|bool
*/
public function getUpdateUrl($item)
{
$itemId = null;
if ($item instanceof Mage_Catalog_Model_Product) {
$itemId = $item->getWishlistItemId();
}
if ($item instanceof Mage_Wishlist_Model_Item) {
$itemId = $item->getId();
}
if ($itemId) {
return $this->_getUrl('wishlist/index/updateItemOptions', array('id' => $itemId));
}
return false;
}
示例2: _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();
}
}
示例3: setItem
/**
* Set quote item
*
* @param Mage_Wishlist_Model_Item $item
* @return Mage_Wishlist_Model_Item_Option
*/
public function setItem($item)
{
$this->setWishlistItemId($item->getId());
$this->_item = $item;
return $this;
}
示例4: addItem
/**
* Adding item to wishlist
*
* @param Mage_Wishlist_Model_Item $item
* @return Mage_Wishlist_Model_Wishlist
*/
public function addItem(Mage_Wishlist_Model_Item $item)
{
$item->setWishlist($this);
if (!$item->getId()) {
$this->getItemCollection()->addItem($item);
Mage::dispatchEvent('wishlist_add_item', array('item' => $item));
}
return $this;
}
示例5: getItemConfigureUrl
/**
* Returns item configure url in wishlist
*
* @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $product
*
* @return string
*/
public function getItemConfigureUrl($product)
{
if ($product instanceof Mage_Catalog_Model_Product) {
$id = $product->getWishlistItemId();
} else {
$id = $product->getId();
}
$params = array('id' => $id);
return $this->getUrl('wishlist/index/configure/', $params);
}
示例6: getUpdateUrl
/**
* Retrieve url for updating product in wishlist
*
* @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
*
* @return string|bool
*/
public function getUpdateUrl($item)
{
$itemId = null;
if ($item instanceof Mage_Catalog_Model_Product) {
$itemId = $item->getWishlistItemId();
}
if ($item instanceof Mage_Wishlist_Model_Item) {
$itemId = $item->getId();
}
if ($itemId) {
$params['id'] = $itemId;
return $this->_getUrlStore($item)->getUrl('wishlist/index/updateItemOptions', $params);
}
return false;
}