Jump to content
Richard Cranium

[Contribution] Scrolling Customer Testimonials

Recommended Posts

hi try to install this at local host, it show the testimonial box on the home page, but when i click on write testimonial i got a blank page,

 

already set the recaptcha to no as instruct at the manual.

 

using oscmax.

 

please help TIA.

Share this post


Link to post
Share on other sites

hi try to install this at local host, it show the testimonial box on the home page, but when i click on write testimonial i got a blank page,

 

already set the recaptcha to no as instruct at the manual.

 

using oscmax.

 

please help TIA.

 

ISWS,

 

Sounds like you are missing a file or setting. Please double-check that all the file changes are done and the new and replaced (if applicable) files are copied over. Let me know if that does not help.

 

Which version did you install?

 

David

Share this post


Link to post
Share on other sites

hi try to install this at local host, it show the testimonial box on the home page, but when i click on write testimonial i got a blank page,

 

already set the recaptcha to no as instruct at the manual.

 

using oscmax.

 

please help TIA.

 

ISWS,

 

Sounds like you are missing a file or setting. Please double-check that all the file changes are done and the new and replaced (if applicable) files are copied over. Let me know if that does not help.

 

Which version did you install?

Share this post


Link to post
Share on other sites

ISWS,

 

Sounds like you are missing a file or setting. Please double-check that all the file changes are done and the new and replaced (if applicable) files are copied over. Let me know if that does not help.

 

Which version did you install?

 

thank for the reply Richard

 

i use oscmax v2015

using Scrolling Customer Testimonials v1.11a

 

this what i do:

1. new installation on oscmax

2. new installation with customer testimonials

 

i already double check:

1. database through phpmyadmin

2. Upload the new files on the catalog

3. modify files from 2.1 - 2.12

 

Step 2.12 catalog/stylesheet.css <-- i dont have this in my catalog so i just copy it from the file provided is that ok?

 

TIA

Share this post


Link to post
Share on other sites

thank for the reply Richard

 

i use oscmax v2015

using Scrolling Customer Testimonials v1.11a

 

this what i do:

1. new installation on oscmax

2. new installation with customer testimonials

 

i already double check:

1. database through phpmyadmin

2. Upload the new files on the catalog

3. modify files from 2.1 - 2.12

 

Step 2.12 catalog/stylesheet.css <-- i dont have this in my catalog so i just copy it from the file provided is that ok?

 

TIA

 

Hmm. Well, I did a file compare between several versions of SCT and v1.11a and I don't see that anything changed in v1.11a except a one-line bug fix. So.... rather than following the instructions in 2.1 - 2.12, I would suggest that you use a file comparison tool (e.g. Beyond Compare) to compare the files in the Modified Files folder with your store. There could be something that I missed in the instructions (if I did, PLEASE let me know so that I can correct the documentation).

 

The Stylesheet.css file should not be an issue and it has nothing to do with the write testimonial function. That code sets up some of the attributes of the scrolling window pane.

 

It's possible there is some kind of conflict with OSCMax. I'm not familiar with that version of OSC. You said that you got a blank page, which means the PHP compiler doesn't like something. That is the only thing about PHP that I don't like - when it barfs on something it really hoses up your Website. Try TEMPORARILY adding the following code to your includes/application_top.php file. Then access the problematic page and post any error messages that you receive. Afterwards, remove the code below so that your customers don't see any suppressed errors.

 

ini_set('display_errors', 'On');
error_reporting(4096);

 

If that does not yield any information, I recommend installing this excellent contribution for troubleshooting:

 

Contribution here: KISS Error Handling and Debug

 

Support: Here

 

Just to be clear... post any error messages you get back here and I'll try to help you out.

Edited by Richard Cranium

Share this post


Link to post
Share on other sites

Hi

thanks for the nice contrib. I have installed it and it works fine.

The only problem is that when scrolling option is used only one same testimonial is shown. There are 2 in the DB now but only one of them is shown.

"Minimum number of testimonials before scrolling customer testimonials 2" <--- this is in admin

Help appreciated.

 

FYI, problem fixed in latest rev (1.11a)

Share this post


Link to post
Share on other sites

Hmm. Well, I did a file compare between several versions of SCT and v1.11a and I don't see that anything changed in v1.11a except a one-line bug fix. So.... rather than following the instructions in 2.1 - 2.12, I would suggest that you use a file comparison tool (e.g. Beyond Compare) to compare the files in the Modified Files folder with your store. There could be something that I missed in the instructions (if I did, PLEASE let me know so that I can correct the documentation).

 

The Stylesheet.css file should not be an issue and it has nothing to do with the write testimonial function. That code sets up some of the attributes of the scrolling window pane.

 

It's possible there is some kind of conflict with OSCMax. I'm not familiar with that version of OSC. You said that you got a blank page, which means the PHP compiler doesn't like something. That is the only thing about PHP that I don't like - when it barfs on something it really hoses up your Website. Try TEMPORARILY adding the following code to your includes/application_top.php file. Then access the problematic page and post any error messages that you receive. Afterwards, remove the code below so that your customers don't see any suppressed errors.

 

ini_set('display_errors', 'On');
error_reporting(4096);

 

If that does not yield any information, I recommend installing this excellent contribution for troubleshooting:

 

Contribution here: KISS Error Handling and Debug

 

Support: Here

 

Just to be clear... post any error messages you get back here and I'll try to help you out.

 

at last i found the error

there is no header.php file in the include folder wierd

 

thanks a lot for this nice add on

Share this post


Link to post
Share on other sites

