Closes woocommerce/woocommerce-blocks#84: Adds order setting to individual product scope
This commit is contained in:
parent
08ec9fa803
commit
5d42920036
|
@ -570,7 +570,6 @@ var ProductsBlockPreview = withAPIData(function (_ref) {
|
|||
|
||||
if ('specific' === display) {
|
||||
query.include = display_setting.join(',');
|
||||
query.orderby = 'include';
|
||||
} else if ('category' === display) {
|
||||
query.category = display_setting.join(',');
|
||||
} else if ('attribute' === display && display_setting.length) {
|
||||
|
@ -586,7 +585,7 @@ var ProductsBlockPreview = withAPIData(function (_ref) {
|
|||
}
|
||||
|
||||
// @todo Add support for orderby by sales, rating, and price to the API.
|
||||
if ('specific' !== display && ('title' === orderby || 'date' === orderby)) {
|
||||
if ('title' === orderby || 'date' === orderby) {
|
||||
query.orderby = orderby;
|
||||
|
||||
if ('title' === orderby) {
|
||||
|
@ -753,10 +752,8 @@ registerBlockType('woocommerce/products', {
|
|||
});
|
||||
}
|
||||
|
||||
// Orderby settings don't make sense for specific-selected products display.
|
||||
var orderControl = null;
|
||||
if ('specific' !== display) {
|
||||
orderControl = wp.element.createElement(SelectControl, {
|
||||
// Order controls
|
||||
var orderControl = wp.element.createElement(SelectControl, {
|
||||
key: 'query-panel-select',
|
||||
label: __('Order Products By'),
|
||||
value: orderby,
|
||||
|
@ -783,7 +780,6 @@ registerBlockType('woocommerce/products', {
|
|||
return setAttributes({ orderby: value });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Row settings don't make sense for specific-selected products display.
|
||||
var rowControl = null;
|
||||
|
|
|
@ -337,7 +337,6 @@ const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
|
|||
|
||||
if ( 'specific' === display ) {
|
||||
query.include = display_setting.join( ',' );
|
||||
query.orderby = 'include';
|
||||
} else if ( 'category' === display ) {
|
||||
query.category = display_setting.join( ',' );
|
||||
} else if ( 'attribute' === display && display_setting.length ) {
|
||||
|
@ -353,7 +352,7 @@ const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
|
|||
}
|
||||
|
||||
// @todo Add support for orderby by sales, rating, and price to the API.
|
||||
if ( 'specific' !== display && ( 'title' === orderby || 'date' === orderby ) ) {
|
||||
if ( 'title' === orderby || 'date' === orderby ) {
|
||||
query.orderby = orderby;
|
||||
|
||||
if ( 'title' === orderby ) {
|
||||
|
@ -486,10 +485,8 @@ registerBlockType( 'woocommerce/products', {
|
|||
);
|
||||
}
|
||||
|
||||
// Orderby settings don't make sense for specific-selected products display.
|
||||
let orderControl = null;
|
||||
if ( 'specific' !== display ) {
|
||||
orderControl = (
|
||||
// Order controls
|
||||
let orderControl = (
|
||||
<SelectControl
|
||||
key="query-panel-select"
|
||||
label={ __( 'Order Products By' ) }
|
||||
|
@ -523,7 +520,6 @@ registerBlockType( 'woocommerce/products', {
|
|||
onChange={ ( value ) => setAttributes( { orderby: value } ) }
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// Row settings don't make sense for specific-selected products display.
|
||||
let rowControl = null;
|
||||
|
|
Loading…
Reference in New Issue