Jump to content
b00

[Contribution] Recently Viewed Products(sales optimized)

Recommended Posts

Share this post


Link to post
Share on other sites

@raiwa

 

A few more things:

 

includes\modules\header_tags\ht_recently_viewed.php

 

line 50:

 

$output =   
 

recommend

 

$output = '';

 

 

Also, in file includes\modules\content\product_info\cm_pi_recently_viewed.php

 

It looks like you are referencing a variables $product_check on line 56:

 

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

Due to the variable not existing, the if statement will always be null so the lines 56 thru 83 can just be removed.

 

 

It appears that you have several configurable options (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_DESCRIPTION and others); however, when defining the array they may not exist.  I would recommend the following changes:

 

Current Lines 116 to 137

 

        $products_query .= "     from products_description pd,
                                      products p
                            left join specials s
                                 on p.products_id = s.products_id
                              where p.products_id in (" . $recently_viewed_string . ")
                                and p.products_status = '1'
                                and p.products_id = pd.products_id
                               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_name = tep_get_products_name($products['products_id']);
            $products_specials_price = tep_get_products_special_price($products_id);
            $products_data[$products_id] = array ('id' => $products_id,
                                                  'name' => $products_name,
                                                  'description' => $products['products_description'],
                                                  'image' => $products['products_image'],
                                                  'price' => $products['products_price'],
                                                  'specials_price' => $products_specials_price,
                                                  'tax_class_id' => $products['products_tax_class_id']
                                                       );
 

should be modified to:

 

        $products_query .= "     from products_description pd,
                                      products p
                              where p.products_id in (" . $recently_viewed_string . ")
                                and p.products_status = '1'
                                and p.products_id = pd.products_id
                               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_name = tep_get_products_name($products['products_id']);
            $products_data[$products_id] = array ('id' => $products_id,
                                                  'name' => $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'] = tep_get_products_special_price($products_id);
                                                  }
 

 

Note that you are joining the specials to the product query; however, you are using the tep_get_products_special_price.

 

Again, these are just recommendations.  I have only tested the product_info module and all appears to work as described with the changes I have suggested.

Share this post


Link to post
Share on other sites

For 234BS, the instructions should include to add recently_viewed.php to the Equal Height Divs Header Tag module.   I have a test product with an extremely long name and if you do not have it added, the grid view does not properly line up.  Adding file to the Equal Height Divs list solved it. 

 

Not sure if this is how it was intended to work or not. 

Share this post


Link to post
Share on other sites

 

includes\modules\header_tags\ht_recently_viewed.php

 

line 50:

 

$output =  

This can just be removed, it is left from develop and only used in the ht_recently_viewed_edit_pages function and correct defined there at line 142.

 

Also, in file includes\modules\content\product_info\cm_pi_recently_viewed.php

 

It looks like you are referencing a variables $product_check on line 56:

 

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

 

Due to the variable not existing, the if statement will always be null so the lines 56 thru 83 can just be removed.

Yes, also left from develop. All this section has been moved to the header tags module in order to get the visited products also registered if the product_info module is not used. It would work  if $product_check is added to the global list (and it was added), it is defined in product_info.php. So you are right, it can be removed.

 

 

It appears that you have several configurable options (MODULE_CONTENT_PRODUCT_INFO_RECENTLY_VIEWED_SHOW_DESCRIPTION and others); however, when defining the array they may not exist.  I would recommend the following changes:

 

Current Lines 116 to 137

 

        $products_query .= "     from products_description pd,

                                      products p

                            left join specials s

                                 on p.products_id = s.products_id

                              where p.products_id in (" . $recently_viewed_string . ")

                                and p.products_status = '1'

                                and p.products_id = pd.products_id

                               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_name = tep_get_products_name($products['products_id']);

            $products_specials_price = tep_get_products_special_price($products_id);

            $products_data[$products_id] = array ('id' => $products_id,

                                                  'name' => $products_name,

                                                  'description' => $products['products_description'],

                                                  'image' => $products['products_image'],

                                                  'price' => $products['products_price'],

                                                  'specials_price' => $products_specials_price,

                                                  'tax_class_id' => $products['products_tax_class_id']

                                                       );

 

