How to define quantity for products that use "Custom Quantity Plugin"?

  • Posts: 6
  • Thank you received: 0
3 years 8 months ago #331996

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3

Hi
I'm using Custom Quantity Plugin for some of my products and everything is ok. User inserts required length in cm, then selects quantity and cart updates successfully.

The code in "custom quantity plugin".

$currencyClass = hikashop_get('class.currency');
$quantity = @$product->cart_product_quantity;
if(!empty($product->length)){
	$quantity = $quantity*$product->length/100;
}
$currencyClass->quantityPrices($product->prices,$quantity,$product->cart_product_total_quantity);

The question is how should I define product quantity in administrator. For example, I have 1000 cm of product "A", which can be sold in any length between 10cm - 400cm, and the user can select the quantity too. like 3 pieces of 30cm.

Should I define quantity in cm?

Thanks for your help.

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
3 years 8 months ago #332014

Hi,

You can't do that.
You can only define the number of times the product can be sold. And in the settings of the custom field where the dimension is entered, you can use the regular expression check setting to define the minimum and maximum length that can be entered in the field.
But there is no mechanism to calculate the total purchased length against an available length to restrict this.
That would require the development of a separate plugin to handle it.

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

Time to create page: 0.041 seconds
Powered by Kunena Forum