/** * Retrieve params for updating product in wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * * @return string|false */ public function getUpdateParams($item) { $itemId = null; if ($item instanceof \Magento\Catalog\Model\Product) { $itemId = $item->getWishlistItemId(); $productId = $item->getId(); } if ($item instanceof \Magento\Wishlist\Model\Item) { $itemId = $item->getId(); $productId = $item->getProduct()->getId(); } $url = $this->_getUrl('wishlist/index/updateItemOptions'); if ($itemId) { $params = ['id' => $itemId, 'product' => $productId, 'qty' => $item->getQty()]; return $this->_postDataHelper->getPostData($url, $params); } return false; }
/** * Retrieve Qty from item * * @param \Magento\Wishlist\Model\Item|\Magento\Catalog\Model\Product $item * @return float */ public function getQty($item) { $qty = $item->getQty() * 1; if (!$qty) { $qty = 1; } return $qty; }
/** * Returns qty to show visually to user * * @param \Magento\Wishlist\Model\Item $item * @return float */ public function getAddToCartQty(\Magento\Wishlist\Model\Item $item) { $qty = $item->getQty(); return $qty ? $qty : 1; }