Categories links in list / detail pages
Hi
I have followed the tutorial on creating a portfolio (https://docs.grabaperch.com/video/v/portfolio-with-categories/) as it is similar to what I am trying to do with a listing / detail page.
I have a couple of different layouts which utilise different prices/offers depending on if someone is a business or personal customer and for this reason they are inside separate folders for example /business or /personal.
I am trying to use categories within these folders so for business it would be /business/category.php and would like it to display a list of offers related to the category selected on the detail page. However I am having issues getting this to work when you click a category link it isnt returning the category.php layout with a list of offers in the way it does in the portfolio tutorial.
Any help would be apprciated.
Can you show us your code?
Hi Drew
Category.php Page:
detail.php Category part of the template
Thanks
I also have this in my htaccess
Ok, great - which part isn't working? How does it fail? What results do you get and what results are you expecting?
What have you tried?
When you click on the category link at the bottom of the detail page it is taking me to business/manufacturers/nissan/ but none of the styles are being pulled through and it isnt producing a list of items associated with the category clicked on the detail page.
If i hit business/category.php it brings back a list of all categories available.
I have tried a number of configurations with the category path but cant get anything to produce a list of items associated with that category.
By styles, you mean the CSS? Do you get any errors in your browser console?
Yeah the CSS isnt being found. I have figured out that it is trying to use detail.php as the page to display the categories on.
Each element being called in the header or footer are causing an error so CSS and Jquery. It seems to be thinking that it is inside a separate folder for each level in the Categories.
I have sent you a DM through slack with the web address of the test site.
Have you linked your CSS and JavaScript so it is root relative?
So:
/js/my-javascript.js /css/my-css.css
Hi Rachel
I had them set to ../css/styles.css. I have removed the .. and the styles are now loading.
Still no joy with the listing of items within a selected category tho. It appears to be using my detail.php template instead of my category.php template.
If you are rewriting URLs you will need to link your assets from root.
With regard to the other issue, what do you get on that page if you turn on debug in Perch?
No worries I have changed them over now.
I changed the link from
to
That appears to have worked I just need to get the rewrite working correctly as its displaying the link as /business/category.php?cat=manufacturers/nissan/
Is there something that Im missing?
It looks like you're querying for items where the
slug
ismanufacturers/nissan/
Is that what you'd expect?
Ah rite no I am guessing it should be the category path.rather than using the slug.
Which page is that debug output from?
Its from my detail.php page as until I changed the category link over it wasnt going to the category.php page
I must have something wrong within the htaccess rewrite
What code is on your
detail.php
page? So far I think you've given me the code from one page and the debug from another. I need both from the same.business/detail.php
business.html categories part of template
business/category.php
cars/business_listing.html template