Jump to content

Marco Ro

Members
  • Posts

    347
  • Joined

  • Last visited

Everything posted by Marco Ro

  1. Hi, I have put the LoginRegister form inside a popup. If someone inserts the data incorrectly, the page is reloaded and the error message is shown, but this is inside the popup and to see the message needs to manually reopen the popup. Is there a way that if an error occurs when the page is reloaded open also the popup? I try just to add the id to the URL, like mysite/page/#modal-Login but when the LoginRegister reload the page the id is deleted. What can I do? For load inside the modal the Forgot page I use this code: $('.LoginRegisterLinksForgot').on('click', function (e) { $.ajax({ url: './', type: "get", data: 'forgot=1', beforeSend: (function () { }), }) .done(function(data){ $('#LoginRegister').html($(data).find('#LoginRegister').html()); }); e.preventDefault(); }); If there are an error can I use something like this? Thank you.
  2. @gmclelland thank you very much. I can see this error only if I connect with a proxy. Maybe a cache problem, I reset ProCache and now the images also load with the proxy. However, if I connect directly the upload problem is gone and the filter tag works. Anyway thank you very much I will continue to do tests to solve the problem. @flydev I completely forgot about this possibility! thank you very much, I use it immediately.
  3. @flydev, yes there are lots of fields to translate! Thanks for the report! @gmclelland, I see all, what do you mean cann't you see the images? @Jonathan Lahijani, absolutely true!
  4. Thank you @bernhard! I just fixed! I used this system and now it works much better:
  5. Hi everyone, a year ago we had put online a first version of our website, which didn't satisfy me much and had several bugs. This year I started working on a complete restyling, both in terms of functionality and graphic. I am very happy with the result obtained. Finally, last week we put this version online that I am proud to show you! Site EU: https://www.playwood.it/ Site USA: https://www.us.playwood.it/ It is an eCommerce for a small StartUp, the PlayWood, based in Reggio Emilia, Italy. The site is multilingual, has two areas of purchase and has two levels of registration. Redirectory based on the source IP for the USA customer and preferred language in the browser for the others countries. It has systems for use registration and sending emails dependent on specific actions, like: registration, purchase, request for quotes, information request, etc. Through the API the site communicates with external platforms such as the management software, Mailchimp and other systems to support marketing and company operations. The site is constantly evolving, in the future we intend to add new features. The site was created with these modules: Padloper Login/register Media Library ProCache PayPal Checkout Subscribe to Mailchimp Tracy Debugger Cookie Management Banner Continent and country names ImagePicker Field Map Marker External libraries: Spectre, scss framework Swiper slideshow verlok/lazyload fancybox Creating this site with ProcessWire represented a moment of strong professional growth. When I started I had little knowledge of some types of language, but Processwire and its APIs give me the ability to easily build pages, manipulate data and integrate any external library easily. Thus, I was able to deepen my knowledge more and more. So I wanted to thank the creators of the cms, who keeps it and who implements it, obviously all the people in the forum for the help they gave me, was very important. Thank you!
  6. A few days ago I received an e-mail from Stripe where he said that by the 14th of September, two-factor authentication should be implemented for online payments. --> article I seem to understand that for the module ecommere here on PW we need to update the API. They sent me to this page: here Or other possibility is to use the new version of Stripe's checkout, at this link. I wanted to ask if someone has plans to update the module? ------ @kongondo, probably you already know, but anyway for the new version of Padloper this could be interesting.
  7. I like pwCommerce. For users it is much easier to understand pwCommerce, it is very intuitive and simple. Which from the commercial point of view is a fundamental characteristic. For the class I don't have idea. but also need be something connected with the name. Idea for the logo! If you don't already have one, you could launch a contest among community members! will be something fun. Maybe just for the concept, after all the branding you'll see how to do it.
  8. Hi,@kongondo the screen look amazing!! I see there are a lot of possibility to trigger the discount code. I don't know if you have already thought about this, but could be a very useful and beautiful option to be able to create discounts dedicated to specific users. The best if it is possible to give it to those who do certain actions, like make a purchase, sign up for the newsletter or have an abandoned cart. What you think? or just a persona code with expiration date and all the other option.
  9. Hi guys, I try to set up the option values for the options fields. Like it's write here: https://processwire.com/docs/fields/select-options-fieldtype/#separate-option-values EG: I write 123=IT|Italy and render the option value <option value="IT">Italy</option>. I read that need to use $option->value. But I would like to step up a hook to show the custom value when this value exists, otherwise continue to show the ID. Is it possible? I try to work around FieldtypeOptions::formatValue(), but I don't know how setup this hook and if it is the correct way to do it.
  10. Hi, I need to check the VAT number before the user make a registration. I start from here https://github.com/herdani/vat-validation, and this work well. But now I have to integrate this with the LoginRegister module, I'm not sure who do it, at moment I try to make the hook in this way: wire()->addHookAfter('LoginRegister::processRegisterForm', function ($event) { $form = $event->arguments[0]; $company = wire('input')->post->register_Iam; // check if you are a person or a company if ($company == '2') { // 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; $countryCode = substr($country_title, 0, 2); } } // Get VAT number $vatNumber = wire('input')->post->register_invoice_VAT; $check = new WireFileTools(); $check->include('vatValidation.class.php'); $vatValidation = new vatValidation( array('debug' => false)); $vatValidation->check($countryCode, $vatNumber); if ($vatValidation->isValid()) { return true; } else { $vatError = 'this VAT N° does not exist'; $vatNumber->error($vatError); } } }); I'm not sure but I think that everything works well until validation. How I can add the verification system? I feel like one of the problem is adding the vatValidation.class.php file in the hook. But I can't debug well this. I try to follow this post. Also I read the problem could be a namespace in the vatValidation.class file. But also, I'm not sure. vatValidation.class.php UPDATE I try also to use this $company = wire('input')->post->register_Iam; if ($company == '2'){ // 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; $countryCode = substr($country_title, 0, 2); } } // Get VAT number $vatNumber = wire('input')->post->register_invoice_VAT; function viesCheckVAT($countryCode, $vatNumber, $timeout = 30) { $response = array (); $pattern = '/<(%s).*?>([\s\S]*)<\/\1/'; $keys = array ( 'countryCode', 'vatNumber', 'requestDate', 'valid', 'name', 'address' ); $content = "<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'> <s11:Body> <tns1:checkVat xmlns:tns1='urn:ec.europa.eu:taxud:vies:services:checkVat:types'> <tns1:countryCode>%s</tns1:countryCode> <tns1:vatNumber>%s</tns1:vatNumber> </tns1:checkVat> </s11:Body> </s11:Envelope>"; $opts = array ( 'http' => array ( 'method' => 'POST', 'header' => "Content-Type: text/xml; charset=utf-8; SOAPAction: checkVatService", 'content' => sprintf ( $content, $countryCode, $vatNumber ), 'timeout' => $timeout ) ); $ctx = stream_context_create ( $opts ); $result = file_get_contents ( 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService', false, $ctx ); if (preg_match ( sprintf ( $pattern, 'checkVatResponse' ), $result, $matches )) { foreach ( $keys as $key ) preg_match ( sprintf ( $pattern, $key ), $matches [2], $value ) && $response [$key] = $value [2]; } return $response; } $arr = viesCheckVAT($countryCode, $vatNumber); if ($arr[valid] == fasle) { ... } } This probably are better, but I'm not able to integrate with the validation of the module. ONE SOLUTION In the end I failed to make the hook as I wanted. So I thought I'd check the VAT before the module registered the user. Ok maybe it's not the best solution but it works. So, with the help of one person, we started from the PHP function I posted above, changing it this way: We sent a request via Ajax, this is activated when data is entered the input, this call via curl and returns a value that, following the logic in this case with a nice callback, enables or disables the send button ? <?php if( $_SERVER['REQUEST_METHOD']=='POST' && !empty( $_POST['task'] ) && $_POST['task']=='check' ){ ob_clean(); $result=null; function curl( $url=NULL, $options=NULL, $headers=false ){ /* Initialise curl request object */ $curl=curl_init(); /* Define standard options */ curl_setopt( $curl, CURLOPT_URL,trim( $url ) ); curl_setopt( $curl, CURLOPT_AUTOREFERER, true ); curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $curl, CURLOPT_FAILONERROR, true ); curl_setopt( $curl, CURLOPT_HEADER, false ); curl_setopt( $curl, CURLINFO_HEADER_OUT, false ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_BINARYTRANSFER, true ); curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 20 ); curl_setopt( $curl, CURLOPT_TIMEOUT, 60 ); curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' ); curl_setopt( $curl, CURLOPT_MAXREDIRS, 10 ); curl_setopt( $curl, CURLOPT_ENCODING, '' ); /* Assign runtime parameters as options */ if( isset( $options ) && is_array( $options ) ){ foreach( $options as $param => $value ) curl_setopt( $curl, $param, $value ); } if( $headers && is_array( $headers ) ){ curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers ); } /* Execute the request and store responses */ $res=(object)array( 'response' => curl_exec( $curl ), 'info' => (object)curl_getinfo( $curl ), 'errors' => curl_error( $curl ) ); curl_close( $curl ); return $res; } function checkvat( $code, $vatnumber, $timeout=30 ){ $url='http://ec.europa.eu/taxation_customs/vies/services/checkVatService'; $content = "<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'> <s11:Body> <tns1:checkVat xmlns:tns1='urn:ec.europa.eu:taxud:vies:services:checkVat:types'> <tns1:countryCode>%s</tns1:countryCode> <tns1:vatNumber>%s</tns1:vatNumber> </tns1:checkVat> </s11:Body> </s11:Envelope>"; $headers=array( 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'checkVatService' ); $options=array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => sprintf ( $content, $code, $vatnumber ) ); return curl( $url, $options, $headers ); } $code=$_POST['code']; $vatnumber=$_POST['vat']; /* check the VAT number etc */ $obj=checkvat( $code, $vatnumber ); /* if we received a valid response, process it */ if( $obj->info->http_code==200 ){ $dom=new DOMDocument; $dom->loadXML( $obj->response ); $reqdate=$dom->getElementsByTagName('requestDate')->item(0)->nodeValue; $valid=$dom->getElementsByTagName('valid')->item(0)->nodeValue; $address=$dom->getElementsByTagName('address')->item(0)->nodeValue; if ($valid == "true") { $result = "<p style='background-color: #fff;width: 30%;color:green;position: absolute;'>Valid Number</p>"; } else { $result = "<p style='background-color: #fff;width: 30%;color:red;position: absolute;'>Not Valid Number</p>"; } } exit( $result ); } ?> <script> const ajax=function( url, params, callback ){ let xhr=new XMLHttpRequest(); xhr.onload=function(){ if( this.status==200 && this.readyState==4 )callback( this.response ) }; xhr.open( 'POST', url, true ); xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); xhr.send( buildparams( params ) ); }; const buildparams=function(p){/* construct payload/querystring from object */ if( p && typeof( p )==='object' ){ p=Object.keys( p ).map(function( k ){ return typeof( p[ k ] )=='object' ? buildparams( p[ k ] ) : [ encodeURIComponent( k ), encodeURIComponent( p[ k ] ) ].join('=') }).join('&'); } return p; }; document.addEventListener('DOMContentLoaded', ()=>{ let form = document.getElementById('LoginRegisterForm'); form.register_invoice_IVA_VAT.addEventListener('keyup', e=>{ let url=location.href; let params={ 'task':'check', 'vat': form.register_invoice_IVA_VAT.value, 'code':'IT' /*need to hook the select filed because now return the ID number*/ }; let callback=function(r){ let vatF = document.getElementById('register_invoice_IVA_VAT'); var thisreturn = r.includes("Not"); var divNew = document.createElement("div"); divNew.innerHTML = r; if (thisreturn == false) { vatF.classList.add('success'); vatF.classList.remove('error'); document.getElementById("register_submit").disabled = false; document.getElementById('wrap_register_invoice_IVA_VAT').appendChild(divNew); } else { vatF.classList.add('error'); vatF.classList.remove('success'); document.getElementById("register_submit").disabled = true; document.getElementById('wrap_register_invoice_IVA_VAT').appendChild(divNew); } } ajax.call( this, url, params, callback ); }) }); </script> So, I didn't make the hard coding part to be complete honest I ask in stackoverflow here, but anyway I want also add this post here if anyone in this form needed it, it can be a starting point. (Maybe could be a interesting features for the new Padloper or some ecosystm module @kongondo)
  11. Wow super! The API system look amazing! I know you still have to tell us many things, like how works the discounts, users management, shipments, payments, etc. But I will like ask a few things ? The API system for get the $order data will change? eg: At the moment I am using the success page or the checkout page to send the order data to external platforms such as our management, Mailchimp, google analytic etc. Will it be possible to continue doing it from there? I see there is the discount page, but also will be possible to change the price in the shopping cart based on the items loaded? eg: discounts based on quantity. Will it be possible to do this as a backend or do it with a separate hook? Will it be possible to choose the type of shipment in the checkout process? eg: normal, super fast... A curiosity, are you also creating new payment module? I think that ProcessWire has the potential to become the cms with the best e-commerce system around!
  12. Hi, 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. I open a different post here
  13. 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); }
  14. 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!
  15. 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?
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. 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?
  21. 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.
  22. 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.
  23. 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?
  24. 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. :(
  25. 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.
×
×
  • Create New...