Posts by AleixNamastech

    I have a category called "location". A location can be California and one of its children is Los Angeles. I want to show the full direction of Los Angeles (Los Angeles, California) and that's my code but it's not working:


    Code
    1. <!-- Child location -->
    2. <perch:categories id="my_location" set="location">
    3. <perch:category id="catTitle" />
    4. </perch:categories>
    5. <!-- Parent location -->
    6. <perch:categories id="my_location" set="location" scope-parent="true">
    7.     <perch:category id="parent.catTitle" />
    8. </perch:categories>

    I found the solution! There are some connection properties which are not possible to define by your API and are necessary to send emails through my email server. I had to add it in the core file perch/core/lib/PerchEmail.class.


    This is what I changed:

    I'm trying to set up the email to send ones through my site, but when I go to Settings/Email to check if all is well implemented I get the following message: ¨SMTP Error: Could not connect to SMTP host¨. At first, I thought the data of the host could be wrong, but I used an online tool (https://www.smtper.net/) to verify it and all the values are right.

    Where is the mistake?




    I have an object with a category price. When a user creates a new instance of this object, it's only allowed to select one value of this category (only one price). When I want to filter my list of objects by price I get “No Results” because the attribute price of the object is an array of length 1 and if I apply a function to each one of the objects of my list mapping the array of prices of length one to an integer it is not used in sorting. It's like sorting is done before this mapping so it cannot sort a list of objects by an attribute of array type.


    This is my code:


    Code
    1. perch_collection('Objects', [
    2.     'each' => function($item) {
    3.         $item["price"] = $item['price'][0];
    4.         return $item;
    5.     },
    6.     'template' => $listing_template,
    7.     'sort' => 'price',
    8.     'sort-order' => 'ASC',
    9.     'sort-type' => 'numeric',
    10. ]);