Jump to content



greasemonkey

Member Since 07 Jan 2010
OFFLINE Last Active Today, 01:44
-----

Posts I've Made

In Topic: Amazon Juggernaut

Yesterday, 20:12

@frankl nice... I'll have a look

In Topic: Amazon Juggernaut

Yesterday, 17:36

On this same topic... is there a way to change the color the review stars without touching html_output.php?

  // review stars
  function tep_draw_stars($rating = 0, $meta = false) {
    $stars = str_repeat('<span class="fa fa-star  star-color"></span>', (int)$rating);
    $stars .= str_repeat('<span class="fa fa-star-o  star-color"></span>', 5-(int)$rating);
    if ($meta !== false) $stars .= '<meta itemprop="rating" content="' . (int)$rating . '" />';

    return $stars;
  }

As above.... I have added star-color to the class and defined in user.css.... but I would have presumed a way without the core hack?

.star-color {
    color: yellow;
    -webkit-text-stroke-width: 0.25px;
    -webkit-text-stroke-color: orange;
}	

In Topic: Amazon Juggernaut

Yesterday, 17:07

here is a super simple add to product listing to add the review stars....

 

Maybe a query expert could help combine this into 1 query?

 

in includes english....

//product_listing review stars
define('LISTING_TEXT_AVERAGE', '%s Review(s) %s');

and includes modules product listing... wherever you want it... I've added it below the add to cart button.

		  //rating stars
$average_query = tep_db_query("select AVG(r.reviews_rating) as average, COUNT(r.reviews_rating) as count from " . TABLE_REVIEWS . " r where r.products_id = '" . (int)$listing['products_id'] . "' and r.reviews_status = 1");
$average = tep_db_fetch_array($average_query);

$reviews_query = tep_db_query("select count(*) as count, avg(reviews_rating) as avgrating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$listing['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
$reviews = tep_db_fetch_array($reviews_query);

		      if ($reviews['count'] > 0) {
		  $prod_list_contents .= '<div class="col-sm-12 text-center">' . sprintf(LISTING_TEXT_AVERAGE, tep_output_string_protected($average['count']), tep_draw_stars(tep_output_string_protected(round($average['average'])))) . '</div>';
			  }else{
			  }		

In Topic: PayPal App and 2.3.4BS Gold

Yesterday, 16:02

@Mikepo do you have 4.039 up and running now?

If so you are safe to use the built in app upgrade button... of course I always take a file and DB back up before doing an upgrade.

In Topic: Amazon Juggernaut

Yesterday, 13:06

@greasemonkey

product_info has a (quite basic) modular reviews module, ready to go...

 

Yep...part of this tread I think has  been about "learning" from the 800 lb gorilla.... looking how seamlessly and professionally Amazon displays the reviews (now that I have so many) I/we need to step it up....

 

Maybe as simple as adding avg review stars with color to the "review" button?

 

But also adding avg review stars to the product listing (a little more tricky.... until the product listing is modularized).

 

So.... so start just grabbing.... from product reviews...


$average_query = tep_db_query("select AVG(r.reviews_rating) as average, COUNT(r.reviews_rating) as count from " . TABLE_REVIEWS . " r where r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_status = 1");
$average = tep_db_fetch_array($average_query);
echo '<div class="col-sm-8 text-center alert alert-success" itemprop="AggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><meta itemprop="ratingValue" content="' . max(1, (int)round($average['average'])) . '" /><meta itemprop="bestRating" content="5" />' . sprintf(REVIEWS_TEXT_AVERAGE, tep_output_string_protected($average['count']), tep_draw_stars(tep_output_string_protected(round($average['average'])))) . '</div>';

and this from product info

<?php
    $reviews_query = tep_db_query("select count(*) as count, avg(reviews_rating) as avgrating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$_GET['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
    $reviews = tep_db_fetch_array($reviews_query);

    if ($reviews['count'] > 0) {
      echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><meta itemprop="ratingValue" content="' . $reviews['avgrating'] . '" /><meta itemprop="ratingCount" content="' . $reviews['count'] . '" /></span>';
    }
?>

  <div class="buttonSet row">
  <div class="col-xs-12 text-right"><?php if ($reviews['count'] > 0) {  
    echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'fa fa-heart', tep_href_link('product_reviews.php', tep_get_all_get_params()), 'default', NULL, 'btn-default'); 
	 }else{
    echo tep_draw_button(IMAGE_BUTTON_WRITE_REVIEW, 'fa fa-heart', tep_href_link('product_reviews_write.php', tep_get_all_get_params()), 'default', NULL, 'btn-default'); }?></div>
  </div>

  <div class="row">
    <?php echo $oscTemplate->getContent('product_info'); ?>
  </div>

And combine into a product info content mod???