Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions Repository/CustomerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,30 @@ public function fetch($offset = 0, $limit = 250)
$query->leftJoin('defaultpayment', 's_core_paymentmeans_attributes', 'defaultpayment_attributes', 'defaultpayment.id = defaultpayment_attributes.paymentmeanID');
$this->addTableSelection($query, 's_core_paymentmeans_attributes', 'defaultpayment_attributes');

$query->leftJoin('customer', 's_core_locales', 'customerlanguage', 'customer.language = customerlanguage.id');
$this->addTableSelection($query, 's_core_locales', 'customerlanguage');

$query->leftJoin('customer', 's_core_shops', 'shop', 'customer.subshopID = shop.id');
$query->leftJoin(
'customer',
's_core_shops',
'shop',
'customer.subshopID = shop.id'
);
$this->addTableSelection($query, 's_core_shops', 'shop');

// customer.language maps to the shopID and not the localeID
$query->leftJoin(
'customer',
's_core_shops',
'customerlanguageshop',
'customer.language = customerlanguageshop.id'
);

$query->leftJoin(
'customer',
's_core_locales',
'customerlanguage',
'customerlanguage.id = customerlanguageshop.locale_id'
);
$this->addTableSelection($query, 's_core_locales', 'customerlanguage');

$query->where('customer.id IN (:ids)');
$query->setParameter('ids', $ids, Connection::PARAM_STR_ARRAY);

Expand Down
19 changes: 18 additions & 1 deletion Service/LanguageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,25 @@ private function fetchCustomerLocaleIds()
{
$query = $this->connection->createQueryBuilder();
$query->from('s_user', 'customer');
$query->addSelect('DISTINCT customer.language');
$query->leftJoin(
'customer',
's_core_shops',
'customerlanguageshop',
'customer.language = customerlanguageshop.id'
);

$query->leftJoin(
'customerlanguageshop',
's_core_locales',
'customerlocales',
'customerlanguageshop.locale_id = customerlocales.id'
);

$query->addSelect('customerlocales.id');
$query->distinct();
$query->where('customer.language IS NOT NULL');
$query->andWhere('customerlanguageshop.locale_id IS NOT NULL');
$query->andWhere('customerlocales.id IS NOT NULL');

return $query->execute()->fetchAll(\PDO::FETCH_COLUMN);
}
Expand Down
Loading