This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from outeredge/use-subcategories
use subcategories option added to menu items
- Loading branch information
Showing
9 changed files
with
256 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace OuterEdge\Menu\Setup; | ||
|
||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\DB\Ddl\Table; | ||
|
||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->startSetup(); | ||
|
||
if (version_compare($context->getVersion(), '1.0.1', '<')) { | ||
$this->addUseSubcategoriesColumnToItemTable($setup); | ||
} | ||
|
||
$setup->endSetup(); | ||
} | ||
|
||
/** | ||
* Add the column 'use_subcategories' to the MenuItem table | ||
* It allows to use subcategory tree on a menu item | ||
* | ||
* @param SchemaSetupInterface $setup | ||
* | ||
* @return void | ||
*/ | ||
private function addUseSubcategoriesColumnToItemTable(SchemaSetupInterface $setup) | ||
{ | ||
$connection = $setup->getConnection(); | ||
|
||
$tableItem = $setup->getTable('menu_item'); | ||
if ($connection->isTableExists($tableItem) == true) { | ||
$connection->addColumn( | ||
$tableItem, | ||
'use_subcategories', | ||
[ | ||
'type' => Table::TYPE_SMALLINT, | ||
'nullable' => false, | ||
'default' => 0, | ||
'comment' => 'Use Subcategory Tree' | ||
] | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="OuterEdge_Menu" setup_version="1.0.0"/> | ||
<module name="OuterEdge_Menu" setup_version="1.0.1"/> | ||
</config> |
Oops, something went wrong.