Thanks for the great contrib., is it possible for you to add a graphical "stars rating" below the comments box? this is to know the level of satisfaction of customers. For example, 1 stars means poor and 5 means excellent, much like the product reviews, and then includes the star ratings under the scrolling text.

Edited by ptt81

Share this post


Link to post
Share on other sites

I was able to add "stars rating" in the submission form but im NOT able to get it to show up in the scrolling box or testimonials page. This is what i have done so far and it does work and get updated in database. Can someone help to get it to show in the infobox and testimonials page? Preferable show before the description.

 

1. Update to database table customer_testimonials

Run the following SQL query in phpMyAdmin or similar tool:

ALTER TABLE customer_testimonials ADD testimonial_rating int(11) default NULL;

2. Open catalog/customer_testimonials_write.php

Find the "two" instance of:

       $html_text = tep_db_prepare_input($HTTP_POST_VARS['html_text']);

at about line 52 and 154

Add below each instance:

       $testimonial_rating = tep_db_prepare_input($HTTP_POST_VARS['testimonial_rating']);


Find: 

       if (empty($html_text)) {
         $testimonials_error = true;
         $messageStack->add('testimonials', ERROR_TESTIMONIALS_DESCRIPTION_REQUIRED);
       }

Add below:

       if (empty($testimonial_rating)) {
         $testimonials_error = true;
         $messageStack->add('testimonials', ERROR_TESTIMONIALS_RATING_REQUIRED);
       }

Find:

'testimonials_html_text' => $html_text,

Add below:

'testimonial_rating' => $testimonial_rating,

Find:

$html_text = '';

Add below:

$testimonial_rating = '';

Find:

                 <tr>
                   <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?> <span class="inputRequirement">*</span><br>
										      <?php echo tep_draw_textarea_field('html_text', 'soft', '130', '10', $html_text); ?></td>
                 </tr>
	          <tr>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                 </tr>

Add below:

                 <tr>
                   <td valign="top" class="main"><?php echo TEXT_TESTIMONIALS_RATING; ?> <span class="inputRequirement">*</span><br>
										      <?php echo tep_draw_radio_field('testimonial_rating', '1'); ?><img src="images/stars_1.gif">(Poor)<br>
                                                 <?php echo tep_draw_radio_field('testimonial_rating', '2'); ?><img src="images/stars_2.gif">(Fair)<br>
   											  <?php echo tep_draw_radio_field('testimonial_rating', '3'); ?><img src="images/stars_3.gif">(Average)<br>
 												  <?php echo tep_draw_radio_field('testimonial_rating', '4'); ?><img src="images/stars_4.gif">(Very Good)<br>
     											  <?php echo tep_draw_radio_field('testimonial_rating', '5'); ?><img src="images/stars_5.gif">(Excellent)</td>
                 </tr>
	          <tr>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                 </tr>



3. Open catalog/includes/languages/english/customer_testimonials.php

Add before ?>:

define('TEXT_TESTIMONIALS_RATING', 'Your Rating of Us!');
define('ERROR_TESTIMONIALS_RATING_REQUIRED', 'A rating is required in order to submit your testimonial');


Edited by ptt81

Share this post


Link to post
Share on other sites

ptt81,

 

I don't have time atm to create a version for you that will do this, but you seem to be off to a good start. You'll also need to make several minor tweaks in various places to get it working smoothly. I'll try to get you started with the more important ones here.

 

1. One thing I noticed is you should add the rating to the Admin Email notification, so the admin knows what that looks like in conjunction with the customer's text.

 

Edit /customer_testimonials_write.php

 

Find around line 119:

 

            $email_text = TESTIMONIAL_NOTIFICATION_TEXT . $testimonials_name . TESTIMONIAL_CONJ . $testimonials_location . '.' . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_TITLE . $testimonials_title . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_HTML_TEXT . $html_text . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_APPROVE;
           tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, TESTIMONIAL_NOTIFICATION_SUBJECT, $email_text, $testimonials_name, $testimonials_email);

 

 

Change to:

 

            $email_text = TESTIMONIAL_NOTIFICATION_TEXT . $testimonials_name . TESTIMONIAL_CONJ . $testimonials_location . '.' . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_TITLE . $testimonials_title . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_HTML_TEXT . $html_text . "\n\n" .
                         TEXT_TESTIMONIAL_RATING . $testimonial_rating . "\n\n" .
                         TESTIMONIAL_NOTIFICATION_APPROVE;
           tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, TESTIMONIAL_NOTIFICATION_SUBJECT, $email_text, $testimonials_name, $testimonials_email);

 

 

 

2. For the InfoBox with the testimonial previews (/includes/boxes/customer_testimonials.php), you first need to decide how you want the preview to look. You also need to think about how much space you have available. The code current limits the preview text to 100 characters. For the moment, I'll presume you would want the rating text to appear below that preview text. The static infobox height is set automatically, and it will adjust and grow as you add more text. If you want to keep the static box the same size then you would need to reduce the number of preview characters to less than 100 (to change that edit line 86 of /includes/boxes/customer_testimonials.php:

 

                                 'text' => '<b><center>' . $testimonial_titulo . '</center></b><br>' . (strlen($testimonial) > 100 ? substr($testimonial,0,100) . ' ...': $testimonial) . '<br /><br /><a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, tep_get_all_get_params(array('language', 'currency')) .'testimonial_id=' . $random_testimonial['testimonials_id']) . '"><span><center>' . TEXT_READ_MORE . '</center></span></a><br><span><center><b> By '.$random_testimonial['testimonials_name'].'</b></center></span><br>' . $testimonial_write_link);

 

 

 

