Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
aknollmann committed Jul 31, 2024
0 parents commit e8328a6
Show file tree
Hide file tree
Showing 78 changed files with 4,945 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.idea/
/generated/
/var/
/vendor/
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2014-2024 Softwareentwicklung Andreas Knollmann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Infrangible Catalog Attribute Landing Page

## Introduction

This module adds the possibility to define an attribute based landing pages.

## License

Infrangible Catalog Attribute Landing Page is licensed under the MIT License - see the LICENSE file for details.
34 changes: 34 additions & 0 deletions ads/ads.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"require": [
"webserver_php_magento-module-demo.json",
"database_magento2-module-demo.json",
"elasticsearch_magento-module-demo.json",
"mailcatcher_magento.json",
"magento2-module-demo.json"
],
"global": {
"systemName": "infrangible_m2_catalog_attribute-landing-page"
},
"ws": {
"webServerType": "apache_php",
"webServerVersion": "2.4",
"phpVersion": "8.2",
"containerVolumes": [
"../src:/var/www/magento/htdocs/app/code/Infrangible/CatalogAttributeLandingPage:www-data"
]
},
"db": {
"databaseType": "mysql",
"databaseVersion": "5.7"
},
"es": {
"elasticsearchVersion": "7.9"
},
"mc": {
"mailCatcherVersion": "0.6"
},
"ms": {
"magentoVersion": "2.4.6-p3",
"magentoEdition": "community"
}
}
33 changes: 33 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "infrangible/m2-catalog-attribute-landing-page",
"description": "Infrangible Magento 2 Catalog Attribute Landing Page",
"type": "magento2-module",
"version": "1.0.0",
"license": "MIT",
"keywords": [
"Magento"
],
"homepage": "https://github.com/infrangible-dev/m2-catalog-attribute-landing-page",
"authors": [
{
"name": "Andreas Knollmann",
"email": "a.knollmann@seak.dev",
"homepage": "https://www.seak.dev",
"role": "Developer"
}
],
"require": {
"php": ">=7.1",
"magento/framework": "~102.0.0|~103.0.0",
"infrangible/m2-backend-widget": "~2.0",
"fewedev/base": ">=1.4.0"
},
"autoload": {
"files": [
"src/registration.php"
],
"psr-4": {
"Infrangible\\CatalogAttributeLandingPage\\": "src"
}
}
}
50 changes: 50 additions & 0 deletions src/Block/Adminhtml/Group/Form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

namespace Infrangible\CatalogAttributeLandingPage\Block\Adminhtml\Group;

use Exception;

/**
* @author Andreas Knollmann
* @copyright 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Form
extends \Infrangible\BackendWidget\Block\Form
{
/**
* @param \Magento\Framework\Data\Form $form
*
* @throws Exception
*/
protected function prepareFields(\Magento\Framework\Data\Form $form)
{
$fieldSet = $form->addFieldset('general', ['legend' => __('General')]);

$this->addTextField($fieldSet, 'url_key', __('Url Key')->render(), true);
$this->addTextField($fieldSet, 'headline', __('Headline')->render(), true);
$this->addTextareaField($fieldSet, 'description', __('Description')->render());
$this->addCmsBlockSelectField($fieldSet, 'cms_block_id');

$fieldSet = $form->addFieldset('attribute', ['legend' => __('Attribute')]);

$this->addEavAttributeField($fieldSet, 'attribute_id1', __('Attribute #1')->render(), true);
$this->addEavAttributeField($fieldSet, 'attribute_id2', __('Attribute #2')->render());
$this->addEavAttributeField($fieldSet, 'attribute_id3', __('Attribute #3')->render());
$this->addEavAttributeField($fieldSet, 'attribute_id4', __('Attribute #4')->render());
$this->addEavAttributeField($fieldSet, 'attribute_id5', __('Attribute #5')->render());

$fieldSet = $form->addFieldset('availability', ['legend' => __('Availability')]);

$this->addStoreMultiselectField($fieldSet, 'store_ids');
$this->addYesNoField($fieldSet, 'active', __('Active')->render());

$fieldSet = $form->addFieldset('seo', ['legend' => __('SEO')]);

$this->addTextField($fieldSet, 'page_title', __('Page Title')->render());
$this->addTextareaField($fieldSet, 'meta_description', __('Meta Description')->render());
$this->addTextareaField($fieldSet, 'meta_keywords', __('Meta Keywords')->render());
}
}
47 changes: 47 additions & 0 deletions src/Block/Adminhtml/Group/Grid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

