Posts by Mxkert


    Is there a way to implement a sorting-system in a Perch App.

    I am using the following code to put all the events in an object:

    1. $Events = new MikeEvents_Events($API);
    2. $events = array();
    3. $events = $Events->all();

    Now I would like to sort $events by, for example the eventTitle field before outputting the events.

    I got it! First I had to obviously put all the dynamicFields into an array, then edit the price field and then putting it back into the array:

    (I also indexed the product)

    My only problem now is that the price in the dynamicFields is as follows: 120.45, but when I edit the product in Perch it has a comma: 120,45.

    I checked the EUR currency, but the Decimal point character has . in Perch.

    EDIT: On the product listing in Perch (/perch/addons/apps/perch_shop_products/) it is written as 120.45, but when editting the product in the template it is written as 120,45...


    1. <perch:shop id="price" type="shop_currency_value" label="Prijs" size="s" min="0" step="any" divider-before="Prijzen"/>


    As mentioned by Clive in this forum post, "textareas are wiped when the member profile is edited by an admin". Does anyone know a solution to prevent this from happening?

    I created a textarea field in the profile.html template. When updating that field through this form, the field gets updated but as soon as I check the member in the Members app, the field gets wiped.



    I would like to update the price of products using the update function. Prices are stored in the productDynamicFields, using the following JSON structure:

    1. "price": {"44": 34.50, "_default": 34.50}

    I tried the follow code, but this wipes the rest of the productDynamicFields and is not updating the price either:

    Is there a way to update the price by using the update function?


    Creating the template:

    1. Create a HTML-file in the folder /perch/templates/content/. For example text_region.html;
    2. Put a textarea in that file, for example: <perch:content id="text" type="textarea" label="Text" editor="ckeditor" html>;

      Using the template on a page:
    3. Refresh the page in the browser on which you put that code (perch_content('Intro'););
    4. Then head over to the Perch dashboard;
    5. Now on the page overview you will see your page with a region behind it;
    6. Click the region
    7. Select your created template;
    8. Start editing and save;
    9. Check your page in the browser.

    NOTE: You don't need to install CKEditor to create a textarea, Perch has a few editors built in it's core. You could for example use editor="redactor in your textarea template.

    Thanks for thinking along. What would you consider a large number of products?

    It is a shop with mobile devices, so for example 13 iPhones, with some iPhones having 18 variants. That is quite a lot, right?

    EDIT: The largest page has 98 products.

    EDIT EDIT: The main reason for the pagination would be for faster page loads (is this even true?). The main action should be to start filtering, so less products will display eventually when filtered. Would lazy loading the products on scroll be a good solution for faster page speed? So they won't be fully loaded on page load.

    I was thinking the same. But I thought perch_shop_product_variants() was only for a specific product. It says: Display a list of product variants for a given product with perch_shop_product_variants().

    I will look into this, thanks for your response.


    In my shop I would like to output 12 products per page. I am outputting my products with variants, using:

    1. $opts = $default_opts = [
    2. 'variants' => true,
    3. 'paginate' => true,
    4. 'page-links' => true,
    5. 'page-link-style' => 'all',
    6. 'count' => 12,
    7. ];

    So now when I am for example using 'count' => 12 it is outputting all the variants of 12 parent products, but I would like to output 12 variants in total and push the rest to the next page.

    Is there a way to use the count option on the variants instead of the parent product?