Decimal in Product Quantity (inventory/stock)

  • Posts: 198
  • Thank you received: 13
  • Hikashop Business
3 months 2 weeks ago #364919

-- HikaShop version -- : 5.1.2
-- Joomla version -- : 5.2.2
-- PHP version -- : 8.2.14
-- Browser(s) name and version -- : n/a
-- Error-message(debug-mod must be tuned on) -- : n/a

My client sells flooring - carpet, hardwood, etc - by the square foot. I've installed the Custom Quantity plugin to allow a customer to purchase a quantity with a decimal, but is there a way for me to set an inventory quantity in the product to include a decimal? And, then to maintain the remaining inventory to the decimal when the client purchases to the decimal?


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

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

  • Posts: 83486
  • Thank you received: 13507
  • MODERATOR
3 months 2 weeks ago #364922

Hi,

The inventory quantity can only be an integer, so no decimals.
I'm afraid you won't be able to do what you want.

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

  • Posts: 1087
  • Thank you received: 12
  • Hikashop Business
4 days 13 hours ago #366311

Hi,
On behalf of our client we run a daily csv import of product quantities from his ERP.
The client uses decimal quantities and as the stock quantities on hikashop are a whole number, the client asks us to implement a floor function.
What would be the quickest way to do this? Which file would we need to modify etc?
Thank you!

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

  • Posts: 83486
  • Thank you received: 13507
  • MODERATOR
4 days 8 hours ago #366313

Hi,

Supposing that you're using the auto update products cron plugin for the import, before the line:

foreach($this->fields as $field){
in the file administrator/components/com_hikashop/helpers/import.php, you could add:
if(isset($product->product_quantity)) $product->product_quantity = (int)floor($product->product_quantity);
Ideally, instead of modifying the core file of HikaShop, you would create an override as per www.hikashop.com/support/documentation/6...ntation.html#classes
That way, you wouldn't have to redo the change after each update of HikaShop.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum