• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wc_get_formatted_variation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wc_get_formatted_variation函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_formatted_variation函数的具体用法?PHP wc_get_formatted_variation怎么用?PHP wc_get_formatted_variation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wc_get_formatted_variation函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: add_column_data

 /**
  * Add data for our newly-added custom columns.
  * @access public
  * @since  1.0.0
  * @param  string $column_name
  * @param  int $id
  * @return void
  */
 public function add_column_data($column_name, $id)
 {
     global $wpdb, $post;
     switch ($column_name) {
         case 'id':
             echo $id;
             break;
         case 'course-prerequisite':
             $course_prerequisite_id = get_post_meta($id, '_course_prerequisite', true);
             if (0 < absint($course_prerequisite_id)) {
                 echo '<a href="' . esc_url(get_edit_post_link(absint($course_prerequisite_id))) . '" title="' . esc_attr(sprintf(__('Edit %s', 'woothemes-sensei'), get_the_title(absint($course_prerequisite_id)))) . '">' . get_the_title(absint($course_prerequisite_id)) . '</a>';
             }
             break;
         case 'course-woocommerce-product':
             if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated()) {
                 $course_woocommerce_product_id = get_post_meta($id, '_course_woocommerce_product', true);
                 if (0 < absint($course_woocommerce_product_id)) {
                     if ('product_variation' == get_post_type($course_woocommerce_product_id)) {
                         $product_object = get_product($course_woocommerce_product_id);
                         if (sensei_check_woocommerce_version('2.1')) {
                             $formatted_variation = wc_get_formatted_variation($product_object->variation_data, true);
                         } else {
                             $formatted_variation = woocommerce_get_formatted_variation($product_object->variation_data, true);
                         }
                         $product_name = $product_object->parent->post->post_title . '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . ucwords($formatted_variation);
                     } else {
                         $product_name = get_the_title(absint($course_woocommerce_product_id));
                     }
                     // End If Statement
                     echo '<a href="' . esc_url(get_edit_post_link(absint($course_woocommerce_product_id))) . '" title="' . esc_attr(sprintf(__('Edit %s', 'woothemes-sensei'), $product_name)) . '">' . $product_name . '</a>';
                 }
                 // End If Statement
             }
             // End If Statement
             break;
         case 'course-category':
             $output = get_the_term_list($id, 'course-category', '', ', ', '');
             if ('' == $output) {
                 $output = __('None', 'woothemes-sensei');
             }
             // End If Statement
             echo $output;
             break;
         default:
             break;
     }
 }
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:55,代码来源:class-woothemes-sensei-course.php


示例2: get_product_variation_title

 /**
  * Return a formatted product title based on variation id.
  *
  * @param  int    $item_id
  * @return string
  */
 public static function get_product_variation_title($variation_id)
 {
     if (is_object($variation_id)) {
         $variation = $variation_id;
     } else {
         $variation = wc_get_product($variation_id);
     }
     if (!$variation) {
         return false;
     }
     if (WC_CP_Core_Compatibility::is_wc_version_gte_2_5()) {
         $description = $variation->get_formatted_variation_attributes(true);
     } else {
         $description = wc_get_formatted_variation($variation->get_variation_attributes(), true);
     }
     $title = $variation->get_title();
     $sku = $variation->get_sku();
     if ($sku) {
         $identifier = $sku;
     } else {
         $identifier = '#' . $variation->variation_id;
     }
     return self::format_product_title($title, $identifier, $description);
 }
开发者ID:alexbaron50,项目名称:Rockk3rs-Lab-Test,代码行数:30,代码来源:class-wc-cp-helpers.php


示例3: get_permalink

    ?>
				        <a href="<?php 
    echo get_permalink($oProduct->id);
    ?>
">
					        <?php 
    echo get_the_title($oProduct->id);
    ?>
					    </a>
                    <?php 
}
?>
                    </h4>
                    <div class="uni-wishlist-variation-details">
                        <?php 
echo wc_get_formatted_variation($aVarAttrs);
?>
                    </div>
                    <div class="uni-wishlist-item-availability">
					<?php 
$aAvailability = $oProduct->get_availability();
echo '<span class="uni-wishlist-item-avail-' . $aAvailability['class'] . '">' . $aAvailability['availability'] . '</span>';
?>
                    </div>
                </div>
            </td>
            <td>
                <?php 
echo $oProduct->get_price_html();
?>
            </td>
