-
Notifications
You must be signed in to change notification settings - Fork 58
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 #8 from vvasiloud/master
Subcategory depth level select & Current category tree option added
- Loading branch information
Showing
15 changed files
with
219 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
/** | ||
* Class:Categories | ||
* Sebwite\Sidebar\Model\Config\Source | ||
* | ||
* @author Vasilis Vasiloudis | ||
* @package Sebwite\Sidebar | ||
* @copyright Copyright (c) 2016, vvasiloud. All rights reserved | ||
*/ | ||
namespace Sebwite\Sidebar\Helper; | ||
|
||
use Magento\Framework\Module\ModuleListInterface; | ||
|
||
class Data extends \Magento\Framework\App\Helper\AbstractHelper | ||
{ | ||
const XML_PATH_ENABLED = 'general/enabled'; | ||
const XML_PATH_CATEGORY = 'general/category'; | ||
const XML_PATH_CATEGORY_DEPTH_LEVEL = 'general/categorydepth'; | ||
|
||
|
||
/** | ||
* @var ModuleListInterface | ||
*/ | ||
protected $_moduleList; | ||
|
||
/** | ||
* @param \Magento\Framework\App\Helper\Context $context | ||
* @param ModuleListInterface $moduleList | ||
*/ | ||
public function __construct(\Magento\Framework\App\Helper\Context $context, ModuleListInterface $moduleList | ||
) { | ||
$this->_moduleList = $moduleList; | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* @param $xmlPath | ||
* @param string $section | ||
* | ||
* @return string | ||
*/ | ||
public function getConfigPath( | ||
$xmlPath, | ||
$section = 'sebwitete_sidebar' | ||
) { | ||
return $section . '/' . $xmlPath; | ||
} | ||
|
||
/** | ||
* Check if enabled | ||
* | ||
* @return string|null | ||
*/ | ||
public function isEnabled() | ||
{ | ||
return $this->scopeConfig->getValue( | ||
$this->getConfigPath(self::XML_PATH_ENABLED), | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
|
||
/** | ||
* Get sidebar category | ||
* | ||
* @return string|null | ||
*/ | ||
public function getSidebarCategory() | ||
{ | ||
return $this->scopeConfig->getValue( | ||
$this->getConfigPath(self::XML_PATH_CATEGORY), | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
|
||
/** | ||
* Get category depth level | ||
* | ||
* @return string|null | ||
*/ | ||
public function getCategoryDepthLevel() | ||
{ | ||
return $this->scopeConfig->getValue( | ||
$this->getConfigPath(self::XML_PATH_CATEGORY_DEPTH_LEVEL), | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
|
||
} |
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,43 @@ | ||
<?php namespace Sebwite\Sidebar\Model\Config\Source; | ||
|
||
/** | ||
* Class:Categories | ||
* Sebwite\Sidebar\Model\Config\Source | ||
* | ||
* @author Vasilis Vasiloudis | ||
* @package Sebwite\Sidebar | ||
* @copyright Copyright (c) 2016, vvasiloud. All rights reserved | ||
*/ | ||
class Depth implements \Magento\Framework\Option\ArrayInterface { | ||
|
||
/** | ||
* Return array of options as value-label pairs | ||
* | ||
* @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...) | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
return [ | ||
[ | ||
'value' => 1, | ||
'label' => __('1'), | ||
], | ||
[ | ||
'value' => 2, | ||
'label' => __('2'), | ||
], | ||
[ | ||
'value' => 3, | ||
'label' => __('3'), | ||
], | ||
[ | ||
'value' => 4, | ||
'label' => __('4'), | ||
], | ||
[ | ||
'value' => 5, | ||
'label' => __('5'), | ||
], | ||
]; | ||
} | ||
} |
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,11 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> | ||
<default> | ||
<sidebar> | ||
<general> | ||
<enabled>1</enabled> | ||
<categorydepth>1</categorydepth> | ||
</general> | ||
</sidebar> | ||
</default> | ||
</config> |
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="Sebwite_Sidebar" setup_version="2.0.2"/> | ||
<module name="Sebwite_Sidebar" setup_version="2.0.3"/> | ||
</config> |
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,7 @@ | ||
var config = { | ||
map: { | ||
'*': { | ||
sidebarmodule: 'Sebwite_Sidebar/js/module' | ||
} | ||
} | ||
}; |
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
Oops, something went wrong.