1

I need two different layouts for bundles. For this I created an alternative page layout in the page_layout folder. I am able to access the page layout in the backend of the bundle what works like a charm.

Now I need to have an alternative XML-definition for the bundle-layout.

The original file is called:
catalog_product_view_type_bundle.xml

I would like to use an alternative, like:
catalog_product_view_type_bundle_alternative.xml

In this new file I would like to add f.e. a new body-class with:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <attribute name="class" value="konfigurator" />
...

But how do I get the connection between the page-layout-file and the bundle-layout. I guess it is really easy but I really do not know how to solve this.

To be clear: I would like to have 2 different layouts for bundle (like a/b test). These both layouts should have different classes, CSS- and JS-resources.

I would really appreciate some hints.

  • .xml files are created according to handler. In your case did you created it? In your case best way to add class to body is from code i.e. if some logic then add class to body. Let me know if you need to add class through code. – Sukumar Gorai Aug 21 '18 at 9:17
  • Or you would need to add a new product type BundleAlternative to have catalog_product_view_type_bundle_alternative.xml working. But I find the question not clear enough. a) Do you want to use a different layout for bundle? b) Do you want to use 2 different layouts for bundle (like an a/b test)? c) Or do you want another bundle product that has a different layout? d) ? – steros Aug 21 '18 at 9:33
  • To add a class is just one thing I want to achieve. There are also other CSS- and JS-resources I would like to add. I know how to do it in the original file. The question is how to connect the alternative layout in the backend with this alternative file: catalog_product_view_type_bundle.xml. – user3631648 Aug 21 '18 at 9:33
  • Sorry for not being that clear: I would like to have 2 different layouts for bundle (like a/b test). These both layouts should have different classes, CSS- and JS-resources. (I am going to clarify this in the question, thanks you steros). – user3631648 Aug 21 '18 at 9:38

Your Answer

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

Browse other questions tagged or ask your own question.