3. Do you want the rating to appear in static and scrolling testimonials, or just one or the other? The preview text is drawn in two different places in includes/boxes/customer_testimonials.php, depending on how it should branch (static or scrolling).

 

Basically, you need to construct a text string with the "ratings" text and the rating, and then insert that after the preview text. Like this...

 

edit /includes/boxes/customer_testimonials.php

 

To modify the static text display, find around line 83:

 

	    	$testimonial = strip_tags($random_testimonial['testimonials_html_text']);
    	$testimonial_titulo = $random_testimonial['testimonials_title'];
    	$info_box_contents[] = array('align' => 'left',
                                'text' => '<b><center>' . $testimonial_titulo . '</center></b><br>' . (strlen($testimonial) > 100 ? substr($testimonial,0,100) . ' ...': $testimonial) . '<br /><br /><a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, tep_get_all_get_params(array('language', 'currency')) .'testimonial_id=' . $random_testimonial['testimonials_id']) . '"><span><center>' . TEXT_READ_MORE . '</center></span></a><br><span><center><b> By '.$random_testimonial['testimonials_name'].'</b></center></span><br>' . $testimonial_write_link);

 

and change it to something like this:

 

	    	$testimonial = strip_tags($random_testimonial['testimonials_html_text']);
    	$testimonial_titulo = $random_testimonial['testimonials_title'];
               $testimonial_rating = TEXT_TESTIMONIAL_RATING . $random_testimonial['testimonial_rating'];
    	$info_box_contents[] = array('align' => 'left',
                                'text' => '<b><center>' . $testimonial_titulo . '</center></b><br>' . (strlen($testimonial) > 100 ? substr($testimonial,0,100) . ' ...': $testimonial) . '<br /><br />' . $testimonial_rating . '<a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, tep_get_all_get_params(array('language', 'currency')) .'testimonial_id=' . $random_testimonial['testimonials_id']) . '"><span><center>' . TEXT_READ_MORE . '</center></span></a><br><span><center><b> By '.$random_testimonial['testimonials_name'].'</b></center></span><br>' . $testimonial_write_link);

 

 

Make sure you define TEXT_TESTIMONIAL_RATING in your language files (e.g. "Rating: ").

 

 

To modify the scrolling text is a similar process, around lines 114-117.

Share this post


Link to post
Share on other sites

Hi Richard, thanks for the tips but don't you need some kind of nested ifelse statement and new SQL query in order for the correct rating to show it's corresponding stars graphic? This is where I got stuck as everything I tried simply make the firefox browser crash...lol I want it to show under the comments with scrolling in the infobox but before the comments in the view all testimonials page. Im hoping

you can give some more tips.

Edited by ptt81

Share this post


Link to post
Share on other sites

Hi Richard, thanks for the tips but don't you need some kind of nested ifelse statement and new SQL query in order for the correct rating to show it's corresponding stars graphic? This is where I got stuck as everything I tried simply make the firefox browser crash...lol I want it to show under the comments with scrolling in the infobox but before the comments in the view all testimonials page. Im hoping

you can give some more tips.

 

Yes, good point. You'll need to grab the radio button value (which it looks like you already figured out), and then on the display side pull that value from the database and possibly interpret the result. If you want to make it relatively simple, store the text values in the database so that when you retrieve them there is no conversion needed. For example, store "Excellent" instead of "5"

 

If you do it that way then you can use the code that I posted previously to pull the value from the testimonial database info.

Edited by Richard Cranium

Share this post


Link to post
Share on other sites

Yes, good point. You'll need to grab the radio button value (which it looks like you already figured out), and then on the display side pull that value from the database and possibly interpret the result. If you want to make it relatively simple, store the text values in the database so that when you retrieve them there is no conversion needed. For example, store "Excellent" instead of "5"

 

If you do it that way then you can use the code that I posted previously to pull the value from the testimonial database info.

 

Doesn't it just going to display "Excellent" without the stars_5.gif? and defeat the purpose of having the stars rating graphic? I tried an ifesle statement within the includes/modules/customer_testimonials.php and it crashed just about anywhere I put the codes, but when it crashed I can see it outputting the right stars just before it froze up. May be I did something wrong, please help.

 

This is what I've tried but failed:

 

1. in catalog/customer_testimonials.php:

Find:  'email' => $testimonials['testimonials_email'],
Add below:  'rating' => $testimonials['testimonial_rating']); 

So it will look like this:

           while ($testimonials = tep_db_fetch_array($full_testimonial)) {
               $testimonial_array[] = array('id' => $testimonials['testimonials_id'],
                                            'author' => $testimonials['testimonials_name'],
				     'location' => $testimonials['testimonials_location'],
				     'title' => $testimonials['testimonials_title'],
                                            'testimonial' => $testimonials['testimonials_html_text'],
                                            'word_count' => tep_word_count($testimonials['testimonials_html_text'], ' '),
                                            'image' => $testimonials['testimonial_image'],
			             'date_added' => $testimonials['date_added'],
                                            'email' => $testimonials['testimonials_email'],
                                            'rating' => $testimonials['testimonial_rating']);   

           }

Then I do an ifelse 

     if(is_null($testimonial_array[$i]['rating'])) $i="";
     elseif($testimonial_array[$i]['rating']==0) $i='<br><img src="'.DIR_WS_IMAGES.'stars_0.gif">';
     elseif($testimonial_array[$i]['rating']==1) $i='<br><img src="'.DIR_WS_IMAGES.'stars_1.gif">';
     elseif($testimonial_array[$i]['rating']==2) $i='<br><img src="'.DIR_WS_IMAGES.'stars_2.gif">';
     elseif($testimonial_array[$i]['rating']==3) $i='<br><img src="'.DIR_WS_IMAGES.'stars_3.gif">';
     elseif($testimonial_array[$i]['rating']==4) $i='<br><img src="'.DIR_WS_IMAGES.'stars_4.gif">';
     elseif($testimonial_array[$i]['rating']==5) $i='<br><img src="'.DIR_WS_IMAGES.'stars_5.gif">';

2. in includes/modules/customer_testimonials.php

add before the codes below, right after line 128:

     $info_box_contents[][] = array('align' => 'left',
                                    'params' => 'class="smallText" width="100%" valign="top"',
                                    'text' => '
								 	<table border="0" cellspacing="2" cellpadding="2" width="100%">
									  <tr>
										<td class="smallText">
										<b>' . TEXT_TESTIMONY_BY . '</b>' . $testimonial_array[$i]['author']. TEXT_TESTIMONY_OF . $testimonial_array[$i]['location'] . '<br><br>' . '<b>' . TEXT_TESTIMONY_DATE_ADDED . '</b>' . tep_date_short($testimonial_array[$i]['date_added']) . '<br><br>Rating: ' . $i . '<br><br><b>' . TEXT_TESTIMONY_TITLE . '</b>' . $testimonial_array[$i]['title'] . '<br><br>' . $testimonial_array[$i]['testimonial'] . '<br><br>' .  $testimonials_list . '
										</td>
										<td class="smallText">
										' . $displayimage . '
										</td>
									  </tr>
									</table>');

Edited by ptt81

Share this post


Link to post
Share on other sites

 

Then I do an ifelse

 

if(is_null($testimonial_array[$i]['rating'])) $i="";

elseif($testimonial_array[$i]['rating']==0) $i='<br><img src="'.DIR_WS_IMAGES.'stars_0.gif">';

elseif($testimonial_array[$i]['rating']==1) $i='<br><img src="'.DIR_WS_IMAGES.'stars_1.gif">';

elseif($testimonial_array[$i]['rating']==2) $i='<br><img src="'.DIR_WS_IMAGES.'stars_2.gif">';

elseif($testimonial_array[$i]['rating']==3) $i='<br><img src="'.DIR_WS_IMAGES.'stars_3.gif">';

elseif($testimonial_array[$i]['rating']==4) $i='<br><img src="'.DIR_WS_IMAGES.'stars_4.gif">';

elseif($testimonial_array[$i]['rating']==5) $i='<br><img src="'.DIR_WS_IMAGES.'stars_5.gif">';

 

Looks like the problem is you are using the $i incorrectly. That ($i) is a counter. What you're doing above is using it first as a pointer and then changing it to a text variable. I'm sure that has a lot to do with why your form is crashing or hanging. What you need is something like this....

 

First, let's use a new variable such as $rating.

 

     if (tep_not_null($testimonial_array[$i]['rating'])) $rating = ($testimonial_array[$i]['rating']==0 ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_0.gif">' : ($testimonial_array[$i]['rating']==1) ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_1.gif">' : ($testimonial_array[$i]['rating']==2) ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_2.gif">' : ($testimonial_array[$i]['rating']==3) ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_3.gif">' : ($testimonial_array[$i]['rating']==4) ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_4.gif">' : ($testimonial_array[$i]['rating']==5) ? $rating='<br><img src="'.DIR_WS_IMAGES.'stars_5.gif">' : $rating = '');

 

 

Now, further down change this line:

 

2. in includes/modules/customer_testimonials.php

 

add before the codes below, right after line 128:

 

<b>' . TEXT_TESTIMONY_BY . '</b>' . $testimonial_array[$i]['author']. TEXT_TESTIMONY_OF . $testimonial_array[$i]['location'] . '<br><br>' . '<b>' . TEXT_TESTIMONY_DATE_ADDED . '</b>' . tep_date_short($testimonial_array[$i]['date_added']) . '<br><br>Rating: ' . $i . '<br><br><b>' . TEXT_TESTIMONY_TITLE . '</b>' . $testimonial_array[$i]['title'] . '<br><br>' . $testimonial_array[$i]['testimonial'] . '<br><br>' . $testimonials_list . '

[/code]

 

TO:

 

<b>' . TEXT_TESTIMONY_BY . '</b>' . $testimonial_array[$i]['author']. TEXT_TESTIMONY_OF . $testimonial_array[$i]['location'] . '<br><br>' . '<b>' . TEXT_TESTIMONY_DATE_ADDED . '</b>' . tep_date_short($testimonial_array[$i]['date_added']) . '<br><br>Rating: ' . $rating . '<br><br><b>' . TEXT_TESTIMONY_TITLE . '</b>' . $testimonial_array[$i]['title'] . '<br><br>' . $testimonial_array[$i]['testimonial'] . '<br><br>' .  $testimonials_list . '

Share this post


Link to post
Share on other sites

That works perfectly. I didn't even realized $i is the counter thats been used in the array, no wonder. Now lets do the same for infobox and may be you can add this to the next version.

 

I did a minor change to include the rating text (Fair to Excellent) and remove <br> tag so the stars would display next to the "Rating: " instead of below it.

 

      if (tep_not_null($testimonial_array[$i]['rating'])) $rating = ($testimonial_array[$i]['rating']==0 ? $rating='<img src="'.DIR_WS_IMAGES.'stars_0.gif">' : ($testimonial_array[$i]['rating']==1) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_1.gif">(Poor)' : ($testimonial_array[$i]['rating']==2) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_2.gif">(Fair)' : ($testimonial_array[$i]['rating']==3) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_3.gif">(Average)' : ($testimonial_array[$i]['rating']==4) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_4.gif">(Very Good)' : ($testimonial_array[$i]['rating']==5) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_5.gif">(Excellent)' : $rating = '');

 

Thanks a lot for your help, hope this is a useful addition to others as well.

Edited by ptt81

Share this post


Link to post
Share on other sites

For the stars gif to display better, I have added align="absmiddle" within the <img tag

 

Edited the codes again to remove "0" star rating since it starts at "1" star

 

      if (tep_not_null($testimonial_array[$i]['rating'])) $rating = ($testimonial_array[$i]['rating']==1 ? $rating='<img src="'.DIR_WS_IMAGES.'stars_1.gif">(Poor)' : ($testimonial_array[$i]['rating']==2) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_2.gif" align="absmiddle">(Fair)' : ($testimonial_array[$i]['rating']==3) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_3.gif" align="absmiddle">(Average)' : ($testimonial_array[$i]['rating']==4) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_4.gif" align="absmiddle">(Very Good)' : ($testimonial_array[$i]['rating']==5) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_5.gif" align="absmiddle">(Excellent)' : $rating = '');

Edited by ptt81

Share this post


Link to post
Share on other sites

Just went thru more testing and I found the codes line above does not work, it does not matter how many stars you submitted it always returned 5 stars. If anyone is reading and doing this do not use it.

 

Going back to ifelse statement I posted earlier, replace $i with $rating and it works perfectly displaying the right number of stars which the user is rated

 

Replace:

if (tep_not_null($testimonial_array[$i]['rating'])) $rating = ($testimonial_array[$i]['rating']==1 ? $rating='<img src="'.DIR_WS_IMAGES.'stars_1.gif">(Poor)' : ($testimonial_array[$i]['rating']==2) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_2.gif">(Average)' : ($testimonial_array[$i]['rating']==3) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_3.gif">(Good)' : ($testimonial_array[$i]['rating']==4) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_4.gif">(Very Good)' : ($testimonial_array[$i]['rating']==5) ? $rating='<img src="'.DIR_WS_IMAGES.'stars_5.gif" align="absmiddle">(Excellent)' : $rating = '');


With:

//Added for stars rating
if(is_null($testimonial_array[$i]['rating'])) $rating="";
elseif($testimonial_array[$i]['rating']==1) $rating='<img src="'.DIR_WS_IMAGES.'stars_1.gif" align="absmiddle">(Poor)';
elseif($testimonial_array[$i]['rating']==2) $rating='<img src="'.DIR_WS_IMAGES.'stars_2.gif" align="absmiddle">(Fair)';
elseif($testimonial_array[$i]['rating']==3) $rating='<img src="'.DIR_WS_IMAGES.'stars_3.gif" align="absmiddle">(Average)';
elseif($testimonial_array[$i]['rating']==4) $rating='<img src="'.DIR_WS_IMAGES.'stars_4.gif" align="absmiddle">(Very Good)';
elseif($testimonial_array[$i]['rating']==5) $rating='<img src="'.DIR_WS_IMAGES.'stars_5.gif" align="absmiddle">(Excellent)';
//Added for stars rating

 

You need to add this piece of code under every instance of if and else inside the includes/modules/customer_testimonials.php (there are 4 instance)

 

Thanks Richard again for pointing out my mistake earlier.

 

Question for Richard: does the upload feature allow someone to upload a virus or a hack injection that could cause damage to the website?

Edited by ptt81

Share this post


Link to post
Share on other sites

Just went thru more testing and I found the codes line above does not work, it does not matter how many stars you submitted it always returned 5 stars. If anyone is reading and doing this do not use it.

 

Going back to ifelse statement I posted earlier, replace $i with $rating and it works perfectly displaying the right number of stars which the user is rated

 

Sorry about that. I must have mucked up the logic. That general concept should work, or as you pointed out a bunch of IF/ELSE statements (which is essentially same thing... I was trying to get it all on one line).

 

Glad you got it working. :)

Share this post


Link to post
Share on other sites

Sorry about that. I must have mucked up the logic. That general concept should work, or as you pointed out a bunch of IF/ELSE statements (which is essentially same thing... I was trying to get it all on one line).

 

Glad you got it working. :)

 

No need for apology. I can't get this to work without your help to begin with.

 

I have two questions:

 

1. Would the upload feature allow uploading or hacking purpose? Im afraid that someone can upload virus and stuff to the server, or would that already be protected by the host?

 

2. Is there anyway to make the scrolling in infobox to scroll in a continuous loop? instead of a blank space at the end of the list before it gets scroll again.

 

Many thanks.

Share this post


Link to post
Share on other sites

Step 2.9 catalog/includes/column_left.php OR catalog/ includes/column_right.php

Add the following wherever you want the CT InfoBox to appear (but before the last ?>):

 
// Begin Scrolling Customer Testimonials v1.0
// Do not load Testimonials box if page is SSL
// Why? It may trigger SSL warning
if ($request_type != 'SSL') {
 include(DIR_WS_BOXES . 'customer_testimonials.php');
}
// End Scrolling Scrolling Customer Testimonials v1.0

 

So does this mean that the infobox on any index.php homepage that has an SSL cert will cause issues for people browsing that site?

Can you please explain what actually is the issue?

 

Regards

George

Share this post


Link to post
Share on other sites

Step 2.9 catalog/includes/column_left.php OR catalog/ includes/column_right.php

Add the following wherever you want the CT InfoBox to appear (but before the last ?>):

 
// Begin Scrolling Customer Testimonials v1.0
// Do not load Testimonials box if page is SSL
// Why? It may trigger SSL warning
if ($request_type != 'SSL') {
 include(DIR_WS_BOXES . 'customer_testimonials.php');
}
// End Scrolling Scrolling Customer Testimonials v1.0

 

So does this mean that the infobox on any index.php homepage that has an SSL cert will cause issues for people browsing that site?

Can you please explain what actually is the issue?

 

Regards

George

 

Hello George.

 

I don't recall the exact cause from when I was developing the mod, but I do recall that under some circumstances that the scrolling testimonials can cause a SSL warning. It's the standard browser warning that some of the content on the page is not encrypted and your information may be viewable by a 3rd party, etc. The problem with that - from a user perspective - is that of course you don't know what the non SSL content is. I did not have a need at the time to find a solution, so I chose to restrict the testimonials to non-SSL pages only, which solved the problem.

 

I can see that if you have your entire site SSL protected, this would obviously be an issue. I can re-visit this issue if you like, but it will be a few weeks before I would have time to do so. Incidentally, unless you absolutely need it to be SSL encrypted, doing so on your home page is generally not advisable IMHO. I makes your server and the client both work harder, resulting in slower performance (though depending on the Website content it may or may not be a big deal, and also depending on how beefy your server is).

 

If you want to tackle this issue yourself, I'll help you out with questions as best as I can. Just post them here.

 

Best Regards,

David

Share this post


Link to post
Share on other sites

No need for apology. I can't get this to work without your help to begin with.

 

I have two questions:

 

1. Would the upload feature allow uploading or hacking purpose? Im afraid that someone can upload virus and stuff to the server, or would that already be protected by the host?

 

2. Is there anyway to make the scrolling in infobox to scroll in a continuous loop? instead of a blank space at the end of the list before it gets scroll again.

 

Many thanks.

 

1. I am not personally a fan of allowing customer uploads via methods such as the SCT mod. I left it in place from the original CT mod because I knew some people would want it. It does introduce a security risk. There's no way around that. You will need to review and release the files before anyone can see them on the site. As far as I know, there is no risk with the files sitting on your server. The risk is if you - as admin - open a malicious file and it does something to your client PC or server. Of course, you also don't want to post a file with a virus or worm and later get complaints from your customers.

 

If you are going to allow customers to upload files, I recommend taking the following steps:

1. Only allow registered users/customers to upload files

2. Require reCaptcha on the Write Testimonials form

3. Make sure you have a dedicated directory for your customer uploads - with no other files in it

4. Screen the files with an up-to-date anti-virus program before you allow the files to be posted on your Website. There are a variety of server-based programs that can also be used to automatically screen anything in the customer upload directory. I don't have any specific ones to recommend, but if you search online you can find them. Some of these programs would need to be installed by a Sys Admin of your Host. If file uploads by customers are relatively infrequent, you may just want to handle it manually.

 

2. You mean the blank space at the end of the text scrolling cycle, when it starts over at the beginning of the chunk of text it is scrolling?

 

Well, you have a few options. One is to make the scroll text field larger, containing more content. The downside of this is it will take your page longer to load and the scrolling testimonials longer before they start to kick in. To do this, just keep the minimum number low and maximum number high of testimonials you want displayed (in the admin tool). That won't eliminate the white space at the end, but it will take longer before you see it.

 

To do what you describe takes a bit of trickery. The Marquee HTML tag - used to create the scrolling effect - wants to automatically insert a blank space at the end. I have read about a method to do what you'd like here. However, I have not tried it and the demo pages appear to be dead links. So, I'm not sure if the method described really works or not.

 

There is also supposedly a JavaScript method by Dynamic Drive. You can view a demo here. To use this method, you would have to re-code all the Marquee HTML code to use JavaScript instead. I don't know anything about this JS code demo'd. I am just tossing this out as a possible option for you.

 

A 3rd possibility is you could try removing some of the hard-coded HTML tags for the text stream, such as <br> tags, and possibly removing or altering <tr>,<td>, and <table> tags to make sure they are not padding with space. The code in question is here in /includes/boxes/customer_testimonials.php:

 

// draw the text
     	$testimonials_list .= '<tr><td class="infoBoxContents" valign="top" align="left">';  
	$testimonial = strip_tags($random_testimonial['testimonials_html_text']);
    $testimonial_titulo = $random_testimonial['testimonials_title'];
    $testimonials_list .= '<center><b>' . $testimonial_titulo . '</center></b><br>' . (strlen($testimonial) > 100 ? substr($testimonial,0,100) . ' ...': $testimonial) . '<br /><br /><a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, tep_get_all_get_params(array('language', 'currency')) .'testimonial_id=' . $random_testimonial['testimonials_id']) . '"><span><center>' . TEXT_READ_MORE . '</center></span></a><br><span><center><b> By '.$random_testimonial['testimonials_name'].'</b></center></span><br><br>';
     $testimonials_list .= '</td></tr>';
   	}
   $testimonials_list .= '</table>';

Share this post


Link to post
Share on other sites

 

Hi David,

 

I gave the upgrade from V4.0 to the latest version and was very happy with the results. You did a great job - Congrats. A couple of questions and comments:

 

1) I will have a look at the SSL error and if it indeed is a problem and get back to you. I will try and assist you in providing a solution if proven a problem.

 

2) The upgrade SQL testimonials_v5_upgrade_v1.1.SQL required one change that I found for me to get it going. Not sure if you came across the same issue. It complained that the followig was too long:

