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

    Default Show referral on Invoice?

    I think I almost have it but need a bit of help. My client wants the referral ID showing on the invoice page. I've been taking stabs at it with limited success. In the admin/invoice.php file, I added a row below the payment method as follows:

    <tr>
    <td class="main"><b>Key Code #:</b></td>
    <td class="main"><?php echo $order->customer['coupon_code']; ?></td>
    </tr>

    The referral code did not show up but the "Key Code" label did. I tried adding the "coupon_code" to the $db->Execute above that to see if that helped but still no luck. Since I'm running out of guesses, I need help from someone who knows what they are doing <grin>.

    How can I display the referral code?

    Thanks,

    Jim Smith

    PS, BTW, nice new look to the Zen-cart.com web site!

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

    Default Re: Show referral on Invoice?

    Find the select statement in the /admin/invoice.php

    Code:
          $order_check = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,
                                        customers_suburb, customers_city, customers_postcode,
                                        customers_state, customers_country, customers_telephone,
                                        customers_email_address, customers_address_format_id, delivery_name,
                                        delivery_company, delivery_street_address, delivery_suburb,
                                        delivery_city, delivery_postcode, delivery_state, delivery_country,
                                        delivery_address_format_id, billing_name, billing_company,
                                        billing_street_address, billing_suburb, billing_city, billing_postcode,
                                        billing_state, billing_country, billing_address_format_id,
                                        payment_method, cc_type, cc_owner, cc_number, cc_expires, currency,
                                        currency_value, date_purchased, orders_status, last_modified
                                 from " . TABLE_ORDERS . "
                                 where orders_id = '" . (int)$oID . "'");
    coupon_code is not in there ... you need to add the field then you can call the Coupon Code used for that order with:
    Code:
    $order_check->fields['coupon_code']
    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: Show referral on Invoice?

    Ajeh,
    That took care of it. The same thing worked for adding the referral code to the packing slip if anyone is looking for that as well. Thanks!

    Regards,

    Jim Smith

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

    Default Re: Show referral on Invoice?

    Oops! I spoke too soon. What I wanted to show up on the invoice is the referral code, not the coupon code. I unsuccessfully tried a few variations like this:

    <?php echo $order_check->fields['customers_referral'];

    Can you please tell me what I should be using and whether to include it in the $db->Execute list or not. Thanks.

    Jim Smith

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

    Default Re: Show referral on Invoice?

    While you could get the customer's referal code ... would this really have a desired effect as once the referral code is assigned to a customer it remains always the same ...

    It would be easier to make a function to look-up the customers_referral from the customers table based on the orders customers_id ...

    Then, you could just echo the function on the invoice.php ...
    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!

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

    Default Re: Show referral on Invoice?

    Quote Originally Posted by Ajeh
    While you could get the customer's referal code ... would this really have a desired effect as once the referral code is assigned to a customer it remains always the same ...
    Yes it seems odd on the surface but this client prints each invoice as his record for sales. The referral code tells him which organization gets credit for that order. His staffers look at each day's invoices and generate a manual report based upon that. The Reports/Customer Referral report will be helpful for him to reconcile these reports but he still wants it to appear on each invoice as well.

    Quote Originally Posted by Ajeh
    It would be easier to make a function to look-up the customers_referral from the customers table based on the orders customers_id ...

    Then, you could just echo the function on the invoice.php ...
    That's what I need some help with. I've tried to guess at it but coming up empty. Can I get some help putting that together?

    Thanks,

    Jim Smith

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

    Default Re: Show referral on Invoice?

    Quote Originally Posted by Ajeh
    It would be easier to make a function to look-up the customers_referral from the customers table based on the orders customers_id ...

    Then, you could just echo the function on the invoice.php ...
    Here's the closest unsuccessful guess I've hobbled together so far if that makes it easier:
    =================
    <?php

    // look-up customer referral code from customers table
    function zen_get_customers_referral ($lookup) {
    global $db;

    if ($lookup==0) {
    return 'Unspecified';
    }

    $check_options = $db->Execute("select customers_referral
    from " . TABLE_CUSTOMERS . "
    where customers_referral_code='" . $lookup . "'");

    return $order_check->fields['customers_referral_code'];
    }
    ?>
    ===================

    Thanks. js

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

    Default Re: Show referral on Invoice?

    Add a function to a new file and put it in the /admin/includes/functions/extra_functions

    Code:
      function zen_get_orders_customers_referral($orders_id) {
        global $db;
        $sql = "SELECT customers_id from " . TABLE_ORDERS . " where orders_id='" . $orders_id . "'";
        $check_orders = $db->Execute($sql);
        $check_customers_id = $check_orders->fields['customers_id'];
        $sql = "SELECT customers_referral from " . TABLE_CUSTOMERS . " where customers_id='" . $check_customers_id . "'";
        $check_customers_referral = $db->Execute($sql);
        return $check_customers_referral->fields['customers_referral'];
      }
    Then to see the results in /admin/invoice.php stick this inside a php area:
    Code:
    echo 'I SEE ' . zen_get_orders_customers_referral((int)$oID) . '<br>';
    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!

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

    Default Re: Show referral on Invoice?

    Ajeh,
    That took care of it. Thanks!

    Jim Smith

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

    Default Re: Show referral on Invoice?

    Glad that the new code could work for you ... thanks for the update ...
    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!

 

 

Similar Threads

  1. Inserting Referral field into invoice
    By blarney in forum Managing Customers and Orders
    Replies: 7
    Last Post: 4 Feb 2011, 09:18 AM
  2. Show shipping method on invoice
    By droidwork in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 May 2009, 04:20 PM
  3. Show manufacturer on invoice?
    By digitalrust in forum Managing Customers and Orders
    Replies: 10
    Last Post: 20 Apr 2007, 02:36 AM
  4. what is Referral / how to use Referral in zencart?
    By jikey in forum Basic Configuration
    Replies: 1
    Last Post: 20 Mar 2007, 04:31 AM

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