AlegroCart open source E-commerce
Web hosting by Host1Plus

disabled and enabled checkout button

General discussion about AlegroCart - Post here if you can't find another suitable forum

disabled and enabled checkout button

Postby 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 :)
heartbreak18
 
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Postby leo » Mon Mar 14, 2016 12:38 am

You mean, the checkout button in the menu bar?
User avatar
leo
admin
 
Posts: 4220
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Postby 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?
heartbreak18
 
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Postby 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.
User avatar
leo
admin
 
Posts: 4220
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Postby 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 :)
heartbreak18
 
Posts: 9
Joined: Fri Feb 19, 2016 10:51 pm

Re: disabled and enabled checkout button

Postby 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.
User avatar
leo
admin
 
Posts: 4220
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: disabled and enabled checkout button

Postby heartbreak18 » Wed Mar 16, 2016 4:48 am

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

Re: disabled and enabled checkout button

Postby leo » Wed Mar 16, 2016 5:29 am

You are welcome.
Please use postreply and not quote.
User avatar
leo
admin
 
Posts: 4220
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron