本文整理汇总了PHP中Mage_Wishlist_Model_Item::getQty方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Wishlist_Model_Item::getQty方法的具体用法?PHP Mage_Wishlist_Model_Item::getQty怎么用?PHP Mage_Wishlist_Model_Item::getQty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Wishlist_Model_Item
的用法示例。
在下文中一共展示了Mage_Wishlist_Model_Item::getQty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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();
}
}
示例2: getQty
/**
* Retrieve Qty from item
*
* @param Mage_Wishlist_Model_Item|Mage_Catalog_Model_Product $item
* @return float
*/
public function getQty($item)
{
$qty = $item->getQty() * 1;
if (!$qty) {
$qty = 1;
}
return $qty;
}
示例3: getAddToCartQty
/**
* Returns qty to show visually to user
*
* @param Mage_Wishlist_Model_Item $item
* @return float
*/
public function getAddToCartQty(Mage_Wishlist_Model_Item $item)
{
$qty = $item->getQty();
return $qty ? $qty : 1;
}
示例4: _filterWishlistItem
/**
* @param Mage_Wishlist_Model_Item $item
* @param int $index
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterWishlistItem(Mage_Wishlist_Model_Item $item, $index = null)
{
if ($item->getParentItem()) {
return $this;
}
$this->setStoreId($item->getStoreId());
$this->setField("productName_{$index}", $item->getName());
$this->setField("productPrice_{$index}", $this->formatPrice($item->getPrice()));
$this->setField("productQty_{$index}", $item->getQty());
$this->setField("productUrl_{$index}", $this->_getWishlistItemUrl($item));
/* @var $product Mage_Catalog_Model_Product */
$product = $item->getProduct();
if (!$product) {
$product = Mage::helper('bronto_common/product')->getProduct($item->getProductId(), $this->getStoreId() ? $this->getStoreId() : false);
}
$this->setField("productSku_{$index}", $product->getSku());
$this->_filterProduct($product, $index);
return $this;
}