1

I'm completely new to magento and i've read some threads in this forum but i'm not quite sure whether my solution is correct.

I have a product which can change its price depending on the customers choice. for example customer can choose how many square meters of the product he wants to buy. Depending on that choice the price has to be recalculated and should be displayed immediately.

This is done via ajax call to my customized controller which overrides the "Mage_Core_Controller_Front_Action"

Second, i have registered an observer for the "catalog_product_get_final_price" event. This observer overrides the final price in the product with my own calculated final price.

My questions now are:

  1. Is this the best possible solution for this problem?
  2. Are there any problems with this solution? Did i miss something very important?
  3. What do i have to test?
1
  • i think you can use the custom or configurable product . Based on the selection you can set your product price. Commented Nov 21, 2013 at 12:09

2 Answers 2

1

I think there is a far better possibility to implement this:

You implement everything client side with "a few lines of JavaScript" (you know what I mean) to calculate the price,based on the square meter.

The square meter is implemented as custom option.

And server side, you hook into some event, I would try checkout_cart_product_add_after to set the price on the quote item. This way you don't have any rewrites, which is highly recommended and you don't need any AJAX-Request to get the price.

0

We saw your question and feel that there are much simpler ways to do it. Here are answers to your question

Is this the best possible solution for this problem?

Yes, Magento provides features of custom options, and configurable products, in case we have multiple choices of options and varying prices accordingly. You should first look into that rather than doing it into codes as Magento is really very flexible and helps a lot from Admin configurations

Some Reference Url http://www.magentocommerce.com/knowledge-base/entry/create-custom-variants-and-options-of-a-product http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product

Are there any problems with this solution? Did i miss something very important?

The problem that we foresee with this solution is that you are playing with the core files of Magento and that is not recommended. You should certainly look to see the admin options first.

What do i have to test?

You can add some test products and review them accordingly.

Let us know if you need any more assistance here.

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.