这是我的代码:
<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>
我想在订单状态完成后停用此按钮。
答案 0 :(得分:0)
希望,这会对你有帮助。
<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>
答案 1 :(得分:0)
Button
属性禁用disabled
会很容易,但您可以根据当前代码为链接添加条件:
<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>
假设状态如下:$value['status'] == 'completed'
飞..你也可以使用javascript添加链接到按钮。
<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />
答案 2 :(得分: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>
希望这些能帮到你