0

Here is my code:

<div class="btn-wrapper pull-left">
    <a target="__blank" href="<?php echo $burl.'/print_delivery?
    id='.$value['order_id']; ?>" class="btn btn-default btn-sm"><span 
    class="glyphicon glyphicon-print"></span> Print
    </a>
</div>

I want to disable this button when my order status is completed.

UmarZaii
  • 1,355
  • 1
  • 17
  • 26
angga
  • 89
  • 3
  • 9
  • 1
    Is there a reason you don't use a semantic ` – msanford Jul 18 '17 at 12:10

3 Answers3

0

Hope, This will help you.

<div class="btn-wrapper pull-left">
    <a target="__blank" href="<?php echo $burl.'/print_delivery?
    id='.$value['order_id']; ?>" class="btn btn-default btn-sm" <?php if (condition here){ ?> disabled <?php   } ?>><span 
    class="glyphicon glyphicon-print"></span> Print
    </a>
</div>
Raru
  • 371
  • 1
  • 4
  • 19
0

it would be easy with Button to disable with disabled property but you can add condition to your link as per your current code:

<div class="btn-wrapper pull-left">
    <a target="__blank" href="<?php echo ($value['status'] == 'completed') ? $burl.'/print_delivery?
    id='.$value['order_id'] : '#' ; ?>" class="btn btn-default btn-sm"><span 
    class="glyphicon glyphicon-print"></span> Print
    </a>
</div>

assumed status would be like this : $value['status'] == 'completed'

fly.. you can also add link to button using javascript.

<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />
Jigar Shah
  • 6,143
  • 2
  • 28
  • 41
0
<div class="btn-wrapper pull-left">
<a target="__blank" <?php if($data['order_status'] =="Completed"){ ?>   <?php   }else{ ?> href="<?php echo $burl.'/print_delivery?
id='.$value['order_id']; ?>"<?php } ?> class="btn btn-default btn-sm" ><span 
class="glyphicon glyphicon-print"></span> Print
</a>

OR

<div class="btn-wrapper pull-left">
<a target="__blank" <?php if (condition to activate button here){ ?>  href="<?php echo $burl.'/print_delivery?
id='.$value['order_id']; ?>" <?php   } ?> class="btn btn-default btn-sm" ><span 
class="glyphicon glyphicon-print"></span> Print
</a>

Hope these will help you

Raru
  • 371
  • 1
  • 4
  • 19
  • this is my status $data['order_status'] = ['wc-processing'=>'Processing', 'wc-on-hold'=>'On Hold', 'wc-completed'=>'Completed', 'wc-pending'=>'Pending']; – angga Jul 18 '17 at 12:34