Posts by Byron Fitzgerald

    I'm pretty sure you'll have to use a discount code, but you can set it programmatically like

    1. $product_count = // your check for products
    2. if($product_count >= 5) {
    3.     perch_shop_set_discount_code('MULTIBUYDISCOUNT');
    4. } else {
    5.    perch_shop_set_discount_code('');
    6. }

    Setting an empty discount code should remove the discount currently in use

    Is this standard perch or runway? I imagine it will be to do with the rewrite rules, as its typical to only use a-z, A-Z, 0-9, and _ -. The + character is a reserved character in URLs so it shouldn't really be used in a slug. So I guess this is an issue the with the slug field type rather than the rewrite rules.

    Clive Walker is right here.

    The paging shown in the example template is just the standard pagination example, it makes no assumptions as to your URL structure. You could quite easily enough have some URL rewriting so that your search URL was, in which case the template example would work fine.

    You can probably tidy up the template code using the rewrite attribute on the paging tags. The docs for it are here

    I don't think there is a way without creating a custom app or editing the perch_forms runtime file.

    For the most part your idea works, but the form tries to find the attributes to assign a form title. In the perch_forms/runtime file this is the section that is causing the issues (lines 26 - 31)

    1. $attrs = $SubmittedForm->get_form_attributes();
    2. if ($attrs->label()) {
    3. $data['formTitle'] = $attrs->label();
    4. }else{
    5. $data['formTitle'] = PerchUtil::filename($formKey, false);
    6. }

    As $attrs is being returned as null, I think if you just add a null check onto $attrs it should work

    Unfortunately your idea won't work.

    When perch gets the form attributes it fetches the content of the template file, so no template processing occurs. So when perch tries to get the ID it sees

    <perch:form id="<perch:forms id="formID" />" method="post" app="mbk_forms">

    instead of

    <form id="form1_tester" action="/landing-page-3" method="post">.

    This format also happens to break the regex used to find the ID of the form which is why you get the error

    You don't want the $API->on method, as it won't be called until after the form has been processed by the forms_app, which won't happen if you redispatch the form within the closure.

    In your ipltd_filename_form_handler() You'll just need to access the form attributes and rename them, so when you redispatch the form perch_forms handles it in the manner you want. You should be able to fetch the data as $SubmittedForm->data. You could also add an attribute to your file field such, as <perch:input type="file" attribute="timestamp"/> Which you can then access the field with $SubmittedForm->get_attribute_map('timestamp');. That will then return you the field name/ID which should make it easier to edit the data as you need

    It might be the way the arrays are added together? As the items that return a single post will actually be $news[0], so if we just the single items in and update the sort function that could work

    Could you not do what you were doing before then use perch_template to output the results? Should let you use the category tags as well.

    In a MySQL DB ordering is case sensitive and needs to be customised to allow for case insensitive ordering. In raw SQL you'd need to do something like

    1. Select col
    2. from myTable
    3. order by lower(col)

    Though as perch adds quotes to the order column I'm not sure you'd be able to create a query in this manner

    Could be a timezone thing? Your web server is likely running on UTC, so depending on the timezone of whoever created the post it might have published the post in the future according to the server, so it takes an hour or so for the post to match the UTC time

    At the moment Perch Shop uses Omnipay to provide a unified API to manage the different payment gateways. Currently Omnipay doesn't support recurring billing so adding Paypal subscriptions directly to shop would be difficult.

    Your best option would probably be to create a stand alone app to handle subscriptions

    I have a form very similar to yours which works fine, the only differences to your select is I have a name attribute on it. I'm also calling perch_content_custom instead of perch_content

    1. <perch:input type="select" id="position" name="position" class="c-select__field" options="<perch:content id="positions" type="text"/>" allowempty/>

    The perch:input namespace is used to generate form fields, but doesn't handle data passed to the template. You'll need to add a perch:content tag inside you value attribute.

    1. <perch:input id="someid" type="checkbox" value="<perch:content id="edition"/>" />