diff --git a/app/code/RicoNeitzel/VertNav/Block/Navigation.php b/app/code/RicoNeitzel/VertNav/Block/Navigation.php index 0a08c3437d..b01a2308ae 100644 --- a/app/code/RicoNeitzel/VertNav/Block/Navigation.php +++ b/app/code/RicoNeitzel/VertNav/Block/Navigation.php @@ -18,7 +18,7 @@ * @copyright Copyright (c) 2011 Vinai Kopp http://netzarbeiter.com/ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +namespace RicoNeitzel\VertNav\Block; /** * Catalog vertical navigation @@ -27,7 +27,7 @@ * @package RicoNeitzel_VertNav * @author Vinai Kopp */ -class RicoNeitzel_VertNav_Block_Navigation extends \Magento\Catalog\Block\Navigation +class Navigation extends \Magento\Catalog\Block\Navigation { /** * @var \Magento\Customer\Model\Session @@ -100,10 +100,14 @@ public function __construct( public function getCacheKey() { $key = parent::getCacheKey(); + $customerGroupId = $this->_getCustomerGroupId(); - $productId = $this->_registry->registry('current_product') ? $this->_registry->registry('current_product')->getId() : 0; - $homePageId = $this->_getStoreConfigValue(\Magento\Cms\Helper\Page::XML_PATH_HOME_PAGE); - $cmsPageId = $this->getRequest()->getParam('page_id', $homePageId); + + /** @var \Magento\Catalog\Model\Product $currentProduct */ + $currentProduct = $this->_registry->registry('current_product'); + $productId = $currentProduct ? $currentProduct->getId() : 0; + $homePageId = $this->_getStoreConfigValue(\Magento\Cms\Helper\Page::XML_PATH_HOME_PAGE); + $cmsPageId = $this->getRequest()->getParam('page_id', $homePageId); return 'VERTNAV_' . $key . '_' . $customerGroupId . '_' . $productId . '_' . $cmsPageId; } @@ -429,12 +433,13 @@ public function getStoreCategories() } /** - * $childrenIdString is a comma seperated list of category IDs + * $childrenIdString is a comma separated list of category IDs * @return \Magento\Catalog\Model\Resource\Category\Collection */ protected function _getCategoryCollection() { $collection = $this->_categoryCollectionFactory->create(); + /* @var $collection \Magento\Catalog\Model\Resource\Category\Collection */ $collection->addAttributeToSelect('url_key') ->addAttributeToSelect('name') diff --git a/app/code/RicoNeitzel/VertNav/Block/Plugin/LoginCatalog.php b/app/code/RicoNeitzel/VertNav/Block/Plugin/LoginCatalog.php index f6fb279eb1..add966dc7f 100644 --- a/app/code/RicoNeitzel/VertNav/Block/Plugin/LoginCatalog.php +++ b/app/code/RicoNeitzel/VertNav/Block/Plugin/LoginCatalog.php @@ -19,13 +19,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace RicoNeitzel\VertNav\Block\Plugin; + /** * Plugin that provides compatibility with Netzarbeiter_LoginCatalog extension */ -class RicoNeitzel_VertNav_Block_Plugin_LoginCatalog +class LoginCatalog { /** - * @var \Magento\Framework\ObjectManager + * @var \Magento\Framework\App\ObjectManager */ protected $_objectManager; @@ -40,12 +42,12 @@ class RicoNeitzel_VertNav_Block_Plugin_LoginCatalog protected $_customerSession; /** - * @param \Magento\Framework\ObjectManager $objectManager + * @param \Magento\Framework\App\ObjectManager $objectManager * @param \Magento\Framework\Module\Manager $moduleManager * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( - \Magento\Framework\ObjectManager $objectManager, + \Magento\Framework\App\ObjectManager $objectManager, \Magento\Framework\Module\Manager $moduleManager, \Magento\Customer\Model\Session $customerSession ) { @@ -57,7 +59,7 @@ public function __construct( /** * Suppress rendering according to Netzarbeiter_LoginCatalog's business logic * - * @param RicoNeitzel_VertNav_Block_Navigation $subject + * @param \RicoNeitzel\VertNav\Block\Navigation $subject * @param callable $proceed * @param \Magento\Catalog\Model\Category $category * @param integer $level @@ -66,7 +68,7 @@ public function __construct( * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundDrawOpenCategoryItem( - RicoNeitzel_VertNav_Block_Navigation $subject, + \RicoNeitzel\VertNav\Block\Navigation $subject, \Closure $proceed, $category, $level = 0, @@ -84,7 +86,7 @@ public function aroundDrawOpenCategoryItem( */ protected function _isLoginCatalogInstalledAndActive() { - return $this->_moduleManager->isEnabled('Netzarbeiter_LoginCatalog'); + return $this->_moduleManager->isEnabled('Netzarbeiter\LoginCatalog'); } /** @@ -93,8 +95,8 @@ protected function _isLoginCatalogInstalledAndActive() */ protected function _loginCatalogHideCategories() { - /** @var Netzarbeiter_LoginCatalog_Helper_Data $loginCatalog */ - $loginCatalog = $this->_objectManager->get('Netzarbeiter_LoginCatalog_Helper_Data'); + /** @var \Netzarbeiter\LoginCatalog\Helper\Data $loginCatalog */ + $loginCatalog = $this->_objectManager->get('Netzarbeiter\LoginCatalog\Helper\Data'); return !$this->_customerSession->isLoggedIn() && $loginCatalog->moduleActive() && $loginCatalog->getConfig('hide_categories'); diff --git a/app/code/RicoNeitzel/VertNav/Model/System/Config/Source/Root.php b/app/code/RicoNeitzel/VertNav/Model/System/Config/Source/Root.php index 4e3f4b6542..afe8162147 100644 --- a/app/code/RicoNeitzel/VertNav/Model/System/Config/Source/Root.php +++ b/app/code/RicoNeitzel/VertNav/Model/System/Config/Source/Root.php @@ -19,8 +19,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class RicoNeitzel_VertNav_Model_System_Config_Source_Root - extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource +namespace RicoNeitzel\VertNav\Model\System\Config\Source; + +class Root extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { /** * @var \Magento\Catalog\Model\Resource\Category @@ -56,7 +57,7 @@ public function toOptionArray() ); $resource = $this->_categoryResource; $select = $resource->getReadConnection()->select()->reset() - ->from($resource->getTable('catalog_category_entity'), new Zend_Db_Expr('MAX(`level`)')); + ->from($resource->getTable('catalog_category_entity'), new \Zend_Db_Expr('MAX(`level`)')); $maxDepth = $resource->getReadConnection()->fetchOne($select); for ($i = 2; $i < $maxDepth; $i++) { $options[] = array( diff --git a/app/code/RicoNeitzel/VertNav/composer.json b/app/code/RicoNeitzel/VertNav/composer.json new file mode 100644 index 0000000000..d1524c3808 --- /dev/null +++ b/app/code/RicoNeitzel/VertNav/composer.json @@ -0,0 +1,39 @@ +{ + "name": "riconeitzel/vertical-navigation", + "type": "magento2-module", + "version": "0.42.0-beta1", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "homepage": "https://github.com/riconeitzel/VertNav", + "description": "Vertical Navigation with CSS Classes.", + "authors": [ + { + "name":"Rico Neitzel", + "email":"mail@riconeitzel.de" + }, + { + "name":"Vinai Kopp", + "email":"vinai@netzarbeiter.com" + } + ], + "require": { + "php": "~5.4.11|~5.5.0", + "magento/module-core": "0.42.0-beta1", + "magento/module-catalog": "0.42.0-beta1", + "magento/module-cms": "0.42.0-beta1", + "magento/module-customer": "0.42.0-beta1", + "magento/module-theme": "0.42.0-beta1", + "magento/framework": "0.42.0-beta1", + "magento/magento-composer-installer": "*" + }, + "extra": { + "map": [ + [ + "*", + "RicoNeitzel/VertNav" + ] + ] + } +} diff --git a/app/code/RicoNeitzel/VertNav/etc/adminhtml/system.xml b/app/code/RicoNeitzel/VertNav/etc/adminhtml/system.xml index 9ec073508c..7156893a7f 100644 --- a/app/code/RicoNeitzel/VertNav/etc/adminhtml/system.xml +++ b/app/code/RicoNeitzel/VertNav/etc/adminhtml/system.xml @@ -52,7 +52,7 @@ - RicoNeitzel_VertNav_Model_System_Config_Source_Root + RicoNeitzel\VertNav\Model\System\Config\Source\Root diff --git a/app/code/RicoNeitzel/VertNav/etc/module.xml b/app/code/RicoNeitzel/VertNav/etc/module.xml index 9da011ff7f..f1a02e6ced 100644 --- a/app/code/RicoNeitzel/VertNav/etc/module.xml +++ b/app/code/RicoNeitzel/VertNav/etc/module.xml @@ -20,9 +20,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ --> - - - + + + @@ -30,6 +30,6 @@ - + diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_default.xml b/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_default.xml index 19f475dc43..33deb95476 100644 --- a/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_default.xml +++ b/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_default.xml @@ -23,6 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_layered.xml b/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_layered.xml index 1772e7c007..dd25ab77e3 100644 --- a/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_layered.xml +++ b/app/code/RicoNeitzel/VertNav/view/frontend/layout/catalog_category_view_type_layered.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + category_filter diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/layout/customer_account.xml b/app/code/RicoNeitzel/VertNav/view/frontend/layout/customer_account.xml index d8beafce61..c24b53c751 100644 --- a/app/code/RicoNeitzel/VertNav/view/frontend/layout/customer_account.xml +++ b/app/code/RicoNeitzel/VertNav/view/frontend/layout/customer_account.xml @@ -23,6 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/layout/default.xml b/app/code/RicoNeitzel/VertNav/view/frontend/layout/default.xml index 9efe2e4f4f..f26f85053e 100644 --- a/app/code/RicoNeitzel/VertNav/view/frontend/layout/default.xml +++ b/app/code/RicoNeitzel/VertNav/view/frontend/layout/default.xml @@ -23,11 +23,11 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + - RicoNeitzel_VertNav::style.css + RicoNeitzel_VertNav::css/style.css @@ -39,6 +39,6 @@ - + diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/left.phtml b/app/code/RicoNeitzel/VertNav/view/frontend/templates/left.phtml similarity index 97% rename from app/code/RicoNeitzel/VertNav/view/frontend/left.phtml rename to app/code/RicoNeitzel/VertNav/view/frontend/templates/left.phtml index 1e5ef40275..206e4d4b25 100644 --- a/app/code/RicoNeitzel/VertNav/view/frontend/left.phtml +++ b/app/code/RicoNeitzel/VertNav/view/frontend/templates/left.phtml @@ -31,6 +31,8 @@ * @see RicoNeitzel_VertNav_Block_Navgation * @see Mage_Catalog_Block_Navigation */ + +/** @var \Magento\Catalog\Model\Category $_category */ ?>
diff --git a/app/code/RicoNeitzel/VertNav/view/frontend/style.css b/app/code/RicoNeitzel/VertNav/view/frontend/web/css/style.css similarity index 100% rename from app/code/RicoNeitzel/VertNav/view/frontend/style.css rename to app/code/RicoNeitzel/VertNav/view/frontend/web/css/style.css