Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recently Viewed Products


Guest

Recommended Posts

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

Hi Amanda,

 

very nice contribution, remebers me of Ebay or Amazon ..

 

Anyway, I had to change "tep_image_dyn" to "tep_image" as well as change your image path to "DIR_WS_IMAGES", and also I had to upload 2 grafics you didn't give us :-"

 

Still, it is a nice contribution and very professional.

 

But I have 2 questions:

 

+ Why isn't the stylesheet working for the Viewed Product? I mean the font is MUCH bigger then the size of the site, plus the links have other colors ect... it lloks like it isn't refering to my stylesheet.css ?

 

 

+ Second question, how do I simply add a small box on the left side that shows only "last 8 viewed products", with a simple Title and link ( just like the one we have now on the left), but withouht .. customers who bought this ...

 

and then in this box we will add FOR MEMBERS who are logged in a link to my account.php, and this is where we will have the FULL VIEWED_PRODUCTS enhancement, with "people also bought ..." "do you remeber ..."

 

 

-------------------------

 

So the left box will look something like this: (for visitors)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

 

 

-------------------------

 

So the left box will look something like this: (for customers)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

 

more viewed history(link to account.php)

 

 

----------------------

 

 

Waiting for your reply and answers ... and again thank you for your effort

Link to comment
Share on other sites

Thank you, arames, is right DIR_WS_IMAGE!

But when I clear all the list of recently viewed, I can see this error:

 

Fatal error: Call to a member function on a non-object in /web/htdocs/www.100asa.it/home/includes/modules/viewed_products.php on line 16

on footer.

I think is impossible: my cache page contribution by Chem is able, and I still see recently viewed in action as a guest as a customer.

I don't know!

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

I've this problem:

clear the cookies and the saved cache files into browser; enter into my website, my first page is always english, I see the first product, and recently viewed show me:

Warning: in_array(): Wrong datatype for second argument in /web/htdocs/www.100asa.it/home/includes/classes/viewed_products.php on line 12

then, I see the second product, and recently viewed show me the first I see.

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

New to the contrib. Like the idea of it. Where can I download the entire, complete, up to date version?

 

I went to the contrib section and it has numerous available for download, but all see to be pieces of the code.

 

Thanks in advance.

Link to comment
Share on other sites

New to the contrib.  Like the idea of it.  Where can I download the entire, complete, up to date version?

 

I went to the contrib section and it has numerous available for download, but all see to be pieces of the code.

 

Thanks in advance.

 

I will post the latest FULL version this morning.

Treasurer MFC

Link to comment
Share on other sites

Now your contribution is OK: my page cache (by Chemo) is able, and your contrib is in action only as customer.

But there's a little bug: I've logged in as customer, the products that I've been see show me into the footer box of your contrib, I clear the box by the X button, I see another product, and I've this error:

Warning: in_array(): Wrong datatype for second argument in /web/htdocs/www.100asa.it/home/includes/modules/viewed_products.php on line 232

I hope I've been clear.

Bye

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Now your contribution is OK: my page cache (by Chemo) is able, and your contrib is in action only as customer.

But there's a little bug: I've logged in as customer, the products that I've been see show me into the footer box of your contrib, I clear the box by the X button, I see another product, and I've this error:

Warning: in_array(): Wrong datatype for second argument in /web/htdocs/www.100asa.it/home/includes/modules/viewed_products.php on line 232

I hope I've been clear.

Bye

 

 

Yes, clear , I will check.

 

 

try moving this statement :

 

$items_ids_on_display = array();

 

 

above this statement :

 

