Guest Posted December 14, 2008 Share Posted December 14, 2008 Hi I am trying to add another firled "author" to the invoice. I have the invoice all setup and i am attempting to pull the "author" data from the TABLE_ORDER_PRODUCTS. However "author" has not been written to TABLE_ORDER_PRODUCTS. Where when placing an order do you write to TABLE_ORDER_PRODUCTS? For example when you place an order oscommerce writes "model" to TABLE_ORDER_PRODUCTS, where does it do this? Checkout_confirmation.php? I have looked but i can't figure out where it does it, please help. Thanks Link to comment Share on other sites More sharing options...
Guest Posted December 14, 2008 Share Posted December 14, 2008 Anyone help? Please. Link to comment Share on other sites More sharing options...
slawless Posted July 22, 2009 Share Posted July 22, 2009 Anyone help? Please. I have a similar problem, I want to write an extra field to TABLE_ORDERS but can't find where the data is written to this. I want to display an extra product code to the checkout_confirmation page and also showing on the invoice and in the admin->orders section. Did you get a solution? Link to comment Share on other sites More sharing options...
Guest Posted July 22, 2009 Share Posted July 22, 2009 I'll have to go back and look specifically at the invoice page and see where it pulls data from. Frequently on these pages they pull data from multiple tables and you need to link them in the query. For instance, in table_order_products there might be a product_id. In the products table you can link to that same ID to pull more info about the product, like author or title. Hi I am trying to add another firled "author" to the invoice. I have the invoice all setup and i am attempting to pull the "author" data from the TABLE_ORDER_PRODUCTS. However "author" has not been written to TABLE_ORDER_PRODUCTS. Where when placing an order do you write to TABLE_ORDER_PRODUCTS? For example when you place an order oscommerce writes "model" to TABLE_ORDER_PRODUCTS, where does it do this? Checkout_confirmation.php? I have looked but i can't figure out where it does it, please help. Thanks Link to comment Share on other sites More sharing options...
slawless Posted July 24, 2009 Share Posted July 24, 2009 I'll have to go back and look specifically at the invoice page and see where it pulls data from. Frequently on these pages they pull data from multiple tables and you need to link them in the query. For instance, in table_order_products there might be a product_id. In the products table you can link to that same ID to pull more info about the product, like author or title. Where does the TABLE_ORDERS get written to? After the cart, where are the fields passed? Link to comment Share on other sites More sharing options...
♥ecartz Posted July 24, 2009 Share Posted July 24, 2009 Where does the TABLE_ORDERS get written to? After the cart, where are the fields passed?checkout_process.php Always back up before making changes. Link to comment Share on other sites More sharing options...
smeagol2009 Posted July 24, 2009 Share Posted July 24, 2009 The field should be added the orders table during the checkout process on checkout_process.php. Presumably this 'author' field came from a contribution? If so, go back and check the install instructions again and make sure you havent missed anything. Or do the following Open catalog/checkout_process.php Find 'products_model' => $order->products[$i]['model'], Replace with 'products_model' => $order->products[$i]['model'], 'products_author' => $order->products[$i]['author'], Find (' . $order->products[$i]['model'] . ') Replace with (' . $order->products[$i]['model'] . ') (' . $order->products[$i]['author'] . ') Once the new field has been written the database it should be a straight forward as doing something like the following In admin/invoice.php Find ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; And replace with ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['author'] . '</td>' . "\n"; Next you would need to open admin/orders.php Find <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . And below you should add <td class="dataTableContent" valign="top">' . $order->products[$i]['author'] . '</td>' . "\n" . Next, open admin/includes/classes/order.php Find $orders_products_query = tep_db_query("select orders_products_id, orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('id' => $orders_products['orders_products_id'], 'qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); And replace with (or add the bold text to your own if it is already modified) $orders_products_query = tep_db_query("select orders_products_id, orders_products_id, products_name, products_model, products_author, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('id' => $orders_products['orders_products_id'], 'qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'author' => $orders_products['products_author'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); Now open catalog/includes/classes/order.php Find products_model, Replace with products_model, products_author, Find 'model' => $orders_products['products_model'], Replace with 'model' => $orders_products['products_model'], 'author' => $orders_products['products_author'], Find 'model' => $products[$i]['model'], Replace with 'model' => $products[$i]['model'], 'author' => $products[$i]['author'], Now open catalog/includes/classes/shopping_cart.php Find p.products_model, Replace with p.products_model, p.products_author, Find 'model' => $products['products_model'], Replace with 'model' => $products['products_model'], 'author' => $products['products_author'], That should just about do it, you may need to tweak it a bit ie. author may be called something different Link to comment Share on other sites More sharing options...
slawless Posted July 25, 2009 Share Posted July 25, 2009 The field should be added the orders table during the checkout process on checkout_process.php. Presumably this 'author' field came from a contribution? If so, go back and check the install instructions again and make sure you havent missed anything. Or do the following Open catalog/checkout_process.php Find 'products_model' => $order->products[$i]['model'], Replace with 'products_model' => $order->products[$i]['model'], 'products_author' => $order->products[$i]['author'], Find (' . $order->products[$i]['model'] . ') Replace with (' . $order->products[$i]['model'] . ') (' . $order->products[$i]['author'] . ') Once the new field has been written the database it should be a straight forward as doing something like the following In admin/invoice.php Find ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; And replace with ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['author'] . '</td>' . "\n"; Next you would need to open admin/orders.php Find <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . And below you should add <td class="dataTableContent" valign="top">' . $order->products[$i]['author'] . '</td>' . "\n" . Next, open admin/includes/classes/order.php Find $orders_products_query = tep_db_query("select orders_products_id, orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('id' => $orders_products['orders_products_id'], 'qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); And replace with (or add the bold text to your own if it is already modified) $orders_products_query = tep_db_query("select orders_products_id, orders_products_id, products_name, products_model, products_author, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('id' => $orders_products['orders_products_id'], 'qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'author' => $orders_products['products_author'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); Now open catalog/includes/classes/order.php Find products_model, Replace with products_model, products_author, Find 'model' => $orders_products['products_model'], Replace with 'model' => $orders_products['products_model'], 'author' => $orders_products['products_author'], Find 'model' => $products[$i]['model'], Replace with 'model' => $products[$i]['model'], 'author' => $products[$i]['author'], Now open catalog/includes/classes/shopping_cart.php Find p.products_model, Replace with p.products_model, p.products_author, Find 'model' => $products['products_model'], Replace with 'model' => $products['products_model'], 'author' => $products['products_author'], That should just about do it, you may need to tweak it a bit ie. author may be called something different Hi Smeagol, Thanks for the info. I have tried your process using 'code' instead of 'products_author' as this is my field in the products table. I'm now just getting a blank page when it reaches checkout_process.php and no data is written to table orders_producs. Any ideas on where it might be going wrong? My aim is to display on all the documents you listed, invoices etc. and also on the checkout_confirmation page. Link to comment Share on other sites More sharing options...
smeagol2009 Posted July 25, 2009 Share Posted July 25, 2009 Hi Smeagol, Thanks for the info. I have tried your process using 'code' instead of 'products_author' as this is my field in the products table. I'm now just getting a blank page when it reaches checkout_process.php and no data is written to table orders_producs. Any ideas on where it might be going wrong? My aim is to display on all the documents you listed, invoices etc. and also on the checkout_confirmation page. Please send me all the files I askled you to edit and I will take a look for you. I'll PM you my email address. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.