Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Admin back side orders


blr044

Recommended Posts

I made a mistake with customers DB. So deleted customers orders manually in DB. Then inserted back into database customers I wanted to keep. So after doing a test purchase with dummy customer, customer received email and also the info is in DB. But no orders appear under orders in Admin.

 

Hope I did not do something wrong. This is the code from orders.php that I belive that has something to with with orders not appearing:

 

	  $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id DESC";
} elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) {
  $status = tep_db_prepare_input($HTTP_GET_VARS['status']);
  $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC";
} else {
  $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC";

 

Now when I deleted customer, i also did it in the address book, customers and all orders tables.

 

So now am trying to figure what I did wrong or need to look.

 

Thanks.

 

Bennett

Link to comment
Share on other sites

I would try running the queries in phpMyAdmin and seeing what comes up. My guess is that there is something wrong with the data in either orders_status or orders_total. Try the following

select orders_status_id, count(*) from orders group by orders_status_id

select * from orders_status

select * from orders_total

select count(ot.orders_total_id)  from orders o left join orders_total ot on (o.orders_id = ot.orders_id)

How many rows do you get back from each query?

Always back up before making changes.

Link to comment
Share on other sites

This is the results:

 

select orders_status_id, count(*) from orders group by orders_status_id

 

 

SQL query:

 

SELECT orders_status_id, count( * )

FROM orders

GROUP BY orders_status_id

LIMIT 0 , 30

 

MySQL said:

 

#1054 - Unknown column 'orders_status_id' in 'field list'

 

****************************************************************************

 

select * from orders_status

MySQL returned an empty result set (i.e. zero rows). (Query took 0.3989 sec)

 

******************************************************************************

 

select * from orders_total

Showing rows 0 - 3 (4 total, Query took 0.0219 sec)

 

*****************************************************************************

select count(ot.orders_total_id) from orders o left join orders_total ot on (o.orders_id = ot.orders_id)

count(ot.orders_total_id)

4

Link to comment
Share on other sites

This is the results:

 

 

Thanks.

 

 

Maybe found problem. Orders status was empty. Copied orders_status from a few backups and now orders is visible. Now i will rerun tour suggestions and recheck a few other things.

 

Bennett

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...