magento2-store-locator-stockists-extension icon indicating copy to clipboard operation
magento2-store-locator-stockists-extension copied to clipboard

Magento Store Id not used when loading store markers

Open greg-42droids opened this issue 6 years ago • 1 comments

Stores are filtered based on which Magento Store they belong to within the "main.phtml" line 157 however, the "limesharp_stockists.js" doesn't filter the same way, displaying all stores even if they are not enabled for the current Magento Store.

I added the followings to enable marker filtering:

"main.phtml"

around line 214:

"limesharp_stockists": {
    // add the store id to the config js object so we can pick it up later
    "storeId" : "<?php echo $storeId; ?>",   

"limesharp_stockists.js" around line 19: var magentoStoreId = config.storeId;

around line 119:

// Split the store_id into an array
var magentoStoresEnabled = data.store_id.split(',');
// convert the magentoStoreId into a string so inArray works
magentoStoreId = magentoStoreId.toString();

// Wrap the markers config & .push into this IF statement
if(jQuery.inArray(magentoStoreId, magentoStoresEnabled) !== -1) {
...
}

I hope this helps @ClaudiuCreanga to track down the issue and apply a (potentially more elegant) fix. Many thanks for this module! It's awesome.

greg-42droids avatar Oct 09 '17 16:10 greg-42droids

Thanks. will apply on next release.

ClaudiuCreanga avatar Oct 13 '17 12:10 ClaudiuCreanga