Jump to content

Spinbox

Members
  • Posts

    43
  • Joined

  • Last visited

Posts posted by Spinbox

  1. Yes I have PowerToys, but the habit of just using 50/50 is strong in me haha. Windows 11 can group 2 windows when you asign them for example with windows+leftarrow.

    I have to use 2x1080p occasionally when working on location.

    At home I have used 3440x1440p before this. And dual 1080p before that.

  2. I want to limit the purchase of some 'event'-typed product to 1 per user.

    Currently when an event is purchased the user get's added to a pagearrayfield which in turn grants them access to some pages.

    How could I limit the amount of a product to be added to the cart to 1? And after they bought it, how can I prevent them from buying it again?

    • Like 1
  3. On 2/27/2024 at 1:15 AM, kongondo said:

    Anyone using a 4K TV as a computer monitor? What has your experience been? Primary use would be coding and video editing (not gaming or graphics or for smart TV features). 43 inch, maybe LED or QLED (not OLED). What I've found out so far:

    1. Distance from screen!
    2. Anything bigger than 50 inch is asking for trouble (ergonomics).
    3. QLED best for bright rooms.
    4. OLED best for darker rooms but...
    5. OLED burn-in! and pricey!
    6. Eye strain + possible headaches (see #1).
    7. Refresh rate (not important for coding?).
    8. Auto dimming.
    9. Font aliasing (reverse RGB to BGR if possible).
    10. One big screen might be better than two smaller ones (central focal point) - YMMV!

    Thoughts?

    Thanks.

    I'm using a single 4k OLED 42" C2 tv as monitor for over a year now.

    1. Using same distance as normal dual monitors
    2. I wouldn't go any larger
    3. True
    4. and 5. If you have no direct window behind you, the glossy screen is great (there are some matte monitors with 4k out there right now, but I personally would go for oled for the deep blacks, which are not that deep on matte screens.. There is also coming an oled monitor from LG with glossy). No burn-in, I do have screensavers and hide the taskbar just in case. Burn-ins really should only occur when something is there for a VERY long time. My pc is on all day long.
    5. I have no problem myself
    6. I have 120hz, personally I really like that when I move windows around it's a bit smoother
    7. Autodimming can be disabled for mine (some program is needed)
    8. Small fonts not looking great when it's a particular color combination, like red on yellow. This might be different for different TV panel types.
    9. I'm usually splitting the screen in 2, but this is particular a personal preference. (It's possible to have 25%/50%/25% but the 25% would be a bit narrow for a code editor)

    Perhaps looking at the new (and not yet released) 4k oled monitors could be an option. If OLED is a no-go then I would still have a 42" monitor. One thing; if you are used to this, working on dual monitors is not very pleasant (especially 2x 1080p).

    • Thanks 1
  4. Hi @kongondo ,

    The admin currently has to select a field and select a value to get the results they want. In this case I only want to show a certain product type. I want to make it a bit easier to use (specially for this product type). What is the best way to have this easily accessible? 

    image.thumb.png.182ad922336960f027f3f1e91cf65fdc.png

     

    Thanks,

  5. It's probably easier to use Adminer (since I also use tracy). I have been using phpmyadmin for so long that I didn't think about alternatives 🙂 

    I have tried to get the pw:install command working. It looks like the stepAdmin data isn't being saved (url, user credentials,) or executed properly, the install files don't get deleted either.
    owever, this does work when I use them as options --name=Name etc. Not sure why that is.


    After some more testing I found out I actually didn't delete the previous databases these tries. My bad.

  6. 19 minutes ago, bernhard said:

    Nice 😎 Why are you adding phpmyadmin? Isn't that a ddev default anyhow? 

    1 hour ago, Spinbox said:

    It isn't anymore. but the following code can be changed for ddev get ddev/ddev-phpmyadmin

      # Automatically add phpMyAdmin to .ddev/config.yaml
        echo "services:" >> .ddev/config.yaml
        echo "  phpmyadmin:" >> .ddev/config.yaml
        echo "    type: phpmyadmin" >> .ddev/config.yaml
        echo "    port: 8036" >> .ddev/config.yaml
    • When you have to choose Timezone you have to set an integer (god knows which), instead of for example Europe/Amsterdam
    • 19 minutes ago, bernhard said:

      And could you please give me some more details if there's something that should be fixed here?

      I will try to look into the specifics

    • Thanks 1
  7. Yes, I have added rockshell alias, and a function to make it some less effort to get default setup.

    function setup_spinbox_project() {
        # Convert project name to lowercase
        local project_name=$(echo "$1" | tr '[:upper:]' '[:lower:]')
    
        # Check if project name is provided
        if [[ -z "$project_name" ]]; then
            echo "Please provide a project name."
            return 1
        fi
    
        # Clone the repository and check for success
        git clone git@gitlab.com:#############################.git "$project_name"
        if [ $? -ne 0 ]; then
            echo "Failed to clone the repository. Check your access rights."
            return 1
        fi
    
        # Change to the project directory
        cd "$project_name" || return
    
        # Run ddev config
        ddev config
    
        # Automatically add phpMyAdmin to .ddev/config.yaml
        echo "services:" >> .ddev/config.yaml
        echo "  phpmyadmin:" >> .ddev/config.yaml
        echo "    type: phpmyadmin" >> .ddev/config.yaml
        echo "    port: 8036" >> .ddev/config.yaml
    
        # Start ddev
        ddev start
    
        # Run RockShell commands
        rockshell pw:download
        rockshell pw:install
    
        echo "Setup for $project_name complete."
    }

     

    • Like 1
  8. 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(),
    		},
    	})
    	...
    }

     

  9. @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();
    	}

     

  10. 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?

  11. 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?

    • Like 1
×
×
  • Create New...