Jump to content

Marco Ro

Members
  • Posts

    347
  • Joined

  • Last visited

Everything posted by Marco Ro

  1. 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?
  2. Thank you @flydev. I try but there are some point that sure I do not understand. I'm reading the hook post. But probably I still make more then one error and this make hard debug the hook. wire()->addHookAfter('Pages::saved', function($event) { // Use wire() because the function is outside of a class. It's in my ready.php // Use addHookAfter becasue I need to have all the fields populated before I can use them. $page = $event->arguments(0); // here set to have the access to all the data in the page (rigth?) if($page->template == "user"){ // if the page saved it's a user page if ($user->hasRole('login-facebook')) { // (I'm not sure if I have to use $user or $page->fields) $mc = $modules->get("SubscribeToMailchimp"); // call the module take the fields and send it $email = $page->email; $subscriber = [ 'FNAME' => $page->pad_firstname, 'MMERGE4' => $page->$country_title, ]; $mc->subscribe($email, $subscriber); } } }); UPDATE I keep try to find a way to do the hook, but not with great result. I have also try to use Users::saveReady. wire()->addHookAfter('Users::saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($user->hasRole('login-facebook')){ $mc = wire('modules')->get("SubscribeToMailchimp"); $email = $this->wire('user')->email; $subscriber = [ 'FNAME' => $this->wire('user')->pad_firstname, ]; $mc->subscribe($email, $subscriber); } }); I think to have a bit of confiution about the structure to how make a hook.
  3. I'm trying to add an action in the moment a new user registers and his page is created. Specifically, when a user is registered with the Facabook module, send the notification to Mailchimp and add it to the list, this with the mailchimp module. I think the problem could be in how I set the hook and in the page data. I hope I didn't make too many mistakes! sorry for this. wire()->addHook('Pages::saved', function($page) { if($page->template == "user"){ $user = $page; if ($user->hasRole('login-facebook')) { $mc = $modules->get("SubscribeToMailchimp"); $email = $user->email; $subscriber = [ 'FNAME' => $user->pad_firstname, 'MMERGE4' => $user->$country_title, ]; $mc->subscribe($email, $subscriber); } } }); I try also to use LoginFacebook::createNewUser but I'm not sure how use it. For this I move to do an hook directly when a user page is created. (that also coulde help me for others projects) .
  4. Hi @daniels, thank you for your reapply! eheh, yes you have right. I explain better what I have to do In addition to the loginRegister module I also use the registration via Facebook. This registration bypasses the registration form and don't send the data to mailchimp. I thought about making a hook for all the users that are registered, regardless of the method. Then use Pages::saved (I'm not sure it's right) and pass data to mailchimp when the user's page is created. But the attempts I tried don't work, I'm probably wrong the way I access the data. Do you know how can I create this action, to send the data to mailchimp when the users page it's created? (Sorry, I have thought just now that maybe this was a question to put in general)
  5. How can I use this moule for all users who are saved with a specific category? I'm not sure which Class and method need to use and also maybe I not get the correct fields. wire()->addHookAfter('Pages::saved', function($event) { $page = $event->arguments(0); if($page->template == "user"){ if ($user->hasRole('login-facebook')) { $mc = $modules->get("SubscribeToMailchimp"); $email = $page->email; $subscriber = [ 'FNAME' => $page->pad_firstname, 'MMERGE4' => $page->$country_title, ]; $mc->subscribe($email, $subscriber); } } });
  6. Hi, I try to make a hook for adding the new user in the Mailchimp list using the module "Subscribe To Mailchimp" by @daniels. This code doesn't work. I didn't understand what facebook fields I should use and if I made any other mistakes. Someone can help me please. Hook still to be hard to learn! ? wire()->addHookAfter('LoginFacebook::createNewUser', function($event) { $u = $event->arguments[0]; // get user object $mc = $modules->get("SubscribeToMailchimp"); $email = $u->email; $name = $u->$userName; $country_title = $u->$country_title; $subscriber = [ 'FNAME' => $name, 'MMERGE4' => $country_title; ]; $mc->subscribe($email, $subscriber); } }); Also, I would like to add this condition: if the user makes a new registration, the privacy checkbox should automatically be marked.
  7. Thank you @kongondo all this is perfect! No worry for the padloper post, sure the new one will be great also for the other question! Compared to what others have said, I can only add that it might be useful have the e-commerce users in a separate page like a Padloper Customers, also for the abandoned carts, maybe with tag for better filter the useres beetween purchased, not purchased, registered and unregistered. About the problem for the anonymus customer, those who aren't registered but have made a abandoned cart without arrive to the confirmation of the data, I think we can use the data only for statistical purposes to know what was in the cart. So, maybe they can only register as IP addresses in this way we can know also where come from. I swear they are the last requests ? Will be good if the user isn't registered add a checkbox at the end of the checkout form to ask if he wants to register. Cloude be a backend question. For the Shipping Price coulde be useful if we can also trigger for the total cost of all items. Always for Shipping Price, could be an option, in the category shipping backend, calcolate the costo adding the singular shipping prices or only take the highest, as it is now.
  8. Hi @kongondo First thank you for your work! In this moment we are using the unpublished order section, that is generated in the confirmation page, as if they were abandoned carts. Which is correct, but it would be useful for marketing to have all abandoned carts of the users. Would it be possible create the order page as soon as they insert a product into the cart? and insert them a specific page such as Unpublished Orders. In this way we can have track about what people add to the cart and if that useres are login we can also know who is.
  9. Hi @adrian, I was working with geoip.nekudo (it was among the services you suggested in another post) and so, geoip.nekudo it's not more free service it was bought by ipapi.com ?
  10. I have this simple structure with two separate pw installation: Root |----Site-one (domain.com) |----All Pages |----Site-two (sub.domain.com) |----All Pages There are few page that would be very nice if I could update them in site-one and show it on the site-two without changing the domain. Is it possible Share contents between two different installations? There are some IPA that I can call the contents from the site-one installation? I try to looking in the forum and I find a link to a module call service-pages but all link give me error 404, also I see the rss module but I'm not sure that can call all the contents from the site-one pages.
  11. Thank you @BitPoet, the problem still unsolved. The images are loaded inside the folder, I checked via ftp. But after a few hours/day they are deleted. This only happens in a folders with lots of images inside, if I create a new one and reload the images this problem is solved. There are no notice about the memory issues, could it always be this?
  12. Hi @flydev Is it possible have access to all variable in sendConfirmationEmail ? I'd like to include the person's name and password in the e-mail notification, but the moment I'm only able to access the e-mail. Also for the buildConfirmationForm I can't add eg. the e-mail inside the text. I try use this but doesn't work. sprintf($this->_('Thank you, a confirmation code has been emailed to you at %s.'), $email) Perhaps it's the same problem that I can't access to all variables from the registration form.
  13. Ok, now redirect users based on their country works. So, for be honest I don't have do a lot, I use on of the free service @adrian write above and I have read this great post from @rayn (thank you). Anyway this code works quite well, but for sure it's possible write it better. <?php function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $http = new WireHttp(); $url = $http->getJSON('https://geoip.nekudo.com/api/'.$user_ip); $country = $url['country']['code']; ?> <?php foreach($languages as $language) { if(strpos($config->httpHost, "$language->yourwebsite.com") === 0) { $user->language = $language; break; } } $name = $sanitizer->pageName(substr($country, 0, 2)); $language = $languages->get($name); if($language->id && $name != $user->language->name) { $url = "http://yourwebsite.com/" . $page->localUrl($language); $session->redirect($url); } ?> If the language it's not set for the country it will load the default language. This can be used also for redirect users to any subdomain or whatever, just need change the $session->redirect($url). substr it can be useful sometime this service give me back an hidden character. I have just a notice in TracyDebug where start the foreach, if I put it after $country give me an error, look like there is an error in the previous lines but honestlyI did not understand what it is. --- * In the Ryan post there is the code for filter the language by Browser's HTTP Accept-Language. As @theo had said.
  14. wow. Thank you very much @adrian the ip service look very nice! I will study the cookie modulo and also probably will implement it on the sites. Thanks again for sharing your knowledge! Yes @theo, I have just find this post. I think will use the HTTP Accept-Language, it's a better way. For the country specific products I will use the geolocation service that suggested Adrian. I will Upload this post when I finish all the code. So, if some one will need in the future. ?
  15. Thank you ? I was two days that I was working on this!!
  16. yes @bernhard, I will do this for this particular situation, because it's a subdomain that you must be logged for see the page and I will have the country code (we have decided now for the same reason you say you). But anyway In our next step we will open the e-commerce in the USA, we will make an other subdomain and we need to redirect all the USA traffic to this subdomain. so, if we do not find another solution we will use a service like ipinfo.io. @Soma I know it's not the best but in this case we have to do in this way, special for the user came form the USA that will see different products compared to European ones. They will not have access to the UE site.
  17. @Soma yes, I understand you, but unfortunately in this case we are obliged because some pages have terms that should be used in the current language. Example, unfortunately not all know the VAT number equivalent that here in Italy is Partita IVA. These things and others can confuse users. ? I would like in any case to leave the possibility to change the language for those who want, but the first language should be the one come form the country IP.
  18. ipinfo.io works well and have nice IPA system. But over 1000 requests for day need a bit expensive plan like 500$/y. So, the economic issue could be not a problem, but would be great if there is a solution that doesn't include accounts with external platforms. But anyway, if I want use ipinfo and test it, how I can redirect the user. I can make a hook inside my ready.php ? I have to use addHookBefore('Session::redirect', function(HookEvent $event) ? Or something like this, that at moment doesn't work... <?PHP function getUserIP(){ $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)){ $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $http = new WireHttp(); $url = "http://ipinfo.io/{$user_ip}/country"; $response = $http->get($url, ['country' => '']); $country = filter_var ( $response, FILTER_SANITIZE_ENCODED); // the country have a hiddend code if ($country == "IT"){ $session->redirect('/it'); } elseif ($country == "FR") { $session->redirect('/fr'); } else { $session->redirect('/'); } ?> Anyway I have to redirect always on the current page not always on the homepage. An also other problem it's that some people could choose to use the website form other languages. It's a bit tricky ?
  19. Hi, I looked in to the forum if there was any post but I have not found, it seems strange ... anyway. Is it possible, using pw, based on the user's country redirect the users to their language page? I was looking at IP geolocation services but they all seem to pay. is not there a system that does not require subscriptions? or even better, an internal system in pw?
  20. Hi @Sevarf2 Probably it's better this one: $wire->addHookAfter('LoginRegister::buildLoginForm', function($event) { $form = $event->return; $form->description = false; // Remove the description foreach ($form->children as $field) { // loop form fields if($field instanceof InputfieldSubmit) { // if we reach the submit button then $field->value = 'My Submit'; // change the value } } $event->return = $form; }); Probably me too later this week I will try to use, I think this could works. Take a look in the 1° page of this post there are also other part of code that maybe can help you.
  21. hi @Sevarf2, I know maybe it's not exactly what you were looking for, but could put you in a good direction. I didn't test yet but look so nice. I have find here wire()->addHookAfter('LoginRegister::buildProfileForm', function($event) { $form = $event->return; foreach ($form->children as $field) { if ($field instanceof InputfieldEmail || $field instanceof InputfieldPassword) { $form->remove($field); } } }); Maybe it's enough make a different hook in instead of $form->remove($field) If you want to use just for a specific form you can make the hook in that page, instead of in the ready.php
  22. Hi @flydev! I try to use this hook, but doesn't work for me. If I use $u->roles->add(wire('roles ')->get ("bs-user")) give me an error "unexpected $u (T_VARIABLE) I try to use $u->addRole('bs-user') like is in the documentation, but also this not work. I try also to use $u->of(false) ... $u->of(true) for see if need a new formatting before assigning values to a user. But the user does not register. How can I add a specific role from a hook? UPDATE: The problem not was wire()->addHookBefore('LoginRegister::createdUser', function($event) { $u = $event->arguments[0]; $u->addRole('bs-user'); $u->save(); }); But in the way I rendering the registration form: If I use $input->get->register = 1 for rendering only the registration form the hook doesn't work. I have to call also the login form <?php $login = $modules->get('LoginRegister'); echo $login->execute(); $Register = $modules->get('LoginRegister'); $input->get->register = 1; echo $Register->execute(); ?>
  23. Hi. Is it possible customize the registration form for different pages ? I have to add a specific roles for the user make the registration from a specific page. And also add one more input in this registration form. I try to add the role following your idea in the other post but this of course doesn't work. wire()->addHookBefore('LoginRegister::buildLoginForm', function ($event) { $form = $event->arguments[0]; $string = $page->path(); $field = 'invoice_IVA_VAT'; // hide a field for all forms except the one on the page. if ($string !== 'business-landing') { $f = $form->get($field); $f->collapsed = Inputfield::collapsedHidden; } // add them new role if ($string == 'business-landing') { $u = $event->arguments[0]; $u->roles->add(wire('roles')->get("bs-user")); $u->save(); } $event->return = $form; }); I see you have use addHookBefore LoginRegister::createdUser in that post. But if I want choose the page where this it's apply I have to use buildLoginForm, correct? How I can add the roles after the registration and a new field? UPDATE: For add a custom roles need to use an hook by this: wire()->addHookBefore('LoginRegister::createdUser', function($event) { $u = $event->arguments[0]; // get user object $u->addRole('bs-user'); $u->save(); }); Be sure to render the login form (and not only the registration form).
  24. Hi, We have made an e-commerce with PW3 and Padloper, the e-commerce sell in Europe in Euro. Now we want extend the e-commerce in the USA and sell in Dollar. We have think to run a different website for the USA versione, because with have different products and we want customize some pages. The idea is to run a new installation with a new Padloper module in a sub.domain, but the best will be keep all the other page, like the blog, in sync with the first website. Any advice on how to do it ? I read about Multiple sites with multiple databases, that could be a good solution because let me make a new installation of Padloepr module and customize the pages. But I'm not sure about how to import the page from the first website and show up in the new installation, in the way we don't have to upload website.
  25. Hi guys, If I use : <link rel='stylesheet' type='text/css' href='<?=$config->urls->FieldtypeComments?>comments.css' /> <script type='text/javascript' src="<?= $config->urls->FieldtypeComments?>comments.min.js"></script> <?php echo $page->comments->renderAll(); ?> The comment work, but: I can't see the star system in the form and in the comment, also if I add it in the backend. The up and down vote don't working well, when I add a vote I see the number grow but after reload the page the vote disappear and (correctly) I can't make a new vote. I try also to customizing the comments output to force the system but this doesn't work. Some one know what I can try to do? Thank you.
×
×
  • Create New...