Post by Khal » Sun Mar 09, 2014 8:31 pm

I have just noticed a big problem on the new version of OC: 1.5.6.1

A customer tried to leave a review but could not. Once a review is submitted, the site gives the message 'please wait'. But this message just stays there and the site seems to crash here.

I have a custom theme but I know this is not a problem with the theme because it uses the default settings for reviews.

People have left reviews for my website in the past, so that's why I think the problem is with the upgrade.

Please does anyone know how to resolve this problem?

Thank you

website: http://khaleejiabaya.com
Last edited by Khal on Wed Mar 12, 2014 12:25 am, edited 1 time in total.

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by MarketInSG » Sun Mar 09, 2014 10:23 pm

Code: Select all

TypeError: data is null
Ensure that your review function returns json data.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by Khal » Sun Mar 09, 2014 10:37 pm

Thank you for your reply.

Which file is the review function in?

Sorry I only know basics like changing styles etc in oc.

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by Khal » Sun Mar 09, 2014 10:43 pm

In /home/khaleeji/public_html/catalog/view/theme/theme-name/template/product/product.tpl

Code: Select all

$('#button-review').bind('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
		type: 'post',
		dataType: 'json',
This is the same as the default product.tpl. Is this code correct and what you meant?

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by melbagnato » Mon Mar 10, 2014 8:07 pm

Hi Khal,

I have OC 1.5.6.1 installed and the "leave a review" feature works for me.

There are a few checks you can make:

Lines 466 to 494 of catalog\view\theme\template\product\product.tpl contains the ajax call that is made when the user populates a review.

Lines 671-703 of catalog\controller\product\product.php is the function that checks the review before it is posted to the database in line 696 of that file.

Lines 3-5 of catalog\model\catalog\review.php is the function that writes the review to the database.

You need to compare these to your installation. Chances are that your product.tpl file is where the problem is, given that you have used a different theme (it's probably not making the ajax call correctly and sending an empty payload).

My suggestion is that you use a local copy of OpenCart loaded into Netbeans, with "netbeans-xdebug" enabled, and step through the code. This will allow you to work out where the call is failing.

Hope this helps.

- Mel

http://online.enterpriseconsulting.com.au

Site with OpenCart extensions & code downloads, many new extensions coming soon!
Follow us on twitter for more updates

Image


User avatar
Active Member

Posts

Joined
Wed Jan 13, 2010 1:39 pm
Location - Melbourne

Post by Khal » Mon Mar 10, 2014 8:48 pm

Mel

Thank you gain for the detailed response! I have gone through the product.tpl files of both the default installation of OC and my custom theme. Product.tpl of the custom theme, although it is about 20 lines shorter, the code for the reviews section is identical to the product.tpl I have under the default theme. I checked the lines you gave.

I am assuming the other two files you referred to should be fine because they are part of the default installation.

A customer tried to leave a review yesterday, and they mentioned that they left the page open for ages after submitting it, waiting for the success message to appear, - the review did eventually come through.

I am not familiar with Netbeans, but I will asked the theme developer if he is able to help resolve this.

Many thanks again for your help.

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by MarketInSG » Mon Mar 10, 2014 10:45 pm

Are you using any vqmod scripts to do any changes? If so, try looking into your vqcache and you might see more results. Alternatively, try looking into your error logs


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by Khal » Mon Mar 10, 2014 11:43 pm

Thank you for the suggestions MarketInSG

Yes I am using vqmod. I have found these two sections of code which I think could be to do with submitting the review?

Code: Select all

public function write() {
		$this->language->load('product/product');

		$this->load->model('catalog/review');

		$json = array();

		$errors = array();
			

		$errors = array();
and:

Code: Select all

if (!isset($json['error'])) {
				$this->model_catalog_review->addReview($this->request->get['product_id'], $this->request->post);

				$json['success'] = $this->language->get('text_success');
Do they look right? I have nothing to compare them with to see if they are correct.

I've checked the error logs- there's nothing there to do with the reviews. It's really frustrating because it was working before the upgrade, and yesterday a review somehow got through.

I really need help!

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by Khal » Tue Mar 11, 2014 2:32 am

I'm really at a loss now.

The theme developer has checked and the Leave A Review feature works fine on his installation of the theme. So it's not theme-related.

Can it be something in the vqmod? I haven't changed anything in that file.

The strange thing is, I have a mobile theme installed on my website when it is viewed on a mobile device. The Leave A Review form is also not working on that theme. It just does not submit.

I really need some help to solve this please. Any other suggestions or help with the vqmod files would greatly be appreciated. I can provide ftp details if it helps.

Thank you

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by melbagnato » Tue Mar 11, 2014 9:28 am

Hi Khal,

if you look in your qmod directory, specifically in the "\vqmod\vqcache" directory, you will find the compiled php files that are used to replace your files. See if any of the following files exist:

catalog_view_theme_template_product_product.tpl
catalog_controller_product_product.php
catalog_model_catalog_review.php


If you find one of these, go to the "\vqmod\xml" directory and find the relevant file and see what it does to your code. Chances are your qmod file contains the error if your other files are ok.

Hope this helps.

- Mel

http://online.enterpriseconsulting.com.au

Site with OpenCart extensions & code downloads, many new extensions coming soon!
Follow us on twitter for more updates

Image


User avatar
Active Member

Posts

Joined
Wed Jan 13, 2010 1:39 pm
Location - Melbourne

Post by Khal » Tue Mar 11, 2014 7:18 pm

Hi Mel

Thank you for the reply and suggestions.

Out of those three files, I only have this file in vqmod/cache:

Code: Select all

vq2-catalog_controller_product_product.php
The only xml file which seems remotely relevant to this is:

Code: Select all

category_breadcrumb.xml


All of the other .xml files are specific for extensions, google, or for my mobile theme.

But there is no code in this file about the Review form. Could that is why it's not working? There isn't a file for it?

Someone suggested I reinstall vqmod, but this seems a bit drastic and I don't want to reset everything or completely mess things up. I did reinstall vqmod to the latest version when I upgraded OC and installed this new theme. Do you think that will solve it?

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK

Post by Khal » Wed Mar 12, 2014 12:28 am

Issue resolved.

There was an error in a vqmod file for my mobile theme. The theme developer added a fix. I'm not sure why it was also affecting my desktop site, but at least its working now. :) :) :)

Thank you for your time and help in trying to fix this issue. I really appreciate it.

OC 2.0.1.1


Active Member

Posts

Joined
Thu May 24, 2012 9:24 pm
Location - Teesside, UK
Who is online

Users browsing this forum: No registered users and 17 guests