should be modified to:

 

        $products_query .= "     from products_description pd,

                                      products p

                              where p.products_id in (" . $recently_viewed_string . ")

                                and p.products_status = '1'

                                and p.products_id = pd.products_id

                               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_name = tep_get_products_name($products['products_id']);

            $products_data[$products_id] = array ('id' => $products_id,

                                                  'name' => $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'] = tep_get_products_special_price($products_id);

                                                  }

This seems to be only a execution time issue and I'm not sure if it's faster to have some unneeded elements in the array or to execute additional if statements. I would rather leave this as is. It was also done like this in the original contribution.

 

 

Note that you are joining the specials to the product query; however, you are using the tep_get_products_special_price.

Yes, this can be removed it's left from the old version where the tep_get_products_special_price function wasn't used. The same for the index module and the box. The query would look then like this:

        $products_query .= "     from products_description pd,
                                      products p 
                              where p.products_id in (" . $recently_viewed_string . ") 
                                and p.products_status = '1' 
                                and p.products_id = pd.products_id 
                               and pd.language_id = '" . (int) $languages_id . "' 
                            ";

For 234BS, the instructions should include to add recently_viewed.php to the Equal Height Divs Header Tag module.   I have a test product with an extremely long name and if you do not have it added, the grid view does not properly line up.  Adding file to the Equal Height Divs list solved it. 

 

OK, can be added, but it is mentioned in the product info module:

Height mode

How should the height of each product box be adjusted. 'Equal Height' uses the Equal Height jquery script. Fixed Height uses the Height specified in the next field. 'None' adjusts the height depending on the content

 

 

I'll wait for your feedback and then upload the update with the fixes/changes.

 

Thank You!!

 

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Yo Rainer ( @@raiwa )

 

I haven't had a chance to test out the speed difference between the if statements and the sql query.  As I mentioned, came across an Undefined variable, $products['products_description'], and like to clean these up.  It allows for easier troubleshooting. ;)

 

While your cleaning up includes\modules\header_tags\ht_recently_viewed.php.  Doesn't look like the following used as well. 

 

lines 88 - 90

 

        if (in_array(basename($PHP_SELF), $pages_array)) {
           $oscTemplate->addBlock($output, $this->group);
        }
 

Just a question, why did you select 'footer_scripts' and not 'header_tags" for the group?

 

Also, after testing it out a little, I noticed that if you click on a product #29 then click around then go back to the product #29, the list does not reset product #29 to the front.  I played around with the code and came up with a solution.  Not sure if you are interested or would like to keep the functionality as is.

 

PS - I truly appreciate your addons.  I hope you take my suggestions as positive feedback... I figure you spent the time to contribute and that I should give back.

Edited by marcello

Share this post


Link to post
Share on other sites

Hello @@marcello,

 

 

I haven't had a chance to test out the speed difference between the if statements and the sql query.  As I mentioned, came across an Undefined variable, $products['products_description'], and like to clean these up.  It allows for easier troubleshooting. ;)

I wouldn't do changes if there is not a real important reason to do it. In the core files (index.php for product listing) and other add-ons there are also queries which retrieve all product or customer information which is not always all used.

 

 

 

While your cleaning up includes\modules\header_tags\ht_recently_viewed.php.  Doesn't look like the following used as well. 

 

lines 88 - 90

 

        if (in_array(basename($PHP_SELF), $pages_array)) {
           $oscTemplate->addBlock($output, $this->group);
        }

Yes, this is wrong placed. It should be moved to line 49:

        if (in_array(basename($PHP_SELF), $pages_array)) { // register only if page is selected

this needs to be removed as there is no output:

           $oscTemplate->addBlock($output, $this->group);

and the closing } stays where it is.

Like this the page selector can be used to exclude the reviews page. I'll add it now to have it included in the page list by default.

 

 

Just a question, why did you select 'footer_scripts' and not 'header_tags" for the group?

