Jump to content

Add custom calculation to cart


Recommended Posts

Hi

I've some experience of php but never added/edited and custom extensions before and hoping someone could tell me what is needed to add a custom calculation to cart.

 

The user chooses a material that has a certain price per meter. Then the user enters height and width (in metres or cm) in an input box and selects the style. Then presses calculate, if the user is in agreement with the calculated price the usual checkout process continues.

 

Behind the scenes the price is controlled by width, height and style. I can’t simply multiply height x width as this is governed by additional formula as the width only comes in set sizes. In addition the style has a bearing on price.

 

I’m thinking of simplifying the pricing structure so it fits within an existing extension as an option.

Another option is to create an extension so that the cart behaves in this way.

 

Any advice helpful as new to this area. Thanks

Link to comment
Share on other sites

I would tie your code in product::getPriceStatic and product::priceCalculation. More in the latter, probably. Make sure it can access your measurements and simply modify the output price if they're there

You might need to change orderDetail as well, and cart::getProducts. SOunds like a tough job ;)

Link to comment
Share on other sites

×
×
  • Create New...