Jump to content
b00

[Contribution] Recently Viewed Products(sales optimized)

Recommended Posts

Thanks a lot, everything is running smoothly now.

 

You're the best!

Share this post


Link to post
Share on other sites

Sadly I ran into a new problem, in includes/modules/recently_viewed.php there is no VAT applied to the prices. In catalog/recently_viewed is't allright.

Share this post


Link to post
Share on other sites

Both pages use $currencies->display_price to format the price with tax. I'm at a loss to explain why one would work and the other not.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Dale-

 

I'm using Oscmax and I managed to get this contribution to work. It's complicated to explain but I've posted a detailed set of instructions on how to convert non-BTS contribs to BTS here: http://oscommerce-tips.blogspot.com/ -- hope it helps resolve your issues.

 

If anyone knows of another appropriate place for me to post these instructions (a bit long..) please let me know and I will do so. I've tried replying to your question in the Oscmax forums but for some reason it didn't come through..

Share this post


Link to post
Share on other sites

Thanks for this great contribution :rolleyes:

Sorry for my poor english, i'm french.

I'm using a sold out button when the quantity of products is 0.

In the recently viewed page, all products can be added to the cart by the customer, I would like to add the "sold out" instead of the button "buy" when the quantity of product = 0.

I am not a programmer, I think having to put this code (or something like that) on the page, but I do not know where and how:

	if($product_info['products_quantity'] <= 0 || $product_info['products_status']==0) 
echo tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT);

Thanks for all

Best regards

Share this post


Link to post
Share on other sites

PHP 5.3 deprecated function ereg_replace()

 

Just working my way through PHP 5.3 locally and came across a the need to replace ereg_replace() with preg_replace(). In order to fix the deprecated function, navigate to:

 

*catalog*/includes/functions/general.php and find this block of code:

 function tep_limit_text ($text, $maxchar, $wordlength = 40) {
   $text = str_replace ("\n", ' ', $text);
   $text = str_replace ("\r", ' ', $text);
   $text = str_replace ('<br />', ' ', $text);
   $text = wordwrap ($text, $wordlength, ' ', true);
   $text = ereg_replace ("[ ]+", ' ', $text);
   $text_length = strlen ($text);
   $text_array = explode (" ", $text);

 

And change to:

 function tep_limit_text ($text, $maxchar, $wordlength = 40) {
   $text = str_replace ("\n", ' ', $text);
   $text = str_replace ("\r", ' ', $text);
   $text = str_replace ('<br />', ' ', $text);
   $text = wordwrap ($text, $wordlength, ' ', true);
   $text = preg_replace ("/[ ]+/", ' ', $text);
   $text_length = strlen ($text);
   $text_array = explode (" ", $text);

 

This will fix a notice in your column_left/column_right.php

 

James

Share this post


Link to post
Share on other sites

okay my English is not perfectly I tries it again. This function installed.

 

1.I have only a Link

"Recently Viewed Products" - right above

 

2.On Link I receive text to Click

 

There aren't any recently-viewed products to display for you right now.

 

This page keeps track of the most recent products you've looked at. You can come back to this list to find items you're interested in after you've browsed through our product selection.

 

3. Where are the products which I saw? Is missing somewhat?

 

Dear Jim,

 

After reading through all posting here, I noticed that I have a similar problem with scouti, I add the code below:

 

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 

However, after adding that, there is still no changes happen in my website. I have set my setting in Administration to all true. Is it maybe because of version that I am using at the moment? I'm still using the 2.2 MS2 (060817) + buySAFE version.

 

Hope to have good advise from you as this contribution is very good to attract customer to my e-business.

 

Thank you.

Share this post


Link to post
Share on other sites

Dear Jim,

 

After reading through all posting here, I noticed that I have a similar problem with scouti, I add the code below:

 

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 

However, after adding that, there is still no changes happen in my website. I have set my setting in Administration to all true. Is it maybe because of version that I am using at the moment? I'm still using the 2.2 MS2 (060817) + buySAFE version.

 

Hope to have good advise from you as this contribution is very good to attract customer to my e-business.

 

Thank you.

 

Anyone can help me with this contribution. I have checked the distribution script and I believe I have install it correctly.

 

Thank you.

Share this post


Link to post
Share on other sites

Anyone can help me with this contribution. I have checked the distribution script and I believe I have install it correctly.

 

Thank you.

 

Hi all, anyone have similar problem like me in installing the version 2.0 contribution. Would like to know how you solved the problem like mine?

 

The problem is there is no recently viewed box at the bottom and in the right column. I have checked in the adminstator/configuration/recently viewed and set all to true.

 

there is a link to recently_viewed.php at the upper of my column right box. However, after clicked at few products and went to see the product that I seen before, it only shows

 

There aren't any recently-viewed products to display for you right now.

 

This page keeps track of the most recent products you've looked at. You can come back to this list to find items you're interested in after you've browsed through our product selection.

 

 

Currently I am using the oscommerce version 2.2 MS2 and I'm using the version 2.0 contribution.

 

Hope you don't mind share with me how you solved the problem as I really have no idea where to start now.

 

Thank you.

Share this post


Link to post
Share on other sites

Is there a maner to add checkboxes in the product listing and the sse the selection in the recently viewed page. Some like a comparision checkboxes.

 

There is other contribution for the same , except thats for the shoping.

ref:
Add Multi Products Checkbox 1.0 (March 24, 2005)

This Add Multi Products Checkbox Contribution adds a checkbox in your products listing behind every product.

You can simply check multiple products at once and add them to the Cart with one click.

 

 

I have trying to integrate one comparsison contrib and im fighting with these (modding them).

Product Specifications

Whislist V3 (adding more columns)

Recently Viewed

Share this post


Link to post
Share on other sites

Thanks for this great contribution :rolleyes:

Sorry for my poor english, i'm french.

I'm using a sold out button when the quantity of products is 0.

In the recently viewed page, all products can be added to the cart by the customer, I would like to add the "sold out" instead of the button "buy" when the quantity of product = 0.

I am not a programmer, I think having to put this code (or something like that) on the page, but I do not know where and how:

	if($product_info['products_quantity'] <= 0 || $product_info['products_status']==0) 
echo tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT);

Thanks for all

Best regards

Share this post


Link to post
Share on other sites

No answer, I found the solution for those who use this contrubution with sold out button.

In catalog/recently_viewed.php

 

Find:

 

$products_query_raw = "select m.manufacturers_name,rv.rec_v_id, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added,pd.products_description from " . TABLE_PRODUCTS . " p, recently_view as rv, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id where p.products_id in (" . $prod_viewed . ") and p.products_status = '1' and p.products_id = rv.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by rv.rec_v_id";

 

Replace with:

 

$products_query_raw = "select m.manufacturers_name,rv.rec_v_id, p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added,pd.products_description from " . TABLE_PRODUCTS . " p, recently_view as rv, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id where p.products_id in (" . $prod_viewed . ") and p.products_status = '1' and p.products_id = rv.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by rv.rec_v_id";

 

 

Find:

 

<?php echo TEXT_MANUFACTURER . '<br>' . $products['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . '<b>' . $products_price . '</b><br><br>' . '  ' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '</a>' . tep_draw_form('buy_now' . $products['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']), 'POST') . '<span align="right" >' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'align="absbottom"') . '</span></form> ' . '</a>'; ?>

 

 

Replace with:

 

<?php echo TEXT_MANUFACTURER . '<br>' . $products['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . '<b>' . $products_price . '</b><br><br>' . '  ' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '</a>'; ?>

 

<?php // Begin Sold Out

If ($products['products_quantity']>0) {

echo tep_draw_form('buy_now' . $products['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']), 'POST') . '<span align="right" >' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'align="absbottom"') . '</span></form> ' . '</a>';

} else {

echo tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT,'align="absbottom"') . '</form> ' . '</a>';

 

}

