Re: jQuery Scrolling Sideboxes [Support Thread]
Hello!
Small typo (pname/name) in tpl_best_sellers_scrolling.php:
Code:
$bss_pname = $best_sellers_scrolling->fields['products_name'];
(...)
$content .= "<br />#$count: $bss_name</a>";
Somehow only best_sellers_scrolling shows up in my 1.5.6c ZC shop and simply reloads the next best sellers after a while.
Should there be some kind of animation?
Other 3 do not show up at all even when enabled as a sidebox from the admin side, no error message in log or on screen.
I'm puzzled. What is it supposed to look like?
Julien
Re: jQuery Scrolling Sideboxes [Support Thread]
Oh my!:shocking: That bug's been present forever (thanks for the report).
I use the featured_scrolling (My Services) and whats_new_scrolling (Recently Updated) sideboxes on My Website. The 'normal' Zen Cart limits are used for those displays.
That is, if you have no featured products, the featured_scrolling won't display. If you have no 'new' products (as limited by Configuration :: Maximum Values :: New Product Listing .. Limited To), the whats_new_scrolling doesn't display.
Re: jQuery Scrolling Sideboxes [Support Thread]
I've just submitted v2.1.3 of the jQuery Scrolling Sideboxes.
This release contains changes associated with the following GitHub issues:
#11: Correct variable usage in best_sellers_scrolling
Re: jQuery Scrolling Sideboxes [Support Thread]
Quote:
Originally Posted by
lat9
I've just submitted v2.1.3 of the jQuery Scrolling Sideboxes.
This release contains changes associated with the following GitHub issues:
#11: Correct variable usage in best_sellers_scrolling
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=1909
Re: jQuery Scrolling Sideboxes [Support Thread]
Quote:
Originally Posted by
lat9
Thank you!
I get it now.
I thought "scrolling" sounded like a visual effect (carousel maybe?) but it's actually a timed rotation, which is fine as well.
Julien
Re: jQuery Scrolling Sideboxes [Support Thread]
Quote:
Originally Posted by
DivaVocals
Question: (yep here I go pushing the envelope again.. :laugh:)
I haven't downloaded this yet to take a looksee, but I would like to add this kind of functionality to the Testimonials and reviews sideboxes.. In your opinion, will it be fairly OBVIOUS looking at your code to figure out how to apply this to the Testimonials and reviews sideboxes??
Hi Crystal, did you ever get this plugin to work with the Reviews Box?
I started to copy/merge some info from this plugin to the review files but my brain started to fade away and I gave up :(
Hope you had luck with this at least.
Quote:
Originally Posted by
lat9
Yes. In each case, the plugin's sideboxes were cloned from their built-in Zen Cart sidebox of a similar name. The jQuery that handles the scrolling is a common function, invoked via the sidebox's tpl_ file.
Thank you very much Cindy for this plugin, works well out of the box on 1.5.7c on PHP 7.4 on responsive_classic :)
Hopefully I can manage to expand it to the reviews box.
Re: jQuery Scrolling Sideboxes [Support Thread]
Ok, so I had another go at it and I'm almost there, just need more help please as I'm very sure I've done a few things wrong :(
Can't seem to get the product to change, it stays on the same product.
Here's the snapshot of the reviews box at the test site: https://i.imgur.com/JegnOTQ.png
1) This is the new file created in (includes/modules/sideboxes/reviews_scrolling.php):
Code:
$review_status = " and r.status = 1 ";
$scrolling_review_sql = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name,
substring(reviews_text, 1, 70) as reviews_text
from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
. TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = r.products_id
and r.reviews_id = rd.reviews_id
and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
$review_status;
if (isset($_GET['products_id'])) {
$scrolling_review .= " and p.products_id = '" . (int)$_GET['products_id'] . "'";
}
$scrolling_review = $db->ExecuteRandomMulti($scrolling_review_sql, MAX_RANDOM_SELECT_REVIEWS);
if (!$scrolling_review->EOF) {
require($template->get_template_dir('tpl_reviews_random_scrolling.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_random_scrolling.php');
} elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
// display 'write a review' box
require($template->get_template_dir('tpl_reviews_write.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_write.php');
} else {
// display 'no reviews' box
require($template->get_template_dir('tpl_reviews_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_none.php');
}
$title = BOX_HEADING_REVIEWS_SCROLLING;
$title_link = FILENAME_REVIEWS;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
?>
2) This is the new file created in (includes/templates/template_default/sideboxes/tpl_reviews_random_scrolling.php):
Code:
$content = '<div class="sideBoxContent centeredContent">';
$review_box_counter = 0;
while (!$scrolling_review->EOF) {
$review_box_counter++;
$rs_pid = $scrolling_review->fields['products_id'];
$rs_pname = $scrolling_review->fields['products_name'];
$content .= '<br />' . $rs_pname . '</a>';
// $content .= "\n" . ' <div class="sideBoxContentItem hiddenField reviewsScroller">'; (If I un-comment this, website jumbles up)
$content .= '<div class="' . str_replace('_', '-', $box_id . 'Content') . ' sideBoxContent centeredContent">';
// $content .= '<a href="' . zen_href_link(zen_get_info_page($rs_pid), 'cPath=' . zen_get_generated_category_path_rev($scrolling_review->fields['master_categories_id']) . "&products_id=$rs_pid") . '">' . zen_image(DIR_WS_IMAGES . $scrolling_review->fields['products_image'], $rs_pname, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . nl2br(zen_trunc_string(zen_output_string_protected(stripslashes($scrolling_review->fields['reviews_text'])), 60)) . '</a><br /><br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $scrolling_review->fields['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $scrolling_review->fields['reviews_rating']));
$content .= '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $scrolling_review->fields['products_id'] . '&reviews_id=' . $scrolling_review->fields['reviews_id']) . '">' . zen_image(DIR_WS_IMAGES . $scrolling_review->fields['products_image'], $scrolling_review->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . nl2br(zen_trunc_string(zen_output_string_protected(stripslashes($scrolling_review->fields['reviews_text'])), 60)) . '</a><br /><br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $scrolling_review->fields['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $scrolling_review->fields['reviews_rating']));
$content .= '</div>';
$scrolling_review->MoveNextRandom();
}
$content .= '</div><script type="text/javascript">$("div.reviewsScroller").cycle(5000);</script>' . "\n";
3) I added this to includes/languages/english/extra_definitions/scrolling_sideboxes.php:
Code:
define('BOX_HEADING_REVIEWS_SCROLLING', 'Reviews');
Re: jQuery Scrolling Sideboxes [Support Thread]
p.s: If I set the Admin/Configuration/Maximum Value --> Random Product Reviews for SideBox to a value More than 1, the sidebox will display several reviews all at once under each other in the sidebox, not scrolling.
Re: jQuery Scrolling Sideboxes [Support Thread]
Ok woow :shocking: seems I have finally made it work after a heap of trial and error.
But I still need help with a couple of things please.
1) When you click on the review, it takes you to product page, I would like it to take the customer to that actual review page!
2) Remove some of the space showing UNDER the review stars (too much white space which is making box too long).
This is the new file created in (includes/templates/template_default/sideboxes/tpl_reviews_random_scrolling.php):
Code:
$content = '<div id="scrolling_review" class="sideBoxContent centeredContent">';
$count = 1;
while (!$scrolling_review->EOF) {
$rs_pid = $scrolling_review->fields['products_id'];
$rs_pname = $scrolling_review->fields['products_name'];
$content .= PHP_EOL . ' <div class="sideBoxContentItem hiddenField reviewsScroller">';
$content .= "$rs_pname<br /><br /></a>";
$content .= '<a href="' . zen_href_link(zen_get_info_page($rs_pid), "products_id=$rs_pid") . '">' . zen_image(DIR_WS_IMAGES . $scrolling_review->fields['products_image'], $rs_pname, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . nl2br(zen_trunc_string(zen_output_string_protected(stripslashes($scrolling_review->fields['reviews_text'])), 60)) . '</a><br /><br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $scrolling_review->fields['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $scrolling_review->fields['reviews_rating']));
$content .= '</div>';
$count++;
$scrolling_review->MoveNextRandom();
}
$content .= '</div><script type="text/javascript">$("div.reviewsScroller").cycle(5000);</script>' . "\n";
Re: jQuery Scrolling Sideboxes [Support Thread]
Ok, managed to solve one of the above queries, No. 1:
I changed the PHP code to this:
Code:
$content .= '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $scrolling_review->fields['products_id'] . '&reviews_id=' . $scrolling_review->fields['reviews_id']) . '">' . zen_image(DIR_WS_IMAGES . $scrolling_review->fields['products_image'], $rs_pname, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . nl2br(zen_trunc_string(zen_output_string_protected(stripslashes($scrolling_review->fields['reviews_text'])), 60)) . '</a><br /><br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $scrolling_review->fields['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $scrolling_review->fields['reviews_rating']));
Could still use help with the above no. 2 query, plus if there is a way to may the product name a little bigger as it seems a bit small & the below error log.
I'm also getting this ERROR Log:
--> PHP Notice: Undefined variable: scrolling_review in /02/includes/modules/sideboxes/reviews_scrolling.php on line 28.
This is Line 28:
if (isset($_GET['products_id'])) { $scrolling_review .= " and p.products_id = '" . (int)$_GET['products_id'] . "'"; }
Thank you.