Originally Posted by
mc12345678
No, the detail was very helpful.
Now to see how I can explain how to address the issue, why the desired results are not being seen, what was not quite being considered correctly.
So, it seems the issue is that there are conditions at which the "standard" process doesn't give the desired results. Lets just consider the cases where the cart total was above the minimum desired, but some extra feature drove the total below the desired amount.
The desire is to allow the situations where ones own money is being used, but to stop the situations where the store is "giving" money.
The two conditions identified right now for that to happen are gift certificates (one's own money) and coupons (the store's money). Both of these cause the total to go below the threshold.
Ok, on the same page right?
Well, thing is, that logic needs to be considered in addressing the handling of the new situation.
Now there are at least two ways that come to mind on how to address it. I have a preference, but it also can depend on how complicated the follow-on action is.
So, the first and my preferred at the moment, is to keep your existing initial evaluation: if the price is lower than it should be, enter this area of evaluation.
Now check why it is low, if it is because of a gift certificate, then continue in a positive direction, allowing the customer to checkout and bypass any "stop" code. The action to otherwise occur is the stop code and message. I leave the coding logic to whatever you choose, but generally speaking the easier it is to read, the easier it is to follow/modify in the future.
The other alternative is to continue with these multiple ifs/elseifs... in the situation described above, because both situations cause the total to be too low, then the action that is to be allowed, should be evaluated first. If the value is low because a gift certificate hasn't been used, then the next thing to consider is if the value is low at all and if so, to stop execution.
Note, that this logic is also dependent on only one or the other being used... for example, what is the handling if the total is low because both a gift certificate *AND* a coupon was used?
Reviewing that on an if statement may be a lot of work. Afterall, its not necessarily a check that a gift certificate was used at all, but even if one or more gift certificates were used, do their total used value plus the current total equal or exceed the lower limit?
Anyways, what I'm getting at is with the new criteria attempted to be used and based on what drives the problem, the first if is always true when using a gift certificate or coupon and therefore the elseif is never reached. Swapping the order of the checks would at least allow evaluation of the gift certificate aspect such that if it isn't the cause the next check is executed which would identify that it is low and then execute.
Alternatively, as in my first example (preferred), the final value is low, now within that area, further evaluation can be done to determine why it is low and if it is ok to be low, carry on if not then "stop".
Bookmarks