Forums / Contribution-Writing Guidelines / new column in TABLE_ORDERS_PRODUCTS

new column in TABLE_ORDERS_PRODUCTS

Locked

Started by robbie_79 on 27 Nov 2008, 8:45 PM · Views: 2,631

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
27 Nov 2008, 8:45 PM
#1
robbie_79 avatar

robbie_79

New Zenner

Join Date:
Oct 2008
Location:
Netherlands
Posts:
26
Plugin Contributions:
0

new column in TABLE_ORDERS_PRODUCTS

Hello,

I'm new to ZC and am experiencing some hard times in finding my way around the scripts. Hopefully anyone can point me into the right direction.

I added a new column (products_cost) in the products table and orders_products table.
When an order is placed, I need the products_cost data to be inserted in to the new column in the orders_products table.

Which files need to be edited to achive this?

thank you for your time ;)
cheers

Robbie
jensmode.nl
Zen Cart 1.3.8a --> 1.3.9d

28 Nov 2008, 4:38 AM
#2
kobra avatar

kobra

Black Belt

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

Re: new column in TABLE_ORDERS_PRODUCTS

As most things around this take place in includes/classes/shopping_cart.php this would be a good place to begin

Zen-Venom Get Bitten

28 Nov 2008, 4:56 AM
#3
drbyte avatar

drbyte

Sensei

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

Re: new column in TABLE_ORDERS_PRODUCTS

If you look for references to TABLE_ORDERS_PRODUCTS in the /includes/classes/order.php file, you'll see where the insert happens. You'll have to add your extra field to the array of fields being passed to the zen_db_perform() function.

.
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.

28 Nov 2008, 2:42 PM
#4
robbie_79 avatar

robbie_79

New Zenner

Join Date:
Oct 2008
Location:
Netherlands
Posts:
26
Plugin Contributions:
0

Re: new column in TABLE_ORDERS_PRODUCTS

Thank you both very much for your reply.

Before I posted my question here in the forum, I edited the orders class so it inserts the data in TABLE_ORDERS_PRODUCTS.
Also the shopping_cart class was changed to retreive data out of TABLE_PRODUCTS.

Now what happens is that the inserted data is zero, while it should insert the data from TABLE_PRODUCTS.

What am I missing here?

Robbie
jensmode.nl
Zen Cart 1.3.8a --> 1.3.9d

28 Nov 2008, 2:47 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: new column in TABLE_ORDERS_PRODUCTS

If you want to keep it simple, then instead of changing the shopping_cart class, why don't you just read the data from the products table fresh when you need it (in the orders class just before writing to the orders_products table), especially since the data has no relevance to the customer?

.
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.

28 Nov 2008, 4:11 PM
#6
robbie_79 avatar

robbie_79

New Zenner

Join Date:
Oct 2008
Location:
Netherlands
Posts:
26
Plugin Contributions:
0

Re: new column in TABLE_ORDERS_PRODUCTS

That's probably a good idea. Sometimes I want to desperately keep all codes as original as possible...without any reason.

The past year I worked quite intence with phpbb3, which was, along with its community forums, my main learning school for mysql and php. Now starting with zc while thinking it would be the same as phpbb 3, i find myself lost many times

Robbie
jensmode.nl
Zen Cart 1.3.8a --> 1.3.9d