Категории |
не меняется статус заказа.Пос сути все изложу. при попытке обновиться статус заказа автоматически ему выставляется значение "не проверен". 09/08/2011 12:08:07 | 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 '' at line 1 | select customers_status_id from os_customers_status_orders_status where orders_status_id = | /admin/orders.php?page=1&oID=275&action=update_order код из order.php <?php /* ##################################### # ShopOS: Скрипты интернет-магазина # Copyright (c) 2008-2009 # http://www.shopos.ru # Ver. 1.0.0 ##################################### */ defined( '_VALID_OS' ) or die( 'Прямой доступ не допускается.' ); class order { var $info, $totals, $products, $customer, $delivery; function order($order_id) { $this->info = array(); $this->totals = array(); $this->products = array(); $this->customer = array(); $this->delivery = array(); $this->query($order_id); } function query($order_id) { $order_query = os_db_query("select customers_name, customers_cid, customers_id, customers_vat_id, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, payment_class, shipping_class, cc_type, cc_owner, cc_number, cc_expires, cc_cvv, comments, currency, currency_value, date_purchased, orders_status, last_modified, orig_reference, login_reference, customers_status, customers_status_name, customers_status_image, customers_ip, language, customers_status_discount from " . TABLE_ORDERS . " where orders_id = '" . os_db_input($order_id) . "'"); $order = os_db_fetch_array($order_query); $totals_query = os_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . os_db_input($order_id) . "' order by sort_order"); while ($totals = os_db_fetch_array($totals_query)) { $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']); } $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'payment_class' => $order['payment_class'], 'shipping_class' => $order['shipping_class'], 'status' => $order['customers_status'], 'status_name' => $order['customers_status_name'], 'status_image' => $order['customers_status_image'], 'status_discount' => $order['customers_status_discount'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'cc_cvv' => $order['cc_cvv'], 'comments' => $order['comments'], 'language' => $order['language'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']); $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'csID' => $order['customers_cid'], 'vat_id' => $order['customers_vat_id'], 'shop_id' => $order['shop_id'], 'ID' => $order['customers_id'], 'cIP' => $order['customers_ip'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address'], 'orig_reference' => $order['orig_reference'], 'login_reference' => $order['login_reference']); $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']); $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']); $index = 0; $orders_products_query = os_db_query("select orders_products_id,products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price,allow_tax, products_discount_made from " . TABLE_ORDERS_PRODUCTS . " where orders_id ='" . os_db_input($order_id) . "'"); while ($orders_products = os_db_fetch_array($orders_products_query)) { $this->products = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'id' => $orders_products['products_id'], 'opid' => $orders_products['orders_products_id'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'discount' => $orders_products['products_discount_made'], 'final_price' => $orders_products['final_price'], 'allow_tax' => $orders_products['allow_tax']); $subindex = 0; $attributes_query = os_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . os_db_input($order_id) . "' and orders_products_id = '" . $orders_products['orders_products_id'] . "'"); if (os_db_num_rows($attributes_query)) { while ($attributes = os_db_fetch_array($attributes_query)) { $this->products['attributes'] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } $index++; } } } ?> код из orders.php <?php /* ##################################### # ShopOS: Скрипты интернет-магазина # Copyright (c) 2008-2009 # http://www.shopos.ru # Ver. 1.0.0 ##################################### */ defined('_VALID_OS') or die('Прямой доступ не допускается.'); ?> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td colspan="5" class="pageHeading" width="100%"> <?php os_header_url('export.png',TABLE_HEADING_ORDERS,os_href_link(FILENAME_ORDERS, '', 'NONSSL')); ?> </td> </tr> <tr class="dataTableHeadingRow"> <td width="40%" class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMER; ?></td> <td width="10%" class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td> <td width="10%" class="dataTableHeadingContent"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td> <td width="20%" class="dataTableHeadingContent"><?php echo TABLE_HEADING_STATUS; ?></td> <td width="20%" class="dataTableHeadingContent"><?php echo TABLE_HEADING_DATE; ?></td> </tr> <?php $orders_query_raw = "select o.orders_id, o.orders_status, o.customers_name, 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 = '".$_SESSION['languages_id']."' and ot.class = 'ot_total') or (o.orders_status = '0' and ot.class = 'ot_total' and s.orders_status_id = '1' and s.language_id = '".$_SESSION['languages_id']."') order by o.date_purchased desc limit 20"; $customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_date_added from ".TABLE_CUSTOMERS." c order by c.customers_date_added desc limit 5"; $orders_query = os_db_query($orders_query_raw); while ($orders = os_db_fetch_array($orders_query)) { ?> <tr> <td class="dataTableContent"><a href="<?php echo os_href_link(FILENAME_ORDERS, os_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit'); ?>"><?php echo $orders['customers_name']; ?></a></td> <td class="dataTableContent"><?php echo $orders['orders_id']; ?></td> <td class="dataTableContent"><?php echo strip_tags($orders['order_total']); ?></td> <td class="dataTableContent"><?php echo $orders['orders_status_name']; ?></td> <td class="dataTableContent"><?php echo os_datetime_short($orders['date_purchased']); ?></td> </tr> <?php } ?> </table></td> </tr> код из split_page_result.php <?php /* ##################################### # ShopOS: Скрипты интернет-магазина # Copyright (c) 2008-2009 # http://www.shopos.ru # Ver. 1.0.0 ##################################### */ defined( '_VALID_OS' ) or die( 'Прямой доступ не допускается.' ); class splitPageResults { function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) { if (empty($current_page_number)) $current_page_number = 1; $pos_to = strlen($sql_query); $pos_from = strpos($sql_query, ' from', 0); $pos_group_by = strpos($sql_query, ' group by', $pos_from); if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by; $pos_having = strpos($sql_query, ' having', $pos_from); if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having; $pos_order_by = strpos($sql_query, ' order by', $pos_from); if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by; $reviews_count_query = os_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from))); $reviews_count = os_db_fetch_array($reviews_count_query); $query_num_rows = $reviews_count['total']; $num_pages = ceil($query_num_rows / $max_rows_per_page); if ($current_page_number > $num_pages) { $current_page_number = $num_pages; } $offset = ($max_rows_per_page * ($current_page_number - 1)); if ($offset < 0) $offset=0; $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page; } function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page') { if ( os_not_null($parameters) && (substr($parameters, -1) != '&') ) $parameters .= '&'; $num_pages = ceil($query_numrows / $max_rows_per_page); $pages_array = array(); for ($i=1; $i<=$num_pages; $i++) { $pages_array[] = array('id' => $i, 'text' => $i); } if ($num_pages > 1) { $display_links = os_draw_form('pages', basename($_SERVER['PHP_SELF']), '', 'get'); if ($current_page_number > 1) { $display_links .= '<a href="' . os_href_link(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number - 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a> '; } else { $display_links .= PREVNEXT_BUTTON_PREV . ' '; } $display_links .= sprintf(TEXT_RESULT_PAGE, os_draw_pull_down_menu($page_name, $pages_array, $current_page_number, 'onChange="this.form.submit();"'), $num_pages); if (($current_page_number < $num_pages) && ($num_pages != 1)) { $display_links .= ' <a href="' . os_href_link(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number + 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>'; } else { $display_links .= ' ' . PREVNEXT_BUTTON_NEXT; } if ($parameters != '') { if (substr($parameters, -1) == '&') $parameters = substr($parameters, 0, -1); $pairs = explode('&', $parameters); while (list(, $pair) = each($pairs)) { list($key,$value) = explode('=', $pair); $display_links .= os_draw_hidden_field(rawurldecode($key), rawurldecode($value)); } } if (SID) $display_links .= os_draw_hidden_field(session_name(), session_id()); $display_links .= '</form>'; } else { $display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages); } return $display_links; } function display_count($query_numrows, $max_rows_per_page, $current_page_number, $text_output) { $to_num = ($max_rows_per_page * $current_page_number); if ($to_num > $query_numrows) $to_num = $query_numrows; $from_num = ($max_rows_per_page * ($current_page_number - 1)); if ($to_num == 0) { $from_num = 0; } else { $from_num++; } return sprintf($text_output, $from_num, $to_num, $query_numrows); } } ?> при попытке прямого запроса в базе выскакивает та же ошибка. по сути это из-за того, что oredrs_status_id посылается пустой. или я не прав? никто не может помочь?((( Попробуйте строку (в двух местах) $check_group_query = os_db_query("select customers_status_id from " . TABLE_CUSTOMERS_STATUS_ORDERS_STATUS . " where orders_status_id = " . $status); Заменить на $check_group_query = os_db_query("select customers_status_id from " . TABLE_CUSTOMERS_STATUS_ORDERS_STATUS . " where orders_status_id = '" . $status."'"); Попробуйте строку (в двух местах) $check_group_query = os_db_query("select customers_status_id from " . TABLE_CUSTOMERS_STATUS_ORDERS_STATUS . " where orders_status_id = " . $status); Заменить на $check_group_query = os_db_query("select customers_status_id from " . TABLE_CUSTOMERS_STATUS_ORDERS_STATUS . " where orders_status_id = '" . $status."'"); простите за глупый вопрос, но в каком файле прописана данная переменная? нашел данную переменную, заменил, та же фигня... |
|