Skip to content

Commit

Permalink
More bugfixes on Googleshopping library
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter committed Jan 20, 2024
1 parent 627d531 commit 0774a99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
23 changes: 3 additions & 20 deletions upload/system/library/googleshopping/googleshopping.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public function __construct($registry, $store_id) {

$this->store_id = $store_id;

// Settings
$this->registry->get('load')->model('setting/setting');

if ($this->store_id === 0) {
$this->store_url = basename(DIR_TEMPLATE) == 'template' ? HTTPS_CATALOG : HTTPS_SERVER;
$this->store_name = $this->registry->get('config')->get('config_name');
Expand Down Expand Up @@ -102,9 +99,6 @@ public function getStoreName(): string {
* @return int
*/
public function getSupportedLanguageId(string $code): int {
// Languages
$this->registry->get('load')->model('localisation/language');

foreach ($this->registry->get('load')->model('localisation/language')->model_localisation_language->getLanguages() as $language) {
$language_code = current(explode("-", $language['code']));

Expand All @@ -124,9 +118,6 @@ public function getSupportedLanguageId(string $code): int {
* @return int
*/
public function getSupportedCurrencyId(string $code): int {
// Currencies
$this->registry->get('load')->model('localisation/currency');

foreach ($this->registry->get('load')->model('localisation/currency')->model_localisation_currency->getCurrencies() as $currency) {
if ($this->compareTrimmedLowercase($code, $currency['code']) === 0) {
return (int)$currency['currency_id'];
Expand All @@ -146,9 +137,6 @@ public function getSupportedCurrencyId(string $code): int {
public function getCountryName(string $code): string {
$this->registry->get('load')->config('googleshopping/googleshopping');

// Countries
$this->registry->get('load')->model('localisation/country');

$countries = $this->registry->get('config')->get('advertise_google_countries');

// Default value
Expand Down Expand Up @@ -312,9 +300,6 @@ public function getProductVariationIds(int $page): array {

$result = [];

// Languages
$this->registry->get('load')->model('localisation/language');

foreach ($this->registry->get('db')->query($sql)->rows as $row) {
foreach ($this->registry->get('load')->model('localisation/language')->model_localisation_language->getLanguages() as $language) {
$groups = $this->getGroups($row['product_id'], $language['language_id'], $row['color'], $row['size']);
Expand Down Expand Up @@ -1215,6 +1200,7 @@ protected function sendEmailReport(array $report): void {
return; // Do nothing
}

// Languages
$this->registry->get('load')->language('extension/advertise/google');

if ($this->registry->get('config')->get('config_mail_engine')) {
Expand Down Expand Up @@ -1345,7 +1331,7 @@ protected function resize(string $filename, int $width, int $height): string {
* sanitizeText
*
* @param string $text
* @param int $limit
* @param int $limit
*
* @return string
*/
Expand Down Expand Up @@ -2184,10 +2170,7 @@ public function getLanguages($language_codes): array {
* @return string
*/
public function getLanguageName(int $language_id, string $default): string {
// Languages
$this->registry->get('load')->model('localisation/language');

$language_info = $this->registry->get('load')->model_localisation_language->getLanguage($language_id);
$language_info = $this->registry->get('load')->model('localisation/language')->model_localisation_language->getLanguage($language_id);

if (isset($language_info['name']) && trim($language_info['name']) != '') {
return $language_info['name'];
Expand Down
4 changes: 1 addition & 3 deletions upload/system/library/googleshopping/traits/storeloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ trait StoreLoader {
protected function loadStore($store_id): void {
$this->registry->set('setting', new \Config());

$this->registry->get('load')->model('setting/setting');

foreach ($this->registry->get('load')->model_setting_setting->getSetting('advertise_google', $store_id) as $key => $value) {
foreach ($this->registry->get('load')->model('setting/setting')->model_setting_setting->getSetting('advertise_google', $store_id) as $key => $value) {
$this->registry->get('setting')->set($key, $value);
}
}
Expand Down

0 comments on commit 0774a99

Please sign in to comment.