Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Help showing a custom field to the admin orders.php

Help showing a custom field to the admin orders.php

Locked

Views: 1,380

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
27 Sep 2008, 10:49 AM
#1
jeronij avatar

jeronij

New Zenner

Join Date:
Sep 2008
Posts:
1
Plugin Contributions:
0

Help showing a custom field to the admin orders.php

Hello to all,

I am getting crazy with a small modification I am making to a ZC installation.
I have added a new field to the orders table, which gets fullfilled with a URL (literal) when the customer checks out. No problem with that part.

Now, I am wanting to show this field in the Admin->Orders page and after over six hours working with it, I cant get it to work :blush:

I tried to modify the order.php query function to include this field

First modification: Add the field to the select query: (order_attach is the name of the new field)

$order_query = "select order_attach, customers_id, 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, payment_module_code, shipping_method, shipping_module_code,
                         coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
                         date_purchased, orders_status, last_modified, order_total, order_tax, ip_address 
						 from " . TABLE_ORDERS . "
                        where orders_id = '" . (int)$order_id . "'"; 

Then I included this field in the $order->info array

    $this->info = array('currency' => $order->fields['currency'],
                        'currency_value' => $order->fields['currency_value'],
                        'payment_method' => $order->fields['payment_method'],
                        'payment_module_code' => $order->fields['payment_module_code'],
                        'shipping_method' => $order->fields['shipping_method'],
                        'shipping_module_code' => $order->fields['shipping_module_code'],
                        'coupon_code' => $order->fields['coupon_code'],
                        'cc_type' => $order->fields['cc_type'],
                        'cc_owner' => $order->fields['cc_owner'],
                        'cc_number' => $order->fields['cc_number'],
                        'cc_expires' => $order->fields['cc_expires'],
                        'date_purchased' => $order->fields['date_purchased'],
                        'orders_status' => $order_status->fields['orders_status_name'],
                        'last_modified' => $order->fields['last_modified'],
                        'total' => $order->fields['order_total'],
                        'tax' => $order->fields['order_tax'],
                        'ip_address' => $order->fields['ip_address'],
						'order_attach' => $order->fields['order_attach']);

Then I added this code to the orders.php page:

           <td class="main"><?php echo $order->info ['order_attach']; ?></td>

Nada. Nothing. The field value does not show using the modified functions in order.php :unsure:


After this I tried to read directly the data from orders.php, without using the function query in order.php. This is the code I wrote:

		   /**/
		   function show_attach()
		   {
		       global $db;
			   $attach=$db->Execute("SELECT order_attach FROM zen_orders WHERE orders_id='$oID'");
			   echo (string)$attach;
		   }

It does not work either :yuck: ¡¡¡

Can someone please have a quick look to this issue, and tell me what I am doing wrong ?¿

(Additionally --> I tested the SQL queries directly in PHPMyAdmin and they work fine there, and they give me the value ¡¡¡)