11

I want to display custom option price on cart and checkout page.

I follow this URL but its display error "Fatal error: Call to a member function getValue() on a non-object " on

app/design/frontend/default/theme/template/checkout/cart/item/default.phtml

    $optionId = $_option['option_id'];
    $product = $_item->getProduct();
    $option = $product->getOptionById($optionId);
    $itemOption = $_item->getOptionByCode('option_' . $option->getId());
    $price = false;
    foreach ($option->getValues() as $values) {
        if ($values->getId() == $itemOption['value']) {
            $price = $values->price;
        }
    }
    if ($price !== false) {
        echo Mage::helper('core')->currency($price);
    }

Reference URL : https://stackoverflow.com/questions/11966256/magento-custom-options-showing-price-in-cart-checkout-page

I have another requirement with custom option price on cart and checkout page.

Please open below link and check "Interested in Embroidery" checkbox. Some options will show which are product custom options. Here, two options have price "Logo Creation Fee" and "Embroidery Logo Charge". When I select all options and add to cart. On cart page, If I increase product quantity, all option's price increase with quantity. But I want that when product quantity increase, only "Embroidery Logo Charge ($35)" custom option varies with quantity not "Logo Creation Fee($300)".

Example: If the product price is $50 and product have two custom options like- " Logo Creation Fee ($300)" and "Embroidery Logo Charge($35)". When we add the product(quantity 1) in a cart with both custom options (subtotal is $385).

Subtotal is: (product price ($50) + Logo Creation Fee ($300) + Embroidery Logo Charge($35)) * 1 = $385

Now, we increase product quantity (2) then subtotal is :

Subtotal is: (product price ($50) + Logo Creation Fee ($300) + Embroidery Logo Charge($35)) * 2 = $770

But I want to change in subtotal. I want subtotal like this :

Subtotal is: ((product price ($50) + Embroidery Logo Charge($35)) * 2) + Logo Creation Fee ($300) = $470 ($170 + $300)

"Logo Creation Fee ($300)" not vary with quantity, add only one quantity for one product.

Means Product's "Unit Price" display without custom option's price.

Demo URL : http://superbuniforms.com/magento/medical-lab-coat-unisex-sky-blue.html

Please suggest.

Thanks!

3
  • hi chandra bhushan whether you need output as shown this screen shot? prnt.sc/fbjupp Commented May 24, 2017 at 13:27
  • yes, but some changes. In your screenshot custom option price($238 and $ 30) not included in subtotal But I need add in subtotal. According your screenshot, I need that like- "(unit price($35.62) + frame option ($30))*2(quantity) + Square($238 *1) = $369.24(subtotal of product)" Commented May 24, 2017 at 16:56
  • You report "Fatal error: Call to a member function getValue()" but I can't see any getValue() in your code ¿? Commented Jul 31, 2017 at 18:31

1 Answer 1

1

You need to override the phtml file, and add the custom price.

app\design\frontend\venoder\theme\Magento_Catalog\templates\product\view\addtocart.phtml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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