motou / magento2-store-locator-stockists-extension

Stockists store locator extension for magento2 using google maps
MIT License
67 stars 44 forks source link

Magento Store Id not used when loading store markers #21

Open greg-42droids opened 7 years ago

greg-42droids commented 7 years ago

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.

ClaudiuCreanga commented 7 years ago

Thanks. will apply on next release.