elgentos / LargeConfigProducts

Large Configurable Products workaround for Magento 2
91 stars 29 forks source link

Invalid template file when viewing product #9

Closed steelnavel closed 6 years ago

steelnavel commented 6 years ago

I'm getting the following error after installing LargeConfigProducts. I have Redis installed and running. This happens when I view any configurable product on the front end.

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Elgentos_LargeConfigProducts::product/view/renderer.phtml' in module: 'Elgentos_LargeConfigProducts' block's name: 'product.info.options.swatches'
steelnavel commented 6 years ago

Any thoughts on how I can fix this?

peterjaap commented 6 years ago

What did you try? There's not much info for me to go on..

steelnavel commented 6 years ago

I don't really understand what the error means. I'm new to Magento and haven't done any front-end programming yet. I tried clearing the cache and reindexing. And file permissions seem right. This happens on products from the Magento sample data so it's not the product info. Other solutions for this error all mention reference for: "Elgentos_LargeConfigProducts::product/view/renderer.phtm", but this looks correct and matches my folder of app/code/Elgentos/LargeConfigProducts.

steelnavel commented 6 years ago

Any clues as to what I could look at would be amazing! Thanks! Here's the entire trace of the error:

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Elgentos_LargeConfigProducts::product/view/renderer.phtml' in module: 'Elgentos_LargeConfigProducts' block's name: 'product.info.options.swatches'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Elgentos_LargeConfigProducts::product/view/renderer.phtml' in module: 'Elgentos_LargeConfigProducts' block's name: 'product.info.options.swatches'
#0 /var/www/html/magento2/generated/code/Elgentos/LargeConfigProducts/Block/Product/Renderer/Configurable/Interceptor.php(596): Magento\Framework\View\Element\Template->fetchView(false)
#1 /var/www/html/magento2/vendor/magento/framework/View/Element/Template.php(300): Elgentos\LargeConfigProducts\Block\Product\Renderer\Configurable\Interceptor->fetchView(false)
#2 /var/www/html/magento2/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(447): Magento\Framework\View\Element\Template->_toHtml()
#3 /var/www/html/magento2/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(425): Magento\Swatches\Block\Product\Renderer\Configurable->getHtmlOutput()
#4 /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Swatches\Block\Product\Renderer\Configurable->_toHtml()
#5 /var/www/html/magento2/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(415): Magento\Framework\View\Element\AbstractBlock->toHtml()
#6 /var/www/html/magento2/generated/code/Elgentos/LargeConfigProducts/Block/Product/Renderer/Configurable/Interceptor.php(89): Magento\Swatches\Block\Product\Renderer\Configurable->toHtml()
#7 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(558): Elgentos\LargeConfigProducts\Block\Product\Renderer\Configurable\Interceptor->toHtml()
#8 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(534): Magento\Framework\View\Layout->_renderBlock('product.info.op...')
#9 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('product.info.op...')
#10 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info.op...')
#11 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('product.info.op...', true)
#12 /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(511): Magento\Framework\View\Layout\Interceptor->renderElement('product.info.op...', true)
#13 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(778): Magento\Framework\View\Element\AbstractBlock->getChildHtml('', true)
#14 /var/www/html/magento2/vendor/magento/module-catalog/view/frontend/templates/product/view/options/wrapper.phtml(15): Magento\Catalog\Block\Product\View\Interceptor->getChildHtml('', true)
#15 /var/www/html/magento2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/html/m...')
#16 /var/www/html/magento2/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Product\View\Interceptor), '/var/www/html/m...', Array)
#17 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(544): Magento\Framework\View\Element\Template->fetchView('/var/www/html/m...')
#18 /var/www/html/magento2/vendor/magento/framework/View/Element/Template.php(300): Magento\Catalog\Block\Product\View\Interceptor->fetchView('/var/www/html/m...')
#19 /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Framework\View\Element\Template->_toHtml()
#20 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(869): Magento\Framework\View\Element\AbstractBlock->toHtml()
#21 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(558): Magento\Catalog\Block\Product\View\Interceptor->toHtml()
#22 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(534): Magento\Framework\View\Layout->_renderBlock('product.info.op...')
#23 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('product.info.op...')
#24 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info.op...')
#25 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('product.info.op...', true)
#26 /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(542): Magento\Framework\View\Layout\Interceptor->renderElement('product.info.op...', true)
#27 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(791): Magento\Framework\View\Element\AbstractBlock->getChildChildHtml('options_contain...', '', true)
#28 /var/www/html/magento2/vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml(36): Magento\Catalog\Block\Product\View\Interceptor->getChildChildHtml('options_contain...')
#29 /var/www/html/magento2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/html/m...')
#30 /var/www/html/magento2/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Product\View\Interceptor), '/var/www/html/m...', Array)
#31 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(544): Magento\Framework\View\Element\Template->fetchView('/var/www/html/m...')
#32 /var/www/html/magento2/vendor/magento/framework/View/Element/Template.php(300): Magento\Catalog\Block\Product\View\Interceptor->fetchView('/var/www/html/m...')
#33 /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Framework\View\Element\Template->_toHtml()
#34 /var/www/html/magento2/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(869): Magento\Framework\View\Element\AbstractBlock->toHtml()
#35 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(558): Magento\Catalog\Block\Product\View\Interceptor->toHtml()
#36 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(534): Magento\Framework\View\Layout->_renderBlock('product.info')
#37 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('product.info')
#38 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info')
#39 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('product.info', true)
#40 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('product.info')
#41 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('product.info.ma...')
#42 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('product.info.ma...')
#43 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info.ma...')
#44 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('product.info.ma...', true)
#45 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('product.info.ma...')
#46 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('content')
#47 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('content')
#48 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content')
#49 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('content', true)
#50 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('content')
#51 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('main')
#52 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main')
#53 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main')
#54 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main', true)
#55 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('main')
#56 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('columns')
#57 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('columns')
#58 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns')
#59 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('columns', true)
#60 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('columns')
#61 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('main.content')
#62 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main.content')
#63 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content')
#64 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main.content', true)
#65 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('main.content')
#66 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#67 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#68 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#69 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#70 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#71 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('root')
#72 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#73 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#74 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#75 /var/www/html/magento2/vendor/magento/framework/View/Layout.php(954): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#76 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput()
#77 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', Array)
#78 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}()
#79 /var/www/html/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(494): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array)
#80 /var/www/html/magento2/vendor/magento/framework/View/Result/Page.php(257): Magento\Framework\View\Layout\Interceptor->getOutput()
#81 /var/www/html/magento2/vendor/magento/framework/View/Result/Layout.php(170): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#82 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#83 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#84 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#85 /var/www/html/magento2/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#86 /var/www/html/magento2/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#87 /var/www/html/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#88 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#89 /var/www/html/magento2/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#90 {main}`
steelnavel commented 6 years ago

