AbanteCart Community

AbanteCart Development => Customization help => Topic started by: cookie on January 10, 2014, 09:43:48 AM

Title: Final price on product page - where/how is that calculated?
Post by: cookie on January 10, 2014, 09:43:48 AM
Hi hi,

An other question :)

I could not figure out how/where the final price on the product page is calculated (the updated price on bottom of the product page, after options if options are used), can you help?

And where's the formula to calculate that final updated price ?!

I want to achieve smth like this for some of the products (so I'll 1st need to set an "if" array to apply to those product IDs only - and have no clue how to define that?)):

I'd use options to add variable parts to the product, each variable having a different weight. I was thinking to define that weight in % but have a rule which does not allow the summ of all chosen options together to be larger than 100 (like 100% is the maximum possible, right?). Like having a product where the customer could chose the % of each ingredient, making sure the max. % is not higher than 100%)

Can you help me with that?

Thank you!



Title: Re: Final price on product page - where/how is that calculated?
Post by: abantecart on January 11, 2014, 12:45:35 PM
How is this a support thread?  ???

This is a customization. I move this to right location.

If you intend to change price calculation, you need to know PHP coding.

Title: Re: Final price on product page - where/how is that calculated?
Post by: cookie on January 11, 2014, 05:36:04 PM
well, I don't know what it is, fact is I am still in the stage of evaluating what the cart can do and if I could use it  :-\
So before talking about any customizations I 1st need to know if this cart is the solution in the 1st place.

I was just looking for information about where those price calculations happen and how are the variables called so that I know what I search for ...

Could you help by answering that?

Is smth like what I wrote doable with this cart ?

Thank you in advance!
Title: Re: Final price on product page - where/how is that calculated?
Post by: eCommerce Core on January 11, 2014, 09:44:00 PM
Regardless of your project stage, your question is related to customization and not normal support. I have to agree on this.

AbanteCart is very flexible and many things are possible, but it is recommended to use extension development to add features.
I suggest you read on dev manual and concepts:
http://www.abantecart.com/document_wiki/index.php/Main_Page

To answer your question.
Quote
I could not figure out how/where the final price on the product page is calculated (the updated price on bottom of the product page, after options if options are used), can you help?

And where's the formula to calculate that final updated price ?!

Look at this file:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/product/product.php

You need lines 178 thru 228

Note $this->data array is pushed to the template and  $this->data['product_price'] becomes $product_price in the template product.tpl.

Hope this helps.