Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    50
    Plugin Contributions
    2

    Default Re: needing to add a P.O. number field to the checkout process

    Quote Originally Posted by 0be1 View Post
    Can you please post the code that you inserted into header_php.php file so others can learn from your findings? I needed to do something similar and would like to see how this was resolved.

    Thanks...

    0be1

    Sure No problem,

    This method adds the P.O. Number field to the form so that it can be saved to the database in the order table, field name po_number If this P.O. Number is needed for a payment module for level 2 or 3 transaction, you'll need to modify the payment module to pull this information out.


    in file /includes/modules/pages/checkout_confirmation/header_php.php
    line 47, added

    "//PO_number added by granville on 2007/12/10

    if(isset($_POST['po_number'])) $_SESSION['po_number'] = zen_db_prepare_input($_POST['po_number']);"



    to be able to save the p.o. number to the order in the database you have to do the following.
    in file /includes/classes/order.php
    line 54, added ",po_number"
    line 123 added ",'po_number' => $order->fields['po_number']"
    line 354 added ",'po_number' => (isset($_SESSION['po_number]) ? $_SESSION['po_number'] : '')"
    line 615 added ",'po_number' => $_SESSION['po_number']"


    the only thing I didn't do is to change the admin side to show the P.O. Number since I feel that the admin didn't need to know what the P.O. Number that the customer puts in. I imagine there could be a case where this would be needed, but I'm certain it's got to be easy to display it.

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: needing to add a P.O. number field to the checkout process

    Granville... is it necessary to create a table in the dbase to store this PO data?
    20 years a Zencart User

  3. #3
    Join Date
    Jul 2006
    Posts
    50
    Plugin Contributions
    2

    Default Re: needing to add a P.O. number field to the checkout process

    Quote Originally Posted by schoolboy View Post
    Granville... is it necessary to create a table in the dbase to store this PO data?
    No, just add the field name po_number to the existing order table. Here is some sql code to get it done.

    Code:
    ALTER TABLE `orders` ADD COLUMN `po_number` VARCHAR(15) AFTER `ip_address`;
    should be able to run this from Tools > Install SQL patches.

  4. #4
    Join Date
    Jul 2006
    Posts
    50
    Plugin Contributions
    2

    Default Re: needing to add a P.O. number field to the checkout process

    Ok guys,

    I figured I would post everything again to have it in one post. This should be everything EXCEPT the ability to edit the P.O. Number by either side. Can't have it all. These changes will place the P.O. Number field into the checkout process and will show the P.O. Number on "My Account" order list, "My Account" single order view, admin orders list, admin invoice, admin packing slip, and admin edit pages.

    Zen-Cart CORE files that needs to be edited. This will make upgrading a lot harder in the future.

    /admin/includes/classes/order.php
    /admin/orders.php
    /admin/invoice.php
    /admin/packingslip.php

    /includes/classes/order.php
    /includes/modules/pages/account_history_info/header_php.php
    /includes/modules/pages/checkout_confirmation/header_php.php


    customize the following pages for you individual templates, copy them out of the default template.

    tpl_account_default.php
    tpl__account_history_info_default.php


    let's start editing.

    Admin changes
    /admin/includes/classes/order.php
    line 37 added ", po_number" to the query
    line 78 added ", 'po_number=>$order->fields['po_number']"

    /admin/orders.php
    line 402 added " &nbsp;&nbsp;&nbsp; P.O. Number: <strong><?php echo $order->info['po_number']; ?></strong>" before the "</td>"
    line 674 added "<td class="dataTableHeadingContent" align="center">P.O. Number</td>" a whole new table cell.
    line 718 added ", o.po_number" to the query
    line 730 added ", o.po_number" to the query
    line 742 added ", o.po_number" to the query
    line 798 added "<td class="dataTableContent" align="left"><?php echo $orders->fields['po_number'];?> </td>" a whole new table cell.

    /admin/invoice.php
    line 143 added " &nbsp;&nbsp;&nbsp; P.O.Number: <strong><?php echo $order->info['po_number']; ?></strong>" before the "</td>"

    /admin/packingslip.php[/B]
    line 137 added " &nbsp;&nbsp;&nbsp; P.O.Number: <strong><?php echo $order->info['po_number']; ?></strong>" before the "</td>"




    Customer side changes
    /includes/classes/order.php
    line 54, added ",po_number"
    line 123 added ",'po_number' => $order->fields['po_number']"
    line 353 added ",'po_number' => (isset($_SESSION['po_number]) ? $_SESSION['po_number'] : '')"
    line 615 added ",'po_number' => $_SESSION['po_number']"

    /includes/modules/pages/account_history_info/header.php
    line 37 added ",o.po_order"
    line 66 added ",'po_number'=>$orders->fields['po_number']"

    /includes/modules/pages/checkout_confirmation/header_php.php
    line 47, added "if(isset($_POST['po_number'])) $_SESSION['po_number'] = zen_db_prepare_input($_POST['po_number']);"




    template changes
    tpl_account_history_info_default.php
    line 95-97 add a whole new table cell between status date and order status "<th scope="col" id="myAccountStatusPONumber">P.O. Number</th>"
    line 104-105 add another table cell between date_added and status name "<td><?php echo $order->info['po_number'];?></td>"

    tpl_account_default.php
    line 30-32 add a whol new table cell between order_number and shipped to "<th scope="col">P.O. Number</th>"
    line 43-45 add another line betwwn orders_id and order address "<td width=""><?php echo $orders['po_number']; ?></td>"



    hope this takes care of it.
    Have fun

  5. #5
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: needing to add a P.O. number field to the checkout process

    Thanks! ... I'll give this a go on a test shop. Advice to everyone who uses this. MAKE GOOD NOTES of the mods to core code... Will be helpful for future upgrades.
    20 years a Zencart User

  6. #6
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: needing to add a P.O. number field to the checkout process

    Quote Originally Posted by graper View Post
    the only thing I didn't do is to change the admin side to show the P.O. Number since I feel that the admin didn't need to know what the P.O. Number that the customer puts in. I imagine there could be a case where this would be needed, but I'm certain it's got to be easy to display it.
    I would imagine that the PO number is a very important part of the order record. I would like to use it, and mine would have to append to the order history in every respect. When a customer (or shop admin) calls up a transaction (order), it ought to be able to reconcile to a PO number, if the customer inserted such a number during checkout.
    20 years a Zencart User

  7. #7
    Join Date
    Jul 2006
    Posts
    50
    Plugin Contributions
    2

    Default Re: needing to add a P.O. number field to the checkout process

    Quote Originally Posted by schoolboy View Post
    I would imagine that the PO number is a very important part of the order record. I would like to use it, and mine would have to append to the order history in every respect. When a customer (or shop admin) calls up a transaction (order), it ought to be able to reconcile to a PO number, if the customer inserted such a number during checkout.
    hmmm.... It's a good thing the project that needed this hasn't been completed. I just realized that there a few other places where the P.O. Number needs to be displayed. The first of which is pulling it out to send to the customer via email.

    As for the admin, I feel that it depends on the admin. For the project I'm on it wasn't important to have the Cutomer's P.O. number viewable only because we discussed it and it was decided that if a customer needed to get some support on an order they the order number from zen would have to be used, only because there is the possibility that more then one customer may use the same p.o. number, rare but with that chance it's better to not use the customers p.o. as a tracking method. at which point why does the admin need to see it. Regardless it's just a matter of opinion and it should be super simple to display it on the full order page, not sure how hard to insert it into the list or orders though.

  8. #8
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: needing to add a P.O. number field to the checkout process

    I have clients who manually take order data out of zencart to input into their bespoke accountancy systems (yep.. I know... dumb to replicate the task of data input - should build a query to do this!) but right now clients have budget constraints!

    maybe Doc Byte can tell us all the instances where order information is called up and parsed into a page or email message - particularly as you say, in the e-mail order confirmation, order history, etc...
    20 years a Zencart User

 

 

Similar Threads

  1. Google Checkout Query - Add Model Number Field
    By da-design in forum Addon Payment Modules
    Replies: 1
    Last Post: 1 Nov 2012, 10:51 AM
  2. Can I reduce the number of pages in checkout process?
    By huntleybill in forum General Questions
    Replies: 3
    Last Post: 10 Nov 2011, 05:31 PM
  3. Limiting the number of characters in the 'add to cart' field to 1
    By broadnax in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 31 Dec 2009, 06:08 PM
  4. Replies: 3
    Last Post: 31 Aug 2007, 07:29 AM

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