fixing styles
This commit is contained in:
@@ -6,25 +6,11 @@ class Shelves
|
||||
{
|
||||
public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false)
|
||||
{
|
||||
$productTypes = Articles::getProductTypesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
if ($articleNatureId) {
|
||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||
} else {
|
||||
if (! $articleNature) {
|
||||
if (count($articleNatures)) {
|
||||
$articleNature = $articleNatures[0];
|
||||
}
|
||||
}
|
||||
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
||||
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
|
||||
}
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers(['category_id' => $categoryId]);
|
||||
$productType = self::getProductType($articleNature, $articleNatures);
|
||||
$articleNatureId = $articleNatureId ?
|
||||
$articleNatureId :
|
||||
self::getArticleNatureId($articleNature, $articleNatures);
|
||||
|
||||
return [
|
||||
'category' => Categories::getFull($categoryId),
|
||||
@@ -33,7 +19,7 @@ class Shelves
|
||||
'product_type' => $productType,
|
||||
'article_nature' => $articleNature,
|
||||
'article_natures' => $articleNatures ?? [],
|
||||
'product_types' => $productTypes ?? [],
|
||||
'product_types' => Articles::getProductTypesWithOffers(['category_id' => $categoryId]),
|
||||
'tags_selected' => $tags,
|
||||
'articles' => Articles::getArticlesToSell([
|
||||
'category_id' => $categoryId,
|
||||
@@ -44,4 +30,27 @@ class Shelves
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getArticleNatureId($articleNature, $articleNatures = [])
|
||||
{
|
||||
if (! $articleNature && count($articleNatures)) {
|
||||
$articleNature = $articleNatures[0];
|
||||
}
|
||||
|
||||
return ArticleNatures::getIdBySlug($articleNature);
|
||||
}
|
||||
|
||||
public static function getProductType($articleNatureId, $articleNature, $articleNatures = [])
|
||||
{
|
||||
if ($articleNatureId) {
|
||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||
} else {
|
||||
if (! $articleNature && count($articleNatures)) {
|
||||
$articleNature = $articleNatures[0];
|
||||
}
|
||||
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
||||
}
|
||||
|
||||
return $productType;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user