Berater Bestellung / online
This commit is contained in:
parent
16fe2fa363
commit
ecc71c616f
26 changed files with 828 additions and 240 deletions
|
|
@ -83,18 +83,38 @@ class ShoppingOrder extends Model
|
|||
'country_id',
|
||||
'user_shop_id',
|
||||
'total',
|
||||
'shipping',
|
||||
'subtotal',
|
||||
//'tax_rate',
|
||||
'shipping',
|
||||
'shipping_net',
|
||||
'subtotal_ws',
|
||||
'tax',
|
||||
'total_shipping',
|
||||
'points',
|
||||
'weight',
|
||||
'paid',
|
||||
'txaction',
|
||||
'wp_invoice_path',
|
||||
'mode',
|
||||
'shipped',
|
||||
'tracking'
|
||||
];
|
||||
|
||||
public static $shippedTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'versendet',
|
||||
2 => 'abgeschlossen',
|
||||
4 => 'In Bearbeitung',
|
||||
|
||||
50 => 'storiniert'
|
||||
];
|
||||
|
||||
public static $shippedColors = [
|
||||
0 => 'warning',
|
||||
1 => 'success',
|
||||
2 => 'success',
|
||||
4 => 'info',
|
||||
50 => 'danger',
|
||||
];
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
|
|
@ -150,36 +170,63 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function _format_number($value)
|
||||
{
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
public function getLastShoppingPayment($key=false){
|
||||
$shopping_payment = $this->shopping_payments->last();
|
||||
if($shopping_payment){
|
||||
if($key === 'getPaymentType'){
|
||||
return $shopping_payment->getPaymentType();
|
||||
}
|
||||
if($key === 'reference'){
|
||||
return $shopping_payment->reference;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getShippedType(){
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : "";
|
||||
}
|
||||
|
||||
public function getShippedColor(){
|
||||
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
|
||||
}
|
||||
|
||||
public function getFormattedTotal()
|
||||
{
|
||||
return formatNumber($this->attributes['total']);
|
||||
}
|
||||
|
||||
public function getFormattedSubtotal()
|
||||
{
|
||||
return formatNumber($this->attributes['subtotal']);
|
||||
}
|
||||
|
||||
public function getFormattedShipping()
|
||||
{
|
||||
if (\App::getLocale() === "en") {
|
||||
return number_format($this->attributes['shipping'], 2, '.', ',');
|
||||
}
|
||||
return number_format($this->attributes['shipping'], 2, ',', '.');
|
||||
return formatNumber($this->attributes['shipping']);
|
||||
}
|
||||
|
||||
public function getFormattedShippingNet()
|
||||
{
|
||||
return formatNumber($this->attributes['shipping_net']);
|
||||
}
|
||||
|
||||
public function getFormattedSubtotalWs()
|
||||
{
|
||||
return formatNumber($this->attributes['subtotal_ws']);
|
||||
}
|
||||
|
||||
public function getFormattedTax()
|
||||
{
|
||||
return formatNumber($this->attributes['tax']);
|
||||
}
|
||||
|
||||
public function getFormattedTotalShipping()
|
||||
{
|
||||
if (\App::getLocale() === "en") {
|
||||
return number_format($this->attributes['total_shipping'], 2, '.', ',');
|
||||
}
|
||||
return number_format($this->attributes['total_shipping'], 2, ',', '.');
|
||||
return formatNumber($this->attributes['total_shipping']);
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedPrice()
|
||||
{
|
||||
if (\App::getLocale() === "en") {
|
||||
return number_format($this->attributes['price'], 2, '.', ',');
|
||||
}
|
||||
return number_format($this->attributes['price'], 2, ',', '.');
|
||||
}
|
||||
|
||||
|
||||
public function getItemsCount(){
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ class ShoppingOrderItem extends Model
|
|||
'product_id',
|
||||
'qty',
|
||||
'price',
|
||||
'price_net',
|
||||
'tax_rate',
|
||||
'slug',
|
||||
];
|
||||
|
|
@ -72,10 +73,22 @@ class ShoppingOrderItem extends Model
|
|||
|
||||
public function getFormattedPrice()
|
||||
{
|
||||
if (\App::getLocale() == "en") {
|
||||
return number_format($this->attributes['price'], 2, '.', ',');
|
||||
}
|
||||
return number_format($this->attributes['price'], 2, ',', '.');
|
||||
return formatNumber($this->attributes['price']);
|
||||
}
|
||||
|
||||
public function getFormattedTotalPrice()
|
||||
{
|
||||
return formatNumber($this->attributes['price'] * $this->attributes['qty']);
|
||||
}
|
||||
|
||||
public function getFormattedPriceNet()
|
||||
{
|
||||
return formatNumber($this->attributes['price_net']);
|
||||
}
|
||||
|
||||
public function getFormattedTotalPriceNet()
|
||||
{
|
||||
return formatNumber($this->attributes['price_net'] * $this->attributes['qty']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -130,6 +130,7 @@ class ShoppingUser extends Model
|
|||
'billing_phone',
|
||||
'billing_email',
|
||||
'faker_mail',
|
||||
'shipping_email',
|
||||
'accepted_data_checkbox',
|
||||
'same_as_billing',
|
||||
'shipping_salutation',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue