0

No Summary is getting generated when configuring a bundled product on my Magento installation. I have been debugging the /vendor/magento/module-bundle/view/frontend/web/js/product-summary.js file but all I can tell is that it is getting fired on each event. I can get the file to log the names of the products added to the bundle ect just nothing is added to the bundle summary.

The bundle-summary container is present and there are no errors in the console. Has anyone else experienced this?

1

I had used a script found on Stack Exchange similar to below to defer javascript similar to below:

preg_match_all('#(<script.*?</script>)#is', $html, $matches);
$js = '';
foreach ($matches[0] as $value):
    $js .= $value;
endforeach;
$html = preg_replace('#(<script.*?</script>)#is', '', $html);
$html = preg_replace('#</body>#',$js.'</body>',$html);

Magento 2: How to Solve Defer parsing of JavaScript on CDN?

Issue

This was moving the below script that was needed for the bundle summary to work correctly:

<script data-template="bundle-summary" type="text/x-magento-template">
                <li>
                    <strong class="label"><%- data._label_ %>:</strong>
                    <div data-container="options"></div>
                </li>
 </script>

Solution

It is a bit of a messy solution but got around it with a simple if statement to stop the moving of these types of script:

preg_match_all('#(<script.*?</script>)#is', $html, $matches);
$js = '';
foreach ($matches[0] as $value):
if (strpos($value, 'type="text/x-magento-template"') === false) {
    $js .= $value;
    $html = str_replace($value, '', $html);
}
endforeach;
$html = preg_replace('#</body>#',$js.'</body>',$html);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.