if ($viewed->count_viewed() > 0) { // displaying

 

 

 

 

 

I would suggest you set warnings/errors to log files not to the display.

You can set it in the php.ini file.

Treasurer MFC

Link to comment
Share on other sites

Only the line 64 above the line 29, or all the blocks (please tell me from... to...)

I would suggest you set warnings/errors to log files not to the display.

You can set it in the php.ini file.

My website is hosting into another ISP: I can't modify php.ini !

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Only the line 64 above the line 29, or all the blocks (please tell me from... to...)

 

My website is hosting into another ISP: I can't modify php.ini !

 

aah those ISP's

 

maybe this could help :

 

<?php

 

// Turn off all error reporting

error_reporting(0);

 

// Report simple running errors

error_reporting(E_ERROR | E_WARNING | E_PARSE);

 

// Reporting E_NOTICE can be good too (to report uninitialized

// variables or catch variable name misspellings ...)

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

 

// Report all errors except E_NOTICE

// This is the default value set in php.ini

error_reporting(E_ALL ^ E_NOTICE);

 

// Report all PHP errors (bitwise 63 may be used in PHP 3)

error_reporting(E_ALL);

 

// Same as error_reporting(E_ALL);

ini_set('error_reporting', E_ALL);

 

?>

Treasurer MFC

Link to comment
Share on other sites

Hi Amanda,

 

very nice contribution, remembers me of Ebay or Amazon ..

 

1 question only ...

 

How do I simply add a small box on the left side that shows only "last 8 viewed products", with a simple Title and link ( just like the one we have now on the left), but withouht .. customers who bought this ...

 

and then in this box we will add FOR MEMBERS who are logged in a link to my account.php, and this is where we will have the FULL VIEWED_PRODUCTS enhancement, with "people also bought ..." "do you remeber ..."

 

 

-------------------------

 

So the left box will look something like this: (for visitors)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

 

 

-------------------------

 

So the left box will look something like this: (for customers)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

 

more viewed history(link to account.php)

 

 

----------------------

 

 

Waiting for your reply and answers ... and again thank you for your effort :blush:

Link to comment
Share on other sites

Hi Amanda,

 

very nice contribution, remembers me of Ebay or Amazon ..

 

1 question only ...

 

How do I simply add a small box on the left side that shows only "last 8 viewed products", with a simple Title and link ( just like the one we have now on the left), but withouht .. customers who bought this ...

 

and then in this box we will add FOR MEMBERS who are logged in a link to my account.php, and this is where we will have the FULL VIEWED_PRODUCTS enhancement, with "people also bought ..." "do you remeber ..."

-------------------------

 

So the left box will look something like this: (for visitors)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

-------------------------

 

So the left box will look something like this: (for customers)

 

Viewed Products

 

+ Michael Jackson "Bad"

+ Michael Jackson "Dangerous"

+ Michael Jackson "Black&White"

 

more viewed history(link to account.php)

----------------------

Waiting for your reply and answers ... and again thank you for your effort  :blush:

 

 

well, you can use this stripped doen version, put this code into a file called viewed_products_stripped.php. Call this one when the customer is not logged in and call the original one in your account.php file.

 

 

<?php

if (((tep_session_is_registered('customer_id')) or (ENABLE_PAGE_CACHE == 'false')) and (!$spider_flag)){

 

//*******************************************************************************

DEFINE('HIST_ROWS',7); // number of rows per column on display

DEFINE('HIST_MAX_ROWS',7); // max number of products on display

//*******************************************************************************

 

 

// register the array if not already done so

 

if (tep_session_is_registered('viewed') && is_object($viewed)) {

} else {

tep_session_register('viewed');

$viewed = new viewed_products;

$viewed->reset();

}

 

// empty the array if requested by the user

 

if (isset($HTTP_GET_VARS['action'])) {

if ($HTTP_GET_VARS['action'] == 'viewed_remove') {

$viewed->remove();

}

}

 

// display the box if we have history

 

$items_ids_on_display = array();

 

if ($viewed->count_viewed() > 0) { // displaying

 

if (HIST_MAX_ROWS <= HIST_ROWS) {

$hist_width= '100%';

} else {

$hist_width= '100%';

}

 

echo '<table width="' . $hist_width . '" align="center" cellpadding="4">

<tr>

<td>

<table align="center" border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="1">

<tr>

<td>

<table border="0" width="100%" cellpadding="0" cellspacing="0" >';

 

$row = 0;

 

/* get the products array from the class containing all viewed products */

 

$items = $viewed->get_viewed_items();

 

$index = 1;

 

/* determine the first and last record we want to display*/

 

$first = sizeof($items)- HIST_MAX_ROWS;

$last = sizeof($items)-1;

if (($last+1) < HIST_MAX_ROWS) {$disp = ($last+1);} else {$disp = HIST_MAX_ROWS;}

if ($first < 0) {$first = 0;}

 

/* only fetch the info for products on display */

for ($i=$last, $n=$first; $i>=$n; $i--) {

$viewed_query = tep_db_query("select pd.products_name,

p.products_image

from " . TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_DESCRIPTION . " pd

where p.products_id = '" . $items[$i] . "' and

pd.language_id = '" . $languages_id . "' and

pd.products_id = p.products_id");

if ($viewed_info = tep_db_fetch_array($viewed_query)) {

$items_on_display[$i] = array('id' => $items[$i],

'name' => $viewed_info['products_name'],

'image' => $viewed_info['products_image']);

$items_ids_on_display[]= $items[$i];

}

}

 

echo '<tr>

<td nowrap class="pageHeading">' . BOX_HEADING_VIEWED_ITEMS . '<font size="1"> (' . TEXT_LAST . $disp . TEXT_ITEMS . ')</font></td>

</tr>';

echo '<tr>

<td height="10"></td>

</tr>';

echo '<tr>

<td class="hist" nowrap valign="top" align="left">';

 

for ($i=$last, $n=$first; $i>=$n; $i--) {

echo tep_image(DIR_WS_IMAGES . 'indicator.gif');

echo '   ';

echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $items_on_display[$i]['id']) . '"><font color="purple">' . $items_on_display[$i]['name'] . '</font></a><br>';

 

$row ++;

$index++;

if ($row > HIST_ROWS - 1) {

$row = 0;

echo '</td>

<td width="5"> </td>';

if ($i > $n) {

echo '<td class="hist" nowrap valign="top" align="left">';

} else {

echo '</td>';

}

}

}

 

echo '</tr>

<tr>

<td class="boxtext"><a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . LOGIN_BOX_MY_ACCOUNT . '</a></td>

<td colspan="100" class="boxtext" align="right"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=viewed_remove'). '"><img src="images/icon_delete.gif" border="0" alt="' . TEXT_RESET_VIEWED_ITEMS . '" title="' . TEXT_RESET_VIEWED_ITEMS . '"></a>  </td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

</table>';

 

} // Displaying

 

if (isset($HTTP_GET_VARS['products_id']) and ($HTTP_GET_VARS['action'] != 'viewed_remove')) {

if (!in_array($HTTP_GET_VARS['products_id'], $items_ids_on_display)) {

$viewed->add_viewed($HTTP_GET_VARS['products_id']);

}

}

 

} // general condition

 

?>

Treasurer MFC

Link to comment
Share on other sites

Thanx Amanda,

 

I added the left box for NON customers.

 

Still 1 stupid questions:

 

1 - How do i add the viewed_products.php into the account.php under the Email notification box?

 

I tried

<?php

 

 

// include the viewed products module

include(DIR_WS_MODULES . 'viewed_products.php');

 

?>

 

didn't work :blush:

Link to comment
Share on other sites

I get this exact same error and I DO NOT have the Chemo contrib installed at all

 

 

 

Now your contribution is OK: my page cache (by Chemo) is able, and your contrib is in action only as customer.

But there's a little bug: I've logged in as customer, the products that I've been see show me into the footer box of your contrib, I clear the box by the X button, I see another product, and I've this error:

Warning: in_array(): Wrong datatype for second argument in /web/htdocs/www.100asa.it/home/includes/modules/viewed_products.php on line 232

I hope I've been clear.

Bye

Link to comment
Share on other sites

Also, this msg is too crunched in the box, how can I make it fit across the bottom of the box..

 

"Your Recent History records the last5 products you have viewed. This is to enable you to go back and re-visit those products at your convenience."

 

I had the same problem before but when I tried Amanda's suggestion, it worked for me (I hope it wasn't a coincidence, though).

 

