Jump to content

[SOLVED]How to skip step carrier in checkout


Recommended Posts

in order.php you must find

/* 4 steps to the order */
   switch (intval($step))
   {
       case 1:



you will find there the steps as case 1 , 2, 3 and 4

if you want to skip carrier you have to replace

case 2:
           if(Tools::isSubmit('processAddress'))
               processAddress();
           autoStep(2);
           displayCarrier();
           break;



with

case 2:
           if(Tools::isSubmit('processAddress'))
               processAddress();
           autoStep(2);
           displayPayment();
           break;



this will skip carrier and go from adresses directly to payment.

you will have to edit order-steps.tpl also to hide the carrier step.

Link to comment
Share on other sites

A final thing... When on the payment page and clicking on the previous button, it doesn't go back to address. The link is order.php?step=2 and that's probably the link to the carrier page. Any idea how to fix that so that it returns to address?

That was really the last question :)

Sorry to bother you but I found out myself. In themes/prestashop/order-payment.tpl you need to change this line:

« {l s='Previous'}



to this:

« {l s='Previous'}



So step 1 instead of 2...

Link to comment
Share on other sites

  • 2 weeks later...

OMG! Thank you SOOO Much. The carrier thing doesn't even matter because we do free shipping here and the carrier changes dependent on a variety of factors that Prestashop could not handle figuring out. Bypassing the carrier is a LIFESAVER. I just finished with implementing your fix here and this problem that has eaten me alive for 2 days now is finally RESOLVED with this fix. Now my storefront actually works!!

Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You! Thank You!

  • Like 1
Link to comment
Share on other sites

It is a good tips and worked for me but my problem is, in this step there is also radio check for agreement which my buyer have to thick on it, and then i also offer gift wrap.

how to move this 2 things to "address step"?


Good question.

I also would like to skip the carrier part and move the checkbox for agreement which my buyer to the 'address' part.

Any solutions on this?
Link to comment
Share on other sites

  • 2 months later...

Hi all,

I've followed these instructions and it works ok, BUT when printing the invoice the field "shipment cost" appears as zero. The amount of the invoice is correct, but I've looked at the ps_orders table and the field id_carrier is set to zero.

What else should we modify in order to set this field automatically to the carrier id value when placing an order?

Thank you!

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
Hi all,

I've followed these instructions and it works ok, BUT when printing the invoice the field "shipment cost" appears as zero. The amount of the invoice is correct, but I've looked at the ps_orders table and the field id_carrier is set to zero.

What else should we modify in order to set this field automatically to the carrier id value when placing an order?

Thank you!


help pls
Link to comment
Share on other sites

  • 2 months later...

There is some code in classes/Cart.php that is usefull to avoid hardcoding.

Besides all steps before that have to made,

i change line 83 (in PS V-1.3.1) from:

$fields['id_carrier'] = intval($this->id_carrier);



to:

$fields['id_carrier'] = intval(Configuration::get('PS_CARRIER_DEFAULT'));



that takes the default carrier, also in ps_cart

Link to comment
Share on other sites

  • 1 month later...

I try to skip carrier in PS 1.4 but its harder, because of the controllers/OrderController.php is so structured.

Know anybody the configuration ??

thx

edit:
for me it is solved PS 1.4.1 the changes in OrderController.php see link

or i can copy it to this thread.

Link to comment
Share on other sites

  • 1 year later...

I've changed the line

 

<form action="{$link->getPageLink('order.php', true)}" method="post">

 

to

<form action="{$base_dir}modules/cashondelivery/validation.php" method="post" onsubmit="return acceptCGV();">

 

In order-address.tpl...

 

Also...i've made changes in OrderController.php from here http://www.prestashop.com/forums/topic/74445-can-i-hide-carrier-selection-step-in-prestashop/

 

 

Everything works, except the messages the customers are leaving...

 

From what i've tested, the problem is within the FORM ACTION.

 

Any ideas?

 

thanks

Link to comment
Share on other sites

  • 9 months later...
  • 6 months later...
  • 1 year later...
  • 3 months later...
  • 9 months later...
  • 3 months later...

This is another solution that works for us (Prestashop 1.6.x):

 

1 - Go to theme/shopping-cart.tpl and find 

