If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Customization from the Admin / Adding Fax/ Tel number to the orders list

Adding Fax/ Tel number to the orders list

Started by dgents on 12 Mar 2022, 9:25 PM · Views: 2,617

Results 1 to 7 of 7
12 Mar 2022, 9:25 PM
#1
dgents avatar

dgents

New Zenner

Join Date:
Apr 2017
Location:
United Kingdom
Posts:
4
Plugin Contributions:
0

Adding Fax/ Tel number to the orders list

Looking at the orders page, as in the list of all your orders... it currently has the order numbers, customers names, company names, date of order etc.

It is possible to display all the customers telephone / fax numbers in that list too?

Reason being is I have changed the fax number field on sign up to a 'how did you hear about us' field, and I would like to see all these in the orders list, instead of manually having to click on each customer and go into their details to see the information.

Many thanks

David

12 Mar 2022, 10:18 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Adding Fax/ Tel number to the orders list

In 1.5.6, look at admin/orders.php line 967. That's where the name is displayed in the list. Add the phone number after the display of company like this:

. '<br>' . $orders->fields['customers_telephone'];

so it looks like this:
<td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a> ' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br>' . $orders->fields['customers_company'] : '') . '<br>' . $orders->fields['customers_telephone']; ?></td>

Then on line 897, you'll see where $new_fields is defined. Add ", o.customers_telephone" to the list.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

12 Mar 2022, 10:46 PM
#3
dgents avatar

dgents

New Zenner

Join Date:
Apr 2017
Location:
United Kingdom
Posts:
4
Plugin Contributions:
0

Re: Adding Fax/ Tel number to the orders list

Thats perfect, thanks very much, all works. Whats the field name for fax number?

12 Mar 2022, 11:11 PM
#4
dgents avatar

dgents

New Zenner

Join Date:
Apr 2017
Location:
United Kingdom
Posts:
4
Plugin Contributions:
0

Re: Adding Fax/ Tel number to the orders list

swguy:

In 1.5.6, look at admin/orders.php line 967. That's where the name is displayed in the list. Add the phone number after the display of company like this:

. '<br>' . $orders->fields['customers_telephone'];

so it looks like this:
<td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a>##' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br>' . $orders->fields['customers_company'] : '') . '<br>' . $orders->fields['customers_telephone']; ?></td>

Then on line 897, you'll see where $new_fields is defined. Add ", o.customers_telephone" to the list.

Ive just tried customers_fax too but I then get this error...

1054 Unknown column 'o.customers_fax' in 'field list'
in:
[select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total, o.customers_company, o.customers_email_address, o.customers_street_address, o.delivery_company, o.delivery_name, o.delivery_street_address, o.billing_company, o.billing_name, o.billing_street_address, o.payment_module_code, o.shipping_module_code, o.ip_address, o.customers_fax from (orders o ) left join orders_status s on (o.orders_status = s.orders_status_id and s.language_id = 1) left join orders_total ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') order by o.orders_id DESC limit 0, 500]

Is this because no one has yet filled a fax number in when they signed up? I only just turned this on..

13 Mar 2022, 7:08 AM
#5
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Re: Adding Fax/ Tel number to the orders list

customers_fax is not stored in the orders table so you won't be able to look it up from there. It's only stored in the customers table. There's 2 things you could do:

  • look it up from the customers table - can be inaccurate in case the customer changes it after placing the order
  • modify the orders table and add customers_fax field, and then modify the includes/classes/order.php to make sure customers_fax is being stored in the orders table when the order is placed. This way you always get the data that was relevant at the time of purchase.

P.S. option #2 can be done using observers so you don't need to modify core files

My site - Pro ZC Help
My portfolio | My plugins

13 Mar 2022, 9:10 AM
#6
dgents avatar

dgents

New Zenner

Join Date:
Apr 2017
Location:
United Kingdom
Posts:
4
Plugin Contributions:
0

Re: Adding Fax/ Tel number to the orders list

balihr:

customers_fax is not stored in the orders table so you won't be able to look it up from there. It's only stored in the customers table. There's 2 things you could do:

  • look it up from the customers table - can be inaccurate in case the customer changes it after placing the order
  • modify the orders table and add customers_fax field, and then modify the includes/classes/order.php to make sure customers_fax is being stored in the orders table when the order is placed. This way you always get the data that was relevant at the time of purchase.

P.S. option #2 can be done using observers so you don't need to modify core files

Viewing it from the customers table would be absolutely fine.

Do you know what code adjustments would be required?

13 Mar 2022, 12:48 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Adding Fax/ Tel number to the orders list

If you were going to use an observer, you could get the customer's phone number there too. Use NOTIFY_ADMIN_ORDERS_LIST_EXTRA_COLUMN_DATA.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.