开发者ID:WP-Panda,项目名称:m.video,代码行数:31,代码来源:bridalitem-variation-table-row-my.php


示例4: esc_url

            } else {
                ?>
						<a href="<?php 
                echo esc_url(get_permalink(apply_filters('woocommerce_in_cart_product', $values['prod_id'])));
                ?>
">
							<?php 
                echo str_replace(array('http:', 'https:'), '', $thumbnail) . $product_name;
                ?>
						</a>
					<?php 
            }
            ?>
						<?php 
            if (!empty($values['variation_id'])) {
                echo wc_get_formatted_variation(unserialize($values['variation_data']), false);
            }
            ?>
						<?php 
            echo $addons_str;
            //addon info
            if (isset($dvin_wcql_settings['no_price']) && $dvin_wcql_settings['no_price'] != 'on') {
                echo apply_filters('woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf('%s &times; %s', $values['quantity'], $price_in_html) . '</span>');
                ?>
					<?php 
            }
        }
    }
    ?>
	</li>
	<p class="buttons">
开发者ID:berisberis,项目名称:betterquote,代码行数:31,代码来源:mini-cart.php


示例5: wc_get_formatted_variation

</a><br/>
							<?php 
                if (!empty($values['variation_id'])) {
                    echo wc_get_formatted_variation($product_obj->variation_data, false);
                }
                //get price before showing the addon data as proce could change
                if (!isset($values['price'])) {
                    $values['price'] = get_quotelist_product_price($product_obj);
                }
                $temp_arr = array();
                if (isset($addon_cart_obj) && $addon_cart_obj instanceof Product_Addon_Cart) {
                    $temp_arr = dvin_wcql_get_add_on_list($addon_cart_obj, $values['price'], $product_obj, $values);
                } else {
                    $temp_arr = dvin_wcql_get_add_on_list(array(), $values['price'], $product_obj, $values);
                }
                echo wc_get_formatted_variation($temp_arr, false);
                ?>
						</td>
						<?php 
                if (!$remove_price_col) {
                    ?>
						<td class="product-price">
						<?php 
                    $price_in_html = apply_filters('woocommerce_cart_product_price', wc_price($values['price']), $product_obj);
                    echo apply_filters('woocommerce_cart_item_price', $price_in_html, '', '');
                    ?>
</td>
                        <?php 
                }
                //end of checking remove price or not
                if (isset($dvin_wcql_settings['show_sku_col']) && $dvin_wcql_settings['show_sku_col'] == 'on') {
开发者ID:berisberis,项目名称:betterquote,代码行数:31,代码来源:quotelist.php


示例6: update

 /**
  * Updates an existing product.
  *
  * @since 2.7.0
  * @param WC_Product
  */
 public function update(&$product)
 {
     $post_data = array('ID' => $product->get_id(), 'post_title' => get_the_title($product->get_parent_id()) . ' &ndash; ' . wc_get_formatted_variation($product, true, false), 'post_parent' => $product->get_parent_id(), 'comment_status' => 'closed', 'post_status' => $product->get_status() ? $product->get_status() : 'publish', 'menu_order' => $product->get_menu_order());
     wp_update_post($post_data);
     $this->update_post_meta($product);
     $this->update_terms($product);
     $this->update_attributes($product);
     $product->save_meta_data();
     do_action('woocommerce_update_product_variation', $product->get_id());
     $product->apply_changes();
     $this->update_version_and_type($product);
     $this->update_term_counts($product);
     $this->clear_caches($product);
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:20,代码来源:class-wc-product-variation-data-store-cpt.php


示例7: get_permalink

    ?>
                    <a href="<?php 
    echo get_permalink($oProduct->id);
    ?>
">
                        <?php 
    echo get_the_title($oProduct->id);
    ?>
                    </a>
                <?php 
}
?>
            </h4>
            <div class="uni-wishlist-variation-details">
                <?php 
echo wc_get_formatted_variation($vat_atts);
?>
            </div>
            <div class="uni-wishlist-item-availability">
                <?php 
$aAvailability = $oProduct->get_availability();
echo '<span class="uni-wishlist-item-avail-' . $aAvailability['class'] . '">' . $aAvailability['availability'] . '</span>';
?>
            </div>
        </div>
    </td>
    <td>
        <?php 
echo $oProduct->get_price_html();
?>
    </td>
开发者ID:WP-Panda,项目名称:m.video,代码行数:31,代码来源:item-variation-table-row.php


示例8: vouchers_meta_box


//.........这里部分代码省略.........
</a>
								<?php 
                if ($voucher->file_exists(WC_PDF_Product_Vouchers::get_uploads_path())) {
                    ?>
									<a href="<?php 
                    echo esc_url(add_query_arg(array('action' => 'download', 'product_id' => $item['product_id'], 'item_id' => $item_id, 'voucher_id' => $item['voucher_id'])));
                    ?>
"><?php 
                    esc_html_e('Download', WC_PDF_Product_Vouchers::TEXT_DOMAIN);
                    ?>
</a>
								<?php 
                }
                ?>
							</td>
							<td class="voucher_number" width="1%">
								<?php 
                echo $voucher->get_voucher_number();
                ?>
							</td>
							<td class="sku" width="1%">
								<?php 
                if ($_product->sku) {
                    echo $_product->sku;
                } else {
                    echo '-';
                }
                ?>
							</td>
							<td class="data">

								<?php 
                echo $item['name'];
                ?>
								<?php 
                if (!empty($voucher_data)) {
                    echo '<br/>' . wc_get_formatted_variation($voucher_data, true);
                }
                ?>
							</td>

							<td class="expires" style="width:auto;">
								<input type="text" name="voucher_expiration[<?php 
                echo $item_id;
                ?>
]" id="voucher_expiration_<?php 
                echo $item_id;
                ?>
