Posts by hus_hmd

    You can reuse the same field uplaod_file:


    Having re-read your initial question, I may have misunderstood what you are trying to do. It sounds like you want to allow the customer to add a comment to the order and have it sent to Perch Shop not Stripe.


    In this case, you are correct in using cart properties. Cart properties should work regardless of the checkout method though. How are you currently adding the cart property?

    Hi,


    but I have to say that this CMS is particularly unforgiving and quite clunky in this respect


    The reason standard Perch is unforgiving when it comes to file paths is the very reason many web designers use it. Perch allows you to turn a static site into a CMS-powered one with ease relative to other options. For Perch to be able to do this, it has to know where the files are. If you move a file, Perch will see it as a different page.


    Key to its ability to be retrofitted to a static site, pages in Perch are file-based. That means when you create a new page within the control panel, a new file for that page is added to your site.



    Perch Runway serves pages dynamically from the database. So it may be a little more forgiving if you have to develop in a sub-folder, but this workflow is not considered a good practice and you should generally avoid it when possible.

    The each option allows you to define a PHP callback function that is applied to each item perch_collection() returns.


    Hi Mat,


    When you use skip-template Perch won't automatically fetch related items or categories. Instead you get their IDs. You can fetch the related items with additional perch_collection() calls.


    Alternatively you can use a Perch template to output the JSON:


    PHP
    1. header('Content-Type: application/json');
    2. perch_collection('Shops', [
    3. 'sort-order' => 'DESC',
    4. 'count' => 10,
    5. 'template' => 'shops/json.html',
    6. ]);


    And format your JSON inside the template. So you can use your perch:related tags in this case.

    would there be any reason to not include all the categories in one category set?

    I always suggest to use what makes more sense to the content structure. If it makes sense in your use-case to have them all in one category set, I'd do that. Otherwise I'd use two sets.


    If tags need to be their own thing, then a second category set makes sense.


    limiting any filtering I might need to do with multiple category sets.

    Using multiple sets won't affect the way Perch filters items by categories. You can filter by multiple categories from different sets at the same time:


    PHP
    1. perch_collection('Blog', [
    2. 'category' => ['blog/news/', 'tags/some-tag-slug/']
    3. ]);

    Hi Stephen,


    I would use categories. You can have 2 category fields if you really need to separate tags from other categories:


    HTML
    1. <perch:categories id="categories" set="blog" label="Categories" />
    2. <perch:categories id="tags" set="tags" label="Tags" />

    Hello,


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


    You can specify a profile with the editor-config attribute:


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


    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,


    I'd probably look into doing the opposite:

    • Write a custom form handler (custom Perch app)
    • Update your form so your custom app handles the responses <perch:form app="chopperoon_app"></perch:form>. You may also need to add a hidden input field for the total score.
    • Calculate the score in your form handler
    • Add the score to the submitted form's data
    • Redispatch to the Perch Forms app to store the response along with the score


    HTML
    1. <perch:form app="chopperoon_app" id="quiz"></perch:form>


    Hi,


    There is a handy app that uses template handlers to make working with translated content easier: https://github.com/ameego/rp_translationhelper


    If your edit template has the following:

    HTML
    1. <perch:content id="name_en" type="text" />
    2. <perch:content id="name_fr" type="text" />


    You can use something like this in your display template:

    HTML
    1. <perch:translate id="name_en" en="name_en" fr="name_fr" />

    but WorldPay isn't redirecting back to the development site

    Is your development site publicly accessible?

    From what I remember WorldPay does NOT redirect back to the site. Instead they fetch your success page's HTML and display it themselves. I think they even remove any Javascript from the page. So the success page is not actually displayed on your site.

    Your success page need to be publicly accessible so WorldPay can fetch and display it. If you link to any resources (CSS, images, etc) on that page, you need to use full URLs because in this context they are external resources:

    HTML
    1. <link rel="stylesheet" type="text/css" href="https://example.com/assets/styles.css">



    I would suggest you keep this page extremely simple and include a link to allow the user to return to your site.