#10 Promotion Modul, Kommentar 2
This commit is contained in:
parent
f0da981737
commit
c9e1545693
128 changed files with 8194 additions and 637 deletions
|
|
@ -105,6 +105,8 @@ class CheckoutController extends Controller
|
|||
$shopping_user = ShoppingUser::findOrFail($this->getPayments('shopping_user_id'));
|
||||
$shopping_user->billing_state = Shop::getCountryShippingCountryId($shopping_user->billing_country_id);
|
||||
$shopping_user->shipping_state = Shop::getCountryShippingCountryId($shopping_user->shipping_country_id);
|
||||
$shopping_user->same_as_billing = $shopping_user->same_as_billing ? false : true; //reinvert
|
||||
|
||||
}
|
||||
if($shopping_user->same_as_billing === NULL){
|
||||
$shopping_user->same_as_billing = false;
|
||||
|
|
@ -552,7 +554,7 @@ class CheckoutController extends Controller
|
|||
|
||||
$shopping_order->txaction = 'open';
|
||||
$shopping_order->save();
|
||||
|
||||
|
||||
if($shopping_payment){
|
||||
|
||||
Payment::handelUserPayCredits($shopping_order, 'deduction');
|
||||
|
|
|
|||
|
|
@ -438,19 +438,16 @@ class HomepartyController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
|
||||
private function getHomparty($id){
|
||||
/*private function getHomparty($id){
|
||||
$homeparty = Homeparty::findOrFail($id);
|
||||
if($homeparty->auth_user_id !== \Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
return $homeparty;
|
||||
}
|
||||
}*/
|
||||
|
||||
public function datatable(){
|
||||
$query = Product::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', '3');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class PromotionController extends Controller
|
|||
|
||||
public function detail($id){
|
||||
|
||||
|
||||
$user_promotion = PromotionUser::findOrFail($id);
|
||||
if($user_promotion->user_id != Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
$user_promotion->about_you = !$user_promotion->about_you ? $user_promotion->user->account->about_you : $user_promotion->about_you;
|
||||
$data = [
|
||||
'checkPaymentCredit' => $user_promotion->checkPaymentCredit(),
|
||||
'user_promotion_cart' => PromotionUser::preCalculateCart($user_promotion, 'user_promotion'),
|
||||
|
|
@ -59,7 +59,7 @@ class PromotionController extends Controller
|
|||
if(isset($data['action']) && $data['action'] === 'save-user-promotion'){
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.'|min:4|max:20',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
|
||||
);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
|
|
@ -96,7 +96,7 @@ class PromotionController extends Controller
|
|||
if(isset($data['action']) && $data['action'] === 'validate_url'){
|
||||
$rules = array(
|
||||
//'user_promotion_url' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|full_word_check',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.'|min:4|max:20',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
|
||||
);
|
||||
/*Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
if(in_array($value, config('profanity.full_word_check'))){
|
||||
|
|
@ -119,7 +119,7 @@ class PromotionController extends Controller
|
|||
|
||||
return Response::json(array(
|
||||
'success' => true,
|
||||
'preview_user_promotion_url' => config('app.promo_url').$name,
|
||||
'preview_user_promotion_url' => config('app.promo_url')."/".$name,
|
||||
));
|
||||
}
|
||||
if(isset($data['action']) && $data['action'] === 'updateCart'){
|
||||
|
|
@ -130,7 +130,7 @@ class PromotionController extends Controller
|
|||
|
||||
if(isset($data['products'])){
|
||||
$fill['user_promotion_cart'] = PromotionUser::preCalculateCart($data['products'], 'products');
|
||||
$fill['checkPaymentCredit'] = PromotionUser::preCheckPaymentCredit($fill['user_promotion_cart']);
|
||||
$fill['checkPaymentCredit'] = PromotionUser::preCheckPaymentCredit($fill['user_promotion_cart'], Auth::user());
|
||||
|
||||
}
|
||||
/*if(isset($data['user_promotion_id']) && $user_promotion = PromotionUser::find($data['user_promotion_id'])){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue