Posts by ellimondo

    Hi


    When you add an image to any edit page then it is generally sized according to the settings in the assigned template. In this case it will probably be templates/blog/post.html. You'd need to edit this template to resize and crop the image to suit your design.


    You can either edit the default field type, or even add multiple field types using the same id and Perch will generate those when you upload an image. This way you can generate, for example, a thumbnail and a main image from the same image at the same time, and use them in different places on your site.


    https://docs.grabaperch.com/templates/field-types/image/

    Hi


    I think you need to speak to the host first if you've got folder permission issues. You're right in saying that the resource folder isn't writable but that won't be down to Perch. You should be able to (re)set the folder permission in the host control panel but sometimes on shared hosting it needs a swift kick from tech support!

    When you say function do you mean nothing shows up in the product edit screen?


    You should get a dropdown menu showing all the categories in the products set. Make use that the set id matches what you've added into the Category app. You can only list categories from one set within one perch:categories pair of tags so you will need to use multiple pairs if you have more than one set of categories.


    As an aside, because product pages tend to be quite complex, it might be easier for you to have one template for editing the products and another for displaying them. Then you don't need to worry about suppress or conditionals cluttering up your product edit template.

    Hi


    I believe your filter value needs to be equal to a Perch field ID. You could try using `'match' => 'regex',` and use a PCRE expression that mirrors your requirement as the value e.g. `^2` – NB I am not good at REGEX so this might not be right for you!

    <perch:showall> is your friend! You'll then see which options are available to that variant with <perch:if exists="variant_id">and create your conditions based upon their existence. You'll need to do this inside the <perch:variants></perch:variants> tag pairing of course.

    Hi


    Are you using this in a content (html) template? <perch:content… can't go in a page (php) template.


    A good way to test it might be to render the image tag outside the section first so the image path displays on the screen and then move it into the section style attribute once you know it's working.


    Also your section and style tag don't look closed to me in your screen grab. It's missing the ')"> but that might just be the image. Best to post the actual code for clarity's sake.


    Jon

    Hi


    This issue has reared its head again – but I've only just seen the error when the site is being edited by the user.


    The template tag is this: <perch:content id="seminar_start" label="Start time" time type="time" format="H:i:s" default="09:00">


    Time is imported using the API as 9:50 into a collection.


    This then saves as 2019-07-29 09:50:00 in the database:


    When the collection item is saved again the field returns this to the initial format. e.g. 9:50


    So the item is now out of order in the listing as the format has changed (to what it should be).


    I can just use a text field as I only need the time but it would be nice if the importer kept to the format set in the template – or alternatively didn't change the actual data format once saved. Is this possible?

    Yeah, thanks hus_hmd , that's what I thought. I build the front-facing page first as the pdf generator was user-facing. However the query and pdf build is so slow I want to move it into the back end. I don't have the time / budget / will to live / left to work on this any longer so I will have to just rely on the scheduled task!

    Hi


    I have a template page that generates a pdf using mpdf library and several Perch collections.


    I now have made a little app that imports a csv to populate those collections. This works great.


    I have set up a schedule task with a function that fetches the page every 12 hours and therefore generates the pdf. This works fine as well.


    I now want to also fetch the page when the import is finished – so that a new pdf is regenerated from the new data.


    When I try to include the page in the app's form page I get the error: Fatal error: Uncaught Error: Call to undefined function perch_collection().


    I guess I can't access runtime functions from an app. So how can I do that? Or am I approaching this from the wrong direction :/? Answers on a postcard much appreciated…

    Your link is relative, meaning that the link will use the current page as its starting point.


    If you start your link with a forward slash <a href="/ then link will use the site's root as its starting point.


    So if you start your link with <a href="/blog/ then the link will always point to the blog folder, which is where your archive page is located.

    Hi Andrew


    I think you probably need to check if the form has been submitted before calling the perch_shop_checkout function.


    I have the following in a checkout page using Stripe - I've only done this once so cannot claim to be an expert (no change there).


    I don't have any additional javascript - I think that's already done with the stripe function in Perch Shop but I'm not 100% sure.


    This bit of code in the head of the page template (before anything else) checks is the member is logged in and gets a token from the form once the user is returned from Stripe. It also controls where the user gets redirected depending on the status of the transaction.

    Then in the body you place


    Code
    1. perch_shop_payment_form('stripe');

    Hi Claus


    Perch won't be able to tell what your CSS is doing to the html. But you can create multiple images from the one image when it is initially uploaded by just using the same ID on multiple tags.


    E.g. The following will output three images with different sizes, all with the same ID. You then just use the different sizes in your template where appropriate. The srcset and sizes options available to the image tag can do this for you without you having to use <perch:if> conditionals. Image options in the Perch docs are here.


    <perch:content id="image" type="image" label="Bild" width="100">

    <perch:content id="image" type="image" label="Bild" width="400">

    <perch:content id="image" type="image" label="Bild" width="800">


    You can use suppress="true" or suppress to stop a field appearing in your template. However, a lot of people use two templates with things like collections. One to use as an edit form in the CMS, and the second to display fields on a webpage. I find it's a much cleaner method of working.


    As to the caption, it's not possible to use the asset title. If you think about it the CMS is creating several files from your original upload so which one would it use? I would recommend you just add the caption as a separate text field to the form.