close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

display products on category detail page

Thread began 12/01/2013 8:55 pm by kevin94181 | Last modified 12/05/2013 8:35 am by Jason Byrnes | 5924 views | 10 replies |

kevin94181

display products on category detail page

I'm trying to display the products within a category on the category detail page (productcategories_Results.php). I have everything working just not sure what the next step is.

Sign in to reply to this post

Jason ByrnesWebAssist

There are a couple different approaches that can be used for categories:

1) a product can belong to only one category

2) a product can belong to multiple categories

the basic idea for showing the products in the categopry is to create a recordset that filters the products based on the CategoryID URL Variable.

the specifics of this depend on which approach was used.

If products belong to only one category, there will be a CategoryID column in the products table, create the recordset to filter the Products table using the Category ID column and the CategoryID URL Variable.

If products can belong to more than one category, you will have a linking table and will need to use a joined query, see the following page for more details on joined queries:
http://www.w3schools.com/sql/sql_join.asp

Sign in to reply to this post

kevin94181

Jason.
Thanks for the reply.
The products will only belong to one category.

Would this be the tutorial to follow?
http://www.webassist.com/community/tutorials/view_tutorial.php?tid=104

Sign in to reply to this post

kevin94181

I think I made a little progress by using the following ...

SELECT ProductName, ProductCategoryID
FROM products
WHERE ProductCategoryID = colname

... but still curious as to how I get this to dynamically list the products on the page and then link each product to its detail page.

Sign in to reply to this post

Jason ByrnesWebAssist

You use the bindings panel to create a display of the products recordset information and add a repeat region around it.

Sign in to reply to this post

kevin94181

Thanks again for your reply and I apologize for dragging this on, but is my recordset filter correct?

SELECT ProductID, ProductName, ProductCategoryID
FROM products
WHERE ProductCategoryID = colname

After creating the above in the Binding panel, I have the following on the page and nothing is showing ... (I copied the "View Details" link from the products results page.)

<table width="95%" border="0" cellspacing="0" cellpadding="5">
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['ProductName']; ?><?php echo $row_Recordset1['ProductID']; ?><?php echo $row_Recordset1['ProductCategoryID']; ?></td>
<td align="center"><span id="View<?php echo(rawurlencode($row_WADAproducts['ProductID'])); ?>" class="WADATextButton"><a href="products_Detail.php?ProductID=<?php echo(rawurlencode($row_WADAproducts['ProductID'])); ?>">View Details</a></span></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>

Sign in to reply to this post

Jason ByrnesWebAssist

not enough information to know if the recordset is correct, send a copy of the page please and a ;link where i can see the problem.

Sign in to reply to this post

kevin94181

Jason.
I have attached the files.

Sign in to reply to this post

Jason ByrnesWebAssist

so the link to the details page:
productcategories_Detail.php?CategoryID=2


passes the id in a URL variable named:
CategoryID

In your recordset, you have set the filter to use a URL variable named:
ProductCategoryID

edit the recordset and set the filtering section to use the column named ProductCategoryID = to URL variable named CategoryID

Sign in to reply to this post

kevin94181

FANTASTIC! That did the trick. Thank you so much Jason!!

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...