Forum

Thread tagged as: Question, Problem, Shop

Product Detail

Hi Drew/Rachel & anyone else who can help!

Massive apologies for duplicate posting about this, but I've gone through all the posts I could find on this subject and I can't seem to find a solution that works on my install.

I've got a test product set up in Perch Shop and I've been pulling my hair out trying the detail page to display. I've got the test product to appear in listing pages, so I know it's in there.

Firstly, I've got /shop/products/{slug} in my settings for the product url

I've got an index.php file inside my /shop directory and also in there I've got a product.php file to display the detail.

Here's my list code:

<perch:before>
<section class="products">

<h1><span>Featured Products</span></h1>
<ul class="featured">
</perch:before>
<li>
    <img src="<perch:shop id="image" type="image" width="233" height="168"/>">
    <p><a href="/shop/products/<perch:shop id="slug" type="slug" />/">
        <perch:shop id="title" type="text" />
    </a>
    <p class="price"><perch:shop id="price" type="shop_currency_value" label="Price" divider-before="Pricing" size="m" min="0" step="any" /></p>
    <a href="/shop/products/<perch:shop id="slug" type="slug" />/" class="button">Buy Now</a>
</li>
<perch:after>
</ul>
</section>
</perch:after>

Heres the perch tag I've got on my product.php page

<?php perch_shop_product(perch_get('s'));?>

I'm constantly getting a 404 error whenever links from my listing page are clicked... the url appears like I'd expect it to (www.myurl.com/shop/products/test-test/)

I can view the product if I manually enter the slug in the URL i.e. /shop/product.php?s=test-test

Can anyone see what I've done wrong???

Nik

Nik Gill

Nik Gill 1 points

  • 4 years ago

Heres my Diagnostic report too

Perch: 2.8.34, PHP: 7.0.16, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_shop_orders (1.0.12), perch_shop_products (1.0.12), perch_shop (1.0.12), perch_members (1.5) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_members', 'perch_shop', ); PERCH_LOGINPATH: /admin PERCH_PATH: /home/sites/remixcreative.uk/public_html/theowlbox/admin PERCH_CORE: /home/sites/remixcreative.uk/public_html/theowlbox/admin/core PERCH_RESFILEPATH: /home/sites/remixcreative.uk/public_html/theowlbox/admin/resources Image manipulation: GD PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M F1: 6a33f95eca3667f9e0c39bf5ca2980fe Resource folder writeable: Yes HTTP_HOST: theowlbox.remixcreative.uk DOCUMENT_ROOT: /home/sites/remixcreative.uk/public_html/theowlbox/ REQUEST_URI: /admin/core/settings/diagnostics/ SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you set up a rewrite rule on your server to handle that URL?

No I haven't done anything like that... I'll be honest I've just pieced what I've got here together from forum posts and support docs (probably incorrectly) as I couldn't find anything in the support documents about this.

I've done a rewrite rule on the blog before, is it a similar thing to this?

<IfModule mod_rewrite.c> 
    RewriteEngine On
    RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L]
</IfModule>

I'm not hugely knowledgeable about rewrite rules if I'm honest so any help you can give would be greatly appreciated

Update: I've fixed it up using the following

<a href="/shop/product.php?s=<perch:shop id="slug" type="slug" />" class="button">Buy Now</a>

Which works fine... I guess I'll have to look into URL tidying though

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you don't want to create rewrite rules, then I'd suggest using Runway instead.

Thanks Drew, I've sorted it now.