Page 1 of 1

Length based article type

Posted: 07 Feb 2020, 15:16
by boettner
Hi all,

as far as I can see there´s no length based article type. A product type for products sold by meter or any other length unit. Besides using block pricing what would be the best approach to set a per length price and let Aimeos calculate upon user entered desired length?

Best
Robert.

Re: Length based article type

Posted: 08 Feb 2020, 14:57
by aimeos
A product type isn't required as it's related to prices and quantities (maybe fractions of quantities).

The easiest way would be to create a new price type for €/m that you display in the frontend. Then, you can add one default price for the minium length unit (e.g. for one centimeter or one decimeter) with the price for that length. Aimeos will calculate the correct price by multiplying that price with the entered length of the user. Block pricing isn't required here, only that you need to define the minimum length unit.

If you want that users can enter fractions of a meter, you can compute the real quantity by dividing the user entered length in meter by the minimum length unit in the frontend via JS or in a HTML client decorator:
Example: 1,75m / 0,01m = 175cm

Re: Length based article type

Posted: 09 Feb 2020, 11:44
by boettner
Thanks for your ongoing support! :-)

I suppose that I have to follow some conventions regarding the form field for the users length/amount input for the automatism you suggest, haven´t I?
aimeos wrote: 08 Feb 2020, 14:57 Aimeos will calculate the correct price by multiplying that price with the entered length of the user.
What do I have to ensure for the offered basket form field to integrate this type of price calculation automatism?

The next question would be, how is that handled regarding the basket weight. To calculate the right weight for delivery service selection?

Re: Length based article type

Posted: 10 Feb 2020, 12:28
by aimeos
boettner wrote: 09 Feb 2020, 11:44 What do I have to ensure for the offered basket form field to integrate this type of price calculation automatism?
Only make sure that the customer always knows the scale he has to enter in the frontend.
boettner wrote: 09 Feb 2020, 11:44 The next question would be, how is that handled regarding the basket weight. To calculate the right weight for delivery service selection?
The product weight must be for the minimum scale, e.g. if the product length is mutiple of 1cm, the product weight must be for 1cm.

BTW: The upcoming 2020.04 version will support fractional quantities and the code is already in the repositories.

Re: Length based article type

Posted: 10 Feb 2020, 13:43
by boettner
Allright, nice! I think, that will do.

To make sure the customer knows the scale I would like to use
https://aimeos.org/docs/User_Manual/Adm ... ils#Prices
Option/Value (optional)
Arbitrary list of key/value pairs that will be available with each price item in the frontend
But that´s not directly available at a priceItem retrieved via

Code: Select all

$priceItems = $this->get( 'prices', [] );
How can I access the config array?

Re: Length based article type

Posted: 11 Feb 2020, 13:11
by aimeos
We've used the product config (not price list config) until we decided to add a new column for the quantity scale:
https://github.com/aimeos/ai-client-htm ... 0R284-R285

Re: Length based article type

Posted: 12 Feb 2020, 14:54
by boettner
That helped, thank you!