Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Review Images Problem


Guest

Recommended Posts

Hi there,

I am having problems after installing a quite new contribution called Customer Review Images. As you can imagine, this contribution enabbles users to upload images with the review text. Unfortunately after installing, I can upload an image but when I try to approve it in the admin, I get following error message:

1054 - Unknown column 'r.reviews_id' in 'on clause'

select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id where r.reviews_id = '16' and r.reviews_id = rd.reviews_id

As a matter of fact, I am a newbie but I think that the mistake is in the admin/reviews.php in which several things must be changed.

Acutally following must be changed:

   $reviews_query = tep_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int)$rID . "' and r.reviews_id = rd.reviews_id");

to

// BOF Review Images
$reviews_query = tep_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id where r.reviews_id = '" . (int)$rID . "' and r.reviews_id = rd.reviews_id");
// EOF Review Images

 

I think it could be an issue with my oscmmerce running on mysql 5, is that possible?

Any help would really be appreciated, thank you very much in advance!

baka

Link to comment
Share on other sites

Sorry about that, yes, MySQL 5 moves more towards a 2003 standard of query syntax, as a result, this query will need to be subtly modified from:

 

// BOF Review Images
$reviews_query = tep_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id where r.reviews_id = '" . (int)$rID . "' and r.reviews_id = rd.reviews_id");
// EOF Review Images

To either this:

 

// BOF Review Images
$reviews_query = tep_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from (" . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd) left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id where r.reviews_id = '" . (int)$rID . "' and r.reviews_id = rd.reviews_id");
// EOF Review Images

Or this:

 

// BOF Review Images
$reviews_query = tep_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from " . TABLE_REVIEWS . " r inner join " . TABLE_REVIEWS_DESCRIPTION . " rd on r.reviews_id = rd.reviews_id left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id where r.reviews_id = '" . (int)$rID . "'");
// EOF Review Images

Try one of those and see if it starts working for you :)

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Thank you very much for your quick answer, but unfortunately none of these codes has an effect - I still get following error message when trying to access the review in the admin:

 

1054 - Unknown column 'r.reviews_id' in 'on clause'

select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id where r.reviews_id = '17' and r.reviews_id = rd.reviews_id

[TEP STOP]

 

When I try to view an older review in the frontend, following error occurs:

 

1054 - Unknown column 'r.reviews_id' in 'on clause'

select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, ri.reviews_image, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from reviews r, reviews_description rd, products p, products_description pd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.reviews_id = '7' and r.reviews_id = rd.reviews_id and rd.languages_id = '5' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '5'

[TEP STOP]

 

I am using also using the Review Approval System Contribution, if this might in any way have an effect.

Thanks again!

baka

Link to comment
Share on other sites

Ok, Admin Side seems to work now, but when I try to access a review from the frontend, I still get this message:

 

1054 - Unknown column 'r.reviews_id' in 'on clause'

select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, ri.reviews_image, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from reviews r, reviews_description rd, products p, products_description pd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.reviews_id = '20' and r.reviews_id = rd.reviews_id and rd.languages_id = '5' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '5'

[TEP STOP]

Any idea, in which file this problem could be?

Link to comment
Share on other sites

I think the problem has its origin in following code in product_reviews_info.php

