Issue #3160 fixed
This commit is contained in:
parent
31b9ae7e3e
commit
d2ff59cc15
|
|
@ -21,7 +21,7 @@ mix.js(__dirname + "/src/Resources/assets/js/app.js", "js/admin.js")
|
|||
processCssUrls: false
|
||||
});
|
||||
|
||||
if (!mix.inProduction()) {
|
||||
if (! mix.inProduction()) {
|
||||
mix.sourceMaps();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,13 @@ class BundleOption extends AbstractProduct
|
|||
$options = [];
|
||||
|
||||
foreach ($this->product->bundle_options as $option) {
|
||||
$options[$option->id] = $this->getOptionItemData($option);
|
||||
$data = $this->getOptionItemData($option);
|
||||
|
||||
if (! count($data['products'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$options[$option->id] = $data;
|
||||
}
|
||||
|
||||
usort ($options, function($a, $b) {
|
||||
|
|
@ -79,6 +85,10 @@ class BundleOption extends AbstractProduct
|
|||
$products = [];
|
||||
|
||||
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
|
||||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$products[$bundleOptionProduct->id] = [
|
||||
'id' => $bundleOptionProduct->id,
|
||||
'qty' => $bundleOptionProduct->qty,
|
||||
|
|
@ -110,15 +120,15 @@ class BundleOption extends AbstractProduct
|
|||
{
|
||||
$products = [];
|
||||
|
||||
$products[$product->id] = [
|
||||
'id' => $product->id,
|
||||
'qty' => $product->qty,
|
||||
'price' => $product->product->getTypeInstance()->getProductPrices(),
|
||||
'name' => $product->product->name,
|
||||
'product_id' => $product->product_id,
|
||||
'is_default' => $product->is_default,
|
||||
'sort_order' => $product->sort_order,
|
||||
];
|
||||
$products[$product->id] = [
|
||||
'id' => $product->id,
|
||||
'qty' => $product->qty,
|
||||
'price' => $product->product->getTypeInstance()->getProductPrices(),
|
||||
'name' => $product->product->name,
|
||||
'product_id' => $product->product_id,
|
||||
'is_default' => $product->is_default,
|
||||
'sort_order' => $product->sort_order,
|
||||
];
|
||||
|
||||
usort ($products, function($a, $b) {
|
||||
if ($a['sort_order'] == $b['sort_order']) {
|
||||
|
|
|
|||
|
|
@ -234,6 +234,10 @@ class Bundle extends AbstractType
|
|||
$optionPrices = [];
|
||||
|
||||
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
|
||||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$optionPrices[] = $bundleOptionProduct->qty
|
||||
* ($minPrice
|
||||
? $bundleOptionProduct->product->getTypeInstance()->getMinimalPrice()
|
||||
|
|
@ -271,6 +275,10 @@ class Bundle extends AbstractType
|
|||
|
||||
foreach ($this->product->bundle_options as $option) {
|
||||
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
|
||||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($option->type, ['multiselect', 'checkbox'])) {
|
||||
if (! isset($optionPrices[$option->id][0])) {
|
||||
$optionPrices[$option->id][0] = 0;
|
||||
|
|
@ -304,6 +312,10 @@ class Bundle extends AbstractType
|
|||
|
||||
foreach ($this->product->bundle_options as $option) {
|
||||
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
|
||||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($option->type, ['multiselect', 'checkbox'])) {
|
||||
if (! isset($optionPrices[$option->id][0])) {
|
||||
$optionPrices[$option->id][0] = 0;
|
||||
|
|
@ -427,6 +439,10 @@ class Bundle extends AbstractType
|
|||
foreach ($this->getCartChildProducts($data) as $productId => $data) {
|
||||
$product = $this->productRepository->find($productId);
|
||||
|
||||
if (! $product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cartProduct = $product->getTypeInstance()->prepareForCart(array_merge($data, ['parent_id' => $this->product->id]));
|
||||
|
||||
if (is_string($cartProduct)) {
|
||||
|
|
@ -473,6 +489,10 @@ class Bundle extends AbstractType
|
|||
'product_bundle_option_id' => $optionId,
|
||||
]);
|
||||
|
||||
if (! $optionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$qty = $data['bundle_option_qty'][$optionId] ?? $optionProduct->qty;
|
||||
|
||||
if (! isset($products[$optionProduct->product_id])) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue