Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Recently Viewed Products(sales optimized)


b00

Recommended Posts

Hello,

 

I wished it above in such a way now after many hours created the Design to make as - puuuh.

 

How do I know now still the left button (button_buy_now.gif) on the product info. page Link ?

 

Are these lines ?

 

$lc_text = '<div><form name="buy_now_' . $products['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL') . '">';

 

$lc_text .= '<br><input type="hidden" name="products_id" value="' . $products['products_id'] . '">' . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW,'align="absbottom"') . ' '. '<br><br><br>';

Link to comment
Share on other sites

Yes, that's the code for the Buy Now button. it can be moved anywhere in the form -- that is, anywhere between

	$lc_text  = '<div><form name="buy_now_' . $products['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL') . '">';

and

</form>

That last is included at the end of other lines, so you may need to separate it out.

 

Regards

Jim

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

Link to comment
Share on other sites

If you mean a link to the Product Info page, that looks like this in HTML:

<a href="http://www.example.com/product_info.php?cPath=26_116&&products_id=156">Example product</a>

To generate this in PHP (in the Recently Viewed page):

echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO,  'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'] . '">' . $products['products_name'] . '</a>';

Regards

Jim

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

Link to comment
Share on other sites

I like the idea of this Contrib! I am using OscMax - osCommerce but with a ton of mods already addded on. Is there anyone else using this add-on that has got a work around for this to work properly?

 

Here's my error:

 

