Loading

Helper


creates a certificate once, depending on the validations. Returns either an array of data or a template. If the certificate has already been created, then the data of the previously created certificate will be returned. The structure of parameters is described in the article.

When displaying the helper in different places on the site, you should take into account the features of the verification mechanism.

Specifying $validation_type checks whether the certificate was ever generated via the helper generateOneCertificate.

User validation (user)

Checks whether the user is authorized and whether a certificate has ever been generated through this helper.

This validation is performed for contact ID, specifying in params. If the contact is not specified, the email field is checked. If the email address is not found, the ID of the current contact that called the helper is used. If the customer is not authorized, it will not pass the verification.


Thus, if the helper is used in the storefront, you don't need to specify the contact ID, because it will be taken from the data of the current user.

If the helper is used in notifications or mailings, specify the contact ID or email address in the $params parameter to make it clear which user to check.

Session validation (session)

Checks whether the user has a special record in the session that the certificate was generated through this helper.

This type of verification should only be used in the frontend, when the certificate is created when the user views the page, because the value in the session will be saved for it.


If you perform this validation in notifications, you may experience incorrect operation.

Cookie validation (cookie)

Checks whether the user has a special record in the cookie that the certificate was generated through this helper.

This type of validation should only be used in the frontend, when the certificate is created when the user views the page, because the value in the cookie will be saved for it.


If you perform this validation in notifications, you may experience incorrect operation.

IP validation (ip)

Checks whether a certificate was generated for the IP through this helper.

This type of validation should only be used in the frontend, when the certificate is created when the user views the page, because the IP value will be saved for it.


If you perform this validation in notifications, you may experience incorrect operation.

Mild checks

These examples check whether ever a certificate was created through the helper.

What should we do if we need to generate a certificate for the same user first in mailing lists, and then later in a notification or on the main page?.

You can specify in the keys of the $validation_type parameter a unique code that will be used for checking the generator.

Let's look at some examples.

Generator for mailings


Generator for notifications


In one case, we used the code mailer to verify the user , in another code notification.

So we created 2 different generators with user verification.

Posted: November 15, 2020
0
Feedback form

Fill the form, and we will contact you.

Your name:
Email
Message: