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

[Contribution] Recently Viewed Products(sales optimized)

Recommended Posts

Hello John @@grandpaj,

 

There is no "modules>contente>recently viewed page" module.

There are:

modules>content>index>cm_i_recently_viewed.php

modules>content>product_info>cm_pi_recently_viewed.php

 

I suppose you refer to these. IThe version reference is ok like this, I didn't update them in the modules since there is no change in these modules since version 3.2r3.

 

For the button configuration: It seems you didn't uninstall the modules when you updated from 3.2r2 to 3.2r3.

Please follow the update instructions in the Update.txt file: Update 3.2r2 to 3.2r3
 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

Hi Rainer

 

Many thanks, but I think I must have broken things, as Ive tried as you suggested, but no change.

Whats the best way to uninstall everything and start again.

Ive tried uninstall the modules, then uninstalling the files and deleting as many of the SQL files I could find. Then reinstalling the updated addon again. But alas still no  

Show the VIEW and BUY buttons
True  (doesn't show as an option, just doesn't appear)  

 

Many thanks

 

Cheers

Grandpa 

Share this post


Link to post
Share on other sites

@@grandpaj,

 

1. uninstall all modules

 

2. search in your database in the configuration table for:

 

configuration_key         LIKE%...%           RECENTLY_VIEWED

 

3. Delete all entries which are found

 

4. Install all modules again

Share this post


Link to post
Share on other sites

@@marcello @@raiwa

 

 

 

@raiwa

 

I was analyzing the sql queries on my dev site and noticed that the code initiates two queries for the name and special price.  I'm still using the IF statements from earlier; however, please feel free to use the following as a suggestion.  As a query is already being made to get the product info, adding the following to obtain the name and speical price is pretty seamless and reduces db queries.

        // Retrieve the data on the products in the recently viewed list and load into an array by products_id
        $products_data = array();
    
      	$products_query = "select ";
      	$specials_query = '';
      		
        if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_DESCRIPTION == 'True')
        	$products_query .= "pd.products_description,";
        
        if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_IMAGE == 'True')
          $products_query .= "p.products_image,";
                                       
        if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_PRICE == 'True') {
        	$products_query .= "p.products_tax_class_id,p.products_price,IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,";
        	$specials_query = " left join specials s on s.products_id = p.products_id ";
      	}

      	$products_query .= "pd.products_name,p.products_id";
        
        $products_query .= " from products p
                              left join products_description pd on pd.products_id = p.products_id"
                              . $specials_query . "
                              where p.products_id in (" . $recently_viewed_string . ") 
                              and p.products_status = '1' 
                              and pd.language_id = '" . (int) $languages_id . "' 
                            ";
        $products_query = tep_db_query($products_query);                            
        while ($products = tep_db_fetch_array ($products_query) ) {
        	$products_id = $products['products_id'];
        	$products_data[$products_id] = array ('id' => $products_id,
                                              	'name' => $products['products_name']
                                           			);
                                              	if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_DESCRIPTION == 'True')
                                              	  $products_data[$products_id]['description'] = $products['products_description'];
												
                                              	if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_IMAGE == 'True')
                                              	  $products_data[$products_id]['image'] = $products['products_image'];
																			   
                                              	if (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_PRICE == 'True') {
                                              	  $products_data[$products_id]['tax_class_id'] = $products['products_tax_class_id'];
                                              	  $products_data[$products_id]['price'] = $products['products_price'];
                                              	  $products_data[$products_id]['specials_price'] = $products['specials_new_products_price'];
                                              	}

        } //while ($products

 

In what file and where to add this code? I want to reduce the queries also because with each viewed product 2 or 3 queries are added.

 

Thanks. It gives a boost to user experience.

Share this post


Link to post
Share on other sites

@@discxpress,

 

the example posted by @@marcello is for the product_info module.

You need to change the configuration constants at the beginning of the snippet from:

MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_PRICE

to the constants of each module:

Example index module:

MODULE_CONTENT_INDEX_RECENTLY_VIEWED_SHOW_PRICE

 

I'll have soon a deeper look on this and decide if I include it in the next update, not sure yet, the core modules also use the tep_get_products_name and tep_get_products_special_price functions instead to include it in the main query.

 

Example bm_whats_new box:

      if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
        $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
        $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

For some reason these functions were created and included in the core.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi

 

Just a thought, or maybe Ive missed something but on the product info page I have it set to only show 6 items (althought more may have been viewed).

Is there a "Show More" button supposed to show as it does on the index page.

 

Cheers

 

Grandpa

Share this post


Link to post
Share on other sites

Hola Rainer,

 

 

sipppp me again. 

I installed this few days ago and seems to work well. Today I decide to unable the modules and to use only the box.

Seems to work like a charm.

In Opera, K-Meleon & Firefox the appearence is different, but most big issue is no that there is NO review box appears in Chrome or Safari.

IE I cannot checked as I dont use or have that garbage.

 

It's the only addon of my site that display/appears different in the different browsers.

 

With only the modules it is igual in all browsers, but box not

 

saludos

Share this post


Link to post
Share on other sites

@@SpicyGirl,

 

I just checked, it looks the same to me like other boxes in all browsers. Reviews box is also showing.

You can check on my demo store:

http://www.sarplataygemas.com/osCommerce234bs/

 

Maybe you messed something up by css changes.

 

rgds Rainer

 