// BOF Review Images
 $review_query = tep_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, ri.reviews_image, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from (" . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd), " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
// EOF Review Images

As this is obviously a MySQL5 issue and I am a complete newbie to it, woould somebody be so kind to give me a hint of how to make this code compliant to MySQL 5? I would really like to add the possibility of adding images to reviews.

Any help would really be appreciated!

Thanks in advance,

baka

Link to comment
Share on other sites

Thanks to Richard, my issue was solved. Here the solution if someone might have the sam problem.

 

Try changing this in product_reviews_info.php:

 

 

// BOF Review Images
 $review_query = tep_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, ri.reviews_image, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from (" . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd), " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
// EOF Review Images

 

To this:

 

// BOF Review Images
 $review_query = tep_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, ri.reviews_image, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from (" . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd) left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
// EOF Review Images

Link to comment
Share on other sites

  • 2 months later...

A few problems left after following the instructions in this thread:

 

1. in catalog/product_reviews.php I'm getting this (even though the review is added correctly)

1054 - Unknown column 'r.reviews_id' in 'on clause'

select count(*) as total from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.products_id = '50' and r.reviews_id = rd.reviews_id and rd.languages_id = '4'

[TEP STOP]

 

2. I'm not getting any option to upload a picture, neither in the admin or shop area?

 

Greatful for any assistance, this conrib would really be of use for me.

Link to comment
Share on other sites

Try changing that query to this (i've substituted in the actual likely variable names in place of the static text, but you may have to proof it when you stick it in to make sure your products_id var is $products_id, or else change $products_id below to what it actually is in your code, i.e. maybe $rInfo->products_id or something like that):

 

select count(*) as total from " . TABLE_REVIEWS . " r join " . TABLE_REVIEWS_DESCRIPTION . " rd on r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$language_id . "' left join " . TABLE_REVIEWS_IMAGES . " ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.products_id = '" . (int)$products_id . "'

 

Good luck :)

 

Richard.

 

A few problems left after following the instructions in this thread:

 

1. in catalog/product_reviews.php I'm getting this (even though the review is added correctly)

1054 - Unknown column 'r.reviews_id' in 'on clause'

select count(*) as total from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.products_id = '50' and r.reviews_id = rd.reviews_id and rd.languages_id = '4'

[TEP STOP]

 

2. I'm not getting any option to upload a picture, neither in the admin or shop area?

 

Greatful for any assistance, this conrib would really be of use for me.

Richard Lindsey

Link to comment
Share on other sites

  • 1 month later...

Thanks for writing the contribution, I've been looking for something to do this for ages.

 

2 things:

 

1) Could you include the modified files in the download. I find it easier to use something like Beyond Compare to merge files. It's so much easier, and ensures you put the code in the right place and don't miss any out.

 

2) Everything seems to be working, except I can't see the images.

When I write a review, I add a pic and click continue and it goes through and creates the review.

I can go into admin and enable the image, but i can't see it (or the product image) on the edit page.

The pics don't appear anywhere in the file structure - I created a folder called reviews as I didn't seem to have one, but they don't get uploaded anywhere.

 

I even tried putting the pics straight in the folder using ftp, but they still don't appear.

 

What have I missed?

 

Thanks,

 

Tamsyn

 

btw: Was the upload file meant to go under admin or not? It wasn't clear, so I ended up putting it in both.

Link to comment
Share on other sites

1054 - Unknown column 'r.reviews_id' in 'on clause'

 

select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating, ri.reviews_image, ri.reviews_status from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id where r.reviews_id = '21' and r.reviews_id = rd.reviews_id

 

[TEP STOP]

 

i am also getting the same error in the admin/reviews.php on dreamhost with mysql5. Is there a simple fix?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Hi there;

First off let me say thank you for this contrib. I plan to use

it for a contest I will be running on my site.

I just uploaded all the changes for the contrib, and I seem

to have a couple of bugs in the system some where.

On the Admin side, when I go into reviews, I am getting this:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/ladykd54/public_html/admin/reviews.php on line 292

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/ladykd54/public_html/admin/reviews.php on line 293

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/ladykd54/public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/ladykd54/public_html/admin/includes/classes/object_info.php on line 18

 

 

On the site itself side, when I go onto the Write a Review, for some reason

I can see the text for // BOF Review Images and // EOF Review Images

on the page. I'd like to have that not seen.

 

Any help would be most appreciated and thanks again for the great contrib.

 

Karen

Link to comment
Share on other sites

  • 2 months later...

If the above doesnt work use this code:

$reviews_query = tep_db_query("select r.products_id, rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, p.products_id, pd.products_name, p.products_image from (((".TABLE_REVIEWS." r, ".TABLE_REVIEWS_DESCRIPTION." rd) left join ".TABLE_PRODUCTS." p on (r.products_id = p.products_id)) left join ".TABLE_PRODUCTS_DESCRIPTION." pd on (p.products_id = pd.products_id and pd.language_id = '".(int) $_SESSION['languages_id']."')) where r.reviews_id = '".(int) $_GET['reviews_id']."' and r.reviews_id = rd.reviews_id and p.products_status = '1'");

Link to comment
Share on other sites

  • 1 year later...

Everything seems to be working, except I can't see the images or review content in the admin area.

 

When I write a review, I add a pic but it isn't displayed in the text area and click continue and it goes through and creates the review.

 

I can go into admin and enable the image, but i can't see it (or the product image) on the edit page.

The pics don't appear anywhere in the file structure - I created a folder called reviews as I didn't seem to have one, but they don't get uploaded anywhere.

 

Can anyone help on this one?

Link to comment
Share on other sites

  • 3 months later...
  • 4 months later...

Hi, I have a site where the review images has stopped working a while ago, and it has only recently been pointed out to me. I get the following error when trying to upload an image or view the products review page.

 

1054 - Unknown column 'r.reviews_id' in 'on clause'

 

select count(*) as total from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.products_id = '1278' and r.reviews_id = rd.reviews_id and rd.languages_id = '1'

 

[TEP STOP]

 

 

Can anyone help?

oscommerce_community_forums.gif
Link to comment
Share on other sites

Hi, I have a site where the review images has stopped working a while ago, and it has only recently been pointed out to me. I get the following error when trying to upload an image or view the products review page.

 

1054 - Unknown column 'r.reviews_id' in 'on clause'

 

select count(*) as total from reviews r, reviews_description rd left join reviews_images ri on r.reviews_id = ri.reviews_id and ri.reviews_status = '1' where r.products_id = '1278' and r.reviews_id = rd.reviews_id and rd.languages_id = '1'

 

[TEP STOP]

 

 

Can anyone help?

Also, I cannot view the reviews individually.

 

I can write a review, it stores the image name in the data base review_images, i don't think the image is uploaded though.

 

I can only view the full list of all reviews. Clicking on the product image within the review or clicking on the review name just brings up a blank page.

 

There is an SEO add on, but turning that off only breaks the product_info page too.

oscommerce_community_forums.gif
Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...