Fraisr - Version 0.4.4

Version Notes

* Bugfixes

Download this release

Release Info

Developer Andre Herrn
Extension Fraisr
Version 0.4.4
Comparing to
See all releases


Code changes from version 0.4.3 to 0.4.4

Files changed (25) hide show
  1. app/code/community/Fraisr/Connect/Block/Adminhtml/Log.php +8 -4
  2. app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit.php +3 -2
  3. app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit/Form.php +8 -6
  4. app/code/community/Fraisr/Connect/Block/Adminhtml/System/Config/Support.php +0 -1
  5. app/code/community/Fraisr/Connect/Exception.php +3 -2
  6. app/code/community/Fraisr/Connect/Helper/Adminhtml/Data.php +2 -2
  7. app/code/community/Fraisr/Connect/Model/Api/Exception.php +3 -2
  8. app/code/community/Fraisr/Connect/Model/Api/Request.php +3 -3
  9. app/code/community/Fraisr/Connect/Model/Api/Response.php +4 -4
  10. app/code/community/Fraisr/Connect/Model/Cause.php +7 -3
  11. app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Category.php +56 -6
  12. app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Cause.php +2 -4
  13. app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/DonationPercentage.php +5 -6
  14. app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Visibility.php +5 -7
  15. app/code/community/Fraisr/Connect/Model/Observer.php +41 -22
  16. app/code/community/Fraisr/Connect/Model/Order.php +24 -24
  17. app/code/community/Fraisr/Connect/Model/Product.php +31 -28
  18. app/code/community/Fraisr/Connect/Model/Resource/Setup.php +3 -2
  19. app/code/community/Fraisr/Connect/controllers/AbstractController.php +16 -10
  20. app/code/community/Fraisr/Connect/controllers/Adminhtml/SynchronisationController.php +8 -20
  21. app/code/community/Fraisr/Connect/controllers/OrdersController.php +4 -5
  22. app/code/community/Fraisr/Connect/etc/config.xml +3 -2
  23. app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.2-0.1.3.php +4 -2
  24. app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.4-0.3.5.php +2 -1
  25. package.xml +5 -6
app/code/community/Fraisr/Connect/Block/Adminhtml/Log.php CHANGED
@@ -54,30 +54,34 @@ class Fraisr_Connect_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Gri
54
  $this->_removeButton('add');
55
 
56
  //Add cause sync button
 
57
  $this->_addButton('cause_synchronisation', array(
58
  'label' => $helper->__('Synchronize causes'),
59
- 'onclick' => 'setLocation(\'' . $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/cause') .'\')',
60
  'class' => 'add',
61
  ));
62
 
63
  //Add category sync button
 
64
  $this->_addButton('category_synchronisation', array(
65
  'label' => $helper->__('Synchronize categories'),
66
- 'onclick' => 'setLocation(\'' . $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/category') .'\')',
67
  'class' => 'add',
68
  ));
69
 
70
  //Add mark products to sync button
 
71
  $this->_addButton('product_mark_to_synchronisation', array(
72
  'label' => $helper->__('Mark products as to synchronize'),
73
- 'onclick' => 'setLocation(\'' . $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/markProduct') .'\')',
74
  'class' => 'add',
75
  ));
76
 
77
  //Add product sync button
 
78
  $this->_addButton('product_synchronisation', array(
79
  'label' => $helper->__('Synchronize products'),
80
- 'onclick' => 'setLocation(\'' . $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/product') .'\')',
81
  'class' => 'add',
82
  ));
83
 
54
  $this->_removeButton('add');
55
 
56
  //Add cause sync button
57
+ $url = $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/cause');
58
  $this->_addButton('cause_synchronisation', array(
59
  'label' => $helper->__('Synchronize causes'),
60
+ 'onclick' => 'setLocation(\'' . $url .'\')',
61
  'class' => 'add',
62
  ));
63
 
64
  //Add category sync button
65
+ $url = $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/category');
66
  $this->_addButton('category_synchronisation', array(
67
  'label' => $helper->__('Synchronize categories'),
68
+ 'onclick' => 'setLocation(\'' . $url . '\')',
69
  'class' => 'add',
70
  ));
71
 
72
  //Add mark products to sync button
73
+ $url = $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/markProduct');
74
  $this->_addButton('product_mark_to_synchronisation', array(
75
  'label' => $helper->__('Mark products as to synchronize'),
76
+ 'onclick' => 'setLocation(\'' . $url . '\')',
77
  'class' => 'add',
78
  ));
79
 
80
  //Add product sync button
81
+ $url = $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/product');
82
  $this->_addButton('product_synchronisation', array(
83
  'label' => $helper->__('Synchronize products'),
84
+ 'onclick' => 'setLocation(\'' . $url .'\')',
85
  'class' => 'add',
86
  ));
87
 
app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit.php CHANGED
@@ -39,14 +39,15 @@ class Fraisr_Connect_Block_Adminhtml_Log_Edit extends Mage_Adminhtml_Block_Widge
39
  $this->_controller = 'adminhtml_log';
40
 
41
  //Add Log Entry to Session
42
- if( $this->getRequest()->getParam($this->_objectId) ) {
43
  $formData = Mage::getModel('fraisrconnect/log')
44
  ->load($this->getRequest()->getParam($this->_objectId));
45
 
46
  Mage::register('current_fraisrlog', $formData);
47
  }
48
 
49
- //Remove reset, save and delete button -> Not necessary because we only want to show the log details (not edit them)
 
50
  $this->_removeButton('reset');
51
  $this->_removeButton('save');
52
  $this->_removeButton('delete');
39
  $this->_controller = 'adminhtml_log';
40
 
41
  //Add Log Entry to Session
42
+ if ($this->getRequest()->getParam($this->_objectId)) {
43
  $formData = Mage::getModel('fraisrconnect/log')
44
  ->load($this->getRequest()->getParam($this->_objectId));
45
 
46
  Mage::register('current_fraisrlog', $formData);
47
  }
48
 
49
+ //Remove reset, save and delete button
50
+ //-> Not necessary because we only want to show the log details (not edit them)
51
  $this->_removeButton('reset');
52
  $this->_removeButton('save');
53
  $this->_removeButton('delete');
app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit/Form.php CHANGED
@@ -104,12 +104,14 @@ class Fraisr_Connect_Block_Adminhtml_Log_Edit_Form extends Mage_Adminhtml_Block_
104
 
105
  $form->setValues(Mage::registry('current_fraisrlog')->getData());
106
 
107
- if ($logData['created_at']!="") $form->getElement('created_at')->setValue(
108
- Mage::app()->getLocale()->date(
109
- $logData['created_at'],
110
- Varien_Date::DATETIME_INTERNAL_FORMAT
111
- )
112
- );
 
 
113
 
114
  $this->setForm($form);
115
  return parent::_prepareForm();
104
 
105
  $form->setValues(Mage::registry('current_fraisrlog')->getData());
106
 
107
+ if ($logData['created_at']!="") {
108
+ $form->getElement('created_at')->setValue(
109
+ Mage::app()->getLocale()->date(
110
+ $logData['created_at'],
111
+ Varien_Date::DATETIME_INTERNAL_FORMAT
112
+ )
113
+ );
114
+ }
115
 
116
  $this->setForm($form);
117
  return parent::_prepareForm();
app/code/community/Fraisr/Connect/Block/Adminhtml/System/Config/Support.php CHANGED
@@ -40,7 +40,6 @@ class Fraisr_Connect_Block_Adminhtml_System_Config_Support
40
  */
41
  public function render(Varien_Data_Form_Element_Abstract $fieldset)
42
  {
43
- $originalData = $fieldset->getOriginalData();
44
  $this->addData(array(
45
  'fieldset_label' => $fieldset->getLegend(),
46
  ));
40
  */
41
  public function render(Varien_Data_Form_Element_Abstract $fieldset)
42
  {
 
43
  $this->addData(array(
44
  'fieldset_label' => $fieldset->getLegend(),
45
  ));
app/code/community/Fraisr/Connect/Exception.php CHANGED
@@ -22,5 +22,6 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Exception extends Exception
26
- { }
 
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Exception extends Exception {
26
+
27
+ }
app/code/community/Fraisr/Connect/Helper/Adminhtml/Data.php CHANGED
@@ -31,7 +31,7 @@ class Fraisr_Connect_Helper_Adminhtml_Data extends Fraisr_Connect_Helper_Data
31
  * @param string $task
32
  * @return void
33
  */
34
- public function logAndAdminOutputException($message, $task = '', Exception $e)
35
  {
36
  //Add admin error message
37
  Mage::getSingleton('adminhtml/session')->addError($message);
@@ -40,7 +40,7 @@ class Fraisr_Connect_Helper_Adminhtml_Data extends Fraisr_Connect_Helper_Data
40
  Mage::getModel('fraisrconnect/log')
41
  ->setTitle($message)
42
  ->setTask($task)
43
- ->setAdditionalInformation1($e->getTraceAsString())
44
  ->logError();
45
  }
46
 
31
  * @param string $task
32
  * @return void
33
  */
34
+ public function logAndAdminOutputException($message, $task = '', Exception $error)
35
  {
36
  //Add admin error message
37
  Mage::getSingleton('adminhtml/session')->addError($message);
40
  Mage::getModel('fraisrconnect/log')
41
  ->setTitle($message)
42
  ->setTask($task)
43
+ ->setAdditionalInformation1($error->getTraceAsString())
44
  ->logError();
45
  }
46
 
app/code/community/Fraisr/Connect/Model/Api/Exception.php CHANGED
@@ -22,5 +22,6 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Api_Exception extends Zend_Http_Client_Adapter_Exception
26
- { }
 
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Api_Exception extends Zend_Http_Client_Adapter_Exception {
26
+
27
+ }
app/code/community/Fraisr/Connect/Model/Api/Request.php CHANGED
@@ -58,7 +58,7 @@ class Fraisr_Connect_Model_Api_Request extends Zend_Http_Client
58
  * Paginated data
59
  * @var array
60
  */
61
- protected $paginateData = array();
62
 
63
  /**
64
  * Workarround to avoid Mage::getModel passed wrong/unwanted parameters to Zend_Http_Client
@@ -113,13 +113,13 @@ class Fraisr_Connect_Model_Api_Request extends Zend_Http_Client
113
  ->validateGet();
114
 
115
  //Set result data
116
- $this->paginateData = array_merge($this->paginateData, $responseHandler->getJsonResponseData());
117
 
118
  //If there is a next page let's run the request again
119
  if (true === $responseHandler->isPaginateNextPage()) {
120
  $this->requestPaginatedGet($taskApiUri, $page+1);
121
  }
122
- return $this->paginateData;
123
  }
124
 
125
  /**
58
  * Paginated data
59
  * @var array
60
  */
61
+ protected $_paginateData = array();
62
 
63
  /**
64
  * Workarround to avoid Mage::getModel passed wrong/unwanted parameters to Zend_Http_Client
113
  ->validateGet();
114
 
115
  //Set result data
116
+ $this->_paginateData = array_merge($this->_paginateData, $responseHandler->getJsonResponseData());
117
 
118
  //If there is a next page let's run the request again
119
  if (true === $responseHandler->isPaginateNextPage()) {
120
  $this->requestPaginatedGet($taskApiUri, $page+1);
121
  }
122
+ return $this->_paginateData;
123
  }
124
 
125
  /**
app/code/community/Fraisr/Connect/Model/Api/Response.php CHANGED
@@ -35,7 +35,7 @@ class Fraisr_Connect_Model_Api_Response
35
  *
36
  * @var array
37
  */
38
- protected $allowedHttpStatusCodes = array(200);
39
 
40
  /**
41
  * Validate GET response
@@ -116,7 +116,7 @@ class Fraisr_Connect_Model_Api_Response
116
  );
117
  }
118
 
119
- if (false === in_array($this->response->getStatus(), $this->allowedHttpStatusCodes)) {
120
  $fraisrErrorMessage = '';
121
  $jsonData = Zend_Json::decode($this->response->getBody());
122
  if (true === is_array($jsonData)
@@ -132,7 +132,7 @@ class Fraisr_Connect_Model_Api_Response
132
  $helper->__(
133
  'Api response code is "%s" instead of "%s".',
134
  $this->response->getStatus(),
135
- implode(',', $this->allowedHttpStatusCodes)
136
  ).$fraisrErrorMessage,
137
  $this->response->getStatus()
138
  );
@@ -189,7 +189,7 @@ class Fraisr_Connect_Model_Api_Response
189
  */
190
  public function setAllowedHttpStatusCodes($statusCodes)
191
  {
192
- $this->allowedHttpStatusCodes = $statusCodes;
193
  return $this;
194
  }
195
  }
35
  *
36
  * @var array
37
  */
38
+ protected $_allowedHttpStatusCodes = array(200);
39
 
40
  /**
41
  * Validate GET response
116
  );
117
  }
118
 
119
+ if (false === in_array($this->response->getStatus(), $this->_allowedHttpStatusCodes)) {
120
  $fraisrErrorMessage = '';
121
  $jsonData = Zend_Json::decode($this->response->getBody());
122
  if (true === is_array($jsonData)
132
  $helper->__(
133
  'Api response code is "%s" instead of "%s".',
134
  $this->response->getStatus(),
135
+ implode(',', $this->_allowedHttpStatusCodes)
136
  ).$fraisrErrorMessage,
137
  $this->response->getStatus()
138
  );
189
  */
190
  public function setAllowedHttpStatusCodes($statusCodes)
191
  {
192
+ $this->_allowedHttpStatusCodes = $statusCodes;
193
  return $this;
194
  }
195
  }
