Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

From order confirmation to orders table


musicmaestro

Recommended Posts

Posted

I need to pass the field WEIGHT from the products table to a field I have created in the orders table with the same name.

 

The reason for this is the WEIGHT field is used to store a UPC/SKU number in our products table and we need this to show on the customers invoice when it is transfered after order confirmation.

 

How do you do this?

 

Thank you.

Posted
I need to pass the field WEIGHT from the products table to a field I have created in the orders table with the same name.

 

The reason for this is the WEIGHT field is used to store a UPC/SKU number in our products table and we need this to show on the customers invoice when it is transfered after order confirmation.

 

How do you do this?

 

Thank you.

 

Surely someone has had some experience of this. Come on guys, just give us an idea where to look or what to do.

 

Thank you

Posted

ok, here is some more information:

 

I have set up a website using oscommerce and all is working perfectly. One of the tables is called products and a field within that is called WEIGHT. This particular field is a VARCHAR(15) and at present is populated by a UPC/SKU number via uploading CSV files via phpmyadmin to reflect on titles on the website.

 

There is also another table called orders_products[b/]. I have looked at this table which is quite limited in the amount of fields it has so I added one called WEIGHT being the same as the field in the products table.

 

The reason for this question is, when we check our orders the UPC/SKU number will be shown on the customers order, we just copy and paste this into a Visual FoxPro app we have and this in turn creates an order to the supplier. We have been using barcode scanners to speed up the process with our procedures, hence the effort to do the same with this one.

 

Explanation out of the way....

 

Can someone please advise how to get the information from the products field WEIGHT and into the orders_products table at the time of ordering? I have posted this same question on the oscommerce forum but without reply.

 

I have managed to create, amend and do some updates to our site purely by research but will admit that I'm not an expert in php (but willing to give it a go).

 

If someone could just direct or advise me I would be grateful

 

Many thanks

 

Steve

Posted

you need to change 6 files minimum.

 

catalog\includes\classes\order.php

catalog\checkout_process.php along with any other payment module if it follows its own checkout process

catalog\admin\includes\classes\order.php

catalog\admin\invoice.php

catalog\admin\orders.php

catalog\admin\includes\classes\order.php

 

In order for the weight field to propagate all the way to the invoice script. So you retrieve it from the shopping cart class, pass it to the order class, store it in the database and then with the admin changes you will be able to view it from the order class to the orders or invoice.

Posted
you need to change 6 files minimum.

 

catalog\includes\classes\order.php

catalog\checkout_process.php along with any other payment module if it follows its own checkout process

catalog\admin\includes\classes\order.php

catalog\admin\invoice.php

catalog\admin\orders.php

catalog\admin\includes\classes\order.php

 

In order for the weight field to propagate all the way to the invoice script. So you retrieve it from the shopping cart class, pass it to the order class, store it in the database and then with the admin changes you will be able to view it from the order class to the orders or invoice.

 

Enigma1

 

Thank you. Now I have somewhere to look.

 

I am grateful to you

 

Steve.

Posted
Enigma1

 

Thank you. Now I have somewhere to look.

 

I am grateful to you

 

Steve.

 

enigma1

 

Just checking the folders you mentioned and there is a duplicate:

 

catalog\admin\includes\classes\order.php

 

Is this a type as you mention six files?

 

Thank you

Steve

Posted

yes there is a duplicated line. Just ignore it, five files minimum then.

Posted
Thank you

 

Steve

 

enigma1

 

I have downloaded the five files concerned. Now I'm not looking for anyone to do this for me as I'm willing to have a go myself but can you give me some idea of what lines I need to edit.

 

I've noticed in the checkout_proccess.php file a line:

 

// Update products_ordered (for bestsellers list)

 

After this is there is an sql statement:

 

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

Would I be on the right lines if I were to add a line like:

 

'products_weight' => $order->products[$i]['weight'],

 

If so, can you give me some guidance on the other files?

 

Thank you so far

 

Stsve

Posted

yes but before doing that you need to insert a new column with the order_products table called products_weight. In fact the checkout_process.php should be the last file to modify.

Posted

Hi - may I ask, how on earth do I get my orders to show? There has been a live realtime purchase made, and tons of tests done, but the orders never show for me in oscomm. I have manipulated line 357 in orders.php, still to no avail. And I have "pending" set as default. Please help!!! You seem like you know your stuff!!!!

 

Thanks in advance

Posted
yes but before doing that you need to insert a new column with the order_products table called products_weight. In fact the checkout_process.php should be the last file to modify.

 

Enigma1

 

I have already done created a field in the orders table called products_weight. This matches the same one as the products table (products_weight) it's a VARCHAR(15)

 

Steve

Posted

Can anyone help any further with this?

 

I have changed all the five php files with what I think should be done (adding that extra line etc) but now I'm at a dead stop.

 

Thank you in anticipation

 

Steve

Posted

Now managed to change the field to not null and the field transfers from the products table to the orders_products (perfect so far because now I know it's there via phpmyadmin!)

 

I just need a little help guys on how to get the field on the order. I found the orders.php file in admin and found a block of code which I think is where the products_weight should go so I changed "model" to "weight" but this doesn't work.

 

Please can someone help me with this bit?

 

Thank you

 

Code from orders.php

 

echo ' </td>' . "\n" .

' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";

echo ' </tr>' . "\n";

}

Posted

It was an SQL statement that was causing the problem. I just added the field concerned and now it works.

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_weight, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

 

It is a shame that the experts don't look after those without the experience. If I saw a post and knew the answer, I would offer advice every time. I am SURE someone knew the answer to this.

 

TFS

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...