namespace Infrangible\CatalogAttributeLandingPage\Block\Adminhtml\Group;

use Exception;
use Magento\Framework\Data\Collection\AbstractDb;

/**
* @author Andreas Knollmann
* @copyright 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Grid
extends \Infrangible\BackendWidget\Block\Grid
{
protected function prepareCollection(AbstractDb $collection): void
{
}

/**
* @throws Exception
*/
protected function prepareFields(): void
{
$this->addTextColumn('url_key', __('Url Key')->render());
$this->addTextColumn('headline', __('Headline')->render());
$this->addEavAttributeColumn('attribute_id1', __('Attribute #1')->render());
$this->addEavAttributeColumn('attribute_id2', __('Attribute #2')->render());
$this->addEavAttributeColumn('attribute_id3', __('Attribute #3')->render());
$this->addEavAttributeColumn('attribute_id4', __('Attribute #4')->render());
$this->addEavAttributeColumn('attribute_id5', __('Attribute #5')->render());
$this->addYesNoColumn('active', __('Active')->render());
$this->addStoreStructureColumn('store_ids');
$this->addDatetimeColumn('created_at', __('Created At')->render());
$this->addDatetimeColumn('updated_at', __('Updated At')->render());
}

/**
* @return string[]
*/
protected function getHiddenFieldNames(): array
{
return ['attribute_id2', 'attribute_id3', 'attribute_id4', 'attribute_id5'];
}
}
91 changes: 91 additions & 0 deletions src/Block/Adminhtml/Page/Form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php /** @noinspection PhpDeprecationInspection */

declare(strict_types=1);

namespace Infrangible\CatalogAttributeLandingPage\Block\Adminhtml\Page;

use Exception;

/**
* @author Andreas Knollmann
* @copyright 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Form
extends \Infrangible\BackendWidget\Block\Form
{
/**
* @throws Exception
*/
protected function prepareFields(\Magento\Framework\Data\Form $form): void
{
$fieldSet = $form->addFieldset('general', ['legend' => __('General')]);

$this->addTextField($fieldSet, 'url_key', __('Url Key')->render(), true);
$this->addTextField($fieldSet, 'headline', __('Headline')->render(), true);
$this->addTextareaField($fieldSet, 'description', __('Description')->render());
$this->addCmsBlockSelectField($fieldSet, 'cms_block_id');
$this->addCmsBlockSelectField($fieldSet, 'additional_cms_block_id', __('Additional Block')->render());
$this->addCmsBlockSelectField($fieldSet, 'seo_cms_block_id', __('SEO Block')->render());
$this->addWysiwygField($fieldSet, 'image', __('Image')->render());
$this->addWysiwygField($fieldSet, 'logo', __('Logo')->render());
$this->addWysiwygField($fieldSet, 'thumbnail', __('Thumbnail')->render());

$fieldSet = $form->addFieldset('attribute1', ['legend' => __('Attribute #1')]);

$this->addEavAttributeFieldWithUpdate($fieldSet, 'attribute_id1', __('Attribute')->render(), ['value1'], true,
true);
$this->addEavAttributeValueField(
$fieldSet, 'attribute_id1', 'value1', __('Attribute Value')->render(), true, true);

$fieldSet = $form->addFieldset('attribute2', ['legend' => __('Attribute #2')]);

$this->addEavAttributeFieldWithUpdate($fieldSet, 'attribute_id2', __('Attribute')->render(), ['value2']);
$this->addEavAttributeValueField($fieldSet, 'attribute_id2', 'value2', __('Attribute Value')->render());

$fieldSet = $form->addFieldset('attribute3', ['legend' => __('Attribute #3')]);

$this->addEavAttributeFieldWithUpdate($fieldSet, 'attribute_id3', __('Attribute')->render(), ['value3']);
$this->addEavAttributeValueField($fieldSet, 'attribute_id3', 'value3', __('Attribute Value')->render());

$fieldSet = $form->addFieldset('attribute4', ['legend' => __('Attribute #4')]);

$this->addEavAttributeFieldWithUpdate($fieldSet, 'attribute_id4', __('Attribute')->render(), ['value4']);
$this->addEavAttributeValueField($fieldSet, 'attribute_id4', 'value4', __('Attribute Value')->render());

$fieldSet = $form->addFieldset('attribute5', ['legend' => __('Attribute #5')]);

$this->addEavAttributeFieldWithUpdate($fieldSet, 'attribute_id5', __('Attribute')->render(), ['value5']);
$this->addEavAttributeValueField($fieldSet, 'attribute_id5', 'value5', __('Attribute Value')->render());

$fieldSet = $form->addFieldset('attribute_set', ['legend' => __('Attribute Set')]);

$this->addEavAttributeSetField($fieldSet, 'attribute_set_id', __('Attribute Set')->render());

$fieldSet = $form->addFieldset('order', ['legend' => __('Attribute Order')]);

$this->addAttributeSortByField(
$fieldSet, 'attribute_orders', __('Available Attributes')->render(), false, true);
$this->addAttributeSortByField($fieldSet, 'attribute_order', __('Attribute')->render());

$attributeOrderDirection = [
['value' => '', 'label' => '-- Please select --'],
['value' => 'asc', 'label' => 'Ascending'],
['value' => 'desc', 'label' => 'Descending']];

$this->addOptionsField(
$fieldSet, 'attribute_order_direction', __('Direction')->render(), $attributeOrderDirection, '');

$fieldSet = $form->addFieldset('availability', ['legend' => __('Availability')]);

$this->addStoreMultiselectField($fieldSet, 'store_ids');
$this->addYesNoField($fieldSet, 'active', __('Active')->render());
$this->addYesNoField($fieldSet, 'check_active', __('Check Active')->render());

$fieldSet = $form->addFieldset('seo', ['legend' => __('SEO')]);

$this->addTextField($fieldSet, 'page_title', __('Page Title')->render());
$this->addTextareaField($fieldSet, 'meta_description', __('Meta Description')->render());
$this->addTextareaField($fieldSet, 'meta_keywords', __('Meta Keywords')->render());
}
}
62 changes: 62 additions & 0 deletions src/Block/Adminhtml/Page/Grid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

