Hi!
I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.
My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:
[...]
$time = time();
if (preg_match("/1 year/i", $order->cart->products[$j]->order_product_options)) {
$time += ($oneyear); }
elseif (preg_match("/6 months/i", $order->cart->products[$j]->order_product_options)) {
$time += ($oneyear / 2); }
[...]
So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like "order_product_option_code" where I can save the periode in days and not in words. So I can calculate with this value ...
Best regards