0

I have a product with multiple options.

The user chooses how much he wants to pay for the product. First I have created a dropdown box with the values €5,- €10,- etc. The product price i have put to €0.

When I choose 10 euros, the product changes to 10 euros - that's good.

Now I want a checkbox where users can choose between Exclude Tax and Include Tax, so if I choose excluding tax the product will be inserted in the shopping cart as €10,00 witch is ok (excluding tax). But when I choose Including tax the product needs to be inserted in the shopping cart as 10 /1.21 = €8,26 (excluding tax).

How can I make this possible?

EDIT:

I have the following code:

$event = $observer->getEvent();
$quote_item = $event->getQuoteItem();

    if (is_array($quote_item->getOptions())) { 
        foreach ($quote_item->getOptions() as $optionValue) { 
            echo ???? . ' --> ' . $optionValue->getValue() . '<br />';
        } 
    } 

This will give me the values from the options. But how do I get the real option_id? I get the option_type_id now.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
FamousWolluf
  • 568
  • 1
  • 3
  • 25

1 Answers1

0

If you look to below page app/design/frontend/default/default/template/catalog/product/price.phtml

you will find  below code

<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
        <span class="price-excluding-tax">
            <span class="label"><?php echo $_taxHelper->__('Excl. Tax:') ?></span>
            <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                <?php echo $_coreHelper->currency($_price+$_weeeTaxAmount,true,false) ?>
            </span>
        </span>
        <span class="price-including-tax">
            <span class="label"><?php echo $_taxHelper->__('Incl. Tax:') ?></span>
            <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                <?php echo $_coreHelper->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
            </span>
        </span>
    <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
        <span class="price-excluding-tax">
            <span class="label"><?php echo $_taxHelper->__('Excl. Tax:') ?></span>
            <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                <?php echo $_coreHelper->currency($_price+$_weeeTaxAmount,true,false) ?>
            </span>
        </span>

to implement you can refer

Changing the price in quote while adding product to cart: magento

Community
  • 1
  • 1
Anil Gupta
  • 632
  • 4
  • 16
  • I can show the price at the product view with jQuery. But how can I save the product with excluding tax instead of including tax. As example U choose 10 euro and the option excluding Tax then it needs to insert 8,26 euro in the shopping cart – FamousWolluf Jun 27 '13 at 11:46
  • you need to checkout_cart_save_before event observer and then modify item price for selected product – Anil Gupta Jun 27 '13 at 11:47
  • hi,you have to get value of your radio button and through observer you can modify product prices – Anil Gupta Jun 28 '13 at 12:12