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.
}
Saturday, July 30 2016, 02:15 AM
Share this post:
Responses (10)
  • Accepted Answer

    Tuesday, August 02 2016, 10:01 AM - #Permalink
    From my understanding, you want to use option as both option and product. I'm not sure if that is possible but I can it exactly if you could send the full mod.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, August 04 2016, 03:22 AM - #Permalink
    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.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, August 19 2016, 08:47 PM - #Permalink
    I still can't figure this out. Can anyone help me with it please?
    The reply is currently minimized Show
  • Accepted Answer

    Friday, August 19 2016, 10:34 PM - #Permalink
    I think Denis offered his help, did you take it (by sending him the needed info asked) ...?
    The reply is currently minimized Show
  • Accepted Answer

    Friday, August 19 2016, 10:48 PM - #Permalink
    Yes, I sent him the entire XML file today.
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, August 20 2016, 04:59 PM - #Permalink
    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
    ;)
    The reply is currently minimized Show
  • Accepted Answer

    Monday, August 22 2016, 01:10 AM - #Permalink
    Okay thanks. So stumped! lol
    The reply is currently minimized Show
  • Accepted Answer

    Monday, August 22 2016, 05:06 PM - #Permalink
    Andrew Tite wrote:

    So stumped! lol


    By you, or what do you mean exactly?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, August 23 2016, 07:36 PM - #Permalink
    Just stumped by the one thing I can't figure out with the $options variable.
    Frustrating when you have something working perfectly except for 1 thing. LOL
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, August 23 2016, 07:51 PM - #Permalink
    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.
    Like
    1
    The reply is currently minimized Show
Your Reply