3

I'm selling salads on my menu and have a bunch of toppings options (in custom options). Each topping is $0.50, but I'd like to make the first choice free. As in, you get one free topping.

Is this simple to code? or can you point me in the right direction?

Thank you!

scrollup
  • 153
  • 3

2 Answers2

0

You need to make adjustments on both frontend and backend codes. On frontend you can edit the catalog/product/view/options.phtml file. Around line 115 (magento 1.8), you will see:

$$('body .product-custom-option').each(function(element){

In this loop the code goes through all available options in this product, and you can tell to ignore it by exiting the function. But the order of process is the order of options in the product (as it is set in the backend).

After you care sattisfied with the result on the frontend you will have to do the same thing in the backend before the product is added to the cart. You will have to overwrite this file: app\code\core\Mage\Catalog\Model\Product\Type\Abstract.php, inside the _prepareProduct() method, around lines 361 - 367

Alex Dinca
  • 2,147
  • 15
  • 16
  • Thanks for pointing me where to look. I'll check it out and see if I can work it out myself, if not, I'll ask for more assistance :) thanks for the quick response. – scrollup May 22 '14 at 15:34
  • Ok, I checked out the code. But it seems above my coding skills atm. If you can be more specific that would be awesome, but considering that it can take significant time to put work into this I'd understand if you decline.

    TODO: Learn moar coding.

    – scrollup May 25 '14 at 13:12
0

It would seem that the simplest way to do this (i.e. no coding) would be to create two custom options on the simple product:

The first one would be a dropdown that would contain all the options but have a zero price increase.

The second custom option would be a repeat of all the options in the first menu but this one would contain the extra pricing.

pzirkind
  • 2,906
  • 1
  • 30
  • 41