Print Page | Close Window

sorting featured items

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=24
Printed Date: 27-November-2024 at 3:18am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: sorting featured items
Posted By: Nothing
Subject: sorting featured items
Date Posted: 08-November-2005 at 4:28pm

We have 5 main (root) categories in our store (many sub categories). The most popular items purchased are from 2 categories.

I want to create a featured product page to show only flagged items from one root category at a time.

We have a featured product page, and we need it’s functions to stay as they are… any item flagged will be displayed on that page.

The page I’m trying to tweak I got from the below link.
“Move the default ProductCart home page (mainIndex.asp) to your root folder. http://www.earlyimpact.com/productcart/support/code_samples/index.zip - Download this special version of mainIndex.asp - renamed http://www.earlyimpact.com/productcart/support/code_samples/index.zip - index.asp - which has been modified to work in your root folder.”

I’m wondering…. is there any easy solution?  

many thanks
n0thing




Replies:
Posted By: rightmind
Date Posted: 21-December-2005 at 4:18pm

I've not tried this, but I would think you could use the file from the Developer's Corner submitted by Dan Tang that allows you to display N featured products anywhere...and then modify the SQL statement to only call items from your category. Easiest would be to create a file for each of the categories you are wanting to feature.

Currently, that file uses this SQL statement at line 28:

'select products that are flagged as featured items for the homepage
mySQL="SELECT sku,idProduct, description, serviceSpec, details, price, smallImageUrl FROM products WHERE showInHome=-1 AND active=-1"

You could modify it to this, which would select all products from your given category regardless of whether or not they are marked to be displayed on the home page (they just have to be marked as "Featured":

'select products that are featured items from a specific category
'be sure to replace X with your category number
mySQL="SELECT products.sku, products.idProduct, products.description, products.serviceSpec, products.details, products.price, products.smallImageUrl
FROM products INNER JOIN categories_products ON products.idProduct = categories_products.idProduct
WHERE categories_products.idCategory=X AND products.active=-1"

Of course, there are other ways to do this like modifying it to check and for the category in the incoming link and then querying based on that.

I hope that at least sets you on the right path!



Posted By: Nothing
Date Posted: 10-February-2006 at 6:03pm

hi rightmind
thanks so much for your idea and code. i've been afk for awhile.
i got about as far as the 'INNER JOIN' statement and ran into knowledge issues.

I got your suggested code working (thanks!) and as far as i can tell, your code displays items from sub categories only - and does not list any items from any categories below it... (hope that made sense)

As mentioned, i have 5 main categories, (tools, wi-fi, hardware, software, prints).
Under TOOLS, i have 7 sub categories. All our products under tools are locted in the 7 sub sections only. Using your code, i'm able to list 'featured products' in one of the sub sections, but not in the main root catagory.

i'll continue to bang my head on this sql statement.

thanks for your help
nothing

 



Posted By: rightmind
Date Posted: 12-February-2006 at 11:54am
The INNER-JOIN "connects" the 2 tables in the database and essentially associates the records based on the field that they have in common -- in this case 'categories_products ON products.idProduct = categories_products.idProduct'

I am sure there is a more sophisticated way to do this, but a basic method would be to add an 'OR' to the query:

categories_products.idCategory=X OR categories_products.idCategory=Y OR categories_products.idCategory=Z

X, Y, and Z would be replaced with your sub-category numbers. I am sure there is also a way to check for sub-categories off of a root category. However, I am not able to take the time to look for how to do that at the moment. I will give it a try when I can, but it may take me a couple of weeks before I'll have a chance. And I am sure you don't want to wait that long to get this going.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net