fix shipping
This commit is contained in:
@@ -11,16 +11,12 @@ class DeliveryPackageController extends Controller
|
||||
{
|
||||
public function index(DeliveryPackagesDataTable $dataTable)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
return $dataTable->render('Admin.Shop.DeliveryPackages.list', $data);
|
||||
return $dataTable->render('Admin.Shop.DeliveryPackages.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data['sale_channels'] = SaleChannels::getOptions();
|
||||
|
||||
return view('Admin.Shop.DeliveryPackages.create', $data);
|
||||
return view('Admin.Shop.DeliveryPackages.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
@@ -30,17 +26,9 @@ class DeliveryPackageController extends Controller
|
||||
return redirect()->route('Admin.Shop.DeliveryPackages.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryPackages::get($id);
|
||||
|
||||
return view('Admin.Shop.DeliveryPackages.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryPackages::get($id)->toArray();
|
||||
$data['sale_channels'] = SaleChannels::getOptions();
|
||||
$data['package'] = DeliveryPackages::get($id)->toArray();
|
||||
|
||||
return view('Admin.Shop.DeliveryPackages.edit', $data);
|
||||
}
|
||||
@@ -49,11 +37,4 @@ class DeliveryPackageController extends Controller
|
||||
{
|
||||
return DeliveryPackages::destroy($id);
|
||||
}
|
||||
|
||||
public function toggleActive(Request $request)
|
||||
{
|
||||
$data = DeliveryPackages::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Shop\DeliveryTypeCalculationsDataTable;
|
||||
use App\Repositories\Shop\DeliveryTypeCalculations;
|
||||
use App\Repositories\Shop\SaleChannels;
|
||||
use App\Repositories\Shop\DeliveryTypes;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryTypeCalculationController extends Controller
|
||||
{
|
||||
public function index(DeliveryTypeCalculationsDataTable $dataTable)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
return $dataTable->render('Admin.Shop.DeliveryTypeCalculations.list', $data);
|
||||
return $dataTable->render('Admin.Shop.DeliveryTypeCalculations.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data = [
|
||||
'delivery_types' => DeliveryTypes::getOptions(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.DeliveryTypeCalculations.create', $data);
|
||||
}
|
||||
@@ -30,18 +30,13 @@ class DeliveryTypeCalculationController extends Controller
|
||||
return redirect()->route('Admin.Shop.DeliveryTypeCalculations.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryTypeCalculations::get($id);
|
||||
|
||||
return view('Admin.Shop.DeliveryTypeCalculations.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryTypeCalculations::get($id)->toArray();
|
||||
$data['sale_channels'] = SaleChannels::getOptions();
|
||||
|
||||
$data = [
|
||||
'calcul' => DeliveryTypeCalculations::get($id)->toArray(),
|
||||
'delivery_types' => DeliveryTypes::getOptions(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.DeliveryTypeCalculations.edit', $data);
|
||||
}
|
||||
|
||||
@@ -49,11 +44,4 @@ class DeliveryTypeCalculationController extends Controller
|
||||
{
|
||||
return DeliveryTypeCalculations::destroy($id);
|
||||
}
|
||||
|
||||
public function toggleActive(Request $request)
|
||||
{
|
||||
$data = DeliveryTypeCalculations::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,6 @@ class DeliveryTypeController extends Controller
|
||||
return redirect()->route('Admin.Shop.DeliveryTypes.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryTypes::get($id);
|
||||
|
||||
return view('Admin.Shop.DeliveryTypes.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['delivery'] = DeliveryTypes::get($id)->toArray();
|
||||
@@ -49,11 +42,4 @@ class DeliveryTypeController extends Controller
|
||||
{
|
||||
return DeliveryTypes::destroy($id);
|
||||
}
|
||||
|
||||
public function toggleActive(Request $request)
|
||||
{
|
||||
$data = DeliveryTypes::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,24 +15,24 @@ class BasketController extends Controller
|
||||
{
|
||||
public function getPrice(Request $request)
|
||||
{
|
||||
$offer_id = $request->input('offer_id');
|
||||
$offerId = $request->input('offer_id');
|
||||
$quantity = $request->input('quantity') ?? 1;
|
||||
$price = Offers::getPrice($offer_id, $quantity)->price_taxed;
|
||||
$price = Offers::getPrice($offerId, $quantity)->price_taxed;
|
||||
return number_format($quantity * $price, 2);
|
||||
}
|
||||
|
||||
public function addBasket(Request $request)
|
||||
{
|
||||
$offer_id = $request->input('offer_id');
|
||||
$offerId = $request->input('offer_id');
|
||||
$quantity = $request->input('quantity') ?? 1;
|
||||
$update = $request->input('update') ?? false;
|
||||
return Baskets::addBasket($offer_id, $quantity, $update);
|
||||
return Baskets::addBasket($offerId, $quantity, $update);
|
||||
}
|
||||
|
||||
public function modalBasket($offer_id, $quantity)
|
||||
public function modalBasket($offerId, $quantity)
|
||||
{
|
||||
$data['offer'] = Offers::getFull($offer_id)->toArray();
|
||||
$data['basket'] = Baskets::addBasket($offer_id, $quantity);
|
||||
$data['offer'] = Offers::getFull($offerId)->toArray();
|
||||
$data['basket'] = Baskets::addBasket($offerId, $quantity);
|
||||
return view('Shop.Baskets.partials.modalBasket', $data);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class BasketController extends Controller
|
||||
$data = $request->all();
|
||||
unset($data['_token']);
|
||||
$data['user_id'] = Users::getId();
|
||||
Orders::newOrder($data);
|
||||
Orders::saveOrder($data);
|
||||
return response()->json(['code' => '200']);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,72 +19,72 @@ class CategoryController extends Controller
|
||||
return $dataTable->render('Shop.Categories.list');
|
||||
}
|
||||
|
||||
public function show(Request $request, $category_id, $article_nature_id = false)
|
||||
public function show(Request $request, $categoryId, $articleNatureId = false)
|
||||
{
|
||||
if ($article_nature_id) {
|
||||
$product_type = ArticleNatures::getProductType($article_nature_id);
|
||||
dump($product_type);
|
||||
if ($articleNatureId) {
|
||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||
dump($productType);
|
||||
exit;
|
||||
} else {
|
||||
$article_nature = $request->input('article_nature');
|
||||
if (!$article_nature) {
|
||||
$articleNature = $request->input('article_nature');
|
||||
if (!$articleNature) {
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $category_id,
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
if (count($articleNatures) === 1) {
|
||||
$article_nature = $articleNatures[0];
|
||||
$articleNature = $articleNatures[0];
|
||||
}
|
||||
$productTypes = Articles::getProductTypesWithOffers([
|
||||
'category_id' => $category_id,
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
if (count($productTypes) === 1) {
|
||||
$product_type = $productTypes[0];
|
||||
$productType = $productTypes[0];
|
||||
}
|
||||
}
|
||||
|
||||
switch ($article_nature) {
|
||||
switch ($articleNature) {
|
||||
case 'semences':
|
||||
$product_type = 'botanic';
|
||||
$article_nature_id = 1;
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 1;
|
||||
break;
|
||||
case 'plants':
|
||||
$product_type = 'botanic';
|
||||
$article_nature_id = 2;
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 2;
|
||||
break;
|
||||
case 'legumes':
|
||||
$product_type = 'botanic';
|
||||
$article_nature_id = 3;
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 3;
|
||||
break;
|
||||
default:
|
||||
if (!($product_type ?? false)) {
|
||||
$product_type = 'botanic';
|
||||
$article_nature_id = 1;
|
||||
$article_nature = 'semences';
|
||||
if (!($productType ?? false)) {
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 1;
|
||||
$articleNature = 'semences';
|
||||
}
|
||||
break;
|
||||
}
|
||||
// $product_type = ArticleNatures::getProductType($article_nature_id);
|
||||
// dump($product_type);
|
||||
// dump($article_nature_id);
|
||||
// $productType = ArticleNatures::getProductType($articleNatureId);
|
||||
// dump($productType);
|
||||
// dump($articleNatureId);
|
||||
// exit;
|
||||
}
|
||||
// exit;
|
||||
$data = [
|
||||
'category' => Categories::getFull($category_id),
|
||||
'breadcrumb' => Categories::getAncestorsByCategory($category_id),
|
||||
'category' => Categories::getFull($categoryId),
|
||||
'breadcrumb' => Categories::getAncestorsByCategory($categoryId),
|
||||
'display_by_rows' => $request->input('display_by_rows') ?? false,
|
||||
'product_type' => $product_type,
|
||||
'article_nature' => $article_nature,
|
||||
'product_type' => $productType,
|
||||
'article_nature' => $articleNature,
|
||||
'article_natures' => $articleNatures ?? [],
|
||||
'product_types' => $productTypes ?? [],
|
||||
'tags_selected' => $request->input('tags') ?? [],
|
||||
'articles' => Articles::getArticlesToSell([
|
||||
'category_id' => $category_id,
|
||||
'category_id' => $categoryId,
|
||||
'tags' => $request->input('tags') ?? [],
|
||||
'product_type' => $product_type ?? false,
|
||||
'article_nature_id' => $article_nature_id ?? false,
|
||||
'product_type' => $productType ?? false,
|
||||
'article_nature_id' => $articleNatureId ?? false,
|
||||
]),
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($category_id),
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||
];
|
||||
// dump($data);
|
||||
// exit;
|
||||
|
||||
Reference in New Issue
Block a user