Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2005
    Location
    Connectiuct
    Posts
    70
    Plugin Contributions
    1

    Default Inserting Referral field into invoice

    I am customizing Zen Cart 1.3.8a in the admin area. My goal is to display the customers_referral field into the invoice page in the admin area. I wanted this in the super_invoice.php page but even tried it in the regular invoice.php page without success.

    I need an extra set of eyes to see what I did wrong. I created a call (between the lines below) which I assume would return the customer's customers_referral field for a particular order.

    If I echo the $customers_ref, I get "Object" rather than the customer's referral string. If there is a simple way to insert the referral code on each invoice, I'd be glad to scrap this and try something different. Any help appreciated!
    ################################################################################
    // Find Referrer
    $customers_ref = $db->Execute("SELECT customers.customers_id, customers.customers_referral, orders.customers_id, orders.orders_id
    FROM " . TABLE_CUSTOMERS . "
    LEFT JOIN " . TABLE_ORDERS . "
    ON customers.customers_id = orders.customers_id
    WHERE orders.orders_id = '" . $oID . "'
    ");

    if ($customers_ref->fields['customers_referral'] = '') {
    $customers_referral = 'empty';
    }
    else {
    $customers_referral = $customers_ref;
    }



    - - - snipped to body - - -

    <?php echo $customers_referral; ?>
    ################################################################################

    Regards,

    Jim Smith

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Inserting Referral field into invoice

    Do you want to echo the $customers_ref or the $customers_ref->fields['customers_referral'] ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2005
    Location
    Connectiuct
    Posts
    70
    Plugin Contributions
    1

    Default Re: Inserting Referral field into invoice

    Thanks Ajeh. Actually either way shows "Object" as the results. Not something I've ever run into.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Inserting Referral field into invoice

    how about the missing equal sign on the IF ...

    Code:
    // Find Referrer
    $customers_ref = $db->Execute("SELECT customers.customers_id, customers.customers_referral, orders.customers_id, orders.orders_id
    FROM " . TABLE_CUSTOMERS . "
    LEFT JOIN " . TABLE_ORDERS . "
    ON customers.customers_id = orders.customers_id
    WHERE orders.orders_id = '" . $oID . "'
    ");
    
    if ($customers_ref->fields['customers_referral'] == '') {
    $customers_referral = 'empty';
    }
    else {
    $customers_referral = $customers_ref->fields['customers_referral'];
    }
    
    
    
    //- - - snipped to body - - -
    
     echo $customers_referral;
    Got me too ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Oct 2005
    Location
    Connectiuct
    Posts
    70
    Plugin Contributions
    1

    Default Re: Inserting Referral field into invoice

    Ajeh
    Thanks for the extra set of eyes. The two errors you spotted combined with my trial and error method of fixing it finally paid off. It now works. For anyone else needing something similar, here is how I added the referral field into the super invoice (which should work with the regular invoice or packing slip if needed):

    In the super_invoice.php (or other similar page), above the doctype, paste the following:

    // START Referrer ID
    $customers_ref = $db->Execute("SELECT customers.customers_id, customers.customers_referral, orders.customers_id, orders.orders_id
    FROM " . TABLE_CUSTOMERS . "
    LEFT JOIN " . TABLE_ORDERS . "
    ON customers.customers_id = orders.customers_id
    WHERE orders.orders_id = '" . $oID . "'
    ");

    if ($customers_ref->fields['customers_referral'] == '') {
    $customers_referral = '<i>***empty***</i>';
    }
    else {
    $customers_referral = $customers_ref->fields['customers_referral'];
    }
    // END Referrer ID

    In the body (I put it below the table row with the payment method) I pasted the following:

    <!-- START REFERRAL ID -->
    <tr>
    <td class="main"><b>Referral Code #:</b></td>
    <td class="main"><?php echo $customers_referral; ?>
    <br></td>
    </tr>
    <!-- END REFERRAL ID -->

    That should take care of it. Thanks again to Ajeh!

    Regards,

    Jim Smith

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Inserting Referral field into invoice

    You are most welcome ... thanks for posting your final solution on this ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Jun 2008
    Posts
    10
    Plugin Contributions
    0

    Default Re: Inserting Referral field into invoice

    I am just posting my HUGE THANK YOU for this thread. I was able to add refferer info to the orders page in the admin in a snap with this code. I just added it right before the doctype heading. I found out the hard way that the sql part of the code has to be after some of the other sql code in the page so that it has the order and customer ids to run with. :)

  8. #8
    Join Date
    Sep 2010
    Posts
    612
    Plugin Contributions
    0

    Default Re: Inserting Referral field into invoice

    This is an old post that is related to what I'm needing help with...so hopefully someone can lead me in the right direction.

    How would I add the customer's referral code so that they can view it from their customer account screen?

    Thank you!

 

 

Similar Threads

  1. v151 php arrays for inserting into one database field
    By delia in forum General Questions
    Replies: 8
    Last Post: 11 Sep 2013, 03:27 PM
  2. Referral Field at Checkout
    By skinnyalbert in forum General Questions
    Replies: 0
    Last Post: 8 Aug 2011, 03:01 PM
  3. Show referral on Invoice?
    By blarney in forum Customization from the Admin
    Replies: 9
    Last Post: 13 May 2006, 08:53 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR