change construction of articles/offers
This commit is contained in:
@@ -111,14 +111,16 @@ class Articles
|
||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||
// dump($price_lists);
|
||||
if (count($price_lists)) {
|
||||
$data[$article->name] = [
|
||||
'description' => (!empty($article->description)) ? $article->description : $article->product->description,
|
||||
'image' => $article->image,
|
||||
'product_type' => $article->product_type,
|
||||
'product_id' => $article->product_id,
|
||||
'product_name' => $article->product->name,
|
||||
'parent_name' => trim(str_replace($article->product->name, '', $article->name)),
|
||||
];
|
||||
if (!is_array($data[$article->name] ?? false)) {
|
||||
$data[$article->name] = [
|
||||
'description' => (!empty($article->description)) ? $article->description : $article->product->description,
|
||||
'image' => $article->image,
|
||||
'product_type' => $article->product_type,
|
||||
'product_id' => $article->product_id,
|
||||
'product_name' => $article->product->name,
|
||||
'parent_name' => trim(str_replace($article->product->name, '', $article->name)),
|
||||
];
|
||||
}
|
||||
$prices = $price_lists[0]['price_list_values'][0];
|
||||
$article_nature_name = strtolower($article->article_nature->name);
|
||||
// dump($prices);
|
||||
@@ -129,10 +131,8 @@ class Articles
|
||||
'price' => $prices['price_taxed'],
|
||||
'variation' => $article->offers[0]->variation->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
// dump($data);
|
||||
// exit;
|
||||
return $data ?? false;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,14 +129,11 @@ class Categories
|
||||
$id = $id ? (int) $id : $data['id'];
|
||||
$category = self::get($id);
|
||||
$ret = $category->update($data);
|
||||
// CategoryTrees::update($data, $category->category_id);
|
||||
return $category;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
// $category = self::get($id);
|
||||
// CategoryTrees::destroy($category->category_id);
|
||||
return Category::destroy($id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user