AbanteCart Community

AbanteCart Development => Customization help => Topic started by: macat on July 08, 2013, 02:54:07 AM

Title: Making review automatic
Post by: macat on July 08, 2013, 02:54:07 AM
Is there a way to make the reviews automatically approved?
Title: Re: Making review automatic
Post by: abantecart on July 13, 2013, 03:24:43 PM
There is no setting currently to auto approve reviews.
You can change code in the model (file below) to save status of 1

storefront/model/catalog/review.php

Look for:
public function addReview(

and add:
status = 1
Title: Re: Making review automatic
Post by: macat on July 14, 2013, 01:48:59 AM
So my file looks like this:


public function addReview(status = 1$product_id, $data)

It doesn't seem to be working, left a comment and it is not there, it seems to be stuck trying to post it, when I reloaded the page I got this error:

Parse error: syntax error, unexpected '=', expecting '&' or T_VARIABLE in /home/chimom/public_html/storefront/model/catalog/review.php on line 24


tried this public function addReview($status = 1, $product_id, $data)
  site didn't go down but it didn't work either.

I removed it because the whole site was down.

http://www.chihuahuamommas.com/index.php?rt=product/product&path=4&product_id=3

Still shows reviews (0)





Quote
There is no setting currently to auto approve reviews.


You can change code in the model (file below) to save status of 1

storefront/model/catalog/review.php

Look for:
public function addReview(

and add:
status = 1
Title: Re: Making review automatic
Post by: abantecart on July 14, 2013, 08:53:47 PM
You need to add status = 1 to SQL part:

Code: [Select]
$this->db->query("INSERT INTO " . DB_PREFIX . "reviews
  SET author = '" . $this->db->escape($data['name']) . "',
      customer_id = '" . (int)$this->customer->getId() . "',
      product_id = '" . (int)$product_id . "',
      text = '" . $this->db->escape(strip_tags($data['text'])) . "',
      rating = '" . (int)$data['rating'] . "',
      status = 1,
      date_added = NOW()");
Title: Re: Making review automatic
Post by: macat on July 15, 2013, 01:12:35 AM
Thank you that worked perfect!!

Title: Re: Making review automatic
Post by: abantecart on July 15, 2013, 08:22:47 AM
Glad I can help. I am sorry for not making this clear first time.
Title: Re: Making review automatic
Post by: macat on July 15, 2013, 11:04:42 AM
I can modify php files if you tell me exactly what to do, php is not my first language, someday I hope to learn it better!!