Create handle with 2 variables

69 views Asked by At

I would like to create a layout specified for only simple product with attribute set id of 4.

currently my code is something like this:

 public function initProductLayout(ResultPage $resultPage, $product, $params = null)
  {
    $resultPage->addPageLayoutHandles(
            ['attribute_set_id' => $product->getAttributeSetId()]
        );

and i have this layout catalog_product_view_attribute_set_id_4.xml its all good in the products page but my problem is that catalog_product_type_bundle.xml is not being used. So I would like to have a layout file which is like catalog_product_type_bundle_attribute_set_id_4.xml if it is possible.

1

There are 1 answers

0
BelVG On

It is possible to get the layout file you are talking about. To do this you should add this code in addition to one you already have

$resultPage->addPageLayoutHandles(['type_'.$product->getTypeId().'_attribute_set_id' => $product->getAttributeSetId()]);

As a result you will get this enter image description here