Posts by hus_hmd

    In comparison to a Region, a Collection isn't tied to a page so I understand why there isn't a run time function for creating a Collection like perch_collection_create(). A single file where you can define all the (default) Collections makes more sense to me.

    Hello,


    One of the things I love about Perch is I don't have to go to the control panel to get things done. Examples:


    • Perch templates define the content schema - I don't need to do that via the control panel
    • perch_content_create() allows me to create a region with some default options


    A part of me wishes I could achieve more from the code editor without having to log into the control panel.


    Although Collections is a big selling point of Runway, you have to create a Collection via a control panel. It would be nice if we can create Collections and set some default options (template, item URL, sort by, sort order, etc) from a file e.g. /perch/config/collections.php.


    Another big feature in Runway is Routing, yet you also have to add them via the control panel. Not sure how feasible this would be, but if given the option, I would prefer to register routes from the master page templates:


    PHP
    1. PerchSystem::register_page_route('services/[slug:s]');


    Or from a single file:




    Why?

    Managing these settings/options from the codebase would enable us to version control them.


    This would also make working in teams with other developers smoother. I end up having to add these settings locally and on staging to make them accessible to other developers. Developers still have to copy those to their local environments (of course they will miss something) or at least download the database from staging (it can overwrite what they were working on).


    When it comes to routes, it would be a lot easier to add multiple URL patterns in one go to a file instead of adding one, save it, add another, save, etc. A client site has now ~50 URL patterns.





    These are just thoughts. Perhaps others don't agree with me. Perhaps it's not practical to change the current implementation. Or perhaps this is already addressed in v4?

    Hi Andy,


    You are loading your CSS and JS assets over http:


    HTML
    1. <link rel="stylesheet" href="http://www.mainesurfacefinishing.com/css/reset.css" />


    You can omit the domain when serving assets from the same domain:


    HTML
    1. <link rel="stylesheet" href="/css/reset.css" />

    One option would be for the content editor to navigate to Assets, find the file they want, grab the file's URL and then go back to the Event and add it as a regular link in the textarea field.


    If Blocks are supported by the Events app, this would be another option for you to consider.

    Hello,


    Not sure whether the indexing mechanism is going to change in v4, but if it remains the same, it may be a good idea to have the no-index attribute supported by default. This would give developers greater control on what gets indexed when building sites using add-ons


    e.g. Perch Shop seems to index all product fields including custom fields and the no-index attribute has no effect.

    Yes, you can do this with page attributes and a little bit of PHP: https://grabapipit.com/blog/drafting-at-the-page-level


    If you prefer to write less PHP you can install the Pipit app and use the pipit_perch_user_logged_in() function:


    PHP
    1. // get the page status
    2. $page_status = perch_page_attribute('status', [], true);
    3. if($page_status == 'draft' && !pipit_perch_user_logged_in()) {
    4. // page is draft and user is not logged into Perch control panel
    5. }


    If you are using Runway, you can use your 404 page like so:


    PHP
    1. if($page_status == 'draft' && !pipit_perch_user_logged_in()) {
    2. PerchSystem::use_error_page(404);
    3. exit;
    4. }


    I don't think you can use PerchSystem::use_error_page() on standard Perch. You can redirect to the 404 if you're ok with that. This doesn't respond with a 404 code though.


    PHP
    1. if($page_status == 'draft' && !pipit_perch_user_logged_in()) {
    2. PerchSystem::redirect('/404.php');
    3. }



    Or you can use PHP's http_response_code() to set the HTTP response code and then output you not found message:

    PHP
    1. if($page_status == 'draft' && !pipit_perch_user_logged_in()) {
    2. http_response_code(404);
    3. // display your not found message from a Perch Layout
    4. perch_layout('404');
    5. exit;
    6. }

    Hi James,




    Product customisation

    If the flavours do not affect the pricing, product customisation could be a good solution for this so you can customise each pack. Unfortunately this feature is not yet available in Shop.



    Product options/variants

    I don't think product options/variants would be a suitable for this (assuming the product itself is a package). If you add an Option for flavours and add all the flavours as the Option values, the customer can only select one flavour for the whole package.

    I think you would need to add 12 Options (to match the 12 slots) and add the same flavours as values for all the Options. This would work and allow the customer to select 12 flavours per package, but it may not be great to manage in the back-end.


    Cart properties

    Another option would be to add the flavours as cart properties, but this may be tricky to implement; the customer may order more than one package, but the cart properties are applied to the order and not per product.



    Cupcake as the product?

    You can have the cupcake as the product (and flavours as an Option). The front-end can present this as a package and ask the customer to add a flavoured cupcake per slot in the package. This may also be tricky to implement to account for customers ordering multiple packages.

    Hi,


    I fail to see how this would be helpful to the editor. When an editor adds a new block, I think it makes sense to display the fields to them right away.


    And blocks are already collapsible. You cannot set them to be collapsed by default though.