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

Fix body classes for manufacturer and supplier listings #31319

Merged
merged 1 commit into from Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions controllers/front/listing/ManufacturerController.php
Expand Up @@ -32,7 +32,7 @@ class ManufacturerControllerCore extends ProductListingFrontController
/** @var string */
public $php_self = 'manufacturer';

/** @var Manufacturer */
/** @var Manufacturer|null */
protected $manufacturer;
protected $label;

Expand Down Expand Up @@ -225,7 +225,7 @@ public function getBreadcrumbLinks()
'url' => $this->context->link->getPageLink('manufacturer', true),
];

if (Validate::isLoadedObject($this->manufacturer) && $this->manufacturer->active && $this->manufacturer->isAssociatedToShop()) {
if (!empty($this->manufacturer)) {
$breadcrumb['links'][] = [
'title' => $this->manufacturer->name,
'url' => $this->context->link->getManufacturerLink($this->manufacturer),
Expand All @@ -239,8 +239,10 @@ public function getTemplateVarPage()
{
$page = parent::getTemplateVarPage();

$page['body_classes']['manufacturer-id-' . $this->manufacturer->id] = true;
$page['body_classes']['manufacturer-' . $this->manufacturer->name] = true;
if (!empty($this->manufacturer)) {
$page['body_classes']['manufacturer-id-' . $this->manufacturer->id] = true;
$page['body_classes']['manufacturer-' . $this->manufacturer->name] = true;
}

return $page;
}
Expand Down
10 changes: 6 additions & 4 deletions controllers/front/listing/SupplierController.php
Expand Up @@ -34,7 +34,7 @@ class SupplierControllerCore extends ProductListingFrontController
*/
public $php_self = 'supplier';

/** @var Supplier */
/** @var Supplier|null */
protected $supplier;
protected $label;

Expand Down Expand Up @@ -228,7 +228,7 @@ public function getBreadcrumbLinks()
'url' => $this->context->link->getPageLink('supplier', true),
];

if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToShop()) {
if (!empty($this->supplier)) {
$breadcrumb['links'][] = [
'title' => $this->supplier->name,
'url' => $this->context->link->getSupplierLink($this->supplier),
Expand All @@ -242,8 +242,10 @@ public function getTemplateVarPage()
{
$page = parent::getTemplateVarPage();

$page['body_classes']['supplier-id-' . $this->supplier->id] = true;
$page['body_classes']['supplier-' . $this->supplier->name] = true;
if (!empty($this->supplier)) {
$page['body_classes']['supplier-id-' . $this->supplier->id] = true;
$page['body_classes']['supplier-' . $this->supplier->name] = true;
}

return $page;
}
Expand Down