Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Featured Products -> Error in Contribution


waqas_punjabian

Recommended Posts

Hi all,

 

i m just new to osCommerce, well, i 've installed following contribution as per instructions:

 

Featured Products

 

Bynow the table 'Featured' was empty.

At the end when i moved to Admin area to add some products as featured products.

 

i 've found following Query Error in Admin's Featured Area:

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 p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from products p, featured s, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20

 

But when i entered a record in Featured table manually using phpMyAdmin.

 

The error removed. I think there isn't any check on null values on limit, or may be i am doing something wrong.

 

If the error is in contribution code, then please someone rectify the error and update contribution. Or else notify me what i am doing wrong.

 

regards

 

WAQAS

Link to comment
Share on other sites

Hi all,

 

i m just new to osCommerce, well, i 've installed following contribution as per instructions:

 

Featured Products

 

Bynow the table 'Featured' was empty.

At the end when i moved to Admin area to add some products as featured products.

 

i 've found following Query Error in Admin's Featured Area:

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 p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from products p, featured s, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20

 

But when i entered a record in Featured table manually using phpMyAdmin.

 

The error removed. I think there isn't any check on null values on limit, or may be i am doing something wrong.

 

If the error is in contribution code, then please someone rectify the error and update contribution. Or else notify me what i am doing wrong.

 

regards

 

WAQAS

It is not an error in the contrib but something you have to change in your files if you do not use the latest MS2 release from the download section. The update document within the latest download package tells to:

------------------------------------------------------------------------------
limit -20, 20
http://www.oscommerce.com/community/bugs,1605
------------------------------------------------------------------------------

Problem:

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

Solution:

Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

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

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to:

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...