Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

52 Excellent

1 Follower

About MarcoPLY

  • Rank
    Sr. Member
  • Birthday 05/08/1987

Profile Information

  • Gender
  • Location
    Reggio Emilia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, could you guys help me to make this Hook? I need to check the VAT number before the user make a registration. I find a good service for check the number, now I have to integrate with the module. I'm not sure what doing, at moment I try to make the hook in this way: wire()->addHookAfter('LoginRegister::processRegisterForm', function ($event) { $form = $event->arguments[0]; // Get country code $options = wire('fieldtypes')->get('FieldtypeOptions')->getOptions(wire('fields')->get('shipping_countrycode')); foreach ($options as $value) { if(wire('input')->post->register_shipping_countrycode == $value->id) { $country_title = $value->title; $country_code = substr($country_title, 0, 2) } } // Get VAT number $vat = wire('input')->post->register_invoice_VAT; // Ask to check the VAT number $countryCode = $country_code; $vatNo = $vat; $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"); $client->checkVat(array( 'countryCode' => $countryCode, 'vatNumber' => $vatNo )); // VALIDATION if ($client->valid == 'true') { // valid Field } else { // not valid Field } }); thank you.
  2. I am looking in the forum for a solution but I didn't find it. I redirect people based on their browser language, with I use this code (that I grab somewhere in the forum): foreach($languages as $language) { if(strpos($config->httpHost, "$language->site.it") === 0) { $user->language = $language; break; } } $name = $sanitizer->pageName(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));; $language = $languages->get($name); if($language->id && $name != $user->language->name) { $url = "https://www.site.it" . $page->localUrl($language); $session->redirect($url); } Now the problem is that: the users can't change the language because they are always redirected to theirs browser language. I would like to let the users change the language. I try to work around Session class, I thought of enabling redirection only on first arrival, but I don't know how to do it. Maybe I have to work with the cookies? I'm not sure about what I can do. I find this post, but I will not use this module but incorporate within my _func.php file, because before to get to the language selection I have other statements. If I have understand well he used this part to make the redirect only in first session, but I'm not sure how can I integrate this // Set some session variables then redirect $this->session->languageAlreadyDetected = true; if (wire('user')->language->name != $matchedLanguage AND !isset(wire('input')->get->{$this->noDetectGetParam})) { $this->session->redirect($page->localUrl($matchedLanguage), false); } MY SOLUTION: probably not the best solution, but it works // set the cookie expire after 5 min, I know is not the best because after 5 min the user not load page is forced to change language, // but the average time of a session is that and in this way I'm sure if the user cameback there isn't this cookie $user_is_first_timer = !isset( $_COOKIE["FirstTimer"] ); setcookie( "FirstTimer", 1, time() + (60 * 5) ); if( $user_is_first_timer ){ foreach($languages as $language) { if(strpos($config->httpHost, "$language->playwood.it") === 0) { $user->language = $language; break; } } $name = $sanitizer->pageName(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));; $language = $languages->get($name); if($language->id && $name != $user->language->name) { $url = "https://www.site.com" . $page->localUrl($language); $session->redirect($url); }
  3. Hi Kongondo, at moment for us the Multilingual Text Fields and the Type Options Fields works well. Maybe I wrong but perhaps the multilingual system should be something that is about the website. But sure the new Padloper must be ready to accept the multilingual version. Thank you and good work!
  4. Hi guys, sorry I don't have understood well how works the fingerprint. I have the same issue because our IP address cloud change during the session, so I have to change the setting. But I'm not sure which option use. What exactly do the fingerprint?
  5. Hi @flydev, I'm sorry you're sick. Honestly I don't know why there is this error, but if I can help, yes I use LoginRegister module, my code it's nothing particular. This problem show up in every registration from on the website, also in the subdomain with other installation that share the wire core folder.
  6. Could be a bug in the new version 3.0.125 ? Before that I update from the 3.0.098 this error doesn't show up. I have see that in the 3.0.098 and 3.0.123 this part was commented. protected function sendCURL($url, $method = 'POST', $options = array()) And in the function that give me the error at 640 row of WireHttp. I have downgraded to the version 3.0.123 and now on the registration form works.
  7. Hi, Sometime people that try to make the registration can't do and in the page load a server error 500. In the log Exceptions I see this alert: Raw data option with CURL not supported for PATCH (in /wire/core/WireHttp.php line 670) What kind of error is? and how can I solve it? Thank you.
  8. Hi @Zeka... thank you, yes the problem was that doesn't show up the file in the list. But I found the solution just now: In the end on the page there is a button: "Refresh File List" Just press that button! I didn't before because look like with disable class but it works. Now the list it's update.
  9. When I prepare the strings for translation using __('strings') and usually in the Languages > Select File(s) appears the template, but I have a couple of templates that not show up in this section. These templates are like the others. Why can this happen?
  10. I have the same problem, but I can use the searching box for looking witch file is broken. Also I can't find any phrase-index.txt, where is exactly? Sorry @PWaddict, maybe you know. This problem about the live search could be the reason why after I added a new language it does not appear in the all URL segment ? I mean, I added French, and added fr in Languages Support - Page Names. In all pages the text input field for the French show up, but in the setting section missing all URL fr/link, there is only the link name, without the fr/ About the problem for the link I have fixed, I forgot to upload in the homepage the fr link. When you create the language to defeat in the homepage it's add the defeat language, I need to correct it by hand, even if you add the tag inside the page Languages Support - Page Names.
  11. Yes. I'm not sure how I'll approach it though. It's just an idea at the moment. Can we have something like ready-api.php page, with all the variable for use just like a endpoint for connect with the API of any carriers ? Could be a backend page where for each of our Padloper fields there are editable fields to connect with the carriers API. Also will be great if there are the fields for add the link of the carriers page where send the data. Or maybe could be just a page where there are a recap of our API + documentation and that in a separate php page we will write our code.
  12. Thanks a lot @flydev. Ok, so, I have to use wire() becasue the hook is ouside the class. and I need also call $pages = $event->object. But aren't the data store in the argument? why I have to call pages object? Unfortunately the hook does not work. I think now the problem is how access to the correct date to send to Mailchimp. The Dumps I see empty, but in the Logs page now I have the Login-Facebook and I can read: Created new user: name-surname then Updated user 'name-surname' fields: role:login-register, pad_firstname, pad_firstname, pad_lastname and then Used Facebook to login for user: name-surname There isn't the email, could this be the problem that does not generate the user in Mailchimp? But, on the user page the email has been added successfully, for this type of hook only need this, correct? I can't find anywhere bd($mc). I try also to use $email = $page->email; and $email = $this->wire('user')->email but but not work, also try $email = wire('input')->post->email I know the input post it's use only in the form but I just to try. Any Idea?
  13. Sorry @flydev, I think to have read all the documentation and forum post. I have trie all the code that I thinked was correct, using the method Pages::saved, Users::saveReady, saveReady. Try trying to start the hook with $this->addHookAfter, $pages->addHookAfter, wire()->addHookAfter but no one worked. I also thought the problem was how I was trying to access the data so I try $email = wire('input')->post->email, $email = $page->email, $email = $this->wire('user')->email. Could you tell me pleace where I wrong? This should not work? $this->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if ($page->template == "user") { $mc = wire('modules')->get("SubscribeToMailchimp"); $email = $this->wire('user')->email; $subscriber = [ 'FNAME' => $this->wire('user')->pad_firstname, ]; $mc->subscribe($email, $subscriber); } }); All the method that I used I think are correct. So, my error need is in how I call the hook and/or how I access the data. The file is in my ready.php so like the documentation I have to use $this-> but not work. In the documentation about hook I read to use wire() if the hook it's ouside the class like it's the module. I try to follow your exemple here and write the hook like you did and call teh module using wire(). So, sure there are something that I do not understand. :(
  14. Thank you @bernhard, I see the post after post this topic. Before to write I was looking in the search bar for "Git" and other kayword but this post not show up. Before to write this post I find other posts but dosen't really resolve my doubt. I hoped there was a simpler solution those in the posts below that are very complex solution. But I can understend that maybe thare aren't a easy way. Probably you have say the faster way use import/export tools.
  15. Is it possible to sync two installations in this way? Site ----------> DB1 Site-dev ----> DB2 On site-dev I realize all my changes etc ... When I finish I would like to move all the changes made in site-dev + DB2 to Site without losing the information contained in the DB1 but only updating and modifying the DB1 in the parts that have been changed or are missing. In other words: I have to do a series of updates. But while I work the main site continues to exist and to regulate users and orders. This new data is not uploaded to the dev-site. So when I have finished making the changes I will miss the data that have been created in the meantime, and if I reload the db I lose this data. How can it be done? I would not like to export and import users and orders manually. Is there a way to synchronize the two installations, that they don't overlap but that they complete themselves?
  • Create New...