" maxlength="10" value="<?php 
                echo $voucher->expiration_date ? date("Y-m-d", $voucher->expiration_date) : '';
                ?>
" class="date-picker-field" />
							</td>

							<td class="qty" width="1%">
								<?php 
                echo $item['qty'];
                ?>
							</td>

							<td class="redeem" width="1%">
								<?php 
                foreach ($item['voucher_redeem'] as $i => $redeem) {
                    ?>
									<input type="text" name="voucher_redeem[<?php 
                    echo $item_id;
                    ?>
][<?php 
                    echo $i;
                    ?>
]" id="voucher_redeem_<?php 
                    echo $item_id . '_' . $i;
                    ?>
" class="voucher_redeem date-picker-field" maxlength="10" style="width:85px;" value="<?php 
                    echo $redeem;
                    ?>
" class="date-picker-field" />
									<?php 
                }
                ?>
							</td>

						</tr>
					<?php 
            }
        }
        ?>
				</tbody>
			</table>
		</div>

		<p class="buttons buttons-alt">
			<button type="button" class="button redeem_all_vouchers"><?php 
        _e('Redeem All &uarr;', WC_PDF_Product_Vouchers::TEXT_DOMAIN);
        ?>
</button>
		</p>
		<div class="clear"></div>
		<?php 
    }
开发者ID:reti-senza-frontiere,项目名称:WP-Plugins,代码行数:101,代码来源:class-wc-pdf-product-vouchers-admin-orders.php


示例9: get_contents

        public function get_contents($order, $package)
        {
            $totals = 0;
            foreach ($package->packed as $key => $item) {
                $item_ids[] = $item['meta']['id'];
            }
            $items = $order->get_items();
            $counts = array_count_values($item_ids);
            foreach ($counts as $key => $qty) {
                $product = wc_get_product($key);
                $parent = wc_get_product($product->parent->post->ID);
                $item = get_post_meta($key);
                $price = $product->price;
                $total = $price * $qty;
                $totals += $total;
                ?>
        
			<tr>
            	<td class="slp_thumb"><?php 
                if ($product) {
                    ?>
				<a href="<?php 
                    echo esc_url(admin_url('post.php?post=' . absint($product->id) . '&action=edit'));
                    ?>
" class="tips" data-tip="<?php 
                    echo '<strong>' . __('Product ID:', 'slp') . '</strong> ' . absint($product->id);
                    if ($product->variation_id && 'product_variation' === get_post_type($product->variation_id)) {
                        echo '<br/><strong>' . __('Variation ID:', 'slp') . '</strong> ' . absint($product->variation_id);
                    } elseif ($product->variation_id) {
                        echo '<br/><strong>' . __('Variation ID:', 'slp') . '</strong> ' . absint($product->variation_id) . ' (' . __('No longer exists', 'slp') . ')';
                    }
                    if ($product && $product->get_sku()) {
                        echo '<br/><strong>' . __('Product SKU:', 'slp') . '</strong> ' . esc_html($product->get_sku());
                    }
                    if ($product && isset($product->variation_data)) {
                        echo '<br/>' . wc_get_formatted_variation($product->variation_data, true);
                    }
                    ?>
">

			 	<?php 
                    echo $product->get_image('shop_thumbnail', array('title' => ''));
                    ?>
</a><?php 
                } else {
                    echo wc_placeholder_img('shop_thumbnail');
                }
                ?>
				<td><a href="<?php 
                echo admin_url("post.php?post={$product->id}&action=edit");
                ?>
"><?php 
                echo $product->sku ? $product->sku . ' - ' . $product->post->post_title : $product->post->post_title;
                ?>
</a></td>
				<td><?php 
                echo $qty;
                ?>
</td>
				<td style="text-align:right;"><?php 
                echo wc_price($price);
                ?>
</td>
				<td style="text-align:right;"><?php 
                echo wc_price($total);
                ?>
</td>
			</tr><?php 
            }
            ?>
       <tr>
          <td colspan="4" style="border-top:1px solid #999; text-align:right;"><?php 
            _e('Package Value', 'slp');
            ?>
</td>
          <td style="border-top:1px solid #999; text-align:right;"><?php 
            echo wc_price($totals);
            ?>
</td>
      </tr>
      <tr/><?php 
        }
开发者ID:jusmark123,项目名称:shipping-label-pro,代码行数:82,代码来源:class-slp-ajax-functions.php


示例10: esc_url

    ?>
			<a href="<?php 
    echo esc_url(admin_url('post.php?post=' . absint($_product->id) . '&action=edit'));
    ?>
" class="tips" data-tip="<?php 
    echo '<strong>' . __('Product ID:', 'woocommerce') . '</strong> ' . absint($item['product_id']);
    if ($item['variation_id'] && 'product_variation' === get_post_type($item['variation_id'])) {
        echo '<br/><strong>' . __('Variation ID:', 'woocommerce') . '</strong> ' . absint($item['variation_id']);
    } elseif ($item['variation_id']) {
        echo '<br/><strong>' . __('Variation ID:', 'woocommerce') . '</strong> ' . absint($item['variation_id']) . ' (' . __('No longer exists', 'woocommerce') . ')';
    }
    if ($_product && $_product->get_sku()) {
        echo '<br/><strong>' . __('Product SKU:', 'woocommerce') . '</strong> ' . esc_html($_product->get_sku());
    }
    if ($_product && isset($_product->variation_data)) {
        echo '<br/>' . wc_get_formatted_variation($_product->variation_data, true);
    }
    ?>
"><?php 
    echo $_product->get_image('shop_thumbnail', array('title' => ''));
    ?>
</a>
		<?php 
} else {
    ?>
			<?php 
    echo wc_placeholder_img('shop_thumbnail');
    ?>
		<?php 
}
?>
开发者ID:blade3,项目名称:woocommerce,代码行数:31,代码来源:html-order-item.php


