Browse code

Update

Benjamin Roth authored on20/03/2023 16:19:16
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,63 @@
1
+<?php
2
+
3
+/**
4
+ * Isotope eCommerce for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
7
+ *
8
+ * @package    Isotope
9
+ * @link       http://isotopeecommerce.org
10
+ * @license    http://opensource.org/licenses/lgpl-3.0.html
11
+ */
12
+
13
+namespace eSM_isotope_custom\Model;
14
+
15
+use Haste\Util\Url;
16
+
17
+/**
18
+ * Standard implementation of an Isotope product.
19
+ */
20
+class Standard extends \Isotope\Model\Product\Standard
21
+{
22
+  /**
23
+   * Generate url
24
+   *
25
+   * @param \PageModel $objJumpTo A PageModel instance
26
+   *
27
+   * @return string
28
+   *
29
+   * @throws \InvalidArgumentException
30
+   */
31
+  public function generateUrl(\PageModel $objJumpTo = null)
32
+  {
33
+    $strUrl = parent::generateUrl($objJumpTo);
34
+
35
+    if (\Input::get('isorc') !== null)
36
+    {
37
+      $strUrl = Url::addQueryString(
38
+        http_build_query(array('isorc' => \Input::get('isorc'))),
39
+        $strUrl
40
+      );
41
+    }
42
+    return $strUrl;
43
+  }
44
+
45
+  public function generate(array $arrConfig)
46
+  {
47
+
48
+    $arrButtons = array();
49
+    foreach ($arrConfig['buttons'] as $button)
50
+    {
51
+      if ($button == 'add_to_cart' && $this->not_buyable)
52
+      {
53
+        continue;
54
+      }
55
+      $arrButtons[] = $button;
56
+    }
57
+    $arrConfig['buttons'] = $arrButtons;
58
+
59
+    return parent::generate($arrConfig);
60
+  }
61
+
62
+
63
+}