Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product layout based on attribute_set #36244

Merged
merged 12 commits into from
Feb 17, 2025
7 changes: 5 additions & 2 deletions app/code/Magento/Catalog/Helper/Product/View.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2011 Adobe
* All Rights Reserved.
*/

namespace Magento\Catalog\Helper\Product;
Expand Down Expand Up @@ -178,16 +178,19 @@ public function initProductLayout(ResultPage $resultPage, $product, $params = nu
if ($params && $params->getBeforeHandles()) {
foreach ($params->getBeforeHandles() as $handle) {
$resultPage->addPageLayoutHandles(['type' => $product->getTypeId()], $handle, false);
$resultPage->addPageLayoutHandles(['attribute_set' => $product->getAttributeSetId()], $handle, false);
$resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku], $handle);
}
}

$resultPage->addPageLayoutHandles(['type' => $product->getTypeId()], null, false);
$resultPage->addPageLayoutHandles(['attribute_set' => $product->getAttributeSetId()], null, false);
$resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku]);

if ($params && $params->getAfterHandles()) {
foreach ($params->getAfterHandles() as $handle) {
$resultPage->addPageLayoutHandles(['type' => $product->getTypeId()], $handle, false);
$resultPage->addPageLayoutHandles(['attribute_set' => $product->getAttributeSetId()], $handle, false);
$resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku], $handle);
}
}
Expand Down