示例11: wcj_order_items_table

 /**
  * wcj_order_items_table.
  */
 function wcj_order_items_table($atts, $content = '')
 {
     $html = '';
     $the_order = $this->the_order;
     // Get columns
     $columns = explode('|', $atts['columns']);
     if (empty($columns)) {
         return '';
     }
     $columns_total_number = count($columns);
     // Check all possible args
     $columns_titles = '' == $atts['columns_titles'] ? array() : explode('|', $atts['columns_titles']);
     $columns_styles = '' == $atts['columns_styles'] ? array() : explode('|', $atts['columns_styles']);
     //if ( ! ( $columns_total_number === count( $columns_titles ) === count( $columns_styles ) ) ) return '';
     // The Items
     $the_items = $the_order->get_items();
     // Shipping as item
     if ('' != $atts['shipping_as_item'] && $the_order->get_total_shipping() > 0) {
         $name = str_replace('%shipping_method_name%', $the_order->get_shipping_method(), $atts['shipping_as_item']);
         $total_shipping_tax_excl = $the_order->get_total_shipping();
         $shipping_tax = $the_order->get_shipping_tax();
         $the_items = $this->add_item($the_items, array('name' => $name, 'qty' => 1, 'line_subtotal' => $total_shipping_tax_excl, 'line_total' => $total_shipping_tax_excl, 'line_tax' => $shipping_tax, 'line_subtotal_tax' => $shipping_tax));
     }
     // Discount as item
     if ('' != $atts['discount_as_item'] && $the_order->get_total_discount(true) > 0) {
         $name = $atts['discount_as_item'];
         $total_discount_tax_excl = $the_order->get_total_discount(true);
         $discount_tax = $the_order->get_total_discount(false) - $total_discount_tax_excl;
         if (false != ($the_tax = $this->wcj_order_get_cart_discount_tax())) {
             $total_discount_tax_excl -= $the_tax;
             $discount_tax += $the_tax;
         }
         $total_discount_tax_excl *= -1;
         $discount_tax *= -1;
         $the_items = $this->add_item($the_items, array('name' => $name, 'qty' => 1, 'line_subtotal' => $total_discount_tax_excl, 'line_total' => $total_discount_tax_excl, 'line_tax' => $discount_tax, 'line_subtotal_tax' => $discount_tax));
     }
     // Starting data[] by adding columns titles
     $data = array();
     foreach ($columns_titles as $column_title) {
         $data[0][] = $column_title;
     }
     // Items to data[]
     $item_counter = 0;
     foreach ($the_items as $item) {
         $item['is_custom'] = isset($item['is_custom']) ? true : false;
         $the_product = true === $item['is_custom'] ? null : $the_order->get_product_from_item($item);
         $item_counter++;
         // Columns
         foreach ($columns as $column) {
             switch ($column) {
                 case 'item_number':
                     $data[$item_counter][] = $item_counter;
                     break;
                 case 'item_name':
                     //$data[ $item_counter ][] = ( true === $item['is_custom'] ) ? $item['name'] : $the_product->get_title();
                     if (true === $item['is_custom']) {
                         $data[$item_counter][] = $item['name'];
                     } else {
                         $the_item_title = $the_product->get_title();
                         // Variation (if needed)
                         if ($the_product->is_type('variation') && !in_array('item_variation', $columns)) {
                             $the_item_title .= '<div style="font-size:smaller;">' . wc_get_formatted_variation($the_product->variation_data, true) . '</div>';
                         }
                         $data[$item_counter][] = $the_item_title;
                     }
                     break;
                 case 'item_variation':
                     $data[$item_counter][] = $the_product->is_type('variation') ? wc_get_formatted_variation($the_product->variation_data, true) : '';
                     break;
                 case 'item_thumbnail':
                     //$data[ $item_counter ][] = $the_product->get_image();
                     $image_id = true === $item['is_custom'] ? 0 : $the_product->get_image_id();
                     $image_src = 0 != $image_id ? wp_get_attachment_image_src($image_id) : wc_placeholder_img_src();
                     if (is_array($image_src)) {
                         $image_src = $image_src[0];
                     }
                     $maybe_width = 0 != $atts['item_image_width'] ? ' width="' . $atts['item_image_width'] . '"' : '';
                     $maybe_height = 0 != $atts['item_image_height'] ? ' height="' . $atts['item_image_height'] . '"' : '';
                     $data[$item_counter][] = '<img src="' . $image_src . '"' . $maybe_width . $maybe_height . '>';
                     break;
                 case 'item_sku':
                     $data[$item_counter][] = true === $item['is_custom'] ? '' : $the_product->get_sku();
                     break;
                 case 'item_quantity':
                     $data[$item_counter][] = $item['qty'];
                     break;
                 case 'item_total_tax_excl':
                     $data[$item_counter][] = $this->wcj_price_shortcode($the_order->get_item_total($item, false, true), $atts);
                     break;
                 case 'item_total_tax_incl':
                     $data[$item_counter][] = $this->wcj_price_shortcode($the_order->get_item_total($item, true, true), $atts);
                     break;
                 case 'item_subtotal_tax_excl':
                     $data[$item_counter][] = $this->wcj_price_shortcode($the_order->get_item_subtotal($item, false, true), $atts);
                     break;
                 case 'item_subtotal_tax_incl':
                     $data[$item_counter][] = $this->wcj_price_shortcode($the_order->get_item_subtotal($item, true, true), $atts);
//.........这里部分代码省略.........
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:101,代码来源:class-wcj-order-items-shortcodes.php


示例12: get_quotelist_product_price

 }
 //get price before showing the addon data as proce could change
 if (!isset($values['price'])) {
     $unit_price = get_quotelist_product_price($product_obj);
 } else {
     $unit_price = $values['price'];
 }
 //get price before showing the addon data as proce could change
 //if addons extensions active
 if (class_exists('Product_Addon_Cart')) {
     $addon_cart_obj = new Product_Addon_Cart();
     $temp_arr = dvin_wcql_get_add_on_list($addon_cart_obj, $unit_price, $product_obj, $values);
 } else {
     $temp_arr = dvin_wcql_get_add_on_list(array(), $unit_price, $product_obj, $values);
 }
 $addons_str = wc_get_formatted_variation($temp_arr, false);
 //if only set the price as visible NOT remove
 if ($add_price_col == 'on') {
     $unit_price_in_html = apply_filters('woocommerce_cart_product_price', wc_price($unit_price), $product_obj);
     $unit_price_in_html = apply_filters('woocommerce_cart_item_price', $unit_price_in_html, '', '');
     //decide the quantity
     $quantity = isset($_POST['qty'][$product_obj->id]) ? $_POST['qty'][$product_obj->id] : $values['quantity'];
     $total_price = (double) $unit_price * (int) $quantity;
     $total_price_str = apply_filters('woocommerce_cart_item_price_html', woocommerce_price($total_price));
 } else {
     //decide the quantity
     $quantity = isset($_POST['qty'][$product_obj->id]) ? $_POST['qty'][$product_obj->id] : $values['quantity'];
 }
 //handle hiiden elements/columns
 $arr = array($href_str, $image_str, $product_name_str . $addons_str);
 if ($add_sku_toemail == 'on') {
开发者ID:berisberis,项目名称:betterquote,代码行数:31,代码来源:email_quotelist_template.php


示例13: get_items_table

 /**
  * get_items_table.
  */
 public function get_items_table($the_order)
 {
     $html = '';
     // ITEMS //
     $the_items = $the_order->get_items();
     $html .= '<h2>' . get_option('wcj_pdf_invoices_items_text') . '</h2>';
     $html .= '<table class="pdf_invoice_items_table_wcj"><tbody>';
     $columns = $this->get_columns();
     // Adding to output //
     $html .= '<tr>';
     foreach ($columns as $column) {
         if (true === $column['required'] || '' != $column['title']) {
             $html .= '<th style="' . $column['css'] . '">' . $column['title'] . '</th>';
         }
     }
     $html .= '</tr>';
     // Shipping as item
     $order_total_shipping = $the_order->get_total_shipping();
     if ('' != get_option('wcj_pdf_invoices_display_shipping_as_item_text') && $order_total_shipping > 0) {
         $shipping_item_name = get_option('wcj_pdf_invoices_display_shipping_as_item_text');
         // Add shipping method text
         if ('yes' === get_option('wcj_pdf_invoices_display_shipping_as_item_shipping_method')) {
             $shipping_item_name .= '<div style="font-size:x-small;">' . $the_order->get_shipping_method() . '</div>';
         } else {
             if ('replace' === get_option('wcj_pdf_invoices_display_shipping_as_item_shipping_method')) {
                 $shipping_item_name = $the_order->get_shipping_method();
             }
         }
         // Create item
         $the_items[] = array('name' => $shipping_item_name, 'type' => 'line_item', 'qty' => 1, 'line_subtotal' => $order_total_shipping, 'line_total' => $order_total_shipping, 'line_tax' => $the_order->get_shipping_tax(), 'line_subtotal_tax' => $the_order->get_shipping_tax(), 'item_meta' => array('_qty' => array(1), '_line_subtotal' => array($order_total_shipping), '_line_total' => array($order_total_shipping), '_line_tax' => array($the_order->get_shipping_tax()), '_line_subtotal_tax' => array($the_order->get_shipping_tax())));
     }
     // Discount as item
     $total_tax_excl = $the_order->get_total_discount(true);
     if ('' != get_option('wcj_pdf_invoices_display_discount_as_item_text') && 0 != $total_tax_excl) {
         //$total_tax_excl = $the_order->get_total_discount( true );
         $tax = $the_order->get_total_discount(false) - $total_tax_excl;
         if (false != ($the_tax = $this->wcj_order_get_cart_discount_tax($the_order))) {
             $total_tax_excl -= $the_tax;
             $tax += $the_tax;
         }
         $total_tax_excl *= -1;
         $tax *= -1;
         $the_items[] = array('name' => get_option('wcj_pdf_invoices_display_discount_as_item_text'), 'type' => 'line_item', 'qty' => 1, 'line_subtotal' => $total_tax_excl, 'line_total' => $total_tax_excl, 'line_tax' => $tax, 'line_subtotal_tax' => $tax, 'item_meta' => array('_qty' => array(1), '_line_subtotal' => array($total_tax_excl), '_line_total' => array($total_tax_excl), '_line_tax' => array($tax), '_line_subtotal_tax' => array($tax)));
     }
     $order_currency_array = array('currency' => $the_order->get_order_currency());
     // ITEMS LOOP //
     $item_counter = 0;
     foreach ($the_items as $item) {
         // Preparing data //
         // Item Prices
         $item_total_excl_tax = $the_order->get_item_subtotal($item, false, false);
         //			$item_tax 				= $the_order->get_item_tax( $item, true );
         $item_tax = $the_order->get_item_subtotal($item, true, false) - $the_order->get_item_subtotal($item, false, false);
         $item_total_incl_tax = $the_order->get_item_subtotal($item, true, false);
         // Line Prices
         $line_total_excl_tax = $the_order->get_line_subtotal($item, false, false);
         $line_tax = $the_order->get_line_subtotal($item, true, false) - $the_order->get_line_subtotal($item, false, false);
         //			$line_tax 				= $the_order->get_line_tax( $item );
         $line_total_incl_tax = $the_order->get_line_subtotal($item, true, false);
         $line_total_tax_percent = 0;
         if (0 != $the_order->get_item_total($item, false, false)) {
             $line_total_tax_percent = $the_order->get_item_tax($item, false) / $the_order->get_item_total($item, false, false) * 100;
             //round( ( $line_tax / $line_total_excl_tax * 100 ), 2 );
             $line_total_tax_percent = sprintf('%.2f %%', $line_total_tax_percent);
         }
         $item_total_excl_tax_formatted = wc_price($item_total_excl_tax, $order_currency_array);
         $item_total_tax_formatted = wc_price($item_tax, $order_currency_array);
         $item_total_incl_tax_formatted = wc_price($item_total_incl_tax, $order_currency_array);
         $line_total_excl_tax_formatted = wc_price($line_total_excl_tax, $order_currency_array);
         $line_total_tax_formatted = wc_price($line_tax, $order_currency_array);
         $line_total_incl_tax_formatted = wc_price($line_total_incl_tax, $order_currency_array);
         // Item Quantity
         $item_quantity = $item['qty'];
         // Item Name
         $item_name = $item['name'];
         //$product->get_title();
         $product = $the_order->get_product_from_item($item);
         if ($product) {
             // Additional info (e.g. SKU)
             if ('' != get_option('wcj_pdf_invoices_column_item_name_additional_text') && $product->get_sku()) {
                 $item_name .= ' ' . str_replace('%sku%', $product->get_sku(), get_option('wcj_pdf_invoices_column_item_name_additional_text'));
             }
             // Variation (if needed)
             if ($product->is_type('variation')) {
                 $item_name .= '<div style="font-size:smaller;">' . wc_get_formatted_variation($product->variation_data, true) . '</div>';
             }
         }
         // Item Counter
         $item_counter++;
         // Adding to output //
         $html .= '<tr>';
         foreach ($columns as $column) {
             if (true === $column['required'] || '' != $column['title']) {
                 $html .= '<td style="' . $column['td_css'] . '">' . ${$column}['value_var'] . '</td>';
             }
         }
         $html .= '</tr>';
//.........这里部分代码省略.........
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:101,代码来源:class-wcj-pdf-invoices.php


示例14: woocommerce_get_formatted_variation

/**
 * @deprecated
 */
function woocommerce_get_formatted_variation($variation = '', $flat = false)
{
    return wc_get_formatted_variation($variation, $flat);
}
开发者ID:nayemDevs,项目名称:woocommerce,代码行数:7,代码来源:wc-deprecated-functions.php


示例15: foreach

            </thead>
            <tbody>
            <?php 
    foreach ($shipment->get_items() as $item) {
        // get the product; if this variation or product has been deleted, this will return null...
        $_product = $shipment->get_product_from_item($item);
        $sku = $variation = '';
        if ($_product) {
            $sku = $_product->get_sku();
        }
        $item_meta = new WC_Order_Item_Meta($item['item_meta']);
        // first, is there order item meta avaialble to display?
        $variation = $item_meta->display(true, true);
        if (!$variation && $_product && isset($_product->variation_data)) {
            // otherwise (for an order added through the admin) lets display the formatted variation data so we have something to fall back to
            $variation = wc_get_formatted_variation($_product->variation_data, true);
        }
        if ($variation) {
            $variation = '<br/><small>' . $variation . '</small>';
        }
        ?>
                <tr>
                    <td><?php 
        echo apply_filters('woocommerce_order_product_title', $item['name'], $_product) . $variation;
        ?>
</td>
                    <td align="center"><?php 
        echo $item['qty'];
        ?>
</td>
                </tr>
开发者ID:RainyDayMedia,项目名称:carbide-probes,代码行数:31,代码来源:order-shipment-metabox.php


示例16: get_product_variation_title

 /**
  * Return a formatted product title based on variation id.
  *
  * @param  int    $item_id
  * @return string
  */
 public function get_product_variation_title($variation_id)
 {
     $variation = WC_PB_Core_Compatibility::wc_get_product($variation_id);
     if (!$variation) {
         return false;
     }
     $description = wc_get_formatted_variation($variation->get_variation_attributes(), true);
     $title = $variation->get_title();
     $sku = $variation->get_sku();
     if ($sku) {
         $sku = sprintf(__('(SKU: %s)', 'woocommerce-product-bundles'), $sku);
     }
     return $this->format_product_title($title, $sku, $description);
 }
开发者ID:ajay786singh,项目名称:viriditas-1,代码行数:20,代码来源:class-wc-pb-helpers.php


示例17: get_formatted_variation_attributes

 /**
  * Get formatted variation data with WC < 2.4 back compat and proper formatting of text-based attribute names.
  *
  * @deprecated 2.7.0
  * @return string
  */
 public function get_formatted_variation_attributes($flat = false)
 {
     wc_deprecated_function('WC_Product::get_formatted_variation_attributes', '2.7', 'wc_get_formatted_variation');
     return wc_get_formatted_variation($this, $flat);
 }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:11,代码来源:abstract-wc-legacy-product.php


示例18: fp_rac_get_formatted_variation

function fp_rac_get_formatted_variation($variation)
{
    if (function_exists('woocommerce_get_formatted_variation')) {
        return woocommerce_get_formatted_variation($variation, true);
    } else {
        if (function_exists('wc_get_formatted_variation')) {
            return wc_get_formatted_variation($variation, true);
        }
    }
}
开发者ID:bear12345678,项目名称:keylessoption,代码行数:10,代码来源:fp_rac_cron.php


示例19: render


//.........这里部分代码省略.........
                 $_columns = array();
                 foreach ($columns as $column) {
                     $_columns[] = trim($column);
                 }
                 $options['columns'] = $_columns;
             }
             $new_columns = array();
             foreach ($options['columns'] as $key) {
                 if (key_exists($key, $column_display_names)) {
                     $new_columns[$key] = $column_display_names[$key];
                 }
             }
             $column_display_names = $new_columns;
         }
         if (count($column_display_names) > 0) {
             $output .= '<table class="subscriptions">';
             $output .= '<thead>';
             $output .= '<tr>';
             foreach ($column_display_names as $key => $column_display_name) {
                 $output .= "<th scope='col' class='{$key}'>{$column_display_name}</th>";
             }
             $output .= '</tr>';
             $output .= '</thead>';
             $output .= '<tbody>';
             $i = 0;
             foreach ($results as $result_key => $result) {
                 $order = Groups_WS_Helper::get_order($result['order_id']);
                 if ($order) {
                     $order_item = WC_Subscriptions_Order::get_item_by_product_id($order, $result['product_id']);
                     $product = $order->get_product_from_item($order_item);
                     $output .= '<tr class="' . ($i % 2 == 0 ? 'even' : 'odd') . '">';
                     foreach ($column_display_names as $column_key => $column_title) {
                         $output .= sprintf('<td class="%s">', $column_key);
                         switch ($column_key) {
                             case 'status':
                                 $output .= WC_Subscriptions_Manager::get_status_to_display($result['status'], $result_key, $user->ID);
                                 break;
                             case 'title':
                                 $output .= WC_Subscriptions_Order::get_item_name($result['order_id'], $result['product_id']);
                                 if (isset($product->variation_data)) {
                                     $column_content .= '<br />';
                                     if (function_exists('wc_get_formatted_variation')) {
                                         $column_content .= wc_get_formatted_variation($product->variation_data, true);
                                     } else {
                                         $column_content .= woocommerce_ge 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_get_image_size函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_get_filename_from_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap