Align variations params

This commit is contained in:
Claudio Sanches 2016-04-01 15:00:00 -03:00
parent fb8773c570
commit 7e791e6f4f
1 changed files with 31 additions and 31 deletions

View File

@ -457,41 +457,41 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
}
$variations[] = array(
'id' => $variation->get_variation_id(),
'date_created' => wc_rest_prepare_date_response( $variation->get_post_data()->post_date_gmt ),
'date_modified' => wc_rest_prepare_date_response( $variation->get_post_data()->post_modified_gmt ),
'permalink' => $variation->get_permalink(),
'sku' => $variation->get_sku(),
'price' => $variation->get_price(),
'regular_price' => $variation->get_regular_price(),
'sale_price' => $variation->get_sale_price(),
'date_on_sale_from' => $variation->sale_price_dates_from ? date( 'Y-m-d', $variation->sale_price_dates_from ) : '',
'date_on_sale_to' => $variation->sale_price_dates_to ? date( 'Y-m-d', $variation->sale_price_dates_to ) : '',
'on_sale' => $variation->is_on_sale(),
'purchasable' => $variation->is_purchasable(),
'virtual' => $variation->is_virtual(),
'downloadable' => $variation->is_downloadable(),
'downloads' => $this->get_downloads( $variation ),
'download_limit' => (int) $variation->download_limit,
'download_expiry' => (int) $variation->download_expiry,
'tax_status' => $variation->get_tax_status(),
'tax_class' => $variation->get_tax_class(),
'manage_stock' => $variation->managing_stock(),
'stock_quantity' => $variation->get_stock_quantity(),
'in_stock' => $variation->is_in_stock(),
'backorders' => $variation->backorders,
'backorders_allowed'=> $variation->backorders_allowed(),
'backordered' => $variation->is_on_backorder(),
'weight' => $variation->get_weight(),
'dimensions' => array(
'id' => $variation->get_variation_id(),
'date_created' => wc_rest_prepare_date_response( $variation->get_post_data()->post_date_gmt ),
'date_modified' => wc_rest_prepare_date_response( $variation->get_post_data()->post_modified_gmt ),
'permalink' => $variation->get_permalink(),
'sku' => $variation->get_sku(),
'price' => $variation->get_price(),
'regular_price' => $variation->get_regular_price(),
'sale_price' => $variation->get_sale_price(),
'date_on_sale_from' => $variation->sale_price_dates_from ? date( 'Y-m-d', $variation->sale_price_dates_from ) : '',
'date_on_sale_to' => $variation->sale_price_dates_to ? date( 'Y-m-d', $variation->sale_price_dates_to ) : '',
'on_sale' => $variation->is_on_sale(),
'purchasable' => $variation->is_purchasable(),
'virtual' => $variation->is_virtual(),
'downloadable' => $variation->is_downloadable(),
'downloads' => $this->get_downloads( $variation ),
'download_limit' => (int) $variation->download_limit,
'download_expiry' => (int) $variation->download_expiry,
'tax_status' => $variation->get_tax_status(),
'tax_class' => $variation->get_tax_class(),
'manage_stock' => $variation->managing_stock(),
'stock_quantity' => $variation->get_stock_quantity(),
'in_stock' => $variation->is_in_stock(),
'backorders' => $variation->backorders,
'backorders_allowed' => $variation->backorders_allowed(),
'backordered' => $variation->is_on_backorder(),
'weight' => $variation->get_weight(),
'dimensions' => array(
'length' => $variation->get_length(),
'width' => $variation->get_width(),
'height' => $variation->get_height(),
),
'shipping_class' => $variation->get_shipping_class(),
'shipping_class_id' => $variation->get_shipping_class_id(),
'image' => $this->get_images( $variation ),
'attributes' => $this->get_attributes( $variation ),
'shipping_class' => $variation->get_shipping_class(),
'shipping_class_id' => $variation->get_shipping_class_id(),
'image' => $this->get_images( $variation ),
'attributes' => $this->get_attributes( $variation ),
);
}