Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customers - Orders problem


jim_d

Recommended Posts

Posted

When I click on ?Customers - Orders? in ?Administration,? I get this error message:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0, 20' at line 1

 

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 orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by limit 0, 20

 

[TEP STOP]

 

What is the problem here?

Posted

You have no order by field in that query.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

Thanks for the reply. I don't understand what you are telling me. I found this code in the admin/orders.php file:

if (isset($HTTP_GET_VARS['cID'])) {

      $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);

      $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 . "' and ot.class = 'ot_total' order by $order";

    } elseif (isset($HTTP_GET_VARS['status'])) {

      $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 $order";

    } 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 $order";

    }

Apparently, the "order by" field is "$order" (I guess.) Do I need to make a change to this orders.php file, or do I need to make a change to the database (or both or neither?)

Posted

I've added Download_Controllerv5.3 and echo1.7.4. Both seem to work properly as far as I can tell. Also, Shipping and Sales tax isn't showing up at checkout, but might be unrelated. Everything else seems to be working fine.

Posted

I've really been struggling with this, and have made some progress. I found that I could completely remove order by $order in the three locations it exists in the admin/orders.php file, and actually get the orders to display . . . with no error message!

 

The only problem is that I can't use the sort feature. Regardless of how I try to sort the orders, they always sort by ascending date.

 

My conclusion is that there is a problem with the $order variable.

 

So I searched, and found that it is defined within the admin/orders.php file as:

<?php

  if (($action == 'edit') && ($order_exists == true)) {

    $order = new order($oID);

?>

What should I do next? Anyone have any ideas?

Archived

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

×
×
  • Create New...