grucker Posted March 24, 2010 Report Share Posted March 24, 2010 Good morning, The shop works and the whole world is sunny except a cloud has appeared on the horizon. When viewing the cart I would like an option to load a members discouunt code which would give a discount off the product costs and apply the new total before sending to PayPal. At the minute I have members logging in and then going to their own store which is a copy of the main store with different prices. It works but is an awful lot of updates for nothing. Just wondered if possible or are there any alternatives at all. Kindest regards David Quote Link to comment Share on other sites More sharing options...
administrator Posted March 24, 2010 Report Share Posted March 24, 2010 Hi, Is this using the Paypal built-in cart or is this a custom cart interfacing with Paypal? Stefan Quote Link to comment Share on other sites More sharing options...
grucker Posted March 24, 2010 Author Report Share Posted March 24, 2010 It is the site I built from the videos I purchased from yourselves and customised with the help of this forum. the view cart page is the original. I would like to reduce the cost price by 10% if a members code was entered code was entered. Regards David Quote Link to comment Share on other sites More sharing options...
administrator Posted March 24, 2010 Report Share Posted March 24, 2010 Ah ... now I understand, you bought the PHP shopping cart with paypal video course. I would create a new class or function (called say: discount-calculator()) that checks to see if the proper discount code was entered, if so, then the function/class would reduce the total purchase amount by 10% ... simple math. .. This would be done in the controller. Does that make sense? Stefan Quote Link to comment Share on other sites More sharing options...
grucker Posted March 25, 2010 Author Report Share Posted March 25, 2010 Hello, I think I could do the function. What I have difficulty seeing is if I do a text box and submit button on the cart page where do I send the discount number information and how? Regards David Quote Link to comment Share on other sites More sharing options...
administrator Posted March 25, 2010 Report Share Posted March 25, 2010 ... where do I send the discount number information and how? Why do you want to send it? We need a better outline of your intentions ... Quote Link to comment Share on other sites More sharing options...
grucker Posted March 25, 2010 Author Report Share Posted March 25, 2010 Good evening, attached are the three relevent files. I just want a way that a registered user can get a discount at the view cart stage. Thanks Regards David ShoppingCart.php templates.php viewCart.php Quote Link to comment Share on other sites More sharing options...
krillz Posted March 25, 2010 Report Share Posted March 25, 2010 (edited) Now I do not know how the layout of the shopping cart is, however I suppose you got the usual shopping cart / view shopping cart before you go ahead accepting the purchase. Well in the view shopping cart you could add a new input field for the costumer code to get the discount. Add a new function to validate the code in your validation class or whatever you are using to check if the code exists, if the code is accepted add the discount to the total cost and charge that through paypal, if not display that the code was not valid. You got the: public function GetTotal() { // add tax here.. return $this->GetSubTotal() + $this->GetShippingCost(); } so you in your case you could write the code validation function then modify the above function somthing a long the lines: if validationCode was accepted return Subtotal+shippingcost - discount otherwise return Subtotal + shippingCost. Also you do realise you just made the code for the shopping cart publicly available for people to grab? It might be an issue if the cost for the tutorial was not only charged for the tutorial but code as well. Edited March 25, 2010 by krillz 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.
Note: Your post will require moderator approval before it will be visible.