lightspeedretail / webstore

Web Store eCommerce solution for Lightspeed
http://www.lightspeedpos.com/webstore
Open Software License 3.0
85 stars 63 forks source link

update Facebook plugins #684

Closed birdawn closed 7 years ago

birdawn commented 7 years ago

Hello, webstore 3.3.4 give an exception error, where seams talk about Facebook plugins must be in the following format : II_CC Anyone knowns how to correct the code?

ottaz commented 7 years ago

Web Store itself uses two letter iso language codes (Admin Panel > Store Settings > Localization). But the Facebook integration requires that the language code follow the pattern ll_CC where ll is the two letter iso code, and CC is the two letter country code. https://developers.facebook.com/docs/internationalization#locales

Yii's version of Facebook Opengraph will correct the locale in Web Store before it connects to Facebook, but it only does it for English, French, Spanish and Portuguese. So if one of your languages in Web Store isn't any of these, you will either have to remove that language or add the code yourself to support that language if you want Facebook integration to work.

Take a look in the SFacebook.php file within the yii-facebook-opengraph submodule. There is a protected function getLocale that you should be able to update if you decide to go that route.

birdawn commented 7 years ago

Thanks a lot Kevin to reply as fast.

We use Spanish, English and French as you can see at my site www.originalonweb.com, this is the three languages that are setting in the data base. core-protected-extensions-yiifacebook-opengraph-SFacebook.php I deduce the customers that have this problem are using catalán language, facebook code for this language is ca_ES and is already added as a protected language, in SFacebook.php I don’t understand what’s the issue then… any idea?

El 15 nov 2016, a las 16:58, Kevin Ottley notifications@github.com escribió:

Web Store itself uses two letter iso language codes (Admin Panel > Store Settings > Localization). But the Facebook integration requires that the language code follow the pattern ll_CC where ll is the two letter iso code, and CC is the two letter country code. https://developers.facebook.com/docs/internationalization#locales https://developers.facebook.com/docs/internationalization#locales Yii's version of Facebook Opengraph will correct the locale in Web Store before it connects to Facebook, but it only does it for English, French, Spanish and Portuguese. So if one of your languages in Web Store isn't this, you either have to remove the language or add the code yourself to support that language.

Take a look in the SFacebook.php file within the yii-facebook-opengraph submodule. There is a protected function getLocale that you should be able to update if you decide to go that route.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lightspeedretail/webstore/issues/684#issuecomment-260681141, or mute the thread https://github.com/notifications/unsubscribe-auth/ASxjP7rTyO3I1hpNOmPSHzo0M303V8pXks5q-da2gaJpZM4KybTG.

birdawn commented 7 years ago

I find a kind of solution, as I see when the IOS was setting in Italian, Catalan and thai language at least that three languages, my website have an error. Then I add a code that force set a language:

In line 421 add:

// catalan añadido por JICIRERA else if ($lang === 'ca' && !in_array($locale, array('es_es','es_cl','es_co','es_mx','es_ve'))) { $locale = 'es_la'; // non standard } // italiano añadido por JICIRERA else if ($lang === 'it' && !in_array($locale, array('es_es','es_cl','es_co','es_mx','es_ve'))) { $locale = 'it_it'; // non standard } // thai añadido por JICIRERA else if ($lang === 'th' && !in_array($locale, array('es_es','es_cl','es_co','es_mx','es_ve'))) { $locale = 'th_th'; // non standard }

And it works, maybe can do with more sense but works already !!

El 15 nov 2016, a las 16:58, Kevin Ottley notifications@github.com escribió:

Web Store itself uses two letter iso language codes (Admin Panel > Store Settings > Localization). But the Facebook integration requires that the language code follow the pattern ll_CC where ll is the two letter iso code, and CC is the two letter country code. https://developers.facebook.com/docs/internationalization#locales

Yii's version of Facebook Opengraph will correct the locale in Web Store before it connects to Facebook, but it only does it for English, French, Spanish and Portuguese. So if one of your languages in Web Store isn't this, you either have to remove the language or add the code yourself to support that language.

Take a look in the SFacebook.php file within the yii-facebook-opengraph submodule. There is a protected function getLocale that you should be able to update if you decide to go that route.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ottaz commented 7 years ago

Yes exactly! You probably don't need the in_array checks though.

// catalan añadido por JICIRERA
else if ($lang === 'ca' ) {
    $locale = 'ca_es'; // non standard
}
// italiano añadido por JICIRERA 
else if ($lang === 'it') {
    $locale = 'it_it'; // non standard
} 
// thai añadido por JICIRERA
else if ($lang === 'th') {
    $locale = 'th_th'; // non standard
}