Default quantity

  • Posts: 5
  • Thank you received: 1
9 years 6 months ago #213955

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.5.27
-- Browser(s) name and version -- : Safari 8.0.7 (OS X)

Is it possible to set a default quantity in the "add to cart" field on the product page ? We have products which we like to sell per 6 by default. It must be possible to order less than 6 units, but we'd like to stimulate the customers to order by 6 (or another multiple). Therefore, in the add to cart box by default the quantity should be set to 6 instead of 1.

I found a thread to set the minimum value to 0 and also manage to set this to 6 (either through minimum order quantity or by modifying the PHP directly), but in that case I cannot input a lower value anymore.

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
9 years 6 months ago #213990

Hi,

There is no option to change that.
You can edit the file "show_quantity" of the view "product" via the menu Display>Views and change the occurrences of :

value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>"
to:
value="6"
so that the default value would be 6, but that you would still be able to set a lower value in the field.

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

  • Posts: 5
  • Thank you received: 1
9 years 6 months ago #214003

Works like a charm ! Thanks.

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

  • Posts: 36
  • Thank you received: 1
4 years 1 month ago #329000

Hey Nicolas is there a way to do this in latest Hikashop? I have a client who needs to do the same thing as this but can't work it out at all.

thanks

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 1 month ago #329008

Hi,

It's still possible but the code to change has evolved.
Now, in that same view file show_quantity.php, you need to change the line:
$current_quantity = hikaInput::get()->getInt('quantity', $min_quantity);
to:
$current_quantity = 6;

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

Time to create page: 0.066 seconds
Powered by Kunena Forum