Gotcha! :)
You've been a huge help so far Jonathan.... The listings page is as good as working.
Can you provide some assistance in getting my categories functioning?
Question; do we just need perch_categories() or perch_shop_categories()
When I call using perch_shop_categories(), it seems to break the listings that were there.
I have setup all 5 categories I want to use in Perch Shop and have the set the category template as 'category'.
On the shop/index.php page I am calling the following:
It depends on how your ui works. How are you using categories? At the moment you are just going to list out the categories. Are you hoping to have separate pages for each product category?
I have a shop landing page with a lefthand column listing the various categories and they're each listed on the righthand side. I'll basically have;
All Products | Product A | Product B | Product C | Seasonal
I don't need new pages for categories, just for them to list on the same shop landing page if that's possible?
Cool, I have all that working but how can I assign each of my listed product SKUs to their categories? I would have thought this was done via Perch Admin or do I need to pass extra arguments through the categories array??
You assign each product to a category (or more) in Perch Shop Admin. I think categories are in the default template. Just change the set name to match your own category set and the categories will display in the UI field on the edit page.
I'm not sure what I'm doing wrong. I have the category links working (per say) and can set different categories for each of my products, however when I click on any of the category links; all products display to the page irrespective of what I click!!
If you've got another page template – which I assume you now have as per "category.php" in your example above – then that page needs to filter products based upon the category slug in the url. e.g. the ?cat=<perch:shop id="categorySlug" /> bit.
Hi Jon, I'm a little bit confused by the above and categories is still not behaving for me.
Any ideas what might be the issue from reviewing the below?
You are already displaying your categories. You want to filter the product list by category. So your basic set up is something like:
Display a list of categories on a page with category ids in the links (currently your product list page)
The links take you to a new page which contains the category as a query in the URL.
The page filters the products by category in that URL.
If there isn't a category in the URL then display all the products.
If you are still struggling after this, then may I suggest you contact someone in the registered developer list? Or join the Perch Slack channel and see if there's anyone there who might trade skills?
You are already displaying your categories. You want to filter the product list by category. So your basic set up is something like:
Display a list of categories on a page with category ids in the links (currently your product list page)
The links take you to a new page which contains the category as a query in the URL.
The page filters the products by category in that URL.
If there isn't a category in the URL then display all the products.
If you are still struggling after this, then may I suggest you contact someone in the registered developer list? Or join the Perch Slack channel and see if there's anyone there who might trade skills?
Because you are outputting it as text in the final line of your template.
NB You can change the product template to suit your own needs. The supplied template is just an example.
Sorry, I don't see where in the template I could be doing that?
You've posted the template a few posts ago! The image template tag is repeated twice.
Gotcha! :) You've been a huge help so far Jonathan.... The listings page is as good as working.
Can you provide some assistance in getting my categories functioning? Question; do we just need perch_categories() or perch_shop_categories() When I call using perch_shop_categories(), it seems to break the listings that were there. I have setup all 5 categories I want to use in Perch Shop and have the set the category template as 'category'.
On the shop/index.php page I am calling the following:
and the template looks like this
You're welcome.
It depends on how your ui works. How are you using categories? At the moment you are just going to list out the categories. Are you hoping to have separate pages for each product category?
I have a shop landing page with a lefthand column listing the various categories and they're each listed on the righthand side. I'll basically have; All Products | Product A | Product B | Product C | Seasonal I don't need new pages for categories, just for them to list on the same shop landing page if that's possible?
Anything's possible!
If you click the categories surely you will display a new listing page showing products in that category?
So effectively you will have a url like /shop/category-slug/product-slug/
If so, you'll need to change the product list function to filter by the category slug in the url (if it exists).
Have a search in the forum as there are examples.
Jon
Cool, I have all that working but how can I assign each of my listed product SKUs to their categories? I would have thought this was done via Perch Admin or do I need to pass extra arguments through the categories array??
You assign each product to a category (or more) in Perch Shop Admin. I think categories are in the default template. Just change the set name to match your own category set and the categories will display in the UI field on the edit page.
I'm not sure what I'm doing wrong. I have the category links working (per say) and can set different categories for each of my products, however when I click on any of the category links; all products display to the page irrespective of what I click!!
If you've got another page template – which I assume you now have as per "category.php" in your example above – then that page needs to filter products based upon the category slug in the url. e.g. the
?cat=<perch:shop id="categorySlug" />
bit.Hi Jon, I'm a little bit confused by the above and categories is still not behaving for me. Any ideas what might be the issue from reviewing the below?
My shop landing page looks like this :
My category.html template:
And within the product template I've match the category ID to be;
Hi
You are already displaying your categories. You want to filter the product list by category. So your basic set up is something like:
If you are still struggling after this, then may I suggest you contact someone in the registered developer list? Or join the Perch Slack channel and see if there's anyone there who might trade skills?
Jon
Thanks very much for your help to date Jonathan.