首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WooCommerce评审-order.php排序

WooCommerce评审-order.php排序
EN

Stack Overflow用户
提问于 2013-08-14 14:16:19
回答 1查看 710关注 0票数 0

我们需要有两个审查表-order.php来显示表1中的发票项目和表2中的信用卡采购。

在这里,我有一个基本的概念概述。

代码语言:javascript
复制
    <?php if($gateways == 'bacs') { ?>
      <div id="order_review">   
        <table class="shop_table">
         <thead>            
           <tr>
             <th class="product-name"><?php _e('Invoice Products', 'yit'); ?></th>
             <th class="product-quantity"><?php _e('Qty', 'yit'); ?></th>
             <th class="product-total"><?php _e('Totals', 'yit'); ?></th>
           </tr>
         </thead>

表2

代码语言:javascript
复制
     <?php if($gateways == 'paypal') { ?>
       <div id="order_review">
        <table class="shop_table">
         <thead>            
           <tr>
             <th class="product-name"><?php _e('Credit Card Products', 'yit'); ?></th>
             <th class="product-quantity"><?php _e('Qty', 'yit'); ?></th>
             <th class="product-total"><?php _e('Totals', 'yit'); ?></th>
           </tr>
         </thead>

问题是,当将表包装在IF中时,这些表就会完全消失。

如果有人能帮助至少一些更好的想法,这将是非常感谢的。谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-14 14:38:21

您从哪里获得$gateways变量?在不知道的情况下,很难理解为什么您的代码不能工作。但这是获取网关的代码。

$woocommerce->payment_gateways->get_available_payment_gateways();= $available_gateways

代码语言:javascript
复制
foreach ( $available_gateways as $gateway ) {
     if ( $gateway->chosen === 'paypal' ) {
          // do something
     }

     // alternative you can try id if that matches
     if ( $gateway->id === 'paypal' ) {
          // do something
     }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18234216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档