I thought it needs to be used at the bottom of the page, so $product_check is defined. But now I found by testing that only the output would be done in the footer or header if changing. The script is executed after the main content, so $product_check is also defined and it would work the same in the header_tag group. However, any reason for to include it in header_tags??

 

 

Also, after testing it out a little, I noticed that if you click on a product #29 then click around then go back to the product #29, the list does not reset product #29 to the front.  I played around with the code and came up with a solution.  Not sure if you are interested or would like to keep the functionality as is.

Yes, that's a good idea. I found this modification:

        		} else {
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (in_array ($products_id, $recently_viewed_array) ) {
        				$recently_viewed_string = str_replace(',' . $products_id, null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
        			}
        			$recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
        		}

Let me know what you think.

 

PS - I truly appreciate your addons.  I hope you take my suggestions as positive feedback... I figure you spent the time to contribute and that I should give back.

and I appreciate your reports ansd suggestions. However I prefer to modify working stuff only if there are errors or important reasons.

 

Thank you very much and kindest regards

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

 

I wouldn't do changes if there is not a real important reason to do it. In the core files (index.php for product listing) and other add-ons there are also queries which retrieve all product or customer information which is not always all used.

 

Completely agree.  Just as of now, products_description is added to the query based on the if statement; however, it is referenced as a established variable a few lines later.  I was just bringing attention to this. 

 

Yes, that's a good idea. I found this modification:
        		} else {
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (in_array ($products_id, $recently_viewed_array) ) {
        				$recently_viewed_string = str_replace(',' . $products_id, null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
        			}
        			$recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
        		}

Let me know what you think.

I like your method as it was more simplified than what I came up with; however, this may break the system.  If you click on product #13, it will remove any product that starts with 13.  For example, product #133 would get merged with the product before by appending #3 to the end.  The following is what I came up with.  Several more lines of code though.

 

        if ($recently_viewed_string == '') { // No other products
          $recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
        } else {
          if (strstr($recently_viewed_string,',')) {
            $recently_viewed_array = explode (',', $recently_viewed_string);
            if (!in_array ($products_id, $recently_viewed_array) ) {
              $recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
            } else {
              $recently_viewed_string = "";
              foreach($recently_viewed_array as $existing_recently_viewed) {
                if ($products_id != $existing_recently_viewed) $recently_viewed_string .= ($recently_viewed_string == '' ? '' : ',') .$existing_recently_viewed; //Add the products ID to the beginning of the variable
              }
              $recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
            }
          } else {
            $recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
          }
        }
 

Last, regarding header_tags or footer_scripts.  I didn't see any output to the catalog side so I was just curious.

Share this post


Link to post
Share on other sites

@@marcello,

 

 

I like your method as it was more simplified than what I came up with; however, this may break the system.  If you click on product #13, it will remove any product that starts with 13.  For example, product #133 would get merged with the product before by appending #3 to the end.  The following is what I came up with.  Several more lines of code though.

 

Yes, thanks you are right, and if we do this:

        				$recently_viewed_string = str_replace(',' . $products_id . ',', ',', $recently_viewed_string); // remove visited products ID and put in first place in the next step
Edited by raiwa

Share this post


Link to post
Share on other sites

@@marcello,

 

Just checked and  found that it doesn't work, if it's the last in the list it will not be found and removed, no coma behind the number.

We need to use preg_replace:

        				$recently_viewed_string = preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step

Share this post


Link to post
Share on other sites

Completely agree.  Just as of now, products_description is added to the query based on the if statement; however, it is referenced as a established variable a few lines later.  I was just bringing attention to this.

 I was blind and didn't see it. Ok, it's not coherent, I'll change it.

Share this post


Link to post
Share on other sites

@@marcello,

 

Final code used in 3.2r4 to place the most recent product first when visited again and avoid duplicate entries for all cases is this:

includes/modules/header_tags/ht_recently_viewed.php lines 69-82:

        		// We only want a product to display once, so check that the product is not already in the session variable
        		$products_id = (int) $_GET['products_id'];
        		if ($recently_viewed_string == '') { // No other products
        			$recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
        		} else {
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (in_array ($products_id, $recently_viewed_array) ) {
        				$recently_viewed_string = preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
        			}
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (!in_array ($products_id, $recently_viewed_array) ) { //Check if the products ID is already at the beginning of the variable
        				$recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
        			}
        		}

Share this post


Link to post
Share on other sites

@raiwa

 

Hey Rainer.  Had me a crazy past several days.  I took a look at your code and think it works well.  Take a look at the following.  It works well and a few less lines of code. ;)

 

                // We only want a product to display once, so check that the product is not already in the session variable
                $products_id = (int) $_GET['products_id'];
                if ($recently_viewed_string == '') { // No other products
                    $recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
                } else {
                    $recently_viewed_array = explode (',', $recently_viewed_string);
                    if (in_array ($products_id, $recently_viewed_array) ) {
                        $recently_viewed_string = $products_id . ',' . preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
                    } else {
                        $recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
                    }
                }
 

 