# Display testimonials language preference
DELETE IGNORE FROM configuration WHERE configuration_key='TESTIMONIAL_LANG_PREF';
INSERT INTO `configuration` ( `configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `date_added`, `set_function`, `use_function`) VALUES (NULL, 'Testimonials langugage display setting', 'TESTIMONIAL_LANG_PREF', 'User Language Only', 'Define how Testimonials are viewed, based on viewer language. If your site has multiple languages, you can allow your users to view testimonials written in all languages or limit their viewing to the language they are using (e.g. English user only sees English testimonials).<br>', '555', '23', NOW(), 'tep_cfg_select_option(array(\'User Language Only\', \'All Languages\'), ', NULL);

I changed it to the following and it accepted the entry:

# Display testimonials language preference
DELETE IGNORE FROM configuration WHERE configuration_key='TESTIMONIAL_LANG_PREF';
INSERT INTO `configuration` ( `configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, 

`configuration_description`, `configuration_group_id`, `sort_order`, `date_added`, `set_function`, `use_function`) VALUES 

(NULL, 'Testimonials langugage display setting', 'TESTIMONIAL_LANG_PREF', 'User Language Only', 'Define how Testimonials are 

viewed, based on viewer language.<br>', '555', '23', NOW(), 'tep_cfg_select_option(array(\'User Language Only\', \'All 

Languages\'), ', NULL);

 

3)Do you know if it is possible to retrieve all DB entries and display them in desc_order? Scrolling random enties sometimes show the same entry twice in a row.

// pick one randomly
	$random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 AND language_id = $languages_id ORDER BY rand() LIMIT 1");
} else {  // else pick one out of all testimonials for all languages
	$random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 ORDER BY rand() LIMIT 1");
}

 

