01 2022 Microsite Promotion

This commit is contained in:
Kevin Adametz 2022-01-18 18:30:14 +01:00
parent 3f1fb9377d
commit 38e7fd504a
39 changed files with 761 additions and 336 deletions

View file

@ -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';