jephmat Posted March 9, 2004 Share Posted March 9, 2004 Hello! Recently I've helped with the installation and modification of an OSCommerce shopping cart for our client, a Northern California Vineyard. I made a modifcation in shopping_cart.php along the path catalog/includes/classes/shopping_cart.php. That is where I modified the total calculation to include discounts for orders of 6 and 12 bottles of wine or more. The discounted function works just fine, displaying the discounted price and even the money saved as the customer moves along with the order, that is until the final confirmation page, where a non-discounted total price is displayed. What happened to the discount? It dissapears in the last stages! I am somehwat confused by all of this. I can only assume that order_confirmation.php is recalculating the total price of the order, and I am trying to find out how to modify the final confirmation order so that the discount, which is explained below, is included. (Read on only if you are curious about the grisly details!) Due to the semi-complex nature of the discount, the price is calculated through a routine. 6 bottles of wine receive a 5% discount. 12 bottles of wine receive a 10% discount. Bottles not included in 12 or 6 sets are charged full price. That is, if you buy 13 bottles of wine, you would get the first 12 for 10% off, and the 13th bottle would be full price. If you bought 20 bottles of win, you would get the first 12 at 10% off, the next 6 at 5% off, and the last 2 would be full price. The line in shopping_cart.php that I modified was this one: $this->total += tep_add_tax($products_price, $products_tax) * $qty; I added a routine to calculate the number of 12 sets, and then see if there is a remaining 6 set and added the discounted price times the 12 sets and/or the 6 set to the $this->total variable, and then any leftover bottles are full pirce, adjusting the $qty variable throughout the procedure. And that's what's what. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.