Loaded Commerce Community

Banner


Board index » Web Design and Development » Designers Workshop

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Any easy to to add product reviews to product listing page?
PostPosted: Fri Apr 03, 2009 6:36 pm 
Offline
CRE Newbie
User avatar

Joined: Fri Jan 30, 2009 3:07 am
Posts: 28
I'd like to have the product reviews show up on the product listing page instead of having to click on a link and be taken to another page.

I found an oscommerce contribution to do this, but cannot get it to work with CRELoaded (i've got 6.2 Pro).

Has anyone done this? Reviews on the product page seem much more user friendly than on a different page, but I can't seem to get the oscommerce addon to work at all.

The addon can be found at http://addons.oscommerce.com/info/734

It seems to be a fairly simply addon as it only includes some definition changes, one update the the db, and a change to the product_info.tpl.php file, but it is above me apparently.

If anyone can help, I'd be very greatful. I would be happy to post the changes to the product_info.tpl.php that are required if anyone would like to look them.


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Fri Apr 03, 2009 7:52 pm 
Offline
CRE Legend
User avatar

Joined: Fri Jan 13, 2006 1:00 am
Posts: 11084
Location: Nappanee Indiana
6.3 has this built in to the product tabs

but you could just as easy use php include to do the same
Code:

<?php
        $reviews_query = tep_db_query("select r.reviews_id, rd.reviews_text as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and rd.languages_id = '" . (int)$languages_id . "' order by rand(), r.reviews_id DESC limit " . PRODUCT_INFO_TAB_NUM_REVIEWS);
        if (tep_db_num_rows($reviews_query) > 0) {
            include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_REVIEWS);
        ?>
        <div class="tab-page" id="product_reviews">
          <h2 class="tab">Product Reviews</h2>
          <script type="text/javascript">tp1.addTabPage( document.getElementById( "product_reviews" ) );</script>
          <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
            <?php
           while ($reviews = tep_db_fetch_array($reviews_query)) {
           ?>
            <tr>
              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main"><?php echo '<span class="smallText">' . sprintf(TEXT_REVIEW_BY, tep_output_string_protected($reviews['customers_name'])) . '</span>'; ?></td>
                    <td class="smallText" align="right"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, tep_date_long($reviews['date_added'])); ?></td>
                  </tr>
                  <tr>
                    <td colspan="2" valign="top" class="main"><?php echo tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>') . ((strlen($reviews['reviews_text']) >= 100) ? '..' : '') . '<br><br><i>' . sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</i>'; ?></td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td class="main"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
            </tr>
            <?php
        }
        ?>
            <tr>
              <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
            </tr>
            <tr>
              <td class="main"><?php  if(tep_db_num_rows($reviews_query) == PRODUCT_INFO_TAB_NUM_REVIEWS ) { echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params() . $params) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; } ?></td>
            </tr>
          </table>
        </div>
        <?php
        }
        ?>

_________________
Jason Miller
https://www.creloadedexpert.com
CRE Loaded Expert Team
CRE Loaded Support
Home of the FIRST 100% tableless CRE Loaded template


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing pa
PostPosted: Fri Apr 03, 2009 8:45 pm 
Offline
CRE Newbie
User avatar

Joined: Fri Jan 30, 2009 3:07 am
Posts: 28
Hmm...interesting. So I'm guessing that bit of code is specific to 6.3?

I included it at the bottom of the product_info.tpl.php file but I get the following error (running 6.2 Pro):

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PRODUCT_INFO_TAB_NUM_REVIEWS' at line 1

select r.reviews_id, rd.reviews_text as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from reviews r, reviews_description rd, products p, products_description pd where p.products_status = '1' and p.products_id = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '1' and rd.languages_id = '1' order by rand(), r.reviews_id DESC limit PRODUCT_INFO_TAB_NUM_REVIEWS

TEP_DB_ERRORR


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Fri Apr 03, 2009 8:55 pm 
Offline
CRE Legend
User avatar

Joined: Fri Jan 13, 2006 1:00 am
Posts: 11084
Location: Nappanee Indiana
yes, replace
Code:
<td class="main"><?php  if(tep_db_num_rows($reviews_query) == PRODUCT_INFO_TAB_NUM_REVIEWS ) { echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params() . $params) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; } ?></td>


with
Code:
<td class="main"><?php  if(tep_db_num_rows($reviews_query) == '3' ) { echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params() . $params) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; } ?></td>

_________________
Jason Miller
https://www.creloadedexpert.com
CRE Loaded Expert Team
CRE Loaded Support
Home of the FIRST 100% tableless CRE Loaded template


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Fri Apr 03, 2009 8:57 pm 
Offline
CRE Newbie
User avatar

Joined: Fri Jan 30, 2009 3:07 am
Posts: 28
Ok...got it working. Just hardcoded the # into the code instead of using the "Product_info_tab_num_reviews" variable. Little bit of css work on it and it will be perfect.

Thanks!


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Fri Apr 03, 2009 8:58 pm 
Offline
CRE Newbie
User avatar

Joined: Fri Jan 30, 2009 3:07 am
Posts: 28
LOL...beat me to it. Yep that's exactly what I did. Both there AND in the actual db query...thanks again.


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Wed Jun 17, 2009 4:24 pm 
Offline
CRE Freak
User avatar

Joined: Sun Jun 14, 2009 11:07 pm
Posts: 37
Any idea how to make reviews with star ratings like this store has done with smiley faces?
http://www.floatingaway.co.uk/product/X ... hine_XZ001


Top
 Profile  
 
 Post subject: Re: Any easy to to add product reviews to product listing page?
PostPosted: Wed Jun 02, 2010 5:36 pm 
Offline
CRE Freak
User avatar

Joined: Thu Jan 10, 2008 5:24 pm
Posts: 107
Location: Middleton, Wisconsin
Can someone help hold my hand through this? I added the code, changed the snippet that was posted, and then tried to figure out what I should be doing to the other call to the database. The changes I tried didn't work.

What should I do?

_________________
http://www.lbvgallery.com/shop/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

Board index » Web Design and Development » Designers Workshop

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Mon May 21, 2012 8:58 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy