-
Posts
80 -
Joined
-
Last visited
Everything posted by Spinbox
-
I've made a change to the js file of the stripe payment module, removing the name input from payment methods. If I update the Padloper module in the future this will of course be overwritten. What's the best approach in changing such a thing? getPaymentElement: function (elements, mount_id) { const paymentElement = elements.create('payment', { fields: { billingDetails: { name: 'never', email: 'never', } } }); }, handleSubmit: async function (stripe, elements, event) { event.preventDefault() padloperPaymentStripe.setLoading(true) ///////////////////////// // @see: https://stripe.com/docs/payments/quickstart AND https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#enable-payment-methods const { error } = await stripe.confirmPayment({ elements, confirmParams: { payment_method_data: { billing_details : { name : document.getElementById("clientName").value, email : document.getElementById("clientEmail").value } }, // payment completion page return_url: PadloperPaymentStripe.getReturnURL(), }, }) ... }
-
Custom Customer Form input
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
@netcarver Thank you, @kongondo I got it working like I wanted. Thank you for your detailed reply. I hope I sanitized everything correctly. edit: I'm not sure how to validate a password, found some topics about checking isValidPassword($pass) but not sure how to implement it here For reference Added extra fields to the usertemplate (not sure if it's better to create a seperate profiletemplate) Added an ajax check for email User is created upon order save, optionally with a password User mailchimp signup <?php namespace ProcessWire; $this->addHookBefore('PadloperProcessOrder::orderSaved', null, 'processOrderSaveCustomer'); function processOrderSaveCustomer(HookEvent $event) { $input = $event->input; $user = user(); $users = users(); $sanitizer = wire('sanitizer'); $orderPage = $event->arguments('orderPage'); $currentUser = Null; $session = session(); if($user->isLoggedin()) { $currentUser = user(); } else { $orderCustomer = $orderPage->get('padloper_order_customer'); $email = $orderCustomer->email; if($email){ // We add an account for the email provided to store customerdata (newsletter) even if the user doesn't want a login // The account can later be activated $currentUser = $users->add($email); $currentUser->email = $email; // Login to the new account if($input->post->createAccount == 1) { // Not sure if I need both of these $users->setCurrentUser($currentUser); $session->forceLogin($currentUser); } } } // Save order to currentuser $orderCustomer = $orderPage->get('padloper_order_customer'); $orderCustomer->userID = $currentUser->id; $orderPage->save('padloper_order_customer'); if($currentUser) { $currentUser->of(false); $currentUser->pass = !empty($currentUser->pass) ? $currentUser->pass : $input->post->pass; $currentUser->shippingAddressFirstName = !empty($currentUser->shippingAddressFirstName) ? $currentUser->shippingAddressFirstName : $sanitizer->text($input->post->firstName); $currentUser->shippingAddressMiddleName = !empty($currentUser->shippingAddressMiddleName) ? $currentUser->shippingAddressMiddleName : $sanitizer->text($input->post->middleName); $currentUser->shippingAddressLastName = !empty($currentUser->shippingAddressLastName) ? $currentUser->shippingAddressLastName : $sanitizer->text($input->post->lastName); $currentUser->shippingAddressPhone = !empty($currentUser->shippingAddressPhone) ? $currentUser->shippingAddressPhone : $sanitizer->digits($input->post->shippingAddressPhone); $currentUser->shippingAddressLineOne = !empty($currentUser->shippingAddressLineOne) ? $currentUser->shippingAddressLineOne : $sanitizer->text($input->post->shippingAddressLineOne); $currentUser->shippingAddressLineTwo = !empty($currentUser->shippingAddressLineTwo) ? $currentUser->shippingAddressLineTwo : $sanitizer->text($input->post->shippingAddressLineTwo); $currentUser->shippingAddressPostalCode = !empty($currentUser->shippingAddressPostalCode) ? $currentUser->shippingAddressPostalCode : $sanitizer->text($input->post->shippingAddressPostalCode); $currentUser->shippingAddressCity = !empty($currentUser->shippingAddressCity) ? $currentUser->shippingAddressCity : $sanitizer->text($input->post->shippingAddressCity); $currentUser->shippingAddressCountry = !empty($currentUser->shippingAddressCountry) ? $currentUser->shippingAddressCountry : $sanitizer->text($input->post->shippingAddressCountry); $newsletterSignup = $sanitizer->int($input->post->newsletter); if($newsletterSignup == 1) { $currentUser->newsletter = $newsletterSignup; $mc = modules()->get("SubscribeToMailchimp"); $mc->subscribe($currentUser->email, ['FNAME' => $currentUser->shippingAddressFirstName, 'LNAME' => $currentUser->shippingAddressLastName]); } $currentUser->addRole('login-register'); $currentUser->save(); } $event->arguments('orderPage', $orderPage); } Check if an users email exists <?php namespace ProcessWire; if($config->ajax) { $email = sanitizer()->email(input()->get->emailExists); if($email != '' && users()->get("email=".$email)->id > 0) { echo json_encode(users()->get("email=".$email)->id); } else { echo json_encode(false); } exit(); } -
Custom Customer Form input
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Thank you, I got it working, probably not the best code $this->addHookBefore('PadloperProcessOrder::orderSaved', null, 'processOrderSaveCustomer'); function processOrderSaveCustomer(HookEvent $event) { $input = $event->input; $user = user(); $users = users(); if($user->isLoggedin()) { $currentUser = user(); } else { $currentUser = $users->add($input->email); $users->setCurrentUser($currentUser); } if($currentUser) { $currentUser->of(false); $currentUser->email = $currentUser->email != '' ? $currentUser->email : $input->post->email; $currentUser->pass = $currentUser->pass != '' ? $currentUser->pass : $input->post->pass; $currentUser->newsletter = $currentUser->newsletter != 1 ? $currentUser->newsletter : $input->post->newsletter; $currentUser->addRole('login-register'); $currentUser->save(); } if($currentUser->newsletter != 1) { // load module into template $mc = modules()->get("SubscribeToMailchimp"); // add merge_fields to fill out user data, based on your audience MERGE_FIELD options // You need to setup the fields at "Settings > List fields and *|MERGE|* tags" first! $mc->subscribe($currentUser->email, ['FNAME' => $currentUser->shippingAddressFirstName, 'LNAME' => $currentUser->shippingAddressLastName]); } } I have also an ajax check if the emailaddress exists for a user. If so, they need to login and are redirected back to the checkoutpage. Only problem I face is that the userID isn't added to the current order. (If i'm already logged in and start a new order, the userID is added to the order). How can I add or update the userID for this order? -
I would like to add extra fields to the customer form fields next to the default ones specified in https://docs.kongondo.com/start/checkout/custom-customer-form.html while checking out. In this particular instance I would like to add a checkbox for newsletter signup, which I would like to process after submitting or on next page of checkout. I've tried to add a field to custom_form_fields, however I don't seem to get the desired value (from $padloper->getOrderCustomer()). Is this possible and how would I handle this?
-
Do you have a eta for this feature? ?
-
Can't find custom addon
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Found out, I had a typo in renderViewURL (no caps URL). Nice to have those debug messages present ? -
Hi @kongondo, I have followed the guideline how to set up an addon for Padloper. The file is located in /site/templates/padloper/addons/CSVImporter/CSVImporter.php with classname CSVImporter It has the required methods. Any idea how to get this to be detected?
-
Asked this question privately to Bernhard, his reaction included I have been digging into RockMigrations and I'm trying to learn the workflow. I have the following MagicPage. <?php namespace ProcessWire; use RockMigrations\MagicPage; class ProjectPage extends Page { use MagicPage; public function migrate(): void { $rm = modules('RockMigrations'); $rm->migrate([ 'fields' => [ 'project_short_description' => [ 'type' => 'FieldtypeTextarea', 'label' => 'Beschrijving', 'notes' => 'Korte beschrijving zichtbaar op andere pagina\'s', 'rows' => 5, 'columnWidth' => 50, 'icon' => 'align-left', 'description' => '', 'inputfieldClass' => '', 'contentType' => 1, ], 'project_description' => [ 'type' => 'FieldtypeTextarea', 'label' => 'Inleidende beschrijving', 'rows' => 5, 'columnWidth' => 50, 'icon' => 'align-left', 'description' => '', 'inputfieldClass' => '', 'contentType' => 1, ], 'project_client' => [ 'name' => 'project_client', 'label' => 'Opdrachtgever', 'type' => 'FieldtypeText', ], 'project_subtitle' => [ 'label' => 'Subtitel', 'type' => 'FieldtypeTextarea', 'rows' => 2, ], 'project_state' => [ 'label' => 'Status', 'type' => 'FieldtypeSelect', 'select_options' => '1:=In voorbereiding 2:=In uitvoering 3:=Gerealiseerd', 'columnWidth' => 33.33334, ], 'project_number' => [ 'label' => 'Aantallen', 'type' => 'FieldtypeText', 'columnWidth' => 33.33334, ], 'project_partners' => [ 'label' => 'Partners', 'type' => 'FieldtypeText', 'columnWidth' => 33.33334, ], ], 'templates' => [ 'project' => [ 'fields' => [ 'title', 'project_short_description', 'project_description', 'project_client', 'project_subtitle', 'project_state', 'project_number', 'project_partners', ] ], ] ]); } } I have removed all the fields and templates that are in this migration. I was expecting the migration to execute when updating the migration inside the MagicPage and create all the fields and the template. This however works only if I add to migrate.php: $rm->migrate(['templates' => ['project']]); Is it possible to trigger the RM via MagicPage only? Or is this by design (Now that I think about it I can imagine you may want to have the MagicPage file in your project but not let it trigger)? ------ @bernhard's reply: ------- I have tested this, but in the case I have not created a 'project'-template yet, this will not trigger. I believe the Custom Page Class will only be triggered if you actually have a template with that name. As soon as I create a project template the migrate will trigger (which is fine for me).
-
Great! Was about to dig into RockMigrations tomorrow. So happy to see you so active! Thanks a lot!
-
Cleanest way to 'reset' padloper
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/8.1.6 ProcessWire 3.0.200 Padloper 0.0.5 -
Cleanest way to 'reset' padloper
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Noticed a typo @PadloperProcessRenderInstaller.php:228 'id' => "padloper_is_complate_removal", 'name' => 'padloper_is_complate_removal', Didn't resolve though -
Cleanest way to 'reset' padloper
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
I have not, other than deleting some orders. I can currently only give access to the website (with adminer enabled) itself. (It's locally hosted but open to the internet) -
Cleanest way to 'reset' padloper
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Using the shop/complete-removal I'm getting a Error encountered. No action was taken. Not sure how to debug (tracy not showing anything) -
Would uninstalling and installing padloper clear all padloper orders/products/settings? If not, what would be the cleanest way?
-
A short explanation would help anybody not familiar with the concept Great stuff, this helps a lot ? Easy to understand and definitely going to start using it.
-
It's probably me but I have a hard time to understand everything from the readme. I'm not sure how to start converting from the 'standard' way of adding stuff via admin interface to rockmigrations. Perhaps a simple workflow from adding a template with fields to actually pushing it to production? Things to consider when using rockmigrations.
-
Awesome ? I'm looking forward for a video about RockMigrations!
-
Changing order of existing productvariants
Spinbox replied to Spinbox's topic in ProcessWire Commerce (Padloper) Support
Thanks for your fast reply. I can imagine it would be nice for the shopowner to be able to change the order from within the editor. For example when he wants a variant to be in front of the others regardless of sorting from my end. I don't think it's a must however.