// End Sold Out-->

 

 

Find:

 

<?php echo TEXT_PRICE . ' ' . '<b>' . $products_price . '</b><br><br><br>' . '  ' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '</a>' . tep_draw_form('buy_now' . $products['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']), 'POST') . '<span align="right" >' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'align="absbottom"') . '</span></form> ' . '</a>'; ?>

 

 

Replace with:

 

<?php echo TEXT_PRICE . ' ' . '<b>' . $products_price . '</b><br><br><br>' . '  ' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, 'products_id=' . $products['products_id']) . '">' . '</a>'; ?>

 

<?php // Begin Sold Out

If ($products['products_quantity']>0) {

echo tep_draw_form('buy_now' . $products['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']), 'POST') . '<span align="right" >' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'align="absbottom"') . '</span></form> ' . '</a>';

 

} else {

echo tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT,'align="absbottom"') . '</form> ' . '</a>';

}

 

// End Sold Out-->

 

 

Everything is ok for me. This prevents purchases on this page when stock = 0.

I hope that this will help someone, the code is not terrible but it works.

Share this post


Link to post
Share on other sites

I have installed this only aw a module (under also purchaced) and i am using graphical borders ! I have a curious problem . When recently viewed box is empty it meses up my design !! When i view a product its ok . my code is

 

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>
       </td>
     </tr>
  <?php
// Begin recently_viewed
 if (RECENTLY_VIEWED_BOTTOM_BOX == 'True') {
   include_once (DIR_WS_MODULES . FILENAME_RECENTLY_VIEWED);
 }
// End recently_viewed
?>

   </table></form></td>
<!-- body_text_eof //-->

 

 

to solve that i had to change the order of recently viewed ans also purchaced

 

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
 <?php
// Begin recently_viewed
 if (RECENTLY_VIEWED_BOTTOM_BOX == 'True') {
   include_once (DIR_WS_MODULES . FILENAME_RECENTLY_VIEWED);
 }
// End recently_viewed

?>
       </td>
     </tr><tr><td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?></td></tr>

   </table></form></td>
<!-- body_text_eof //-->

 

