allow order only with specific quanties

  • Posts: 184
  • Thank you received: 4
12 years 8 months ago #60489

Good evening!
For some categories we fixed the minimum quantity to 6 (throught the standard field of hika)
For these categories we would like to allow the users the buy only in multiple of 6:
6 bottles
12
18
24
Do you think is possible?
Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 26223
  • Thank you received: 4035
  • MODERATOR
12 years 8 months ago #60506

Hi,

Thanks to views, you can modify the "quantity" view in order to display a dropdown list instead of the classical input text field.
After that, if you want more "security", you can add some checks in the "checkout step" view to check products' quantities.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 83604
  • Thank you received: 13536
  • MODERATOR
12 years 8 months ago #60507

You might also be able to do it more simply:
One simple way is to enter the price for 6 bottles and consider the product as a pack of six bottles.
Another way is to create a characteristic for the number of bottles and in each variant of the product enter the corresponding price.

Please Log in or Create an account to join the conversation.

  • Posts: 184
  • Thank you received: 4
12 years 8 months ago #60508

Thank you both for your help.

I would like to show the price of the single bottle and the characteristic should suit the purpose.
I defined the characteristic "package", and the value are 6 bottles, 12, 18.
I was able to define different prices for them.
Unfortunately Hika considers them like different items, and for this reason the stock is considered different.
In my case the stock is always the same, and I need to show and decrease it like before.
Do you have any ideas?

Otherwise I can try to modify the view, could you please give me some little suggestions to modify the code?

Thanks.

Last edit: 12 years 8 months ago by Teto.

Please Log in or Create an account to join the conversation.

  • Posts: 83604
  • Thank you received: 13536
  • MODERATOR
12 years 8 months ago #60591

If you want to have the stock handled on a per bottle basis, you won't be able to use a characteristic for the selection.
In that case you should create a quantity display override and not use characteristics:
www.hikashop.com/en/forum/4-how-to/15254...uantity-ordered.html

Please Log in or Create an account to join the conversation.

  • Posts: 184
  • Thank you received: 4
12 years 8 months ago #60600

so i have to:
1) create a file templates/YOUR_TEMPLATE/html/hikashop_button.php with the code indicated
2) For the cart/checkout, i need to edit the cart file of the views checkout and product and change the code which displays the input field.

am i right?
could you give more details for the point 2?

Please Log in or Create an account to join the conversation.

  • Posts: 83604
  • Thank you received: 13536
  • MODERATOR
12 years 8 months ago #60684

The simplest is to change the line:
<input id="hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>" type="text" name="item[<?php echo $row->cart_product_id;?>]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?>}" />

to:
<?php echo $row->cart_product_quantity; ?>

so that the user cannot change the quantities on the checkout.

You can also transform that line to a select.

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum