Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

adding a Prev. Next. navigation to product info pages


lindsayanng

Recommended Posts

Posted

Is there a way to add a prev. - next navigation into my product description. People who look at my products are GOING to look at them in order, and instead of always bringing them back to the product listing page, i would like for them just to click NEXT and see the next product.. It was the biggest complaints of peope testing my site, i just have no clue how to code something like that!!

 

here is my site just if you want to see

 

Catalog

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

i found this contribution, but all those bug fixes and comments (this contribution doesnt work right) kinda scares me. I already installed ONE contribution that pissed me off, i dont want to do this again.. Anyone use this? Or does anyone already have something similar implimented on their site that they would like to share with me??

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

So has anoyne used this? I am about to pull the trigger on installing it, i just dont know.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

this one is the one..

 

contribution

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

OOPS actually this was the one that scared me.. the comments THIS CONTRIBUTION DOES NOTWORK.. and a million "fixes"

http://addons.oscommerce.com/info/1164

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

ok.. well i tried the FIRST one that i linked to, and it resulted in a PRODUCT NOT FOUND on my product info page..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

so is that it.. I am stuck at NUTHIN

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted
ok.. well i tried the FIRST one that i linked to, and it resulted in a PRODUCT NOT FOUND on my product info page..

Did you just replace the files or did add the code changes to your existing files?

That contrib is so old that if you compare the files to a 2.2 with updates 060817 version, they still don't match. That could be why its not working. Outdated.

Posted

I added the code to xisting files because i had too much changed in the existing.. this contribution also assumes you dont have a product_listing.php but i do form Spook's product listing contribution..

 

WHY is it outdated?? WHY IS EVERY CONTRIBUTION I WANT OUTDATED?? WHY DID I USE THE MOST RECENT OSC??

 

I really need this. It is the most requested feature among testers AND users.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

Hey Lindsay, you've been a big help to me today. I need to get some sleep right now. I will think about a way to implement what you are looking for tomorrow.

Posted

that would be AWESOME>. if ANYONE comes up with an idea on how to do this, i would be forever greatfull!!I need sleep tonight too.. goodnight folks!~

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

I guess no one thought of anything overnight..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

Ok, I had some free time between classes and this is the solution that I came up with. It might order the products differently than you have them on the product_listing. Right now I have it ordering them according to the product_id #. If you desperately need it to match the order displayed when you view the entire category, I can probably make it do that. I was unsure exactly how you were sorting them so I just made it sort them according to product_id.

 

Open up your file product_info...

Find the line that says...

	$product_info = tep_db_fetch_array($product_info_query);

Immediately after that line add this code...

// ------ Previous Next ---- Joseph Roth ---- Start section
// Select the current category
$category_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$category_info = tep_db_fetch_array($category_query);
// Select all other products from this category
$previous_next_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $category_info['categories_id'] . "'");
// Scroll through products until we find the current product_id
$current_product = tep_db_fetch_array($previous_next_query);
$previous_product = $current_product;
while ($current_product['products_id'] != $HTTP_GET_VARS['products_id']) {
  $previous_product = $current_product;
  $current_product = tep_db_fetch_array($previous_next_query);
}
// We have located the current product_id and also have the previous product
$next_product = tep_db_fetch_array($previous_next_query);
// Check to make sure that there is a previous and next product and store their ids
if ($previous_product != $current_product) {
  $previous_id = $previous_product['products_id'];
}
if ($next_product != false) {
  $next_id = $next_product['products_id'];
}
// ------ Previous Next ---- Joseph Roth ---- End section

 

Then wherever you want the previous and next to appear add the following code...

<?php
// ------ Previous Next ---- Joseph Roth ---- Start section
if ($previous_id != '') {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $previous_id) . '">Previous Product</a>';
}
if ($next_id != '') {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $next_id) . '">Next Product</a>';
}
// ------ Previous Next ---- Joseph Roth ---- End section
?>

 

I'm assuming that you are relatively familiar with the organization of the product_info.php file and can figure out where to add that specific section so that it appears how you want it. You probably will also want to make them nice buttons, and also want to make it so that it says something if you are at either end of the list of products. I have to run off to class right now. I will check back in in about an hour and see what you think. If you need any tweaks, I can probably implement them.

Posted

I cant have something that is going to mess with the order because rightnow i have Spook's thumbnail enhancement contribution which allows the customers to set the order.. PLUS, the product names are actually the image file names, and they really need to be in order.

 

