Forums / Managing Customers and Orders / Capture additional product information for an order

Capture additional product information for an order

Locked

Views: 1,705

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
17 Jun 2010, 3:09 PM
#1
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Capture additional product information for an order

Hi,

Hopefully you guys can help me out, tried searching with no answers.

My question is, can I add additional fields to the orders_products table that stores the information for each product of an order. What I want to achieve is from a txt box on the product page store this into a field when added to basket as you would with qty – and record this in the orders_products table once the user checks out.

The reason for doing this instead of using attributes which is an obvious solution is because I already capture attributes, but I want to be able to sort using my own report(sql) products by the additional field I will capture.

Many Thanks

18 Jun 2010, 5:21 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Capture additional product information for an order

You have explained why you want this but have not elaborated on what it is....
There may be a 3rd paety module already created or one you can base upon

Zen-Venom Get Bitten

18 Jun 2010, 8:50 AM
#3
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Hi Kobra Thanks for your reply.

From searching their isnt a module for what I need, but I didnt elaborate on the exact field because eventually I need to store various other information that will make it easier to sort orders. All mods I've found add extra information for the order, and not the ordered products.

18 Jun 2010, 10:17 AM
#5
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Hi Thanks for your suggestion, this only adds fields for the actual product, whereas I want to record information regarding the ordered product, for eample final_price is stored within orders_products.

I've got a suspition that this is handled in orders.php so just trying to figure it it is.

Thanks

18 Jun 2010, 1:50 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Capture additional product information for an order

This is done in the order.php class ...

The actual information being put into the orders_products table is done around 738-752:

      $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);

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!

18 Jun 2010, 2:42 PM
#7
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Thanks Ajeh,

So now I know how to store it, lastly how can I store the value to begin with from the product page when the user adds the product to cart.

As an idea somthing like this on the product page?

$this->products['new_field] = document.getElementById('new_field');

18 Jun 2010, 5:17 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Capture additional product information for an order

You can obtain the information in any manner to store in the orders_products table ...

So if the data you need is not available, you can gather it from the products table or whatever and add it to the fields you need via that array to be run to update the orders_products 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!

22 Jun 2010, 9:04 PM
#9
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Hi, Im still struggling.

I now know how to store extra information into the order_products table, but from the product page how do I first capture extra information.

Say I have a textbox on the product page 'colour', how do I store this as a variable for that product when added to cart. I'm guessing the logic is within the shopping_cart class but cannot figure how to do it.

I know attributes would work but I need specific information separate so I can sort orders by it.

I would really appreciate more help on this.

Thanks

24 Jun 2010, 12:43 PM
#10
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Still trying to figure this out. Within the shopping cart class theres the add_to_cart class, I'm guessing any additional information has to be passed within that.

Also for what I'm wanting to achieve, would I first have to store any new information regarding the product in the customers basket table?

Would really appreciate any help with this.

Thanks

24 Jun 2010, 1:58 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Capture additional product information for an order

Where is this text box for color on the product's page coming from?

Is it in the products table? Is it an Attribute?

If in the products table what is the field name?

Do you have a matching field name in the orders_products 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!

24 Jun 2010, 2:48 PM
#12
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Hi Ajeh,

The value that I want to store isnt in any tables, to get this working I want a textbox which can have text written in which becomes the value that will be stored, placing this into a variable that will then be stored in the orders_products table with the relevant field name.

For example

Product Page > text box [colour] > store txt in $colour
Process Order > put $colour in orders_products [colour]

The reason for this is I can store information for each ordered product.

24 Jun 2010, 2:58 PM
#13
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Capture additional product information for an order

Having another thought about this, I can still use attributes to store the data, I was thinking I couldnt then sort orders by these BUT I could create a WHERE attributename = the attribute I want to sort orders by.

Maybe I was over complicating it the other way