tzunami Posted January 8, 2004 Share Posted January 8, 2004 I have recently installed the Actual Attribute Price (AAP v1.0b) modification. While the modification itself is very good (showing the actual prices of different selected attributes when there is no +/- prefix included). Presently the code works as expected for everything except the Shopping Cart. Example... *For non-british users VAT is tax at 17.5%* Product: Glass Top Tables/Pot Stands Product Price: 64.95 Inc VAT (Exc 55.2766) Attribute1: Size - Set of Both Attribute Price: 55.2766 Attribute Price Inc VAT: 64.95 Attribute2: Size - Small Attribute Price: 23.7872 Attribute Price Inc VAT: 27.95 Attribute3: Size - Large Attribute Price: 34.0000 Attribute Price Inc VAT: 39.95 When I select attribute 1 from the drop-drown list and add to cart, everything works fine - the price of 64.95 displays correctly in the Shopping Cart, as does the subtotal of 64.95. If instead I select attribute 2 or 3, the subtotal of the shopping cart is incorrect. There seems no reasoning however for the value of the subtotal. If in this example I have only the small option in the cart (attribute 2) the price displays (correctly) as 27.95, but the subtotal is displayed as 33.48 (when it should be 27.95) With attribute 3 (large) only in the shopping cart, the price is correct (39.95), but the subtotal is again wrong (43.69) when it should be 39.95. There seems no logic or reasoning to this, and hiding the shopping cart would be a very drastic measure for something that is probably very simple. I have been looking everywhere for the answer, so if anyone has it then please please please help me out! I've included the code from the two modified files (I have also installed attribute sortv 1.0 if that helps anyone) [THE FOLLOWING IS THE ADDED CODE FROM SHOPPING_CART.PHP catalog/includes/classes/shopping_cart.php] // BOF - AAP V1.0 - updated to account for no price prefix to equal actual price // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if (($price_prefix == '') and ($option_price != 0)) { if ($price_prefix == '') { $this->total += $qty * tep_add_tax(tep_adjust_price($option_price, $products_price), $product_tax); } } } } } } // subtotal function for attributes price function attributes_price($products_id) { $attributes_price = 0; if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $attributes_price += $option_price; } if ($price_prefix == '-') { $attributes_price -= $option_price; } if (($price_prefix == '') and ($option_price != 0)) { $attributes_price += tep_adjust_price($option_price, $products_price); } } } return $attributes_price; } // EOF - AAP V1.0 [THE FOLLOWING IS THE ADDED CODE FROM GENERAL.PHP /catalog/includes/functions/general.php] // BOF AAP V1.0 // actual attribute price adjustment (used with no price prefix only) function tep_adjust_price($attribute, $price) { global $currencies; $adjustment = ($attribute-$price); return $adjustment; } //EOF AAP V1.0 Many thanks Tom Quote Link to comment Share on other sites More sharing options...
nainesh Posted January 22, 2004 Share Posted January 22, 2004 hi i have the same problem, did you or anyone else have a solution? Please please cheers Quote Link to comment Share on other sites More sharing options...
tzunami Posted January 22, 2004 Author Share Posted January 22, 2004 Yep, I've (or rather our programmer!) has found the solution - I'll be posting it as a mod soon... Left the fix on my work PC - so i'll send you the fix tomorrow, If you really need it sorted today I might be able to FTP the relevant section? Tom Quote Link to comment Share on other sites More sharing options...
nainesh Posted January 24, 2004 Share Posted January 24, 2004 thanks tom look forward to receiving the fix nainesh Quote Link to comment Share on other sites More sharing options...
tzunami Posted January 26, 2004 Author Share Posted January 26, 2004 The fix is ready... Hopefully sort things out for you, but i'm no programmer! - you'll have to un-install the original mod and put this one in. Let me know how you get on... Tom Quote Link to comment Share on other sites More sharing options...
tzunami Posted January 26, 2004 Author Share Posted January 26, 2004 oops almost forgot... Actual Attribute 1.2 Quote Link to comment Share on other sites More sharing options...
nainesh Posted January 28, 2004 Share Posted January 28, 2004 cheers seems to be working just fine, though a problem with the sorting order of the list. thanks for your help Quote Link to comment Share on other sites More sharing options...
tzunami Posted January 29, 2004 Author Share Posted January 29, 2004 There is a contribution that will sort that out - I think it's called something like "Attribute Sort" Tom Quote Link to comment Share on other sites More sharing options...
nainesh Posted April 20, 2004 Share Posted April 20, 2004 having installed the latest contribution have the problem again where the shopping cart total is incorrect. Sorry tom ... thanks for the help you've been giving Quote Link to comment Share on other sites More sharing options...
tzunami Posted April 20, 2004 Author Share Posted April 20, 2004 Sorry nainesh - been looking into it, but can't seem to figure out what is causing your errors :-( Quote Link to comment Share on other sites More sharing options...
nainesh Posted April 22, 2004 Share Posted April 22, 2004 no probs thanks for trying. Sites down at the mo. should be back up later today Quote Link to comment Share on other sites More sharing options...
nainesh Posted April 28, 2004 Share Posted April 28, 2004 still got probs with discounted prices not showing their proper value, when using actual attributes. (see previous message) nainesh Quote Link to comment Share on other sites More sharing options...
Guest Posted June 3, 2004 Share Posted June 3, 2004 hello i am have the same prob with: The total is wrong, the sub-total is right?? Someone help please?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.