Warning: require(includes/header.php): failed to open stream: No such file or directory in /hsphere/local/home/soundapp/soundapproach.com/catalog/recently_viewed.php on line 138 Fatal error: require(): Failed opening required 'includes/header.php' (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/soundapp/soundapproach.com/catalog/recently_viewed.php on line 138

 

I know that osCMax does not use header.php and changed the line 138 to read:

 

<?php require(DIR_WS_CATALOG . 'templates/fallback/main_page.tpl.php'); ?>

 

But it still didn't work.

 

 

Thanks in advance.

 

Dale

Link to comment
Share on other sites

It's the template that's messing things up. I don't know what templating system OscMax uses, but see if it has instructions for extending the template to a new page. That's what you need to do to make this work.

 

Regards

Jim

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

Link to comment
Share on other sites

It's the template that's messing things up. I don't know what templating system OscMax uses, but see if it has instructions for extending the template to a new page. That's what you need to do to make this work.

 

Regards

Jim

 

 

Yes, osCMax uses the BTS template. I've tried to make it work, but with no success. I'm hoping someone else has used this Contrib with the Fallback template. I want to implement this on our site. I do see the usefulness of it.

 

Thanks,

 

Dale

Link to comment
Share on other sites

Just upgraded from 11/5/07 to 11/5/08 by kymation. Admin is up and running fine, database was updated properly and all files updated. However, when we go to product_info.php for a particular product, we get this error now

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and p.products_status = '1' ' at line 11

select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price from products_description pd, products p left join specials s on p.products_id = s.products_id where p.products_id in () and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'

 

Any ideas what is causing this or how to fix?

Link to comment
Share on other sites

Just upgraded from 11/5/07 to 11/5/08 by kymation. Admin is up and running fine, database was updated properly and all files updated. However, when we go to product_info.php for a particular product, we get this error now

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and p.products_status = '1' ' at line 11

select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price from products_description pd, products p left join specials s on p.products_id = s.products_id where p.products_id in () and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'

 

Any ideas what is causing this or how to fix?

 

 

Never mind...got it fixed. Guess I was a bit tired when I applied the update from the original contrubution and the 2.0 update. I had mistakingly left some of the code that needed to be removed in products_info.php. Once I removed this snippet of code, all worked great. Thanks for the great contribution....

 

///////////// begin recently_viewed
if (!tep_session_is_registered('recently_viewed'))
{
tep_session_register('recently_viewed');
$recently_viewed = $HTTP_GET_VARS['products_id'] . ';';
}
$dup_recent_viewed = 'n';
$recent_products = split(';',$recently_viewed);
foreach ($recent_products as $recent) {
if ($recent == $HTTP_GET_VARS['products_id']) $dup_recent_viewed = 'y';
}//foreach ($recent_products as $recent) {
if ($dup_recent_viewed == 'n') $recently_viewed = $HTTP_GET_VARS['products_id'] . ';' . $recently_viewed;
///////////// end recently_viewed

Link to comment
Share on other sites

  • 3 weeks later...
okay my English is not perfectly I tries it again. This function installed.

 

1.I have only a Link

"Recently Viewed Products" - right above

 

Check in the file colum_right if you copied the following lines:

 

// Start recently_viewed

if (SHOW_RECENTLY_VIEWED_COLUMN_BOX && basename ($PHP_SELF) != FILENAME_RECENTLY_VIEWED) {

require_once (DIR_WS_BOXES . 'recently_viewed.php');

} // if (SHOW_RECENTLY_VIEWED_COLUMN_BOX

// End recently_viewed

Link to comment
Share on other sites

I have downloaded this contribution and I am trying to make it work with CRE Loaded 6.2 but I keep getting errors come up.

 

I think the problem is that CRE Loaded used the BTS contribution for templating.

 

Is there any advice on how to make this work with CRE Loaded?

 

Thanks for any help?

Link to comment
Share on other sites

Nope. BTS interferes with just about everything by moving content to different files and making changes to the core code. You need a good understanding of BTS and how it has modified the code to know where to add any new code. You might try the BTS support topic -- maybe someone there can help.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 months later...

Hey, i've just installed the contributions and it's working in firefox but when i check it in explorer nothing happens and on the recent_viewed.php i get "There aren't any recently-viewed products to display for you right now. "

So i just check on a different pc and the same thing happens... well nothing actually happens.. I would guess it has something to do with the sessions?

any ideas??

Link to comment
Share on other sites

That does look like a session problem. Have you noticed any other session-related issues in IE, such as shopping cart and checkout problems? Have you changed anything related to sessions, such as requiring cookies?

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

Hey guys, I have installed this and would like to say thank you to the original creator, however I have a little problem that I dont know if its a problem or suppose to be like this.

 

When I browse the site, the recently viewed items shown up perfectly, however if I just leave the site open and not doing anything for a while, recently viewed infobox dissapear until I click on some products again, basically it reset the list, note that im still logged in at this point. I would like to keep the list available until either the customer logoff or close the browser completely, is there any solution for that? or is that the way it suppose to work?

 

Thanks in advance for any helps

Link to comment
Share on other sites

Recently Viewed needs to work whether or not the customer is logged in, so it stores the data in a session variable. Session expires after ~15 minutes of no activity, so the data is lost at that time. This is pretty much the way it's supposed to work.

 

It would be possible to make this longer for logged-in customers only. The result would be confusing, and customers rarely log in until they are ready to buy something anyway, so it wouldn't be of much value anyway.

 

Regards

Jim

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

Link to comment
Share on other sites

Recently Viewed needs to work whether or not the customer is logged in, so it stores the data in a session variable. Session expires after ~15 minutes of no activity, so the data is lost at that time. This is pretty much the way it's supposed to work.

 

It would be possible to make this longer for logged-in customers only. The result would be confusing, and customers rarely log in until they are ready to buy something anyway, so it wouldn't be of much value anyway.

 

Regards

Jim

 

Hi Jim, thanks for the reply, now i understand how it work at least I know i didn't do anything wrong. I came across some site that have similar features, but as long as I dont close the browser, my recently viewed list is there when I go back to their site, so thats why I wanted to see if we can do the same. However I think it would be more useful to make the session longer in case they have to leave their computer for while or something. Would it be very hard to extend the session time for all customer (logged in or not)? any chance you know what codes need adding or changing? thanks again

Link to comment
Share on other sites

I can't guarantee this will work, since some hosting services block changing this locally. Try adding this to your .htaccess

php_value session.gc_maxlifetime 3600

or whatever timeout value (in seconds) that you want. If you are on a shared server, you have to save your sessions in your own directory or the database, not the common /tmp directory.

 

Regards

Jim

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

Link to comment
Share on other sites

thanks, I'll try that.

 

however I've found another solution that works for any server shared or not, for anyone that wanted the same thing here goes

 

in catalog/includes/functions/sessions.php

 

replace

 

if (STORE_SESSIONS == 'mysql') {

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {

$SESS_LIFE = 1440;

}

 

with

 

if (STORE_SESSIONS == 'mysql') {

$SESS_LIFE = 3600; //set session time out to 60min in seconds

Edited by ptt81
Link to comment
Share on other sites

That will work, but only if you are storing session data in the database.

 

Regards

Jim

 

yes, thats the case for me, but looking by the code oSC set it to store in database by default

 

well thanks a lot for your help

Link to comment
Share on other sites

  • 1 month later...

Hi Jim,

 

I'm running recently viewed as well as more pics but I think I've to change the sql for recently viewed to see the product images. Since you developed both I hope you can help me out.

 

Thanks in advance en regards,

Marja.

Link to comment
Share on other sites

I'm not the original developer of this one, but i have made a lot of changes to it, so I should be able to figure out a few more. I assume that the the problems are with catalog/recently_viewed.php and catalog/includes/modules/recently_viewed.php, so I'll concentrate on those.

 

First, change p.products_image to pi.image_filename everywhere that occurs in both files.

 

Then change products_image to image_filename everywhere that still exists.

 

Finally, in every SQL string that (now) includes pi.image_filename, find the line containing

										 " . TABLE_PRODUCTS . " p

and add just after that code

										 left join " . TABLE_PRODUCTS_IMAGES . " pi on p.products_id = pi.products_id and pi.category_page = '1'

That should fix the images on just about any page.

 

Regards

Jim

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

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...