Someone on the magento forums suggested changing the first view in the template path to lower case. I did that and then a configurable product loads but displays: "Please wait, loading product options.."

I checked redis with the redis-cli monitor command and redis is working when I load magento pages.

Also, when changing view to lower case the admin page no longer works.

Any ideas?

peterjaap commented 6 years ago

@steelnavel which 'View' did you change to lowercase version? I can't seem to find an instance with a capital V? Do you have a link to the code in this repo?

When it shows 'Please wait, loading product options' an XHR call should have happened. If you open your browser console and check the network tab and filter on XHR, do you see it? It should be to /lcp/fetch......

steelnavel commented 6 years ago

Thanks for your reply Peter! The upper case View was in the zip download.

Now I have completely removed the extension and installed via composer instead.

Now the admin area works. I can open the configurable product.

On the front end, I still get: "Please wait, loading product options.."

In the Chrome console, network tab, filtered for XHR, I do not see /lcp/fetch

However, when I run the redis-cli monitor command on the server CLI, I see the following when I refresh a configurable product page:

1530041860.470288 [0 127.0.0.1:60712] "select" "1" 1530041860.473101 [0 127.0.0.1:60714] "hget" "zc:k:ea6_INTERCEPTION" "d" 1530041860.474948 [0 127.0.0.1:60714] "hget" "zc:k:ea6_RESOLVED_STORES_D1BEFA03C79CA0B84ECC488DEA96BC68" "d" 1530041860.475285 [0 127.0.0.1:60714] "hget" "zc:k:ea6_GLOBAL__RESOURCESCACHE" "d" 1530041860.521207 [0 127.0.0.1:60714] "hget" "zc:k:ea6_SYSTEM_STORES_DEFAULT" "d" 1530041860.522649 [0 127.0.0.1:60714] "hget" "zc:k:ea6_SYSTEM_DEFAULT" "d" 1530041860.524404 [0 127.0.0.1:60714] "hget" "zc:k:ea6_GLOBAL_FRONTEND_PLUGIN_LIST" "d" 1530041860.525839 [1 127.0.0.1:60712] "hget" "zc:k:ea6_F1B2F31085198A7F2B951C1E978381A82A6FC92A" "d" 1530041860.526700 [0 127.0.0.1:60714] "hget" "zc:k:ea6_GLOBAL__EVENT_CONFIG_CACHE" "d" 1530041860.527171 [0 127.0.0.1:60714] "hget" "zc:k:ea6_FRONTEND__EVENT_CONFIG_CACHE" "d" 1530041879.784272 [0 127.0.0.1:60720] "select" "1" 1530041879.787109 [0 127.0.0.1:60722] "hget" "zc:k:ea6_INTERCEPTION" "d" 1530041879.788959 [0 127.0.0.1:60722] "hget" "zc:k:ea6_RESOLVED_STORES_D1BEFA03C79CA0B84ECC488DEA96BC68" "d" 1530041879.789297 [0 127.0.0.1:60722] "hget" "zc:k:ea6_GLOBAL__RESOURCESCACHE" "d" 1530041879.853782 [0 127.0.0.1:60722] "hget" "zc:k:ea6_SYSTEM_STORES_DEFAULT" "d" 1530041879.855353 [0 127.0.0.1:60722] "hget" "zc:k:ea6_SYSTEM_DEFAULT" "d" 1530041879.857152 [0 127.0.0.1:60722] "hget" "zc:k:ea6_GLOBAL_FRONTEND_PLUGIN_LIST" "d" 1530041879.858573 [1 127.0.0.1:60720] "hget" "zc:k:ea6_F1B2F31085198A7F2B951C1E978381A82A6FC92A" "d" 1530041879.859441 [0 127.0.0.1:60722] "hget" "zc:k:ea6_GLOBAL__EVENT_CONFIG_CACHE" "d" 1530041879.859932 [0 127.0.0.1:60722] "hget" "zc:k:ea6_FRONTEND__EVENT_CONFIG_CACHE" "d" So, it seems like at least Magento is talking to redis if not the extension.