4)Do you know if it possible to retrieve all testimonials and their whole string (viewable in view source) but but only display first 150 characters of each testimonial in the scrolling infobox?

 

$testimonials_list .= '<b><center>' . $testimonial_titulo . '</center></b><br>' . '<img src="images/quote_up.png" alt="">' . (strlen($testimonial) > 150 ? substr($testimonial,0,150) . '...' : $testimonial) . '<img valign="top" src="images/quote_down.png" alt="">' . '<br>' . '<span><center><b>'.$random_testimonial['testimonials_name'].'</b></center></span><br>';

 

 

5)Let me know if you are interested to incorporate split page results in your next revision. I created this code and found that it works great. Cant seem to find any error yet, have a look and let me know your thoughts.

Split results CT Thread link

 

Regards

George

Share this post


Link to post
Share on other sites

Hi David,

 

I gave the upgrade from V4.0 to the latest version and was very happy with the results. You did a great job - Congrats. A couple of questions and comments:

 

1) I will have a look at the SSL error and if it indeed is a problem and get back to you. I will try and assist you in providing a solution if proven a problem.

 

 

George,

 

Sounds good. Thanks. :)

 

2) The upgrade SQL testimonials_v5_upgrade_v1.1.SQL required one change that I found for me to get it going. Not sure if you came across the same issue. It complained that the followig was too long:

