Jump to content

Edit review output


geoffb

Recommended Posts

Hi,

 

On the customer review output which says '5.0 average, based on 1 review' I can't seem to find the file or line to edit this as I want to edit the link for the term 'review' to open a tabbed content box somewhere else on the page.

 

The content.product.php file just shows this: <p class="rating-info">{$LANG_REVIEW_INFO}</p>

 

Thanks for any help.

Link to comment
Share on other sites

Welcome geoffb! Glad to see you made it to the forums.

 

There are two parts this: a language template and the data that goes in the template.

 

The template can be see in admin, Languages, choose a language, then in the drop-down, choose the 'catalogue' group. In the listing that shows, look for the 'review_info' key.

 

Currently, the value is:

%1$s average, based on <a href="%3$s">%2$s reviews</a>

 

%1$s, %2$s, and %3$s are the placeholders for this template. They will be filled with data calculated in the code found in the file /classes/catalogue.class.php, near line 932:

## Calculate average review score

 

Specifically, the link (%3$s) is determined by:

if (!$product_view) {
  $link = currentPage(array('_a', 'cat_id'), null, false).'_a=product&amp;product_id='.$product['product_id'].'#reviews';
} else {
  $link = '#reviews';
}

$product_view arrives to this function as true if we intend to use this function when we are already viewing the View Product page. If so, the link is simply the named anchor on the page and the browser moves the viewport so that the named anchor is at the top. If not, then the link becomes a fully qualified URL pointing to the View Product page and the named anchor on that page.

 

So, '#reviews' as the named anchor is hard-coded in the function, and it would be here that you would change the name of the named anchor. But...

 

If the effect you want is to open a content tab (maybe using a mod), does not the tab already 'open' (under javascript control) when called? For that tab, would <div id="reviews"> work?

Link to comment
Share on other sites

Hi bsmither,
 
Wow very promt help, thank you. I can say I'm very very impressed with the Cube Cart product and have so far developed a new template that I hope to send you to have a look at, its a very far cry from the originals as I have stripped it right back pretty much.
 
Regarding the link, I'm actually using an onclick call in the tabs that then shows the content underneath, one of which is the reviews comments so is there a way of altering the code to do this?
 
My current function is:

onclick="expandcontent('sc2', this)"

with the actual content div being:

<div id="sc2" class="tabcontent">
      <div align="left">
        REVIEW CONTENT HERE
      </div>
    </div>

Any furher help really appreciated.

 

Thanks

Link to comment
Share on other sites

Two things:

 

Your expandcontent() function accepts two functions: the ID of the target <div>, and... what is this? I would try adding your onclick to the template:

%1$s average, based on <a onclick="expandcontent('sc2', this)" href="%3$s">%2$s reviews</a>

changing this to whatever it needs to be.

 

CubeCart5 already has jQuery code to control tabs. Unfortunately, there are no tabs presented in any storefront page (yet) -- only in the admin. So, the relevant jQuery code is found in /js/admin.js and would need to be copied to common.js. Doing that however, would need further QA testing.

Link to comment
Share on other sites

Go to:
The template can be see in admin, Languages, choose a language, then in the drop-down presented to you, choose the 'catalogue' group. In the listing that shows, look for the 'review_info' key (the left column).
 
On the right, click in the field and edit the phrase to say:
%1$s average, based on <a onclick="expandcontent('sc2', this)" href="%3$s">%2$s reviews</a>

 

At the bottom of the page, click Save. Call up a product's View Product page on the storefront. Have your browser show you the HTML source of that page.

 

Look for the <p class="rating-info"> paragraph.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...