close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Product by categories Id

Thread began 2/09/2010 4:05 pm by tolushayoo193471 | Last modified 2/22/2010 5:36 am by tolushayoo193471 | 2398 views | 13 replies |

tolushayoo193471

Product by categories Id

With powerstore2 I was able to display my products using category Id below is the code
"SELECT *, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0) FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) AS NumLeft, (SELECT MAX(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS TopPrice, (SELECT MIN(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS BottomPrice FROM products LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID AND products.ProductCategoryID = 16 ORDER BY products.ProductID DESC"

but now I've upgraded to powerstore3 I've tried to add filter the productcategory to ps3_categories.CategoryID =16

but am having these error Unknown column 'ps3_categories.CategoryID' in 'order clause'

Sign in to reply to this post

Jimmy Wu

Which page are you trying to add the filter to? Is it the Products_Results.php page?

Sign in to reply to this post

tolushayoo193471

Product by categories Id

yes, Products_Results.php page

Sign in to reply to this post

Jimmy Wu

The ps3_categories table is not the table being selected from in the products query, so you can't use the categories to order the products. I believe you'd want to use the GroupingID for this purpose.

Sign in to reply to this post

tolushayoo193471

thnaks, please explain more cause I dont know about the GroupID, please it possible to help me out with the filtering code to be added unto it?

Sign in to reply to this post

Dani Chankhour

In PowerStore v3, you can add a product which does not belong to any category, which is why the category id column does not exists in the products table any more.

Instead, You might want to update the links to your product results page to include the category in the url, for example, you could have a link as follow:

Products_Results.php?Search=1&ProductCategoryID[]=1

or

Products_Results.php?Search=1&ProductCategoryID[]=2

Sign in to reply to this post

tolushayoo193471

Product by categories Id

Thank you, I type these in the browser Products_Results.php?ProductCategoryID[]=1
or

Products_Results.php?CategoryID[]=1

and the result brought out all products in the database.

but actually in my database in ps3_cetegories i have

CategoryID CategoryName CategoryParent
1 PLAYSETS 0
2 CLASSROOM STORAGE 0
3 BOOK STORAGE 0
4 TOY STORAGE 0

or do i have to filter through my product result page? thank you

Sign in to reply to this post

Dani Chankhour

You will just need to add an additional parameter as follow:

?Search=1&ProductCategoryID[]=1

if you click on the link i sent you in a browser, you will see the second parameter (Search=1)

Sign in to reply to this post

tolushayoo193471

thank you but I still dont know where to put the ?Search=1&ProductCategoryID[]=1, do I have to put it on the product result page? When I put it below is the code but it came up with error

"SELECT * , coalesce((select ps3_productoptions.GroupingID from ps3_productoptions WHERE ps3_productoptions.ProductID = ps3_products.ProductID limit 1),ps3_products.ProductID) AS GroupingID FROM ps3_products WHERE ProductLive = 1 GROUP BY GroupingID ORDER BY ProductName ?Search=1&ProductCategoryID[]=1";

ERROR
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 '?Search=1&ProductCategoryID[]=1 LIMIT 0, 10' at line 1

or am i placing it in the wrong section?


And if i placed it on the link Products_Results.php?Search=1&ProductCategoryID
it gives me below error

Warning: implode() [function.implode]: Invalid arguments passed in /home/thearkea/public_html/Products_Results.php on line 84
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 ')) GROUP BY GroupingID ORDER BY ProductName LIMIT 0, 10' at line 1

thanks

Sign in to reply to this post

Dani Chankhour

You will need to add that to the link to the product result page. So the url needs to be:

Products_Results.php?Search=1&ProductCategoryID[]=1

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