This commit is contained in:
rahul shukla 2020-01-27 13:24:22 +05:30
parent cbaebaa388
commit 4fd6599bda
3 changed files with 22 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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());
}

View File

@ -182,7 +182,7 @@
data: function() {
return {
selected_product: (this.option.type == 'checkbox' || this.option.type == 'multiselect') ? [] : null,
qty_validations: ''
}
},