# Display testimonials language preference
DELETE IGNORE FROM configuration WHERE configuration_key='TESTIMONIAL_LANG_PREF';
INSERT INTO `configuration` ( `configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `date_added`, `set_function`, `use_function`) VALUES (NULL, 'Testimonials langugage display setting', 'TESTIMONIAL_LANG_PREF', 'User Language Only', 'Define how Testimonials are viewed, based on viewer language. If your site has multiple languages, you can allow your users to view testimonials written in all languages or limit their viewing to the language they are using (e.g. English user only sees English testimonials).<br>', '555', '23', NOW(), 'tep_cfg_select_option(array(\'User Language Only\', \'All Languages\'), ', NULL);

I changed it to the following and it accepted the entry:

# Display testimonials language preference
DELETE IGNORE FROM configuration WHERE configuration_key='TESTIMONIAL_LANG_PREF';
INSERT INTO `configuration` ( `configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, 

`configuration_description`, `configuration_group_id`, `sort_order`, `date_added`, `set_function`, `use_function`) VALUES 

(NULL, 'Testimonials langugage display setting', 'TESTIMONIAL_LANG_PREF', 'User Language Only', 'Define how Testimonials are 

viewed, based on viewer language.<br>', '555', '23', NOW(), 'tep_cfg_select_option(array(\'User Language Only\', \'All 

Languages\'), ', NULL);

 

Thanks. That is good to know. I've not run into that problem, personally. But I appreciate the info. Are you using MyPHPAdmin to run your SQL, or something else? Which version of MySQL is on your server?

 

3)Do you know if it is possible to retrieve all DB entries and display them in desc_order? Scrolling random enties sometimes show the same entry twice in a row.

// pick one randomly
	$random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 AND language_id = $languages_id ORDER BY rand() LIMIT 1");
} else {  // else pick one out of all testimonials for all languages
	$random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 ORDER BY rand() LIMIT 1");
}

 

