From 626a5ea72b9bd945ad9315c09e9db31bc2f25ac2 Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 19 Apr 2022 14:54:57 +0500 Subject: [PATCH] lasf fixes --- .../Sarga/Shop/src/Repositories/ProductRepository.php | 11 +++-------- .../Product/src/Repositories/ProductRepository.php | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index 0db741b64..9739c2e2c 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -143,7 +143,7 @@ class ProductRepository extends WProductRepository $sortOptions = $this->getDefaultSortByOption(); $orderDirection = ! empty($sortOptions) ? $sortOptions[1] : 'asc'; } - DB::connection()->enableQueryLog(); + if (isset($params['sort'])) { $this->checkSortAttributeAndGenerateQuery($qb, $params['sort'], $orderDirection); } else { @@ -153,8 +153,6 @@ class ProductRepository extends WProductRepository } } - Log::info(DB::getQueryLog()); - if ($priceFilter = request('price')) { $priceRange = explode(',', $priceFilter); @@ -440,7 +438,6 @@ class ProductRepository extends WProductRepository $qb->havingRaw('COUNT(*) = ' . count($attributeFilters)); } - Log::info($qb->toSql()); return $qb->groupBy('product_flat.id'); }); @@ -617,7 +614,7 @@ class ProductRepository extends WProductRepository $attributes = [ 'sku' => $variant->sku, 'size' => $this->getAttributeOptionId('size', $sizeVariant['attributeValue']), - 'product_id' => "{$data['product_number']}-{$sizeVariant['itemNumber']}", + 'product_number' => "{$data['product_number']}-{$sizeVariant['itemNumber']}", 'name' => $data['name'], // 'price' => $sizeVariant['price'], 'weight' => $data['weight'] ?? 0.45, @@ -914,7 +911,6 @@ class ProductRepository extends WProductRepository foreach($attributes as $code => $value){ if(! $attribute = $this->attributeRepository->findOneByField('code', $code)) { - Log::info('Attribute not found:'.$code); continue; } @@ -940,8 +936,7 @@ class ProductRepository extends WProductRepository } } catch(\Exception $ex){ - Log::info($attr); - Log::info($attribute); + Log::info($ex->getMessage()); } } diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index c226c95c8..31094893d 100755 --- a/packages/Webkul/Product/src/Repositories/ProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php @@ -647,7 +647,7 @@ class ProductRepository extends Repository if ($attribute) { if ($attribute->code === 'price') { - $query->orderBy('variants.min_price', $direction); + $query->orderBy('min_price', $direction); } else { $query->orderBy($attribute->code, $direction); }