Jump to content

MarcoPLY

Members
  • Content Count

    252
  • Joined

  • Last visited

Community Reputation

63 Excellent

1 Follower

About MarcoPLY

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

Profile Information

  • Gender
    Male
  • Location
    Reggio Emilia

Recent Profile Visitors

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

  1. @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.
  2. @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!
  3. Thank you @bernhard! I just fixed! I used this system and now it works much better:
  4. 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!
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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)
  10. 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!
  11. 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
  12. 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); }
  13. 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!
  14. 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?
  15. 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.
×
×
  • Create New...