Added Setup products to Preorder

This commit is contained in:
Frank Schubert
2022-05-17 15:28:16 +02:00
parent 117b56a301
commit e01f803fbb
7 changed files with 109 additions and 25 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ class Preorder extends mfBaseModel {
if($this->$name == null) {
if($name == "campaign") {
$this->campaign = new Preordercampaign($this->id);
$this->campaign = new Preordercampaign($this->preordercampaign_id);
return $this->campaign;
}
+2 -3
View File
@@ -45,7 +45,7 @@ class PreorderController extends mfBaseController {
if($filter['campaign_id']) {
$campaign_id = $filter['campaign_id'];
if(is_numeric($campaign_id) && $campaign_id > 0) {
$campaign = new Preordercampaign($campaign);
$campaign = new Preordercampaign($campaign_id);
$this->layout()->set("campaign", $campaign);
}
@@ -54,8 +54,6 @@ class PreorderController extends mfBaseController {
//var_dump($campaign_filter);exit;
$preorders = PreorderModel::search($campaign_filter);
$this->layout()->set("preorders", $preorders);
}
private function getPreparedFilter($filter) {
@@ -149,6 +147,7 @@ class PreorderController extends mfBaseController {
$data['building_id'] = $r->building_id;
$data['termination_id'] = ($r->termination_id) ? $r->termination_id : null;
$data['product_id'] = $r->product_id;
$data['setup_product_id'] = $r->setup_product_id;
switch($r->type) {
case "interest":
+1
View File
@@ -5,6 +5,7 @@ class PreorderModel {
public $building_id;
public $termination_id;
public $product_id;
public $setup_product_id;
public $type;
public $order_id;
public $price;
@@ -42,6 +42,13 @@ class Preordercampaign extends mfBaseModel {
}
public function getSetupProducts() {
$provisions = ProductModel::search(["attributename" => "presales", "attributevalue" => "provision"]);
$activations = ProductModel::search(["attributename" => "presales", "attributevalue" => "activation"]);
return ['activation' => $activations, 'provision' => $provisions];
}
public function getProperty($name) {
if($this->$name == null) {
@@ -58,8 +65,10 @@ class Preordercampaign extends mfBaseModel {
return $this->types;
}
if($name == "setup_products_provision") {
$products = ProductModel::search(["attributename" => "presales", "attributevalue" => "provision"]);
if($name == "setup_products") {
$this->setup_products = $this->getSetupProducts();
//var_dump($this->setup_products);exit;
return $this->setup_products;
}
if($name == "creator") {
+3 -2
View File
@@ -105,7 +105,8 @@ class ProductModel {
WHERE $where
GROUP BY Product.id";
$res = $db->select("Product", "*", "$where ORDER BY name, producttech_id");
$res = $db->query($sql);
//$res = $db->select("Product", "*", "$where ORDER BY name, producttech_id");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Product($data);
@@ -151,7 +152,7 @@ class ProductModel {
if(array_key_exists("attributename", $filter)) {
$attributename = $db->escape($filter['attributename']);
if($attributename) {
$where .= " AND ProductAttribute.name = '$attributename'";
$where .= " AND ProducttechAttribute.name = '$attributename'";
}
}