Browse code

Update

Benjamin Roth authored on20/03/2023 16:19:16
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+<?php
2
+
3
+/**
4
+ * Isotope eCommerce for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2009-2016 terminal42 gmbh & Isotope eCommerce Workgroup
7
+ *
8
+ * @link       https://isotopeecommerce.org
9
+ * @license    https://opensource.org/licenses/lgpl-3.0.html
10
+ */
11
+
12
+namespace eSM_isotope_custom\Model;
13
+
14
+use Isotope\Interfaces\IsotopeProduct;
15
+use Isotope\Model\Rule;
16
+
17
+/**
18
+ * @property int    $id
19
+ * @property int    $tstamp
20
+ * @property string $type
21
+ * @property string $name
22
+ * @property string $label
23
+ * @property string $discount
24
+ * @property int    $tax_class
25
+ * @property string $applyTo
26
+ * @property string $rounding
27
+ * @property bool   $enableCode
28
+ * @property string $code
29
+ * @property int    $limitPerMember
30
+ * @property int    $limitPerConfig
31
+ * @property int    $minSubtotal
32
+ * @property int    $maxSubtotal
33
+ * @property string $minWeight
34
+ * @property string $maxWeight
35
+ * @property int    $minItemQuantity
36
+ * @property int    $maxItemQuantity
37
+ * @property string $quantityMode
38
+ * @property int    $startDate
39
+ * @property int    $endDate
40
+ * @property int    $startTime
41
+ * @property int    $endTime
42
+ * @property string $configRestrictions
43
+ * @property bool   $configCondition
44
+ * @property string $memberRestrictions
45
+ * @property bool   $memberCondition
46
+ * @property string $productRestrictions
47
+ * @property bool   $productCondition
48
+ * @property string $attributeName
49
+ * @property string $attributeCondition
50
+ * @property string $attributeValue
51
+ * @property bool   $enabled
52
+ */
53
+class AffentalerRule extends Rule
54
+{
55
+  public static function findByProduct(IsotopeProduct $objProduct, $strField, $fltPrice)
56
+  {
57
+      return static::findByConditions(array("type='affentaler'"), array(), array($objProduct), ($strField == 'low_price' ? true : false), array($strField => $fltPrice));
58
+  }
59
+
60
+  public static function findForCart($intId = null)
61
+  {
62
+    $arrProcedures = array("type='special'", "enableCode=''");
63
+
64
+    if (null === $intId) {
65
+      $arrProcedures[] = "groupOnly=''";
66
+    } else {
67
+      $arrProcedures[] = 'id='.(int)$intId;
68
+    }
69
+
70
+    return static::findByConditions($arrProcedures);
71
+  }
72
+}