Here is her solution again:

 

 

 

In modules/viewed_products.php, try moving this statement :

 

$items_ids_on_display = array();

 

 

above this statement :

 

if ($viewed->count_viewed() > 0) { // displaying

 

 

Hope that works for you guys, also.

 

Mike

Link to comment
Share on other sites

I'm very happy of your contribution, Amanda, my customer too.

To view your contrib in action by my guest, I've disabled page cache by Chemo.

But when I go to the product info page and then to ask a question page, I lost the recently viewed products. Why this?

Thank you

Please, try it

Edited by 100asa

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

I'm very happy of your contribution, Amanda, my customer too.

To view your contrib in action by my guest, I've disabled page cache by Chemo.

But when I go to the product info page and then to ask a question page, I lost the recently viewed products. Why this?

Thank you

Please, try it

 

well the history array is stored in the session.

so if you lose the session, you lose the array and then it will not display.

So I think the "question page" contribution causes you to lose the session.

Treasurer MFC

Link to comment
Share on other sites

Also, this msg is too crunched in the box, how can I make it fit across the bottom of the box..

 

"Your Recent History records the last5 products you have viewed. This is to enable you to go back and re-visit those products at your convenience."

 

 

well, this code displays that text :

 

// if no results at all, display the explanation

 

echo '<td width="50%" align="left" valign="top">

<table width="60%" align="center" border="0">

<tr>

<td valign="top"><img src="images/info_blue_small.jpg"></td>

<td class="boxtext" align="left">' . TEXT_HIST_EXPL1 . HIST_MAX_ROWS . TEXT_HIST_EXPL2 . '</td>

</tr>

</table>

</td>';

 

 

put it anywhere you like.

Treasurer MFC

Link to comment
Share on other sites

  • 2 weeks later...

if you're having Warning: :angry:

 

Warning: in_array(): Wrong datatype for second argument in C:\www\hkorg\includes\modules\viewed_products.php on line xxx

 

from

 

  if (!in_array($HTTP_GET_VARS['products_id'], '$items_ids_on_display')) {  

 

to

 

  if (!in_array($HTTP_GET_VARS['products_id'], $items_ids_on_display)) {  

 

try remove ' ' from '$items_ids_on_display'

 

I'm using Ask A Question contib also. After changing thre line above Warning disappeared. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...