commit 08-2025
This commit is contained in:
parent
9ae662f63e
commit
480fdc65ed
404 changed files with 65310 additions and 2600431 deletions
|
|
@ -8,11 +8,13 @@ use Request;
|
|||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class CardController extends Controller
|
||||
{
|
||||
private $instance = 'webshop';
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
|
|
@ -33,16 +35,16 @@ class CardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')
|
||||
$cartItem = Yard::instance($this->instance)
|
||||
->add($product->id, $product->getLang('name'), $quantity,
|
||||
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
|
||||
$product->getPriceWith(Yard::instance($this->instance)->getUserTaxFree(), false, Yard::instance($this->instance)->getUserCountry()), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'show_on' => $product->show_on]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
if(Yard::instance($this->instance)->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance($this->instance)->getUserCountry()));
|
||||
}
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
Yard::instance($this->instance)->reCalculateShippingPrice();
|
||||
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
|
|
@ -62,16 +64,16 @@ class CardController extends Controller
|
|||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
$cartItem = Yard::instance('shopping')
|
||||
$cartItem = Yard::instance($this->instance)
|
||||
->add($product->id, $product->getLang('name'), $quantity,
|
||||
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
|
||||
$product->getPriceWith(Yard::instance($this->instance)->getUserTaxFree(), false, Yard::instance($this->instance)->getUserCountry()), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'show_on' => $product->show_on]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
if(Yard::instance($this->instance)->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance($this->instance)->getUserCountry()));
|
||||
}
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
Yard::instance($this->instance)->reCalculateShippingPrice();
|
||||
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
|
|
@ -83,15 +85,18 @@ class CardController extends Controller
|
|||
public function showCard(){
|
||||
|
||||
if(Request::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Request::get('selected_country'));
|
||||
Yard::instance($this->instance)->setShippingCountryWithPrice(Request::get('selected_country'));
|
||||
}else{
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
Yard::instance($this->instance)->reCalculateShippingPrice();
|
||||
}
|
||||
|
||||
//show konflikt wenn user eingeloggt ist und country nicht gesetzt ist
|
||||
$shipping_error = $this->checkShippingError();
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
|
||||
'mylangs' => Shop::getLangChange($this->instance),
|
||||
'yard_instance' => $this->instance,
|
||||
'shipping_error' => $shipping_error ?? false,
|
||||
];
|
||||
return view('web.templates.card', $data);
|
||||
}
|
||||
|
|
@ -101,8 +106,8 @@ class CardController extends Controller
|
|||
$data = Request::all();
|
||||
if(isset($data['quantity'])){
|
||||
foreach ($data['quantity'] as $rowId => $qty){
|
||||
Yard::instance('shopping')->update($rowId, $qty);
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
Yard::instance($this->instance)->update($rowId, $qty);
|
||||
Yard::instance($this->instance)->reCalculateShippingPrice();
|
||||
}
|
||||
}else{
|
||||
$this->deleteCard();
|
||||
|
|
@ -111,31 +116,30 @@ class CardController extends Controller
|
|||
}
|
||||
|
||||
public function checkoutServer(){
|
||||
|
||||
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
$data = [];
|
||||
$data['is_from'] = 'shopping';
|
||||
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
|
||||
$data['user_price_infos'] = Yard::instance($this->instance)->getUserPriceInfos();
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment' => 1, //Customer Shop Payment
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'country_id' => Yard::instance($this->instance)->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);
|
||||
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
Yard::instance($this->instance)->store($identifier);
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
if(strpos($path, 'https') === false){
|
||||
|
|
@ -151,19 +155,48 @@ class CardController extends Controller
|
|||
}
|
||||
public function removeCard($rowId){
|
||||
|
||||
Yard::instance('shopping')->remove($rowId);
|
||||
Yard::instance($this->instance)->remove($rowId);
|
||||
return back();
|
||||
}
|
||||
|
||||
public function deleteCard(){
|
||||
|
||||
$setCode = Shop::getUserShopLang();
|
||||
$mylangs = Shop::getLangChange();
|
||||
$setCode = Shop::getUserShopLang(null, $this->instance);
|
||||
$mylangs = Shop::getLangChange($this->instance);
|
||||
foreach($mylangs as $code => $country){
|
||||
if(strtolower($setCode) === strtolower($code)){
|
||||
Shop::initUserShopLang($country);
|
||||
Shop::initUserShopLang($country, $this->instance);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function checkShippingError(){
|
||||
$shipping_error = false;
|
||||
if(\Auth::guard('customers')->check()){
|
||||
$user = \Auth::guard('customers')->user();
|
||||
if($user->shopping_user_id){
|
||||
$shopping_user = ShoppingUser::find($user->shopping_user_id);
|
||||
if($shopping_user->same_as_billing){
|
||||
if($shopping_user->billing_country_id != Yard::instance($this->instance)->getUserCountryId()){
|
||||
$user_country = Yard::instance($this->instance)->getUserCountry();
|
||||
$user_country_name = $user_country ? $user_country->getLocated() : '';
|
||||
$billing_country = $shopping_user->billing_country;
|
||||
$country_name = $billing_country ? $billing_country->getLocated() : '';
|
||||
$shipping_error = __('website.shipping_error_billing', ['shipping_country' => $user_country_name, 'billing_country' => $country_name]);
|
||||
}
|
||||
}else{
|
||||
if($shopping_user->shipping_country_id != Yard::instance($this->instance)->getUserCountryId()){
|
||||
$user_country = Yard::instance($this->instance)->getUserCountry();
|
||||
$user_country_name = $user_country ? $user_country->getLocated() : '';
|
||||
$shipping_country = $shopping_user->shipping_country;
|
||||
$country_name = $shipping_country ? $shipping_country->getLocated() : '';
|
||||
$shipping_error = __('website.shipping_error_delivery', ['shipping_country' => $user_country_name, 'billing_country' => $country_name]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $shipping_error;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ use Yard;
|
|||
class CheckoutController extends Controller
|
||||
{
|
||||
private $checkoutRepo;
|
||||
private $instance = 'checkout';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
|
@ -42,7 +43,15 @@ class CheckoutController extends Controller
|
|||
*/
|
||||
public function checkout()
|
||||
{
|
||||
$shopping_data = Yard::instance('shopping')->getYardExtra('shopping_data');
|
||||
/*
|
||||
@if(Auth::guard('customers')->check())
|
||||
<a href="{{ route('portal.logout') }}" class="btn btn-sm btn-default mt-3"><i class="fa fa-power-off"></i> {{ __('navigation.logout') }} </a>
|
||||
@else
|
||||
<a href="{{ Util::getMyMivitaPortalUrl() }}" class="btn btn-primary btn-block mt-3 faa-parent animated-hover"><i class="fa fa-sign-in"></i> {{ __('website.to_customer_portal') }} </a>
|
||||
@endif
|
||||
@if(Auth::guard('user')->check())
|
||||
*/
|
||||
$shopping_data = Yard::instance($this->instance)->getYardExtra('shopping_data');
|
||||
$is_from = $shopping_data['is_from'] ?? 'shopping';
|
||||
$is_for = $shopping_data['is_for'] ?? false;
|
||||
$is_abo = isset($shopping_data['is_abo']) ? (bool) $shopping_data['is_abo'] : false;
|
||||
|
|
@ -53,7 +62,6 @@ class CheckoutController extends Controller
|
|||
if ($is_for === 'ot-customer' || $is_for === 'abo-ot-customer') {
|
||||
$is_from = 'shopping';
|
||||
}
|
||||
|
||||
Util::setInstanceStatus(1, true); // link_check
|
||||
if ($is_abo) {
|
||||
$instance_status = Util::getInstanceStatus();
|
||||
|
|
@ -61,29 +69,11 @@ class CheckoutController extends Controller
|
|||
return $this->redirectToIsFinal($instance_status);
|
||||
}
|
||||
}
|
||||
|
||||
if (Session::has('new_session')) {
|
||||
$this->checkoutRepo->sessionDestroy();
|
||||
Session::forget('new_session');
|
||||
}
|
||||
|
||||
if (!$this->checkoutRepo->getSessionPayments('shopping_user_id')) {
|
||||
if ($shopping_data && $is_from !== 'shopping') {
|
||||
$shopping_user = $this->checkoutRepo->shoppingUserAuthData($is_from, $is_for, $shopping_data);
|
||||
$shopping_user->save();
|
||||
$this->checkoutRepo->putSessionPayments('shopping_user_id', $shopping_user->id);
|
||||
} elseif ($is_from === 'shopping' && ($is_for !== 'ot-customer' && $is_for !== 'abo-ot-customer')) {
|
||||
$shopping_user = $this->initializeShoppingUser($is_for, $is_from, $homeparty_id);
|
||||
} elseif ($is_from === 'shopping' && ($is_for === 'ot-customer' || $is_for === 'abo-ot-customer')) {
|
||||
$shopping_user = $this->checkoutRepo->makeCustomerShoppingUser($shopping_data);
|
||||
$shopping_user->is_for = $is_for;
|
||||
$shopping_user->is_from = $is_from;
|
||||
$shopping_user->mode = 'prev';
|
||||
$shopping_user->language = \App::getLocale();
|
||||
}
|
||||
} else {
|
||||
$shopping_user = $this->getExistingShoppingUser();
|
||||
}
|
||||
}
|
||||
$shopping_user = $this->initializeShoppingUserSession($is_from, $is_for, $shopping_data, $homeparty_id);
|
||||
|
||||
$this->prepareShoppingUserData($shopping_user);
|
||||
$payment_methods = $this->checkoutRepo->getPaymentsMethods($is_from, $is_abo);
|
||||
|
|
@ -101,46 +91,14 @@ class CheckoutController extends Controller
|
|||
'payment_methods_active' => $payment_methods['active'],
|
||||
'payment_data' => $payment_methods['data'],
|
||||
'instance_status' => $instance_status ?? false,
|
||||
'is_checkout' => true,
|
||||
'yard_instance' => $this->instance,
|
||||
];
|
||||
|
||||
return view('web.templates.checkout', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisiert einen neuen ShoppingUser
|
||||
*
|
||||
* @param string $is_for
|
||||
* @param string $is_from
|
||||
* @param int|null $homeparty_id
|
||||
* @return ShoppingUser
|
||||
*/
|
||||
private function initializeShoppingUser($is_for, $is_from, $homeparty_id = null)
|
||||
{
|
||||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->is_for = $is_for;
|
||||
$shopping_user->is_from = $is_from;
|
||||
$shopping_user->homeparty_id = $homeparty_id;
|
||||
$shopping_user->mode = 'prev';
|
||||
$shopping_user->language = \App::getLocale();
|
||||
|
||||
return $shopping_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt den existierenden ShoppingUser und bereitet ihn vor
|
||||
*
|
||||
* @return ShoppingUser
|
||||
*/
|
||||
private function getExistingShoppingUser()
|
||||
{
|
||||
$shopping_user = ShoppingUser::findOrFail($this->checkoutRepo->getSessionPayments('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
|
||||
|
||||
return $shopping_user;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bereitet die ShoppingUser-Daten vor
|
||||
*
|
||||
|
|
@ -152,25 +110,23 @@ class CheckoutController extends Controller
|
|||
if ($shopping_user->same_as_billing === NULL) {
|
||||
$shopping_user->same_as_billing = false;
|
||||
}
|
||||
|
||||
if (!$shopping_user->billing_country_id) {
|
||||
$shopping_user->billing_country_id = Yard::instance('shopping')->getUserCountryId();
|
||||
$shopping_user->billing_country_id = Yard::instance($this->instance)->getUserCountryId();
|
||||
// Die Zeile unten entfernen, da die Relation automatisch geladen wird
|
||||
// $shopping_user->billing_country = Yard::instance('shopping')->getUserCountry();
|
||||
// $shopping_user->billing_country = Yard::instance($this->instance)->getUserCountry();
|
||||
}
|
||||
|
||||
if (!$shopping_user->shipping_country_id) {
|
||||
$shopping_user->shipping_country_id = Yard::instance('shopping')->getUserCountryId();
|
||||
$shopping_user->shipping_country_id = Yard::instance($this->instance)->getUserCountryId();
|
||||
// Die Zeile unten entfernen, da die Relation automatisch geladen wird
|
||||
// $shopping_user->shipping_country = Yard::instance('shopping')->getUserCountry();
|
||||
// $shopping_user->shipping_country = Yard::instance($this->instance)->getUserCountry();
|
||||
}
|
||||
if (old('selected_country') && old('selected_country') === 'change') {
|
||||
Session::forget('_old_input.selected_country');
|
||||
$shopping_user->billing_state = old('billing_state');
|
||||
$shopping_user->shipping_state = old('shipping_state');
|
||||
} else {
|
||||
$shopping_user->billing_state = Yard::instance('shopping')->getShippingCountryId();
|
||||
$shopping_user->shipping_state = Yard::instance('shopping')->getShippingCountryId();
|
||||
$shopping_user->billing_state = Yard::instance($this->instance)->getShippingCountryId();
|
||||
$shopping_user->shipping_state = Yard::instance($this->instance)->getShippingCountryId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,9 +184,9 @@ class CheckoutController extends Controller
|
|||
private function handleCountryChange($data)
|
||||
{
|
||||
if (!Request::get('same_as_billing')) {
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($data['billing_state'], $data['is_for']);
|
||||
Yard::instance($this->instance)->setShippingCountryWithPrice($data['billing_state'], $data['is_for']);
|
||||
} else {
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($data['shipping_state'], $data['is_for']);
|
||||
Yard::instance($this->instance)->setShippingCountryWithPrice($data['shipping_state'], $data['is_for']);
|
||||
}
|
||||
|
||||
return back()->withInput(Request::all());
|
||||
|
|
@ -300,7 +256,7 @@ class CheckoutController extends Controller
|
|||
// Zahlung vorbereiten
|
||||
$pay = new PayoneController();
|
||||
$pay->init($shopping_user, $shopping_order);
|
||||
$amount = Yard::instance('shopping')->totalWithShipping(2, '.', '') * 100;
|
||||
$amount = Yard::instance($this->instance)->totalWithShipping(2, '.', '') * 100;
|
||||
$reference = $pay->setPrePayment($payment_method, $amount, 'EUR', $result);
|
||||
$this->checkoutRepo->putSessionPayments('payment_reference', $reference);
|
||||
$pay->setPersonalData();
|
||||
|
|
@ -345,7 +301,7 @@ class CheckoutController extends Controller
|
|||
if (is_null(Request::get('mandate_identification'))) {
|
||||
$pay = new PayoneController();
|
||||
$pay->init($shopping_user, $shopping_order);
|
||||
$amount = Yard::instance('shopping')->totalWithShipping(2, '.', '') * 100;
|
||||
$amount = Yard::instance($this->instance)->totalWithShipping(2, '.', '') * 100;
|
||||
$ret['elv'] = $pay->checkBankAccount($data, $amount, 'EUR', $shopping_user);
|
||||
|
||||
if ($ret['elv']['status'] === 'ERROR' || $ret['elv']['status'] === 'INVALID') {
|
||||
|
|
@ -388,6 +344,8 @@ class CheckoutController extends Controller
|
|||
{
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'is_checkout' => true,
|
||||
'yard_instance' => $this->instance,
|
||||
];
|
||||
|
||||
return view('web.templates.checkout-is-final', $data);
|
||||
|
|
@ -444,8 +402,8 @@ class CheckoutController extends Controller
|
|||
*/
|
||||
private function handleSuccessfulTransaction($ShoppingPayment, $reference)
|
||||
{
|
||||
Yard::instance('shopping')->destroy();
|
||||
$this->checkoutRepo->sessionDestroy();
|
||||
Yard::instance($this->instance)->destroy();
|
||||
$this->checkoutRepo->sessionDestroy(true);
|
||||
Util::setInstanceStatus(3, true); // link_pending
|
||||
|
||||
// Abo erstellen, falls nötig
|
||||
|
|
@ -458,6 +416,8 @@ class CheckoutController extends Controller
|
|||
'user_shop' => Util::getUserShop(),
|
||||
'order_reference' => $reference,
|
||||
'pay_trans' => $payt,
|
||||
'is_checkout' => true,
|
||||
'yard_instance' => $this->instance,
|
||||
];
|
||||
|
||||
return view('web.templates.checkout-final', $data);
|
||||
|
|
@ -476,9 +436,8 @@ class CheckoutController extends Controller
|
|||
if ($payt->shopping_payment->reference != $reference) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
Yard::instance('shopping')->destroy();
|
||||
$this->checkoutRepo->sessionDestroy();
|
||||
Yard::instance($this->instance)->destroy();
|
||||
$this->checkoutRepo->sessionDestroy(true);
|
||||
Util::setInstanceStatus(3, true); // link_pending
|
||||
|
||||
// Abo erstellen, falls nötig
|
||||
|
|
@ -495,6 +454,8 @@ class CheckoutController extends Controller
|
|||
'user_shop' => Util::getUserShop(),
|
||||
'order_reference' => $payt->shopping_payment->reference,
|
||||
'pay_trans' => $payt,
|
||||
'is_checkout' => true,
|
||||
'yard_instance' => $this->instance,
|
||||
];
|
||||
|
||||
return view('web.templates.checkout-final', $data);
|
||||
|
|
@ -549,4 +510,57 @@ class CheckoutController extends Controller
|
|||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisiert oder ruft einen Shopping-Benutzer ab
|
||||
*
|
||||
* @param string|null $is_from = shopping | user_order | user_order_ot | user_order_abo | user_order_abo_ot | user_order_ot_customer | user_order_abo_ot_customer
|
||||
* @param string|null $is_for = me | ot | abo-me | abo-ot | ot-customer | abo-ot-customer
|
||||
* @param array|null $shopping_data
|
||||
* @param int|null $homeparty_id
|
||||
* @return \App\Models\ShoppingUser
|
||||
*/
|
||||
private function initializeShoppingUserSession($is_from, $is_for, $shopping_data = null, $homeparty_id = null)
|
||||
{
|
||||
//check if shopping_user_id is set - der user ist bereits angelegt
|
||||
if ($this->checkoutRepo->getSessionPayments('shopping_user_id')) {
|
||||
return $this->getExistingShoppingUser();
|
||||
}
|
||||
//kommt vom Salescenter
|
||||
if ($shopping_data && $is_from !== 'shopping') {
|
||||
$shopping_user = $this->checkoutRepo->shoppingUserAuthData($is_from, $is_for, $shopping_data);
|
||||
$shopping_user->save();
|
||||
$this->checkoutRepo->putSessionPayments('shopping_user_id', $shopping_user->id);
|
||||
return $shopping_user;
|
||||
}
|
||||
|
||||
//kommt aus dem Salescenter mit bestelllink oder aus dem Webshop
|
||||
if ($is_from === 'shopping') {
|
||||
//Bestelllink
|
||||
if ($is_for === 'ot-customer' || $is_for === 'abo-ot-customer') {
|
||||
//customer shop mit den Daten aus dem Salescenter shopping_data
|
||||
return $this->checkoutRepo->makeCustomerShoppingUser($shopping_data, $is_for, $is_from);
|
||||
}
|
||||
//Webshop
|
||||
return $this->checkoutRepo->initShoppingUser($is_for, $is_from, $homeparty_id);
|
||||
}
|
||||
|
||||
return $this->getExistingShoppingUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt den existierenden ShoppingUser und bereitet ihn vor
|
||||
*
|
||||
* @return ShoppingUser
|
||||
*/
|
||||
private function getExistingShoppingUser()
|
||||
{
|
||||
$shopping_user = ShoppingUser::findOrFail($this->checkoutRepo->getSessionPayments('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
|
||||
|
||||
return $shopping_user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,7 +34,8 @@ class ContactController extends Controller
|
|||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'yard_instance' => 'webshop',
|
||||
|
||||
];
|
||||
return view('web.templates.kontakt', $data);
|
||||
|
|
@ -95,7 +96,8 @@ class ContactController extends Controller
|
|||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.contact-final', $data);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class RegisterController extends Controller
|
|||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
}
|
||||
|
|
@ -59,7 +60,8 @@ class RegisterController extends Controller
|
|||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'from_member_id' => $member_id
|
||||
'from_member_id' => $member_id,
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
}
|
||||
|
|
@ -129,6 +131,7 @@ class RegisterController extends Controller
|
|||
{
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.registrierung_finish', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@ class SiteController extends Controller
|
|||
'products' => Product::whereIn('slug', $products)->where('active', true)->whereJsonContains('show_on', '1')->get(),
|
||||
'set_products' => Product::whereIn('slug', $set_products)->where('active', true)->whereJsonContains('show_on', '1')->get(),
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'site' => IqSite::find(1),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
|
||||
return view('web.index', $data);
|
||||
}
|
||||
|
||||
|
|
@ -39,13 +41,13 @@ class SiteController extends Controller
|
|||
public function changeLang(){
|
||||
$data = Request::all();
|
||||
if(isset($data['change_country_id'])){
|
||||
$mylangs = Shop::getLangChange();
|
||||
$mylangs = Shop::getLangChange('webshop');
|
||||
foreach($mylangs as $code => $country){
|
||||
if(strtolower($data['change_country_id']) === strtolower($code)){
|
||||
\Session::put('user_init_country', strtolower($code));
|
||||
\Session::forget('user_init_country_options');
|
||||
\Session::put('locale', strtolower($data['change_locale_id']));
|
||||
Shop::initUserShopLang($country);
|
||||
Shop::initUserShopLang($country, 'webshop');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
|
@ -88,33 +90,33 @@ class SiteController extends Controller
|
|||
}
|
||||
|
||||
//bestelland / versandland
|
||||
if(array_key_exists($country, Shop::getLangChange())){
|
||||
if(array_key_exists($country, Shop::getLangChange('webshop'))){
|
||||
\Session::put('user_init_country_options', $country);
|
||||
}else{
|
||||
\Session::put('user_init_country_options', 'de');
|
||||
}
|
||||
|
||||
return redirect(route('home'));
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
public function site($site, $subsite = false, $product_slug = false)
|
||||
{
|
||||
|
||||
$this->setIPInfo();
|
||||
$subsite = trim($subsite, '/');
|
||||
$product_slug = trim($product_slug, '/');
|
||||
if($product_slug){
|
||||
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
$product = Product::where('slug', $product_slug)->where('active', true)->whereJsonContains('show_on', '1')->first();
|
||||
if ($category && $product) {
|
||||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'subsite' => $subsite,
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'product' => $product,
|
||||
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.produkte-show', $data);
|
||||
}
|
||||
|
|
@ -135,7 +137,7 @@ class SiteController extends Controller
|
|||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'subsite' => $subsite,
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'products' => false,
|
||||
|
|
@ -143,6 +145,7 @@ class SiteController extends Controller
|
|||
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
|
||||
'headline' => $category->getLang('headline'),
|
||||
'headline_image' => $headline_image,
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.' . $site, $data);
|
||||
|
||||
|
|
@ -150,7 +153,7 @@ class SiteController extends Controller
|
|||
}
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'subsite' => 'alle-produkte',
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', '1')->orderBy('pos', 'DESC')->get(),
|
||||
|
|
@ -158,12 +161,14 @@ class SiteController extends Controller
|
|||
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
|
||||
'headline' => __('website.productworld'),
|
||||
'headline_image' => false,
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'mylangs' => Shop::getLangChange(),
|
||||
'mylangs' => Shop::getLangChange('webshop'),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
if($subsite){
|
||||
if(!view()->exists('web.templates.'.$subsite)){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue