Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Posts
    7
    Plugin Contributions
    0

    Default 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

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default 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.

  3. #3
    Join Date
    Jun 2009
    Posts
    7
    Plugin Contributions
    0

    Default Re: Issue with placing the 1st order

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

    Arthur

 

 

Similar Threads

  1. Replies: 1
    Last Post: 13 Dec 2011, 12:15 PM
  2. Layout issue / css problem with IE only. Can't find the issue!
    By linnx in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 2 Apr 2011, 10:54 AM
  3. Placing a test order
    By VisExp in forum General Questions
    Replies: 2
    Last Post: 13 Mar 2009, 02:17 AM
  4. 1st download link out of place and the rest not in order
    By kjoistudios in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 9 Dec 2007, 06:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg