سؤال

Magento ver. 2.2.7

Template: Techno Themevast: https://themeforest.net/item/techno-store-electronic-magento-2-theme/22239747

In developer mode everything was working. I switched to production and it worked. After I switched back to developer I get error on front.

I have used this to switch:

rm -rf /generated/code/*
bin/magento deploy:mode:set production
bin/magento cache:flush

And after that got this in frontend:

    1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'remove': This element is not expected.
Line: 797


Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'remove': This element is not expected.
Line: 797

#0 /{magento_root}/vendor/magento/framework/Config/Dom.php(115): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...')
#1 /{magento_root}/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Config\Dom->__construct('<layout xmlns:x...', Object(Magento\Framework\App\Arguments\ValidationState), Array, NULL, '/usr/www/users/...', '%message%\nLine:...')
#2 /{magento_root}/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#3 /{magento_root}/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#4 /{magento_root}/vendor/magento/framework/Config/DomFactory.php(42): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#5 /{magento_root}/vendor/magento/framework/View/Model/Layout/Update/Validator.php(141): Magento\Framework\Config\DomFactory->createDom(Array)
#6 /{magento_root}/vendor/magento/framework/View/Model/Layout/Merge.php(464): Magento\Framework\View\Model\Layout\Update\Validator->isValid('<layout xmlns:x...', 'layout_merged', false)
#7 /{magento_root}/vendor/magento/framework/View/Model/Layout/Merge.php(445): Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout('LAYOUT_frontend...', '<body>\n   <refe...')
#8 /{magento_root}/generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php(193): Magento\Framework\View\Model\Layout\Merge->load(Array)
#9 /{magento_root}/vendor/magento/framework/View/Layout/Builder.php(86): Magento\Framework\View\Model\Layout\Merge\Interceptor->load()
#10 /{magento_root}/vendor/magento/framework/View/Layout/Builder.php(63): Magento\Framework\View\Layout\Builder->loadLayoutUpdates()
#11 /{magento_root}/vendor/magento/framework/View/Layout.php(253): Magento\Framework\View\Layout\Builder->build()
#12 /{magento_root}/vendor/magento/framework/View/Layout.php(875): Magento\Framework\View\Layout->build()
#13 /{magento_root}/generated/code/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('page_content_he...')
#14 /{magento_root}/vendor/magento/module-cms/Helper/Page.php(171): Magento\Framework\View\Layout\Interceptor->getBlock('page_content_he...')
#15 /{magento_root}/vendor/magento/module-cms/Controller/Page/View.php(36): Magento\Cms\Helper\Page->prepareResultPage(Object(Magento\Cms\Controller\Page\View\Interceptor), '21')
#16 /{magento_root}/generated/code/Magento/Cms/Controller/Page/View/Interceptor.php(24): Magento\Cms\Controller\Page\View->execute()
#17 /{magento_root}/vendor/magento/framework/App/Action/Action.php(107): Magento\Cms\Controller\Page\View\Interceptor->execute()
#18 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Page\View\Interceptor->___callParent('dispatch', Array)
#20 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Page\View\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#21 /{magento_root}/generated/code/Magento/Cms/Controller/Page/View/Interceptor.php(39): Magento\Cms\Controller\Page\View\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /{magento_root}/vendor/magento/framework/App/FrontController.php(55): Magento\Cms\Controller\Page\View\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#25 /{magento_root}/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#26 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#27 /{magento_root}/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#28 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#29 /{magento_root}/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#30 /{magento_root}/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#31 /{magento_root}/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#32 /{magento_root}/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#33 /{magento_root}/vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http\Interceptor->launch()
#34 /{magento_root}/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#35 {main}

There were no changes in xml that I can think of.

I have tried with these commands:

/usr/bin/php71 bin/magento setup:di:compile
/usr/bin/php71 bin/magento setup:static-content:deploy hr_HR
/usr/bin/php71 bin/magento setup:static-content:deploy
/usr/bin/php71 bin/magento cache:flush

Also my admin is not returning:

Sorry, you need permissions to view this content."


UPDATE: I have run Find in all files under public_html/app for <remove and got this as result:

menu-layout.js
public_html/app/code/Themevast/MegaMenu/view/adminhtml/web/js/menu-layout.js
1032 for(var i=0; i<removeNum; i++){

menu.xml
public_html/app/code/Wyomind/MassProductImport/etc/adminhtml/menu.xml
12 <remove id="Wyomind_MassStockUpdate::profiles"/>

default.xml
public_html/app/design/frontend/tv_themevast_package/default/Magento_Newsletter/layout/default.xml
36 <remove name="subscribe"/>

I have commented out line 36 in default.xml and after that flushed cache - it didn't help, then I redeployed static and flushed cache - still no change.

Any other suggestions?


2nd UPDATE:

I have searched for "remove=" lookgin for something like <container remove=""> and found one file from template that has:

<container name="columns.top" remove="true" />

I have removed attribute remove="true" from element <container> and flushed cache. After that shop loaded but with broken static. I have tried recompiling, deploying static and so on but it didn't help. Also it loaded for a very long time.


3rd UPDATE: Broken static was due to change from production -> developer. I had to change static signing of files in database.

هل كانت مفيدة؟

المحلول 2

Finally, I have managed to solve that problem. I have updated the question and in the 2nd update is the answer:

I have searched for remove= looking for something like <container remove=""> and found one file from the template that has:

<container name="columns.top" remove="true" />

I have removed attribute remove="true" from element and flushed cache. After that shop loaded but with broken static.

I hope it helps to someone else :)

نصائح أخرى

Find "<remove" this sting in your app folder.

you will find like below code:

<remove name="product.info.price"/>

remove this, its alternative, you need to add remove="true" attribute in block tag.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top