PS: It's always good to add screenshots for these cases, just to see what you are referring to.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa,

 

ok i understand, i messed up, like always.

so one css edit wrong and some browsers cannot read it while others do it whithout problems?

 

saludos

Share this post


Link to post
Share on other sites

Hola Rainer,

 

 

me again  :) .

When clicking on the more button it redirects 2 recently_viewed.php.

Products are there in List form, when clicking on the grid button goes to catalog/# and that is the new products page??

 

Also have HEADING_TITLE & NAVBAR_TITLE.

Have this in english & spanish, even that the spanish php file in includes/languages is modified with the spanish text

 

BTW ; 

Current Version

Version info. It is read only.

Version 3.3 BS

Enable Reviews Module
Should the recently_viewed block be shown on the product info page?

Edited by SpicyGirl

Share this post


Link to post
Share on other sites

@@raiwa - had a little problem come up, when i enabled the show product description, the layout of the rest of the website went  all over the place. after looking into the code i found it was cutting off a html tag, and of course a tag may not get closed due to it being after the cutoff. so i managed to fix it by on line 191 in cm_i_recently_viewed (line 173 FOR THE PRODUCT INFO PAGE VERSION) i wrapped 

$products_data[$products_id]['description'] 

within 

strip_tags()

Share this post


Link to post
Share on other sites

Hello Craig @@puddlec,

 

Just to let you know, I prepared the next version with this variant:

          	$products_data[$products_id]['description'] = strip_tags($products['products_description'], '<br>');

Like this at least linebreaks will keep in place and its also done like this in the core product_listing.php module.

 

regards

Rainer

Share this post


Link to post
Share on other sites

Hi Rainer,

 

Just installed this module in a two, or three days old 2.3.4 BS EDGE Shop. Installation was easy, but now I noticed that the order of the products is not the same as I visit them. Where can I change the sort order ? BTW I noticed the same behavior in your demoshop...  :wacko:

Thank you for helping !

 

SEE YA

Denzel.

Share this post


Link to post
Share on other sites

Ok, this morning Ive changed the "Show the current product" Switch to True and now it does what I want it to do :D 

Everything is fine :thumbsup: 

 

SEE YA

Denzel.

Share this post


Link to post
Share on other sites

Hi Rainer,

 

Now, after a few days adding contribs to my shop, all the boxes has stopped to work. nothing is displayed :wacko: 

I think  the $_SESSION['recently_viewed'] is not set. Ive tried a debug output like this:

 

if (tep_session_is_registered ('recently_viewed') && strlen ($_SESSION['recently_viewed']) > 0) {  

 

...

 

} else { $oscTemplate->addBlock('123'.$_SESSION['recently_viewed'], $this->group); }

 

in bm_recently_viewed. The 123 appears, but nothing else. The headertag module is installed...

Is there a known intolerance against any of these contribs:

 

Previous - Next - With detailed info   2016-06-21     Wishlist BS   2016-06-21     Modular Shopping Cart BS   2016-06-23     Ship In Cart BS reloaded   2016-06-23     Latest News Rotator Multilingual 1.0 BS   2016-06-23     dashboard whos online history   2016-06-23     Who's Online Dashboard   2016-06-23     Invoice Editor 1.0   2016-06-26     Run SQL Script from Admin v1.2 for osCommerce 2.3.x   2016-06-27     Ask a Product Question 1.0 for 2.3   2016-06-28     Admin Notes   2016-06-29     Common Product Notes for osCommerce 2.3   2016-06-29    
 
Thank you for helping  B)
SEE YA
Denzel.

Share this post


Link to post
Share on other sites

Hello Dennis @@Denzel,

 

There is no known incompatibility for other add-ons.

I'm using the following together with recently viewed:

  Modular Shopping Cart BS   2016-06-23     Ship In Cart BS reloaded   2016-06-23    Ask a Product Question 1.0 for and have no problems.

All other is not test by myself, but also didn't get any report for problems.

Could you do testing switch on off the other add.ons one by one to find out which combination produces the problem. I'll then could try to recreate the error (if it's really related to recently viewed).

 

regards

Rainer

Share this post


Link to post
Share on other sites

Hi Rainer,

 

I found, that the   if ($product_check['total'] > 0) { //We don't want to add products that don't exist/are not available

query in ht_recently_viewed.php prevents the display of the box. Seems that this is an issue of the

Modular Product Page http://addons.oscommerce.com/info/9453 which I have missed to add to my list... :angry:

 

I have commented out the if query and everthing goes... But what is the replacement ? 

Maybe its: if (true = $product->product_exists()) {

I didnt have tested it...

 

SEE YA

Denzel.

Edited by Denzel

Share this post


Link to post
Share on other sites

Ok, I got it... I had to change

 

if ($product_check['total'] > 0) { //We don't want to add products that don't exist/are not available

 

to

 

if (isset($product_info) && $product_info->product_exists() === true) { //We don't want to add products that don't exist/are not available
 

and 

 

      global $oscTemplate, $PHP_SELF, $_SESSION, $recently_viewed_string, $product_check;
 
to
 
      global $oscTemplate, $PHP_SELF, $_SESSION, $recently_viewed_string, $product_info;
 
in ht_recently_viewed.php. Now the Box is displayed but missing articles would not added to the session.  :thumbsup: 
 
SEE YA
Denzel.
 

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

×