Orders Table

Locked

Views: 2,843

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
14 Aug 2007, 3:34 PM
#1
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Orders Table

I was wondering if anyone knows where the customer information from the "address_book" and "customer" tables get inserted into the orders table at... I have some custom fields that are stored in these two tables that I need inserted along with the rest of the data that gets put in after each order. I know order.php pulls from the orders table but I don't ever see it filling these fields before it pulls from them.

thanks

14 Aug 2007, 3:47 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Orders Table

The order information is managed in the order class ...

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!]
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!

14 Aug 2007, 4:00 PM
#3
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Orders Table

yeah, thats what I have been looking at, and I am confused as to when/where in the file data is actually inserted in orders table fields. In create_account.php, the fields in tpl_modules_create_account.php, like name address and stuff are all inserted into the customers and address book tables. How does that data make it into the orders table, I sure can't find it in order.php.

14 Aug 2007, 4:45 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Orders Table

  function create($zf_ot_modules, $zf_mode = 2) {

Everything is built in there then applied to each table ...

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!]
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!

14 Aug 2007, 5:31 PM
#5
thoseguys26 avatar

thoseguys26

New Zenner

Join Date:
Jun 2007
Posts:
10
Plugin Contributions:
0

Re: Orders Table

This is sort of off topic but similar. I think it's more of a database problem but I'm not sure. I have two custom written payment mods for TransFirst; ePay and eCheck. About two weeks ago I had the Admin Activity log full so I reset it without doing a backup :( I doubt that caused any problems but the issue now is only the first order seems to be able to be inserted into the two tables related to these modules. I've dropped the tables are recreated them and the same thing happens. The cart seems to work fine by taking multiple orders and the listing seems fine but only the first order made after dropping the tables can be inserted into the tables. I'm currently waiting for the host to recreate the tables to see if that will make a difference since I can't access phpMyAdmin because the cart just has an i.p. address until it's finished so I can reroute the dns.

Hopefully that all makes sense and someone can give some advice.

14 Aug 2007, 5:43 PM
#6
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Orders Table

Ajeh:

function create($zf_ot_modules, $zf_mode = 2) {


thanks Ajeh appreciate it
12 Sep 2007, 6:43 PM
#7
jacque427 avatar

jacque427

Zen Follower

Join Date:
Apr 2005
Location:
Spokane, Washington
Posts:
324
Plugin Contributions:
0

Re: Orders Table

Bryce, did the fix work for you? Here is my quandry.....

I have a number of custom fields that customers fill out when registering.

The data is captured in the customers table of the database.

I have gotten as far as placing

No thank yous: <?php echo $order->customer['nothanks']; ?>

into super_invoice.php, the proper corresponding code into order.php in included/classes and the appropriate field into table_orders.

What I am wondering is how does the information get from the customers table into the orders table so that it will show on the invoice.

This is in ZC 1.3.7

Edit: I went into the DB, and entered some text into the field of the orders table and it shows on the invoice. So, how can I get the orders table to pull that field from the customers table like it gets the rest of the customer data?

Just knowledgeable enough to be dangerous.

12 Sep 2007, 7:48 PM
#8
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Orders Table

Ok so I take it you are storing your data from the custom field(s) in the customers table, right?

The following code populates an array from the fields in the customers table and then this array is used to populate the customer fields of the orders table....

includes/classes/orders.php

$this->customer = array('firstname' => $customer_address->fields['customers_firstname'],
                            'lastname' => $customer_address->fields['customers_lastname'],
                            'company' => $customer_address->fields['entry_company'],
                            'street_address' => $customer_address->fields['entry_street_address'],
                            'suburb' => $customer_address->fields['entry_suburb'],
                            'city' => $customer_address->fields['entry_city'],
                            'postcode' => $customer_address->fields['entry_postcode'],
                            'state' => ((zen_not_null($customer_address->fields['entry_state'])) ? $customer_address->fields['entry_state'] : $customer_address->fields['zone_name']),
                            'zone_id' => $customer_address->fields['entry_zone_id'],
                            'country' => array('id' => $customer_address->fields['countries_id'], 'title' => $customer_address->fields['countries_name'], 'iso_code_2' => $customer_address->fields['countries_iso_code_2'], 'iso_code_3' => $customer_address->fields['countries_iso_code_3']),
                            'format_id' => $customer_address->fields['address_format_id'],
                            'telephone' => $customer_address->fields['customers_telephone'],
                            'email_address' => $customer_address->fields['customers_email_address']);

I am not exactly sure what you are wanting to do but you need to either edit one of those if you want one of the orders table values to get populated by a different field than it currently is....or add a new entry to the array for your custom database field in the orders table and the custom value from the customers table.

example:
'custom_value' => $customer_address->fields['my_custom_field']);

hope some of that makes some sense.

12 Sep 2007, 8:16 PM
#9
jacque427 avatar

jacque427

Zen Follower

Join Date:
Apr 2005
Location:
Spokane, Washington
Posts:
324
Plugin Contributions:
0

Re: Orders Table

Yes, what you said makes sense.

In includes/classses/order.php I have added the line

'nothanks' => $order->fields['customers_no_thanks'],

And in super_invoice.php I have

No thank yous: <?php echo $order->customer['nothanks']; ?>

The text "No thank yous:" shows fine on the invoice, it's just that what should be pulled from the customers_no_thanks field of the customers table isn't appearing.

I even added a customers_no_thanks field to to the orders table thinking that would automatically fill in with the data from the customers table.

Just knowledgeable enough to be dangerous.

12 Sep 2007, 8:36 PM
#10
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Orders Table

If you are sure that your registration form is actually putting data in the field 'customers_no_thanks' in your customers table, then you would need to add this to the end of the array I showed you earlier:

'customers_no_thanks' must be the exact name of the field in the customers table

'nothanks' => $customer_address->fields['customers_no_thanks']);

Then try what you were trying in the invoice:

 No thank yous: <?php echo $order->customer['nothanks']; ?>

I'm not sure if that is the correct way of echoing the field because I'm not sure how the others in the invoice are being shown, but the key is that your 'customers_no_thanks' in the customers table is actually getting inserted with data from your form. If it is, then I dont see why what I have shown you would not work.

12 Sep 2007, 8:46 PM
#11
brycej2 avatar

brycej2

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Orders Table

You also need to make sure you have a 'nothanks' field in the orders table to be populated by the 'nothanks' from the customers table...or you could bypass this all and try directly echoing from the customers table instead, which is what I would do if you are still stuck after this.

12 Sep 2007, 9:29 PM
#12
jacque427 avatar

jacque427

Zen Follower

Join Date:
Apr 2005
Location:
Spokane, Washington
Posts:
324
Plugin Contributions:
0

Re: Orders Table

Got it! I had to add significant additions to different arrays and sql searches in order.php. But if anyone searches the forum for a similar issue I'll be able to point them in the right direction.

Thanks for your help. It pointed me in the right direction.

jacque

Just knowledgeable enough to be dangerous.

18 Oct 2007, 4:18 PM
#13
beto_pu avatar

beto_pu

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Orders Table

Jacque I have the same problem as you had, can you share the solution you found.

Thanx in advance

18 Oct 2007, 7:32 PM
#14
jacque427 avatar

jacque427

Zen Follower

Join Date:
Apr 2005
Location:
Spokane, Washington
Posts:
324
Plugin Contributions:
0

Re: Orders Table

Oh man! I have no idea what I did, I wish now I had posted it here.

I seem to recall that I had to add some code to a couple of files in classes in addition to adding some searches to the sql in order.php.

If I can find it i'll post here.

jacque

Just knowledgeable enough to be dangerous.