Shipping Tax Card
This commit is contained in:
parent
da08e9ff37
commit
eb55b01b0d
13 changed files with 86 additions and 81 deletions
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
|
|
@ -3,17 +3,18 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="2fbaac5f-25ba-4502-a970-cc14728d7d55" name="Default Changelist" comment="">
|
<list default="true" id="2fbaac5f-25ba-4502-a970-cc14728d7d55" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/ShoppingUserController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/ShoppingUserController.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/ShippingController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/ShippingController.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/CardController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/CardController.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Models/Shipping.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Shipping.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/CheckoutController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/CheckoutController.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Models/ShippingPrice.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShippingPrice.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Models/Product.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Product.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingOrderItem.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingOrderItem.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/Services/Yard.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/Yard.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Services/Yard.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/Yard.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/config/cart.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/cart.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/database/migrations/2019_01_06_004849_create_shipping_prices_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_01_06_004849_create_shipping_prices_table.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/database/migrations/2019_02_23_163724_create_shopping_order_items_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_02_23_163724_create_shopping_order_items_table.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/lang/de/email.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/lang/de/email.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/views/admin/shipping/edit.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/shipping/edit.blade.php" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/card.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/card.blade.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/card.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/card.blade.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/checkout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/checkout.blade.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/produkte-show.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/produkte-show.blade.php" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|
@ -486,6 +487,7 @@
|
||||||
<workItem from="1592831761021" duration="3000" />
|
<workItem from="1592831761021" duration="3000" />
|
||||||
<workItem from="1592905155133" duration="2081000" />
|
<workItem from="1592905155133" duration="2081000" />
|
||||||
<workItem from="1593539130650" duration="5379000" />
|
<workItem from="1593539130650" duration="5379000" />
|
||||||
|
<workItem from="1593607978036" duration="4312000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -541,12 +543,12 @@
|
||||||
<screen x="0" y="23" width="2560" height="1417" />
|
<screen x="0" y="23" width="2560" height="1417" />
|
||||||
</state>
|
</state>
|
||||||
<state x="951" y="549" key="com.jetbrains.php.test.PhpNewTestDialog/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@0.23.2560.1417" timestamp="1591961096724" />
|
<state x="951" y="549" key="com.jetbrains.php.test.PhpNewTestDialog/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@0.23.2560.1417" timestamp="1591961096724" />
|
||||||
<state x="805" y="444" width="1115" height="793" key="find.popup" timestamp="1593544315663">
|
<state x="805" y="444" width="1115" height="793" key="find.popup" timestamp="1593612216078">
|
||||||
<screen x="0" y="23" width="2560" height="1417" />
|
<screen x="0" y="23" width="2560" height="1417" />
|
||||||
</state>
|
</state>
|
||||||
<state x="805" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1589024021327" />
|
<state x="805" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1589024021327" />
|
||||||
<state x="-1755" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@-2560.23.2560.1417" timestamp="1589974580416" />
|
<state x="-1755" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@-2560.23.2560.1417" timestamp="1589974580416" />
|
||||||
<state x="805" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@0.23.2560.1417" timestamp="1593544315663" />
|
<state x="805" y="444" width="1115" height="793" key="find.popup/-2560.23.2560.1417/2560.-527.1440.2537/0.23.2560.1417@0.23.2560.1417" timestamp="1593612216078" />
|
||||||
<state x="863" y="438" width="1115" height="793" key="find.popup/2560.-493.1440.2537/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1585758694219" />
|
<state x="863" y="438" width="1115" height="793" key="find.popup/2560.-493.1440.2537/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1585758694219" />
|
||||||
<state x="863" y="438" width="1115" height="793" key="find.popup/2560.-527.1440.2537/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1587109016568" />
|
<state x="863" y="438" width="1115" height="793" key="find.popup/2560.-527.1440.2537/-2560.23.2560.1417/0.23.2560.1417@0.23.2560.1417" timestamp="1587109016568" />
|
||||||
<state x="945" y="377" width="670" height="676" key="search.everywhere.popup" timestamp="1593542096563">
|
<state x="945" y="377" width="670" height="676" key="search.everywhere.popup" timestamp="1593542096563">
|
||||||
|
|
@ -565,7 +567,7 @@
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="php">
|
<line-breakpoint enabled="true" type="php">
|
||||||
<url>file://$PROJECT_DIR$/resources/views/emails/checkout.blade.php</url>
|
<url>file://$PROJECT_DIR$/resources/views/emails/checkout.blade.php</url>
|
||||||
<line>360</line>
|
<line>362</line>
|
||||||
<option name="timeStamp" value="4" />
|
<option name="timeStamp" value="4" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ class ShippingController extends Controller
|
||||||
$shipping = false;
|
$shipping = false;
|
||||||
$data = Request::all();
|
$data = Request::all();
|
||||||
|
|
||||||
if($data['action'] == 'shipping'){
|
if($data['action'] === 'shipping'){
|
||||||
if ($data['id'] == "new") {
|
if ($data['id'] === "new") {
|
||||||
$shipping = new Shipping();
|
$shipping = new Shipping();
|
||||||
$rules = array('name' => 'required');
|
$rules = array('name' => 'required');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -79,7 +79,7 @@ class ShippingController extends Controller
|
||||||
$shipping->save();
|
$shipping->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['action'] == 'price'){
|
if($data['action'] === 'price'){
|
||||||
$shipping = Shipping::findOrFail($data['shipping_id']);
|
$shipping = Shipping::findOrFail($data['shipping_id']);
|
||||||
$rules = array('price' => 'required');
|
$rules = array('price' => 'required');
|
||||||
$ret = ['value' => $shipping];
|
$ret = ['value' => $shipping];
|
||||||
|
|
@ -87,7 +87,7 @@ class ShippingController extends Controller
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return view('admin.shipping.edit', $ret)->withErrors($validator);
|
return view('admin.shipping.edit', $ret)->withErrors($validator);
|
||||||
}
|
}
|
||||||
if ($data['id'] == "new") {
|
if ($data['id'] === "new") {
|
||||||
$price = ShippingPrice::create($data);
|
$price = ShippingPrice::create($data);
|
||||||
} else {
|
} else {
|
||||||
$price = ShippingPrice::findOrFail($data['id']);
|
$price = ShippingPrice::findOrFail($data['id']);
|
||||||
|
|
@ -99,7 +99,7 @@ class ShippingController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if($data['action'] == 'country'){
|
if($data['action'] === 'country'){
|
||||||
$shipping = Shipping::findOrFail($data['shipping_id']);
|
$shipping = Shipping::findOrFail($data['shipping_id']);
|
||||||
foreach($data['country_ids'] as $country_id){
|
foreach($data['country_ids'] as $country_id){
|
||||||
if(ShippingCountry::where('country_id', $country_id)->count() == 0){
|
if(ShippingCountry::where('country_id', $country_id)->count() == 0){
|
||||||
|
|
|
||||||
|
|
@ -73,4 +73,7 @@ class Shipping extends Model
|
||||||
public function prices(){
|
public function prices(){
|
||||||
return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id');
|
return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id');
|
||||||
}
|
}
|
||||||
|
public function shipping_prices(){
|
||||||
|
return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $shipping_id
|
* @property int $shipping_id
|
||||||
* @property float|null $price
|
* @property float|null $price
|
||||||
* @property float|null $tax
|
* @property float|null $tax_rate
|
||||||
* @property float|null $factor
|
* @property float|null $factor
|
||||||
* @property float|null $total_from
|
* @property float|null $total_from
|
||||||
* @property float|null $total_to
|
* @property float|null $total_to
|
||||||
|
|
@ -40,7 +40,7 @@ class ShippingPrice extends Model
|
||||||
protected $table = 'shipping_prices';
|
protected $table = 'shipping_prices';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'shipping_id', 'price', 'tax', 'factor', 'total_from', 'total_to', 'weight_from', 'weight_to',
|
'shipping_id', 'price', 'tax_rate', 'factor', 'total_from', 'total_to', 'weight_from', 'weight_to',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function shipping()
|
public function shipping()
|
||||||
|
|
@ -75,9 +75,9 @@ class ShippingPrice extends Model
|
||||||
{
|
{
|
||||||
$value = $this->_format_number($value);
|
$value = $this->_format_number($value);
|
||||||
if ($value == "") {
|
if ($value == "") {
|
||||||
$this->attributes['tax'] = null;
|
$this->attributes['tax_rate'] = null;
|
||||||
} else {
|
} else {
|
||||||
$this->attributes['tax'] = floatval(str_replace(',', '.', $value));
|
$this->attributes['tax_rate'] = floatval(str_replace(',', '.', $value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,15 +115,15 @@ class ShippingPrice extends Model
|
||||||
return number_format($this->attributes['price'], 2, ',', '.');
|
return number_format($this->attributes['price'], 2, ',', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormattedTax()
|
public function getFormattedTaxRate()
|
||||||
{
|
{
|
||||||
if ($this->attributes['tax'] === NULL) {
|
if ($this->attributes['tax_rate'] === NULL) {
|
||||||
return $this->attributes['tax'];
|
return $this->attributes['tax_rate'];
|
||||||
}
|
}
|
||||||
if (\App::getLocale() == "en") {
|
if (\App::getLocale() == "en") {
|
||||||
return number_format($this->attributes['tax'], 2, '.', ',');
|
return number_format($this->attributes['tax_rate'], 2, '.', ',');
|
||||||
}
|
}
|
||||||
return number_format($this->attributes['tax'], 2, ',', '.');
|
return number_format($this->attributes['tax_rate'], 2, ',', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormattedFactor()
|
public function getFormattedFactor()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class Yard extends Cart
|
class Yard extends Cart
|
||||||
{
|
{
|
||||||
private $shipping = 0;
|
private $shipping_price = 0;
|
||||||
|
private $shipping_tax = 0;
|
||||||
private $shipping_country_id = 0; //default de
|
private $shipping_country_id = 0; //default de
|
||||||
private $ysession;
|
private $ysession;
|
||||||
private $yinstance;
|
private $yinstance;
|
||||||
|
|
@ -21,7 +22,11 @@ class Yard extends Cart
|
||||||
$this->ysession = $session;
|
$this->ysession = $session;
|
||||||
$this->yinstance = sprintf('%s.%s', 'cart', 'shipping_extras');
|
$this->yinstance = sprintf('%s.%s', 'cart', 'shipping_extras');
|
||||||
if($this->getShippingExtra('shipping_price')){
|
if($this->getShippingExtra('shipping_price')){
|
||||||
$this->shipping = floatval($this->getShippingExtra('shipping_price'));
|
$this->shipping_price = (float) ($this->getShippingExtra('shipping_price'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->getShippingExtra('shipping_tax')){
|
||||||
|
$this->shipping_tax = (float) ($this->getShippingExtra('shipping_tax'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->getShippingExtra('shipping_country_id')){
|
if($this->getShippingExtra('shipping_country_id')){
|
||||||
|
|
@ -32,20 +37,18 @@ class Yard extends Cart
|
||||||
|
|
||||||
if($this->shipping_country_id == 0){
|
if($this->shipping_country_id == 0){
|
||||||
$shippingCountry = ShippingCountry::first();
|
$shippingCountry = ShippingCountry::first();
|
||||||
$this->shipping_country_id = $shippingCountry->id;
|
if($shippingCountry){
|
||||||
|
$this->shipping_country_id = $shippingCountry->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($this->shipping == 0){
|
if($this->shipping_price == 0){
|
||||||
self::instance('shopping')->setShippingCountryWithPrice($this->shipping_country_id);
|
self::instance('shopping')->setShippingCountryWithPrice($this->shipping_country_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTaxRate()
|
public static function getTaxRate()
|
||||||
{
|
{
|
||||||
|
|
||||||
return config('cart.tax');
|
return config('cart.tax');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putShippingExtra($key, $value){
|
public function putShippingExtra($key, $value){
|
||||||
|
|
@ -53,7 +56,6 @@ class Yard extends Cart
|
||||||
$content = $this->getYContent();
|
$content = $this->getYContent();
|
||||||
$content->put($key, $value);
|
$content->put($key, $value);
|
||||||
$this->ysession->put($this->yinstance, $content);
|
$this->ysession->put($this->yinstance, $content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShippingExtra($key){
|
public function getShippingExtra($key){
|
||||||
|
|
@ -113,24 +115,26 @@ class Yard extends Cart
|
||||||
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
|
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
|
||||||
$shipping = $shippingCountry->shipping;
|
$shipping = $shippingCountry->shipping;
|
||||||
|
|
||||||
if(intval($this->weight()) == 0){
|
if($this->weight() == 0){
|
||||||
$price = $shipping->prices->first();
|
$shipping_price = $shipping->shipping_prices->first();
|
||||||
$price->price = 0;
|
$shipping_price->price = 0;
|
||||||
}else{
|
}else{
|
||||||
//first by price
|
//first by price
|
||||||
$price = $this->shippingPriceByTotal($shipping->prices, floatval($this->total(2, '.', ',')));
|
$shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', ''));
|
||||||
//sec by weight
|
//sec by weight
|
||||||
if(!$price){
|
if(!$shipping_price){
|
||||||
$price = $this->shippingPriceByWeight($shipping->prices, intval($this->weight()));
|
$shipping_price = $this->shippingPriceByWeight($shipping->shipping_prices, $this->weight());
|
||||||
}
|
}
|
||||||
//default
|
//default
|
||||||
if(!$price){
|
if(!$shipping_price){
|
||||||
$price = $shipping->prices->first();
|
$shipping_price = $shipping->shipping_prices->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($price){
|
if($shipping_price){
|
||||||
$this->shipping = floatval($price->price);
|
$this->shipping_price = $shipping_price->price;
|
||||||
$this->putShippingExtra('shipping_price', $this->shipping);
|
$this->shipping_tax = $shipping_price->tax_rate;
|
||||||
|
$this->putShippingExtra('shipping_price', $this->shipping_price);
|
||||||
|
$this->putShippingExtra('shipping_tax', $this->shipping_tax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,9 +159,6 @@ class Yard extends Cart
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $decimals
|
* @param null $decimals
|
||||||
* @param null $decimalPoint
|
* @param null $decimalPoint
|
||||||
|
|
@ -166,26 +167,24 @@ class Yard extends Cart
|
||||||
*/
|
*/
|
||||||
public function shipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
public function shipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||||
{
|
{
|
||||||
return $this->numberFormat($this->shipping, $decimals, $decimalPoint, $thousandSeperator);
|
return $this->numberFormat($this->shipping_price, $decimals, $decimalPoint, $thousandSeperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private function shippingTax($taxRate = -19){
|
private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null){
|
||||||
return ($this->shipping * ($taxRate / 100));
|
$shippingTax = $this->shipping_price / (100 + $this->shipping_tax) * $this->shipping_tax;
|
||||||
|
return $this->numberFormat($shippingTax, $decimals, $decimalPoint, $thousandSeperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function shippingSub($taxRate){
|
private function subShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null){
|
||||||
return ($this->shipping + $this->shippingTax($taxRate));
|
$subShipping = $this->shipping_price - $this->shippingTax($decimals, $decimalPoint, $thousandSeperator);
|
||||||
|
return $this->numberFormat($subShipping, $decimals, $decimalPoint, $thousandSeperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function subtotalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
public function subtotalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||||
{
|
{
|
||||||
$subtotal = $this->subtotal(2, '.', '') + $this->shipping;
|
$subtotal = $this->subtotal(2, '.', '') + $this->subShipping(2, '.', '');
|
||||||
//$taxRate =config('cart.tax');
|
|
||||||
/*$total = (float) ($this->total(2, '.', '')) + $this->shipping;
|
|
||||||
$totalTax = $total/ (100 + $taxRate) * $taxRate;*/
|
|
||||||
return $this->numberFormat($subtotal, $decimals, $decimalPoint, $thousandSeperator);
|
return $this->numberFormat($subtotal, $decimals, $decimalPoint, $thousandSeperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,21 +192,17 @@ class Yard extends Cart
|
||||||
public function taxWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
public function taxWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||||
{
|
{
|
||||||
$totalTax = $this->tax(2, '.', '');
|
$totalTax = $this->tax(2, '.', '');
|
||||||
/* $taxRate =config('cart.tax');
|
$shippingTax = $this->shippingTax(2, '.', '');
|
||||||
$total = (float) ($this->total(2, '.', '')) + $this->shipping;
|
return $this->numberFormat(($totalTax+$shippingTax), $decimals, $decimalPoint, $thousandSeperator);
|
||||||
$totalTax = $total/ (100 + $taxRate) * $taxRate; */
|
|
||||||
return $this->numberFormat($totalTax, $decimals, $decimalPoint, $thousandSeperator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function totalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
public function totalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||||
{
|
{
|
||||||
$total = (float) ($this->total(2, '.', '')) + $this->shipping;
|
$total = (float) ($this->total(2, '.', '')) + $this->shipping_price;
|
||||||
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
|
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total price of the items in the cart.
|
* Get the total price of the items in the cart.
|
||||||
*
|
*
|
||||||
|
|
@ -220,7 +215,7 @@ class Yard extends Cart
|
||||||
{
|
{
|
||||||
$content = $this->getContent();
|
$content = $this->getContent();
|
||||||
$total = $content->reduce(function ($total, CartItem $cartItem) {
|
$total = $content->reduce(function ($total, CartItem $cartItem) {
|
||||||
return $total + ($cartItem->options->weight ? intval($cartItem->options->weight*$cartItem->qty) : 0);
|
return $total + ($cartItem->options->weight ? ($cartItem->options->weight*$cartItem->qty) : 0);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'tax' => 19,
|
'tax' => 16,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class CreateShippingPricesTable extends Migration
|
||||||
$table->unsignedInteger('shipping_id');
|
$table->unsignedInteger('shipping_id');
|
||||||
|
|
||||||
$table->decimal('price', 8, 2)->nullable();
|
$table->decimal('price', 8, 2)->nullable();
|
||||||
$table->decimal('tax', 5, 2)->nullable();
|
$table->decimal('tax_rate', 5, 2)->nullable();
|
||||||
$table->decimal('factor', 5, 2)->nullable();
|
$table->decimal('factor', 5, 2)->nullable();
|
||||||
|
|
||||||
$table->decimal('total_from', 8, 2)->nullable();
|
$table->decimal('total_from', 8, 2)->nullable();
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class CreateShoppingOrderItemsTable extends Migration
|
||||||
$table->unsignedInteger('product_id');
|
$table->unsignedInteger('product_id');
|
||||||
$table->unsignedInteger('qty');
|
$table->unsignedInteger('qty');
|
||||||
$table->decimal('price', 8, 2)->nullable();
|
$table->decimal('price', 8, 2)->nullable();
|
||||||
|
$table->decimal('tax_rate', 5, 2)->nullable();
|
||||||
$table->string('slug')->nullable();
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
'checkout_mail_shipping' => 'Verpackungs- u. Versandkosten',
|
'checkout_mail_shipping' => 'Verpackungs- u. Versandkosten',
|
||||||
'checkout_mail_status_info' => 'Statusinfo:',
|
'checkout_mail_status_info' => 'Statusinfo:',
|
||||||
'checkout_mail_total' => 'Gesamtpreis',
|
'checkout_mail_total' => 'Gesamtpreis',
|
||||||
|
'checkout_mail_tax_info' => 'Preis inkl. MwSt',
|
||||||
'checkout_mail_pay_info' => 'Zahlungsinfo:',
|
'checkout_mail_pay_info' => 'Zahlungsinfo:',
|
||||||
'checkout_mail_pay_success' => 'Zahlung ist bestätigt!',
|
'checkout_mail_pay_success' => 'Zahlung ist bestätigt!',
|
||||||
'checkout_mail_pay_with' => 'Zahlung mit:',
|
'checkout_mail_pay_with' => 'Zahlung mit:',
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price"
|
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price"
|
||||||
data-id="{{ $price->id }}"
|
data-id="{{ $price->id }}"
|
||||||
data-price="{{ $price->getFormattedPrice() }}"
|
data-price="{{ $price->getFormattedPrice() }}"
|
||||||
data-tax="{{ $price->getFormattedTax() }}"
|
data-tax_rate="{{ $price->getFormattedTaxRate() }}"
|
||||||
data-factor="{{ $price->getFormattedFactor() }}"
|
data-factor="{{ $price->getFormattedFactor() }}"
|
||||||
data-total_from="{{ $price->getFormatTotalFrom() }}"
|
data-total_from="{{ $price->getFormatTotalFrom() }}"
|
||||||
data-total_to="{{ $price->getFormattedTotalTo() }}"
|
data-total_to="{{ $price->getFormattedTotalTo() }}"
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $price->getFormattedPrice() }}</td>
|
<td>{{ $price->getFormattedPrice() }}</td>
|
||||||
<td>{{ $price->getFormattedTax() }}</td>
|
<td>{{ $price->getFormattedTaxRate() }}</td>
|
||||||
<td>{{ $price->getFormatTotalFrom() }} - {{ $price->getFormattedTotalTo() }}</td>
|
<td>{{ $price->getFormatTotalFrom() }} - {{ $price->getFormattedTotalTo() }}</td>
|
||||||
<td>{{ $price->weight_from }} - {{ $price->weight_to }}</td>
|
<td>{{ $price->weight_from }} - {{ $price->weight_to }}</td>
|
||||||
<td><a class="text-danger" href="{{ route('admin_shipping_price_delete', [$price->id]) }}" onclick="return confirm('{{__('Really delete entry?')}}');"><i class="far fa-trash-alt"></i></a></td>
|
<td><a class="text-danger" href="{{ route('admin_shipping_price_delete', [$price->id]) }}" onclick="return confirm('{{__('Really delete entry?')}}');"><i class="far fa-trash-alt"></i></a></td>
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price"
|
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price"
|
||||||
data-id="new"
|
data-id="new"
|
||||||
data-price=""
|
data-price=""
|
||||||
data-tax=""
|
data-tax_rate=""
|
||||||
data-factor="1"
|
data-factor="1"
|
||||||
data-total_from=""
|
data-total_from=""
|
||||||
data-total_to=""
|
data-total_to=""
|
||||||
|
|
@ -139,8 +139,8 @@
|
||||||
<input type="text" class="form-control" name="price" placeholder="{{__('Preis in Euro')}}" required>
|
<input type="text" class="form-control" name="price" placeholder="{{__('Preis in Euro')}}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-6">
|
<div class="form-group col-6">
|
||||||
<label for="tax" class="form-label">{{__('enthaltene Tax (%)')}}</label>
|
<label for="tax_rate" class="form-label">{{__('enthaltene Tax (%)')}}</label>
|
||||||
<input type="text" class="form-control" name="tax" placeholder="{{__('Tax in %')}}">
|
<input type="text" class="form-control" name="tax_rate" placeholder="{{__('Tax in %')}}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -250,7 +250,7 @@
|
||||||
var button = $(event.relatedTarget);
|
var button = $(event.relatedTarget);
|
||||||
$(this).find(".modal-content input[name='id']").val(button.data('id'));
|
$(this).find(".modal-content input[name='id']").val(button.data('id'));
|
||||||
$(this).find(".modal-body input[name='price']").val(button.data('price'));
|
$(this).find(".modal-body input[name='price']").val(button.data('price'));
|
||||||
$(this).find(".modal-body input[name='tax']").val(button.data('tax'));
|
$(this).find(".modal-body input[name='tax_rate']").val(button.data('tax_rate'));
|
||||||
$(this).find(".modal-body input[name='factor']").val(button.data('factor'));
|
$(this).find(".modal-body input[name='factor']").val(button.data('factor'));
|
||||||
$(this).find(".modal-body input[name='total_from']").val(button.data('total_from'));
|
$(this).find(".modal-body input[name='total_from']").val(button.data('total_from'));
|
||||||
$(this).find(".modal-body input[name='total_to']").val(button.data('total_to'));
|
$(this).find(".modal-body input[name='total_to']").val(button.data('total_to'));
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order_item->product->name }}
|
{{ $shopping_order_item->product->name }}
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order_item->getFormattedPrice() }} EUR
|
{{ $shopping_order_item->getFormattedPrice() }} EUR
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
{{__('email.checkout_mail_shipping')}}
|
{{__('email.checkout_mail_shipping')}}
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order->getFormattedShipping() }} EUR
|
{{ $shopping_order->getFormattedShipping() }} EUR
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -196,8 +196,10 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
<b>{{__('email.checkout_mail_total')}}</b>
|
<b>{{__('email.checkout_mail_total')}}</b>
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
<b>{{ $shopping_order->getFormattedTotalShipping() }} EUR</b>
|
<b>{{ $shopping_order->getFormattedTotalShipping() }} EUR</b>
|
||||||
|
<br>
|
||||||
|
<span style="font-size: 0.8em">{{__('email.checkout_mail_tax_info')}}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order_item->product->name }}
|
{{ $shopping_order_item->product->name }}
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order_item->getFormattedPrice() }} EUR
|
{{ $shopping_order_item->getFormattedPrice() }} EUR
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -225,7 +225,7 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
{{__('email.checkout_mail_shipping')}}
|
{{__('email.checkout_mail_shipping')}}
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
{{ $shopping_order->getFormattedShipping() }} EUR
|
{{ $shopping_order->getFormattedShipping() }} EUR
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -241,8 +241,10 @@
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
||||||
<b>{{__('email.checkout_mail_total')}}</b>
|
<b>{{__('email.checkout_mail_total')}}</b>
|
||||||
</td>
|
</td>
|
||||||
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
|
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
|
||||||
<b>{{ $shopping_order->getFormattedTotalShipping() }} EUR</b>
|
<b>{{ $shopping_order->getFormattedTotalShipping() }} EUR</b>
|
||||||
|
<br>
|
||||||
|
<span style="font-size: 0.8em">{{__('email.checkout_mail_tax_info')}}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,6 @@
|
||||||
@foreach(Yard::instance('shopping')->content() as $row)
|
@foreach(Yard::instance('shopping')->content() as $row)
|
||||||
|
|
||||||
@php($product = \App\Models\Product::find($row->id))
|
@php($product = \App\Models\Product::find($row->id))
|
||||||
|
|
||||||
<tr class="item yard">
|
<tr class="item yard">
|
||||||
<td>
|
<td>
|
||||||
@if($row->options->has('image'))
|
@if($row->options->has('image'))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue