[ic] Discount problem

Scott Kennedy interchange-users@interchange.redhat.com
Wed May 15 13:22:01 2002


On Wed, 15 May 2002, Ed LaFrance wrote:

|At 11:26 AM 05/15/2002 -0500, you wrote:
|>Well, I'm still having trouble with this.  I've tried several different
|>things.
|>Below is the most current code.  In my previous posts on this subject, I
|>neglected to mention that the discounts weren't being calculated right.  I
|>have
|>corrected that problem now.  The discounts are supposed to be stacked meaning
|>that a discount is applied to the total and then another discount is
|>applied to
|>the discounted total.  In other words, the percentages aren't applied to the
|>original total (the total of the order before any discounts) unless only one
|>discount has been selected.
|>
|>Anyway, the problem is that when the checkout form gets refreshed the newly
|>discounted total isn't displayed right away.  For example, let's say the order
|>total is $1,000.  If a 10% discount is selected (please see code below), the
|>displayed total should be $900 after the checkout form gets
|>refreshed.  Instead,
|>the total shown is $1,000.  If I refresh the checkout page again the correct
|>total of $900 is shown.  This same problem happens again as additional
|>discounts
|>are selected.  Also, I'd imagine that an incorrect total would be shown on the
|>receipt page if the order were finalized without refreshing the checkout
|>page a
|>second time first.  Speaking of recalculating the order, the correct order
|>total
|>will also be displayed if I go to another page and then come back to the
|>checkout or basket page.  Could someone please tell me what I am doing wrong
|>here?  I'm sure that my code could be greatly improved and simplified.
|>
|>[del of big nasty mess]
|
|Ugh. One thing you are doing wrong is posting unreadable masses of
|characters, then asking people to try to make sense of it -  don't expect
|much help unless you code is formatted for some semblance of readability.

Yeah, that was pretty messy.  I'll try to format things better in the future.
Does text wrap on posted messages?  My email program automatically wraps text.
I can change the point at which it wraps at to whatever I want to.

|Where is the actual code which applies the discount in relation to the
|cart display. If it is below the cart, that is your problem; move it up above
|the cart and you will see the discount without that second refresh.

That was the problem.  Well, part of the problem anyway.  I am still getting an
error message in the log file.  I think I know how to fix that.  The discount
routine doesn't like it if you return the subtotal, I believe.  I can solve that
problem with if-then clauses.  I don't think it likes you to return zero either.
Despite the error message, everything seems to work okay.  Anyway, thank you for
your help.  I really appreciate it!

|- Ed L.
|
|
|===============================================================
|New Media E.M.S.               Software Solutions for Business
|463 Main St., Suite D          eCommerce | Consulting | Hosting
|Placerville, CA  95667         edl@newmediaems.com
|(530) 622-9421                 http://www.newmediaems.com
|(866) 519-4680 Toll-Free       (530) 622-9426 Fax
|===============================================================
|
|_______________________________________________
|interchange-users mailing list
|interchange-users@interchange.redhat.com
|http://interchange.redhat.com/mailman/listinfo/interchange-users
|


***********************************************************
/ Custom Web Promotions /
Economical web hosting & online storefronts featuring
Red Hat Linux 7.2 & Red Hat Interchange 4.8.5
http://custweb.com / 888-287-8932 / sales@custweb.com
***********************************************************