fixing styles
This commit is contained in:
@@ -44,7 +44,7 @@ class Deliveries
|
||||
return Delivery::orderBy('name', 'asc')->active()->public()->with('sale_channel')->get();
|
||||
}
|
||||
|
||||
public static function toggle_active($id, $active)
|
||||
public static function toggleActive($id, $active)
|
||||
{
|
||||
return self::update(['active' => $active], $id);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class Offers
|
||||
return Offer::with(['article.tags'])->byTags($tags)->get();
|
||||
}
|
||||
|
||||
public static function toggle_active($id, $status_id)
|
||||
public static function toggleActive($id, $status_id)
|
||||
{
|
||||
return self::update(['status_id' => $status_id], $id);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,13 @@ class Packages
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function init()
|
||||
{
|
||||
return [
|
||||
'families' => ArticleNatures::getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Package::orderBy('value', 'asc')->pluck('value', 'id')->toArray();
|
||||
|
||||
@@ -10,6 +10,15 @@ class PriceListValues
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function init()
|
||||
{
|
||||
return [
|
||||
'unities' => Unities::getOptions(),
|
||||
'taxes_options' => Taxes::getOptions(),
|
||||
'categories' => PriceListValueCategories::getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPriceByOffer($offer_id, $quantity = 1, $sale_channel_id = false)
|
||||
{
|
||||
$prices = self::getPricesByOffer($offer_id, $sale_channel_id);
|
||||
|
||||
@@ -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