disabled and enabled checkout button

General discussion about AlegroCart - Post here if you can't find another suitable forum
Post Reply
heartbreak18
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

disabled and enabled checkout button

Post by heartbreak18 » Sun Mar 13, 2016 11:24 pm

how to disable checkout button when user hasn't choose the item?

but when user has choose an item the checkout button will active again.

thanks :)

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Post by leo » Mon Mar 14, 2016 12:38 am

You mean, the checkout button in the menu bar?

heartbreak18
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Post by heartbreak18 » Tue Mar 15, 2016 4:04 am

leo wrote:You mean, the checkout button in the menu bar?
yes leo, how can i do that?

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Post by leo » Tue Mar 15, 2016 7:30 am

Are you sure you want this?
If your customer adds products to the cart, but decides to continue the payment later and logs off, when he comes back, he cannot use the checkout button, although he has already products in his cart. This could be confusing for him.

heartbreak18
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Post by heartbreak18 » Tue Mar 15, 2016 11:28 pm

leo wrote:Are you sure you want this?
If your customer adds products to the cart, but decides to continue the payment later and logs off, when he comes back, he cannot use the checkout button, although he has already products in his cart. This could be confusing for him.
yeah i know leo, but i want to give a try :)

so, when costumer hasn't adds product to the cart they can't use the checkout button, but if costumer has adds product to the cart they can access the checkout button.

please help me :)

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Post by leo » Wed Mar 16, 2016 1:23 am

Modify catalog/template/defult/module/navigation.tpl to

Code: Select all

  <a href="<?php echo $account; ?>"><?php echo $text_account; ?></a>
  <?php if (@$login) { ?>
  <a href="<?php echo $login; ?>"><?php echo $text_login; ?></a>
  <?php } else { ?>
  <a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a>
  <?php } ?>
  <a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a>
  <a href="<?php echo $checkout; ?>" class="<?php echo ($enable_checkout ? 'enabled' : 'disabled'); ?>"><?php echo $text_checkout; ?></a>
</div>
</div>
<script type="text/javascript"><!--
	$(document).ready(function(){
		$("#bar a:last").css("border-right","0px");
	});
//--></script>
<script type="text/javascript"><!--
$(".b > a").on("click", function(event){
	if ($(this).hasClass("disabled")) {
		event.preventDefault();
	}
});
//--></script>
then add to the end of catalog/template/default/shred/add_to_cart.tpl:

Code: Select all

<script type="text/javascript"><!--
$(".add > .button").on("click", function(event){
	$('.b > a').removeClass("disabled");
});
//--></script>
add to catalog/extension/module/navigation.php:
below

Code: Select all

		$config   =& $this->locator->get('config');
this:

Code: Select all

		$cart   =& $this->locator->get('cart');
and below

Code: Select all

     		$view->set('cart', $url->href('cart'));
this line:

Code: Select all

    		$view->set('enable_checkout', $cart->hasProducts());
This should do the trick.

heartbreak18
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Post by heartbreak18 » Wed Mar 16, 2016 4:48 am

thanks leo :D

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Post by leo » Wed Mar 16, 2016 5:29 am

You are welcome.
Please use postreply and not quote.

Dubrey
Posts: 1
Joined: Wed Dec 05, 2018 3:28 am

Re: disabled and enabled checkout button

Post by Dubrey » Thu Dec 06, 2018 7:41 am

leo wrote:
Thu Dec 06, 2018 10:09 am
Hi, this phenomenal belly fat burners suggestion is not a fix, just a modification.
You have to add it manually.
Hi Leo, was this fix added to the default template or does it still have to be applied manually?
Last edited by Dubrey on Wed Oct 11, 2023 5:58 am, edited 2 times in total.

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Post by leo » Thu Dec 06, 2018 10:09 am

Hi, this is not a fix, just a modification.
You have to add it manually.

Post Reply