Rest-Api

Das Modul bietet eine Web-Rest-Schnittstelle, um Store-Daten für den Country-Language-Selector zu ermitteln und auszugeben.

Rest-Api-Call

Request:

https://www.domain.tld/rest/V1/td-country-language-selector/getStoreData

Response:

[
    {
        "region": "Europe",
        "countries": {
            "Germany": {
                "storeViewCountryMapping": "Germany",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "de_DE",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_DE/",
                        "pageUrl": "https://magento244commerce.test/de_DE/",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "German"
                    }
                ]
            },
            "Italia": {
                "storeViewCountryMapping": "Italia",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "it_IT",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_IT/",
                        "pageUrl": "https://magento244commerce.test/it_IT/",
                        "sortOrder": 6,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            },
            "France": {
                "storeViewCountryMapping": "France",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "fr_FR",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_FR/",
                        "pageUrl": "https://magento244commerce.test/fr_FR/",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "French"
                    }
                ]
            },
            "Switzerland": {
                "storeViewCountryMapping": "Switzerland",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "de_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_CH/",
                        "pageUrl": "https://magento244commerce.test/de_CH/",
                        "sortOrder": 2,
                        "storeViewLanguageMapping": "German"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "fr_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_CH/",
                        "pageUrl": "https://magento244commerce.test/fr_CH/",
                        "sortOrder": 3,
                        "storeViewLanguageMapping": "French"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "it_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_CH/",
                        "pageUrl": "https://magento244commerce.test/it_CH/",
                        "sortOrder": 4,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            }
        }
    },
    {
        "region": "Asia",
        "countries": {
            "Japan": {
                "storeViewCountryMapping": "Japan",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "ja_JP",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/ja_JP/",
                        "pageUrl": "https://magento244commerce.test/ja_JP/",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "Japanese"
                    }
                ]
            }
        }
    },
    {
        "region": "North America",
        "countries": {
            "United States": {
                "storeViewCountryMapping": "United States",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "default",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/default/",
                        "pageUrl": "https://magento244commerce.test/",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "English"
                    }
                ]
            }
        }
    }
]

Ausgabe Produkt

Es können auch direkt Store-Informationen bzgl. eines Produktes ermittelt werden. Als Identifikation des Produkts wird die SKU verwendet.

Existiert ein Produkt in einem Store nicht (deaktiviert), dann wird die Basis-Homepage ermittelt

Request:

https://www.domain.tld/rest/V1/td-country-language-selector/getStoreData?entity=product&identifier=product_dynamic_1

Response:

[
    {
        "region": "Europe",
        "countries": {
            "Germany": {
                "storeViewCountryMapping": "Germany",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "de_DE",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_DE/",
                        "pageUrl": "https://magento244commerce.test/de_DE/simple-product-1.html",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "German"
                    }
                ]
            },
            "Italia": {
                "storeViewCountryMapping": "Italia",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "it_IT",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_IT/",
                        "pageUrl": "https://magento244commerce.test/it_IT/simple-product-1.html",
                        "sortOrder": 6,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            },
            "France": {
                "storeViewCountryMapping": "France",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "fr_FR",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_FR/",
                        "pageUrl": "https://magento244commerce.test/fr_FR/simple-product-1.html",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "French"
                    }
                ]
            },
            "Switzerland": {
                "storeViewCountryMapping": "Switzerland",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "de_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_CH/",
                        "pageUrl": "https://magento244commerce.test/de_CH/simple-product-1.html",
                        "sortOrder": 2,
                        "storeViewLanguageMapping": "German"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "fr_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_CH/",
                        "pageUrl": "https://magento244commerce.test/fr_CH/simple-product-1.html",
                        "sortOrder": 3,
                        "storeViewLanguageMapping": "French"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "it_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_CH/",
                        "pageUrl": "https://magento244commerce.test/it_CH/simple-product-1.html",
                        "sortOrder": 4,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            }
        }
    },
    {
        "region": "Asia",
        "countries": {
            "Japan": {
                "storeViewCountryMapping": "Japan",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "ja_JP",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/ja_JP/",
                        "pageUrl": "https://magento244commerce.test/ja_JP/simple-product-1.html",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "Japanese"
                    }
                ]
            }
        }
    },
    {
        "region": "North America",
        "countries": {
            "United States": {
                "storeViewCountryMapping": "United States",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "default",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/default/",
                        "pageUrl": "https://magento244commerce.test/default/simple-product-1.html",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "English"
                    }
                ]
            }
        }
    }
]

Ausgabe Kategorie

Es können auch direkt Store-Informationen bzgl. einer Kategorie ermittelt werden. Als Identifikation der Kategorie wird die ID verwendet.

Existiert eine Kategorie in einem Store nicht (deaktiviert), dann wird die Basis-Homepage ermittelt

Request:

