Skip to content

Commit

Permalink
[DGS-317] init
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijusCoding committed Dec 12, 2024
1 parent 834d62b commit 328e7e5
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/Repository/PriceRuleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public function getAllFlag($tableName, $idPriceRule)
*/
public function getByCarrierReference(
Address $deliveryAddress,
$carrierReference,
bool $includeCountryCheck = false
$carrierReference
) {
$query = new DbQuery();
$query->select('prc.`id_dpd_price_rule`');
Expand All @@ -91,27 +90,11 @@ public function getByCarrierReference(
'prs',
'prs.`id_dpd_price_rule` = prc.`id_dpd_price_rule`'
);

/* param needed to filter out by countries to get specific price rules for that country address */
if ($includeCountryCheck && $deliveryAddress->id_country) {
$query->innerJoin(
'dpd_price_rule_zone',
'prz',
'prc.`id_dpd_price_rule` = prz.`id_dpd_price_rule`'
);
$query->innerJoin(
'dpd_zone_range',
'zr',
'prz.`id_dpd_zone` = zr.`id_dpd_zone`'
);

$query->where('zr.`id_country`= ' . (int) $deliveryAddress->id_country);
}

$query->where('prc.`id_reference`="' . (int) $carrierReference . '" OR prc.`all_carriers`="1"');
$query->where('prc.`id_reference`="' . (int)$carrierReference . '" OR prc.`all_carriers`="1"');
$query->where('pr.active = 1');
$query->orderBy('pr.position ASC');


if (Validate::isLoadedObject($deliveryAddress)) {
if ($deliveryAddress->company) {
$query->where(
Expand Down

0 comments on commit 328e7e5

Please sign in to comment.