Jump to content
Sign in to follow this  
CraXyOW3

Newsdesk 1.49 - Unkown Column problem.

Recommended Posts

So, i've downloaded the Contrib "Newsdesk" which is exactly what i was looking for, altho there is one annoying problem i can not figure out on my own and now i turn to the illuminated people here at the forums in hope that you can help me !

 

The error is the following:

1054 - Unknown column 'p.newsdesk_id' in 'on clause'

select count(p.newsdesk_id) as total from newsdesk_description pd, newsdesk p left join manufacturers m on p.newsdesk_id = m.manufacturers_id, newsdesk_to_categories p2c left join specials s on p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '4' and p2c.categories_id = '11'

[TEP STOP]

 

I am completely blank regarding this problem and really in need of a fix :P

I did read about that the sql statement was prior to version 5 faulty, but my knowledge only goes so far...

 

Source: http://www.oscommerce.com/community/contributions,934

 

Thanks!

Share this post


Link to post
Share on other sites

Uhm, well, i have fiddled around with the on clause somewhat now and done some RTFM stuff and so far i have only removed 2 chars and now it works, i dont know if this was a valid solution, but it works now!

 

From

$listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, 
pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
IF(s.status, s.specials_new_products_price, NULL) as final_price from " 
. TABLE_NEWSDESK_DESCRIPTION . " pd, " 
. TABLE_NEWSDESK . 
" p left join " 
. TABLE_MANUFACTURERS . 
" m on p.newsdesk_id = m.manufacturers_id, " 
. TABLE_NEWSDESK_TO_CATEGORIES . " p2c 
left join " 
. TABLE_SPECIALS . " s on 
p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id 
and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

 

To

$listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, 
pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
IF(s.status, s.specials_new_products_price, NULL) as final_price from " 
. TABLE_NEWSDESK_DESCRIPTION . " pd, " 
. TABLE_NEWSDESK . 
" p left join " 
. TABLE_MANUFACTURERS . 
" m on p.newsdesk_id = m.manufacturers_id, " 
. TABLE_NEWSDESK_TO_CATEGORIES . " p2c 
left join " 
. TABLE_SPECIALS . " s on 
newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id 
and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

 

Third line from bottom was changed "on p.newsdesk_id" to "on newsdesk_id".

 

Now when i got this working, could someone just tell me if this was a "valid" solution ?

Share this post


Link to post
Share on other sites
Uhm, well, i have fiddled around with the on clause somewhat now and done some RTFM stuff and so far i have only removed 2 chars and now it works, i dont know if this was a valid solution, but it works now!

 

From

$listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, 
pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
IF(s.status, s.specials_new_products_price, NULL) as final_price from " 
. TABLE_NEWSDESK_DESCRIPTION . " pd, " 
. TABLE_NEWSDESK . 
" p left join " 
. TABLE_MANUFACTURERS . 
" m on p.newsdesk_id = m.manufacturers_id, " 
. TABLE_NEWSDESK_TO_CATEGORIES . " p2c 
left join " 
. TABLE_SPECIALS . " s on 
p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id 
and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

 

To

$listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, 
pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
IF(s.status, s.specials_new_products_price, NULL) as final_price from " 
. TABLE_NEWSDESK_DESCRIPTION . " pd, " 
. TABLE_NEWSDESK . 
" p left join " 
. TABLE_MANUFACTURERS . 
" m on p.newsdesk_id = m.manufacturers_id, " 
. TABLE_NEWSDESK_TO_CATEGORIES . " p2c 
left join " 
. TABLE_SPECIALS . " s on 
newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id 
and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

 

Third line from bottom was changed "on p.newsdesk_id" to "on newsdesk_id".

 

Now when i got this working, could someone just tell me if this was a "valid" solution ?

 

better solution can be:

change the identified code to the following code:

 

$listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, 
pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
IF(s.status, s.specials_new_products_price, NULL) as final_price from (" 
. TABLE_NEWSDESK_DESCRIPTION . " pd, " 
. TABLE_NEWSDESK . 
" p left join " 
. TABLE_MANUFACTURERS . 
" m on p.newsdesk_id = m.manufacturers_id, " 
. TABLE_NEWSDESK_TO_CATEGORIES . " p2c )
left join " 
. TABLE_SPECIALS . " s on 
p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id 
and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

 

 

Alex

Share this post


Link to post
Share on other sites

TY Alot Alex!

 

This fixed my problems with Newsdesk, been lurking and even started to learn some basic php and sql in the process, but after coding in another language ive been quite stuck with it and had hard time cooping with this.

 

Thnx again, this fix should be mentioned on the contribs section too.

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  

×