Forum
Can't access custom template with perch_shop_custom or perch_shop_product array.
Diagnostics report
HEALTH CHECK
PHP 5.5.38 is up to date
MySQL 5.6.36-82.0-log is up to date
Image processing available
SUMMARY INFORMATION
Perch: 2.8.34, PHP: 5.5.38, MySQL: 5.1.73, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_blog (4.6), perch_shop_paypal (1.2.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_shop_paypal', 'perch_blog', 'kirk_admin_links', ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /chroot/home/ultrabre/ultrabreezesuits.com/html/perch
PERCH_CORE: /chroot/home/ultrabre/ultrabreezesuits.com/html/perch/core
PERCH_RESFILEPATH: /chroot/home/ultrabre/ultrabreezesuits.com/html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 64M, Max POST 64M, Memory: 512M, Total max file upload: 64M
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
Resource folder writeable: Yes
HTTP_HOST: www.ultrabreezesuits.com
DOCUMENT_ROOT: /home/ultrabre/ultrabreezesuits.com/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
I can retrieve individual products using this:
<?php
perch_shop_product(perch_get('s'), [
// 'template' => 'shop/product.html',
]);
?>
But if I uncomment the template reference, the product-specific content disappears. I've tried various incarnations of the path but nothing seems to work. I'm not sure if I'm missing something or if something is turned off.
Kyle, I am thinking you only need the template name here, not the directory. Try that while I go and look it up, cause I am drawing a blank here.
Yes, you only need the template name, unless you have changed the template directory to be below /perch/templates/shop...
documentation
https://docs.grabaperch.com/functions/shop/products/perch-shop-product/
If you turn on debug you should get an error showing the template path that is being used.
I thought so too, and tried that before also but no luck. I tried it again with Debug Mode running and I'm not seeing anything I recognize as an error.
Each
Using template:
line shows you which templates are being used.The templates listed are the same in both cases. This is the Debug code for the page when I don't try to specify a template:
I'm still not seeing any difference.
How are you setting the template? The only example you've shown has the option commented out.
I've tried all of these individually:
Hello Kyle,
If you are using Perch's default templates for the Shop App, I believe the default file is
/perch/templates/shop/products/product.html
.I think
perch_shop_product()
looks at/perch/templates/shop
by default when you use thetemplate
option, so you still have to specify sub-directories:but it doesn't.
Umm, plus the debug message would tell you if the template couldn't be found. So I guess this rules out an incorrect path.
Can you show us your template?
Absolutely. This is product.html:
What path is this saved as?
public_html/perch/templates/shop/product.html
That looks correct to me.
That's why I posted here. Is there a way to use another function similar to perch_layout to achieve the same thing? I know perch_layout is working for pulling in the global templates, I just don't know if there's another way I could code it.
Looking at your template I see you haven't self-closed several
<perch:input />
tags:I closed all tags and same issue. I've also replaced the perch_shop_paypal (1.2.3) app with a fresh version and tried removing everything from the product.html template except an HTML comment and tried all paths above. Still nothing.
Ah, I didn't realise you were on the old PayPal Shop app, not Perch Shop. That app is deprecated and no longer supported.
It was in my diagnostics report in the very first post. Sorry for the inconvenience.