https://www.domain.tld/rest/V1/td-country-language-selector/getStoreData?entity=category&identifier=category-2-1-1

Response:

[
    {
        "region": "Europe",
        "countries": {
            "Germany": {
                "storeViewCountryMapping": "Germany",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "de_DE",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_DE/",
                        "pageUrl": "https://magento244commerce.test/de_DE/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "German"
                    }
                ]
            },
            "Italia": {
                "storeViewCountryMapping": "Italia",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "it_IT",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_IT/",
                        "pageUrl": "https://magento244commerce.test/it_IT/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 6,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            },
            "France": {
                "storeViewCountryMapping": "France",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "fr_FR",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_FR/",
                        "pageUrl": "https://magento244commerce.test/fr_FR/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "French"
                    }
                ]
            },
            "Switzerland": {
                "storeViewCountryMapping": "Switzerland",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "de_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_CH/",
                        "pageUrl": "https://magento244commerce.test/de_CH/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 2,
                        "storeViewLanguageMapping": "German"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "fr_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_CH/",
                        "pageUrl": "https://magento244commerce.test/fr_CH/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 3,
                        "storeViewLanguageMapping": "French"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "it_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_CH/",
                        "pageUrl": "https://magento244commerce.test/it_CH/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 4,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            }
        }
    },
    {
        "region": "Asia",
        "countries": {
            "Japan": {
                "storeViewCountryMapping": "Japan",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "ja_JP",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/ja_JP/",
                        "pageUrl": "https://magento244commerce.test/ja_JP/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "Japanese"
                    }
                ]
            }
        }
    },
    {
        "region": "North America",
        "countries": {
            "United States": {
                "storeViewCountryMapping": "United States",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "default",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/default/",
                        "pageUrl": "https://magento244commerce.test/default/category-2/category-2-1/category-2-1-1.html",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "English"
                    }
                ]
            }
        }
    }
]

Ausgabe CMS-Seite

Es können auch direkt Store-Informationen bzgl. einer CMS-Seite ermittelt werden. Als Identifikation der CMS-Seite wird dir Identifier verwendet.

Existiert diese CMS-Seite in einem Store nicht (deaktiviert), dann wird die Basis-Homepage ermittelt

Request:

https://www.domain.tld/rest/V1/td-country-language-selector/getStoreData?entity=cms&identifier=enable-cookies

Response:

[
    {
        "region": "Europe",
        "countries": {
            "Germany": {
                "storeViewCountryMapping": "Germany",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "de_DE",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_DE/",
                        "pageUrl": "https://magento244commerce.test/de_DE/enable-cookies",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "German"
                    }
                ]
            },
            "Italia": {
                "storeViewCountryMapping": "Italia",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "it_IT",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_IT/",
                        "pageUrl": "https://magento244commerce.test/it_IT/enable-cookies",
                        "sortOrder": 6,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            },
            "France": {
                "storeViewCountryMapping": "France",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "fr_FR",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_FR/",
                        "pageUrl": "https://magento244commerce.test/fr_FR/enable-cookies",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "French"
                    }
                ]
            },
            "Switzerland": {
                "storeViewCountryMapping": "Switzerland",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "de_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/de_CH/",
                        "pageUrl": "https://magento244commerce.test/de_CH/enable-cookies",
                        "sortOrder": 2,
                        "storeViewLanguageMapping": "German"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "fr_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/fr_CH/",
                        "pageUrl": "https://magento244commerce.test/fr_CH/enable-cookies",
                        "sortOrder": 3,
                        "storeViewLanguageMapping": "French"
                    },
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "CH-Store",
                        "storeCode": "it_CH",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/it_CH/",
                        "pageUrl": "https://magento244commerce.test/it_CH/enable-cookies",
                        "sortOrder": 4,
                        "storeViewLanguageMapping": "Italian"
                    }
                ]
            }
        }
    },
    {
        "region": "Asia",
        "countries": {
            "Japan": {
                "storeViewCountryMapping": "Japan",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "ja_JP",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/ja_JP/",
                        "pageUrl": "https://magento244commerce.test/ja_JP/enable-cookies",
                        "sortOrder": 5,
                        "storeViewLanguageMapping": "Japanese"
                    }
                ]
            }
        }
    },
    {
        "region": "North America",
        "countries": {
            "United States": {
                "storeViewCountryMapping": "United States",
                "storeViews": [
                    {
                        "storeCountry": "US",
                        "storeLocale": "en_US",
                        "storeGroupCode": "main_website_store",
                        "storeCode": "default",
                        "country": "United States",
                        "language": "English",
                        "base": "https://magento244commerce.test/default/",
                        "pageUrl": "https://magento244commerce.test/default/enable-cookies",
                        "sortOrder": 1,
                        "storeViewLanguageMapping": "English"
                    }
                ]
            }
        }
    }
]