- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On some of my products, I've set the product quantity increments (in Inventory) as a number other than 1, say 10. Now what I want on my Product view page is for the Quantity Increment Buttons (+,-) to increment and decrement by this much quantity. I can do that with jquery, the only problem is I'm not able to receive the Quantity Increment value on my page. Here was the quantity box already in my addtocart.phtml file
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Quantity') ?>" class="input-text qty" />
To which I modified, to add increment value
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Quantity') ?>" class="input-text qty" data-increments="<?php echo $_product->getQtyIncrements(); ?>" />
But I'm not getting this value. I've also tried $this->getQtyIncrements, $this->getProductQtyIncrements and $_product->getProductQtyIncrements. I also tried php's get_class_methods function on $this and $_product but this method was not in the output.
get_class_methods($this); get_class_methods($_product);
Any help would be appreciated? I couldn't find the answers on the internet.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @VipulK,
I don't remember but you can try with something like this to get access to all Stock values for a given product:
$product->getStockItem()->getData()
I think that $product->getStockItem()->getData('qty_increments') have the value that you're looking for.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @VipulK,
I don't remember but you can try with something like this to get access to all Stock values for a given product:
$product->getStockItem()->getData()
I think that $product->getStockItem()->getData('qty_increments') have the value that you're looking for.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Get product quantity increments on Product view page
I really need to get those increment/decrement buttons on the Product view page.,, ...could you help me plz......cause I'm still beginning with coding....much thanks.