01 2022 Microsite Promotion
This commit is contained in:
parent
3f1fb9377d
commit
38e7fd504a
39 changed files with 761 additions and 336 deletions
|
|
@ -211,6 +211,19 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesOptionsByShowOn($ids = array(), $all = false, $show_on = []){
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.$all.'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductIngredientsOptions($has_ids = array(), $all = true){
|
||||
$values = Ingredient::where('active', 1)->get();
|
||||
$ret = "";
|
||||
|
|
@ -327,8 +340,20 @@ class HTMLHelper
|
|||
return "not defined";
|
||||
}
|
||||
|
||||
public static function getCountriesForShipping($id, $all=false){#
|
||||
public static function getCountriesForShipping($id, $all=false, $shipping_for = false){#
|
||||
$values = ShippingCountry::all();
|
||||
|
||||
if($shipping_for){
|
||||
$temp = [];
|
||||
foreach($values as $value){
|
||||
if($shipping = $value->shipping){
|
||||
if($shipping->getShippingPricesFirstBy($shipping_for)){
|
||||
$temp[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$values = $temp;
|
||||
}
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class PromotionCart
|
|||
{
|
||||
if($ShippingCountry = ShippingCountry::all()->first()){
|
||||
if($ShippingCountry->shipping){
|
||||
if($ShippingPrices = $ShippingCountry->shipping->getShippingPricesBy($shipping_for)->orderBy('price', 'ASC')->first()){
|
||||
if($ShippingPrices = $ShippingCountry->shipping->getShippingPricesFirstBy($shipping_for)){
|
||||
return formatNumber($ShippingPrices->price);
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,18 @@ class PromotionCart
|
|||
|
||||
}
|
||||
|
||||
public static function changeStateShipping($data)
|
||||
{
|
||||
$id = 1;
|
||||
if($ShippingCountry = ShippingCountry::find($data['shipping_country_id'])){
|
||||
$id = $ShippingCountry->id;
|
||||
}
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($id, 'shop');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function updateProduct($data, $add=false)
|
||||
{
|
||||
if($product = Product::find($data['product_id'])){
|
||||
|
|
@ -100,7 +112,8 @@ class PromotionCart
|
|||
[
|
||||
'image' => $image,
|
||||
'slug' => $product->slug,
|
||||
'weight' => $product->weight,
|
||||
//'weight' => $product->weight,
|
||||
'weight' => 1,
|
||||
'free_product_id' => intval($data['free_product_id']),
|
||||
'product_id' => $product->id
|
||||
]);
|
||||
|
|
|
|||
53
app/Services/Type.php
Normal file
53
app/Services/Type.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
|
||||
|
||||
|
||||
class Type
|
||||
{
|
||||
public static $showATs = [
|
||||
0 => 'Nur Kunden Bestellungen',
|
||||
1 => 'Kunden + Vertriebspartner Bestellungen',
|
||||
2 => 'Nur Vertriebspartner Bestellungen',
|
||||
3 => 'Registrierung / Mitgliedschaft Vertriebspartner',
|
||||
4 => 'Nur Mitgliedschaft Vertriebspartner',
|
||||
//5 => 'Onboarding Vertriebspartner',
|
||||
//6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop',
|
||||
7 => 'zur internen Berechnung',
|
||||
|
||||
];
|
||||
|
||||
public static $showONs = [
|
||||
1 => 'Kunden Bestellungen',
|
||||
2 => 'Vertriebspartner Bestellungen',
|
||||
3 => 'Microsite',
|
||||
4 => 'Registrierung Vertriebspartner',
|
||||
5 => 'Mitgliedschaft Vertriebspartner',
|
||||
//6 => 'Onboarding Berater',
|
||||
10 => 'zur internen Berechnung',
|
||||
];
|
||||
|
||||
|
||||
public static $payShowATs = [
|
||||
0 => 'Nur Kunden Shop',
|
||||
1 => 'Nur Vertriebspartner Shop',
|
||||
2 => 'Kunden + Vertriebspartner Shop',
|
||||
3 => 'Nur Reg/Mitgliedschaft Vertriebspartner',
|
||||
4 => 'Kunden + Vertriebspartner Shop + Reg/Mitgliedschaft',
|
||||
5 => 'Vertriebspartner Shop + Reg/Mitgliedschaft',
|
||||
9 => 'überall',
|
||||
];
|
||||
|
||||
public static $payShowONs = [
|
||||
1 => 'Kunden Bestellungen',
|
||||
2 => 'Vertriebspartner Bestellungen',
|
||||
3 => 'Microsite',
|
||||
4 => 'Registrierung Vertriebspartner',
|
||||
5 => 'Mitgliedschaft Vertriebspartner',
|
||||
//6 => 'Onboarding Berater',
|
||||
10 => 'überall',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -181,7 +181,6 @@ class Yard extends Cart
|
|||
return $this->shipping_country_id;
|
||||
}
|
||||
|
||||
|
||||
public function getYContent()
|
||||
{
|
||||
if (is_null($this->ysession->get($this->yinstance))) {
|
||||
|
|
@ -366,11 +365,14 @@ class Yard extends Cart
|
|||
//sec by weight
|
||||
if(!$shipping_price){
|
||||
$shipping_price = $this->shippingPriceByWeight($shipping->getShippingPricesBy($shipping_price_for), $this->weight());
|
||||
|
||||
|
||||
}
|
||||
//default
|
||||
if(!$shipping_price){
|
||||
$shipping_price = $shipping->getShippingPricesBy($shipping_price_for)->first();
|
||||
}
|
||||
|
||||
}
|
||||
if($shipping_price){
|
||||
$price = $shipping_price->price;
|
||||
|
|
@ -443,7 +445,6 @@ class Yard extends Cart
|
|||
private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||
{
|
||||
return $this->numberFormat($this->shipping_tax, $decimals, $decimalPoint, $thousandSeperator);
|
||||
|
||||
}
|
||||
|
||||
/* private function subShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue