Posts by hus_hmd

    Hi,


    How can I specify different buttons and formatting, etc according to the size value I add to the textarea in the template?


    You would use the editor-config attribute for this.


    HTML
    1. <perch:content id="text" type="textarea" label="Text" editor="redactor" editor-config="minimal" html>


    You can access the value of the editor-config attribute in your custom configuration file:


    JavaScript
    1. var get = function(profile, config, field) {
    2. if(profile == 'minimal') {
    3. // hide some buttons
    4. config.buttonsHide = ['link', 'bold'];
    5. }
    6. return config;
    7. };

    Hi Daniel,


    Is there anything specific you would like to know about Perch in order to be able to compare the two products better?


    You can watch the video tutorials which could give you a better idea on what it's like to develop a site with Perch.

    The format you need for filtering does not have to match the date format in the template. It needs to match the format in the database.


    Does the following format work for filtering?


    PHP
    1. $today = date('Y-m-d');

    You don't need to have the filtering logic in PHP and the template. That is, you don't need the conditional tag perch:if if you are filtering with perch_content_custom().


    Also, your $today variable shouldn't have quotes around the date() function. It is also not in the correct format. Try:


    PHP
    1. $today = date('Y-m-d');

    Hello,


    perch_shop_checkout() handles failed payments too.


    I think the ideal approach would be to write a Perch app that listens to the event Perch Shop fires when an order was successfully paid for. You can learn more about event hooks in the documentation.


    Another option would be to use perch_shop_order_successful() to check for a successful order (in your successful payment page for example).


    PHP
    1. if (perch_shop_order_successful()) {
    2. // you have a successful order
    3. }


    Though I think this may evaluate to true for the duration of the user's session. So if the user refreshes the successful payment page, you may be posting duplicate purchases to your marketing/analytics tool.

    Hi,


    I don't think you can filter on blocks. This is not what blocks are for anyway. Fields that essentially define an item (e.g. event date, event title, event slug, categories) shouldn't really be in blocks.


    Try moving the date field outside of your <perch:blocks></perch:blocks>.

    That sounds like a sensible approach. A more powerful perch:if tag would be appreciated regardless.


    I understand not wanting to add this to the app even though I see this as a common use case (any shop that has products with finite stock?).


    It's achievable as is anyway. I wrote a small helper app with a function I can use where necessary:


    Hi,


    I like how Perch Shop allows us to set both a stock status and the stock level. It would be nice if there was a variable that indicates whether a product can be ordered.


    To evaluate whether a product can be ordered, one would have to check the stock status and the stock level. And if the stock status is unlimited, then the stock level shouldn't be taken into account. And if a product has variants, this check needs to be performed for all variants to determine whether this product can be ordered.


    Attempting to perform these checks with conditional tags inside the template would be messy. The alternative would be to perform the check in the each option when using perch_shop_products() or perch_shop_product().


    So I think it makes sense for Perch Shop to evaluate this and return a variable like orderable. This would make things much easier:


    HTML
    1. <perch:if exists="orderable">
    2. <!--* Add to cart form *-->
    3. <perch:else>
    4. <!--* No stock message *-->
    5. <perch:if id="stock_status" value="5">
    6. This product has been discontinued.
    7. <perch:else>
    8. This product is out of stock.
    9. </perch:if>
    10. </perch:if>


    It would also be nice to be able to filter by this:


    PHP
    1. perch_shop_products([
    2. 'filter' => 'orderable',
    3. 'match' => 'eq',
    4. 'value' => 1
    5. ]);

    Hi,


    • Is PHP error reporting enabled? If not, enabling it here can be helpful.
    • Is this on a regular page? If so, turn on debug mode and check the debug message at the bottom for any warnings or errors.
    • Have you finished configuring Perch Shop (setting up products category set, brands, etc)? I think you generally need to do this before adding products
    • I know this sounds silly, but since you haven't shared the whole file we have no way of knowing. Are you calling the function addProducts() anywhere on the page?

    It looks like the Blog app search handler does not return the blog slug.


    So a workaround would be to check whether the result source is PerchBlog, grab the post slug from the incomplete result URL and then get the correct post URL using the slug.


    You can't use the each option with perch_content_search() as far as I'm aware. The other possible approaches I can think of here are using a template filter or a layout include.



    With a layout include, your template would be something like this:


    HTML
    1. <a href="<perch:layout path="search_result_url" url="<perch:search id="result_url">" source="<perch:search id="source">">" >
    2. <perch:search id="result_title">
    3. </a>


    And your /perch/layouts/search_result_url.php would be something like:




    If you are comfortable writing a template filter, your template would be easier to read:


    HTML
    1. <a href="<perch:search id="result_url" filter="searchurl">" >
    2. <perch:search id="result_title">
    3. </a>

    Hello,


    It would be useful if the Members app fired an event when a member's details are updated. This would allow a third-party Perch app to keep members details in sync with a third-party service.

    Thanks for taking the time to explain this, Drew.


    This is the first time I'm sending emails via Office365. HESK's documentation for setting up Office365 SMTP suggested the from email address should match the SMTP username and that has indeed solved the issue.


    So perhaps this is specific to Office365.

    Hi,


    I'm getting a SMTP error when testing emails via the control panel.


    What does the error "SMTP Error: data not accepted" mean? Does it mean Perch successfully connected to the SMTP server, but the server rejected the data?

    Hi Richard,


    I think you'll have to perform the check outside of the template. One option would be to use of the each option:




    HTML
    1. <perch:if exists="all_past">
    2.     <!--* your message *-->
    3. </perch:if>