Forum
Product Detail page
how do i redirect to a product detail page? when using the tag: perch_shop_products();
using this:
perch_shop_product('test', [
'template' => 'shop/products/product.html'
]);
and getting this: Sorry, that page could not be found.
And how to make it dynamically? Using the product slug?
Sorry, do you mean how do you link to the product detail page from the listing?
What's the URL of the product detail page?
Yes And i created a page called: Products
Want to navigate to product detail page when clicking on the product (Test)
You need to create a page, then use perch_shop_product() on that page passing in the slug from the QueryString:
https://docs.grabaperch.com/addons/shop/products/functions/perch-shop-product/
Your listing needs to link to that page from the template. Editing Shop templates is the same as editing any other Perch templates - copy them into
perch/templates
and edit them or add your own.Found more info here: https://solutions.grabaperch.com/architecture/how-do-i-create-list-detail-pages
I am still having issues with this, I must be missing something obvious. I am not a php dev, so may explain it.
So I have created a page for the 'product listing’ & 'product detail page’ which sit in a folder called shop within the root both use their respective default functions & default templates just while I learn the shop ropes.
If I test each page in the browser all is OK, in that they both fire their respective templates, the product lists shows all products, the product detail shows a product if I add a slug, or all products in a bit more detail if none parsed.
So to rephrase this thread, how do I pass the ‘slug’ as a query to the product_shop_product() function from the listing page once I click on the product link.
As Rachel mentioned I need to tell the list.html <a> element to look for the product details page, the default template is
I updated to this
I have blog installed and no issues setting that up, I looked at how that handles passing the query from the blog/index.php to blog/post.php so tried something similar like this perch_shop_product(perch_get('s')); and tweaking the template, but I’m just missing something obvious I know it!
Any help appreciated
@Mike
You running Perch or Perch Runway?, I use Runway
I solved it with token (https://docs.grabaperch.com/runway/routing/custom-tokens/)
I'm on standard perch
Ok thanks Ali, I will take a look. I need to buy a dev runway licence anyway, so think I will do that and start afresh rather than mess up my other installs.
yeah, i think its better, runway is way better then old perch :) you can do a lot more stuff :)
i have this setting:
then go to the product page via dashboard and click Page Options And in the URL pattern, you then add:
that should work, it worked for me :)