Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DGS-317 "ALL" zones revert changes #140

Open
wants to merge 2 commits into
base: release-v3.0.21
Choose a base branch
from
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
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
3 changes: 1 addition & 2 deletions src/Service/ShippingPriceCalculationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public function calculate(Cart $cart, \Carrier $carrier, Address $deliveryAddres

$priceRulesIds = $this->priceRuleRepository->getByCarrierReference(
$deliveryAddress,
$carrier->id_reference,
true
$carrier->id_reference
);

$shippingCosts += $this->priceRuleService->applyPriceRuleForCarrier(
Expand Down
Loading