Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with orders


mikedarling905

Recommended Posts

It seems there is something wrong with the PHP/ SQL in the shop as it didn't insert anything in the database \:

 

Orders

Order ID:

Status:

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 '-20, 20' at line 1

 

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

 

[TEP STOP]

 

We got an order filled out which didnt show the shirt sizes or colours now, it doesn't do it all the time but i was wondering if there was a fix or anything for this... or if anyone knows anything about why this is happening.

 

thanks

 

I would have searched more, but i was unsure of what my problem exactly was only if I thought it was something. Any redirection assistance is much appreciated.

Link to comment
Share on other sites

in includes/classes/split_page_results.php in catalog and in admin change:

$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

to

$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
  if($offset < 0){ 
	$offset = 0; 
  }

Link to comment
Share on other sites

Thanks for the reply- Here is what I have:

 

 $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;
   }

 

 

 

Do I need to get rid of any code or just add

if($offset < 0){ 
	$offset = 0; 
  }[/code]

?

 

I tried just adding it and nothing changed. I saw the thread you referred me to but didn't know if it applied to my problem.... Thanks again for taking the time to respond,

Linn

Link to comment
Share on other sites

add that code in:

- includes/classes/split_page_results.php

- admin/includes/classes/split_page_results.php

Link to comment
Share on other sites

add that code in:

- includes/classes/split_page_results.php

- admin/includes/classes/split_page_results.php

 

 

Ok, I added the above code to both pages. Now I have:

 

$offset = ($max_rows_per_page * ($current_page_number - 1));



     if($offset < 0){
$offset = 0;
}

     $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
   }

AND

$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

    if($offset < 0){
    $offset = 0;
    }

  $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;
   }

 

 

The error is unchanged. Did I miss something? Thanks again,

Linn

Link to comment
Share on other sites

Just in case anyone else is having this problem- Let me clarify my error message since it is not exactly the same as the original post of this thread. I don't want to confuse anyone. Here it is :

 

Warning: Division by zero in /home/staymyba/public_html/osCommerce/catalog/includes/classes/split_page_results.php on line 59

 

 

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 '-0, 0' at line 1

 

select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' order by p.products_date_added DESC, pd.products_name limit -0, 0

 

[TEP STOP]

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...