PS:  I like the logic of the above code as the if statements make it pretty easy to follow; however, if you wanted you can always just run the preg_replace and save a few more lines.  Take a look:

 

                // We only want a product to display once, so check that the product is not already in the session variable
                $products_id = (int) $_GET['products_id'];
                if ($recently_viewed_string == '') { // No other products
                    $recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
                } else {
                    $recently_viewed_string = $products_id . ',' . preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
                }
 

Edited by marcello

Share this post


Link to post
Share on other sites

@raiwa

 

I found that if you clicked on the same product or refreshed the screen while on a product it would duplicate the item in the list. The preg didn't address if the item was already at the front of the list. 

 

                // We only want a product to display once, so check that the product is not already in the session variable
                $products_id = (int) $_GET['products_id'];
                if ($recently_viewed_string == '') { // No other products
                    $recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
                } elseif ($recently_viewed_string != $products_id) {
                    $recently_viewed_string = $products_id . ',' . preg_replace('%\b' . $products_id . ',\b%', null, preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string)); // remove visited products ID and put in first place in the next step
                }
 

I'm sure you can come up with a more efficient way of handling the preg_replace.

Share this post


Link to post
Share on other sites

@@marcello,

 

I checked several times and the last version which is used in 3.2r4 works for me and doesn't produce duplicate entries if the actual product is in first place:

        		// We only want a product to display once, so check that the product is not already in the session variable
        		$products_id = (int) $_GET['products_id'];
        		if ($recently_viewed_string == '') { // No other products
        			$recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
        		} else {
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (in_array ($products_id, $recently_viewed_array) ) {
        				$recently_viewed_string = preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
        			}
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (!in_array ($products_id, $recently_viewed_array) ) { //Check if the products ID is already at the beginning of the variable
        				$recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
        			}
        		}

Share this post


Link to post
Share on other sites

@raiwa

 

My apologies that I wasn't clear.  It was the initial code :poop:  I posted yesterday that caused the double entry issue.  The code you posted is clean :thumbsup:  as is my last posted code.  No need to change anything.  I was just attempting to reduce the lines of code.

 

 

 

@@marcello,

 

I checked several times and the last version which is used in 3.2r4 works for me and doesn't produce duplicate entries if the actual product is in first place:

        		// We only want a product to display once, so check that the product is not already in the session variable
        		$products_id = (int) $_GET['products_id'];
        		if ($recently_viewed_string == '') { // No other products
        			$recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
        		} else {
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (in_array ($products_id, $recently_viewed_array) ) {
        				$recently_viewed_string = preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string); // remove visited products ID and put in first place in the next step
        			}
        			$recently_viewed_array = explode (',', $recently_viewed_string);
        			if (!in_array ($products_id, $recently_viewed_array) ) { //Check if the products ID is already at the beginning of the variable
        				$recently_viewed_string = $products_id . ',' . $recently_viewed_string; //Add the products ID to the beginning of the variable
        			}
        		}

and

 

@raiwa

 

