question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Find a better heuristic for detecting a Magento 2.x store

See original GitHub issue

This issue is a:

  • Bug
  • Feature suggestion
  • Documentation issue
  • Other (Please Specify)

Environment

Question Answer
Magento version N/A
Browser + version N/A
node.js version (node -v) N/A
npm version (npm -v) N/A

Description

The code used to detect a Magento 2 store and show the tab in DevTools is not great. It checks for one of the following 3 classes:

  • page-layout-1column,
  • page-layout-2columns-left,
  • page-layout-checkout

I’m sure there are pages this breaks on, so we should find a better way.

Requirements:

  • Should work on the large majority of Magento 2.x stores
  • Should not require installing any additional modules

Expected result:

A more stable implementation of the isMagento2Store function.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DrewMLcommented, Dec 23, 2018

Heh, turns out that wasn’t quite enough. Hopefully the newest variant works:

https://github.com/magento/m2-devtools/blob/a68c24acd1a5b2348d17821f568abefaeafc5e49/extension/devtools.js#L37-L44

1reaction
Vinaicommented, Dec 12, 2018

A guest that only visits pages served from the FPC will not have a cookie. Not sure if that is a relevant scenario for collecting the data for the bundling config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

11+ Best Magento Search Extensions to Enhance User ...
Choose the best Magento search extensions to give your customers an enhanced search functionality. The more they search the better sales you ...
Read more >
spam - regex / heuristic to detect repetitive words e.g. "gfgfgfgf ...
Above method detects repetitions from neighboring words, as well, and limits creative ("valid") words, which is not a desirable effect. Examples ...
Read more >
How to emulator Store View by Store ID Magento 2.x
You can use emulation as per store view using store id as below /** * \Magento\Store\Model\App\Emulation */ protected $emulation; ...
Read more >
How to protect your Magento Store from hackers - Polcode
Read on to find a few relatively simple steps that will protect your Magento 2 store from attackers. Use the best server.
Read more >
Guide to Supporting Multiple Magento Stores (for Magento 2.x)
Overview If you have a single Magento 2 server that hosts more than one store, you have two options as you get setup...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found