Grow your CSS skills. Land your dream job.

magento percentage price calculation for custom options

  • # August 12, 2014 at 3:37 am

    By default the attributes calculate percentage off the base price of the product.
    Base Price = $10
    custom Option 1 = $10
    custom option 2 = 10%
    Default magento calculation for custom options is
    Baseprice + custom option1 + custom option2
    $100 + $100 + (10% of $100[Base price]) = $210
    But i want to calculate percentage based price from total price not from base price.
    I need Like this
    Baseprice + custom option1 + custom option2
    $100 + $100 + (10% of $200[Baseprice + custom option1]) = $220
    Does anyone knows how to solve this?

    # August 12, 2014 at 3:39 am

    I suspect we’d need to see the code that generates the original calculation.

    # August 12, 2014 at 3:48 am

    I can get the desired results here of calculating percentage based on the changed price value rather than the base price by changing this line of code in app/code/core/Mage/Catalog/Model/Product/Type/Price.php to $finalPrice instead of $basePrice

    from this:

    $finalPrice += $group->getOptionPrice($quoteItemOption->getValue(), $basePrice);

    to this:

    $finalPrice += $group->getOptionPrice($quoteItemOption->getValue(), $finalPrice);

    But No use

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".