function commerce_backoffice_product_quick_edit_form_submit in Commerce Backoffice 7
Submit callback for commerce_backoffice_product_quick_edit_form.
File
- ./
commerce_backoffice_product.module, line 378
Code
function commerce_backoffice_product_quick_edit_form_submit($form, &$form_state) {
$product = $form_state['product'];
$currency_code = $product->commerce_price[LANGUAGE_NONE][0]['currency_code'];
// Make sure decimal separator is period and determine rounding boolean
$currency = commerce_currency_load($currency_code);
$price = $form_state['values']['price'];
if ($currency['decimal_separator'] == ',') {
$price = str_replace(',', '.', $price);
}
$round = $currency['rounding_step'] == 0 ? FALSE : TRUE;
$product->commerce_price[LANGUAGE_NONE][0]['amount'] = commerce_currency_decimal_to_amount($price, $currency_code, $round);
$product->status = $form_state['values']['status'];
commerce_product_save($product);
$form_state['rebuild'] = TRUE;
$form_state['product_saved'] = TRUE;
}