Skip to content

Commit 36e2dcd

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-59: Importing Bundle with '?' in the option title corrupts how option is displayed and prevents product from being added to cart
1 parent e6db6fd commit 36e2dcd

File tree

2 files changed

+7
-10
lines changed
  • app/code/Magento
    • BundleImportExport/Model/Import/Product/Type
    • Bundle/view/frontend/templates/catalog/product/view

2 files changed

+7
-10
lines changed

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// phpcs:disable PHPCompatibility.Miscellaneous.RemovedAlternativePHPTags.MaybeASPOpenTagFound
88
$_product = $block->getProduct();
99
?>
10-
<?php if ($_product->isSaleable() && $block->hasOptions()): ?>
10+
<?php if ($_product->isSaleable() && $block->hasOptions()) : ?>
1111
<div id="bundleSummary"
1212
class="block-bundle-summary"
1313
data-mage-init='{"sticky":{"container": ".product-add-form"}}'>
@@ -19,11 +19,11 @@ $_product = $block->getProduct();
1919
<?= $block->getImage($_product, 'bundled_product_customization_page')->toHtml() ?>
2020
<div class="product-details">
2121
<strong class="product name"><?= $block->escapeHtml($_product->getName()) ?></strong>
22-
<?php if ($_product->getIsSalable()): ?>
22+
<?php if ($_product->getIsSalable()) : ?>
2323
<p class="available stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
2424
<span><?= $block->escapeHtml(__('In stock')) ?></span>
2525
</p>
26-
<?php else: ?>
26+
<?php else : ?>
2727
<p class="unavailable stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
2828
<span><?= $block->escapeHtml(__('Out of stock')) ?></span>
2929
</p>
@@ -48,7 +48,6 @@ $_product = $block->getProduct();
4848
</div>
4949
</div>
5050
</div>
51-
<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate?>
5251
<script type="text/x-magento-init">
5352
{
5453
".product-add-form": {
@@ -58,7 +57,7 @@ $_product = $block->getProduct();
5857
"slideBackSelector": ".action.customization.back",
5958
"bundleProductSelector": "#bundleProduct",
6059
"bundleOptionsContainer": ".product-add-form"
61-
<?php if ($block->isStartCustomization()): ?>
60+
<?php if ($block->isStartCustomization()) : ?>
6261
,"autostart": true
6362
<?php endif;?>
6463
}

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ protected function parseSelections($rowData, $entityId)
184184
$selections = explode(
185185
Product::PSEUDO_MULTI_LINE_SEPARATOR,
186186
$rowData['bundle_values']
187-
//str_replace('?', '&#63;', $rowData['bundle_values'])
188187
);
189188
foreach ($selections as $selection) {
190189
$values = explode($this->_entityModel->getMultipleValueSeparator(), $selection);
@@ -200,7 +199,7 @@ protected function parseSelections($rowData, $entityId)
200199
$this->_cachedOptions[$entityId][$option['name']]['selections'] = [];
201200
}
202201
$this->_cachedOptions[$entityId][$option['name']]['selections'][] = $option;
203-
$this->_cachedOptionSelectQuery[] = 'parent_id =' . (int)$entityId . ' AND title =' . $option['name'];
202+
$this->_cachedOptionSelectQuery[] = [(int)$entityId, $option['name']];
204203
}
205204
}
206205
return $selections;
@@ -481,11 +480,10 @@ protected function populateExistingOptions()
481480
);
482481
$orWhere = false;
483482
foreach ($this->_cachedOptionSelectQuery as $item) {
484-
$expItem = explode('=', $item);
485483
if ($orWhere) {
486-
$select->orWhere($expItem[0].' = '.$expItem[1].' = ?', $expItem[2]);
484+
$select->orWhere('parent_id = '.$item[0].' AND title = ?', $item[1]);
487485
} else {
488-
$select->where($expItem[0].' = '.$expItem[1].' = ?', $expItem[2]);
486+
$select->where('parent_id = '.$item[0].' AND title = ?', $item[1]);
489487
$orWhere = true;
490488
}
491489
}

0 commit comments

Comments
 (0)