I know it's possible. Just put the retrieved testimonials in an array and sort it. This is something on my radar, but I have not had time to work on it. Ideally, I would like to create such a function that allows the admin to choose a sort field or leave it random. Mainly, I believe it would be useful to eliminate duplicates. And yet another part of the challenge is after you eliminate dups, the code should go back and insert more testimonials until you hit the minimum number specified by the admin for display or you find you are displaying all of the testimonials (reached maximum) - though the latter is easily checked before the start of a code routine to sort them. I started working on this during the original SCT construction, but quickly realized it requires careful thought and is much more complicated than it might seem at first. At least the concept is simple, but writing a subroutine to do it that does not chew up tons of server resources and take lots of time requires some thought.

 

4)Do you know if it possible to retrieve all testimonials and their whole string (viewable in view source) but but only display first 150 characters of each testimonial in the scrolling infobox?

 

$testimonials_list .= '<b><center>' . $testimonial_titulo . '</center></b><br>' . '<img src="images/quote_up.png" alt="">' . (strlen($testimonial) > 150 ? substr($testimonial,0,150) . '...' : $testimonial) . '<img valign="top" src="images/quote_down.png" alt="">' . '<br>' . '<span><center><b>'.$random_testimonial['testimonials_name'].'</b></center></span><br>';

 

Perhaps I am probably missing something in your question, but what you are asking for already happens. Except it's not being sent to the browser. Is that what you are asking? If you can send the whole testimonial text to the browser, but tell the browser to only display part of it? If so, what would be your goal? I purposely limited the text coming down to the browser in order to facilitate a faster page rendering. A testimonial could be thousands of characters, depending on the Website and how it is configured. If you allow this and the admin has set up the site to display, say 100 testimonials scrolling for example, you could choke the browser on some computers. Plus it would force the server to spit out a lot of data for each connection. I just think it makes sense to limit the output from the server end.

 

All that aside, what you ask (if I am interpreting your question as you intended) is possible, yes. However, you cannot limit that function with the Marquee HTML command. It is going to display the whole chunk of text - whatever you sent. To accomplish what you want, you would need to also send down a hidden text field with the data. Another item that I have on the radar for development is to create a JavaScript version of the scroller. At that point, I could incorporate the function you describe. However, again I would question the value of doing so and sending down all that data to the client when it's not being used. So, I'm not sure it would make sense to create such a function. What purpose do you have in mind to do with the full testimonial text?

 

5)Let me know if you are interested to incorporate split page results in your next revision. I created this code and found that it works great. Cant seem to find any error yet, have a look and let me know your thoughts.

Split results CT Thread link

 

Regards

George

 

Thank you for your offer. I'll have to give it some thought. Is there a site with a demo for CT using split results that I could view? Is the idea to add a page number, prev, next buttons at the end of n testimonials displayed per page?

 

Best Regards,

David

Share this post


Link to post
Share on other sites

Thanks. That is good to know. I've not run into that problem, personally. But I appreciate the info. Are you using MyPHPAdmin to run your SQL, or something else? Which version of MySQL is on your server?

I tried it with mysql Query Browser, phpmyadmin and mysqldumper. MYSQL version 5.0

I know it's possible. Just put the retrieved testimonials in an array and sort it. This is something on my radar, but I have not had time to work on it. Ideally, I would like to create such a function that allows the admin to choose a sort field or leave it random. Mainly, I believe it would be useful to eliminate duplicates. And yet another part of the challenge is after you eliminate dups, the code should go back and insert more testimonials until you hit the minimum number specified by the admin for display or you find you are displaying all of the testimonials (reached maximum) - though the latter is easily checked before the start of a code routine to sort them. I started working on this during the original SCT construction, but quickly realized it requires careful thought and is much more complicated than it might seem at first. At least the concept is simple, but writing a subroutine to do it that does not chew up tons of server resources and take lots of time requires some thought.

I agree on your points re resources etc, though it does this anyway when we run the query for customer_testimonials page. I was thinking along the lines of using same query. Your thoughts?

Perhaps I am probably missing something in your question, but what you are asking for already happens. Except it's not being sent to the browser. Is that what you are asking? If you can send the whole testimonial text to the browser, but tell the browser to only display part of it? If so, what would be your goal? I purposely limited the text coming down to the browser in order to facilitate a faster page rendering. A testimonial could be thousands of characters, depending on the Website and how it is configured. If you allow this and the admin has set up the site to display, say 100 testimonials scrolling for example, you could choke the browser on some computers. Plus it would force the server to spit out a lot of data for each connection. I just think it makes sense to limit the output from the server end.

All that aside, what you ask (if I am interpreting your question as you intended) is possible, yes. However, you cannot limit that function with the Marquee HTML command. It is going to display the whole chunk of text - whatever you sent. To accomplish what you want, you would need to also send down a hidden text field with the data. Another item that I have on the radar for development is to create a JavaScript version of the scroller. At that point, I could incorporate the function you describe. However, again I would question the value of doing so and sending down all that data to the client when it's not being used. So, I'm not sure it would make sense to create such a function. What purpose do you have in mind to do with the full testimonial text?

I agree with faster page rendering etc but my idea was more around increasing the code to text ratios for a site. More from an SEO point of view for sites with limited to no text and more graphics. Many words and sentences in testimonials have good keywords/text that are appropriate/relevant to the topic of the website. More of a quick win to increase the code to text ratio. I think the benefit of increased text out weighs degradation of server load times etc.

I had a look at different options as well and tried a few but none seemed to work as it should. The jquery fadein effect in my opinion is the most elegant option to use. if moving to a java option.

Thank you for your offer. I'll have to give it some thought. Is there a site with a demo for CT using split results that I could view? Is the idea to add a page number, prev, next buttons at the end of n testimonials displayed per page?

Yeah thats the idea. I also incorporated show all as it was a requirement. Ill PM you the link and you can let me know your thoughts. I can send over the file changes if you like to test it out.

 

Regards

George

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×