time-dependent-shopping-cart-price-rules - Version 1.0.2

Version Notes

Time dependent Shopping cart price rules

Download this release

Release Info

Developer Orange35
Extension time-dependent-shopping-cart-price-rules
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.2

app/code/community/Orange35/SalesruleTime/Model/Observer.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
  class Orange35_SalesruleTime_Model_Observer{
 
 
 
 
3
  public function adminhtmlPromoQuoteEditTabMainPrepareForm($observer){
4
  $form = $observer->getData("form");
5
  $fs = $form->getElement("base_fieldset");
@@ -14,4 +18,33 @@ class Orange35_SalesruleTime_Model_Observer{
14
  $model = Mage::registry('current_promo_quote_rule');
15
  $form->setValues($model->getData());
16
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
1
  <?php
2
  class Orange35_SalesruleTime_Model_Observer{
3
+
4
+ const DOWNLOAD_URL = 'https://orange35.com/download/core';
5
+ const MODULE_FULL_NAME = 'Time Dependent Shopping Cart Price Rules';
6
+
7
  public function adminhtmlPromoQuoteEditTabMainPrepareForm($observer){
8
  $form = $observer->getData("form");
9
  $fs = $form->getElement("base_fieldset");
18
  $model = Mage::registry('current_promo_quote_rule');
19
  $form->setValues($model->getData());
20
  }
21
+
22
+ public function checkRequiredModules()
23
+ {
24
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
25
+ $coreConfig = Mage::getConfig()->getModuleConfig('Orange35_Core');
26
+ if (empty($coreConfig) || !$coreConfig->is('active', 'true')) {
27
+ $notificationModel = Mage::getModel('adminnotification/inbox');
28
+ $title = self::MODULE_FULL_NAME. ' Installation Error.';
29
+ $notification = $notificationModel->getCollection()->addFieldToFilter('title', $title)
30
+ ->getFirstItem();
31
+ $notificationId = $notification->getData('notification_id');
32
+ if ($notificationId == null) {
33
+ $description = 'Important: Please setup Orange35 Core in order to finish <strong>'. self::MODULE_FULL_NAME .'</strong> installation.<br />
34
+ Please download <a href="' . self::DOWNLOAD_URL . '" target="_blank">Orange35 Core</a> and setup it via Magento Connect.<br />
35
+ Please refer to installation guide';
36
+ $data = array(
37
+ 'severity' => '4',
38
+ 'date_added' => date('Y-m-d H:i:s'),
39
+ 'title' => $title,
40
+ 'description' => $description,
41
+ 'is_read' => '0',
42
+ 'is_remove' => '0'
43
+ );
44
+ $notificationModel->setData($data);
45
+ $notificationModel->save();
46
+ }
47
+ }
48
+ }
49
+ }
50
  }
app/code/community/Orange35/SalesruleTime/Model/Rule/Rule.php CHANGED
@@ -36,4 +36,28 @@ class Orange35_SalesruleTime_Model_Rule_Rule extends Mage_Rule_Model_Rule {
36
 
37
  return $arr;
38
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
36
 
37
  return $arr;
38
  }
39
+
40
+ public function validateData(Varien_Object $object)
41
+ {
42
+ $result = parent::validateData($object);
43
+ $result = $result!= true ? $result : array();
44
+ $fromDate = $toDate = null;
45
+
46
+ if ($object->hasFromDate() && $object->hasToDate()) {
47
+ $fromDate = $object->getFromDate();
48
+ $toDate = $object->getToDate();
49
+ }
50
+
51
+ if ($fromDate && $toDate) {
52
+ $fromDate = new Zend_Date($fromDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
53
+ $toDate = new Zend_Date($toDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
54
+
55
+ if ($fromDate->compare($toDate) === 1) {
56
+ if (!in_array(Mage::helper('rule')->__('End Date must be greater than Start Date.'), $result)){
57
+ $result[] = Mage::helper('rule')->__('End Date must be greater than Start Date.');
58
+ }
59
+ }
60
+ }
61
+ return !empty($result) ? $result : true;
62
+ }
63
  }
app/code/community/Orange35/SalesruleTime/Model/SalesRule/Rule.php CHANGED
@@ -36,4 +36,28 @@ class Orange35_SalesruleTime_Model_SalesRule_Rule extends Mage_SalesRule_Model_R
36
 
37
  return $arr;
38
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
36
 
37
  return $arr;
38
  }
39
+
40
+ public function validateData(Varien_Object $object)
41
+ {
42
+ $result = parent::validateData($object);
43
+ $result = $result!= true ? $result : array();
44
+ $fromDate = $toDate = null;
45
+
46
+ if ($object->hasFromDate() && $object->hasToDate()) {
47
+ $fromDate = $object->getFromDate();
48
+ $toDate = $object->getToDate();
49
+ }
50
+
51
+ if ($fromDate && $toDate) {
52
+ $fromDate = new Zend_Date($fromDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
53
+ $toDate = new Zend_Date($toDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
54
+
55
+ if ($fromDate->compare($toDate) === 1) {
56
+ if (!in_array(Mage::helper('rule')->__('End Date must be greater than Start Date.'), $result)){
57
+ $result[] = Mage::helper('rule')->__('End Date must be greater than Start Date.');
58
+ }
59
+ }
60
+ }
61
+ return !empty($result) ? $result : true;
62
+ }
63
  }
app/code/community/Orange35/SalesruleTime/Model/SalesRule/svn-commit.2.tmp ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ issue MAGE-575
2
+ --This line, and those below, will be ignored--
3
+
4
+ M Rule.php
app/code/community/Orange35/SalesruleTime/Model/SalesRule/svn-commit.3.tmp ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ issue MAGE-575
2
+ --This line, and those below, will be ignored--
3
+
4
+ M Rule.php
app/code/community/Orange35/SalesruleTime/Model/SalesRule/svn-commit.tmp ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ MAGE-575
2
+ --This line, and those below, will be ignored--
3
+
4
+ M Rule.php
app/code/community/Orange35/SalesruleTime/controllers/Adminhtml/Promo/QuoteController.php CHANGED
@@ -50,7 +50,7 @@ class Orange35_SalesruleTime_Adminhtml_Promo_QuoteController extends Mage_Adminh
50
  if ($this->getRequest()->getPost()) {
51
  try {
52
  /** @var $model Mage_SalesRule_Model_Rule */
53
- $model = Mage::getModel('salesrule/rule');
54
  Mage::dispatchEvent(
55
  'adminhtml_controller_salesrule_prepare_save',
56
  array('request' => $this->getRequest()));
50
  if ($this->getRequest()->getPost()) {
51
  try {
52
  /** @var $model Mage_SalesRule_Model_Rule */
53
+ $model = Mage::getModel('orange35_salesruletime/salesRule_rule');
54
  Mage::dispatchEvent(
55
  'adminhtml_controller_salesrule_prepare_save',
56
  array('request' => $this->getRequest()));
app/code/community/Orange35/SalesruleTime/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Orange35_SalesruleTime>
5
- <version>1.0.0</version>
6
  </Orange35_SalesruleTime>
7
  </modules>
8
  <global>
@@ -55,6 +55,14 @@
55
  </orange35_salesruletime_quote_edit_tab_main_prepare_form>
56
  </observers>
57
  </adminhtml_promo_quote_edit_tab_main_prepare_form>
 
 
 
 
 
 
 
 
58
  </events>
59
  </adminhtml>
60
  <admin>
2
  <config>
3
  <modules>
4
  <Orange35_SalesruleTime>
5
+ <version>1.0.2</version>
6
  </Orange35_SalesruleTime>
7
  </modules>
8
  <global>
55
  </orange35_salesruletime_quote_edit_tab_main_prepare_form>
56
  </observers>
57
  </adminhtml_promo_quote_edit_tab_main_prepare_form>
58
+ <controller_action_predispatch>
59
+ <observers>
60
+ <orange35_salesruletime>
61
+ <class>Orange35_SalesruleTime_Model_Observer</class>
62
+ <method>checkRequiredModules</method>
63
+ </orange35_salesruletime>
64
+ </observers>
65
+ </controller_action_predispatch>
66
  </events>
67
  </adminhtml>
68
  <admin>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>time-dependent-shopping-cart-price-rules</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Time dependent Shopping cart price rules</description>
11
  <notes>Time dependent Shopping cart price rules</notes>
12
  <authors><author><name>Orange35</name><user>Orange35</user><email>support@orange35.com</email></author></authors>
13
- <date>2015-02-17</date>
14
- <time>15:41:18</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Orange35_SalesruleTime.xml" hash="4f18084f275960c82fa2d91cbd5641c2"/></dir></target><target name="magecommunity"><dir name="Orange35"><dir name="SalesruleTime"><dir name="Model"><file name="Observer.php" hash="688066f6312c42b5188c800b4d1e05df"/><dir name="Resource"><dir name="SalesRule"><dir name="Rule"><file name="Collection.php" hash="413bae8331063ec0eb59234b4e8ac653"/></dir></dir></dir><dir name="Rule"><file name="Rule.php" hash="1703742932c6a3a0c3ef835547b957bf"/></dir><dir name="SalesRule"><file name="Rule.php" hash="f95a9f7f1ae03bd2286a6d2a247ea97a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Promo"><file name="QuoteController.php" hash="454768fcf1c4179b69a23fcf79b6dc20"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="34eef31e21d39db596af3a23646dbccc"/></dir><dir name="sql"><dir name="orange35_salesruleTime_setup"><file name="install-1.0.0.php" hash="8680618998944226375b96d8abaa6f92"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>time-dependent-shopping-cart-price-rules</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
10
  <description>Time dependent Shopping cart price rules</description>
11
  <notes>Time dependent Shopping cart price rules</notes>
12
  <authors><author><name>Orange35</name><user>Orange35</user><email>support@orange35.com</email></author></authors>
13
+ <date>2015-05-12</date>
14
+ <time>07:33:06</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Orange35_SalesruleTime.xml" hash="4f18084f275960c82fa2d91cbd5641c2"/></dir></target><target name="magecommunity"><dir name="Orange35"><dir name="SalesruleTime"><dir name="Model"><file name="Observer.php" hash="5b4f0b1784f800897fd6fa860f3fecdb"/><dir name="Resource"><dir name="SalesRule"><dir name="Rule"><file name="Collection.php" hash="413bae8331063ec0eb59234b4e8ac653"/></dir></dir></dir><dir name="Rule"><file name="Rule.php" hash="f6208d35a98e057b6aeea8575b248353"/></dir><dir name="SalesRule"><file name="Rule.php" hash="a6d6b9bab1217248ea4b74af1a25c0e0"/><file name="svn-commit.2.tmp" hash="5fdbc5e60ef67fa6407099f7b2165822"/><file name="svn-commit.3.tmp" hash="5fdbc5e60ef67fa6407099f7b2165822"/><file name="svn-commit.tmp" hash="7f182b383e0e5db87d2f44c04f125e18"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Promo"><file name="QuoteController.php" hash="1e4f707f9be9f8323d7fe0b711241269"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="bf53f2119c72ff483d00389501d30951"/></dir><dir name="sql"><dir name="orange35_salesruleTime_setup"><file name="install-1.0.0.php" hash="8680618998944226375b96d8abaa6f92"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>