Forum
Product page in new Shop App
I've been able to create a nice product listing by filtering perch_shop_products();
on SKU, so that I can have certain products appearing in various sections of my main shop page.
I'm ready to move on to the next step of creating a product page that displays the detail of each product, variants, add-to-cart button etc.
I'm hitting a mental block when it comes to linking up the product listing with the actual product page.
in list.html
we have:
<a href="/shop/products/<perch:shop id="slug" type="slug" />/">
<perch:shop id="title" type="text" />
</a>
So with a click I'm taken to localhost/shop/products/my-slug
which does not exist...not surprised, but I feel like I'm missing something very obvious.
I tried a workaround just to get something on the products.php page I created. I changed the link to:
<a href="products.php?slug=<perch:shop id="slug" type="slug" />/"> </a>
If this is the preferred way to go about this (which I doubt), how would I get the products to display based on their slugs?
I've tried a few functions with no success:
perch_shop_product(perch_get('slug'));
perch_shop_product(perch_get('s'));
perch_shop_product('');
php perch_shop_product([
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('slug'),
]);
perch_content_custom(array(
"page" => "/products.php",
"template" => "product.html",
"filter" => "slug",
"match" => "eq",
"value" => perch_get('item'),
));
Thank you so much, I really appreciate the help
Olympia,
I am not sure but looking at the code you posted should
Contain the "php" part?
This may have nothing to do with the problem though.
Are you on Perch or Perch Runway?
I'm on Perch.
Sorry, left out the php parts here...they're there in real life!
So you'll need to add a rewrite rule for
shop/products/product-slug
to point to your page for showing product details.So I've come full circle...
I'm on Runway, routed all out, etc. but still can't get a product page to display properly.
My main shop page has links to various products via /shop/[cat]/[subcat]/[slug] When I select one of those products I want to get to the products.php page for that particular slug.
I'm not returning anything from products.php, having tried lots of functions like
The page is there. When I key in a particular slug, it returns each variation of that product (using the product.html template).
I knew better than to close this thread! Any direction is much appreciated.
route =
shop/[cat]/[subcat]/[slug]
think of it asshop/[1]/[2]/[3]
without assigning names you need to
perch_get()
like this...otherwise with names...
shop/[*:cat]/[*:subcat]/[slug:slug]
Sounds like the key Robert, unfortunately I'm still not returning anything with these..
I've not been able to get Perch Shop Beta, I have been told I was on the Beta list, But I have never been delivered the files.
For this reason I have to do a lot of guessing.
Which build are you using? Gamma 6?
eek, not even close. And I'm sorry I see now that I should be discussing these topics in slack. I'm in the general slack but I don't think I'm in the private shop channel. Would you add me please? very sorry Should I re-request slack?
Yes, send me a message there (drewm) and then I'll have your username to add you.
Drew, Any word on when I might get Gamma Access?