motou/magento2-store-locator-stockists-extension

Magento Store Id not used when loading store markers

Opened this issue · 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.

Thanks. will apply on next release.