Jump to content
Sign in to follow this  
curtisj

"Categories Specials" MySQL Error

Recommended Posts

I am recieving the following error after installing the Categories Specials Contribution. I have searched and not found much support for this contrib. I have checked permissions on all files and checked to make sure the database names match. I have also installed, removed, and re-installed following the instructions. I am completely stuck. The following is the error I recieve when try to add a new special and click "insert":

 

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 special_id from special_category where categ_id =

 

[TEP STOP]

Share this post


Link to post
Share on other sites

Anyone have any ideas?

 

I just tried deleting the tables associated with the contrib, to verify where the problem is. I recieved the same error after I dropped the tables from the database. (special_category and special_product). This leads me to believe the mistake is in the php code, which I have gone over as best I could (i would not call myself a php expert by a longshot) and could not find any mistakes. Everything is exactly as the install file describes and the admin/categories_specials.php looks OK, but I am guessing that is where the problem is.

 

Any known problems with the Category Specials contrib?

 

Thanks,

Curt

Share this post


Link to post
Share on other sites

Well, you should have the tables in your database.

 

the issue is that the SQL statement is incomplete as there is no category id specified, it should read something like

 

select special_id from special_category where categ_id = 1

 

can you post the php code you added (I guess) it is going to be in your catalog/includes/modules directory if it adds a box with specials), or perhaps a complete new php file in your main catalog directory.

Somehow a catagory needs to be passed via the url, maybe the code assumes register globals being enabled, maybe an issue with your php version vs the version used by the original contribution coder ...


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

I am having problems with the code in the Admin side. I get this when I click the Edit button

 

1054 - Unknown column 'A.products_id' in 'on clause'

select count(*) as total from products A, products_description B, products_to_categories E left join specials C on C.products_id = A.products_id left join special_product F on A.products_id = F.product_id left join special_category D on E.categories_id = D.categ_id where E.categories_id = 5 and E.products_id = A.products_id and A.products_id = B.products_id and B.language_id = '1'

I have tried to troubleshoot this, but I can't find any code in the category_specials.php file that has select count(*) as total in it. That bit of code isn't in that file. I re downloaded another version of this & still have the same errors.

 

If I try to insert a new category sale I get this error

1054 - Unknown column 'A.products_id' in 'on clause'

select A.products_id, B.products_price from products_to_categories A, products B left join specials C on C.products_id = A.products_id where A.categories_id = 1 and B.products_id = A.products_id and C.products_id IS NULL

[TEP STOP]

 

I was going to post my file below, but it very long.

Share this post


Link to post
Share on other sites
Has anyone else ran into the same problem that I am having?

Iv'e had a similar problem but I haven't found an answer yet. This may help a bit, though.

For me the problem is a translation from MSQL4 to MYSQL5 - the contrib works fine in MYSQL4 but not in MYSQL5.

the code producing the problem is in the file: ADMIN/category_specials.php around line 471-

 

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

$specials_query_raw = "select A.products_id, B.products_name, A.products_price, C.specials_id, C.specials_new_products_price,

C.specials_date_added, C.specials_last_modified, C.expires_date, C.date_status_change, C.status, F.special_id from " .

TABLE_PRODUCTS . " A, " . TABLE_PRODUCTS_DESCRIPTION . " B , products_to_categories E

left join " . TABLE_SPECIALS . "C on C.products_id = A.products_id left join special_product F on A.products_id = F.product_id

left join special_category D on E.categories_id = D.categ_id where E.categories_id = $categ_id and E.products_id = A.products_id and

A.products_id = B.products_id and B.language_id = '" . (int)$languages_id . "' order by F.special_id, C.specials_id, B.products_name ";

 

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

trying to convert this to MYSQL5 just fries my brain - if anyone else can do this translation I would be very grateful.

Share this post


Link to post
Share on other sites

I know this is an older post but there doesnt seem to be much discussion relating to this module anywhere..

 

has anyone worked out the correct table joins for this module.?

 

The latest version whcih supposedly is mysql5 compliant has the same bug as the older versions

Share this post


Link to post
Share on other sites

I'm also at a loss on how to convert this to work with MYSQL5. Does anyone have a fix for this? Many thanks in advance.

 

Iv'e had a similar problem but I haven't found an answer yet. This may help a bit, though.

For me the problem is a translation from MSQL4 to MYSQL5 - the contrib works fine in MYSQL4 but not in MYSQL5.

the code producing the problem is in the file: ADMIN/category_specials.php around line 471-

 

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

$specials_query_raw = "select A.products_id, B.products_name, A.products_price, C.specials_id, C.specials_new_products_price,

C.specials_date_added, C.specials_last_modified, C.expires_date, C.date_status_change, C.status, F.special_id from " .

TABLE_PRODUCTS . " A, " . TABLE_PRODUCTS_DESCRIPTION . " B , products_to_categories E

left join " . TABLE_SPECIALS . "C on C.products_id = A.products_id left join special_product F on A.products_id = F.product_id

left join special_category D on E.categories_id = D.categ_id where E.categories_id = $categ_id and E.products_id = A.products_id and

A.products_id = B.products_id and B.language_id = '" . (int)$languages_id . "' order by F.special_id, C.specials_id, B.products_name ";

 

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

trying to convert this to MYSQL5 just fries my brain - if anyone else can do this translation I would be very grateful.

Share this post


Link to post
Share on other sites

Well, looks like I figured this out. Replace the query posted earlier with this one instead:

 

$specials_query_raw = "select A.products_id, B.products_name, A.products_price, C.specials_id, C.specials_new_products_price,
			C.specials_date_added, C.specials_last_modified, C.expires_date, C.date_status_change, C.status, F.special_id from (" .
			TABLE_PRODUCTS . " A, " . TABLE_PRODUCTS_DESCRIPTION . " B , products_to_categories E )
			left join " . TABLE_SPECIALS . " C on C.products_id = A.products_id left join special_product F on A.products_id = F.product_id
			left join special_category D on E.categories_id = D.categ_id where E.categories_id = $categ_id and E.products_id = A.products_id and
			A.products_id = B.products_id and B.language_id = '" . (int)$languages_id . "' order by F.special_id, C.specials_id, B.products_name ";

 

For mysql5, you have to wrap multiple table declarations prior to a LEFT JOIN in parenthesis. I just tried it out on my site and it seems to work again. Hope this helps.

 

Alfredo

 

 

I'm also at a loss on how to convert this to work with MYSQL5. Does anyone have a fix for this? Many thanks in advance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×