Posts by hus_hmd

    Hi Tony,


    To filter by a related item's field you use accessories.field_id. And to filter against multiple values, you can use 'match' => 'in':


    Hard-coded:

    PHP
    1. perch_collection('Case Studies', [
    2. 'filter' => 'accessories.slug',
    3. 'match' => 'in',
    4. 'value' => 'some-slug,another-slug,look-a-unicorn',
    5. ]);


    Dynamically:

    Hi Damian,


    Does this only happen in production? Or are you seeing the problem in your development environment too?


    Can you post the first part of your extended diagnostics report? I'm particularly interested in the DB tables section.

    Hi,


    There is more than one way to achieve this, but you can continue using the same approach. Because you are passing the content from outside the Content - Main region, you need to use perch_content_custom():


    PHP
    1. perch_content_custom('Content - Main');



    By the way, you can simplify how you get the region's HTML:


    PHP
    1. // if you have other regions with the same name as the shared region, use perch_content_custom()
    2. $recognition_html = perch_content_custom('martech_recognition', [
    3. 'page' => '*',
    4. ], true);
    5. // otherwise use perch_content()
    6. $recognition_html = perch_content('martech_recognition', true);


    So your code can be simplified into this:

    PHP
    1. $recognition_html = perch_content('martech_recognition', true);
    2. $trusted_by_html = perch_content('Trusted_by', true);
    3. PerchSystem::set_vars([
    4. 'sharedregion_recognition' => $recognition_html,
    5. 'sharedregion_trusted_by' => $trusted_by_html,
    6. ]);
    7. perch_content_custom('Content - Main');


    You don't even need to use PerchSystem::set_vars(). You can use the data option instead:


    PHP
    1. $recognition_html = perch_content('martech_recognition', true);
    2. $trusted_by_html = perch_content('Trusted_by', true);
    3. perch_content_custom('Content - Main', [
    4. 'data' => [
    5. 'sharedregion_recognition' => $recognition_html,
    6. 'sharedregion_trusted_by' => $trusted_by_html,
    7. ]
    8. ]);

    Thanks rachelandrew for taking the time to explain things. We've missed you around here.



    I think at the very least the community would like to see you:

    • Keep Perch compatible with the latest version of PHP, which you and Drew seem very willing to do
    • Communicate with customers


    I honestly don't expect you/Drew to answer site building questions or constantly communicate with us, but there is an expectation from customers to at least get a response from you on threads like this and this.


    I realise Drew does the forum moderation and keeps it free of spam, but it is a bit slower than expected. For context:

    Every now and then someone on the Perchology Slack group mentions they have to wait days (or even over a week) to get their posts approved here. Sometimes they even get help on Slack before their post gets approved.


    I have also started receiving emails from other customers (who are not on Slack) about this, and all I can do is direct them to the Slack group. The last email I got of this kind was on 23 April. The post still hasn't been approved. While I can't examine the contents of the post myself, based on the slug in the URL they sent me it doesn't look like spam.



    While Perch is great, a stable product may not be enough. Even if the product is not being actively developed, you still need to actively run the business including performing the trivial customer-facing tasks.


    My suggestion is that we move those to GitHub under the same account as the docs (they currently live in a private git repo, so that should be easy enough to do) and then if members of the community wish to help fix those issues that's great.

    In the short run I rather see you communicate with customers more (at least when necessary and expected) than manage PRs on GitHub, but open sourcing first-party add-ons sounds like a good idea.

    The function lists the files a logged in customer has purchased. You can use it to list purchased files for all the customer's orders or for a single order:


    PHP
    1. // list purchased files for all customer orders
    2. perch_shop_purchased_files();
    3. // list purchased files for a single order
    4. perch_shop_purchased_files([
    5. 'order' => $orderID,
    6. ]);

    Assuming this is a product template, I don't think that's possible. By the way, shop_brand is the field type not the field ID:

    HTML
    1. <perch:shop id="brand" type="shop_brand" output="image">


    You can add a callback function with the each option to perform the check:

    PHP
    1. perch_shop_product($productSlug, [
    2. 'each' => function($item) {
    3. // check brand image
    4. return $item;
    5. }
    6. ]);

    But it already works with other alias emails with the exact same settings


    Given it works with the other aliases but not this specific one, the issue could be on the email host end.


    I'd still recommend configuring Perch to send emails via SMTP (or an API) to improve email deliverability. You can use your own email host's SMTP or use an email delivery service like SendGrid (100 free emails per day) which gives you the option to send emails via an SMTP or an API.


    The SMTP route is perhaps the easiest because it requires no Perch add-ons. For SendGrid you can use the following configurations:

    PHP
    1. define('PERCH_EMAIL_METHOD', 'smtp');
    2. define('PERCH_EMAIL_HOST', 'smtp.sendgrid.net');
    3. define('PERCH_EMAIL_AUTH', true);
    4. define('PERCH_EMAIL_SECURE', 'tls');
    5. define('PERCH_EMAIL_PORT', 587);
    6. define('PERCH_EMAIL_USERNAME', 'apikey');
    7. // add your API key as the password
    8. define('PERCH_EMAIL_PASSWORD', '');



    Note that if you are using cPanel, many hosts block accessing external SMTPs by default and you'd need to change the settings to allow it.

    Does the incorrect value appear everywhere? Or just when you are outputting a specific region? If the latter, are you outputting the region with perch_content() or perch_content_custom()?

    Hi Scott,


    The Perch Forms app fires the event perch_forms.received when a response is received:


    PHP
    1. $API = new PerchAPI(1.0, 'your_app_id');
    2. $API->on('perch_forms.received', function(PerchSystemEvent $Event){
    3. $formID = $Event->subject['_id'];
    4. $fields = $Event->subject['fields'];
    5. $files = $Event->subject['files'];
    6. });

    Hi Tony,


    I suspect Perch Shop internally relies on the address slug for setting the order address, so it is unlikely to change this behaviour with the current version of the app.

    Hi drewm


    It would be handy if we can use multiple form validators on a single input field.


    A use-case I'm currently dealing with is checking whether a member's phone number is unique and whether it is a valid phone number. While it is possible to perform all checks with a single validator function, it doesn't seem to be possible to have different error messages for each validation type:


    HTML
    1. <perch:error for="phone" type="helper">
    2. A single error message for all custom validation types
    3. </perch:error>



    Perhaps the helper attribute could have a suffix to specify the type:


    Actually, the total variable is added to every single item in the list. This means it can be used in perch:before, perch:after or in between:


    HTML
    1. <perch:before>
    2. <perch:content id="total">
    3. </perch:before>
    4. <perch:content id="total">
    5. <perch:after>
    6. <perch:content id="total">
    7. </perch:after>



    And instead of:


    HTML
    1. <perch:exists="paging"><perch:content id="total"></perch:if>


    Use:


    HTML
    1. <perch:exists="total"><perch:content id="total"></perch:if>