Posts by Byron Fitzgerald

    If you are using perch_layout to include your footer, you can always pass a variable from the master page, and then check in the footer for the variable.


    In you page template

    Code
    1. perch_layout('global/footer', [
    2. 'showScript' => true
    3. ])

    In your footer

    PHP
    1. <?php if(perch_layout_has('showScript')) : ?>
    2. <script>
    3. // do stuff
    4. </script>
    5. <?php endif;?>

    From what I'm aware of you can't access repeater or blocks namespaces inside the related namespace.


    Your best option is to get the related content from a separate template and store the response as a variable and then output that in your current template.

    Then you should be able to access the HTML with

    Code
    1. <perch:content id="catHTML" html="true" />

    There will most definitely be mistakes with what I've provided above, but the idea should work.

    You can use the data option to pass extra variables into your template

    Should work, but if the perch_shop_products function doesn't accept the data option, its just a shortcut for the following,

    Code
    1. PerchSystem::set_var('categoryTitle', perch_get('cat'));

    I think its because you are using 'match' => 'eq', which is doesn't work with multiple items. you can try the following,


    Code
    1. perch_categories([
    2.     'set' => 'content-type',
    3.     'template' => 'menu',
    4.     'filter' => 'catSlug',
    5.     'match' => 'in',
    6.     'value' => ['case-studies', 'publications', 'resources'],
    7. ]);

    I prefer using slug, as you've already passed the set in. If it still expects a string the following should work

    Code
    1. perch_categories([
    2. 'set' => 'content-type',
    3. 'template' => 'menu',
    4. 'filter' => 'catSlug',
    5. 'match' => 'in',
    6. 'value' => 'case-studies, publications, resources',
    7. ]);

    It should be safe to clear the cart entries, as there are often a lot of empty carts. These are the queries we run to clean up the cart tables.


    SQL
    1. SELECT * FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "";
    2. SELECT * FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "" LIMIT 100000;
    3. DELETE FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "" LIMIT 100000;

    We limit to 100000 as otherwise it often crashes the database.


    As for other tables I'd be uncertain whether it would be safe to remove entries.

    Rather than skipping the template and returning raw, you can just make a perch template to output the XML.


    Haven't seen your template but here is a best guess for a possible solution

    You should be able to use an array of collections as the key.


    Code
    1. perch_collection([
    2.         'Blog',
    3.         'Case Studies',
    4.         'Publications',
    5.         ''Resources'
    6.     ], [
    7.     'template' => 'blog-template.html',
    8.     'category' => perch_get('cat'),
    9. ]);

    Although this might not work with MySQL 5.7 as standard, due to strict mode, though you should be able to update the settings as required

    Easiest option would be to set up some tags for verified and un verified. If the user is unverified redirect them to a regular perch form, (you can prefill in any info in hidden fields) and then a user can upload a file that way. Once received you can update the tags manually.

    I believe the clean up occurs on save of a region/collection, so I can only guess that without it being saved in a region it won't be subject to the same clean up rules.


    You could always use a collection or a multiple item region to add the files, and then provide a url from there. Otherwise I think you'll have to manually remove the assets