We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Dynamically List and Display Shop Products By Categories.
I want to have a page /shop that displays a list of product categories. Then when you click on the category it takes you to a page that displays all the products in that category.
I have created a page /shop/category/ that does this for a single category using:
<?php perch_shop_products([ 'category' => 'products/washers', ]); ?>
This works fine.
I want to avoid having to create a new master page for each category and hard coding the product category like this each time.
A: How can I generate the links dynamically for the categories on the /shop page? so shop/category becomes shop/category/washers or shop/washers
B: How can I take the value from the link to dynamically change the perch_shop_products category query?
If this is too general to answer here could we have something similar added to the examples section in the shop docs (I am living in them at the moment) please.
Perch Runway: 2.8.31, PHP: 7.0.10, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO Server OS: Darwin, apache2handler Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_blog (5.0), perch_forms (1.8.3), perch_shop_orders (1.0.8), perch_shop_products (1.0.8), perch_shop (1.0.8), perch_members (1.5) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_blog', 'perch_members', 'perch_shop', ); PERCH_LOGINPATH: /perch PERCH_PATH: /Users/greg/Sites/millers/trunk/perch PERCH_CORE: /Users/greg/Sites/millers/trunk/perch/core PERCH_RESFILEPATH: /Users/greg/Sites/millers/trunk/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M F1: 2edba60ed1f613d6dd804feb202456a2 Resource folder writeable: Yes HTTP_HOST: millers DOCUMENT_ROOT: /Users/greg/Sites/millers/trunk REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Want to reply to this thread?Login with Perch