0
votes

Instead of making a custom post_type pack

What the previous developer did is to add options (with more units) to the products and make them mandatory...

this way when user adds a item to the cart. we have:

  • the pack prize, ej: 66€
  • the uni price, ej: 5,50€

when i should be only: 66€ but in the shopping cart then are 71,50€ ( wrong)

So how can i correct this mess?

i looked into the product constructor in the product controller file (/catalog/controller/product.php):

And in the foreach, i tried:

foreach ($product_options as $product_option) {
    if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
        $product_option_value_data = array();



        if($product_option['name'] == 'Pack'){
            $price = $packPrice;
            $total = $packPrice;
            $product_option_value['price'] = $product_option_value_data;
            die('Die: '.$product_option_value_data);
        }else{

        }

Any idea why is this not doing anything? any idea where should i be looking?

thanks

1

1 Answers

0
votes

Yeah you should reconfigure the pack price option to subtract 4,40 instead of adding 66

Then remove that added code and set it back to the original. Product options will natively either add or subtract from the base price without any modifications to the code.

That should do the trick for you.