Jump to content
Latest News: (loading..)
b00

[Contribution] Recently Viewed Products(sales optimized)

Recommended Posts

Hello,

I have your most recent version installed on Frozen and get this error with php 7.2 :

Warning: count(): Parameter must be an array or an object that implements Countable in /xxx/xx/xx/xx/catalog/includes/modules/content/shopping_cart/cm_sc_continue_recently_viewed.php on line 66
Line 65-69 are:

           $back = sizeof($navigation->path)-2;
            $count = count($products);
            if( isset($products[$count-1]['id']) ) {
                $continueButtonId = tep_get_product_path(str_replace(strstr($products[$count-1]['id'], '{'), '', $products[$count-1]['id']));
            }

Any ideas would be greatly appreciated.

Barbara

Share this post


Link to post
Share on other sites

Updated with the above PHP 7.2 warning error fix:

 Version 4.6.2 BS

                Changes:        
         - Fixed PHP 7.2 warning error in cm_sc_continue_recently_viewed.php shopping cart module. Thanks to @lucsangel for the report

https://apps.oscommerce.com/z7iA8&recently-viewed-products-bs

Share this post


Link to post
Share on other sites

hi Rainer,

This is a small modification to this addon for anyone who wants to use it,.. and if you see value in it, you could add it to an update release.

The mod is designed to only show the “See More” button if the number of recently viewed products exceeds the content limit of recently viewed products for each module.

For example: if a customer viewed 4 or less products and the content limit is set to 4 recently viewed products, then it does not makes sense to have them see and click on a "See More" button that takes them to a Recently Viewed Products page containing the same 4 or less products that were listed on whatever page they were on.

So, here are the changes and I’m only going to use the product_info page Recently Viewed module in this sample. This works in BS Edge.

/includes/modules/content/index/cm_i_recently_viewed.php

1)      FIND this code:

        // Set up the product data string in order by $recently_viewed_array
        if ($num_products > 0) { // Show only if we still have products in the array

ADD just ABOVE it:

        // this will show/hide the "See More" button
        $rv_btn = 'style="display:none;"';
        $rv_number_viewed = substr_count($recently_viewed_string, ",") + 1; 
        if ($rv_number_viewed > MODULE_CONTENT_INDEX_RECENTLY_VIEWED_CONTENT_LIMIT) {
            $rv_btn = 'style="display:inline;"';
        }

 

2)      FIND this code:

        	$recently_viewed_content .= '<h3 class="h3"><span itemprop="name">' . MODULE_CONTENT_INDEX_RECENTLY_VIEWED_TITLE . '</span>' . ((MODULE_CONTENT_INDEX_RECENTLY_VIEWED_SHOW_MORE_BUTTON == 'True')? '  <a href="' . tep_href_link('recently_viewed.php') . '" class="btn btn-default btn-sm">' . MODULE_CONTENT_INDEX_RECENTLY_VIEWED_IMAGE_BUTTON_SEE_MORE . '  <span class="fa fa-angle-right"></span></a>' : '' ) . '</h3>';

REPLACE it with this:

        	$recently_viewed_content .= '<h3><span itemprop="name">' . MODULE_CONTENT_INDEX_RECENTLY_VIEWED_TITLE . '</span>' . ((MODULE_CONTENT_INDEX_RECENTLY_VIEWED_SHOW_MORE_BUTTON == 'True')? '&nbsp;&nbsp;<span ' . $rv_btn . '>' . tep_draw_button(MODULE_CONTENT_INDEX_RECENTLY_VIEWED_IMAGE_BUTTON_SEE_MORE, 'glyphicon glyphicon-triangle-right', tep_href_link('recently_viewed.php'), 'primary', null, 'btn-default btn-sm') . '</span>':'') . '</h3>';

 

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

×