namespace Infrangible\CatalogAttributeLandingPage\Block\Adminhtml\Page;

use Exception;
use Magento\Framework\Data\Collection\AbstractDb;

/**
* @author Andreas Knollmann
* @copyright 2014-2024 Softwareentwicklung Andreas Knollmann
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Grid
extends \Infrangible\BackendWidget\Block\Grid
{
protected function prepareCollection(AbstractDb $collection): void
{
}

/**
* @throws Exception
*/
protected function prepareFields(): void
{
$this->addTextColumn('url_key', __('Url Key')->render());
$this->addTextColumn('headline', __('Headline')->render());
$this->addEavAttributeColumn('attribute_id1', __('Attribute #1')->render());
$this->addEavAttributeValueColumn('value1', 'attribute_id1', __('Value #1')->render(), true);
$this->addEavAttributeColumn('attribute_id2', __('Attribute #2')->render());
$this->addEavAttributeValueColumn('value2', 'attribute_id2', __('Value #2')->render(), true);
$this->addEavAttributeColumn('attribute_id3', __('Attribute #3')->render());
$this->addEavAttributeValueColumn('value3', 'attribute_id3', __('Value #3')->render(), true);
$this->addEavAttributeColumn('attribute_id4', __('Attribute #4')->render());
$this->addEavAttributeValueColumn('value4', 'attribute_id4', __('Value #4')->render(), true);
$this->addEavAttributeColumn('attribute_id5', __('Attribute #5')->render());
$this->addEavAttributeValueColumn('value5', 'attribute_id5', __('Value #5')->render(), true);
$this->addEavAttributeSetColumn('attribute_set_id', __('Attribute Set')->render());
$this->addYesNoColumn('active', __('Active')->render());
$this->addStoreStructureColumn('store_ids');
$this->addDatetimeColumn('created_at', __('Created At')->render());
$this->addDatetimeColumn('updated_at', __('Updated At')->render());
}

/**
* @return string[]
*/
protected function getHiddenFieldNames(): array
{
return [
'attribute_id2',
'value2',
'attribute_id3',
'value3',
'attribute_id4',
'value4',
'attribute_id5',
'value5'
];
}
}
Loading

0 comments on commit e8328a6

Please sign in to comment.