DIsplay comments module for selected products by category

 

Could you please advise me as how I can restrict free comments module for specific categories?  The module does not seem to allow this in the back office.  I'm fine with modifying the code but I'm not savvy enough to know how to access the $category value.  I've seen advice on-line that states I must pass the $category value through some type of Smarty function but I have no idea how to do that.  I appreciate any help you may have.  It seems like restricting the categories allowed for review is a logical configuration option and perhaps should be included in the module.


I will be purchasing the upgrade for email notifications when comments are made by customers.  Thank you for making so many wonderful additions to this module.  Besides not being able to restrict the categories, I've had very little trouble working with the module and updating it to do what I would like it to:  A volunteer sign up sheet.


Again, Thank you.









currently module does not have this feature :(

so, the only one way to achieve what you expect is a modifications of module files.

this requires modification of main module file myprestacomments.php:
at the begining of function:
public function renderCommentsForm($params)
{
...
}
it will be required to check to what category product belongs to and if it will not belong to selected categories - terminate the function with return; 

//by default we want to terminate the function if product is not associated with selected category
$terminate = 1;

//we check the categories where the product belongs to
foreach (Product::getProductCategories(Tools::getValue('id_product')) AS $key => $category) {
if (in_array($category, array(102, 500, 200))) {
//if product is associated with category where we want to display the reviews - we set the terminate to 0 to not terminate the function
$terminate = 0;
}
}

// if product is not associated with any accepted category - we terminate the function
if ($terminate == 1) {
return;
}
Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment