Posts by Mxkert

    Thank you, I will try it out this evening!

    Next time I will create the issue on Github. My line of thought was that you often hang around here and maybe it could be an issue related to my Perch config's or something in that direction.

    I will let you know here if it worked for me.



    I am trying to use the Cognetif ApiMail app with SendGrid.

    • I created an account at SendGrid and have an API-key;
    • I installed the app via the zip-upload to the server;
    • Then I used composer inside /perch/addons/apps/cognetif_apimail to install sendgrid etc;
    • I added cognetif_apimail to my apps.php;
    • In my config.php I added the following:

    1. define('PERCH_EMAIL_FROM', 'my_email');
    2. define('PERCH_EMAIL_FROM_NAME', 'Mike');
    3. define('PERCH_EMAIL_USERNAME', 'my_email');
    4.     define('PERCH_EMAIL_METHOD', 'api');
    5. define('COGNETIF_APIMAIL_CONNECTOR', '\Cognetif\ApiMail\Connections\SendGridApi');
    • I created a perch form template;
    • I filled the form options in Perch to send a response and autoresponse;
    • When submitting the form on my website I get the following PHP error(s):
    1. [Sun Jan 12 14:14:08.525337 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: Return value of Cognetif\\ApiMail\\Manager::email_send() must be an instance of Cognetif\\ApiMail\\void, none returned in [MY_PATH]/perch/addons/apps/cognetif_apimail/lib/Cognetif/ApiMail/Manager.php:49, referer: http://[MY_DOMAIN]/contact
    2. [Sun Jan 12 14:14:08.525505 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: Stack trace:, referer: http://[MY_DOMAIN]/contact
    3. [Sun Jan 12 14:14:08.525511 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: #0 [MY_PATH]/perch/core/lib/Perch.class.php(232): Cognetif\\ApiMail\\Manager::email_send(Object(PerchSystemEvent)), referer: http://[MY_DOMAIN]/contact
    4. [Sun Jan 12 14:14:08.525516 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: #1 [MY_PATH]/perch/core/lib/PerchEmail.class.php(337): Perch->event('email.send', Object(PerchSystemEventSubject)), referer: http://[MY_DOMAIN]/contact
    5. [Sun Jan 12 14:14:08.525521 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: #2 [MY_PATH]/perch/addons/apps/perch_forms/PerchForms_Form.class.php(304): PerchEmail->send(), referer: http://[MY_DOMAIN]/contact
    6. [Sun Jan 12 14:14:08.525525 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: #3 [MY_PATH]/perch/addons/apps/perch_forms/PerchForms_Form.class.php(142): PerchForms_Form->_send_email(Object(stdClass), Array), referer: http://[MY_DOMAIN]/contact
    7. [Sun Jan 12 14:14:08.525529 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client] mod_fcgid: stderr: #4 /home/kndrxwbst/domains/kend in [MY_PATH]/perch/addons/apps/cognetif_apimail/lib/Cognetif/ApiMail/Manager.php on line 49, referer: http://[MY_DOMAIN]/contact

    Hi Hussein,

    Thanks for your response. You are right, it is because of my custom gateway integration, I did not think of that. I am not calling finalize_as_paid(). I guess my integration is not 100% how it should be. This weekend I will look into how I can call the finalize_as_paid() function in my app.

    Thank you!

    Debug part 2

    Hello Hussein,

    Sure, here is my debug (split into two posts, because it is too long):

    I added the tag as follows:


    I added a tag to a product which has to be applied to a member after purchase. But the tag is not applied when the member purchases this product. I also tried logging the member out and back in, but without success. I also don't see anything about the tag in the debug after the purchase.

    Am I missing something?


    Hi Robin,

    In your ../perch/config/config.php file add the following line:

    1. setlocale(LC_ALL,'nl_NL') or setlocale(LC_ALL,'nld_NLD');

    And then in your blog template you can use the following format on your field(s):

    1. <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" />

    I think this is all you need. Let me know if it is not working.

    I use this piece of code:

    1. RewriteCond %{HTTP_HOST} .
    2. RewriteCond %{HTTP_HOST} !^www\. [NC]
    3. RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    4. RewriteCond %{HTTPS} !=on
    5. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    The post.html file is the file that is being used when creating the blog post. In this file you can specify which and how many resolutions you would like to generate from an image. Here is a snippet of my code, which generates multiple resolutions of the same image:

    1. <perch:blog id="image" type="image" width="1980" height="1020" crop="true" label="Afbeelding" bucket="blog" />
    2. <perch:blog id="image" type="image" width="730" height="487" crop="true" suppress="true" bucket="blog" />
    3. <perch:blog id="image" type="image" width="327" height="500" crop="true" suppress="true" bucket="blog" />
    4. <perch:blog id="image" type="image" width="327" height="280" crop="true" suppress="true" bucket="blog" />

    Just make sure all ID's are the same for every resolution and Perch will do the rest for you.

    Now you can use one or multiple of those in your display template.

    Perhaps you could set the product title for example as a variable. In your top layout you could add something like this:

    1. if (perch_layout_has('product')) {
    2. $product_data = perch_shop_product('', [
    3. 'skip-template' => true,
    4. 'filter' => 'slug',
    5. 'match' => 'eq',
    6. 'value' => perch_get('s'),
    7. ]);
    8. $product_title = $product_data[0]['title'];
    9. PerchSystem::set_var('product_title', $product_title);
    10. }

    On your product page you could add the product statement to your layout:

    1. perch_layout('top', array(
    2. 'product' => true,
    3. ));

    Then in your form template you can set the variable as the value:

    <perch:input id="product" type="hidden" value="<perch:shop id="product_title" type="hidden" />" />

    Note, this only works for templates which are parsed at runtime – such as content rendered with perch_content_custom() rather than the precompiled output from perch_content().