I really do not understand why the empty recently_viewed module appears and why the fix is only working when I have first the recently_viewed and THEN the also_purchaced modules!!

Share this post


Link to post
Share on other sites

Your fix introduces some incorrect HTML. The Recently Viewed box contains its own table row and cell tags, and you've enclosed those in another set of row and cell tags. I have no idea why that would work and the original would not. Have you made changes to catalog/includes/modules/recently_viewed.php, or to any of the stock osCommerce files that would affect this?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Sorry for that . As I said I am using Graphical Borders and I have made some changes to the module to look like graphical borders BUT i dont seem to be doing a great job . it works for my needs but it may not for everybody .

 

If someone can make the module look like and work as in Graphical borders he/she will be welcome !!!

 

Ps nothing to do with product_info . the includes/modules/recently_viewed.php needs to be changed !

Share this post


Link to post
Share on other sites

I have built several sites using Graphical Borders and Recently Viewed, but all of them use the side column box instead of the module. It should be possible to modify the module using the same code as other modules, I just haven't done it.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi All

 

Excellent contribution

 

Everything is working fine on my site apart from the fact that I get thie error message in the product pages.

 

Warning: include_once(includes/modules/recently_viewed.php) [function.include-once]: failed to open stream: No such file or directory in /home/streetan/public_html/catalog/product_info.php on line 275

 

Warning: include_once() [function.include]: Failed opening 'includes/modules/recently_viewed.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/streetan/public_html/catalog/product_info.php on line 275

 

All other pages are fine

 

Can someone tells me what it means :( ? And how to fix it :thumbsup: because i dont have a clue about php

Share this post


Link to post
Share on other sites

It means that you didn't upload includes/modules/recently_viewed.php. Read the instructions again.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

It means that you didn't upload includes/modules/recently_viewed.php. Read the instructions again.

 

Regards

Jim

Hello Jim :thumbsup:

 

All sorted!

 

The instructions I have don't mention "modules" anywhere.

Edited by RMD27

Share this post


Link to post
Share on other sites

Version 2.0 has the correct instructions. I'm not responsible for any of the later uploads. I probably need to go fix this Addon again.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

PHP 5.3 deprecated function ereg_replace()

 

Just working my way through PHP 5.3 locally and came across a the need to replace ereg_replace() with preg_replace(). In order to fix the deprecated function, navigate to:

 

*catalog*/includes/functions/general.php and find this block of code:

 function tep_limit_text ($text, $maxchar, $wordlength = 40) {
   $text = str_replace ("\n", ' ', $text);
   $text = str_replace ("\r", ' ', $text);
   $text = str_replace ('<br />', ' ', $text);
   $text = wordwrap ($text, $wordlength, ' ', true);
   $text = ereg_replace ("[ ]+", ' ', $text);
   $text_length = strlen ($text);
   $text_array = explode (" ", $text);

 

And change to:

 function tep_limit_text ($text, $maxchar, $wordlength = 40) {
   $text = str_replace ("\n", ' ', $text);
   $text = str_replace ("\r", ' ', $text);
   $text = str_replace ('<br />', ' ', $text);
   $text = wordwrap ($text, $wordlength, ' ', true);
   $text = preg_replace ("/[ ]+/", ' ', $text);
   $text_length = strlen ($text);
   $text_array = explode (" ", $text);

 

This will fix a notice in your column_left/column_right.php

 

James

 

Are there other issues w/ using this and php5? I installed this contribution last week and have not been able to get it to work.

Share this post


Link to post
Share on other sites

Dear Jim,

 

After reading through all posting here, I noticed that I have a similar problem with scouti, I add the code below:

 

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 

However, after adding that, there is still no changes happen in my website. I have set my setting in Administration to all true. Is it maybe because of version that I am using at the moment? I'm still using the 2.2 MS2 (060817) + buySAFE version.

 

Hope to have good advise from you as this contribution is very good to attract customer to my e-business.

 

Thank you.

 

Have you had any success? I have installed this week and cannot display products.

Share this post


Link to post
Share on other sites

This addon is designed to work with osC 2.2RC2a. I suggest that you upgrade to that version before attempting to install Recently Viewed.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I will describe the problem the best I can. I have successfully installed Recently Viewed 2.0, all seems to be working well for the most part, however, while viewing the site, not logged in, sometimes the recently view box will disappear when clicking on products, and/or it will not record all products viewed, this only seems to occur when a user is not logged in. If a user is logged in, everything functions normally it seems... My products_info.php is cached, to less server load. Any one have a similar problem, or know a fix for this?

Share this post


Link to post
Share on other sites

The Recently Viewed Addon uses a session variable to store data. The box will disappear if session is lost. This is a serious problem with your store, since the customer's cart will also be lost if session is lost. Try adding something to the cart, without logging in, and see if the cart box disappears at the same time as the Recently Viewed box. If it does, the problem is loss of session. The usual cause of this is links that do not carry session, i.e. links that are not made with the osC tep_href_link() function.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

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

×