Forum
Getting Started in Perch Shop
I'm struggling to get going with the official Perch shop APP.
I downloaded the latest Runway and Shop APP and have them installed running locally through MAMP.
I followed the installation process, worked through the checklist and have added products.
Starting at a very basic Level I added the following code to a page template and created a page:
perch_shop_products();
This shows me a list of the products, however when clicking on the product name I get a "Sorry, that page could not be found." message.
Am I missing something here?
That's an HTTP 404 message, which means either the link is wrong, or the page you're linking to is missing.
Which is it for your site?
Hello Drew,
Not sure what you mean by page? I'm using Perch Runway and Shop APP, when creating the product it automatically generates the slug.
I display the list of products as above which correctly calls in the name. However the link doesn't work.
The homepage displays fine, and there isn't an index file in the root folder?
Clicking the add to cart button also returns the same error.
I think perhaps the Shop app is going to prove difficult to implement. It's the most complex add-on we have, and does require reasonable experience in developing dynamic sites. If you're not yet confident with concepts like pages and diagnosing a 404 error, it's going to be an uphill struggle.
Making slow progress, I have created a cart page which successfully shows the product being added into the cart.
How do I create the standard product view showing the product itself?
The examples show how to create a view by passing the product slug into the function, but I don't think I'm supposed to create a product in the shop section and then create and individual page to show that product separately or am I?
Hello Drew,
I'd like to give it more of a shot, if you're happy to help me over this initial hurdle?
You'd create a single, dynamic page for displaying the details of any product. You'd get the slug of the product from the URL, using
perch_get()
https://docs.grabaperch.com/functions/utilities/perch-get/
Thanks Drew,
I'm on the right path, albeit with ugly URLs showing parameters:
Then the product page:
I found a separate support issue that links to your 24 ways url rewriting article. If I can crack that to get SEO friendly URLs, it will be the biggest problem out of the way.
In Runway you can use routes. https://docs.grabaperch.com/runway/routing/
Thanks Drew,
I created a route on the product page:
I edited the link on the list template:
However this returns a 404.
Can you give us a head start please, if you show me how to get the above example working I can work it out from there for future ones.
Which isn't working, the route or the link?
I'm a little further forward, I've got the route working, this now show the product.php template correctly.
However I'm struggling to get the current slug into the perch_shop_product part of the product.php template.
Gives me the error:
It's definitely in there somewhere as if I type it in manually and use perch:showall it gives me a table and 'slug' is detailed correctly.
You've got
[
and]
in there instead of'
Tried that and it returned nothing?
Returns no errors but no results.
Can you show us the actual url of the page that returns no errors or results?
It's a local page, best thing I can do is show you a screen shot, I've tried to include everything:
https://www.sixtillnine.co.uk/screenShot.png
You'll see the manually typed section works fine, I just can't get the slug out of the url?
Change your route (
slug
defines the token, not the name)The use
That worked!
Is the slug treated differently for products or is this something I have to bear in mind for other page types?