Issue #2147
This commit is contained in:
parent
cbaebaa388
commit
4fd6599bda
|
|
@ -45,6 +45,14 @@ class BundleOption extends AbstractProduct
|
|||
$options[$option->id] = $this->getOptionItemData($option);
|
||||
}
|
||||
|
||||
usort ($options, function($a, $b) {
|
||||
if ($a['sort_order'] == $b['sort_order']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort_order'] < $b['sort_order']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +76,7 @@ class BundleOption extends AbstractProduct
|
|||
|
||||
/**
|
||||
* Get formed data from bundle option product
|
||||
*
|
||||
*
|
||||
* @param ProductBundleOption $option
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -83,10 +91,19 @@ class BundleOption extends AbstractProduct
|
|||
'price' => $bundleOptionProduct->product->getTypeInstance()->getProductPrices(),
|
||||
'name' => $bundleOptionProduct->product->name,
|
||||
'product_id' => $bundleOptionProduct->product_id,
|
||||
'is_default' => $bundleOptionProduct->is_default
|
||||
'is_default' => $bundleOptionProduct->is_default,
|
||||
'sort_order' => $bundleOptionProduct->sort_order
|
||||
];
|
||||
}
|
||||
|
||||
usort ($products, function($a, $b) {
|
||||
if ($a['sort_order'] == $b['sort_order']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort_order'] < $b['sort_order']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $products;
|
||||
}
|
||||
}
|
||||
|
|
@ -535,12 +535,12 @@ class Bundle extends AbstractType
|
|||
continue;
|
||||
|
||||
$optionProduct = $this->productBundleOptionProductRepository->find($optionProductId);
|
||||
|
||||
|
||||
$qty = $data['bundle_option_qty'][$optionId] ?? $optionProduct->qty;
|
||||
|
||||
if (! isset($data['bundle_option_qty'][$optionId]))
|
||||
$bundleOptionQuantities[$optionId] = $qty;
|
||||
|
||||
|
||||
$labels[] = $qty . ' x ' . $optionProduct->product->name . ' ' . core()->currency($optionProduct->product->getTypeInstance()->getMinimalPrice());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@
|
|||
data: function() {
|
||||
return {
|
||||
selected_product: (this.option.type == 'checkbox' || this.option.type == 'multiselect') ? [] : null,
|
||||
|
||||
|
||||
qty_validations: ''
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue