Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show Rating-button only if there


Zuncan

Recommended Posts

Hi!

 

Is it possible to alter the code in product_info.php so that the customerratings-button only will display if there actually are any ratings made? If it's possible - Please help!

 

Here is the code for the button in product_info.php:

 

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?>

 

Be well / Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Hi!

 

Is it possible to alter the code in product_info.php so that the customerratings-button only will display if there actually are any ratings made? If it's possible - Please help!

 

Here is the code for the button in product_info.php:

 

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?>

 

Be well / Zuncan

 

You would need to query the database and put an if statement dependent on whether there were reviews or not.

 

Quick question though, how would someone rate a product if there was no button to press?

Link to comment
Share on other sites

I would like to ad a "Write review" button also. Thats how I was thinking.

That would help the customers so that thay dont need to press the reviews button to only end up seeing: "There are currently no review for this product".

 

Would be more that greatful if you could help me out with this. Im totally lost when it comes to query the database..

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Is it a simple way to do this, so pls help..

 

 

go to the code of the page the button currently takes you to.

 

As you can see, it displays if there is no review. The query for this has already been done, you only need to steal it from there, and instead of displaying "no reviews yet" you do not display anthing, and if there are reviews, you display your button.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Still need help..

 

Can someone give me a code to use?

 

<?php
$reviews_query = "select '1' from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id desc";

if (tep_db_num_rows($reviews_query)) {
?>

<!--here comes your button for reviews-->

<?php
}
?>

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Thx Monica!

 

It almost worked! The button disappered, but also for the products that have reviews. So basically the button is completly gone now..

 

Could you please look into this once more?

 

/ Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...