Forum
Shop product data will not display inside a perch conditional filtered by catego...
Hi all,
I'm trying to get some product specific data to display inside a perch conditional. The template code I'm using is
<perch:categories id="category" set="products">
<perch:if id="catPath" value="products/sparkling-presss/">
<h3>Ingredients</h3>
<p>
<perch:shop id="ingredients" />
</p>
</perch:if>
</perch:categories>
I know the conditional statement is working correctly because the h3
tag only appears for products in the category with catPath
= products/sparkling-presss/
.
I've also confirmed that <perch:shop id="ingredients" />
shows the correct text string if it's placed outside of the conditional statement.
Would appreciate any ideas to solve this please.
Diagnostics report
Health check
Perch is up to date
PHP 5.6.9-1+deb.sury.org~trusty+2 is up to date
MySQL 5.6.10 is up to date
No image processing library. Consider installing GD or ImageMagick for resizing images.
File upload size is low. You can only upload files up to 2M.
Summary information
Perch: 2.8.34, PHP: 5.6.9-1+deb.sury.org~trusty+2, MySQL: 5.5.49, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), jw_activity_log (1.0.0), perch_shop_orders (1.0.10), perch_shop_products (1.0.10), perch_shop (1.0.10), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /vagrant/www/kingsdownwater/public_html/perch
PERCH_CORE: /vagrant/www/kingsdownwater/public_html/perch/core
PERCH_RESFILEPATH: /vagrant/www/kingsdownwater/public_html/perch/resources
Image manipulation:
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
Resource folder writeable: Yes
HTTP_HOST: kingsdownwater.dev
DOCUMENT_ROOT: /vagrant/www/kingsdownwater/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Have you checked the debug output for that page, to see what queries are being run against the database?
To use that within the scope of the categories tags, you'll need to set
scope-parent="true"
and then useparent.ingredients
Thanks for your help Duncan.
I'm a designer not a developer - I can follow each line the debug message but don't know how to tell if it's working as expected. The pages, shop cart, shop product, categories, and shop currency tables are all being queried:
Hi Martin,
I certainly couldn't declare I know everything that is being reported in the debug - but sometimes something will jump out - a blatant error (in red) or no reference to the value you're expecting to see etc.
I've learned something from Drew's answer - everyday is a school day!
Thanks for your help Drew - I missed your reply while writing my own.
I've added your solution to my code (and looked up other
scope-parent
documentation) but I'm still experiencing the same issue. The revised code isIs there something I'm missing? I'm working with Perch, not Runway btw.
Thanks again for your help.
What does
<perch:showall />
output?Your
perch:shop
tag might need to be aperch:category
tag.showall
will tell you that.Thanks so much Drew.
Your last suggestion was absolutely correct.
showall
returnedperch_namespace: perch:category
I've got this working now and will also add
<perch:showall />
to my standard debug procedure.Thanks again.
I should also have said, please mark this thread as answered :-)