Post by herve11170 » Sat Apr 18, 2020 2:36 pm

Hi,
I have a problem:
I need that my clients check the radio button to select the shipping method (pickup, delivery,...).
I don't want the first shipping method by default checked.
So I removed the checked="checked" from the input radio shipping method in chekout.tpl.
The problem I have is if the client does not select a shipping method, he can checkout and pay.
I need to have a warning message and something who check if radio button of shipping method is o no checked.
I don't understand why there is no warning message for this.
Is there a check (radio:checked) for the shipping method?
Where can I find it?
I have seen this in my one page checkout tpl:

Code: Select all

jQuery(".shipping-method").load('index.php?route=checkout/checkout/shipping_method', $('.checkout_form input[type=\'text\'], .checkout_form input[type=\'date\'], .checkout_form input[type=\'datetime-local\'], .checkout_form input[type=\'time\'], .checkout_form input[type=\'password\'], .checkout_form input[type=\'hidden\'], .checkout_form input[type=\'checkbox\']:checked, .checkout_form input[type=\'radio\']:checked,input[name=\'shipping_method\']:first, .checkout_form textarea, .checkout_form select'), function() 
    {
		if (jQuery("input[name=\'shipping_method\']:first").length) 
		{
			jQuery("input[name=\'shipping_method\']:first").attr('checked', 'checked').prop('checked', true).click();
		} else
		{
			jQuery("#cart_table").load('index.php?route=checkout/checkout/cart', $('.checkout_form input[type=\'text\'], .checkout_form input[type=\'date\'], .checkout_form input[type=\'datetime-local\'], .checkout_form input[type=\'time\'], .checkout_form input[type=\'password\'], .checkout_form input[type=\'hidden\'], .checkout_form input[type=\'checkbox\']:checked, .checkout_form input[type=\'radio\']:checked, .checkout_form textarea, .checkout_form select'));	
		}
    });
I think it's here but I don't know how to do it...
Thank u very much for your help.
Opencart V2.0.1.1

New member

Posts

Joined
Wed Feb 15, 2017 1:39 pm

Post by straightlight » Sat Apr 18, 2020 7:14 pm

You could use an extension from the Marketplace to restrict shipping methods. There's a good one here you could use: https://www.opencartx.com/restrict-shipping-methods .

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by herve11170 » Sat Apr 18, 2020 8:21 pm

Thanks for your reply.
But I think I didn't express myself well.
If I let the default input radio shipping method to checked="checked", people forget to change the option to delivery if they need a delivery.
So, I removed checked="checked" from the input to force them to select a shipping method 8pickup or delivery).
although I removed the "checked" it seems that, when confirming the order (if no shippping method is selected), the program takes into account by default "pickup at our store" instead of putting an error message that nothing has been selected.
It seems that by default, it is the first option which is selected (with or without "checked" ) and I would like to remove this to have an error message (please select a transport method). I don't know where to search if it's in checkout.php, shipping-method.php, confirm.php or just in the script I put up.
thanks

New member

Posts

Joined
Wed Feb 15, 2017 1:39 pm
Who is online

Users browsing this forum: No registered users and 192 guests