Posts by Byron Fitzgerald

    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

    It might be that the asset is still be used by previous revisions of the content region (for the undo functionality). Once the asset is no longer used by the revisions, the asset should be available for cleanup. You can alter this by adding this to your perch config, define(PERCH_UNDO_BUFFER, 'Value') where the value is the total revisions (defaults to 30). I don't think this will retro actively delete revisions however.

    The select_field allows for, multiple inputs, below is an example

    Code
    1. $class = 'input-simple categories ' . $this->Tag->size('xxl');
    2. $multiple = true;
    3. $Form->select($input_id, $opts, $value, $class, $multiple, $attributes);

    You could potentially add a category set field to your page attributes template. This should then be accessible through perch navigation function, and then rather than using the subitems tag you can just loop through the categories instead.