Too Cool Posted April 4, 2013 Share Posted April 4, 2013 I would like to know in which file in presta shop the product price is calculated? I have added two attributes to one of the products, but I would like to do something like if(product_id = 44) { attribute1 + (attribute1 x attribute2) = the price }else { the usual calculation... } Right now the price changes according to what is selected in attribute1 + attribute2, I couldnt find any help on presta documentation and I really need this. Link to comment Share on other sites More sharing options...
PascalVG Posted April 6, 2013 Share Posted April 6, 2013 Looks like it's in the file /classes/Product.php look for function: public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction, $id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0) { ... in this function, you see a part : ... // Attribute price if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0)) { $attribute_price = Tools::convertPrice($result['attribute_price'] !== null ? (float)$result['attribute_price'] : 0, $id_currency); if ($id_product_attribute !== false && !is_null($id_product_attribute)) // If you want the default combination, please use NULL value instead $price += $attribute_price; // this looks like the normal calculation... } ... Didn't try to change myself, but maybe try and see if this does something My 2 cents, pascal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now