Merge pull request #12470 from woocommerce/upsells-allow-variations

Upsells and Cross sells variations
This commit is contained in:
Claudio Sanches 2016-11-25 12:02:54 -02:00 committed by GitHub
commit 82fa5e4f36
3 changed files with 4 additions and 4 deletions

View File

@ -276,7 +276,7 @@ class WC_Meta_Box_Product_Data {
'shipping_class_id' => absint( $_POST['product_shipping_class'] ),
'sold_individually' => ! empty( $_POST['_sold_individually'] ),
'upsell_ids' => array_map( 'intval', explode( ',', $_POST['upsell_ids'] ) ),
'crosssell_ids' => array_map( 'intval', explode( ',', $_POST['crosssell_ids'] ) ),
'cross_sell_ids' => array_map( 'intval', explode( ',', $_POST['crosssell_ids'] ) ),
'regular_price' => wc_clean( $_POST['_regular_price'] ),
'sale_price' => wc_clean( $_POST['_sale_price'] ),
'date_on_sale_from' => wc_clean( $_POST['_sale_price_dates_from'] ),

View File

@ -3,7 +3,7 @@
<div class="options_group">
<p class="form-field">
<label for="upsell_ids"><?php _e( 'Up-sells', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" style="width: 50%;" id="upsell_ids" name="upsell_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php echo intval( $post->ID ); ?>" data-selected="<?php
<input type="hidden" class="wc-product-search" style="width: 50%;" id="upsell_ids" name="upsell_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-multiple="true" data-exclude="<?php echo intval( $post->ID ); ?>" data-selected="<?php
$product_ids = $product_object->get_upsell_ids( 'edit' );
$json_ids = array();
@ -20,7 +20,7 @@
<p class="form-field">
<label for="crosssell_ids"><?php _e( 'Cross-sells', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" style="width: 50%;" id="crosssell_ids" name="crosssell_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php echo intval( $post->ID ); ?>" data-selected="<?php
<input type="hidden" class="wc-product-search" style="width: 50%;" id="crosssell_ids" name="crosssell_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-multiple="true" data-exclude="<?php echo intval( $post->ID ); ?>" data-selected="<?php
$product_ids = $product_object->get_cross_sell_ids( 'edit' );
$json_ids = array();

View File

@ -612,7 +612,7 @@ class WC_Cart {
foreach ( $this->get_cart() as $cart_item_key => $values ) {
if ( $values['quantity'] > 0 ) {
$cross_sells = array_merge( $values['data']->get_cross_sell_ids(), $cross_sells );
$in_cart[] = $values['product_id'];
$in_cart[] = $values['product_id'];
}
}
}