Jump to content
#StayAtHome ×
SaranacLake

Product Details page

Recommended Posts

Hello.  I just created a product gallery containing thumbnails of items that I will be selling.

When a user click on on of the thumbnails, I want a product details page to appear with more details about the chosen product

Could use some feedback if I am going about things the right way...

Step 1: User goes to my gallery located here:  www.mysite.com/store/product-gallery.php

Step 2: System displays a page of thumbnails representing items that I am selling.

Step 3: User click on a given thumbnail which is a hyperlink to:  www.mysite.com/store/products/4571

Step 4: System rewrites the URL as such:  www.mysite.com/store/products.php?sku=4571

Step 5: System queries MySQL and retrieves record for sku 4571

Step 6: System displays product details for the chosen item in Step 3 which is sku 4571

 

How does that sound?

 

Share this post


Link to post
Share on other sites

I dont' see why you have step 3.  You're open about the name of your starting gallery script in the url.  But why not with the url that your link is sending?  Why have to reformat it as step 4?

Share this post


Link to post
Share on other sites
6 minutes ago, ginerjm said:

I dont' see why you have step 3.  You're open about the name of your starting gallery script in the url.  But why not with the url that your link is sending?  Why have to reformat it as step 4?

Not sure that I follow you...

I have Step 3 because you start off in a gallery of thumbnails with no product details and after you choose a given thumbnail, then you go to a product details page which has all of the item's details.

 

Share this post


Link to post
Share on other sites

I'm asking why you don't simply produce the same url from the LINK instead of passing a shortened version to your script that then produces that same url.

Share this post


Link to post
Share on other sites
1 hour ago, ginerjm said:

I'm asking why you don't simply produce the same url from the LINK instead of passing a shortened version to your script that then produces that same url.

I prefer pretty URLs and the hope is - for people who still look at the Address Bar - that it will be more intuitive to them.

Share this post


Link to post
Share on other sites

IMHO - showing the exact url that you are really using right up front is more intuitive rather than going thru a re-format of it for no real reason.

Share this post


Link to post
Share on other sites
5 minutes ago, ginerjm said:

IMHO - showing the exact url that you are really using right up front is more intuitive rather than going thru a re-format of it for no real reason.

Most people would not find this URL to be intuitive...

www.mystore.com/store/products.php?category=clothing&gender=mens&type=outerwear&season=winter-coats

 

This, by contrast is more intuitive...

www.mystore.com/store/products/clothing/mens/outerwear/winter-coats/

Share this post


Link to post
Share on other sites

You didn't show ANYTHING like that in your previous example.

Share this post


Link to post
Share on other sites
24 minutes ago, ginerjm said:

You didn't show ANYTHING like that in your previous example.

Didn't need to.  My point is that there *IS* value in "pretty URLs" although a lot of techies disagree.

Back back on track....  So does it sound like I am approaching things the correct way in my OP - besides differeing opinions on what URLs should look like?

 

Share this post


Link to post
Share on other sites

Yes - you have the right idea.  I was only pointing out that if you built your page with the complete link embedded in it you wouldn't need the extra step in the middle.  

For me - being pretty is not important since the user is only going to see it for about 2 seconds on screen depending upon his/her connection speed.  After that the page that is returned will have its own url.

Share this post


Link to post
Share on other sites
8 minutes ago, ginerjm said:

Yes - you have the right idea.  I was only pointing out that if you built your page with the complete link embedded in it you wouldn't need the extra step in the middle.  

For me - being pretty is not important since the user is only going to see it for about 2 seconds on screen depending upon his/her connection speed.  After that the page that is returned will have its own url.

Sorry, but I still don't think I am understanding you...

My user starts off on this page...  www.mysite.com/store/product-gallery.php

(Technically, I could chop off the ".php" to make it totally "pretty", but I'm not so concerned about that.)

A gallery of thumbnails appears.

The user clicks on one of those thumbnails - which represents a product - to learn more about the product.

Here is where I'm not sure if we are following each other...

I don't care about the format of the URL behind that thumbnail that the user clicked, HOWEVER, when the product details page laods for sku 4571, I want the user to see the following URL...  www.mysite.com/store/products/4571

Clear?

It's a one-way street in that you can't have an "ugly" URL and then load a page displaying a "pretty" URL.  If you want a "pretty" URL to appear when the page loads, you need to have a "pretty" URL in the hyperlink behind the image.

Right?

So I'm not following you when you say I am taking an extra unnecessary step....

If I am wrong about something or am misunderstanding you, please correct me.  But it seems like your suggestion wouldn't work like I need it to work.

🙂

 

 

Share this post


Link to post
Share on other sites

Seems like you're only real question is whether or not you're going about this the right way.  While there isn't a "right" way, per se, to do something, this is probably the most popular way.  You didn't provide code, so I assume you've already set things up this way, no?

Share this post


Link to post
Share on other sites

Pretty URLs are fairly simple.  Either use mod_rewrite (for Apache servers) or its equivalent on your system to do the complete work, or use it to redirect to a centralized script that reads the URL parameters and shows content based on that parameter.

At work, we have listings like:  www.ombe.com/listing/2151404/Uninet-Developer-for-use-in-Ricoh-Aficio-200,-250,-345g

mod_rewrite has this rule:  

RewriteRule ^listing/([0-9]+)/?.*$ listing?$1 [NC,L]

"Listing" does something like this:

$product_num = intval($_SERVER['QUERY_STRING']);

Of course there's a LOT more, config and security modules before this point, and error handling for invalid query strings, and so on.

 

 

Edited by dalecosp

Share this post


Link to post
Share on other sites
6 hours ago, Zane said:

Seems like you're only real question is whether or not you're going about this the right way.  While there isn't a "right" way, per se, to do something, this is probably the most popular way.  You didn't provide code, so I assume you've already set things up this way, no?

I didn't write any code yet as to avoid hanging myself if I was going about this totally wrong!  🙂

Does the use-case i outline above sound like a reasonable approach?

 

Share this post


Link to post
Share on other sites
6 hours ago, dalecosp said:

Pretty URLs are fairly simple.  Either use mod_rewrite (for Apache servers) or its equivalent on your system to do the complete work, or use it to redirect to a centralized script that reads the URL parameters and shows content based on that parameter.
 

I understand how to do mod_rewrites.

I was simply trying to understand why ginerjm was saying one of my steps was unnecessary.

Share this post


Link to post
Share on other sites
6 hours ago, dalecosp said:

It would also be possible to post-process all the URLs on the page with JavaScript, but who wants to take time to do THAT?

I am not using JavaScript on my site.

Share this post


Link to post
Share on other sites
11 hours ago, SaranacLake said:

Does the use-case i outline above sound like a reasonable approach?

Yes.  It's not only reasonable, it's common practice to do it that way (with mod_rewrite).  Off the top of my head, I can't think of any other way to accomplish this.

  • Like 1

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.