I hate to sound picky about this..

 

And yea, i definitely know theproduct info file enough to where you tell me what to put there and i can make it happen.. usually by trial and error, but none the less.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

I'm not sure if you completely understand what I mean by the ordering.

 

The customer will most likely not even be able to remember what order the images appeared in the thumbnail view vs. the product_info view. I looked around at some of your images and when you upload a new image you give it a number for its name. This means that your products are ordered in the thumbnail view according to their products_id. So even if your customer wrote down the order for each of the thumbnails, he would find that they appeared in the correct order when he selected the previous / next buttons.

 

The only difference would be if the customer chose to sort the product thumbnails in descending order. But even if he did that, he should still expect the previous one to be the number just beneath the current one that he is viewing.

 

I suggest that you try to implement my method and test it out. You will notice that if you are viewing TR_030 and you click next, it should send you to TR_031.

Posted

yea, unless the customer clicks the little thing at the bottom that allows them to show the images in reverse order.

Some people will look at them in reverse order if we tell them that their images are number 210-325. Then i believe that will totally screw them up because in the product listing pages, they will see them ordered backwards, but wehn they go to view the images, when they hit next, the will be going forward..

 

does this make sense???

 

I assume (and this is just me thinking out loud) that if you did an if reverse listing is shown, reverse product id???

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

I could probably do that, but it would involve some way to transmit to the products_info page the sort order.

 

If you can pass me in a GET variable the sort order, I can change my code so that it orders the query dependent upon how the customer was viewing the products.

 

BUT, I think that this might confuse the customer. If you as a customer are viewing product TR_232 and you click on Next Product, where would you expect to be redirected to? TR_233 or TR_231. Even if you had been viewing the thumbnails in reverse order, I think that you probably would expect to move to TR_233. Do you understand what I'm trying to get across? I think that they way that I have it set up right now works fine.

Posted

I do understand what you are trying to say.. maybe it WILL confuse the customer to do it that way instead of my way. I hate that i sound picky.. I'm not. I PROMISE!!!

 

As soon as i get home, i will add this to my code. I refuse to do any work on my PC at work..

 

BTW, did you get the cookie path set for your SSL?? You have some issues over there that i explained.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

OMG I LOVE YOU!!! thank you sooo much for this. it works like a charm and i can not thank you enough!! you should put it into a text file a upload it as a contribution, seeing as NONE of the other ones work and are WAY more complicated.. the other one had me actually uploading a NEW file.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted

I would upload it as a contribution, but I made a very simple version that will only work for your situation. I noticed a few unique things about your store that could simplify the process.

 

First, you don't include the category when you are browsing products. This makes it simpler to create the links for the next product.

 

Second, when you create new products for a category you give them names that line up alphabetically with the order that you upload the files. Since you name them with numbers, they line up alphabetically. This way all I have to do is pull the product_id and it will match up alphabetically. I don't have to worry about joining two different tables together and sorting the result.

 

For those reasons I don't think it would be worth it to make it into a contribution. If I really had the desire to, I could spend a few more hours and make it so that it pulled the products alphabetically and also allow you to sort it according to a few different properties, but like I said, I don't really have the desire or time to do that.

 

I'm glad that I could be of help in your specific case.

Posted

OHhhhh.. i get it. I didnt even think of that.

 

I dont really understand what you are saying about me not including the category when browsing products.. the way the products are entered is stock.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

  • 3 months later...
Posted

A small mistake in the code sequence for product_info.php

 

while ($current_product['products_id'] != $HTTP_GET_VARS['products_id']) {

 

should be

 

while ($current_product['products_id'] != (int)$HTTP_GET_VARS['products_id']) {

 

to avoid endless loops when the product id contains options like id=634{4}22

  • 3 weeks later...
Posted
A small mistake in the code sequence for product_info.php

 

while ($current_product['products_id'] != $HTTP_GET_VARS['products_id']) {

 

should be

 

while ($current_product['products_id'] != (int)$HTTP_GET_VARS['products_id']) {

 

to avoid endless loops when the product id contains options like id=634{4}22

 

 

Thank you so much for this!!! I've been using this fix and started to get a timeout problem and had NOOOO clue how to fix it. I'm so glad I checked back in this thread and saw your solution. THANK YOU THANKYOU!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...