app/code/community/Fraisr/Connect/Model/Cause.php CHANGED
@@ -184,8 +184,10 @@ class Fraisr_Connect_Model_Cause extends Mage_Core_Model_Abstract
184
  //If causeIds were given, add them as filter
185
  if (count($causeIds) > 0) {
186
  $products
187
- ->addFieldToFilter('fraisr_cause', array('notnull' => true)) //fraisr_cause is not null -> has values
188
- ->addFieldToFilter('fraisr_cause', array('nin' => $causeIds)); //fraisr_cause is non of the current causes
 
 
189
  }
190
  return $products;
191
  }
@@ -210,7 +212,9 @@ class Fraisr_Connect_Model_Cause extends Mage_Core_Model_Abstract
210
 
211
  $helper->logAndAdminOutputNotice(
212
  $helper->__(
213
- 'Set "Fraisr enabled" to "No" for %s products because their cause is not available anymore. Skus: "%s". In case of questions please the contact fraisr support.',
 
 
214
  count($disabledSkus),
215
  implode(',', $disabledSkus)
216
  ),
184
  //If causeIds were given, add them as filter
185
  if (count($causeIds) > 0) {
186
  $products
187
+ //fraisr_cause is not null -> has values
188
+ ->addFieldToFilter('fraisr_cause', array('notnull' => true))
189
+ //fraisr_cause is non of the current causes
190
+ ->addFieldToFilter('fraisr_cause', array('nin' => $causeIds));
191
  }
192
  return $products;
193
  }
212
 
213
  $helper->logAndAdminOutputNotice(
214
  $helper->__(
215
+ 'Set "Fraisr enabled" to "No" for %s products because ' .
216
+ 'their cause is not available anymore. Skus: "%s". ' .
217
+ 'In case of questions please the contact fraisr support.',
218
  count($disabledSkus),
219
  implode(',', $disabledSkus)
220
  ),
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Category.php CHANGED
@@ -22,10 +22,8 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Entity_Attribute_Source_Category
26
- extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
27
- {
28
- /**
29
  * @const FRAISR_CATEGORY_DEFAULT Default category value
30
  */
31
  const FRAISR_CATEGORY_DEFAULT = '';
@@ -46,6 +44,7 @@ class Fraisr_Connect_Model_Entity_Attribute_Source_Category
46
  );
47
 
48
  $categoryCollection = Mage::getModel('fraisrconnect/category')->getCollection();
 
49
  //If no categories exist, add a notice that categories have to be synched
50
  if (true === Mage::getModel('fraisrconnect/config')->isActive()
51
  && $categoryCollection->count() === 0) {
@@ -54,6 +53,17 @@ class Fraisr_Connect_Model_Entity_Attribute_Source_Category
54
  );
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
57
  //For every synched category => create a select option
58
  foreach ($categoryCollection as $category) {
59
  //Parent product -> Just create an optgroup option
@@ -62,7 +72,30 @@ class Fraisr_Connect_Model_Entity_Attribute_Source_Category
62
  'label' => $category->getName(),
63
  'value' => array(),
64
  );
65
- } else { //Create a real selectable value for the category children
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  $label = $category->getName();
67
 
68
  //Add label in brackets if existing
@@ -70,7 +103,24 @@ class Fraisr_Connect_Model_Entity_Attribute_Source_Category
70
  $label .= ' ('.$category->getLabel().')';
71
  }
72
 
73
- $this->_options[$category->getParentId()]['value'][] = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  'label' => $label,
75
  'value' => $category->getId(),
76
  );
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Entity_Attribute_Source_Category extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
26
+ /**
 
 
27
  * @const FRAISR_CATEGORY_DEFAULT Default category value
28
  */
29
  const FRAISR_CATEGORY_DEFAULT = '';
44
  );
45
 
46
  $categoryCollection = Mage::getModel('fraisrconnect/category')->getCollection();
47
+
48
  //If no categories exist, add a notice that categories have to be synched
49
  if (true === Mage::getModel('fraisrconnect/config')->isActive()
50
  && $categoryCollection->count() === 0) {
53
  );
54
  }
55
 
56
+ $isParent = array();
57
+ $parent = array();
58
+ foreach ($categoryCollection as $category) {
59
+ $parent[$category->getId()] = $category->getParentId();
60
+ if (true === is_null($category->getParentId())) {
61
+ $isParent[$category->getId()] = true;
62
+ } else {
63
+ $isParent[$category->getParentId()] = true;
64
+ }
65
+ }
66
+
67
  //For every synched category => create a select option
68
  foreach ($categoryCollection as $category) {
69
  //Parent product -> Just create an optgroup option
72
  'label' => $category->getName(),
73
  'value' => array(),
74
  );
75
+ } elseif (array_key_exists($category->getId(), $isParent)) {
76
+ $label = $category->getName();
77
+ $parents = array();
78
+ $p = $category->getId();
79
+ $o = &$this->_options;
80
+ $i = 0;
81
+
82
+ while(($p = $parent[$p]) !== null){
83
+ array_unshift($parents, $p);
84
+ $i++;
85
+ }
86
+
87
+ foreach ($parents AS $c => $p) {
88
+ if($c + 1 == $i){
89
+ $label = $o[$p]["label"] . " / " . $label;
90
+ }
91
+ $o = &$o[$p]["value"];
92
+ }
93
+
94
+ $o[$category->getId()] = array(
95
+ 'label' => $label,
96
+ 'value' => array(),
97
+ );
98
+ } else {
99
  $label = $category->getName();
100
 
101
  //Add label in brackets if existing
103
  $label .= ' ('.$category->getLabel().')';
104
  }
105
 
