Jump to content

Adding order button on one page checkout instead "save" and payment choice


Detelin Markov

Recommended Posts

Hi devs,

 

I try to remove confusing of some client with checkout page with adding "Order" button that to do:

When user click on "Order" button -> to be clicked "save" button, if account is created -> click one payment choice.

 

I already move cash on delivery confirmation button instead payment select  - now when user "save" account arrive cash on delivery confirm button.

 

I try to do this with jQuery but something is not properly:

 

- first buttons:

<p class="submit">
<input type="submit" class="orderbutton" id="orderbutton" value="{l s='Order'}" />
</p>

---------

<p class="submit">
<input type="submit" class="exclusive button" name="submitGuestAccount" id="submitGuestAccount" value="{l s='Save'}" />
</p>

----------

<div class="cod_cofirm">
<form action="http://bijutaniki.com/module/cashondelivery/validation" method="post">
	<input type="hidden" name="confirm" value="1">
	<p class="cart_navigation" id="cart_navigation">
		<input type="submit" value="COD Confirm Button" class="extraorderbutton">
	</p>
</form>
</div>

and jQuery:

$(document).ready(function () {
    var firstFormValid = false;
    var isFormValid = false;
    $('#orderbutton').click(function(){
        if(anycondition) 
           firstFormValid = true;
    });

    $("#submitGuestAccount").click(function () {
         if(firstFormValid ) {
         if($("#email").val().trim().length>0 &&$("#customer_firstname").val().trim().length>0 && $("#customer_lastname").val().trim().length>0 )  {
             isFormValid = true;     
         } else isFormValid = false;
         } else firstFormValid =false; 
    }); 

    $("#extraorderbutton").click(function () {
       if(isValid && firstFormValid)
           $('#extraorderbutton').submit()
    });
});

What are you think? How to add "Order" button properly and where is my mistake in jQuery script?

 

May be i need to use selector from AuthController.php?

// if register process is in two steps, we display a message to confirm account creation
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE'))
	$this->context->cookie->account_created = 1;
$customer->logged = 1;
$this->context->cookie->email = $customer->email;
$this->context->cookie->is_guest = !Tools::getValue('is_new_customer', 1);

Thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...