Fixed an issue with convertXToProductId which was causing some productids from being pushed into the storage

This commit is contained in:
Prashant Singh 2019-07-23 13:43:37 +05:30
parent dfd6ea8c25
commit 2acad0e540
4 changed files with 10 additions and 9 deletions

View File

@ -807,7 +807,7 @@ return [
'promotion' => [
'information' => 'Information',
'condiiton' => 'Conditions',
'conditions' => 'Conditions',
'actions' => 'Actions',
'coupons' => 'Coupons',
'zero-unlimited' => 'Zero denotes unlimited usage here',

View File

@ -199,9 +199,14 @@ class ConvertXToProductId
foreach ($categories as $category) {
$data = $this->getAll($category->id);
if ($data->count()) {
$products->push($data);
unset($data);
}
}
return $data;
return $products->flatten()->all();
}
/**
@ -262,8 +267,6 @@ class ConvertXToProductId
->select('products.id')
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id')
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->whereNotNull('product_flat.url_key');
if ($categoryId) {
@ -279,9 +282,7 @@ class ConvertXToProductId
}
$queryBuilder = $qb->leftJoin('product_flat as flat_variants', function($qb) use($channel, $locale) {
$qb->on('product_flat.id', '=', 'flat_variants.parent_id')
->where('flat_variants.channel', $channel)
->where('flat_variants.locale', $locale);
$qb->on('product_flat.id', '=', 'flat_variants.parent_id');
});
return $qb->groupBy('product_flat.id');

View File

@ -216,7 +216,7 @@ abstract class Discount
$actualShippingRate = $actualShippingRate->calculate();
if (is_array($actualShippingRate)) {
foreach($actualShippingRate as $actualRate) {
foreach ($actualShippingRate as $actualRate) {
if ($actualRate->method == $cart->selected_shipping_rate->method) {
$actualShippingRate = $actualRate;

View File

@ -53,7 +53,7 @@ class NonCouponAbleRule extends Discount
// time based filter
foreach($rules as $rule) {
$applicability = $this->checkApplicability($rule);
dd($applicability);
if ($applicability) {
$items = collect();