Skip to content

Commit

Permalink
update page structure
Browse files Browse the repository at this point in the history
  • Loading branch information
aknollmann committed Aug 30, 2024
1 parent e8328a6 commit c848861
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 42 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "infrangible/m2-catalog-attribute-landing-page",
"description": "Infrangible Magento 2 Catalog Attribute Landing Page",
"type": "magento2-module",
"version": "1.0.0",
"version": "2.0.0",
"license": "MIT",
"keywords": [
"Magento"
Expand All @@ -18,7 +18,7 @@
],
"require": {
"php": ">=7.1",
"magento/framework": "~102.0.0|~103.0.0",
"magento/framework": "~103.0.0",
"infrangible/m2-backend-widget": "~2.0",
"fewedev/base": ">=1.4.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
</block>
</block>
</referenceContainer>
<referenceContainer name="columns.top">
<container name="landing_page.view.container" htmlTag="div" htmlClass="category-view" after="-">
<block class="Infrangible\CatalogAttributeLandingPage\Block\Page" name="landing_page.description" template="Infrangible_CatalogAttributeLandingPage::page/description.phtml"/>
<block class="Infrangible\CatalogAttributeLandingPage\Block\Page" name="landing_page.cms" template="Infrangible_CatalogAttributeLandingPage::page/cms.phtml"/>
<block class="Infrangible\CatalogAttributeLandingPage\Block\Page" name="landing_page.image" template="Infrangible_CatalogAttributeLandingPage::page/image.phtml"/>
</container>
</referenceContainer>
<referenceContainer name="content">
<block class="Infrangible\CatalogAttributeLandingPage\Block\Page" name="landing_page.products" template="Infrangible_CatalogAttributeLandingPage::page.phtml">
<block class="Infrangible\CatalogAttributeLandingPage\Block\Product\ListProduct" name="product_list" as="landing_page.products.list" template="Magento_Catalog::product/list.phtml">
Expand Down
41 changes: 1 addition & 40 deletions src/view/frontend/templates/page.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,10 @@ declare(strict_types=1);
*/

use Infrangible\CatalogAttributeLandingPage\Block\Page;

/** @var Page $block */
$description = $block->getPage()->getDescription();
$image = $block->getPage()->getImage();
$imagePosition = $block->getImagePosition();
$logo = $block->getPage()->getLogo();
?>

<?php if ($image && $imagePosition === 'headline'): ?>
<p class="category-image">
<img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
</p>
<?php endif; ?>

<?php if ($image && $imagePosition === 'description'): ?>
<p class="category-image">
<img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
</p>
<?php endif; ?>

<?php if ($description): ?>
<div class="landing-page-description category-description std">
<?php if ($logo): ?>
<img src="<?php echo $block->getPage()->getLogoUrl(); ?>" class="category-logo" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
<?php endif; ?>
<?php echo $description; ?>
</div>
<?php endif; ?>

<?php if ($image && $imagePosition === 'cms'): ?>
<p class="category-image">
<img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
</p>
<?php endif; ?>

<?php echo $block->getCmsBlockHtml(); ?>
<?php echo $block->getAdditionalCmsBlockHtml(); ?>

<?php if ($image && $imagePosition === 'product_list'): ?>
<p class="category-image">
<img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
</p>
<?php endif; ?>

<?php echo $block->getProductListHtml(); ?>

<?php echo $block->getSeoCmsBlockHtml(); ?>
29 changes: 29 additions & 0 deletions src/view/frontend/templates/page/cms.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* @author Andreas Knollmann
* @copyright Copyright (c) 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/

use Infrangible\CatalogAttributeLandingPage\Block\Page;

/** @var Page $block */
$image = $block->getPage()->getImage();
$imagePosition = $block->getImagePosition();
$cmsBlockHtml = $block->getCmsBlockHtml();
$additionalCmsBlockHtml = $block->getAdditionalCmsBlockHtml();
?>

<?php if ($image && $imagePosition === 'cms'): ?>
<div class="category-image"><img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" class="image"/></div>
<?php endif; ?>

<?php if ($cmsBlockHtml || $additionalCmsBlockHtml) :?>
<div class="category-cms">
<?php echo $cmsBlockHtml; ?>
<?php echo $additionalCmsBlockHtml; ?>
</div>
<?php endif; ?>
31 changes: 31 additions & 0 deletions src/view/frontend/templates/page/description.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

/**
* @author Andreas Knollmann
* @copyright Copyright (c) 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/

use Infrangible\CatalogAttributeLandingPage\Block\Page;

/** @var Page $block */
$image = $block->getPage()->getImage();
$imagePosition = $block->getImagePosition();
$description = $block->getPage()->getDescription();
$logo = $block->getPage()->getLogo();
?>

<?php if ($image && $imagePosition === 'description'): ?>
<div class="category-image"><img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" class="image"/></div>
<?php endif; ?>

<?php if ($description) :?>
<div class="category-description">
<?php if ($logo): ?>
<img src="<?php echo $block->getPage()->getLogoUrl(); ?>" class="category-logo" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" />
<?php endif; ?>
<?= /* @noEscape */ $description; ?>
</div>
<?php endif; ?>
20 changes: 20 additions & 0 deletions src/view/frontend/templates/page/image.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

/**
* @author Andreas Knollmann
* @copyright Copyright (c) 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/

use Infrangible\CatalogAttributeLandingPage\Block\Page;

/** @var Page $block */
$image = $block->getPage()->getImage();
$imagePosition = $block->getImagePosition();
?>

<?php if ($image && $imagePosition === 'product_list'): ?>
<div class="category-image"><img src="<?php echo $block->getPage()->getImageUrl(); ?>" alt="<?php echo $block->getHeadline(); ?>" title="<?php echo $block->getHeadline(); ?>" class="image"/></div>
<?php endif; ?>

0 comments on commit c848861

Please sign in to comment.