Erweiterungen / Korrekturen Beraterbestellungen

This commit is contained in:
Kevin Adametz 2020-09-08 19:22:07 +02:00
parent ecc71c616f
commit c4ed6b39db
36 changed files with 1104 additions and 617 deletions

View file

@ -242,6 +242,14 @@ class HTMLHelper
return $ret;
}
public static function getCountryNameFormShipping($id){
$value = ShippingCountry::find($id);
if($value){
return $value->country->getLocated();
}
return "not defined";
}
public static function getCountriesForShipping($id, $all=false){#
$values = ShippingCountry::all();
$ret = "";

View file

@ -19,6 +19,7 @@ class Yard extends Cart
private $shipping_tax = 0;
private $shipping_country_id = 0; //default de
private $shipping_is_for;
private $num_comp;
private $ysession;
private $yinstance;
private $shopping_data = [];
@ -51,6 +52,10 @@ class Yard extends Cart
$this->shipping_is_for = $this->getYardExtra('shipping_is_for');
}
if($this->getYardExtra('num_comp')){
$this->num_comp = $this->getYardExtra('num_comp');
}
parent::__construct($session, $events);
@ -160,8 +165,10 @@ class Yard extends Cart
}
if($shipping_price){
$price = $shipping_price->price;
$this->num_comp = 0;
if($this->shipping_is_for === 'me'){
$price = $shipping_price->price_comp;
$this->num_comp = $shipping_price->num_comp;
}
$this->shipping_price = $price;
@ -169,6 +176,7 @@ class Yard extends Cart
$this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
$this->putYardExtra('num_comp', $this->num_comp);
$this->putYardExtra('shipping_price', $this->shipping_price);
$this->putYardExtra('shipping_tax_rate', $this->shipping_tax_rate);
$this->putYardExtra('shipping_tax', $this->shipping_tax);
@ -394,7 +402,33 @@ class Yard extends Cart
return $this->numberFormat(($price * $row->qty), $decimals, $decimalPoint, $thousandSeperator);
}
public function getNumComp(){
return $this->num_comp;
}
public function getCompProductBy($comp, $product_id=false){
foreach ($this->content() as $row) {
if($row->options->comp == $comp) {
return $row->options->product_id;
}
}
return false;
}
public function getContentByOrder(){
$ret = [];
$comp = [];
foreach ($this->content() as $row) {
if($row->options->comp){
$comp[100+$row->options->comp] = $row;
}else{
$ret[] = $row;
}
}
ksort($comp);
$ret = array_merge($ret, $comp);
return $ret;
}
/**
* Get the Formated number