{if !$opc}
<center> 
			<a
				href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&back={$back}')|escape:'html':'UTF-8'}{else}{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}{/if}"
				class="button-exclusive btn btn-default btn-warning"  
				title="{l s='Proceed to checkout'}" >
				<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
			</a></center>
		{/if}

change it to:

{if !$opc}

{if $conditions}
				<p class="carrier_title">{l s='Terms of service'}</p>
				<p class="checkbox">
					<input type="checkbox" name="cgv" id="cgv1" value="1"  />
					<label for="cgv1">{l s='I agree to the terms of service and will adhere to them unconditionally.'}</label>
					<a href="{$link_conditions|escape:'html':'UTF-8'}" class="iframe" rel="nofollow">{l s='(Read the Terms of Service)'}</a>
				</p>
			{/if}

<center> 
			<a
				href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&back={$back}')|escape:'html':'UTF-8'}{else}{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}{/if}"
				class="button-exclusive btn btn-default btn-warning" id="butonProceed"   
				title="{l s='Proceed to checkout'}" >
				<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
			</a></center>
		{/if}

so now you will ask for TermsAndConditions on the step1. For that condition to work, go to global.js and add this:

$('#butonProceed').on('click',function(e) {
if( $('#cgv1').prop('checked') == false ){
alert("You must agree to the terms of service before continuing");
e.stopPropagation(); 
e.preventDefault();
return false;}
});

Good. Now go to theme/order-address.tpl and find the proceed to checkout button:

<button type="submit" name="processAddress" class="btn btn-warning btn-default">
					<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
				</button>

And change it to this:

<button type="submit" name="processAddress" id="clickSingur" class="btn btn-warning btn-default">
					<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
				</button>

And at the end of the code, add this:

<script>{literal}
window.setInterval(clickSingur(), 1);

function clickSingur(){

$('#clickSingur').click();

}
{/literal}</script>

Good. Now the address step will be skipped. Go to theme/order-carrier.tpl and find this

{if $conditions AND $cms_id}
				<p class="carrier_title">{l s='Terms of service'}</p>
				<p class="checkbox">
					<input type="checkbox" name="cgv" id="cgv" value="1" {if ...} />
					<label for="cgv">{l s='I agree to the terms of service and will adhere to them unconditionally.'}</label>
					<a href="{$link_conditions|escape:'html':'UTF-8'}" class="iframe" rel="nofollow">{l s='(Read the Terms of Service)'}</a>
				</p>
			{/if}

and change it to this:

{if $conditions AND $cms_id}
				<p class="carrier_title">{l s='Terms of service'}</p>
				<p class="checkbox">
					<input type="checkbox" name="cgv" id="cgv" value="1" checked />
					<label for="cgv">{l s='I agree to the terms of service and will adhere to them unconditionally.'}</label>
					<a href="{$link_conditions|escape:'html':'UTF-8'}" class="iframe" rel="nofollow">{l s='(Read the Terms of Service)'}</a>
				</p>
			{/if}

now find this:

<button  type="submit"  name="processCarrier" class="btn btn-warning" >
							
								{l s='Proceed to checkout'}
								<i class="icon-chevron-right right"></i>
							
						</button>

and change it to this:

<button  type="submit" id = "apasaSingur" name="processCarrier" class="btn btn-warning" >
							
								{l s='Proceed to checkout'}
								<i class="icon-chevron-right right"></i>
							
						</button>

and at the end of the code add this:

<script>{literal}
window.setInterval(clickSingur(), 1);

function clickSingur(){

$('#apasaSingur').click();

}
{/literal}</script>

Now the carrier step will be completed automaticly.

Now go to theme/modules/cashondelivery/views/templates/front/validation.tpl and find:

 <button  type="submit" class="btn btn-warning button " >
        <span>{l s='I confirm my order' mod='cashondelivery'}               </span>	      </button> 

and change it to this:

 <button id="confirmaAutomat" type="submit" class="btn btn-warning button ">
        <span>{l s='I confirm my order' mod='cashondelivery'}               </span>	      </button> 

And now at the end of the code add this:

<script>{literal}
window.setInterval(clickSingur(), 1);

function clickSingur(){

$('#confirmaAutomat').click();

}
{/literal}</script>

And now the order will be confirmed automaticly. You can do that on any payment method validation tpl as well.

 

Tested and working perfect;)

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