Prestashop 1.7.7 E-Mail Input Validation for Domain Name - prestashop

i looking for a solution in Prestashop for correct E-Mail Input field format validation.
A normal email xyz#domain.com will check for the # symbol but not for domain dot(!) com.
So i can write into the checkout email field as guest: xyz#domain but the dot and com missing.
Somebody have some idea for that?
Thanks
Akos

The email validity check is handled in /classes/Validate.php
into the
public static function isEmail($email)
{
}
method.
You can consider editing or overriding it to suit your needs.

Related

How to use actionValidateCustomerAddressForm hook to get the address of customer

How to use actionValidateCustomerAddressForm, during runtime of address update details
In the actionValidateCustomerAddressForm you will get the whole address form as parameter.
public function hookActionValidateCustomerAddressForm($params){
$addressForm = $params['form'];
// do the stuff
}
Of course, you can use the hook only in a module. For generating a basic custom module, check the https://validator.prestashop.com/

How to read RFC822 content as plain text?

First thing to note...I have tried a simple doc.computewithform(false,false) and it did not resolve this.
I have an agent set to run after new mail arrives. This agent will do different things depending on the email address it was sent to. Several email addresses are pointed to this mail-in db. So, in order for this to work, I need to read the 'sendto' field on the incoming email. Sometimes this value is plain text, and that works fine. Sometimes, depending on where the email was initiated, the sendto value is RFC822 text. I am hoping to find a way to convert this or extract from it the plain text representation of the sendto address.
I have a local memo form in this database that I could add an #Formula language function to, should one exist (so I could look there after the computewithform call).
If anyone has any ideas, I would be grateful for your input.
Matt
#Name([Abbreviate];SendTo) will extract the text from a field of RFC822 type 'Address'
or
The NotesName class in LotusScript can retrieve any part of a field of type 'RFC822 Text'

How to pass the default language to the Registration page?

Is there a way to pass a specific UI language to the registration page? This is coming from the website and I want it to be the defaut option.
you can send the culture with these headers
c=...
uic=...
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpLocalizationHeaderRequestCultureProvider.cs#L12
and for MVC use culture parameter like below
/register?culture=tr
must be the first parameter of the query string
and last option; you can always override AbpUserRequestCultureProvider
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpUserRequestCultureProvider.cs
UPDATE:
According to the implementation it accepts query string parameters as culture like below
?culture=es-MX&ui-culture=es-MX
See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2103
If you look at the request headers sent by the browser, it includes "Accept-Language". It can look something like this:
en-US,en;q=0.9,es-419;q=0.8,es;q=0.7
Generally, the preference runs in descending order, so here, the browser is saying it prefers U.S. english before anything else. More here about what the q values mean: What is q=0.5 in Accept* HTTP headers?
You can access this value through in the controller.
Request.Headers["Accept-Language"]

CakePHP 3.x I need to check prefix in model if admin

I want to check if the current address is admin area IN MODEL to change conditions:
public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary) {
debug($this->request['prefix']);
}
It's not working. I need only to access to request vars IN MODEL.
Thanks.
I resolve it by using $_SERVER variable. It's works good
$_SERVER['REQUEST_URI']
but I still need to add beforefind for each Model... while I need only general conditions for all queries... I really feel bad about the accessibility of cakephp
Brother you can use the class in model
use Cake\Network\Request;
and Get path if you want

Woocommerce select email address destination only for new order notification(admin) through form checkout it's possible?

Scenery: 1 store and 2 locations. I already have select field form (checkout) where the customer select which store is closest to your location, eg: city A or city B.
Now I need that the new order notification (admin) sent ONLY to e-mail the city shop chosen in form.
Seems to me that all this operations occurs near: class-wc-order, class-wc-checkout.php
But I belive that exist that do it only using filters
Any ideas?
Thanks advance.
$_SESSION Vars on WooCommerce work's fine.
Well not the fine way, but also not worst too!
Create a jquery ($.ajax) function to call one php script external file and register the session variable ($_SESSION).
In my case this php is in (eg: public_html/loadvar.php), this file receive $_POST variables through ajax (in my case: when the user select your office location prefered, this value eg: emailA or emailB according office selected (onChange event) )
I used this session variable to store the alternative email addresses. (not admin_email default)
In (class-wc-checkout.php) , retrieve these values (session variable) eg: email1 or email2... previously selected on form checkout, and overriding the "get_option( 'admin_email' )" by the $_SESSION value
Now, users can choice the office that prefer, and only the selected office will receive the quote request
Note: I only can use this session vars on woocommerce configuring wp_unregister_GLOBALS() on wp-includes/load.php or disable it commenting this function.
This worked (not is state-of-art code) maybe dirty code but can't need deep coding, obviously not "strict patch" this will not survive an update
Thats all folks