How to use float on Minimum quantity per order

  • Posts: 57
  • Thank you received: 4
10 years 6 months ago #194141

Hi,

I need your help.

I want to change the Minimum quantity per order but the hikashop don't let me do that.
For example, like you can see in this next printscreen the hikashop only let me put the integer values and in my business I need to use float values.

For example, I have products when you can send parts of the product.

One example is that I need do send products with quantities like (0.001, 0.002, 0.003) and not only integers like (1, 2, 3).
But, like we can see in this pictures this don't let me do that.



I have created a plugin and I have something like that:
 if($view->getLayout() == 'show')
{	
         $view->element->product_min_per_order = 0.05;
}

And in this product page the quantity really appears like I wan't but when i try to add to the cart this don't let me.
For example, if I put 0.2 this round the value to 0 and don't let me to add. But if I put something like 0.5 or 0.6 this round the value to 1 and add to the cart (1), but I don't want (1), I want (0.5).

Can you help me to solve that problem?
Thanks.

Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 6 months ago #194149

Hi,

HikaShop only work with integer quantity for his products.
In the code and in the database, the value will always be an integer, not a float.

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: 57
  • Thank you received: 4
10 years 6 months ago #194276

Hi,

Ok I understood.

But I really need to transform this integer in a float.

Can you help me please, showing where I need to change the source code and database to put this working with float values?

Thanks.

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

  • Posts: 12953
  • Thank you received: 1778
10 years 6 months ago #194283

Hello,
A solution can be to use an "item" custom field through your product page instead of the quantity field, and then develop a custom plugin which will multiply the price of your product regarding the value of that field.

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

  • Posts: 57
  • Thank you received: 4
10 years 6 months ago #194467

Hi, I'm sorry but I don't understood.
Can you explain with some example please?

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
10 years 6 months ago #194470

Hi,

You have to create a custom item field via the menu Display > Custom fields, with the type "text", displayed on frontend, and all the desired settings.

This way on the product page the customer will be able to enter any values, then you have to create a plugin which will get this value and do a calculation like price * the_value to have the final price.

As example you can see how the plugin "custom_price" is working and edit it directly.

Here is the documentation for the custom fields:
www.hikashop.com/support/support/documen...shop-field-form.html

And here the one for the plugins:
www.hikashop.com/support/support/documen...r-documentation.html

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

Time to create page: 0.070 seconds
Powered by Kunena Forum