snowdogapps / magento2-menu Goto Github PK
View Code? Open in Web Editor NEWProvides powerful menu editor to replace category based menus in Magento 2
License: MIT License
Provides powerful menu editor to replace category based menus in Magento 2
License: MIT License
Attempting to drag to select text within Main Menu > Nodes section of the backend results in the entire node being moved instead -
the only way to change text is to click into the field
Steps to reproduce
Step: 1) Content>Main Menu> Nodes
Step: 2) Select any node & click the edit button
Step: 3) try to drag and select text in any of the fields
It would be nice add some icons to the tree inside admin panel and allow modify node type. Imho better use single "Add" button and select for node type instead of N "add" buttons.
Current readme is lacking detailed information how to set menu from start to finish and what should look menu once finished thus for developers not that experienced with magento 2 it's proven as a difficult task.
When using a product node it displays the full original image rather than a resized and optimised version.
Because the menu is on ever page the images are being loaded on every page and because they are the original images it is slowing the site down.
Is there a way to be able to choose an image role or specify a role so that images are optimised and resized?
Don't see this option now and I think it should be as then user doesn't need to remove something and later add as it can just disable node
First, I want to say thanks for building just the module I'd designed in my head a couple weeks ago. Now I only need to extend it where necessary! ๐
In Snowdog\Menu\Model\ResourceModel\NodeType\Category::fetchData
, the variable $eavColumnName
is used to determine from which column of url_rewrite
to select/filter results. However, even with the EE-only staging module installed, url_rewrite
continues to use entity_id
.
It looks like the issue also exists for Snowdog\Menu\Model\ResourceModel\NodeType\CmsPage::fetchData
.
If I create a pull request including modifications to those two classes to use the known column entity_id
, would that be an acceptable fix?
In 98aec10 category selection template was modified - same treatment is required for cms pages and cms blocks suggestion templates. (Also Category ID seems to be not displayed when autoselected, and "11 results are available, use up and down arrow keys to navigate." is not hiding after selection was made)
This module shouldn't have any styling or scripts on the storefront.
Also, templates should be as simple as possible, for example, icons should be removed.
We need to check our stores if this default JS logic is in use somewhere, before releasing this changes.
Internal ticket DEV-37926
The README says:
Menu editor is using Vue.js so you need to create a new vue component that has node type code as name in view/adminhtml/web/vue/menu-type and load it in view/adminhtml/templates/menu/nodes.phtml
I have created the template view/adminhtml/web/vue/menu-type/recommendation.vue
into my custom module. But what exactly does it mean to "load it in view/adminhtml/templates/menu/nodes.phtml
"?
Hi,
If we're trying to add/remove a node in the backend we get this js error: Uncaught TypeError: tree.get_json is not a function
.
Right now, we are not able to set a custom url node that would redirect to a third party page. It is caused by prepending store url in CustomUrl Block:
I would be nice to make it optional with enabled by default to keep the backward compatibility.
The module does not work when you have table prefixes like:
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.eav_attribute' doesn't exist, query was: SELECT a
.attribute_id
FROM eav_attribute
AS a
This should be:
databasename.eav_attribute => databasename.prefix_eav_attribute
Just few things, what we can add in new version:
227.1200
to 227,00 + currency symbol
The javascript in /master/view/frontend/web/js/navigation.babel.js must be compiled with babel before it can be used by "normal" browsers. This is incompatible with a vanilla Magento2 not using frontools.
Can you add a compiled version in the repository so that this module can be used directly on a plain Magento 2?
In multi language storeview setup, we need to define a menu for each storeview in order to translate Node Name. Only for CmsBlock type it is possible to use the "trans" directive inside the block it.
Do you think it would be possible to add a translation mechanism for Node Name to avoid maintaining n menu across all storeviews ?
Adding FK prevents database from collisions
The product image is not rendering anything even though the product does have an image associated to it.
Steps to reproduce:
menu/node_type/product.phtml
template to echo the included $productImage
variable.Expected result:
The product image URL should show up.
Actual result:
Nothing is outputted.
--
I found that the problem is the fetchImageData
function in Model/ResourceModel/NodeType/Product.php
not getting the thumbnail data even though it's being added as an attribute to select in the collection but I didn't get further than that.
Is there a way to import/export menus and nodes? Wondering what kind of deployment strategies there is when using this module. Can we load nodes from a file, put them under git versioning maybe?
"Adding new types of nodes" readme section refers to view/adminhtml/web/js/category.js
and view/adminhtml/templates/menu/node_type/category.phtml
but these files were removed.
Please update "Adding new types of nodes", because currently it's not clear how to add a new menu node
CMS Page Node renderer doesn't check if a URL for a particular page exists in pageUrls
array:
magento2-menu/Block/NodeType/CmsPage.php
Lines 151 to 168 in 1e53884
Apparently, such an event can happen because pageUrls
array is hydrated from url_rewrite
table data When a cms page doesn't have any URL rewrites for that store, then its URL is not included in the pageUrls
array.
magento2-menu/Model/ResourceModel/NodeType/CmsPage.php
Lines 58 to 71 in 1e53884
In result we're getting:
1 exception(s):
Exception #0 (Exception): Notice: Undefined offset: 3 in /var/www/magento/vendor/snowdog/module-menu/Block/NodeType/CmsPage.php on line 158
A solution would be to back fetched data up with identifier
from cms_page
joined with cms_page_store
Hey,
is it possible to implement a functionality to import categories including subcategories as nodes? Maybe even with specifying until which level you want to include subcategories. It would be really handy if you could import them in case you have a whole bunch of subcategories. Inserting all these nodes separately is lots of effort.
Hello!
First of all - thank you for free module for menu. I've trying to use Magento in headless mode (frontend based on VueJS). And current rest api miss something crucial things, like:
https://github.com/SnowdogApps/magento2-menu/blob/master/etc/webapi.xml#L9
url="/V1/menus/:identifier/nodes"
We have the following error with magento 2.3.2. But only one menu is displaying it:
This is the rule from the error:
<?php echo $block->renderSubmenu( $children, $node, $childrenLevel ); ?>
1 exception(s):
Exception #0 (Magento\Framework\Exception\AlreadyExistsException): Current connection is already holding lock for accept|BLOCK_79bac44278fe12844bd3419033ef815d13099cf6, only single lock allowed
Exception #0 (Magento\Framework\Exception\AlreadyExistsException): Current connection is already holding lock for accept|BLOCK_79bac44278fe12844bd3419033ef815d13099cf6, only single lock allowed
<pre>#1 Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1130]
#2 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
#3 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor/snowdog/module-menu/Block/Menu.php:261]
#4 Snowdog\Menu\Block\Menu->renderSubmenu() called at [app/design/frontend/Wietzaadjes/default/Snowdog_Menu/templates/quick_links.phtml:18]
#5 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#6 Magento\Framework\View\TemplateEngine\Php->render() called at [vendor/magento/framework/View/Element/Template.php:271]
#7 Magento\Framework\View\Element\Template->fetchView() called at [vendor/magento/framework/View/Element/Template.php:301]
#8 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
#9 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor/magento/framework/Cache/LockGuardedCacheLoader.php:79]
#10 Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1130]
#11 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
#12 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
#13 Magento\Framework\View\Layout->_renderBlock() called at [vendor/magento/framework/View/Layout.php:533]
#14 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#15 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:488]
#16 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#17 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:585]
#18 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:535]
#19 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#20 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:488]
#21 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#22 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:585]
#23 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:535]
#24 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#25 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:488]
#26 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#27 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:585]
#28 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:535]
#29 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#30 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:488]
#31 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#32 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:954]
#33 Magento\Framework\View\Layout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#34 Magento\Framework\View\Layout\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#35 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#36 Magento\Framework\View\Layout\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:494]
#37 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
#38 Magento\Framework\View\Result\Page->render() called at [vendor/magento/framework/View/Result/Layout.php:171]
#39 Magento\Framework\View\Result\Layout->renderResult() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#40 Magento\Framework\View\Result\Page\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#41 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [app/code/Aheadworks/Layerednav/Model/Plugin/Result.php:93]
#42 Aheadworks\Layerednav\Model\Plugin\Result->aroundRenderResult() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#43 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#44 Magento\Framework\View\Result\Page\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:130]
#45 Magento\Framework\View\Result\Page\Interceptor->renderResult() called at [vendor/magento/framework/App/Http.php:141]
#46 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#47 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:40]
</pre>
It would be great if we could set specific template for every node item and its submenu template if it has children
<li class="list__item <?= $itemClasses; ?>">
<?= $block->renderMenuNode($node); ?>
<?= $block->renderSubmenu($children, $node, $childrenLevel); ?>
</li>
I think we should pass extra argument $template,
in renderMenuNode()
as second argument (be default it would use default template depending on the node type).
in renderSubmenu()
as fourth argument (by default it would use default template sub_menu.phtml)
The best if we could select or set the path or name of template in admin panel in node setting. if template not found then use default.
Why this feature?
sometimes menu structure and styling is different for different section (submenu). Now sometimes it requires adding extra logic in templates or/and classes in admin panel or code in css. Having possibility to have custom templates for nodes and submenu we can create more clean templates with specific classes and achieve really different look and structure if required.
It would be useful if we have one menu and structure like that:
Main-menu
--- Section A
(submenu template A: menu/sub_menu_section-a.phtml
)
--- item A.1 (node custom_url, custom template: menu/node_type/custom_url-section-a.phtml
--- itd . A.2 (node custom_url, default template: menu/node_type/custom_url.phtml
--- (submenu default template: menu/sub_menu.phtml
--- Section B
(submenu template B: menu/sub_menu_section-b.phtml
)
--- item B.1 (node X, template: default or set via admin panel)
Magento Team added PHP7 support to code generation here magento/magento2#6106 but it's still on the develop branch only.
We should remove all PHP7 type hints from module code.
It might work same way as in the Banana module for M1, where we can add menu ID to the name of the template
Even better will be to base it on folders i.e for ID menu-mobile
we would like to overwrite templates as /Snowdog_Menu/templates/menu-mobile/menu.phtml
and /Snowdog_Menu/templates/menu-mobile/menu/node_type/category.phtml
internal ticket: 32516
From time to time while adding/editing items in the menu, randomly, this error pop up https://i.imgur.com/UUfzdjN.png.
The error makes the menu disappear on the front and there are some empty items in the admin https://i.imgur.com/xch0sDu.png.
The problem persist on M2.2.4 / M2.3. Windows / Linux too.
Changing from dev to production gives the following error:
PHP Fatal error: Declaration of Snowdog\Menu\Block\NodeType\AbstractNode::getHtml() must be compatible with Snowdog\Menu\Api\NodeTypeInterface::getHtml(Snowdog\Menu\Api\int $nodeId, Snowdog\Menu\Api\int $level) in /home/user/public_html/app/code/Snowdog/Menu/Block/NodeType/AbstractNode.php on line 20
I get the following errors when trying to create a new menu in Magento 2.2 EE:
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause', query was: SELECT `e`.`entity_id`, `e`.`parent_id`, `v`.`value` AS `name` FROM `catalog_category_entity` AS `e`
INNER JOIN `catalog_category_entity_varchar` AS `v` ON v.entity_id = e.entity_id AND v.store_id = 0
AND v.attribute_id = 45 WHERE (e.level > 0) AND (e.created_in <= 1) AND (e.updated_in > 1) ORDER BY `e`.`level` ASC, `e`.`position` ASC
Exception #1 (PDOException): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause'
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause', query was: SELECT `e`.`entity_id`, `e`.`parent_id`, `v`.`value` AS `name` FROM `catalog_category_entity` AS `e`
INNER JOIN `catalog_category_entity_varchar` AS `v` ON v.entity_id = e.entity_id AND v.store_id = 0
AND v.attribute_id = 45 WHERE (e.level > 0) AND (e.created_in <= 1) AND (e.updated_in > 1) ORDER BY `e`.`level` ASC, `e`.`position` ASC
Is this due to catalog_category_entity_varchar. entity_id being replaced by row_id in EE?
I can't get in to the Snowdog Menu settings for a menu I created after updating to 2.3.0. I'm using M2EE and getting the following error:
2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause', query was: SELECT `e`.`entity_id`, `e`.`parent_id`, `v`.`value` AS `name` FROM `catalog_category_entity` AS `e`
INNER JOIN `catalog_category_entity_varchar` AS `v` ON v.entity_id = e.entity_id AND v.store_id = 0
AND v.attribute_id = 41 WHERE (e.level > 0) AND (e.created_in <= 1) AND (e.updated_in > 1) ORDER BY `e`.`level` ASC, `e`.`position` ASC
Exception #1 (PDOException): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause'
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.entity_id' in 'on clause', query was: SELECT `e`.`entity_id`, `e`.`parent_id`, `v`.`value` AS `name` FROM `catalog_category_entity` AS `e`
INNER JOIN `catalog_category_entity_varchar` AS `v` ON v.entity_id = e.entity_id AND v.store_id = 0
AND v.attribute_id = 41 WHERE (e.level > 0) AND (e.created_in <= 1) AND (e.updated_in > 1) ORDER BY `e`.`level` ASC, `e`.`position` ASC
For the second time I ran into a case where I would need to access category data in the template (menu/node_type/category.phtml
).
I can get for example category URL with getCategoryUrl()
, but I'm not able to get the category object itself.
Would it be OK to expose the category e.g. with \Snowdog\Menu\Block\NodeType\Category::getCategory()
?
Or perhaps it could even be called getEntity()
so the same method could be implemented also for Product, CmsPage and CmsBlock node types?
Can the extension be updated to be compatible with Magento 2.2? actually there are only RC versions for this release but soon will be published so I guess it worth to make it compatible
Every time a Menu is saved the Nodes in that menu are deleted and Recreated
$existingNodes
array rather than a regex pattern it will never matchI've attempted to use the extension, but it does not display properly. I'm thinking it's due to the theme being used.
What CSS does this extension expect to have it display properly?
I'm wondering if it would be worth adding a "products" node? It seems like a common use case to be able to link to specific products in the menu.
In my case I've used this before to display "featured products" in the menu, so it wouldn't just show the name but maybe the product image and price as well.
I think it could work exactly like the category node but pull through the product list instead.
Hello, I just installed your extension on my website. I see my menu in my backend.
But the menu isn't display in my frontend. I've copied and pasted your code (with the same identifier for the menu). The menu is appearing without any css in the page, it's only display outside store.menu.
I.E : I can display in page.wrapper, I've menu and submenu but no css and not in the right place
And I have this error in my console : /fr_FR/images/icon-sprite.svg 404 (Not Found) (I have a custom theme)
<?php /** @var \Snowdog\Menu\Block\NodeType\Category $block */ ?>
$class = $block->getMenuClass();
I can call getMenuClass
but there is no method getNodeClasses
, so node css classes attribute looks like useless.
$block->getMenu()
method shouldn't return object if given menu doesn't exist, I'd expect false
or null
.
<?php if ($block->getMenu()): ?>
<!-- Menu content -->
<?php endif; ?>
A different option will be to create a method that we can use in templates, to check if menu exists before rendering any HTML, for example:
<?php if ($block->isMenu()): ?>
<!-- Menu content -->
<?php endif; ?>
Internal ticket #37116
With Snowdog Menu 2.4.0 there is an option for Target Node Blank, which I assume adds target="_blank"
to a link in the menu. I have checked this option, but it seems to not save anything as when the page refreshes, the option is blank again and after a bin/magento setup:upgrade
the database doesn't seem to have anywhere to hold the field.
Issue when you have different websites/stores with different content, but the same url/identifier. It is only possible to choose the latest one.
It will be useful to have hints after typed product id (maybe after 3+ chars will be safer)
And also did you think about add SKU instead of ID's? or both?
Hi,
I am using your extension which works fine in desktop but in mobile view when I click on subcategory link it redirects to an example.com/undefined
Please check given video for more information.
https://www.screencast.com/t/4QxtVtXPZykF
Please help on this asap.
Thanks,
Currently while adding new nodes, scope / focus is immediately changed to a newly created node, which makes adding many nodes, on the same level, kinda frustrating.
This will simplify customization process by saving a lot of time wasted for opening over and over same menu instance.
Internal ticket #37117
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.