How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4102 by ltwmaster
01 Apr 2017, 20:45
Hey Girls and Guys,

following question, you may respond in german if its easier for your:
I want to have an item which has a variable price. I'm selling physical vouchers. Customers should be able to purchase the voucher at any value they want. eg. 55,55€.

My approach would be to price the voucher at 0,01€ and do some easy Javascript magic with the quantityfield. So for example if they enter 55,55€ to translate that in to 5555 in to the quantity.

Any better ideas than this workaround?

#4103 by aimeos
02 Apr 2017, 16:52
This way, you would have the problem that you need to adapt the templates where the basket/order data is shown to avoid quantities of "5555" and values of "0.01" which might be confusing to customers.

Another way would be to create a new product type (e.g. "voucher") and implement a new decorator for the basket frontend controller like done for bundles:

You can assign a custom attribute to the voucher product which displays an input field and set the price of the product in your new decorator to that value. Only the ProductPrice basket plugin couldn't be used in that setup because it would reset the price value.
#4195 by ltwmaster
15 May 2017, 12:23
Hi Guys,

its me again :)

I'm a bit stuck on the logic of this case:
So I introduce a new product type called "voucher" and this one uses a specific decorator, like in the example for bundles that you have posted above...

Is this also used on the Invoice? In the E-Mails?

Is there really no way to have a variable price? :)

Thank you
#4196 by aimeos
15 May 2017, 22:18
The "voucher" decorator has to do the same as the implementation for the simple articles, which are only a few lines of code. The only difference to simple articles is that it will set the price according to the given value from the user (including some checks that it isn't negative for example).

At the end, the product is a simple article and displaying the price in the checkout process and the e-mails will be automatically correct.