106
+ $parents = array();
107
+ $p = $category->getId();
108
+ $o = &$this->_options;
109
+ $i = 0;
110
+
111
+ while(($p = $parent[$p]) !== null){
112
+ array_unshift($parents, $p);
113
+ $i++;
114
+ }
115
+
116
+ foreach ($parents AS $c => $p) {
117
+ if($c + 1 == $i){
118
+ $label = $o[$p]["label"] . " / " . $label;
119
+ }
120
+ $o = &$o[$p]["value"];
121
+ }
122
+
123
+ $o[] = array(
124
  'label' => $label,
125
  'value' => $category->getId(),
126
  );
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Cause.php CHANGED
@@ -22,10 +22,8 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Entity_Attribute_Source_Cause
26
- extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
27
- {
28
- /**
29
  * @const FRAISR_CAUSE_DEFAULT Default case value
30
  */
31
  const FRAISR_CAUSE_DEFAULT = '';
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Entity_Attribute_Source_Cause extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
26
+ /**
 
 
27
  * @const FRAISR_CAUSE_DEFAULT Default case value
28
  */
29
  const FRAISR_CAUSE_DEFAULT = '';
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/DonationPercentage.php CHANGED
@@ -22,19 +22,18 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Entity_Attribute_Source_DonationPercentage
26
- extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
27
- {
28
  /**
29
  * Allowed donation percentages
30
  *
31
  * @var array
32
  */
33
- protected $donationPercentages = array(
34
  5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100
35
  );
36
 
37
- /**
38
  * @const FRAISR_DONATION_PERCENTAGE_DEFAULT Default donation value
39
  */
40
  const FRAISR_DONATION_PERCENTAGE_DEFAULT = '';
@@ -55,7 +54,7 @@ class Fraisr_Connect_Model_Entity_Attribute_Source_DonationPercentage
55
  );
56
 
57
  //For every defined percentage => create a select option
58
- foreach ($this->donationPercentages as $percentage) {
59
  $this->_options[] = array(
60
  'label' => Mage::helper('fraisrconnect/data')->__('%s %s', $percentage, '%'),
61
  'value' => $percentage,
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Entity_Attribute_Source_DonationPercentage
26
+ extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
 
27
  /**
28
  * Allowed donation percentages
29
  *
30
  * @var array
31
  */
32
+ protected $_donationPercentages = array(
33
  5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100
34
  );
35
 
36
+ /**
37
  * @const FRAISR_DONATION_PERCENTAGE_DEFAULT Default donation value
38
  */
39
  const FRAISR_DONATION_PERCENTAGE_DEFAULT = '';
54
  );
55
 
56
  //For every defined percentage => create a select option
57
+ foreach ($this->_donationPercentages as $percentage) {
58
  $this->_options[] = array(
59
  'label' => Mage::helper('fraisrconnect/data')->__('%s %s', $percentage, '%'),
60
  'value' => $percentage,
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Visibility.php CHANGED
@@ -22,25 +22,23 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Entity_Attribute_Source_Visibility
26
- extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
27
- {
28
- /**
29
  * @const FRAISR_VISIBILITY_KEY Translation prefix constant
30
  */
31
  const FRAISR_VISIBILITY_KEY = 'visibility_';
32
 
33
- /**
34
  * @const FRAISR_VISIBILITY_BOTH Visible in fraisr and in the shop
35
  */
36
  const FRAISR_VISIBILITY_BOTH = 'both';
37
 
38
- /**
39
  * @const FRAISR_VISIBILITY_SHOP Visible in the shop only
40
  */
41
  const FRAISR_VISIBILITY_SHOP = 'shop';
42
 
43
- /**
44
  * @const FRAISR_VISIBILITY_FRAISR Visible in fraisr only
45
  */
46
  const FRAISR_VISIBILITY_FRAISR = 'fraisr';
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Entity_Attribute_Source_Visibility extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
26
+ /**
 
 
27
  * @const FRAISR_VISIBILITY_KEY Translation prefix constant
28
  */
29
  const FRAISR_VISIBILITY_KEY = 'visibility_';
30
 
31
+ /**
32
  * @const FRAISR_VISIBILITY_BOTH Visible in fraisr and in the shop
33
  */
34
  const FRAISR_VISIBILITY_BOTH = 'both';
35
 
36
+ /**
37
  * @const FRAISR_VISIBILITY_SHOP Visible in the shop only
38
  */
39
  const FRAISR_VISIBILITY_SHOP = 'shop';
40
 
41
+ /**
42
  * @const FRAISR_VISIBILITY_FRAISR Visible in fraisr only
43
  */
44
  const FRAISR_VISIBILITY_FRAISR = 'fraisr';
app/code/community/Fraisr/Connect/Model/Observer.php CHANGED
@@ -44,12 +44,13 @@ class Fraisr_Connect_Model_Observer
44
  $websites = Mage::app()->getWebsites();
45
  $code = $websites[1]->getDefaultStore()->getCode();
46
 
47
- if(($store = Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId()) !== 0){
48
  $code = Mage::app()->getStore($store)->getCode();
49
  }
50
 
51
- if($code === $this->_currentStoreCode)
52
  return;
 
53
 
54
  Mage::app()->setCurrentStore($code);
55
  }
@@ -130,7 +131,9 @@ class Fraisr_Connect_Model_Observer
130
 
131
  //Log about adding a next cronjob task
132
  $logTitle = Mage::helper('fraisrconnect/data')->__(
133
- 'Not all products have been synchronized because of a transmission error or a script timeout. Therefore another cron task was added for GMT-Datetime %s.',
 
 
134
  $cronTask->getScheduledAt()
135
  );
136
  Mage::getModel('fraisrconnect/log')
@@ -141,7 +144,8 @@ class Fraisr_Connect_Model_Observer
141
  } catch (Exception $e) {
142
  //Log error title
143
  $logTitle = Mage::helper('fraisrconnect/data')->__(
144
- 'An error occured during the creation of the following cron task for the product sychronisation with message: "%s".',
 
145
  $e->getMessage()
146
  );
147
 
@@ -234,10 +238,10 @@ class Fraisr_Connect_Model_Observer
234
  }
235
 
236
  $event = $observer->getEvent();
237
- $order_item = $event->getOrderItem();
238
- $order_item->setFraisrProductId($event->getItem()->getFraisrProductId());
239
- $order_item->setFraisrCauseId($event->getItem()->getFraisrCauseId());
240
- $order_item->setFraisrDonationPercentage($event->getItem()->getFraisrDonationPercentage());
241
  }
242
 
243
  /**
@@ -267,7 +271,9 @@ class Fraisr_Connect_Model_Observer
267
 
268
  //Log about adding a next cronjob task
269
  $logTitle = Mage::helper('fraisrconnect/data')->__(
270
- 'Not all orders have been synchronized because of a transmission error or a script timeout. Therefore another cron task was added for GMT-Datetime %s.',
 
 
271
  $cronTask->getScheduledAt()
272
  );
273
  Mage::getModel('fraisrconnect/log')
@@ -278,7 +284,8 @@ class Fraisr_Connect_Model_Observer
278
  } catch (Exception $e) {
279
  //Log error title
280
  $logTitle = Mage::helper('fraisrconnect/data')->__(
281
- 'An error occured during the creation of the following cron task for the order sychronisation with message: "%s".',
 
282
  $e->getMessage()
283
  );
284
 
@@ -299,8 +306,9 @@ class Fraisr_Connect_Model_Observer
299
  $config = Mage::getModel("fraisrconnect/config");
300
  $callback_url = Mage::getUrl("fraisrconnect");
301
 
302
- if($config->isActive() !== true)
303
  return;
 
304
 
305
  $this->setDefaultStore();
306
 
@@ -310,8 +318,8 @@ class Fraisr_Connect_Model_Observer
310
  compact("callback_url")
311
  );
312
 
313
- if($response["success"] !== true){
314
- if(array_key_exists($response["error"])){
315
  throw new Exception($response["error"]);
316
  }
317
 
@@ -338,22 +346,30 @@ class Fraisr_Connect_Model_Observer
338
  public function catalogProductLoadAfter($observer){
339
  $action = Mage::app()->getFrontController()->getAction();
340
 
341
- if($action->getFullActionName() !== "checkout_cart_add")
 
 
 
 
342
  return;
 
343
 
344
  $product = $observer->getProduct();
345
 
346
- if(is_null($product->getFraisrId()))
347
  return;
 
348
 
349
- if(is_null($product->getFraisrCause()))
350
  return;
 
351
 
352
- if(is_null($product->getFraisrDonationPercentage()))
353
  return;
 
354
 
355
  $additionalOptions = array();
356
- if($additionalOption = $product->getCustomOption("additional_options")){
357
  $additionalOptions = (array) unserialize($additionalOption->getValue());
358
  }
359
 
@@ -393,11 +409,13 @@ class Fraisr_Connect_Model_Observer
393
  public function customgridColumnAppend($observer){
394
  $block = $observer->getBlock();
395
 
396
- if(!isset($block))
397
  return;
 
398
 
399
- if($block->getType() !== "adminhtml/sales_order_grid")
400
  return;
 
401
 
402
  $block->addColumnAfter("has_fraisr_items", array(
403
  "header" => Mage::helper("fraisrconnect/data")->__("Has fraisr items"),
@@ -418,9 +436,10 @@ class Fraisr_Connect_Model_Observer
418
  $order = $observer->getEvent()->getOrder();
419
  $has_fraisr_items = 0;
420
 
421
- foreach($quote->getAllVisibleItems() AS $quoteItem){
422
- if(is_null($quoteItem->getFraisrProductId()))
423
  continue;
 
424
 
425
  $has_fraisr_items = 1;
426
  break;
44
  $websites = Mage::app()->getWebsites();
45
  $code = $websites[1]->getDefaultStore()->getCode();
46
 
47
+ if (($store = Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId()) !== 0) {
48
  $code = Mage::app()->getStore($store)->getCode();
49
  }
50
 
51
+ if ($code === $this->_currentStoreCode) {
52
  return;
53
+ }
54
 
55
  Mage::app()->setCurrentStore($code);
56
  }
131
 
132
  //Log about adding a next cronjob task
133
  $logTitle = Mage::helper('fraisrconnect/data')->__(
134
+ 'Not all products have been synchronized because ' .
135
+ 'of a transmission error or a script timeout. ' .
136
+ 'Therefore another cron task was added for GMT-Datetime %s.',
137
  $cronTask->getScheduledAt()
138
  );
139
  Mage::getModel('fraisrconnect/log')
144
  } catch (Exception $e) {
145
  //Log error title
146
  $logTitle = Mage::helper('fraisrconnect/data')->__(
147
+ 'An error occured during the creation of the following ' .
148
+ 'cron task for the product sychronisation with message: "%s".',
149
  $e->getMessage()
150
  );
151
 
238
  }
239
 
240
  $event = $observer->getEvent();
241
+ $orderItem = $event->getOrderItem();
242
+ $orderItem->setFraisrProductId($event->getItem()->getFraisrProductId());
243
+ $orderItem->setFraisrCauseId($event->getItem()->getFraisrCauseId());
244
+ $orderItem->setFraisrDonationPercentage($event->getItem()->getFraisrDonationPercentage());
245
  }
246
 
247
  /**
271
 
272
  //Log about adding a next cronjob task
273
  $logTitle = Mage::helper('fraisrconnect/data')->__(
274
+ 'Not all orders have been synchronized because ' .
275
+ 'of a transmission error or a script timeout. ' .
276
+ 'Therefore another cron task was added for GMT-Datetime %s.',
277
  $cronTask->getScheduledAt()
278
  );
279
  Mage::getModel('fraisrconnect/log')
284
  } catch (Exception $e) {
285
  //Log error title
286
  $logTitle = Mage::helper('fraisrconnect/data')->__(
287
+ 'An error occured during the creation of the following ' .
288
+ 'cron task for the order sychronisation with message: "%s".',
289
  $e->getMessage()
290
  );
291
 
306
  $config = Mage::getModel("fraisrconnect/config");
307
  $callback_url = Mage::getUrl("fraisrconnect");
308
 
309
+ if ($config->isActive() !== true) {
310
  return;
311
+ }
312
 
313
  $this->setDefaultStore();
314
 
318
  compact("callback_url")
319
  );
320
 
321
+ if ($response["success"] !== true) {
322
+ if (array_key_exists($response["error"])) {
323
  throw new Exception($response["error"]);
324
  }
325
 
346
  public function catalogProductLoadAfter($observer){
347
  $action = Mage::app()->getFrontController()->getAction();
348
 
349
+ if (true === is_null($action)) {
350
+ return;
351
+ }
352
+
353
+ if ($action->getFullActionName() !== "checkout_cart_add") {
354
  return;
355
+ }
356
 
357
  $product = $observer->getProduct();
358
 
359
+ if (is_null($product->getFraisrId())) {
360
  return;
361
+ }
362
 
363
+ if (is_null($product->getFraisrCause())) {
364
  return;
365
+ }
366
 
367
+ if (is_null($product->getFraisrDonationPercentage())) {
368
  return;
369
+ }
370
 
371
  $additionalOptions = array();
372
+ if ($additionalOption = $product->getCustomOption("additional_options")) {
373
  $additionalOptions = (array) unserialize($additionalOption->getValue());
374
  }
375
 
409
  public function customgridColumnAppend($observer){
410
  $block = $observer->getBlock();
411
 
412
+ if (!isset($block)) {
413
  return;
414
+ }
415
 
416
+ if ($block->getType() !== "adminhtml/sales_order_grid") {
417
  return;
418
+ }
419
 
420
  $block->addColumnAfter("has_fraisr_items", array(
421
  "header" => Mage::helper("fraisrconnect/data")->__("Has fraisr items"),
436
  $order = $observer->getEvent()->getOrder();
437
  $has_fraisr_items = 0;
438
 
439
+ foreach ($quote->getAllVisibleItems() AS $quoteItem) {
440
+ if (is_null($quoteItem->getFraisrProductId())) {
441
  continue;
442
+ }
443
 
444
  $has_fraisr_items = 1;
445
  break;
app/code/community/Fraisr/Connect/Model/Order.php CHANGED
@@ -28,35 +28,35 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
28
  * fraisr admin helper
29
  * @var Fraisr_Connect_Helper_Adminhtml_Data
30
  */
31
- protected $adminHelper = null;
32
 
33
  /**
34
  * collection of new orders
35
  *
36
  * @var array
37
  */
38
- protected $newOrdersReport = array();
39
 
40
  /**
41
  * collection of updated orders
42
  *
43
  * @var array
44
  */
45
- protected $updatedOrdersReport = array();
46
 
47
  /**
48
  * collection of updated orders
49
  *
50
  * @var array
51
  */
52
- protected $deletedOrdersReport = array();
53
 
54
  /**
55
  * collection of transmission failed orders
56
  *
57
  * @var array
58
  */
59
- protected $failedOrdersReport = array();
60
 
61
  /**
62
  * Flag to check if the synchronisation is finished/completed or not
@@ -161,7 +161,7 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
161
  $logDetails['error_message'] = $e->getMessage();
162
 
163
  //Add item to failed order list
164
- $this->failedOrdersReport[] = $logDetails;
165
  }
166
 
167
  //Check if the script runtime is already close to exceed
@@ -239,7 +239,7 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
239
  ->save();
240
 
241
  //Add order_id to success list
242
- $this->newOrdersReport[] = array(
243
  'magento_order_id' => $orderItem->getIncrementId(),
244
  'fraisr_order_id' => $orderItem->getFraisrOrderId(),
245
  'product' => $orderRequestData['product'],
@@ -274,14 +274,14 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
274
 
275
  if ($amount > 0) {
276
  //Add order_id to update success list
277
- $this->updatedOrdersReport[] = array(
278
  'magento_order_id' => $orderItem->getIncrementId(),
279
  'fraisr_order_id' => $orderItem->getFraisrOrderId(),
280
  'amount' => $amount,
281
  );
282
  } else {
283
  //Add order_id to delete success list
284
- $this->deletedOrdersReport[] = array(
285
  'magento_order_id' => $orderItem->getIncrementId(),
286
  'fraisr_order_id' => $orderItem->getFraisrProductId(),
287
  'amount' => $amount,
@@ -302,36 +302,36 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
302
  //Add admin notice message about new added orders
303
  $newOrdersMessage = $this->getAdminHelper()->__(
304
  '%s order(s) were successfully added to fraisr.',
305
- (int) count($this->newOrdersReport)
306
  );
307
- if (count($this->newOrdersReport) > 0) {
308
  Mage::getSingleton('adminhtml/session')->addNotice($newOrdersMessage);
309
  }
310
 
311
  //Add admin notice message about updated orders
312
  $updatedOrdersMessage = $this->getAdminHelper()->__(
313
  '%s order(s) were successfully updated in fraisr.',
314
- (int) count($this->updatedOrdersReport)
315
  );
316
- if (count($this->updatedOrdersReport) > 0) {
317
  Mage::getSingleton('adminhtml/session')->addNotice($updatedOrdersMessage);
318
  }
319
 
320
  //Add admin notice message about deleted orders
321
  $deletedOrdersMessage = $this->getAdminHelper()->__(
322
  '%s order(s) were successfully deleted from fraisr.',
323
- (int) count($this->deletedOrdersReport)
324
  );
325
- if (count($this->deletedOrdersReport) > 0) {
326
  Mage::getSingleton('adminhtml/session')->addNotice($deletedOrdersMessage);
327
  }
328
 
329
  //Add admin notice message about transmission failed orders
330
  $failedOrdersMessage = $this->getAdminHelper()->__(
331
  'The transmission of %s order(s) failed during fraisr synchronisation.',
332
- (int) count($this->failedOrdersReport)
333
  );
334
- if (count($this->failedOrdersReport) > 0) {
335
  Mage::getSingleton('adminhtml/session')->addNotice($failedOrdersMessage);
336
  }
337
 
@@ -342,13 +342,13 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
342
  ."#%s\n%s\n\n"
343
  ."#%s\n%s\n\n",
344
  $newOrdersMessage,
345
- Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->newOrdersReport),
346
  $updatedOrdersMessage,
347
- Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->updatedOrdersReport),
348
  $deletedOrdersMessage,
349
- Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->deletedOrdersReport),
350
  $failedOrdersMessage,
351
- Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->failedOrdersReport)
352
  );
353
  Mage::getModel('fraisrconnect/log')
354
  ->setTitle($this->getAdminHelper()->__('Order synchronisation report'))
@@ -364,10 +364,10 @@ class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
364
  */
365
  protected function getAdminHelper()
366
  {
367
- if (true === is_null($this->adminHelper)) {
368
- $this->adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
369
  }
370
- return $this->adminHelper;
371
  }
372
 
373
  /**
28
  * fraisr admin helper
29
  * @var Fraisr_Connect_Helper_Adminhtml_Data
30
  */
31
+ protected $_adminHelper = null;
32
 
33
  /**
34
  * collection of new orders
35
  *
36
  * @var array
37
  */
38
+ protected $_newOrdersReport = array();
39
 
40
  /**
41
  * collection of updated orders
42
  *
43
  * @var array
44
  */
45
+ protected $_updatedOrdersReport = array();
46
 
47
  /**
48
  * collection of updated orders
49
  *
50
  * @var array
51
  */
52
+ protected $_deletedOrdersReport = array();
53
 
54
  /**
55
  * collection of transmission failed orders
56
  *
57
  * @var array
58
  */
59
+ protected $_failedOrdersReport = array();
60
 
61
  /**
62
  * Flag to check if the synchronisation is finished/completed or not
161
  $logDetails['error_message'] = $e->getMessage();
162
 
163
  //Add item to failed order list
164
+ $this->_failedOrdersReport[] = $logDetails;
165
  }
166
 
167
  //Check if the script runtime is already close to exceed
239
  ->save();
240
 
241
  //Add order_id to success list
242
+ $this->_newOrdersReport[] = array(
243
  'magento_order_id' => $orderItem->getIncrementId(),
244
  'fraisr_order_id' => $orderItem->getFraisrOrderId(),
245
  'product' => $orderRequestData['product'],
274
 
275
  if ($amount > 0) {
276
  //Add order_id to update success list
277
+ $this->_updatedOrdersReport[] = array(
278
  'magento_order_id' => $orderItem->getIncrementId(),
279
  'fraisr_order_id' => $orderItem->getFraisrOrderId(),
280
  'amount' => $amount,
281
  );
282
  } else {
283
  //Add order_id to delete success list
284
+ $this->_deletedOrdersReport[] = array(
285
  'magento_order_id' => $orderItem->getIncrementId(),
286
  'fraisr_order_id' => $orderItem->getFraisrProductId(),
287
  'amount' => $amount,
302
  //Add admin notice message about new added orders
303
  $newOrdersMessage = $this->getAdminHelper()->__(
304
  '%s order(s) were successfully added to fraisr.',
305
+ (int) count($this->_newOrdersReport)
306
  );
307
+ if (count($this->_newOrdersReport) > 0) {
308
  Mage::getSingleton('adminhtml/session')->addNotice($newOrdersMessage);
309
  }
310
 
311
  //Add admin notice message about updated orders
312
  $updatedOrdersMessage = $this->getAdminHelper()->__(
313
  '%s order(s) were successfully updated in fraisr.',
314
+ (int) count($this->_updatedOrdersReport)
315
  );
316
+ if (count($this->_updatedOrdersReport) > 0) {
317
  Mage::getSingleton('adminhtml/session')->addNotice($updatedOrdersMessage);
318
  }
319
 
320
  //Add admin notice message about deleted orders
321
  $deletedOrdersMessage = $this->getAdminHelper()->__(
322
  '%s order(s) were successfully deleted from fraisr.',
323
+ (int) count($this->_deletedOrdersReport)
324
  );
325
+ if (count($this->_deletedOrdersReport) > 0) {
326
  Mage::getSingleton('adminhtml/session')->addNotice($deletedOrdersMessage);
327
  }
328
 
329
  //Add admin notice message about transmission failed orders
330
  $failedOrdersMessage = $this->getAdminHelper()->__(
331
  'The transmission of %s order(s) failed during fraisr synchronisation.',
332
+ (int) count($this->_failedOrdersReport)
333
  );
334
+ if (count($this->_failedOrdersReport) > 0) {
335
  Mage::getSingleton('adminhtml/session')->addNotice($failedOrdersMessage);
336
  }
337
 
342
  ."#%s\n%s\n\n"
343
  ."#%s\n%s\n\n",
344
  $newOrdersMessage,
345
+ Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->_newOrdersReport),
346
  $updatedOrdersMessage,
347
+ Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->_updatedOrdersReport),
348
  $deletedOrdersMessage,
349
+ Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->_deletedOrdersReport),
350
  $failedOrdersMessage,
351
+ Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->_failedOrdersReport)
352
  );
353
  Mage::getModel('fraisrconnect/log')
354
  ->setTitle($this->getAdminHelper()->__('Order synchronisation report'))
364
  */
365
  protected function getAdminHelper()
366
  {
367
+ if (true === is_null($this->_adminHelper)) {
368
+ $this->_adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
369
  }
370
+ return $this->_adminHelper;
371
  }
372
 
373
  /**
app/code/community/Fraisr/Connect/Model/Product.php CHANGED
@@ -28,35 +28,35 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
28
  * fraisr admin helper
29
  * @var Fraisr_Connect_Helper_Adminhtml_Data
30
  */
31
- protected $adminHelper = null;
32
 
33
  /**
34
  * collection of new added products (sku + fraisr_id)
35
  *
36
  * @var array
37
  */
38
- protected $newProductsReport = array();
39
 
40
  /**
41
  * collection of updated products (sku + fraisr_id)
42
  *
43
  * @var array
44
  */
45
- protected $updatedProductsReport = array();
46
 
47
  /**
48
  * collection of deleted products (sku + fraisr_id)
49
  *
50
  * @var array
51
  */
52
- protected $deletedProductsReport = array();
53
 
54
  /**
55
  * collection of transmission failed products (sku + optional fraisr_id)
56
  *
57
  * @var array
58
  */
59
- protected $failedProductsReport = array();
60
 
61
  /**
62
  * Flag to check if the synchronisation is finished/completed or not
@@ -163,7 +163,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
163
  Mage::helper('fraisrconnect/synchronisation_product')->markAsSynchronized($product);
164
  } catch (Fraisr_Connect_Model_Api_Exception $e) {
165
  //Add sku to failed products list
166
- $this->failedProductsReport[] = array(
167
  'sku' => $product->getSku(),
168
  'fraisr_id' => $product->getFraisrId(),
169
  'error_message' => $e->getMessage(),
@@ -223,7 +223,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
223
  $product->setFraisrId($reponse['_id'])->save();
224
 
225
  //Add sku to success list
226
- $this->newProductsReport[] = array(
227
  'sku' => $product->getSku(),
228
  'fraisr_id' => $reponse['_id']
229
  );
@@ -247,7 +247,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
247
  );
248
 
249
  //Add sku to success list
250
- $this->updatedProductsReport[] = array(
251
  'sku' => $product->getSku(),
252
  'fraisr_id' => $product->getFraisrId()
253
  );
@@ -267,7 +267,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
267
  );
268
 
269
  //Add sku to delete list
270
- $this->deletedProductsReport[] = array(
271
  'sku' => $sku,
272
  'fraisr_id' => $fraisrId
273
  );
@@ -347,36 +347,36 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
347
  //Add admin notice message about new added products
348
  $newProductsMessage = $this->getAdminHelper()->__(
349
  '%s product(s) were successfully added to fraisr.',
350
- (int) count($this->newProductsReport)
351
  );
352
- if (count($this->newProductsReport) > 0) {
353
  Mage::getSingleton('adminhtml/session')->addNotice($newProductsMessage);
354
  }
355
 
356
  //Add admin notice message about updated products
357
  $updatedProductsMessage = $this->getAdminHelper()->__(
358
  '%s product(s) were successfully updated in fraisr.',
359
- (int) count($this->updatedProductsReport)
360
  );
361
- if (count($this->updatedProductsReport) > 0) {
362
  Mage::getSingleton('adminhtml/session')->addNotice($updatedProductsMessage);
363
  }
364
 
365
  //Add admin notice message about deleted products
366
  $deletedProductsMessage = $this->getAdminHelper()->__(
367
  '%s product(s) were successfully deleted from fraisr.',
368
- (int) count($this->deletedProductsReport)
369
  );
370
- if (count($this->deletedProductsReport) > 0) {
371
  Mage::getSingleton('adminhtml/session')->addNotice($deletedProductsMessage);
372
  }
373
 
374
  //Add admin notice message about transmission failed products
375
  $failedProductsMessage = $this->getAdminHelper()->__(
376
  'The transmission of %s product(s) failed during fraisr synchronisation.',
377
- (int) count($this->failedProductsReport)
378
  );
379
- if (count($this->failedProductsReport) > 0) {
380
  Mage::getSingleton('adminhtml/session')->addNotice($failedProductsMessage);
381
  }
382
 
@@ -387,13 +387,13 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
387
  ."#%s\n%s\n\n"
388
  ."#%s\n%s\n\n",
389
  $newProductsMessage,
390
- Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->newProductsReport),
391
  $updatedProductsMessage,
392
- Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->updatedProductsReport),
393
  $deletedProductsMessage,
394
- Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->deletedProductsReport),
395
  $failedProductsMessage,
396
- Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->failedProductsReport)
397
  );
398
  Mage::getModel('fraisrconnect/log')
399
  ->setTitle($this->getAdminHelper()->__('Product synchronisation report'))
@@ -409,10 +409,10 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
409
  */
410
  protected function getAdminHelper()
411
  {
412
- if (true === is_null($this->adminHelper)) {
413
- $this->adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
414
  }
415
- return $this->adminHelper;
416
  }
417
 
418
  /**
@@ -447,7 +447,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
447
  Mage::getModel('fraisrconnect/config')->removeProductFromDeleteQueue($product['sku']);
448
  } catch (Fraisr_Connect_Model_Api_Exception $e) {
449
  //Add sku to delete products list
450
- $this->failedProductsReport[] = array(
451
  'sku' => $product['sku'],
452
  'fraisr_id' => $product['fraisr_id'],
453
  'error_message' => $e->getMessage(),
@@ -467,13 +467,16 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
467
  try {
468
  //Get product collection of new and update products
469
  $newAndUpdateFraisrProducts = array();
470
- foreach(Mage::helper('fraisrconnect/synchronisation_product')->getNewAndUpdateFraisrProducts() AS $product){
 
 
471
  $data = $this->buildFaisrProductRequestData($product);
472
  ksort($data);
473
  $hash = hash("sha512", implode("", $data));
474
 
475
- if($hash === $product->getFraisrSyncHash() && !is_null($product->getFraisrId()))
476
  continue;
 
477
 
478
  $product
479
  ->setFraisrSyncHash($hash)
@@ -496,7 +499,7 @@ class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
496
  ),
497
  Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC
498
  );
499
- }else{
500
  $this->getAdminHelper()->logAndAdminOutputSuccess(
501
  $this->getAdminHelper()->__(
502
  'There are no products to synchronize.'
28
  * fraisr admin helper
29
  * @var Fraisr_Connect_Helper_Adminhtml_Data
30
  */
31
+ protected $_adminHelper = null;
32
 
33
  /**
34
  * collection of new added products (sku + fraisr_id)
35
  *
36
  * @var array
37
  */
38
+ protected $_newProductsReport = array();
39
 
40
  /**
41
  * collection of updated products (sku + fraisr_id)
42
  *
43
  * @var array
44
  */
45
+ protected $_updatedProductsReport = array();
46
 
47
  /**
48
  * collection of deleted products (sku + fraisr_id)
49
  *
50
  * @var array
51
  */
52
+ protected $_deletedProductsReport = array();
53
 
54
  /**
55
  * collection of transmission failed products (sku + optional fraisr_id)
56
  *
57
  * @var array
58
  */
59
+ protected $_failedProductsReport = array();
60
 
61
  /**
62
  * Flag to check if the synchronisation is finished/completed or not
163
  Mage::helper('fraisrconnect/synchronisation_product')->markAsSynchronized($product);
164
  } catch (Fraisr_Connect_Model_Api_Exception $e) {
165
  //Add sku to failed products list
166
+ $this->_failedProductsReport[] = array(
167
  'sku' => $product->getSku(),
168
  'fraisr_id' => $product->getFraisrId(),
169
  'error_message' => $e->getMessage(),
223
  $product->setFraisrId($reponse['_id'])->save();
224
 
225
  //Add sku to success list
226
+ $this->_newProductsReport[] = array(
227
  'sku' => $product->getSku(),
228
  'fraisr_id' => $reponse['_id']
229
  );
247
  );
248
 
249
  //Add sku to success list
250
+ $this->_updatedProductsReport[] = array(
251
  'sku' => $product->getSku(),
252
  'fraisr_id' => $product->getFraisrId()
253
  );
267
  );
268
 
269
  //Add sku to delete list
270
+ $this->_deletedProductsReport[] = array(
271
  'sku' => $sku,
272
  'fraisr_id' => $fraisrId
273
  );
347
  //Add admin notice message about new added products
348
  $newProductsMessage = $this->getAdminHelper()->__(
349
  '%s product(s) were successfully added to fraisr.',
350
+ (int) count($this->_newProductsReport)
351
  );
352
+ if (count($this->_newProductsReport) > 0) {
353
  Mage::getSingleton('adminhtml/session')->addNotice($newProductsMessage);
354
  }
355
 
356
  //Add admin notice message about updated products
357
  $updatedProductsMessage = $this->getAdminHelper()->__(
358
  '%s product(s) were successfully updated in fraisr.',
359
+ (int) count($this->_updatedProductsReport)
360
  );
361
+ if (count($this->_updatedProductsReport) > 0) {
362
  Mage::getSingleton('adminhtml/session')->addNotice($updatedProductsMessage);
363
  }
364
 
365
  //Add admin notice message about deleted products
366
  $deletedProductsMessage = $this->getAdminHelper()->__(
367
  '%s product(s) were successfully deleted from fraisr.',
368
+ (int) count($this->_deletedProductsReport)
369
  );
370
+ if (count($this->_deletedProductsReport) > 0) {
371
  Mage::getSingleton('adminhtml/session')->addNotice($deletedProductsMessage);
372
  }
373
 
374
  //Add admin notice message about transmission failed products
375
  $failedProductsMessage = $this->getAdminHelper()->__(
376
  'The transmission of %s product(s) failed during fraisr synchronisation.',
377
+ (int) count($this->_failedProductsReport)
378
  );
379
+ if (count($this->_failedProductsReport) > 0) {
380
  Mage::getSingleton('adminhtml/session')->addNotice($failedProductsMessage);
381
  }
382
 
387
  ."#%s\n%s\n\n"
388
  ."#%s\n%s\n\n",
389
  $newProductsMessage,
390
+ Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->_newProductsReport),
391
  $updatedProductsMessage,
392
+ Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->_updatedProductsReport),
393
  $deletedProductsMessage,
394
+ Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->_deletedProductsReport),
395
  $failedProductsMessage,
396
+ Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->_failedProductsReport)
397
  );
398
  Mage::getModel('fraisrconnect/log')
399
  ->setTitle($this->getAdminHelper()->__('Product synchronisation report'))
409
  */
410
  protected function getAdminHelper()
411
  {
412
+ if (true === is_null($this->_adminHelper)) {
413
+ $this->_adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
414
  }
415
+ return $this->_adminHelper;
416
  }
417
 
418
  /**
447
  Mage::getModel('fraisrconnect/config')->removeProductFromDeleteQueue($product['sku']);
448
  } catch (Fraisr_Connect_Model_Api_Exception $e) {
449
  //Add sku to delete products list
450
+ $this->_failedProductsReport[] = array(
451
  'sku' => $product['sku'],
452
  'fraisr_id' => $product['fraisr_id'],
453
  'error_message' => $e->getMessage(),
467
  try {
468
  //Get product collection of new and update products
469
  $newAndUpdateFraisrProducts = array();
470
+ foreach (Mage::helper('fraisrconnect/synchronisation_product')->getNewAndUpdateFraisrProducts()
471
+ AS $product) {
472
+
473
  $data = $this->buildFaisrProductRequestData($product);
474
  ksort($data);
475
  $hash = hash("sha512", implode("", $data));
476
 
477
+ if($hash === $product->getFraisrSyncHash() && !is_null($product->getFraisrId())) {
478
  continue;
479
+ }
480
 
481
  $product
482
  ->setFraisrSyncHash($hash)
499
  ),
500
  Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC
501
  );
502
+ } else {
503
  $this->getAdminHelper()->logAndAdminOutputSuccess(
504
  $this->getAdminHelper()->__(
505
  'There are no products to synchronize.'
app/code/community/Fraisr/Connect/Model/Resource/Setup.php CHANGED
@@ -22,5 +22,6 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
26
- { }
 
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
26
+
27
+ }
app/code/community/Fraisr/Connect/controllers/AbstractController.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Front_Action{
4
  /**
5
  * @type Fraisr_Connect_Model_Config
6
  */
@@ -12,7 +12,12 @@ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Fr
12
  * @param Zend_Controller_Response_Abstract $response
13
  * @param array $invokeArgs
14
  */
15
- public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()){
 
 
 
 
 
16
  parent::__construct($request, $response, $invokeArgs);
17
 
18
  $this->getResponse()->setHeader("Content-Type", "application/json", true);
@@ -32,8 +37,9 @@ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Fr
32
  * @throws Exception when plugin is disabled
33
  */
34
  protected function _checkActive(){
35
- if (!$this->_config->isActive())
36
  throw new Exception("The fraisr plugin is currently disabled");
 
37
  }
38
 
39
  /**
@@ -41,11 +47,13 @@ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Fr
41
  * @throws Exception when token is invalid
42
  */
43
  protected function _checkRequest(){
44
- if (null === ($token = $this->getRequest()->getParam("token", null)))
45
  throw new Exception("Missing param 'token'");
 
46
 
47
- if ($token !== $this->_getToken())
48
  throw new Exception("Param 'token' is invalid.");
 
49
  }
50
 
51
  /**
@@ -56,7 +64,7 @@ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Fr
56
  $key = $this->_config->getApiKey();
57
  $secret = $this->_config->getApiSecret();
58
 
59
- if(strlen($key) > 0 && strlen($secret) > 0){
60
  return hash("sha512", implode('|', array($key, $secret)));
61
  }
62
 
@@ -83,8 +91,6 @@ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Fr
83
  $response = $this->getResponse();
84
  $body = Zend_Json::encode($body);
85
  $response->setBody($body);
86
- die($response->sendResponse());
87
  }
88
- }
89
-
90
- ?>
1
  <?php
2
 
3
+ abstract class Fraisr_Connect_AbstractController extends Mage_Core_Controller_Front_Action {
4
  /**
5
  * @type Fraisr_Connect_Model_Config
6
  */
12
  * @param Zend_Controller_Response_Abstract $response
13
  * @param array $invokeArgs
14
  */
15
+ public function __construct(
16
+ Zend_Controller_Request_Abstract $request,
17
+ Zend_Controller_Response_Abstract $response,
18
+ array $invokeArgs = array()
19
+ ){
20
+
21
  parent::__construct($request, $response, $invokeArgs);
22
 
23
  $this->getResponse()->setHeader("Content-Type", "application/json", true);
37
  * @throws Exception when plugin is disabled
38
  */
39
  protected function _checkActive(){
40
+ if (!$this->_config->isActive()) {
41
  throw new Exception("The fraisr plugin is currently disabled");
42
+ }
43
  }
44
 
45
  /**
47
  * @throws Exception when token is invalid
48
  */
49
  protected function _checkRequest(){
50
+ if (null === ($token = $this->getRequest()->getParam("token", null))) {
51
  throw new Exception("Missing param 'token'");
52
+ }
53
 
54
+ if ($token !== $this->_getToken()) {
55
  throw new Exception("Param 'token' is invalid.");
56
+ }
57
  }
58
 
59
  /**
64
  $key = $this->_config->getApiKey();
65
  $secret = $this->_config->getApiSecret();
66
 
67
+ if (strlen($key) > 0 && strlen($secret) > 0) {
68
  return hash("sha512", implode('|', array($key, $secret)));
69
  }
70
 
91
  $response = $this->getResponse();
92
  $body = Zend_Json::encode($body);
93
  $response->setBody($body);
94
+ exit($response->sendResponse());
95
  }
96
+ }
 
 
app/code/community/Fraisr/Connect/controllers/Adminhtml/SynchronisationController.php CHANGED
@@ -22,8 +22,7 @@
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
- class Fraisr_Connect_Adminhtml_SynchronisationController extends Mage_Adminhtml_Controller_Action
26
- {
27
  /**
28
  * Current store code
29
  * @var String
@@ -44,12 +43,13 @@ class Fraisr_Connect_Adminhtml_SynchronisationController extends Mage_Adminhtml_
44
  $websites = Mage::app()->getWebsites();
45
  $code = $websites[1]->getDefaultStore()->getCode();
46
 
47
- if(($store = Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId()) !== 0){
48
  $code = Mage::app()->getStore($store)->getCode();
49
  }
50
 
51
- if($code === $this->_currentStoreCode)
52
  return;
 
53
 
54
  Mage::app()->setCurrentStore($code);
55
  }
@@ -123,7 +123,10 @@ class Fraisr_Connect_Adminhtml_SynchronisationController extends Mage_Adminhtml_
123
 
124
  if (false === $productSyncronisation->isSynchronisationComplete()) {
125
  Mage::getSingleton('adminhtml/session')->addWarning(
126
- Mage::helper('fraisrconnect/data')->__('Not all products have been synchronized because of a transmission error or a script timeout. Please start the process again.')
 
 
 
127
  );
128
  }
129
  }
@@ -159,21 +162,6 @@ class Fraisr_Connect_Adminhtml_SynchronisationController extends Mage_Adminhtml_
159
  */
160
  public function orderAction()
161
  {
162
- // if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
163
- // $orderSyncronisation = Mage::getModel('fraisrconnect/order');
164
- // $orderSyncronisation->synchronize();
165
-
166
- // if (false === $orderSyncronisation->isSynchronisationComplete()) {
167
- // Mage::getSingleton('adminhtml/session')->addWarning(
168
- // Mage::helper('fraisrconnect/data')->__('Not all orders have been synchronized because of a transmission error or a script timeout. Please start the process again.')
169
- // );
170
- // } else {
171
- // Mage::getSingleton('adminhtml/session')->addSuccess(
172
- // Mage::helper('fraisrconnect/data')->__('fraisr order synchronisation completed.')
173
- // );
174
- // }
175
- // }
176
-
177
  $this->_redirectReferer();
178
  return;
179
  }
22
  * @package Fraisr_Connect
23
  * @author André Herrn <andre.herrn@das-medienkombinat.de>
24
  */
25
+ class Fraisr_Connect_Adminhtml_SynchronisationController extends Mage_Adminhtml_Controller_Action {
 
26
  /**
27
  * Current store code
28
  * @var String
43
  $websites = Mage::app()->getWebsites();
44
  $code = $websites[1]->getDefaultStore()->getCode();
45
 
46
+ if (($store = Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId()) !== 0) {
47
  $code = Mage::app()->getStore($store)->getCode();
48
  }
49
 
50
+ if ($code === $this->_currentStoreCode) {
51
  return;
52
+ }
53
 
54
  Mage::app()->setCurrentStore($code);
55
  }
123
 
124
  if (false === $productSyncronisation->isSynchronisationComplete()) {
125
  Mage::getSingleton('adminhtml/session')->addWarning(
126
+ Mage::helper('fraisrconnect/data')->__(
127
+ 'Not all products have been synchronized ' .
128
+ 'because of a transmission error or a script timeout. ' .
129
+ 'Please start the process again.')
130
  );
131
  }
132
  }
162
  */
163
  public function orderAction()
164
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  $this->_redirectReferer();
166
  return;
167
  }
app/code/community/Fraisr/Connect/controllers/OrdersController.php CHANGED
@@ -2,21 +2,20 @@
2
 
3
  require_once "AbstractController.php";
4
 
5
- class Fraisr_Connect_OrdersController extends Fraisr_Connect_AbstractController{
6
  public function indexAction(){
7
  $helper = Mage::helper("fraisrconnect/synchronisation_order");
8
  $orders = $helper->getOrderItemsToSynchronize();
9
  $body = array();
10
 
11
  foreach ($orders as $order) {
12
- if(!$helper->isOrderItemValid($order))
13
  continue;
 
14
 
15
  array_push($body, $helper->getJsonObject($order));
16
  }
17
 
18
  $this->_send($body);
19
  }
20
- }
21
-
22
- ?>
2
 
3
  require_once "AbstractController.php";
4
 
5
+ class Fraisr_Connect_OrdersController extends Fraisr_Connect_AbstractController {
6
  public function indexAction(){
7
  $helper = Mage::helper("fraisrconnect/synchronisation_order");
8
  $orders = $helper->getOrderItemsToSynchronize();
9
  $body = array();
10
 
11
  foreach ($orders as $order) {
12
+ if(!$helper->isOrderItemValid($order)) {
13
  continue;
14
+ }
15
 
16
  array_push($body, $helper->getJsonObject($order));
17
  }
18
 
19
  $this->_send($body);
20
  }
21
+ }
 
 
app/code/community/Fraisr/Connect/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <Fraisr_Connect>
22
- <version>0.4.3</version>
23
  </Fraisr_Connect>
24
  </modules>
25
  <global>
@@ -269,7 +269,8 @@
269
  <api>
270
  <live>https://www.fraisr.com/</live>
271
  <trusted>https://fraisr-trusted.herokuapp.com/</trusted>
272
- <sandbox>https://fraisr-test.herokuapp.com/</sandbox>
 
273
  <connect>api/v1/connect</connect>
274
  <cause>api/v1/causes/for-shops</cause>
275
  <category>api/v1/categories</category>
19
  <config>
20
  <modules>
21
  <Fraisr_Connect>
22
+ <version>0.4.4</version>
23
  </Fraisr_Connect>
24
  </modules>
25
  <global>
269
  <api>
270
  <live>https://www.fraisr.com/</live>
271
  <trusted>https://fraisr-trusted.herokuapp.com/</trusted>
272
+ <!-- <sandbox>https://fraisr-test.herokuapp.com/</sandbox> -->
273
+ <sandbox>http://fraisr.dev:3000/</sandbox>
274
  <connect>api/v1/connect</connect>
275
  <cause>api/v1/causes/for-shops</cause>
276
  <category>api/v1/categories</category>
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.2-0.1.3.php CHANGED
@@ -101,6 +101,7 @@ $setup->addAttribute(
101
  );
102
 
103
  //Donation percentage
 
104
  $setup->addAttribute(
105
  'catalog_product',
106
  'fraisr_donation_percentage',
@@ -110,7 +111,7 @@ $setup->addAttribute(
110
  'type' => 'int',
111
  'label' => $fraisrHelper->__("fraisr donation percentage"),
112
  'source' => 'fraisrconnect/entity_attribute_source_donationPercentage',
113
- 'default' => Fraisr_Connect_Model_Entity_Attribute_Source_DonationPercentage::FRAISR_DONATION_PERCENTAGE_DEFAULT,
114
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
115
  'apply_to' => implode(",", $productTypes),
116
  'sort_order' => 300,
@@ -128,6 +129,7 @@ $setup->addAttribute(
128
  );
129
 
130
  //Category
 
131
  $setup->addAttribute(
132
  'catalog_product',
133
  'fraisr_category',
@@ -137,7 +139,7 @@ $setup->addAttribute(
137
  'type' => 'varchar',
138
  'label' => $fraisrHelper->__("fraisr category"),
139
  'source' => 'fraisrconnect/entity_attribute_source_category',
140
- 'default' => Fraisr_Connect_Model_Entity_Attribute_Source_Category::FRAISR_CATEGORY_DEFAULT,
141
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
142
  'apply_to' => implode(",", $productTypes),
143
  'sort_order' => 400,
101
  );
102
 
103
  //Donation percentage
104
+ $default = Fraisr_Connect_Model_Entity_Attribute_Source_DonationPercentage::FRAISR_DONATION_PERCENTAGE_DEFAULT;
105
  $setup->addAttribute(
106
  'catalog_product',
107
  'fraisr_donation_percentage',
111
  'type' => 'int',
112
  'label' => $fraisrHelper->__("fraisr donation percentage"),
113
  'source' => 'fraisrconnect/entity_attribute_source_donationPercentage',
114
+ 'default' => $default,
115
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
116
  'apply_to' => implode(",", $productTypes),
117
  'sort_order' => 300,
129
  );
130
 
131
  //Category
132
+ $default = Fraisr_Connect_Model_Entity_Attribute_Source_Category::FRAISR_CATEGORY_DEFAULT;
133
  $setup->addAttribute(
134
  'catalog_product',
135
  'fraisr_category',
139
  'type' => 'varchar',
140
  'label' => $fraisrHelper->__("fraisr category"),
141
  'source' => 'fraisrconnect/entity_attribute_source_category',
142
+ 'default' => $default,
143
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
144
  'apply_to' => implode(",", $productTypes),
145
  'sort_order' => 400,
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.4-0.3.5.php CHANGED
@@ -28,7 +28,8 @@ $setup->updateAttribute(
28
  'catalog_product',
29
  'fraisr_cause',
30
  'note',
31
- $fraisrHelper->__('Folgende Artikel NICHT für die Organisation verkaufen:<br />"ALK": "Alkohol"<br />"TBK": "Tabakwaren"<br />"LDR": "Lederwaren"<br />
 
32
  "PELZ": "Pelzwaren"<br />"FLS": "Fleischprodukte"<br />"TP": "tierische Produkte"')
33
  );
34
 
28
  'catalog_product',
29
  'fraisr_cause',
30
  'note',
31
+ $fraisrHelper->__('Folgende Artikel NICHT für die Organisation verkaufen:<br />' .
32
+ '"ALK": "Alkohol"<br />"TBK": "Tabakwaren"<br />"LDR": "Lederwaren"<br />
33
  "PELZ": "Pelzwaren"<br />"FLS": "Fleischprodukte"<br />"TP": "tierische Produkte"')
34
  );
35
 
package.xml CHANGED
@@ -1,19 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fraisr</name>
4
- <version>0.4.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Extension zur Anbindung von Magento an den fraisr-Marktplatz</summary>
10
  <description>Extension zur Anbindung von Magento an den fraisr-Marktplatz</description>
11
- <notes>* Bugfixes&#xD;
12
- * Donation iFrame is now extern and will not be affected of downtimes by fraisr.com</notes>
13
  <authors><author><name>Andre Herrn</name><user>fraisr</user><email>andre.herrn@das-medienkombinat.de</email></author><author><name>Christopher Kn&#xF6;tschke</name><user>fraisr</user><email>chris@fraisr.com</email></author></authors>
14
- <date>2013-11-11</date>
15
- <time>15:55:29</time>
16
- <contents><target name="magecommunity"><dir name="Fraisr"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Entity"><dir name="Attribute"><file name="FraisrId.php" hash="3b5b31fa5ea711b2ff7fd62493af9385"/><file name="FraisrUpdate.php" hash="7c4cd9a33e95d2a6157aa7e19e58faac"/></dir></dir><dir name="Log"><dir name="Edit"><file name="Form.php" hash="738ccce441a380d9e550dbb195d4ca65"/></dir><file name="Edit.php" hash="a7a9d340645576c63d48f878e7f89553"/><file name="Grid.php" hash="5fdad267ad670efa9ff8219aa6e81f58"/></dir><file name="Log.php" hash="70da89bf7cff8f93993701d3e97e57dc"/><dir name="System"><dir name="Config"><file name="Support.php" hash="87cefd408ad58ea5b60aa32960dbfcb9"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Json"><file name="List.php" hash="bac5ca7939aba90877528281ab1c7d67"/><file name="View.php" hash="d886952165104a8589ab331bb4582b1c"/></dir><dir name="View"><file name="Label.php" hash="cfd9565e9180aa441a90044f26cc2b5f"/></dir></dir></dir><dir name="Frontend"><file name="Widget.php" hash="104642fb642c5bc4d160df189d033f5a"/></dir></dir><file name="Exception.php" hash="56e65be5923c5095d3741b282d2dfd69"/><dir name="Helper"><dir name="Adminhtml"><file name="Data.php" hash="38160355e1a0e54f9a5306c5b5a413b2"/></dir><file name="Data.php" hash="1e11e42b6d3e5ed038aa5dd3faf07c68"/><dir name="Synchronisation"><file name="Abstract.php" hash="ddb949841004ec8aeb9d03f03753d6aa"/><file name="Order.php" hash="84a2996123f842415675670b37767d4b"/><file name="Product.php" hash="3870e04fb00db2e7f16f148d28509b89"/></dir></dir><dir name="Model"><dir name="Api"><file name="Exception.php" hash="e07c7c64278f3d1b6982eb36ac08e59f"/><file name="Request.php" hash="8f0359bf541e3fd6404a34976478a650"/><file name="Response.php" hash="6fcff68389fb6bff85b0743066e5f0cd"/></dir><file name="Category.php" hash="82c652c89ea5038e7a0a25a779acd481"/><file name="Cause.php" hash="c9fef8c82e096485a5a8945fe02a6115"/><file name="Config.php" hash="9e13f64b79e0b4eb2226c7f4a198d310"/><dir name="Entity"><dir name="Attribute"><dir name="Source"><file name="Category.php" hash="8516fdca6750d63b4e0c2b1430b12c36"/><file name="Cause.php" hash="45b934d6baa7e60c17b85f0ab444c824"/><file name="DonationPercentage.php" hash="603bccb9c8fcf68f76ed41fa421f4964"/><file name="Visibility.php" hash="eabb285ce7c1d02f88e3a5e909429da2"/></dir></dir></dir><file name="Log.php" hash="afa03219f67f5dfa3d6da9c69525b9f7"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="572bdc6a3a818a644a8afa170bd79a1c"/></dir><file name="Category.php" hash="ec8b07d6447905add97f3934622b839d"/><dir name="Cause"><file name="Collection.php" hash="37294f0c2b82e7dce37ef3aef99c45c2"/></dir><file name="Cause.php" hash="795bab5edab9c89987e09a8f260b2c73"/><dir name="Log"><file name="Collection.php" hash="1f0e9993959e694112be1762691600b3"/></dir><file name="Log.php" hash="88f831dc313b2873871a8db508717a47"/></dir><file name="Observer.php" hash="77fa566338631e26121d361eaa535688"/><file name="Order.php" hash="0bb42ff34f3aa898d027df2ec28bd26c"/><file name="Product.php" hash="9b11fdc20b6739a91d5be7df09e720f4"/><dir name="Resource"><file name="Setup.php" hash="6e188164f57fe01fdade6af0e2b5966c"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="BanderolePosition.php" hash="6950b70d023c8d7ff475b7a1ec157363"/><file name="DonationLabel.php" hash="cad5e736745ec3d81a53c67e9cf2f018"/><file name="IconPosition.php" hash="70d21f296eea0833f8f2b5fd7278e1ec"/><file name="ProductAttribute.php" hash="9cbe063b1adc8e6441d490106cb290a8"/><file name="Scope.php" hash="90070b38db18fc47b07c590337253651"/></dir></dir></dir></dir><dir name="controllers"><file name="AbstractController.php" hash="f31bdb501dd175254a135eb63a760054"/><dir name="Adminhtml"><file name="LogController.php" hash="f3ba897e445acfe3f34697668eabf7fd"/><file name="SynchronisationController.php" hash="179ac7f975ec29dd379aa132870b9556"/></dir><file name="OrdersController.php" hash="4ae0b2dd6cb672485503b5695812439e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c45830aa9aa1d61cb578280836fd1d77"/><file name="config.xml" hash="34863dbd768ef2a5b27d84d7b6d959dd"/><file name="system.xml" hash="4e13ce94b137352e2da43ab406905cfb"/></dir><dir name="sql"><dir name="fraisrconnect_setup"><file name="mysql4-install-0.1.0.php" hash="538c2dda212b55e84facbe02020e8a1c"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="3c3826353e7aef17db3d43614022bd05"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="64341dc3b0e89ea6cce00ade40225305"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="746c98b109deea2b7648f16c9629a28d"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="04c452067cc87efd6140a369de5c0a27"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="a24f127685ec51d289b964a353258e05"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="011d3d7df9c2532d3295a53095764731"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="59b871795b0cef1789895a9e0de827eb"/><file name="mysql4-upgrade-0.1.8-0.2.0.php" hash="ca49d4510a5c6fbec8ce7414e11046a2"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="f9c5a6f192d10ef8985ae62904b7f68b"/><file name="mysql4-upgrade-0.2.1-0.2.2.php" hash="ca4e5fca6c3ab44f21a1d3cc92033bac"/><file name="mysql4-upgrade-0.2.2-0.3.0.php" hash="ef0fe908d322f82ebbb8b60b19320111"/><file name="mysql4-upgrade-0.3.0-0.3.3.php" hash="2f0b456b26f5d0fe02d59965c7ec1c47"/><file name="mysql4-upgrade-0.3.3-0.3.4.php" hash="12c4cf36ff8c0b4e64d1d3a46fed844a"/><file name="mysql4-upgrade-0.3.4-0.3.5.php" hash="d28242fa6ce43180fad6bcf501d90532"/><file name="mysql4-upgrade-0.3.5-0.4.0.php" hash="04c452067cc87efd6140a369de5c0a27"/><file name="mysql4-upgrade-0.4.0-0.4.1.php" hash="5b87d9c425eef9ddee0085e91b513b67"/><file name="mysql4-upgrade-0.4.1-0.4.2.php" hash="3ad65c1fa98f4823ec856fc47fb6a234"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fraisr_Connect.xml" hash="e037cdec4cbb114352f359be5167baf2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="fraisrconnect"><dir name="catalog"><dir name="product"><dir name="json"><file name="list.phtml" hash="3361fe64acda92225d82cf028c960514"/><file name="view.phtml" hash="bf4b2a000e4c6f0748bf34f51f4238b5"/></dir><dir name="view"><file name="label_bottom.phtml" hash="bfa63e6c013424207d2d7df1d240ccb1"/><file name="label_top.phtml" hash="c9b9eec5c7bb546791eac70b770e9b68"/></dir></dir></dir><dir name="frontend"><file name="widget.phtml" hash="af561ae0ea6d7d0f788d2a1b1346f3df"/></dir></dir></dir><dir name="layout"><file name="fraisrconnect.xml" hash="4f04d956b570f8e57f423fb77d408938"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fraisrconnect"><dir name="system"><dir name="config"><file name="support.phtml" hash="be21e090f46e29ca2ce6e19474085fc4"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Fraisr_Connect.csv" hash="36361e1fcdb8155a00f7d814bc7e3cef"/></dir><dir name="en_US"><file name="Fraisr_Connect.csv" hash="43c166f3397377e9eb04260e6e8b96dc"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fraisr</name>
4
+ <version>0.4.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Extension zur Anbindung von Magento an den fraisr-Marktplatz</summary>
10
  <description>Extension zur Anbindung von Magento an den fraisr-Marktplatz</description>
11
+ <notes>* Bugfixes</notes>
 
12
  <authors><author><name>Andre Herrn</name><user>fraisr</user><email>andre.herrn@das-medienkombinat.de</email></author><author><name>Christopher Kn&#xF6;tschke</name><user>fraisr</user><email>chris@fraisr.com</email></author></authors>
13
+ <date>2013-11-26</date>
14
+ <time>12:51:37</time>
15
+ <contents><target name="magecommunity"><dir name="Fraisr"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Entity"><dir name="Attribute"><file name="FraisrId.php" hash="3b5b31fa5ea711b2ff7fd62493af9385"/><file name="FraisrUpdate.php" hash="7c4cd9a33e95d2a6157aa7e19e58faac"/></dir></dir><dir name="Log"><dir name="Edit"><file name="Form.php" hash="ad10ba1358a251cc2fadcd4412cd71a6"/></dir><file name="Edit.php" hash="cee21008eb87a9a18dafc91a054b8762"/><file name="Grid.php" hash="5fdad267ad670efa9ff8219aa6e81f58"/></dir><file name="Log.php" hash="76f6ebcfeb901a9eb30feb767390be60"/><dir name="System"><dir name="Config"><file name="Support.php" hash="2a6306e94bdc0180fe43c78d7052c379"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Json"><file name="List.php" hash="bac5ca7939aba90877528281ab1c7d67"/><file name="View.php" hash="d886952165104a8589ab331bb4582b1c"/></dir><dir name="View"><file name="Label.php" hash="cfd9565e9180aa441a90044f26cc2b5f"/></dir></dir></dir><dir name="Frontend"><file name="Widget.php" hash="104642fb642c5bc4d160df189d033f5a"/></dir></dir><file name="Exception.php" hash="b73df12d1f1614add01ffaccde251428"/><dir name="Helper"><dir name="Adminhtml"><file name="Data.php" hash="ddd81a07a9920b0ff6253dae32c10f3f"/></dir><file name="Data.php" hash="1e11e42b6d3e5ed038aa5dd3faf07c68"/><dir name="Synchronisation"><file name="Abstract.php" hash="ddb949841004ec8aeb9d03f03753d6aa"/><file name="Order.php" hash="84a2996123f842415675670b37767d4b"/><file name="Product.php" hash="3870e04fb00db2e7f16f148d28509b89"/></dir></dir><dir name="Model"><dir name="Api"><file name="Exception.php" hash="9edeb6b33714659171e8a15fd35bc3bc"/><file name="Request.php" hash="b97d667aea4e0e6284b37870115ac0c8"/><file name="Response.php" hash="b550de6539c928fffdeb4b98bfbd4382"/></dir><file name="Category.php" hash="82c652c89ea5038e7a0a25a779acd481"/><file name="Cause.php" hash="7d5a80040315176562393d096adc8009"/><file name="Config.php" hash="9e13f64b79e0b4eb2226c7f4a198d310"/><dir name="Entity"><dir name="Attribute"><dir name="Source"><file name="Category.php" hash="2bb6b4eacf1916bc918b8e40f7ac0766"/><file name="Cause.php" hash="f936672663733c7372b26275151bf969"/><file name="DonationPercentage.php" hash="415851d361cfcb9999fb323ea58813e3"/><file name="Visibility.php" hash="076eef84245161bba9cf878524d5c1e3"/></dir></dir></dir><file name="Log.php" hash="afa03219f67f5dfa3d6da9c69525b9f7"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="572bdc6a3a818a644a8afa170bd79a1c"/></dir><file name="Category.php" hash="ec8b07d6447905add97f3934622b839d"/><dir name="Cause"><file name="Collection.php" hash="37294f0c2b82e7dce37ef3aef99c45c2"/></dir><file name="Cause.php" hash="795bab5edab9c89987e09a8f260b2c73"/><dir name="Log"><file name="Collection.php" hash="1f0e9993959e694112be1762691600b3"/></dir><file name="Log.php" hash="88f831dc313b2873871a8db508717a47"/></dir><file name="Observer.php" hash="bf1c45fcc1beaae72e02970527da5e0c"/><file name="Order.php" hash="ccd82fc8d887adea2f2962ca7a59aa0e"/><file name="Product.php" hash="87f16a29b7f5d2a8ee0082ee9017f746"/><dir name="Resource"><file name="Setup.php" hash="c7fa7ca79477cd1fe66731525d718a5d"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="BanderolePosition.php" hash="6950b70d023c8d7ff475b7a1ec157363"/><file name="DonationLabel.php" hash="cad5e736745ec3d81a53c67e9cf2f018"/><file name="IconPosition.php" hash="70d21f296eea0833f8f2b5fd7278e1ec"/><file name="ProductAttribute.php" hash="9cbe063b1adc8e6441d490106cb290a8"/><file name="Scope.php" hash="90070b38db18fc47b07c590337253651"/></dir></dir></dir></dir><dir name="controllers"><file name="AbstractController.php" hash="21b1105be3e69396d40a25f55570355e"/><dir name="Adminhtml"><file name="LogController.php" hash="f3ba897e445acfe3f34697668eabf7fd"/><file name="SynchronisationController.php" hash="c7ad2115b3ba39cc6ae93097dc2f58ad"/></dir><file name="OrdersController.php" hash="41941d55fbe9fdc55d8789e5c774bbc0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c45830aa9aa1d61cb578280836fd1d77"/><file name="config.xml" hash="8635824755c51de2caa19c907f0d9a4c"/><file name="system.xml" hash="4e13ce94b137352e2da43ab406905cfb"/></dir><dir name="sql"><dir name="fraisrconnect_setup"><file name="mysql4-install-0.1.0.php" hash="538c2dda212b55e84facbe02020e8a1c"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="3c3826353e7aef17db3d43614022bd05"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="453407d6fe33398c3288ccaeb6ff34d4"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="746c98b109deea2b7648f16c9629a28d"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="04c452067cc87efd6140a369de5c0a27"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="a24f127685ec51d289b964a353258e05"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="011d3d7df9c2532d3295a53095764731"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="59b871795b0cef1789895a9e0de827eb"/><file name="mysql4-upgrade-0.1.8-0.2.0.php" hash="ca49d4510a5c6fbec8ce7414e11046a2"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="f9c5a6f192d10ef8985ae62904b7f68b"/><file name="mysql4-upgrade-0.2.1-0.2.2.php" hash="ca4e5fca6c3ab44f21a1d3cc92033bac"/><file name="mysql4-upgrade-0.2.2-0.3.0.php" hash="ef0fe908d322f82ebbb8b60b19320111"/><file name="mysql4-upgrade-0.3.0-0.3.3.php" hash="2f0b456b26f5d0fe02d59965c7ec1c47"/><file name="mysql4-upgrade-0.3.3-0.3.4.php" hash="12c4cf36ff8c0b4e64d1d3a46fed844a"/><file name="mysql4-upgrade-0.3.4-0.3.5.php" hash="923eb74bb2e8ecde1c011431897d2094"/><file name="mysql4-upgrade-0.3.5-0.4.0.php" hash="04c452067cc87efd6140a369de5c0a27"/><file name="mysql4-upgrade-0.4.0-0.4.1.php" hash="5b87d9c425eef9ddee0085e91b513b67"/><file name="mysql4-upgrade-0.4.1-0.4.2.php" hash="3ad65c1fa98f4823ec856fc47fb6a234"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fraisr_Connect.xml" hash="e037cdec4cbb114352f359be5167baf2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="fraisrconnect"><dir name="catalog"><dir name="product"><dir name="json"><file name="list.phtml" hash="3361fe64acda92225d82cf028c960514"/><file name="view.phtml" hash="bf4b2a000e4c6f0748bf34f51f4238b5"/></dir><dir name="view"><file name="label_bottom.phtml" hash="bfa63e6c013424207d2d7df1d240ccb1"/><file name="label_top.phtml" hash="c9b9eec5c7bb546791eac70b770e9b68"/></dir></dir></dir><dir name="frontend"><file name="widget.phtml" hash="af561ae0ea6d7d0f788d2a1b1346f3df"/></dir></dir></dir><dir name="layout"><file name="fraisrconnect.xml" hash="4f04d956b570f8e57f423fb77d408938"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fraisrconnect"><dir name="system"><dir name="config"><file name="support.phtml" hash="be21e090f46e29ca2ce6e19474085fc4"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Fraisr_Connect.csv" hash="36361e1fcdb8155a00f7d814bc7e3cef"/></dir><dir name="en_US"><file name="Fraisr_Connect.csv" hash="43c166f3397377e9eb04260e6e8b96dc"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>