Hi, I have a mod working that allows products as options, and if selected in the setup, can override the main product when added to the cart. This solves the problem of having for example a red, blue, and green item with different part numbers and inventory counts.
It's working perfectly, the only thing is when there is a regular option on the main product that applies to all the other variation products (blue item, red item, etc), it won't add the option to the cart.
I'm using this to determine if it's a product option to override the main one.
if (!$override) { $this->cart->add($product_id, $quantity, $option, $recurring_id); }
if ($override) {
$this->cart->add($product_as_option_value['product_id'], $product_product_option_value['quantity'], $option, $recurring_id);
} else {
$this->cart->add($product_as_option_value['product_id'], $product_product_option_value['quantity'], array(), $recurring_id);
}
As you can see, I used the $option variable from the main product if it is an override product so it will pick up the main product option(s) and add them.
It's recognising that there is an option because it's adding a new line if i select a different option and adding quantity if i select the same option. It's just not actually showing up on the view cart page or order. I think it's because the options in the database are product specific and I can't figure out how to add the product option if it isn't associated to the same product. I even tried copying the options and that didn't work either.
I'm really stuck here.
}
It's working perfectly, the only thing is when there is a regular option on the main product that applies to all the other variation products (blue item, red item, etc), it won't add the option to the cart.
I'm using this to determine if it's a product option to override the main one.
if (!$override) { $this->cart->add($product_id, $quantity, $option, $recurring_id); }
if ($override) {
$this->cart->add($product_as_option_value['product_id'], $product_product_option_value['quantity'], $option, $recurring_id);
} else {
$this->cart->add($product_as_option_value['product_id'], $product_product_option_value['quantity'], array(), $recurring_id);
}
As you can see, I used the $option variable from the main product if it is an override product so it will pick up the main product option(s) and add them.
It's recognising that there is an option because it's adding a new line if i select a different option and adding quantity if i select the same option. It's just not actually showing up on the view cart page or order. I think it's because the options in the database are product specific and I can't figure out how to add the product option if it isn't associated to the same product. I even tried copying the options and that didn't work either.
I'm really stuck here.
}
In Extensions
Share this post:
Responses (10)
-
Accepted Answer
OK, I see.
Just remember this is internet, short unclear texts might easily be misunderstood. And you might be yelled at, or simply ignored.
Anyhow, I hope Denis gets time to look at your code soon. -
Accepted Answer
-
Accepted Answer
From what I can tell $option contains the products options.
If I'm overriding the product with the option product, I would like to pass the option data to the override product (the one being added to the cart instead).
With my if..else, if it's not an override product I'm using '' for the options (nothing).
If it is a product that will override the original product, I want to pass the options from the original product, which should be in $options
They seem to be product specific though so I'm not sure how to make it work. -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
Then we should have patience to let him get time to respond to it ...
Note that they are busy with the 1.4 release: https://arastta.org/roadmap
-
Accepted Answer
-
Accepted Answer
Your Reply
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »