Merge branch 'nishitlangaliya-issue-16966-B'
This commit is contained in:
commit
42f2bbb3fe
|
@ -7,6 +7,7 @@
|
||||||
* @package WooCommerce/Import
|
* @package WooCommerce/Import
|
||||||
* @version 3.1.0
|
* @version 3.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +28,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
* Initialize importer.
|
* Initialize importer.
|
||||||
*
|
*
|
||||||
* @param string $file File to read.
|
* @param string $file File to read.
|
||||||
* @param array $args Arguments for the parser.
|
* @param array $params Arguments for the parser.
|
||||||
*/
|
*/
|
||||||
public function __construct( $file, $params = array() ) {
|
public function __construct( $file, $params = array() ) {
|
||||||
$default_args = array(
|
$default_args = array(
|
||||||
|
@ -141,9 +142,8 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
|
|
||||||
if ( $original_id ) {
|
if ( $original_id ) {
|
||||||
return absint( $original_id );
|
return absint( $original_id );
|
||||||
|
|
||||||
// If we're not updating existing posts, we need a placeholder.
|
|
||||||
} elseif ( ! $this->params['update_existing'] ) {
|
} elseif ( ! $this->params['update_existing'] ) {
|
||||||
|
// If we're not updating existing posts, we need a placeholder.
|
||||||
$product = new WC_Product_Simple();
|
$product = new WC_Product_Simple();
|
||||||
$product->set_name( 'Import placeholder for ' . $id );
|
$product->set_name( 'Import placeholder for ' . $id );
|
||||||
$product->set_status( 'importing' );
|
$product->set_status( 'importing' );
|
||||||
|
@ -243,7 +243,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function parse_comma_field( $value ) {
|
public function parse_comma_field( $value ) {
|
||||||
if ( empty( $value ) && $value !== '0' ) {
|
if ( empty( $value ) && '0' !== $value ) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,9 +616,13 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
$data['stock_status'] = isset( $data['stock_status'] ) ? $data['stock_status'] : true;
|
$data['stock_status'] = isset( $data['stock_status'] ) ? $data['stock_status'] : true;
|
||||||
} else {
|
} else {
|
||||||
$data['manage_stock'] = true;
|
$data['manage_stock'] = true;
|
||||||
|
|
||||||
|
// Only auto set status when stock_status is empty.
|
||||||
|
if ( ! isset( $data['stock_status'] ) || isset( $data['stock_status'] ) && '' === $data['stock_status'] ) {
|
||||||
$data['stock_status'] = 0 < $data['stock_quantity'];
|
$data['stock_status'] = 0 < $data['stock_quantity'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Stock is bool.
|
// Stock is bool.
|
||||||
if ( isset( $data['stock_status'] ) ) {
|
if ( isset( $data['stock_status'] ) ) {
|
||||||
|
@ -637,7 +641,6 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
$meta_data = array();
|
$meta_data = array();
|
||||||
|
|
||||||
foreach ( $data as $key => $value ) {
|
foreach ( $data as $key => $value ) {
|
||||||
// Attributes.
|
|
||||||
if ( $this->starts_with( $key, 'attributes:name' ) ) {
|
if ( $this->starts_with( $key, 'attributes:name' ) ) {
|
||||||
if ( ! empty( $value ) ) {
|
if ( ! empty( $value ) ) {
|
||||||
$attributes[ str_replace( 'attributes:name', '', $key ) ]['name'] = $value;
|
$attributes[ str_replace( 'attributes:name', '', $key ) ]['name'] = $value;
|
||||||
|
@ -662,7 +665,6 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
}
|
}
|
||||||
unset( $data[ $key ] );
|
unset( $data[ $key ] );
|
||||||
|
|
||||||
// Downloads.
|
|
||||||
} elseif ( $this->starts_with( $key, 'downloads:name' ) ) {
|
} elseif ( $this->starts_with( $key, 'downloads:name' ) ) {
|
||||||
if ( ! empty( $value ) ) {
|
if ( ! empty( $value ) ) {
|
||||||
$downloads[ str_replace( 'downloads:name', '', $key ) ]['name'] = $value;
|
$downloads[ str_replace( 'downloads:name', '', $key ) ]['name'] = $value;
|
||||||
|
@ -675,7 +677,6 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
}
|
}
|
||||||
unset( $data[ $key ] );
|
unset( $data[ $key ] );
|
||||||
|
|
||||||
// Meta data.
|
|
||||||
} elseif ( $this->starts_with( $key, 'meta:' ) ) {
|
} elseif ( $this->starts_with( $key, 'meta:' ) ) {
|
||||||
$meta_data[] = array(
|
$meta_data[] = array(
|
||||||
'key' => str_replace( 'meta:', '', $key ),
|
'key' => str_replace( 'meta:', '', $key ),
|
||||||
|
@ -764,7 +765,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
/**
|
/**
|
||||||
* Get a string to identify the row from parsed data.
|
* Get a string to identify the row from parsed data.
|
||||||
*
|
*
|
||||||
* @param array $parsed_data
|
* @param array $parsed_data Parsed data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function get_row_id( $parsed_data ) {
|
protected function get_row_id( $parsed_data ) {
|
||||||
|
|
|
@ -292,6 +292,7 @@ function wc_get_account_orders_actions( $order ) {
|
||||||
*/
|
*/
|
||||||
function wc_get_account_formatted_address( $address_type = 'billing', $customer_id = 0 ) {
|
function wc_get_account_formatted_address( $address_type = 'billing', $customer_id = 0 ) {
|
||||||
$getter = "get_{$address_type}";
|
$getter = "get_{$address_type}";
|
||||||
|
$address = array();
|
||||||
|
|
||||||
if ( 0 === $customer_id ) {
|
if ( 0 === $customer_id ) {
|
||||||
$customer_id = get_current_user_id();
|
$customer_id = get_current_user_id();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 3.1.0
|
* @version 3.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -63,8 +63,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="product-thumbnail">
|
<td class="product-thumbnail"><?php
|
||||||
<?php
|
|
||||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||||
|
|
||||||
if ( ! $product_permalink ) {
|
if ( ! $product_permalink ) {
|
||||||
|
@ -72,26 +71,23 @@ do_action( 'woocommerce_before_cart' ); ?>
|
||||||
} else {
|
} else {
|
||||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
|
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
|
||||||
}
|
}
|
||||||
?>
|
?></td>
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'woocommerce' ); ?>">
|
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'woocommerce' ); ?>"><?php
|
||||||
<?php
|
|
||||||
if ( ! $product_permalink ) {
|
if ( ! $product_permalink ) {
|
||||||
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ';
|
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ';
|
||||||
} else {
|
} else {
|
||||||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key );
|
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Meta data
|
// Meta data.
|
||||||
echo WC()->cart->get_item_data( $cart_item );
|
echo WC()->cart->get_item_data( $cart_item );
|
||||||
|
|
||||||
// Backorder notification
|
// Backorder notification.
|
||||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||||
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
|
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
|
||||||
}
|
}
|
||||||
?>
|
?></td>
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>">
|
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>">
|
||||||
<?php
|
<?php
|
||||||
|
@ -99,8 +95,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'woocommerce' ); ?>">
|
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'woocommerce' ); ?>"><?php
|
||||||
<?php
|
|
||||||
if ( $_product->is_sold_individually() ) {
|
if ( $_product->is_sold_individually() ) {
|
||||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,12 +104,12 @@ do_action( 'woocommerce_before_cart' ); ?>
|
||||||
'input_value' => $cart_item['quantity'],
|
'input_value' => $cart_item['quantity'],
|
||||||
'max_value' => $_product->get_max_purchase_quantity(),
|
'max_value' => $_product->get_max_purchase_quantity(),
|
||||||
'min_value' => '0',
|
'min_value' => '0',
|
||||||
|
'product_name' => $_product->get_name(),
|
||||||
), $_product, false );
|
), $_product, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
|
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
|
||||||
?>
|
?></td>
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'woocommerce' ); ?>">
|
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'woocommerce' ); ?>">
|
||||||
<?php
|
<?php
|
||||||
|
@ -156,7 +151,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
||||||
<div class="cart-collaterals">
|
<div class="cart-collaterals">
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* woocommerce_cart_collaterals hook.
|
* Cart collaterals hook.
|
||||||
*
|
*
|
||||||
* @hooked woocommerce_cross_sell_display
|
* @hooked woocommerce_cross_sell_display
|
||||||
* @hooked woocommerce_cart_totals - 10
|
* @hooked woocommerce_cart_totals - 10
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 3.2.0
|
* @version 3.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -30,7 +30,7 @@ if ( $max_value && $min_value === $max_value ) {
|
||||||
?>
|
?>
|
||||||
<div class="quantity">
|
<div class="quantity">
|
||||||
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></label>
|
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></label>
|
||||||
<input type="number" id="<?php echo esc_attr( $input_id ); ?>" class="input-text qty text" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) ?>" size="4" pattern="<?php echo esc_attr( $pattern ); ?>" inputmode="<?php echo esc_attr( $inputmode ); ?>" />
|
<input type="number" id="<?php echo esc_attr( $input_id ); ?>" class="input-text qty text" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) ?>" size="4" pattern="<?php echo esc_attr( $pattern ); ?>" inputmode="<?php echo esc_attr( $inputmode ); ?>" aria-labelledby="<?php echo ! empty( $args['product_name'] ) ? sprintf( esc_attr__( '%s quantity', 'woocommerce' ), $args['product_name'] ) : ''; ?>" />
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue