本文整理汇总了PHP中woocommerce_get_formatted_variation函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_get_formatted_variation函数的具体用法?PHP woocommerce_get_formatted_variation怎么用?PHP woocommerce_get_formatted_variation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_get_formatted_variation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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/> ' . 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: sprintf
echo $woocommerce->cart->get_cart_total();
echo sprintf(_n('<mark>%d</mark>', '<mark>%d</mark>', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
</span>
</a>
<?php
echo '<ul class="cart_list">';
if (sizeof($woocommerce->cart->cart_contents) > 0) {
foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
$_product = $cart_item['data'];
if ($_product->exists() && $cart_item['quantity'] > 0) {
echo '<li class="cart_list_product"><a href="' . get_permalink($cart_item['product_id']) . '">';
echo $_product->get_image();
echo '</a>';
if ($_product instanceof woocommerce_product_variation && is_array($cart_item['variation'])) {
echo woocommerce_get_formatted_variation($cart_item['variation']);
}
echo '<span class="details quantity"><a href="' . get_permalink($cart_item['product_id']) . '">' . apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product) . '</a>' . $cart_item['quantity'] . ' × ' . woocommerce_price($_product->get_price()) . '</span></li>';
}
}
} else {
echo '<li class="empty">' . __('No products in the cart.', 'woothemes') . '</li>';
}
if (sizeof($woocommerce->cart->cart_contents) > 0) {
echo '<li class="total"><strong>';
if (get_option('js_prices_include_tax') == 'yes') {
_e('Total', 'woothemes');
} else {
_e('Subtotal', 'woothemes');
}
echo ':</strong>' . $woocommerce->cart->get_cart_total();
开发者ID:realbig,项目名称:TH_MULLINS,代码行数:31,代码来源:header.php
示例3: gtm4wp_woocommerce_datalayer_filter_items
//.........这里部分代码省略.........
} else {
if (is_order_received_page()) {
$order_id = apply_filters('woocommerce_thankyou_order_id', empty($_GET['order']) ? $GLOBALS["wp"]->query_vars["order-received"] ? $GLOBALS["wp"]->query_vars["order-received"] : 0 : absint($_GET['order']));
$order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : woocommerce_clean($_GET['key']));
if ($order_id > 0) {
$order = new WC_Order($order_id);
if ($order->order_key != $order_key) {
unset($order);
}
}
if (1 == get_post_meta($order_id, '_ga_tracked', true)) {
unset($order);
}
if (isset($order)) {
if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKCLASSICEC]) {
$dataLayer["transactionId"] = $order->get_order_number();
$dataLayer["transactionDate"] = date("c");
$dataLayer["transactionType"] = "sale";
$dataLayer["transactionAffiliation"] = get_bloginfo('name');
$dataLayer["transactionTotal"] = $order->get_total();
$dataLayer["transactionShipping"] = $order->get_total_shipping();
$dataLayer["transactionTax"] = $order->get_total_tax();
$dataLayer["transactionPaymentType"] = $order->payment_method_title;
$dataLayer["transactionCurrency"] = get_woocommerce_currency();
$dataLayer["transactionShippingMethod"] = $order->get_shipping_method();
$dataLayer["transactionPromoCode"] = implode(", ", $order->get_used_coupons());
}
if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
$dataLayer["ecommerce"] = "-~-{'purchase': {'actionField': {'id': '" . $order->get_order_number() . "', 'affiliation': '" . get_bloginfo('name') . "', 'revenue': '" . $order->get_total() . "', 'tax': '" . $order->get_total_tax() . "', 'shipping': '" . $order->get_total_shipping() . "'}, ";
}
$_products = array();
$_sumprice = 0;
$_product_ids = array();
if ($order->get_items()) {
foreach ($order->get_items() as $item) {
$_product = $order->get_product_from_item($item);
$variation_data = null;
if (get_class($_product) == "WC_Product_Variation") {
$variation_data = $_product->get_variation_attributes();
}
if (isset($variation_data)) {
$_category = woocommerce_get_formatted_variation($_product->variation_data, true);
} else {
$out = array();
$categories = get_the_terms($_product->id, 'product_cat');
if ($categories) {
foreach ($categories as $category) {
$out[] = $category->name;
}
}
$_category = implode(" / ", $out);
}
$_prodprice = $order->get_item_total($item);
$_products[] = array("id" => $_product->id, "name" => $item['name'], "sku" => $_product->get_sku() ? __('SKU:', GTM4WP_TEXTDOMAIN) . ' ' . $_product->get_sku() : $_product->id, "category" => $_category, "price" => $_prodprice, "currency" => get_woocommerce_currency(), "quantity" => $item['qty']);
$_sumprice += $_prodprice;
$_product_ids[] = "'" . $_product->id . "'";
}
}
if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKCLASSICEC]) {
$dataLayer["transactionProducts"] = $_products;
$dataLayer["event"] = "gtm4wp.orderCompleted";
}
if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
$dataLayer["ecommerce"] .= "'products': " . str_replace('"', "'", json_encode($_products)) . " }}-~-";
$dataLayer["event"] = "gtm4wp.orderCompleted";
}
if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING]) {
$dataLayer["ecomm_prodid"] = '-~-[' . implode(", ", $_product_ids) . ']-~-';
$dataLayer["ecomm_pagetype"] = "purchase";
$dataLayer["ecomm_totalvalue"] = $_sumprice;
}
// update_post_meta( $order_id, '_ga_tracked', 1 );
}
} else {
if (is_checkout()) {
if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
foreach ($woocommerce->cart->get_cart() as $cart_item_id => $cart_item_data) {
$product = $cart_item_data["data"];
$_product_cats = get_the_terms($product->id, 'product_cat');
if (is_array($_product_cats) && count($_product_cats) > 0) {
$product_cat = array_pop($_product_cats);
$product_cat = $product_cat->name;
} else {
$product_cat = "";
}
$gtm4wp_checkout_products[] = "{'name': '" . str_replace("'", "\\'", $product->post->post_title) . "', 'id': '" . $product->id . "', 'price': '" . $product->get_price() . "', 'category': '" . $product_cat . "', 'quantity': '" . $cart_item_data["quantity"] . "'}";
}
$dataLayer["ecommerce"] = "-~-{'checkout': {'actionField': {'step': 1}, 'products':[" . implode(", ", $gtm4wp_checkout_products) . "]}}-~-";
}
} else {
if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING]) {
$dataLayer["ecomm_pagetype"] = "siteview";
}
}
}
}
}
}
return $dataLayer;
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:101,代码来源:woocommerce.php
示例4: ebor_dropdown
function ebor_dropdown()
{
global $woocommerce;
if (is_cart()) {
return;
}
echo '<div id="dropdowncart">
<a href="' . $woocommerce->cart->get_cart_url() . '" class="dropdowncarttrigger"><i class="icon-basket-1"></i></a>';
if (sizeof($woocommerce->cart->cart_contents) > 0) {
echo '
<div class="dropdowncartcontents">
<ul class="cart_list">';
$i = 0;
foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
$i++;
$i % 2 == 0 ? $rowclass = ' class="dark_wrapper"' : ($rowclass = '');
$_product = $cart_item['data'];
if ($_product->exists() && $cart_item['quantity'] > 0) {
echo '<li' . $rowclass . '><div class="dropdowncartimage">';
echo '<a href="' . get_permalink($cart_item['product_id']) . '">';
if (has_post_thumbnail($cart_item['product_id'])) {
echo get_the_post_thumbnail($cart_item['product_id'], 'shop_thumbnail');
} else {
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . $woocommerce->get_image_size('shop_thumbnail_image_width') . '" height="' . $woocommerce->get_image_size('shop_thumbnail_image_height') . '" />';
}
echo '</a>';
echo '</div>';
echo '<div class="dropdowncartproduct">';
echo '<a href="' . get_permalink($cart_item['product_id']) . '">';
echo apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product);
if ($_product instanceof woocommerce_product_variation && is_array($cart_item['variation'])) {
echo woocommerce_get_formatted_variation($cart_item['variation']);
}
echo '<span class="quantity">' . $cart_item['quantity'] . ' × ' . woocommerce_price($_product->get_price()) . '</span>
</a></div><div class="clear"></div></li>';
}
}
echo '</ul>';
}
if (sizeof($woocommerce->cart->cart_contents) > 0) {
echo '<p class="total"><strong>';
if (get_option('js_prices_include_tax') == 'yes') {
_e('Total', 'marble');
} else {
_e('Subtotal', 'marble');
}
echo ':</strong><span class="contents">' . $woocommerce->cart->get_cart_total() . '</span></p>';
do_action('woocommerce_widget_shopping_cart_before_buttons');
echo '<p class="buttons">
<a href="' . $woocommerce->cart->get_cart_url() . '" class="btn">' . __('View Cart →', 'marble') . '</a>
<a href="' . $woocommerce->cart->get_checkout_url() . '" class="btn checkout">' . __('Checkout →', 'marble') . '</a>
</p></div>';
}
echo '</div>';
}
开发者ID:carinaoliveira,项目名称:template2016,代码行数:55,代码来源:woocommerce_support.php
示例5: ecommerce_tracking_code
/**
* Google Analytics eCommerce tracking
*
* @access public
* @param mixed $order_id
* @return void
*/
function ecommerce_tracking_code($order_id)
{
global $woocommerce;
if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1) {
return;
}
$tracking_id = $this->ga_id;
if (!$tracking_id) {
return;
}
// Doing eCommerce tracking so unhook standard tracking from the footer
remove_action("wp_footer", array($this, "ee_settings"));
// Get the order and output tracking code
$order = new WC_Order($order_id);
//Get Applied Coupon Codes
$coupons_list = '';
if ($order->get_used_coupons()) {
$coupons_count = count($order->get_used_coupons());
$i = 1;
foreach ($order->get_used_coupons() as $coupon) {
$coupons_list .= $coupon;
if ($i < $coupons_count) {
$coupons_list .= ', ';
}
$i++;
}
}
//get domain name if value is set
if (!empty($this->ga_Dname)) {
$set_domain_name = esc_js($this->ga_Dname);
} else {
$set_domain_name = "auto";
}
//add display features
if ($this->ga_DF) {
$ga_display_feature_code = 'ga("require", "displayfeatures");';
} else {
$ga_display_feature_code = "";
}
//add Pageview on order page if user checked Add Standard UA code
if ($this->ga_ST) {
$ga_pageview = 'ga("send", "pageview");';
} else {
$ga_pageview = "";
}
$code = '(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "' . esc_js($tracking_id) . '", "' . $set_domain_name . '");
' . $ga_display_feature_code . '
ga("require", "ec", "ec.js");
' . $ga_pageview . '
';
// Order items
if ($order->get_items()) {
foreach ($order->get_items() as $item) {
$_product = $order->get_product_from_item($item);
if (isset($_product->variation_data)) {
$categories = esc_js(woocommerce_get_formatted_variation($_product->variation_data, true));
} else {
$out = array();
$categories = get_the_terms($_product->id, "product_cat");
if ($categories) {
foreach ($categories as $category) {
$out[] = $category->name;
}
}
$categories = esc_js(join(",", $out));
}
//orderpage Prod json
$orderpage_prod_Array[get_permalink($_product->id)] = array("tvc_id" => esc_html($_product->id), "tvc_i" => esc_js($_product->get_sku() ? $_product->get_sku() : $_product->id), "tvc_n" => esc_js($item["name"]), "tvc_p" => esc_js($order->get_item_total($item)), "tvc_c" => $categories, "tvc_q" => esc_js($item["qty"]));
}
//make json for prod meta data on order page
$this->wc_version_compare("tvc_oc=" . json_encode($orderpage_prod_Array) . ";");
}
//get shipping cost based on version >2.1 get_total_shipping() < get_shipping
if (version_compare($woocommerce->version, "2.1", ">=")) {
$tvc_sc = $order->get_total_shipping();
} else {
$tvc_sc = $order->get_shipping();
}
//orderpage transcation data json
$orderpage_trans_Array = array("id" => esc_js($order->get_order_number()), "affiliation" => esc_js(get_bloginfo('name')), "revenue" => esc_js($order->get_total()), "tax" => esc_js($order->get_total_tax()), "shipping" => esc_js($tvc_sc), "coupon" => $coupons_list);
//make json for trans data on order page
$this->wc_version_compare("tvc_td=" . json_encode($orderpage_trans_Array) . ";");
$code .= '
//set local currencies
ga("set", "&cu", tvc_lc);
for(var t_item in tvc_oc){
ga("ec:addProduct", {
"id": tvc_oc[t_item].tvc_i,
//.........这里部分代码省略.........
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:101,代码来源:class-wc-enhanced-ecommerce-google-analytics-integration.php
示例6: captiva_header_add_to_cart_fragment
function captiva_header_add_to_cart_fragment($fragments)
{
global $woocommerce;
ob_start();
?>
<ul class="tiny-cart">
<li>
<a class="cart_dropdown_link cart-parent" href="<?php
echo $woocommerce->cart->get_cart_url();
?>
" title="<?php
_e('View your shopping cart', 'captiva');
?>
">
<div class="bag-icon"></div>
<span class='cart_subtotal'><?php
echo $woocommerce->cart->get_cart_total();
?>
</span>
<?php
echo sprintf(_n('<span class="cart_itemstotal">(%d item)</span>', '<span class="cart_itemstotal">(%d items)</span>', $woocommerce->cart->cart_contents_count, 'captiva'), $woocommerce->cart->cart_contents_count);
?>
</a>
<?php
echo '<ul class="cart_list">';
//echo '<li class="cart-title"><h3>' . __( 'Your Cart Contents', 'captiva' ) . '</h3></li>';
if (sizeof($woocommerce->cart->cart_contents) > 0) {
foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
$_product = $cart_item['data'];
if ($_product->exists() && $cart_item['quantity'] > 0) {
echo '<li class="cart_list_product"><a href="' . get_permalink($cart_item['product_id']) . '">';
echo $_product->get_image();
echo apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product) . '</a>';
if ($_product instanceof woocommerce_product_variation && is_array($cart_item['variation'])) {
echo woocommerce_get_formatted_variation($cart_item['variation']);
}
echo '<span class="quantities">' . $cart_item['quantity'] . ' × ' . woocommerce_price($_product->get_price()) . '</span></li>';
}
}
} else {
echo '<li class="empty">' . __('No products in the cart.', 'captiva') . '</li>';
}
if (sizeof($woocommerce->cart->cart_contents) > 0) {
echo '<li class="total"><strong>';
if (get_option('js_prices_include_tax') == 'yes') {
_e('Total', 'captiva');
} else {
_e('Subtotal', 'captiva');
}
echo ':</strong>' . $woocommerce->cart->get_cart_total();
'</li>';
echo '<li class="buttons"><a href="' . $woocommerce->cart->get_cart_url() . '" class="button">' . __('View Cart', 'captiva') . '</a> <a href="' . $woocommerce->cart->get_checkout_url() . '" class="button checkout">' . __('Checkout', 'captiva') . '</a></li>';
}
echo '</ul>';
?>
</li>
</ul>
<?php
$fragments['ul.tiny-cart'] = ob_get_clean();
return $fragments;
}
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:64,代码来源:woocommerce-config.php
示例7: get_content_plain
/**
* get_content_plain function.
*
* @access public
* @return string
*/
function get_content_plain()
{
$order = new WC_Order($this->object['order_id']);
$item_name = WC_Subscriptions_Order::get_item_name($this->object['order_id'], $this->object['product_id']);
$order_item = WC_Subscriptions_Order::get_item_by_product_id($order, $this->object['product_id']);
$product = $order->get_product_from_item($order_item);
if (isset($product->variation_data)) {
$item_name .= ' (' . woocommerce_get_formatted_variation($product->variation_data, true) . ')';
}
WC_Subscriptions_Order::$recurring_only_price_strings = true;
$recurring_total = WC_Subscriptions_Order::get_formatted_order_total(0, $order);
WC_Subscriptions_Order::$recurring_only_price_strings = false;
if ($end_of_prepaid_term = wp_next_scheduled('scheduled_subscription_end_of_prepaid_term', array('user_id' => (int) $order->user_id, 'subscription_key' => $this->subscription_key))) {
$end_of_prepaid_term = date_i18n(woocommerce_date_format(), $end_of_prepaid_term + get_option('gmt_offset') * 3600);
}
ob_start();
woocommerce_get_template($this->template_plain, array('subscription_key' => $this->subscription_key, 'subscription' => $this->object, 'order' => $order, 'email_heading' => $this->get_heading(), 'item_name' => $item_name, 'recurring_total' => $recurring_total, 'last_payment' => date_i18n(woocommerce_date_format(), WC_Subscriptions_Manager::get_last_payment_date($this->subscription_key, '', 'timestamp')), 'end_of_prepaid_term' => $end_of_prepaid_term), '', $this->template_base);
return ob_get_clean();
}
开发者ID:bulats,项目名称:chef,代码行数:25,代码来源:class-wcs-email-cancelled-subscription.php
示例8: woocommerce_cart_items_meta_box
//.........这里部分代码省略.........
} else {
echo '-';
}
?>
<input type="hidden" class="item_id" name="item_id[<?php
echo $loop;
?>
]" value="<?php
if (isset($item->id) && $item->id != '') {
echo esc_attr($item->id);
}
?>
" />
<input type="hidden" name="item_name[<?php
echo $loop;
?>
]" value="<?php
echo esc_attr($item->id);
?>
" />
<?php
if (isset($item->variation_id)) {
?>
<input type="hidden" name="item_variation[<?php
echo $loop;
?>
]" value="<?php
echo esc_attr($item->variation_id);
?>
" /> <?php
}
?>
</td>
<td class="name" width="20%">
<div class="row-actions">
<span class="view"><a href="<?php
echo esc_url(admin_url('post.php?post=' . $_product->id . '&action=edit'));
?>
"><?php
_e('View product', 'woocommerce');
?>
</a>
</div>
<?php
echo $_product->get_title();
?>
<?php
if (isset($_product->variation_data)) {
echo '<br/>' . woocommerce_get_formatted_variation($_product->variation_data, true);
}
?>
</td>
<?php
//do_action('woocommerce_admin_order_item_values', $_product, $item);
?>
<td class="price" width="20%"><p>
<?php
echo $_product->get_price_html();
?>
</p></td>
<td class="quantity" width="20%"><p>
<?php
echo $item['quantity'];
?>
</p></td>
</tr>
<?php
}
?>
<?php
$loop++;
}
} else {
//Explain to the user why no products could show up in a recently abandoned / opened cart
?>
<span style="color:gray;"'>No Products In The Cart</span> <?php
av8_tooltip(__('When a customer adds items to a cart, then abandones the cart for a considerable amount of time, the browser often deletes the cart data. The cart still belongs to the customer, but their brower removed the products. :( But hey! This indicates that they came back. And might be ready to purchase.', 'woocommerce_cart_reports'));
?>
<?php
}
?>
</tbody>
</table>
</div>
<script type="text/javascript">
</script>
<?php
}
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:101,代码来源:cart_edit_interface.php
示例9: esc_html
?>
<?php
echo esc_html($item['name']);
?>
<?php
}
?>
<input type="hidden" class="order_item_id" name="order_item_id[]" value="<?php
echo esc_attr($item_id);
?>
" />
<?php
if ($_product && isset($_product->variation_data)) {
echo '<br/>' . woocommerce_get_formatted_variation($_product->variation_data, true);
}
?>
<table class="meta" cellspacing="0">
<tfoot>
<tr>
<td colspan="4"><button class="add_order_item_meta button"><?php
_e('Add meta', 'woocommerce');
?>
</button></td>
</tr>
</tfoot>
<tbody class="meta_items">
<?php
if ($metadata = $order->has_meta($item_id)) {
foreach ($metadata as $meta) {
开发者ID:shahadat014,项目名称:geleyi,代码行数:31,代码来源:order-item-html.php
示例10: woocommerce_order_items_meta_box
//.........这里部分代码省略.........
} else {
echo '-';
}
echo '<br/><strong>' . __('Product SKU:', 'woothemes') . '</strong> ';
if ($_product->sku) {
echo $_product->sku;
} else {
echo '-';
}
?>
" src="<?php
echo $woocommerce->plugin_url();
?>
/assets/images/tip.png" />
</td>
<td class="sku"><?php
if ($_product->sku) {
echo $_product->sku;
} else {
echo '-';
}
?>
</td>
<td class="name">
<a href="<?php
echo esc_url(admin_url('post.php?post=' . $_product->id . '&action=edit'));
?>
"><?php
echo $item['name'];
?>
</a>
<?php
if (isset($_product->variation_data)) {
echo '<br/>' . woocommerce_get_formatted_variation($_product->variation_data, true);
}
?>
</td>
<td>
<table class="meta" cellspacing="0">
<tfoot>
<tr>
<td colspan="4"><button class="add_meta button"><?php
_e('Add meta', 'woothemes');
?>
</button></td>
</tr>
</tfoot>
<tbody class="meta_items">
<?php
if (isset($item['item_meta']) && is_array($item['item_meta']) && sizeof($item['item_meta']) > 0) {
foreach ($item['item_meta'] as $key => $meta) {
// Backwards compatibility
if (is_array($meta) && isset($meta['meta_name'])) {
$meta_name = $meta['meta_name'];
$meta_value = $meta['meta_value'];
} else {
$meta_name = $key;
$meta_value = $meta;
}
echo '<tr><td><input type="text" name="meta_name[' . $loop . '][]" value="' . $meta_name . '" /></td><td><input type="text" name="meta_value[' . $loop . '][]" value="' . esc_attr($meta_value) . '" /></td><td><button class="remove_meta button">×</button></td></tr>';
}
}
?>
</tbody>
</table>
</td>
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:67,代码来源:writepanel-order_data.php
示例11: woocommerce_add_order_item
function woocommerce_add_order_item()
{
global $woocommerce;
check_ajax_referer('add-order-item', 'security');
global $wpdb;
$index = trim(stripslashes($_POST['index']));
$item_to_add = trim(stripslashes($_POST['item_to_add']));
$post = '';
// Find the item
if (is_numeric($item_to_add)) {
$post = get_post($item_to_add);
}
if (!$post || $post->post_type !== 'product' && $post->post_type !== 'product_variation') {
$post_id = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT post_id\n\t\t\tFROM {$wpdb->posts}\n\t\t\tLEFT JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)\n\t\t\tWHERE {$wpdb->postmeta}.meta_key = 'sku'\n\t\t\tAND {$wpdb->posts}.post_status = 'publish'\n\t\t\tAND {$wpdb->posts}.post_type = 'shop_product'\n\t\t\tAND {$wpdb->postmeta}.meta_value = %s\n\t\t\tLIMIT 1\n\t\t"), $item_to_add);
$post = get_post($post_id);
}
if (!$post || $post->post_type !== 'product' && $post->post_type !== 'product_variation') {
die;
}
if ($post->post_type == "product") {
$_product =& new woocommerce_product($post->ID);
} else {
$_product =& new woocommerce_product_variation($post->ID);
}
?>
<tr class="item" rel="<?php
echo $index;
?>
">
<td class="product-id">
<img class="tips" tip="<?php
echo '<strong>' . __('Product ID:', 'woothemes') . '</strong> ' . $_product->id;
echo '<br/><strong>' . __('Variation ID:', 'woothemes') . '</strong> ';
if ($_product->variation_id) {
echo $_product->variation_id;
} else {
echo '-';
}
echo '<br/><strong>' . __('Product SKU:', 'woothemes') . '</strong> ';
if ($_product->sku) {
echo $_product->sku;
} else {
echo '-';
}
?>
" src="<?php
echo $woocommerce->plugin_url();
?>
/assets/images/tip.png" />
</td>
<td class="sku"><?php
if ($_product->sku) {
echo $_product->sku;
} else {
echo '-';
}
?>
</td>
<td class="name">
<a href="<?php
echo esc_url(admin_url('post.php?post=' . $_product->id . '&action=edit'));
?>
"><?php
echo $_product->get_title();
?>
</a>
<?php
if (isset($_product->variation_data)) {
echo '<br/>' . woocommerce_get_formatted_variation($_product->variation_data, true);
}
?>
</td>
<td>
<table class="meta" cellspacing="0">
<tfoot>
<tr>
<td colspan="3"><button class="add_meta button"><?php
_e('Add meta', 'woothemes');
?>
</button></td>
</tr>
</tfoot>
<tbody class="meta_items"></tbody>
</table>
</td>
<?php
do_action('woocommerce_admin_order_item_values', $_product);
?>
<td class="quantity"><input type="text" name="item_quantity[<?php
echo $index;
?>
]" placeholder="0" value="1" /></td>
<td class="cost"><input type="text" name="base_item_cost[<?php
echo $index;
?>
]" placeholder="0.00" value="<?php
echo esc_attr($_product->get_price_excluding_tax(false));
?>
" /></td>
<td class="cost"><input type="text" name="item_cost[<?php
//.........这里部分代码省略.........
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:101,代码来源:woocommerce-ajax.php
示例12: get_product
$_product = get_product($product['id']);
?>
<tr>
<td class="product"><strong><a
href="<?php
echo esc_url(get_permalink($_product->id));
?>
"><?php
echo $product['title'];
?>
</a></strong>
<?php
if (!empty($_product->variation_id)) {
echo woocommerce_get_formatted_variation($_product->variation_data);
}
?>
</td>
<td class="qty"><?php
echo $product['qty'];
?>
</td>
<td class="commission"><?php
echo woocommerce_price($product['cost']);
?>
</td>
<td class="rate"><?php
echo sprintf('%.2f%%', $product['commission_rate']);
?>
</td>
开发者ID:shahadat014,项目名称:geleyi,代码行数:31,代码来源:reports.php
示例13: wc_subs_exporter_create_csv
function wc_subs_exporter_create_csv($export)
{
global $wc_subs_exporter;
if (!$export->status) {
return false;
}
if (empty($export->subscriptions)) {
return false;
}
$subscription_statuses = wc_subs_exporter_get_subscription_statuses();
$fields = array(__('Order Id', 'wc-subs-exporter'), __('Order Status', 'wc-subs-exporter'), __('Subscription Status', 'wc-subs-exporter'), __('Subscription Description', 'wc-subs-exporter'), __('Subscription Start Date', 'wc-subs-exporter'), __('Subscription Expiration Date', 'wc-subs-exporter'), __('Subscription Last Payment', 'wc-subs-exporter'), __('Email', 'wc-subs-exporter'), __('Billing First Name', 'wc-subs-exporter'), __('Billing Last Name', 'wc-subs-exporter'), __('Billing Address 1', 'wc-subs-exporter'), __('Billing Address 2', 'wc-subs-exporter'), __('Billing City', 'wc-subs-exporter'), __('Billing State', 'wc-subs-exporter'), __('Billing Zip', 'wc-subs-exporter'), __('Billing Country', 'wc-subs-exporter'), __('Shipping First Name', 'wc-subs-exporter'), __('Shipping Last Name', 'wc-subs-exporter'), __('Shipping Address 1', 'wc-subs-exporter'), __('Shipping Address 2', 'wc-subs-exporter'), __('Shipping City', 'wc-subs-exporter'), __('Shipping State', 'wc-subs-exporter'), __('Shipping Zip', 'wc-subs-exporter'), __('Shipping Country', 'wc-subs-exporter'), __('Product SKU', 'wc-subs-exporter'), __('Product Description', 'wc-subs-exporter'), __('Quantity', 'wc-subs-exporter'), __('Date Ordered', 'wc-subs-exporter'), __('Coupon Code Used', 'wc-subs-exporter'));
$csv = '';
if ($export->bom) {
$csv .= chr(239) . chr(187) . chr(191) . '';
}
foreach ($fields as $field) {
$csv .= wc_subs_exporter_escape_csv_value($field, $export->delimiter, $export->escape_formatting) . $export->delimiter;
}
$csv = substr($csv, 0, -strlen($export->delimiter)) . "\n";
$processed_rows = 0;
foreach ($export->subscriptions as $user => $user_subscriptions) {
foreach ($user_subscriptions as $key => $subscription) {
$order = new WC_Order($subscription['order_id']);
$order_item = WC_Subscriptions_Order::get_item_by_product_id($order, $subscription['product_id']);
$product = $order->get_product_from_item($order_item);
if (empty($product)) {
continue;
}
$product_sku = $product->get_sku();
$product_title = WC_Subscriptions_Order::get_item_name($subscription['order_id'], $subscription['product_id']);
if (isset($product->variation_data)) {
$product_description = woocommerce_get_formatted_variation($product->variation_data, true);
} else {
$product_description = $product_title;
}
$coupon_code_used = '';
$coupons = $order->get_items(array('coupon'));
foreach ($coupons as $item_id => $item) {
$coupon_code_used .= $item['name'] . ' ';
}
$start_date = substr($subscription['start_date'], 0, 10);
if ($subscription['expiry_date']) {
$end_date = substr($subscription['expiry_date'], 0, 10);
} else {
$end_date = '0000-00-00';
}
if ($order->user_id > 0) {
$user_info = get_userdata($order->user_id);
}
if (array_key_exists('completed_payments', $subscription) && is_array($subscription['completed_payments'])) {
$recent_payment = substr(end($subscription['completed_payments']), 0, 10);
} else {
$recent_payment = '';
}
$order_date = substr($order->completed_date, 0, 10);
$csv .= wc_subs_exporter_escape_csv_value($order->id, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->status, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($subscription_statuses[$subscription['status']], $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($product_title, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($start_date, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($end_date, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($recent_payment, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($user_info->user_email, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_first_name, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_last_name, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_address_1, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_address_2, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_city, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_state, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_postcode, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->billing_country, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->shipping_first_name, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->shipping_last_name, $export->delimiter, $export->escape_formatting) . $export->delimiter;
$csv .= wc_subs_exporter_escape_csv_value($order->shipping_address_1, $export->delimiter, $export->escape_formatting) . $export->
|
请发表评论