I found that if you clicked on the same product or refreshed the screen while on a product it would duplicate the item in the list. The preg didn't address if the item was already at the front of the list. 

 

                // We only want a product to display once, so check that the product is not already in the session variable
                $products_id = (int) $_GET['products_id'];
                if ($recently_viewed_string == '') { // No other products
                    $recently_viewed_string = (string) $products_id; // So set the variable to the current products ID
                } elseif ($recently_viewed_string != $products_id) {
                    $recently_viewed_string = $products_id . ',' . preg_replace('%\b' . $products_id . ',\b%', null, preg_replace('%\b,' . $products_id . '\b%', null, $recently_viewed_string)); // remove visited products ID and put in first place in the next step
                }
 

I'm sure you can come up with a more efficient way of handling the preg_replace.

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

I was working on my site and noticed that the addon does not display at the category levels and only on the default index page.  Again, this may be the original intent and I do not mean to overstep; however, I wanted to be able to display the recently viewed to the customer if they ventured off and started browsing from the category tree.

 

 

*********************************************************************************************************************
STEP 3 - Edit the following modified file

If you do not have yet included the content module call in your index.php:
In: [catalog/]index.php

Find:
  <div class="alert alert-info">
    <?php echo tep_customer_greeting(); ?>
  </div>

Add below:
 
  <div class="row">
    <?php echo $oscTemplate->getContent('index'); ?>
  </div>
 

 

Maybe add the following so it will output at the category levels as well

 

 

*********************************************************************************************************************
STEP 3b - Edit the following modified file

If you do not have yet included the content module call in your index.php:
In: [catalog/]index.php

Find:

</div>

<?php
  } else { // default page
?>

Add before:
 
  <div class="row">
    <?php echo $oscTemplate->getContent('index'); ?>
  </div>
 

Share this post


Link to post
Share on other sites

Please note that doing as I mentioned above does cause the size of the boxes to change throughout the page.  This is due to the equal-height.  If this is something that is worth pursuing, there are several other changes that would allow for the more consistent view depending on page.  This has to do with the <hr> and the View/Buy button. 

Share this post


Link to post
Share on other sites

@@marcello,

 

Thank You, I'll have a look on this when I have som time.

Share this post


Link to post
Share on other sites

Thanks to @@douglaswalker for spotting this.  http://forums.oscommerce.com/topic/408310-adding-font-awesome-icon-to-buy-now-code/?p=1733685

tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'cPath'))

change 'cart' to 'fa fa-shopping-cart'

tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'fa fa-shopping-cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'cPath'))

Share this post


Link to post
Share on other sites

In my implementation I had wanted recently_viewed.php products sorting to reflect recently view so I had made a change to the sort order as such...i hope you may find it useful...

      case 'PRODUCT_LIST_ID':
        $listing_sql .= " order by field(p.products_id," . $recently_viewed_string . ") " . ($sort_order == 'd' ? 'desc' : '');
        //$listing_sql .= " order by p.products_id " . ($sort_order == 'd' ? 'desc' : '');
        break;


 

Share this post


Link to post
Share on other sites

I was working on my site and noticed that the addon does not display at the category levels and only on the default index page.  Again, this may be the original intent and I do not mean to overstep; however, I wanted to be able to display the recently viewed to the customer if they ventured off and started browsing from the category tree.

 

 

Maybe add the following so it will output at the category levels as well

 

@@marcello,

 

v3.2r5 Update is uploaded and I also included the mod for output on product level.

Edited by raiwa

Share this post


Link to post
Share on other sites

Hi Rainer

 

I suspect I may have "stuffed up".

When I update using the latest version, it still shows that the installed module is

"Current Version
3.2r3 BS" on the installed modules

 

Also

 

Show the product price
True

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


Show the product MORE button
True

 

Just wondering if perhaps I have some "old" code somewhere which I havent removed at some stage during uypdates.

 

Any comments would be appreciated.

 

Cheers

 

Grandpa

Share this post


Link to post
Share on other sites

@grandpaj

Hi Rainer

 

Regarding the above post. I should have mentioned that

 

Show the product price
True

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

Show the product MORE button
True

 

Is from the modules>contente>recently viewed page

 

Cheers

Grandpa

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

×