steelnavel commented 6 years ago

I solved the issue with the view folder. You have both a View and view folder at the same level. When I extracted them on my windows computer it combined them into one folder called View. From then on I never had a correct installation.

Now I just need to figure out why the /lcp/fetch isn't working

peterjaap commented 6 years ago

Well the ajax call to lcp/fetch is in both mixins;

https://github.com/elgentos/LargeConfigProducts/blob/7f0455c94d461c7a6e4573eee79c9215dbcf1546/view/frontend/web/js/swatch-renderer-mixin.js#L16 https://github.com/elgentos/LargeConfigProducts/blob/5d31505e851a42f662cffadb47d1b50c6efc1377/view/frontend/web/js/configurable-mixin.js#L13

So you could start by checking your network tab to see whether the mixins are loaded. If not, you might want to deploy your static content again.

steelnavel commented 6 years ago

Hi Peter,

I tried changing from developer mode to production and redeploying the static content. I'm still not seeing either of those mixins being loaded on the Network pane.

I am seeing a JavaScript error in the console:

VM2018:5 Uncaught SyntaxError: Unexpected token < in JSON at position 134 at JSON.parse (<anonymous>) at getNodeData (scripts.js:87) at Array.map (<anonymous>) at scripts.js:117 at HTMLDocument.apply (main.js:70) at fire (jquery.js:3232) at Object.add [as done] (jquery.js:3291) at jQuery.fn.init.jQuery.fn.ready (jquery.js:3542) at jQuery.fn.init (jquery.js:2967) at new jQuery.fn.init (jquery-migrate.js:225)

And this is the json in question:

