Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WooCommerce review-order.php排序_Woocommerce - Fatal编程技术网

WooCommerce review-order.php排序

WooCommerce review-order.php排序,woocommerce,Woocommerce,我们需要在review-order.php中有两个表来显示表1中的发票项目和表2中的信用卡购买 这里我有一个基本的概念概述 <?php if($gateways == 'bacs') { ?> <div id="order_review"> <table class="shop_table"> <thead> <tr>

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

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

    <?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

     <?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中包装时,这些表会完全消失


如果有人能提供一些更好的建议,我们将不胜感激。谢谢

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

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


非常感谢。您的替代方法已经达到了它的目的,但由于某种原因,我为产品设置的网关过滤器似乎在review-order.php之前被重置。只有paypal显示产品及其同时显示paypal和bacs产品:(.我有代码要显示,但需要声誉。是的,很抱歉,我不想在此评论区发布它,因为格式不太准确。我不太熟悉stackoverflow,因为我会根据需要建立声誉。此外,我还通过调用实际产品ID的in_数组,找到了如何按发票和PayPal拆分表的方法
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
     }
}