This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,125 @@
<?php
namespace WeltPixel\LayeredNavigation\Setup\Patch\Schema;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
class AddAttributeOptionsTable implements SchemaPatchInterface, PatchVersionInterface
{
/**
* @var SchemaSetupInterface $schemaSetup
*/
private $schemaSetup;
/**
* @param SchemaSetupInterface $schemaSetup
*/
public function __construct(SchemaSetupInterface $schemaSetup)
{
$this->schemaSetup = $schemaSetup;
}
/**
* {@inheritdoc}
*/
public function apply()
{
$setup = $this->schemaSetup;
$this->schemaSetup->startSetup();
/**
* Create table 'weltpixel_ln_attribute_options'
*/
$table = $setup->getConnection()->newTable(
$setup->getTable('weltpixel_ln_attribute_options')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'Id'
)->addColumn(
'attribute_id',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '0'],
'Attribute Id'
)->addColumn(
'display_option',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '0'],
'Filter Display Option'
)->addColumn(
'visible_options',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '99'],
'Initial number of options'
)->addColumn(
'visible_options_step',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '99'],
'Expandable items behaviour'
)->addColumn(
'is_multiselect',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '0'],
'Enable Multiselect'
)->addColumn(
'show_quantity',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '0'],
'Show Quantity'
)->addColumn(
'sort_by',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['unsigned' => true, 'nullable' => false, 'default' => '1'],
'Sort By'
)->addIndex(
$setup->getIdxName($setup->getTable('weltpixel_ln_attribute_options'),['id']),
['id']
)->addForeignKey(
$setup->getFkName('weltpixel_ln_attribute_options', 'attribute_id', 'eav_attribute', 'attribute_id'),
'attribute_id',
$setup->getTable('eav_attribute'),
'attribute_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'WeltPixel Layered Navigation Attribute Options'
);
$setup->getConnection()->createTable($table);
$this->schemaSetup->endSetup();
}
/**
* {@inheritdoc}
*/
public static function getVersion()
{
return '1.0.0';
}
/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}
}
@@ -0,0 +1,108 @@
<?php
namespace WeltPixel\LayeredNavigation\Setup\Patch\Schema;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
class ModifyAttributeOptionsTableColumns implements SchemaPatchInterface, PatchVersionInterface
{
/**
* @var SchemaSetupInterface $schemaSetup
*/
private $schemaSetup;
/**
* @param SchemaSetupInterface $schemaSetup
*/
public function __construct(SchemaSetupInterface $schemaSetup)
{
$this->schemaSetup = $schemaSetup;
}
/**
* {@inheritdoc}
*/
public function apply()
{
$setup = $this->schemaSetup;
$setup->startSetup();
$connection = $setup->getConnection();
$tableName = $setup->getTable('weltpixel_ln_attribute_options');
if ($setup->getConnection()->isTableExists($tableName)) {
$columns = [
'instant_search' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'default' => 0,
'unsigned' => true,
'nullable' => false,
'comment' => 'Instant Search Desktop',
],
'instant_search_mobile' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'default' => 0,
'unsigned' => true,
'nullable' => false,
'comment' => 'Instant Search Mobile',
],
'category_visibility' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'default' => 0,
'unsigned' => true,
'nullable' => false,
'comment' => 'Category Visibility',
],
'category_ids' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'unsigned' => true,
'nullable' => true,
'comment' => 'Categories ids list',
],
'keep_open_after_filter' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'default' => 0,
'unsigned' => true,
'nullable' => false,
'comment' => 'Keep attribute opened after filtering',
'after' => 'is_multiselect'
]
];
foreach ($columns as $name => $definition) {
if (!$connection->tableColumnExists($tableName, $name)) {
$connection->addColumn($tableName, $name, $definition);
}
}
}
$setup->endSetup();
}
/**
* {@inheritdoc}
*/
public static function getVersion()
{
return '1.0.4';
}
/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
AddAttributeOptionsTable::class
];
}
}