Country Prices | Homeparty | Shop | Order

This commit is contained in:
Kevin Adametz 2021-08-27 18:53:12 +02:00
parent 51d81d8ec6
commit 39d1e93416
284 changed files with 784 additions and 216 deletions

View file

@ -3,12 +3,13 @@
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Product;
use App\Models\ShoppingInstance;
use App\Services\Util;
use Yard;
use Request;
use App\Services\Shop;
use App\Services\Util;
use App\Models\Product;
use App\Models\ShoppingInstance;
use App\Http\Controllers\Controller;
class CardController extends Controller
{
@ -32,8 +33,12 @@ class CardController extends Controller
if($product->images->count()){
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product_slug, 'weight' => $product->weight]);
Yard::setTax($cartItem->rowId, $product->tax);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
}
Yard::instance('shopping')->reCalculateShippingPrice();
\Session()->flash('show-card-after-add', true);
@ -55,7 +60,12 @@ class CardController extends Controller
}
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
Yard::setTax($cartItem->rowId, $product->tax);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
}
Yard::instance('shopping')->reCalculateShippingPrice();
\Session()->flash('show-card-after-add', true);
@ -74,6 +84,8 @@ class CardController extends Controller
}
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
];
return view('web.templates.card', $data);
}
@ -103,6 +115,8 @@ class CardController extends Controller
$data = [];
$data['is_from'] = 'shopping';
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
ShoppingInstance::create([
'identifier' => $identifier,

View file

@ -89,6 +89,13 @@ class CheckoutController extends Controller
$shopping_user->same_as_billing = false;
}
if(!$shopping_user->billing_country){
$shopping_user->billing_country = Yard::instance('shopping')->getUserCountry();
}
if(!$shopping_user->shipping_country){
$shopping_user->shipping_country = Yard::instance('shopping')->getUserCountry();
}
if(old('selected_country') && old('selected_country') === 'change'){
\Session::forget('_old_input.selected_country');
$shopping_user->billing_state = old('billing_state');
@ -479,7 +486,7 @@ class CheckoutController extends Controller
'subtotal_ws' => 0,
'tax' => 0,
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => $homeparty->order['points'],
'points' => $homeparty->order['points'] - $homeparty->order['bonus_points_diff'],
'weight' => 0,
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),

View file

@ -3,13 +3,14 @@
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Mail\MailContact;
use GuzzleHttp\Client;
use Request;
use Illuminate\Support\Facades\Mail;
use App\Services\Util;
use Validator;
use App\Services\Shop;
use App\Services\Util;
use GuzzleHttp\Client;
use App\Mail\MailContact;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Mail;
class ContactController extends Controller
@ -27,11 +28,14 @@ class ContactController extends Controller
}
public function create()
{
$data = [
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
];
return view('web.templates.kontakt', $data);
}
@ -91,6 +95,7 @@ class ContactController extends Controller
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
];
return view('web.templates.contact-final', $data);

View file

@ -3,35 +3,29 @@
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Category;
use Yard;
use Request;
use App\Models\IqSite;
use App\Models\Product;
use App\Models\ProductCategory;
use App\Services\Shop;
use App\Services\Util;
use App\Models\Product;
use App\Models\Category;
use App\Models\ProductCategory;
use App\Http\Controllers\Controller;
class SiteController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
}
public function index()
{
$products = ['aloe-vera-gel-99', 'aloe-vera-saft-500-ml', 'aloe-vera-lippenbalsam'];
// $set_products = ['aloe-vera-cleaner-set', 'aloe-vera-koerper-set', 'aloe-vera-repair-set'];
$set_products = ['aloe-vera-koerper-set', 'baby-set', 'aloe-vera-gel-set'];
$data = [
'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(),
'site' => IqSite::find(1),
];
return view('web.index', $data);
@ -40,6 +34,20 @@ class SiteController extends Controller
public function domainCheck(){
die("checked");
}
public function changeLang(){
$data = Request::all();
if(isset($data['change_country_id'])){
$mylangs = Shop::getLangChange();
foreach($mylangs as $code => $country){
if(strtolower($data['change_country_id']) === strtolower($code)){
Shop::initUserShopLang($country);
return back();
}
}
}
}
public function site($site, $subsite = false, $product_slug = false)
{
$subsite = trim($subsite, '/');
@ -52,11 +60,11 @@ class SiteController extends Controller
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
'subsite' => $subsite,
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
'product' => $product,
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
];
return view('web.templates.produkte-show', $data);
}
@ -79,6 +87,7 @@ class SiteController extends Controller
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
'subsite' => $subsite,
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
'products' => false,
@ -93,6 +102,7 @@ class SiteController extends Controller
}
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
'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(),
@ -104,7 +114,8 @@ class SiteController extends Controller
return view('web.templates.'.$site, $data);
}
$data = [
'user_shop' => Util::getUserShop()
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),
];
if($subsite){
if(!view()->exists('web.templates.'.$subsite)){