enhance add to basket
This commit is contained in:
@@ -98,12 +98,12 @@ class Articles
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$variety = $article->product;
|
||||
$specie = $variety->specie;
|
||||
$description = empty($specie->description) ? '' : $specie->description . '<br>';
|
||||
$description .= empty($variety->description) ? '' : $variety->description . '<br>';
|
||||
$description = empty($specie->description) ? '' : $specie->description . '<br><br>';
|
||||
$description .= empty($variety->description) ? '' : $variety->description . '<br><br>';
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$specie = $article->product;
|
||||
$description = empty($specie->description) ? '' : $specie->description . '<br>';
|
||||
$description = empty($specie->description) ? '' : $specie->description . '<br><br>';
|
||||
break;
|
||||
default:
|
||||
$description = '';
|
||||
|
||||
@@ -7,6 +7,32 @@ use App\Repositories\Core\User\ShopCart;
|
||||
|
||||
class Offers
|
||||
{
|
||||
public static function addBasket($offer_id, $quantity = 1)
|
||||
{
|
||||
if (ShopCart::has($offer_id)) {
|
||||
$ret = ShopCart::remove($offer_id);
|
||||
}
|
||||
$data = $quantity ? Offers::getBasketData($offer_id, $quantity) : false;
|
||||
return $data ? ShopCart::add($data) : false;
|
||||
}
|
||||
|
||||
public static function getFull($id, $sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||
return Offer::with([
|
||||
'article.article_nature',
|
||||
'article.product',
|
||||
'article.image',
|
||||
'tariff' => function ($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
},
|
||||
'tariff.price_lists' => function ($query) use ($sale_channel_id) {
|
||||
$query->BySaleChannel($sale_channel_id);
|
||||
},
|
||||
'tariff.price_lists.price_list_values',
|
||||
'variation',
|
||||
])->find($id);
|
||||
}
|
||||
|
||||
public static function getPrice($id, $quantity = 1, $sale_channel_id = false)
|
||||
{
|
||||
@@ -153,5 +179,4 @@ class Offers
|
||||
{
|
||||
return self::update(['status_id' => $status_id], $id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user