and also confirm if this master template code is correct?
Let's focus on the main subject of the thread which is getting the product detail page to work. There's nothing on there I see that would cause a 404, if that's what you're asking.
Okay well I'm stumped as to why I keep getting 404s. Would the website having an SSL cert installed affect this? The perch config file is reflected to recognise this + other static pages have the
<?php PerchSystem::force_ssl(); ?>
Can the pages app be affected by this? I appears to load as a HTTPS on the browser, just doesn't load the template.
Hi Hussein, I've managed to resolve the 404 error. It was actually an incorrectly named .htaccess file was the culprit.
So , managing to get the page created. The basic /shop/product.php template page is displaying okay, however when I click into a slug page i.e. /shop/products/slug/ it throws up the following debug error:
Debug Message - Perch Runway 3.1.2
[9] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC
Matched pageless route: shop/products/[slug:product]
Using master page: /templates/pages/product.php
Page arguments:
Array
(
[0] => /shop/products/lir-desert-box-145g
[product] => lir-desert-box-145g
[1] => lir-desert-box-145g
)
[46] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_shop_cart WHERE cartID=254
[1] SELECT * FROM perch3_shop_cart WHERE cartID=254
[nil] SELECT * FROM perch3_shop_sales WHERE saleFrom<='2018-09-03 14:39:00' AND saleTo>'2018-09-03 14:39:00' AND saleActive=1 AND saleDeleted IS NULL ORDER BY saleOrder ASC
Request time: 0.1104
Process time: 0.1094
Memory: 2.1209
Array
(
[type] => 2
[message] => include(): Failed opening '/var/www/vhosts/142/1004491/webspace/httpdocs/perch/templates/pages/product.php' for inclusion (include_path='.:/opt/alt/php71/usr/share/pear')
[file] => /var/www/vhosts/142/1004491/webspace/httpdocs/perch/core/runway/start.php
[line] => 43
)
Actually, ignore the above...! :) I renamed the master pages earlier template as it was causing confusion. This is working now, only the actual /shop/products/slug/ is loading without it's css styling applied.
Your paths should start with slash e.g. src="/images/lir-master-light-horiz2.png"
Okay! that's my bad :) fixed now to root.
If you refresh that SKU page, you'll notice the page loads fine but the actual SKU still doesn't load as expected.
Do I now need to adjust the below array by passing in my template for this 'product_detail.html'
<?php perch_shop_product(perch_get('product'));?>
or is it the product.html template that I need to alter? I basically just want it to render the title, image, description and buy-now button
This is what my product_detail template looks like:
Hussein, you've been a massive help! Thank you for your patience.
It's pretty much there now. Just need to figure out minor things like why the product image is not displaying and why the description is wrapping <p> tags
any ideas on the image?
The path doesn't need an extension, so you can use
/shop/product.php
.Again if you want your product URL to be
/shop/products/product-slug
your URL pattern should beshop/products/[slug:product]
.The problem still remains. I don't think it's getting to use the master template correctly to be honest...
Can you advise why the debug states: "Using template: /templates/pages/attributes/default.html"
and also confirm if this master template code is correct?
According to this article you do need to include the string?? https://docs.grabaperch.com/perch/pages-and-nav/pages/master-pages/
This refers to the page attributes template.
Let's focus on the main subject of the thread which is getting the product detail page to work. There's nothing on there I see that would cause a 404, if that's what you're asking.
Okay well I'm stumped as to why I keep getting 404s. Would the website having an SSL cert installed affect this? The perch config file is reflected to recognise this + other static pages have the
Can the pages app be affected by this? I appears to load as a HTTPS on the browser, just doesn't load the template.
Hi Hussein, I've managed to resolve the 404 error. It was actually an incorrectly named .htaccess file was the culprit. So , managing to get the page created. The basic /shop/product.php template page is displaying okay, however when I click into a slug page i.e. /shop/products/slug/ it throws up the following debug error:
Actually, ignore the above...! :) I renamed the master pages earlier template as it was causing confusion. This is working now, only the actual /shop/products/slug/ is loading without it's css styling applied.
Ok great!
Use the full path for the CSS, e.g.:
Actually, I don't think it's CSS, there's still something odd going on here:
Product page created on template loads perfect: https://www.lirchocolates.com/shop/product.php
Slug page within this is loading with broken elements. Inspect window suggests more 404 errors: https://www.lirchocolates.com/shop/products/lir-desert-box-145g/
How come the template page is now loading good but not the slug page?
You have CSS links like this:
which need to be root-relative so that they work at any level in the site:
You are using relative paths:
Your paths should start with slash e.g.
src="/images/lir-master-light-horiz2.png"
or is it the product.html template that I need to alter? I basically just want it to render the title, image, description and buy-now button
This is what my product_detail template looks like:
I suppose to simplify my question.... currently it's set to
How do I now tell Perch to pull specific info from a product template called product_detail.html? Do I still need to call that ('product') variable?
Assuming your template is
templates/shop/products/product_detail.html
:Hussein, you've been a massive help! Thank you for your patience. It's pretty much there now. Just need to figure out minor things like why the product image is not displaying and why the description is wrapping <p> tags any ideas on the image?
detail template
list template
You are missing a quote in your image tag. It should be: