简体   繁体   中英

Magento: Inventory increment qty attribute per store

I have one simple question.

My problem is:

Is there are any free extensions that could turn " Enable Qty Increments " and " Qty Increments " from global scope to store view?

Also I have found this question inventory settings

It's have some kind of answer, but I need to confirm this.

If there are no free extension that could fulfill my needs, do I need to write my own extension (as answer in previous link says) or there is an easy way to change scope from global to store view. ?

My Magento version is CE 1.9.1.0

What you could do to achieve the same thing is create a new product text attribute called pack_size, give it a per store view scope, then set the order quantity against it per product, per store view.

Then, in your addtocart.phtml file, here;

app/design/frontend/XXX/YYY/template/catalog/product/view/addtocart.phtml

Where XXX YYY is the name of your theme, and replace the quantity input box with;

<?php $pack = $_product->getData('pack_size'); ?>
<?php if(($pack == 1) || (!$pack)) { ?>
<input type="text" name="qty" id="qty" maxlength="4" value="1" />
<?php } else { ?>
<select name="qty" id="qty" maxlength="12">
<?php 
$countme = 1;
while ($countme < 101) {
        echo '<option value="'.($pack*$countme).'">'.($pack*$countme).'</option>';
$countme++;  } ?>
</select>

Now if the value of pack_offer is set and greater than 1, the user will only be able to choose a multiple of that qty.

Depending on your theme, you may also need to implement this in the cart page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM