Forums / Managing Customers and Orders / Issue with placing the 1st order

Issue with placing the 1st order

Locked

Views: 996

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
3 Jul 2009, 1:23 AM
#1
aforzon avatar

aforzon

New Zenner

Join Date:
Jun 2009
Posts:
7
Plugin Contributions:
0

Issue with placing the 1st order

Hi Everyone,

Here is my issue I am experiencing.
I just put up a new site, http://www.imajercleaners.com.

Once a customer logs in, in the tpl_header.php, I've added the following:

<?php if(isset($_SESSION['customer_id'])){ $check = $db->execute('select sum(amount) as amount from ' . TABLE_STORE_CREDIT . ' where customers_id='. (int)$_SESSION['customer_id']); $amount = $check->fields['amount']; ?> <td align="left" class="bold">Balance:<?php echo $currencies->format($amount);?></td> <?php }else{ $amount = 0; } ?>

This is so that the customer can see their account balance at the top of the page.

The problem is after the 1st purchase, the amount of the purchase displays in the store credit, I need to manually set the credit to 0 otherwise the amount of the 1st purchase is displayed in the header.

After setting to 0, the purchases do not affect the credit.
Please let me know if I am being unclear about my explanation.

Thank you,

Arthur

7 Jul 2009, 1:37 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Issue with placing the 1st order

Perhaps check something basic like maybe your choice of using the "$amount" variable might be conflicting with another variable used somewhere else on the page?
Or maybe you should be setting it to 0 before you even run the query?
Or, maybe you might need to study the way the Store Credit addon you're using stores its data and calculates its balances, and adapt your code to match, if it doesn't already? (I've not used the addon, so can't comment on it, but if you've got a logic error somewhere then that might be why you're getting results you're not expecting.)

And, it might also be good to put your <td> ... </td> code outside your PHP loop, otherwise it won't display if the amount is zero.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Jul 2009, 3:21 PM
#3
aforzon avatar

aforzon

New Zenner

Join Date:
Jun 2009
Posts:
7
Plugin Contributions:
0

Re: Issue with placing the 1st order

Thank you for your suggestions. I am looking at a few options.

Arthur