Jump to content

Paypal web store


grucker

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by krillz
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...