lasf fixes

This commit is contained in:
merdan 2022-04-19 14:54:57 +05:00
parent 53d64dcaca
commit 626a5ea72b
2 changed files with 4 additions and 9 deletions

View File

@ -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());
}
}

View File

@ -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);
}