Forums / General Questions / Where the order details are subbmited in SQL?

Where the order details are subbmited in SQL?

Locked

Views: 1,063

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
11 Aug 2009, 6:07 PM
#1
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Where the order details are subbmited in SQL?

Hi there,
Im trying to add new filed for product and i made it well.
However i want this field value to be inserted in order table too.
The deal is that i cannot find the file where this happend.
I need to know what file make the query for inserting this info in SQL, like product information, total price.. basicly all info or the order.
Any ideas where it might be?
Than you in advance

11 Aug 2009, 6:59 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where the order details are subbmited in SQL?

The product details for the order are saved to the database in the create_add_products() method of the order class.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Aug 2009, 8:10 PM
#3
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

DrByte:

The product details for the order are saved to the database in the create_add_products() method of the order class.

Thanks i will try to do this...

19 Aug 2009, 6:35 PM
#4
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

DrByte:

The product details for the order are saved to the database in the create_add_products() method of the order class.

ok i tried to find this, but i did not had a success with my task.
I dont know if you get my idea correct so i will try to explain it one more time...

I want to add a extra field for a product (just like for example "model"). I menage to do this. Now i want this filed to be saved in orders_products table when order is placed. So i add this new filed in orders_products table, and now i seek a way to add a value in it.
For example:
product has model=test and newfiled=test1 in his database table (products). When order is placed in orders_products table for model "test" value is set in this filed, but the newfield is empty (instead of containing test1 as a value)
So i seek how orders_products table is filled with product information from products table when order is placed.
Any ideas?
Thank you in advance

19 Aug 2009, 6:43 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where the order details are subbmited in SQL?

Add your field name and its value to this list in that file:```
$sql_data_array = array('orders_id' => $zf_insert_id,
'products_id' => zen_get_prid($this->products[$i]['id']),
'products_model' => $this->products[$i]['model'],
'products_name' => $this->products[$i]['name'],
'products_price' => $this->products[$i]['price'],
'final_price' => $this->products[$i]['final_price'],
'onetime_charges' => $this->products[$i]['onetime_charges'],
'products_tax' => $this->products[$i]['tax'],
'products_quantity' => $this->products[$i]['qty'],
'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
'product_is_free' => $this->products[$i]['product_is_free'],
'products_discount_type' => $this->products[$i]['products_discount_type'],
'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
'products_prid' => $this->products[$i]['id']);
zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Aug 2009, 6:48 PM
#6
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

I already did this, but the field is still empty...
here is my code

$sql_data_array = array('orders_id' => $zf_insert_id,
                              'products_id' => zen_get_prid($this->products[$i]['id']),
                              'products_model' => $this->products[$i]['model'],
                              'products_catalogue_number' => $this->products[$i]['products_catalogue_number'],
                              'products_name' => $this->products[$i]['name'],
                              'products_price' => $this->products[$i]['price'],
                              'final_price' => $this->products[$i]['final_price'],
                              'onetime_charges' => $this->products[$i]['onetime_charges'],
                              'products_tax' => $this->products[$i]['tax'],
                              'products_quantity' => $this->products[$i]['qty'],
                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                              'product_is_free' => $this->products[$i]['product_is_free'],
                              'products_discount_type' => $this->products[$i]['products_discount_type'],
                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                              'products_prid' => $this->products[$i]['id']);
      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

I also added this in folowing places:

$orders_products_query = "select orders_products_id, products_id, products_name,
                                 products_model, products_catalogue_number, products_price, products_tax,
                                 products_quantity, final_price,
                                 onetime_charges,
                                 products_priced_by_attribute, product_is_free, products_discount_type,
                                 products_discount_type_from
                                  from " . TABLE_ORDERS_PRODUCTS . "
                                  where orders_id = '" . (int)$order_id . "'
                                  order by orders_products_id";
$this->products[$index] = array('qty' => $new_qty,
                                      'id' => $orders_products->fields['products_id'],
                                      'name' => $orders_products->fields['products_name'],
                                      'model' => $orders_products->fields['products_model'],
                                      'products_catalogue_number' => $orders_products->fields['products_catalogue_number'],
                                      'tax' => $orders_products->fields['products_tax'],
                                      'price' => $orders_products->fields['products_price'],
                                      'final_price' => $orders_products->fields['final_price'],
                                      'onetime_charges' => $orders_products->fields['onetime_charges'],
                                      'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
                                      'product_is_free' => $orders_products->fields['product_is_free'],
                                      'products_discount_type' => $orders_products->fields['products_discount_type'],
                                      'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);

Anything that i missed?

19 Aug 2009, 6:52 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where the order details are subbmited in SQL?

If you want to add it via the $this->products array, then you'll have to work your way back through the code to where the $this->products array is populated, and make sure it gets the data at that time. In some cases it may mean also going back to the shopping_cart class and adding the data there too.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Aug 2009, 6:55 PM
#8
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

DrByte:

If you want to add it via the $this->products array, then you'll have to work your way back through the code to where the $this->products array is populated, and make sure it gets the data at that time. In some cases it may mean also going back to the shopping_cart class and adding the data there too.

Thanks, will try this now

19 Aug 2009, 7:05 PM
#9
nidkolio avatar

nidkolio

New Zenner

Join Date:
May 2009
Posts:
55
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

Thanks for your help!!:clap:
It works now as i wanted.

28 Aug 2009, 9:41 PM
#10
mkonchalski avatar

mkonchalski

New Zenner

Join Date:
Dec 2008
Posts:
18
Plugin Contributions:
0

Re: Where the order details are subbmited in SQL?

I have an interesting variation of this question...

I have modified the Products with Attributes Stock contrib, to write to the Database a SKU number. Every product has a variation...I would love to give a live link to the site, however I cannot as I'm developing via WAMP locally.

What I need to have the MODEL field, pull the SKU from another database table. I can find the logic where the PRODUCTS_MODEL gets pulled from the TABLE_PRODUCTS, your explanation was great.

Where would I add the information to pull the SKU from the

table_products_with_attributes_stock??