Posts by splendid_rob

    I'm having an issue with sorting products by date in perch shop. I have added a date field to product.html but sorting either ASC or DESC doesnt seem to work. I feel it is something to do with the way the date is formatted as they do take a certain order it just isn't that of ascending date!


    product.html:

    Code
    1. <perch:shop id="course_end_date" type="date" label="Course End Date" order="3" native required />

    product-card.html:

    product-list.php:

    PHP
    1. <?php
    2. perch_shop_products([
    3. 'template' => 'products/product-card.html',
    4. 'page' => '/index.php',
    5. 'sort' => 'course_end_date',
    6. 'sort-order' => 'DESC',
    7. 'sort-type' => 'numeric',
    8. ]);
    9. ?>

    Is there a way to check if a region is outputting anything if that regions template is being filtered via an if statement?


    I am filtering the template via a date selector as it is a list of courses. So any courses in the past are not output. However if there are no courses output on the page then I want to display a message saying no courses currently available please contact blah blah, rather than just an empty space.


    Courses page:

    Product Card template:

    Any help muchly appreciated. Many thanks!