"[data-role=swatch-options]": { "Magento_Swatches/js/swatch-renderer": { "jsonConfig": null<? /* @escapeNotVerified */ //echo $swatchOptions = $block->getJsonConfig() ?>,

I don't know if that helps or not. I'll keep investigating to figure out what I've done wrong.

John

peterjaap commented 6 years ago

@steelnavel the JSON contains raw PHP, that should be processed by then. Maybe there's a hint?

steelnavel commented 6 years ago

Hi Peter,

I've been working on this all day and still can't figure it out. When I disable LargeConfigProducts the configurable products (small ones) work fine. When I enable LargeConfigProducts I get that same error.

Looking at the data-role=swatch-options JSON, everything else is filled in except for the jsonConfig.

Does that mean your mixins are running?

I can see them in the static content here: /www/magento2/pub/static/frontend/Magento/luma/en_US/Elgentos_LargeConfigProducts/js

I'm at a loss at what else to look at. Any assistance you can provide would be appreciated.

John

peterjaap commented 6 years ago

If you open the mixin in the network panel, what content do you see there?

steelnavel commented 6 years ago

I don't see any of the three mixins in the Network panel.

I do see the contents of the LCP requirejs-config.js file in the Network panel:

http://test.steelnavel.com/magento2/pub/static/frontend/Magento/luma/en_US/requirejs-config.js

(function(require){
(function() {
var config = {
    config: {
        mixins: {
            'Magento_Swatches/js/swatch-renderer': {
                'Elgentos_LargeConfigProducts/js/swatch-renderer-mixin': true
            },
            'Magento_Swatches/js/configurable-customer-data': {
                'Elgentos_LargeConfigProducts/js/configurable-customer-data-mixin': true
            },
            'Magento_ConfigurableProduct/js/configurable': {
                'Elgentos_LargeConfigProducts/js/configurable-mixin': true
            }
        }
    }
};
require.config(config);
})();

In the product page source, these are the only js files listed:
<script  type="text/javascript"  src="http://test.steelnavel.com/magento2/pub/static/frontend/Magento/luma/en_US/requirejs/require.js"></script>
<script  type="text/javascript"  src="http://test.steelnavel.com/magento2/pub/static/frontend/Magento/luma/en_US/mage/requirejs/mixins.js"></script>
<script  type="text/javascript"  src="http://test.steelnavel.com/magento2/pub/static/frontend/Magento/luma/en_US/requirejs-config.js"></script>

In reading an Alan Storm article about RequireJS, it sounds like js isn't loaded until needed. But that still doesn't explain why the mixins are not executing.

peterjaap commented 6 years ago

I'd start by putting Magento at test.steelnavel.com instead of test.steelnavel.com/magento2/pub. That'll probably solve some if not all unexpected issues. Magento (and extensions) do not generally like being run in a subdirectory. And point your document root to <root>/index.php, not <root>/pub/index.php (see Alan's blog as well).

See it that solves your issues.

steelnavel commented 6 years ago

Thanks Peter

I'm going to try that.

steelnavel commented 6 years ago

Hi Peter,

I spent a few days creating a new Magento ver 2.2.5 server without the subdirectory. I installed LCP using composer.

The test product is here: http://test.steelnavel.com/silicone-heart-labret-retainer.html

The mixin files are still not executing. Nothing shows up in the Chrome Network tab. The console tab continues to show the failed json.

The prewarm command works fine with redis.

I'll leave the server up so you can take a look. I really appreciate your help. I can't see any way to move forward with Magento without using your extension.

peterjaap commented 6 years ago

Check your config.php; is Elgentos_LargeConfigProducts listed after or before Magento_Swatches & Magento_ConfigurableProduct ?

steelnavel commented 6 years ago

Hi Peter,

Thanks for this info. In config.php, Elgentos_LargeConfigProducts was before both Magento_Swatches and Magento_ConfigurableProduct.

I moved Elgentos_LargeConfigProducts to the end of the list and rebooted the server. It still didn't work.

Then I ran: php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex

Flushed cache storage Flushed Magento cache

And it still didn't work. It still is not running the mixin JS.

I really appreciate you continuing to look into this. I know it's a lot to ask for a free extension.

John

peterjaap commented 6 years ago

@steelnavel seems to be offline now?

peterjaap commented 6 years ago

I seem to be on track of the issue. I just upgraded our installation from 2.2.3 to 2.2.5 and I'm expericing the same issue. It does work however for products that use swatches. But for product that do not have swatches, the configurable.js (and thus its mixin) are not loaded anymore. It looks like Magento refactored how this works and moved the logic to another JS file.

peterjaap commented 6 years ago

On local development (in developer mode) it works fine. Problem arises when running in production mode (maybe als default mode). What mode are you running in?

peterjaap commented 6 years ago

@steelnavel are you by any chance using an extension that defers Javascript loading?

peterjaap commented 6 years ago

@steelnavel found it!!

It boils down to this bug; https://github.com/magento/magento2/issues/10559

I didn't dive too deeply into the root of the issue but a workaround is to copy

vendor/elgentos/largeconfigproducts/view/frontend/templates/product/view/renderer.phtml to app/design/frontend/{COMPANY}/{THEME}/Elgentos_LargeConfigProducts/templates/product/view/renderer.phtml

Please let me know if this works for you too.

steelnavel commented 6 years ago

Sadly, it still doesn't work. Tested in Chrome, Firefox, Edge and Safari

This was my first time working with a theme. This is what I did:

  1. Created: app/design/frontend/SteelNavel/default/registration.php

  2. Created: app/design/frontend/SteelNavel/default/theme.xml

  3. Copied: vendor/elgentos/largeconfigproducts/view/frontend/templates/product/view/renderer.phtml To: app/design/frontend/SteelNavel/default/Elgentos_LargeConfigProducts/templates/product/view/renderer.phtml

  4. Opened Magento Admin to register the theme. It now appears in Admin under Content/Themes

  5. I'm running in developer mode but I cleared the cache and refreshed the cache anyway.

I'll leave the server running so you can view the page here: http://test.steelnavel.com/silicone-heart-labret-retainer.html

peterjaap commented 6 years ago

Are you sure you're using the theme? Just registering is not enough, you also need to tell Magento to use it.

steelnavel commented 6 years ago

I was not using the theme.

I went to Content > Configuration and selected the new theme.

Tried all sorts of clearing cache, reindexing, deleting content of pub/static/frontend and var/view_preprocessed.

It's still not working.

steelnavel commented 6 years ago

Hi Peter, I'm leaving the server running over the weekend so you can take a look on Monday. I think you're 11 hours ahead of me here in Oregon.

This is the test product: http://test.steelnavel.com/silicone-heart-labret-retainer.html

steelnavel commented 6 years ago

Hi Peter,

Any other thoughts on this?

I would be willing to pay you or someone on your staff to make this work. Like I said, I can't migrate to Magento without this working.

John

peterjaap commented 6 years ago

@steelnavel could you try removing <? /* @escapeNotVerified */ //echo $swatchOptions = $block->getJsonConfig() ?> part from view/frontend/templates/product/view/renderer.phtml?

For some reason, that PHP isn't processed correctly by your server. Seeing as its commented out, removing that part might fix the issue. You can see the problem here;

image

steelnavel commented 6 years ago

After removing that line from the renderer.phtml in the theme, and flushing the cache, the JSON error goes away, and now the product picture shows; however, the color swatches and other attributes, still don't appear. It still leaves the options spinner and "Please wait, loading product options.." where they should be.

I'm doing more research on mixins and why the three js files in requirejs-config.js are not getting called.

Anything else I should test?

peterjaap commented 6 years ago

I now see the mixin is loaded correctly;

image

But it seems it's not getting called for some reason. I don't see the code I referenced in the previous screenshot in this thread (the code in view/frontend/templates/product/view/renderer.phtml). That is the code that should trigger the ajax call to /lcp/fetch. Maybe you can look into why that file isn't being rendered anymore?

steelnavel commented 6 years ago

I do see the renderer.phtml being called in Commerce Bug 3. As you can see here:

image

I'll leave the site up in case you want to look at the page with the debug details: http://test.steelnavel.com/silicone-heart-labret-retainer.html

steelnavel commented 6 years ago

I'm actually turning the servers off for the weekend.
I'm going to take a different approach and see if I can fit my products into configurables with fewer than 1,000 simple products. I might try your extension later when I have more time. Thanks for all your help!

peterjaap commented 6 years ago

Closing this. In hindsight, this was probably the same issue as #11; no short-tags enabled.

muazamkhan commented 3 years ago

i try to write update code in magento 2 but error generate like this Error filtering template: Invalid template file: 'Sm_ListingTabs::staticOnSlider.phtml' in module: 'Sm_ListingTabs' block's name: 'listingtabs_0' Error filtering template: Invalid template file: 'Sm_Categories::home-category.phtml' in module: 'Sm_Categories' block's name: 'categories_0' Error filtering template: Invalid template file: 'Sm_ListingTabs::slider2HomePage.phtml' in module: 'Sm_ListingTabs' block's name: 'listingtabs_1'

muazamkhan commented 3 years ago

any one has solution please guide me

gaiterjones commented 3 years ago

@muazamkhan I guess you landed here after googling an error message. if "SM_ListingTabs" is a commercial module get in touch with the vendor for support, fortunately this module has nothing to do with _SMListingTabs :-)