0

When configuring a product on the product page, the price works out whatever the price of the product is plus the combined amount of options added which is correct.

but when I add the product to the checkout, it will show the wrong price. I am trying to fix the issue , but i am not getting how to fix it.

The price in the checkout is working out:

item + option[1]
item + option[2]
item + option[3] +
---------------------------
£1,725.99

instead of:

item
option[1]
option[2]
option[3]+
---------------------------
£927.99


the site is using onestepcheckout and also simple-product. I don't think these are the issues as when I turn onestepcheckout off, i still have the same problem.

I hope this makes sence, thanks in advance!

0

I worked it out, maybe a bit of a hack but it seems to work. I thought I'd post an answer in case anyone else has the same problem.

In: app/code/local/Magecomp/AbsolutePricing/Model/Product/Type/Price.php

Change this:

protected function _applyOptionsPrice($product, $qty, $finalPrice)
{
    if ($optionIds = $product->getCustomOption('option_ids')) {
        $basePrice = $finalPrice;
        $finalPrice = 0;
        foreach (explode(',', $optionIds->getValue()) as $optionId) {
            if ($option = $product->getOptionById($optionId)) {

                $quoteItemOption = $product->getCustomOption('option_'.$option->getId());
                $group = $option->groupFactory($option->getType())
                    ->setOption($option)
                    ->setQuoteItemOption($quoteItemOption);
                //Mage::log('Option Type : '.$option->getType());
                $price = $group->getOptionPrice($quoteItemOption->getValue(), $basePrice);
                //Mage::log('getOptionPrice : '.$price);
                $finalPrice += $price;
                //Mage::log('_applyOptionsPrice : '.$finalPrice);
            }
        }
    }

    return $finalPrice;
}


To this:

protected function _applyOptionsPrice($product, $qty, $finalPrice)
{
    if ($optionIds = $product->getCustomOption('option_ids')) {

        //used to count how many options, we divide the base price by to get correct value 
        $numberOfOptions = count(explode(',', $optionIds->getValue()));

        $basePrice = $finalPrice / $numberOfOptions;
        $finalPrice = 0;

        foreach (explode(',', $optionIds->getValue()) as $optionId) {
            if ($option = $product->getOptionById($optionId)) {
                $quoteItemOption = $product->getCustomOption('option_'.$option->getId());
                $group = $option->groupFactory($option->getType())
                    ->setOption($option)
                    ->setQuoteItemOption($quoteItemOption);
                //Mage::log('Option Type : '.$option->getType());
                $price = $group->getOptionPrice($quoteItemOption->getValue(), $basePrice);
                //Mage::log('getOptionPrice : '.$price);
                $finalPrice += $price;
                //Mage::log('_applyOptionsPrice : '.$finalPrice);
            }
        }
    }

    return $finalPrice;
}

This counts the number of selected options and divides the final price by the result of $numberOfOptions.

I hope this helps! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.