#10 Promotion Modul, Kommentar 2
This commit is contained in:
parent
f0da981737
commit
c9e1545693
128 changed files with 8194 additions and 637 deletions
|
|
@ -278,33 +278,17 @@ class OrderController extends Controller
|
|||
|
||||
public function datatable(){
|
||||
|
||||
$show_at = 1;
|
||||
$not_show_pids = ProductBuy::getNotShowProductIDs(Auth::user()->id);
|
||||
if(Request::get('shipping_is_for') === 'me'){
|
||||
$query = Product::with('categories')->select('products.*')->where('active', true)->where(function ($q) {
|
||||
$q->where('show_at', '=', 1)
|
||||
->orWhere('show_at', '=', 2)
|
||||
->orWhere('show_at', '=', 6);
|
||||
|
||||
});
|
||||
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
}else{
|
||||
$query = Product::with('categories')->select('products.*')->where('active', true)->where(function ($q) {
|
||||
$q->where('show_at', '=', 0)
|
||||
->orWhere('show_at', '=', 1);
|
||||
});
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '1');
|
||||
}
|
||||
|
||||
foreach($not_show_pids as $not_show_pid){
|
||||
$query->where('id', '!=', $not_show_pid);
|
||||
}
|
||||
|
||||
|
||||
//Kunden und Vertriebspartner
|
||||
//->orWhere('show_at', '=', 2); // Nur Vertriebspartner
|
||||
//->orderBy('pos', 'DESC')
|
||||
//->orderBy('id', 'DESC');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('product', function (Product $product) {
|
||||
|
|
@ -540,10 +524,10 @@ class OrderController extends Controller
|
|||
private function getCompProducts($for){
|
||||
|
||||
if($for === 'me' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_me')){
|
||||
return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['2'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
}
|
||||
if($for === 'ot' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_ot')){
|
||||
return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['1'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue