I modified the flat shipping method to have a different name and have a hidden select in the shipping method list div. If the flat shipping method is chosen - it should trigger the hidden select to appear. However - even with radio buttons or the select dropdown if the correct option is selected - it flashes the hidden div and the div is only visible on the second press, meaning the customer would need to double tap the option.
I've tried stopPropagation and preventDefault jquery methods for preventing this from happening - preventDefault does work, but has a few bugs, one of them is that the radio button is not selected on the press, and does not get selected. Is there maybe a easier/better way to achieve what I'm looking for?
Also I'm trying to get the new selected value in the controller, for example the quickcheckout module - it's not appearing in the $data (obviously), nt in the session->data, and not in the request->post (unless I'm doing something wrong), where is the best place to find the value of the newly added select? I'm trying to concactinate the order comment with this select value.
TDLR; The basic idea is that theres a flat shipping method that is used to ship to stationary post boxes and there's a select with the list of those stationary boxes. If the person chooses this shipping option - the hidden select appears, letting the person choose the shipping destination. Then in the controller it should add the shipping method to the end of the order comment - but I can't seem to fetch the value of the select in the shipping/quickchekout controllers.
current code (for select):
Code: Select all
$(document).on('click','.shipping-method-select',function(event){
if ( $( "#flat\\.flat" ).is(':selected') ) {
$(".hidden-select").css("display", "block");
}else{
$(".hidden-select").css("display", "none");
}
});
Code: Select all
$('#shipping_method_list').live('click', function (event) {
clicked_id = event.target.id;
if(clicked_id == 'flat.flat' && event.target.tagName == 'INPUT'){
$(".hidden-select").css("display", "block");
// if below are on - the radio button won't be changed, and there was another bug if I remember correctly.
// event.preventDefault();
// event.stopPropagation();
}else if(event.target.tagName != 'SPAN') {
$(".hidden-select").hide();
}
});