Version Notes
Initial release
Download this release
Release Info
Developer | Andre Herrn |
Extension | Fraisr |
Version | 0.3.5 |
Comparing to | |
See all releases |
Version 0.3.5
- app/code/community/Fraisr/Connect/Block/Adminhtml/Entity/Attribute/FraisrId.php +37 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/Entity/Attribute/FraisrUpdate.php +37 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/Log.php +91 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit.php +64 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit/Form.php +117 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Grid.php +110 -0
- app/code/community/Fraisr/Connect/Block/Adminhtml/System/Config/Support.php +111 -0
- app/code/community/Fraisr/Connect/Block/Catalog/Product/Json/List.php +51 -0
- app/code/community/Fraisr/Connect/Block/Catalog/Product/Json/View.php +54 -0
- app/code/community/Fraisr/Connect/Block/Catalog/Product/View/Label.php +60 -0
- app/code/community/Fraisr/Connect/Block/Frontend/Widget.php +48 -0
- app/code/community/Fraisr/Connect/Exception.php +26 -0
- app/code/community/Fraisr/Connect/Helper/Adminhtml/Data.php +126 -0
- app/code/community/Fraisr/Connect/Helper/Data.php +90 -0
- app/code/community/Fraisr/Connect/Helper/Synchronisation/Abstract.php +91 -0
- app/code/community/Fraisr/Connect/Helper/Synchronisation/Order.php +119 -0
- app/code/community/Fraisr/Connect/Helper/Synchronisation/Product.php +233 -0
- app/code/community/Fraisr/Connect/Model/Api/Exception.php +26 -0
- app/code/community/Fraisr/Connect/Model/Api/Request.php +314 -0
- app/code/community/Fraisr/Connect/Model/Api/Response.php +195 -0
- app/code/community/Fraisr/Connect/Model/Category.php +143 -0
- app/code/community/Fraisr/Connect/Model/Cause.php +243 -0
- app/code/community/Fraisr/Connect/Model/Config.php +378 -0
- app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Category.php +82 -0
- app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Cause.php +73 -0
- app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/DonationPercentage.php +68 -0
- app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Visibility.php +79 -0
- app/code/community/Fraisr/Connect/Model/Log.php +179 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Category.php +57 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Category/Collection.php +37 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Cause.php +57 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Cause/Collection.php +37 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Log.php +36 -0
- app/code/community/Fraisr/Connect/Model/Mysql4/Log/Collection.php +37 -0
- app/code/community/Fraisr/Connect/Model/Observer.php +245 -0
- app/code/community/Fraisr/Connect/Model/Order.php +407 -0
- app/code/community/Fraisr/Connect/Model/Product.php +534 -0
- app/code/community/Fraisr/Connect/Model/Resource/Setup.php +26 -0
- app/code/community/Fraisr/Connect/Model/System/Config/Source/BanderolePosition.php +66 -0
- app/code/community/Fraisr/Connect/Model/System/Config/Source/DonationLabel.php +57 -0
- app/code/community/Fraisr/Connect/Model/System/Config/Source/IconPosition.php +84 -0
- app/code/community/Fraisr/Connect/Model/System/Config/Source/ProductAttribute.php +56 -0
- app/code/community/Fraisr/Connect/Model/System/Config/Source/Scope.php +72 -0
- app/code/community/Fraisr/Connect/controllers/Adminhtml/LogController.php +54 -0
- app/code/community/Fraisr/Connect/controllers/Adminhtml/SynchronisationController.php +151 -0
- app/code/community/Fraisr/Connect/etc/adminhtml.xml +55 -0
- app/code/community/Fraisr/Connect/etc/config.xml +233 -0
- app/code/community/Fraisr/Connect/etc/system.xml +230 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-install-0.1.0.php +36 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.0-0.1.2.php +31 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.2-0.1.3.php +185 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.3-0.1.4.php +49 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.4-0.1.5.php +21 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.5-0.1.6.php +69 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.6-0.1.7.php +30 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.7-0.1.8.php +26 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.8-0.2.0.php +37 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.0-0.2.1.php +57 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.1-0.2.2.php +93 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.2-0.3.0.php +30 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.0-0.3.3.php +30 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.3-0.3.4.php +28 -0
- app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.4-0.3.5.php +35 -0
- app/design/adminhtml/default/default/template/fraisrconnect/system/config/support.phtml +61 -0
- app/design/frontend/base/default/layout/fraisrconnect.xml +95 -0
- app/design/frontend/base/default/template/fraisrconnect/catalog/product/json/list.phtml +24 -0
- app/design/frontend/base/default/template/fraisrconnect/catalog/product/json/view.phtml +24 -0
- app/design/frontend/base/default/template/fraisrconnect/catalog/product/view/label_bottom.phtml +26 -0
- app/design/frontend/base/default/template/fraisrconnect/catalog/product/view/label_top.phtml +26 -0
- app/design/frontend/base/default/template/fraisrconnect/frontend/widget.phtml +28 -0
- app/etc/modules/Fraisr_Connect.xml +30 -0
- app/locale/de_DE/Fraisr_Connect.csv +128 -0
- app/locale/en_US/Fraisr_Connect.csv +128 -0
- package.xml +18 -0
app/code/community/Fraisr/Connect/Block/Adminhtml/Entity/Attribute/FraisrId.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin item renderer for fraisr id attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Entity_Attribute_FraisrId extends Varien_Data_Form_Element_Text
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Set fraisr ID Attribute to readonly (disable), because it should be only filled by API Sync
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getElementHtml()
|
33 |
+
{
|
34 |
+
$this->setReadonly(true, true);
|
35 |
+
return parent::getElementHtml();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/Entity/Attribute/FraisrUpdate.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin item renderer for 'fraisr_update' attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Entity_Attribute_FraisrUpdate extends Varien_Data_Form_Element_Text
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Set 'fraisr_update' Attribute to readonly (disable), because it should be only filled during API Sync
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getElementHtml()
|
33 |
+
{
|
34 |
+
$this->setReadonly(true, true);
|
35 |
+
return parent::getElementHtml();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/Log.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Block
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Construct
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
$helper = Mage::helper('fraisrconnect/data');
|
36 |
+
|
37 |
+
$this->_blockGroup = 'fraisrconnect';
|
38 |
+
$this->_controller = 'adminhtml_log';
|
39 |
+
$this->_headerText = $helper->__('fraisr log');
|
40 |
+
|
41 |
+
$this->changeButtons();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Remove default buttons and add new sync buttons
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
protected function changeButtons()
|
50 |
+
{
|
51 |
+
$helper = Mage::helper('fraisrconnect/data');
|
52 |
+
$urlModel = Mage::getModel('adminhtml/url');
|
53 |
+
|
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 |
+
|
84 |
+
//Add order sync button
|
85 |
+
$this->_addButton('order_synchronisation', array(
|
86 |
+
'label' => $helper->__('Synchronize orders'),
|
87 |
+
'onclick' => 'setLocation(\'' . $urlModel->getUrl('fraisrconnect/adminhtml_synchronisation/order') .'\')',
|
88 |
+
'class' => 'add',
|
89 |
+
));
|
90 |
+
}
|
91 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Edit Block
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Log_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Construct
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
|
36 |
+
$this->_objectId = "id";
|
37 |
+
$this->_blockGroup = 'fraisrconnect';
|
38 |
+
$this->_mode = 'edit';
|
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');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Get Header Text
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getHeaderText()
|
61 |
+
{
|
62 |
+
return Mage::helper('fraisrconnect/data')->__('fraisr log');
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Edit/Form.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Edit Form
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Log_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Prepare Form
|
29 |
+
*
|
30 |
+
* @return object
|
31 |
+
*/
|
32 |
+
protected function _prepareForm()
|
33 |
+
{
|
34 |
+
$helper = Mage::helper('fraisrconnect/data');
|
35 |
+
$form = new Varien_Data_Form(array(
|
36 |
+
'id' => 'edit_form',
|
37 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
38 |
+
'method' => 'post'
|
39 |
+
));
|
40 |
+
|
41 |
+
$logData = Mage::registry('current_fraisrlog')->getData();
|
42 |
+
|
43 |
+
$fieldset = $form->addFieldset(
|
44 |
+
'edit_fraisrlog',
|
45 |
+
array('legend' => Mage::helper('fraisrconnect/data')->__('fraisr log'))
|
46 |
+
);
|
47 |
+
|
48 |
+
$fieldset->addField('type', 'select', array(
|
49 |
+
'name' => 'type',
|
50 |
+
'title' => $helper->__('Type'),
|
51 |
+
'label' => $helper->__('Type'),
|
52 |
+
'maxlength' => '50',
|
53 |
+
'style' => 'width:98%;',
|
54 |
+
'options' => Mage::getModel('fraisrconnect/log')->getTypeOptions()
|
55 |
+
));
|
56 |
+
|
57 |
+
$fieldset->addField('task', 'select', array(
|
58 |
+
'name' => 'task',
|
59 |
+
'title' => $helper->__('Task'),
|
60 |
+
'label' => $helper->__('Task'),
|
61 |
+
'maxlength' => '50',
|
62 |
+
'style' => 'width:98%;',
|
63 |
+
'options' => Mage::getModel('fraisrconnect/log')->getTaskOptions()
|
64 |
+
));
|
65 |
+
|
66 |
+
$fieldset->addField('title', 'text', array(
|
67 |
+
'name' => 'title',
|
68 |
+
'title' => $helper->__('Title'),
|
69 |
+
'label' => $helper->__('Title'),
|
70 |
+
'maxlength' => '50',
|
71 |
+
'style' => 'width:98%;',
|
72 |
+
));
|
73 |
+
|
74 |
+
$outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
75 |
+
$fieldset->addField('created_at', 'date', array(
|
76 |
+
'name' => 'created_at',
|
77 |
+
'title' => $helper->__('Date'),
|
78 |
+
'label' => $helper->__('Date'),
|
79 |
+
'format' => $outputFormat,
|
80 |
+
'maxlength' => '50',
|
81 |
+
'style' => 'width:98%;',
|
82 |
+
));
|
83 |
+
|
84 |
+
$fieldset->addField('message', 'textarea', array(
|
85 |
+
'name' => 'message',
|
86 |
+
'title' => $helper->__('Message'),
|
87 |
+
'label' => $helper->__('Message'),
|
88 |
+
'style' => 'width: 700px; height: 400px;',
|
89 |
+
));
|
90 |
+
|
91 |
+
$fieldset->addField('additional_information1', 'textarea', array(
|
92 |
+
'name' => 'additional_information1',
|
93 |
+
'title' => $helper->__('Additional information 1'),
|
94 |
+
'label' => $helper->__('Additional information 1'),
|
95 |
+
'style' => 'width: 700px; height: 400px;',
|
96 |
+
));
|
97 |
+
|
98 |
+
$fieldset->addField('additional_information2', 'textarea', array(
|
99 |
+
'name' => 'additional_information2',
|
100 |
+
'title' => $helper->__('Additional information 2'),
|
101 |
+
'label' => $helper->__('Additional information 2'),
|
102 |
+
'style' => 'width: 700px; height: 400px;',
|
103 |
+
));
|
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();
|
116 |
+
}
|
117 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/Log/Grid.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Widget Grid
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Construct
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
$this->setId('fraisrconnectLogIndex');
|
36 |
+
$this->setDefaultSort('id');
|
37 |
+
$this->setDefaultDir('desc');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Prepare Collection
|
42 |
+
*
|
43 |
+
* @return object
|
44 |
+
*/
|
45 |
+
protected function _prepareCollection()
|
46 |
+
{
|
47 |
+
$collection = Mage::getModel('fraisrconnect/log')->getCollection();
|
48 |
+
$this->setCollection($collection);
|
49 |
+
return parent::_prepareCollection();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Prepare Columns
|
54 |
+
*
|
55 |
+
* @return object
|
56 |
+
*/
|
57 |
+
protected function _prepareColumns()
|
58 |
+
{
|
59 |
+
$this->addColumn('id', array(
|
60 |
+
'header' => Mage::helper('fraisrconnect/data')->__('Id'),
|
61 |
+
'align' => 'left',
|
62 |
+
'filter_index' => 'id',
|
63 |
+
'index' => 'id',
|
64 |
+
));
|
65 |
+
|
66 |
+
$this->addColumn('type', array(
|
67 |
+
'header' => Mage::helper('fraisrconnect/data')->__('Type'),
|
68 |
+
'align' => 'left',
|
69 |
+
'index' => 'type',
|
70 |
+
'type' => 'options',
|
71 |
+
'options' => Mage::getModel('fraisrconnect/log')->getTypeOptions(),
|
72 |
+
));
|
73 |
+
|
74 |
+
$this->addColumn('title', array(
|
75 |
+
'header' => Mage::helper('fraisrconnect/data')->__('Title'),
|
76 |
+
'align' => 'left',
|
77 |
+
'filter_index' => 'title',
|
78 |
+
'index' => 'title',
|
79 |
+
));
|
80 |
+
|
81 |
+
$this->addColumn('task', array(
|
82 |
+
'header' => Mage::helper('fraisrconnect/data')->__('Task'),
|
83 |
+
'align' => 'left',
|
84 |
+
'index' => 'task',
|
85 |
+
'filter_index' => 'task',
|
86 |
+
'type' => 'options',
|
87 |
+
'options' => Mage::getModel('fraisrconnect/log')->getTaskOptions(),
|
88 |
+
));
|
89 |
+
|
90 |
+
$this->addColumn('created_at', array(
|
91 |
+
'header' => Mage::helper('fraisrconnect/data')->__('Date'),
|
92 |
+
'align' => 'left',
|
93 |
+
'filter_index' => 'created_at',
|
94 |
+
'index' => 'created_at',
|
95 |
+
'type' => 'datetime'
|
96 |
+
));
|
97 |
+
|
98 |
+
return parent::_prepareColumns();
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Row click url
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getRowUrl($row)
|
107 |
+
{
|
108 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
109 |
+
}
|
110 |
+
}
|
app/code/community/Fraisr/Connect/Block/Adminhtml/System/Config/Support.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Backend Config Support Area
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Adminhtml_System_Config_Support
|
26 |
+
extends Mage_Adminhtml_Block_Abstract
|
27 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Support Template
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
protected $_template = 'fraisrconnect/system/config/support.phtml';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Render fieldset html
|
37 |
+
*
|
38 |
+
* @param Varien_Data_Form_Element_Abstract $fieldset
|
39 |
+
* @return string
|
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 |
+
));
|
47 |
+
return $this->toHtml();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get extension version
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function getExtensionVersion()
|
56 |
+
{
|
57 |
+
return(string) Mage::getConfig()
|
58 |
+
->getNode('modules')
|
59 |
+
->children()
|
60 |
+
->Fraisr_Connect
|
61 |
+
->version;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get Magento version
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getMageVersion()
|
70 |
+
{
|
71 |
+
$mageVersion = Mage::getVersion();
|
72 |
+
if (true === is_callable('Mage::getEdition')) {
|
73 |
+
$mageVersion = sprintf(
|
74 |
+
'%s %s',
|
75 |
+
Mage::getEdition(),
|
76 |
+
$mageVersion
|
77 |
+
);
|
78 |
+
}
|
79 |
+
return $mageVersion;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get support email address
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public function getSupportEmail()
|
88 |
+
{
|
89 |
+
return $this->getConfig()->getSupportEmail();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get commercial register url
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getCommercialRegisterUrl()
|
98 |
+
{
|
99 |
+
return $this->getConfig()->getCommercialRegisterUrl();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get Config Model
|
104 |
+
*
|
105 |
+
* @return Fraisr_Connect_Model_Config
|
106 |
+
*/
|
107 |
+
protected function getConfig()
|
108 |
+
{
|
109 |
+
return Mage::getModel('fraisrconnect/config');
|
110 |
+
}
|
111 |
+
}
|
app/code/community/Fraisr/Connect/Block/Catalog/Product/Json/List.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Catalog Product List Json Block
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Catalog_Product_Json_List extends Mage_Catalog_Block_Product_List
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get product list json
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getProductListJson()
|
33 |
+
{
|
34 |
+
$fraisrProductData = array();
|
35 |
+
|
36 |
+
//Get every product of the current selection and loop through it
|
37 |
+
foreach ($this->getLoadedProductCollection() as $product) {
|
38 |
+
//Continue only if product is tagged with 'Fraisr':'Yes' and has a 'fraisr_id'
|
39 |
+
if ('1' !== $product->getFraisrEnabled()
|
40 |
+
|| true === is_null($product->getFraisrId())) {
|
41 |
+
continue;
|
42 |
+
}
|
43 |
+
|
44 |
+
//Add product entry
|
45 |
+
$fraisrProductData[$product->getProductUrl()] = Mage::helper('fraisrconnect/data')
|
46 |
+
->buildProductJsonEntry($product);
|
47 |
+
}
|
48 |
+
|
49 |
+
return Zend_Json::encode($fraisrProductData);
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Fraisr/Connect/Block/Catalog/Product/Json/View.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Catalog Product View Json Block
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Catalog_Product_Json_View extends Mage_Catalog_Block_Product_View
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get product detail json
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getProductDetailJson()
|
33 |
+
{
|
34 |
+
$fraisrProductData = array();
|
35 |
+
$product = $this->getProduct();
|
36 |
+
|
37 |
+
//Continue only if product is tagged with 'Fraisr':'Yes' and has a 'fraisr_id'
|
38 |
+
/**
|
39 |
+
* TODO: Uncomment later if products have a fraisr_id
|
40 |
+
* || true === is_null($product->getFraisrId()
|
41 |
+
*/
|
42 |
+
if (!($product instanceof Mage_Catalog_Model_Product)
|
43 |
+
|| true === is_null($product->getId())
|
44 |
+
|| '1' !== $product->getFraisrEnabled()) {
|
45 |
+
continue;
|
46 |
+
}
|
47 |
+
|
48 |
+
//Add product entry
|
49 |
+
$fraisrProductData[] = Mage::helper('fraisrconnect/data')
|
50 |
+
->buildProductJsonEntry($product);
|
51 |
+
|
52 |
+
return Zend_Json::encode($fraisrProductData);
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Fraisr/Connect/Block/Catalog/Product/View/Label.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Catalog Product View Label
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Catalog_Product_View_Label extends Mage_Catalog_Block_Product_View
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get fraisr donation label iframe
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getIframeUrl()
|
33 |
+
{
|
34 |
+
$config = Mage::getModel('fraisrconnect/config');
|
35 |
+
|
36 |
+
//Get base64 encoded hash
|
37 |
+
$base64Hash = Mage::helper('fraisrconnect/data')->buildIframeHash(
|
38 |
+
$this->getProduct()->getFraisrId()
|
39 |
+
);
|
40 |
+
|
41 |
+
//Return iframe url
|
42 |
+
return $config->getApiUri().$config->getDonationLabelIframeUri(
|
43 |
+
$base64Hash
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Check if product is active in fraisr
|
49 |
+
*
|
50 |
+
* @return boolean
|
51 |
+
*/
|
52 |
+
public function productIsActiveInFraisr()
|
53 |
+
{
|
54 |
+
if (false === is_null($this->getProduct()->getFraisrId())
|
55 |
+
&& 1 == $this->getProduct()->getFraisrEnabled()) {
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Fraisr/Connect/Block/Frontend/Widget.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Frontend Widget Block
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Block_Frontend_Widget extends Mage_Core_Block_Template
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get fraisr widget js uri
|
29 |
+
*
|
30 |
+
* @deprecated Currently a directly link to https://s3-eu-west-1.amazonaws.com/fraisr-com/ is used
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getFraisrWidgetJsUri()
|
34 |
+
{
|
35 |
+
return Mage::getModel('fraisrconnect/config')->getFrontendWidgetJsUri();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get fraisr widget css uri
|
40 |
+
*
|
41 |
+
* @deprecated Currently a directly link to https://s3-eu-west-1.amazonaws.com/fraisr-com/ is used
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function getFraisrWidgetCssUri()
|
45 |
+
{
|
46 |
+
return Mage::getModel('fraisrconnect/config')->getFrontendWidgetCssUri();
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Fraisr/Connect/Exception.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* General Fraisr Connect Exception
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Exception extends Exception
|
26 |
+
{ }
|
app/code/community/Fraisr/Connect/Helper/Adminhtml/Data.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Main Helper
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Helper_Adminhtml_Data extends Fraisr_Connect_Helper_Data
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Log a message to the logging system and output the message to admin session as an error
|
29 |
+
*
|
30 |
+
* @param string $message
|
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);
|
38 |
+
|
39 |
+
//Log the message
|
40 |
+
Mage::getModel('fraisrconnect/log')
|
41 |
+
->setTitle($message)
|
42 |
+
->setTask($task)
|
43 |
+
->setAdditionalInformation1($e->getTraceAsString())
|
44 |
+
->logError();
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Log a message to the logging system and output the message to admin session as success
|
49 |
+
*
|
50 |
+
* @param string $message
|
51 |
+
* @param string $task
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function logAndAdminOutputSuccess($message, $task = '')
|
55 |
+
{
|
56 |
+
//Add admin success message
|
57 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
58 |
+
|
59 |
+
//Log the message
|
60 |
+
Mage::getModel('fraisrconnect/log')
|
61 |
+
->setTitle($message)
|
62 |
+
->setTask($task)
|
63 |
+
->logSuccess();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Log a message to the logging system and output the message to admin session as notice
|
68 |
+
*
|
69 |
+
* @param string $message
|
70 |
+
* @param string $task
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
+
public function logAndAdminOutputNotice($message, $task = '')
|
74 |
+
{
|
75 |
+
//Add admin notice message
|
76 |
+
Mage::getSingleton('adminhtml/session')->addNotice($message);
|
77 |
+
|
78 |
+
//Log the message
|
79 |
+
Mage::getModel('fraisrconnect/log')
|
80 |
+
->setTitle($message)
|
81 |
+
->setTask($task)
|
82 |
+
->logNotice();
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Log a message to the logging system and output the message to admin session as warning
|
87 |
+
*
|
88 |
+
* @param string $message
|
89 |
+
* @param string $task
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
+
public function logAndAdminOutputWarning($message, $task = '')
|
93 |
+
{
|
94 |
+
//Add admin notice message
|
95 |
+
Mage::getSingleton('adminhtml/session')->addNotice($message);
|
96 |
+
|
97 |
+
//Log the message
|
98 |
+
Mage::getModel("fraisrconnect/log")
|
99 |
+
->setTitle($message)
|
100 |
+
->setTask($task)
|
101 |
+
->logWarning();
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Check is extension is active and output message
|
106 |
+
*
|
107 |
+
* @param boolean $withMessage
|
108 |
+
* @return boolean
|
109 |
+
*/
|
110 |
+
public function isActive($withMessage = false)
|
111 |
+
{
|
112 |
+
//If activated, just return
|
113 |
+
if (true === Mage::getModel('fraisrconnect/config')->isActive()) {
|
114 |
+
return true;
|
115 |
+
}
|
116 |
+
|
117 |
+
//Add message
|
118 |
+
if (true === $withMessage) {
|
119 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
120 |
+
$this->__('The fraisr-extension was disabled in the configuration.')
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
}
|
app/code/community/Fraisr/Connect/Helper/Data.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Main Helper
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Helper_Data extends Mage_Core_Helper_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Build product JSON entry
|
29 |
+
*
|
30 |
+
* @param Mage_Catalog_Model_Product $product
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function buildProductJsonEntry($product)
|
34 |
+
{
|
35 |
+
return array(
|
36 |
+
'cause' => $product->getFraisrCause(),
|
37 |
+
'donation' => $product->getFraisrDonationPercentage(),
|
38 |
+
'category' => $product->getFraisrCategory(),
|
39 |
+
'internalid' => $product->getSku(),
|
40 |
+
'name' => $product->getName(),
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Build fraisr frontend settings JSON
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getFraisrFrontendSettingsJson()
|
50 |
+
{
|
51 |
+
$frontendSettings = array(
|
52 |
+
'label' => Mage::getModel('fraisrconnect/config')->getDonationLabel(),
|
53 |
+
'position' => Mage::getModel('fraisrconnect/config')->getDonationLabelPosition()
|
54 |
+
);
|
55 |
+
return Zend_Json::encode($frontendSettings);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Build hash for donation label iframe
|
60 |
+
*
|
61 |
+
* @param string $fraisrId
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
public function buildIframeHash($fraisrId)
|
65 |
+
{
|
66 |
+
$config = Mage::getModel('fraisrconnect/config');
|
67 |
+
|
68 |
+
//Build hash array
|
69 |
+
$hashValues = array(
|
70 |
+
$config->getApiKey(),
|
71 |
+
$config->getApiSecret(),
|
72 |
+
$fraisrId,
|
73 |
+
Mage::getBaseUrl()
|
74 |
+
);
|
75 |
+
|
76 |
+
//Caclulate hash
|
77 |
+
$hash = hash("sha512", implode('|', $hashValues));
|
78 |
+
|
79 |
+
//Build base64-encoded hash
|
80 |
+
$base64Values = array(
|
81 |
+
$fraisrId,
|
82 |
+
Mage::getBaseUrl(),
|
83 |
+
$hash
|
84 |
+
);
|
85 |
+
|
86 |
+
return base64_encode(
|
87 |
+
implode('|', $base64Values)
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
app/code/community/Fraisr/Connect/Helper/Synchronisation/Abstract.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Abstract Synchronisation Helper
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Helper_Synchronisation_Abstract extends Fraisr_Connect_Helper_Data
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const CRON_TASK_ADDITIONAL_MINUTES Continue cron task will start in x minutes
|
29 |
+
*/
|
30 |
+
const CRON_TASK_ADDITIONAL_MINUTES = 15;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Check if the runtime is already exceeded
|
34 |
+
*
|
35 |
+
* Compare the starttime with the current time and the maximum execution time
|
36 |
+
*
|
37 |
+
* @param int $synchronisationStartTime
|
38 |
+
* @return boolean
|
39 |
+
*/
|
40 |
+
public function isRuntimeExceeded($synchronisationStartTime)
|
41 |
+
{
|
42 |
+
//Get maximum execution time
|
43 |
+
$maxExecutionTime = $this->getMaximumExecutionTime();
|
44 |
+
|
45 |
+
//Return true for is exceeded if we are 10sec before the execution time
|
46 |
+
if (($maxExecutionTime - 10) < (time() - $synchronisationStartTime)) {
|
47 |
+
return true;
|
48 |
+
} else {
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get maximum execution time
|
55 |
+
*
|
56 |
+
* @return int
|
57 |
+
*/
|
58 |
+
protected function getMaximumExecutionTime()
|
59 |
+
{
|
60 |
+
$maxExecutionTime = (int) ini_get('max_execution_time');
|
61 |
+
if (false === is_int($maxExecutionTime)
|
62 |
+
|| $maxExecutionTime < 1) {
|
63 |
+
$maxExecutionTime = INF;
|
64 |
+
}
|
65 |
+
return $maxExecutionTime;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Build syncronisation report details
|
70 |
+
*
|
71 |
+
* @param array $report
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function buildSyncReportDetails($reports)
|
75 |
+
{
|
76 |
+
//Return empty string if report is empty
|
77 |
+
if (0 == count($reports)) {
|
78 |
+
return '';
|
79 |
+
}
|
80 |
+
|
81 |
+
//Build message
|
82 |
+
$reportMessage = '';
|
83 |
+
foreach ($reports as $report) {
|
84 |
+
foreach ($report as $key => $value) {
|
85 |
+
$reportMessage .= sprintf('["%s":"%s"]', $key, $value);
|
86 |
+
}
|
87 |
+
$reportMessage .= "\n";
|
88 |
+
}
|
89 |
+
return $reportMessage;
|
90 |
+
}
|
91 |
+
}
|
app/code/community/Fraisr/Connect/Helper/Synchronisation/Order.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Order Synchronisation Helper
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Helper_Synchronisation_Order extends Fraisr_Connect_Helper_Synchronisation_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get order item collection which has to be synchronized
|
29 |
+
*
|
30 |
+
* @return Mage_Sales_Model_Resource_Order_Item_Collection
|
31 |
+
*/
|
32 |
+
public function getOrderItemsToSynchronize()
|
33 |
+
{
|
34 |
+
//Get config model
|
35 |
+
$config = Mage::getModel('fraisrconnect/config');
|
36 |
+
|
37 |
+
//Calculate filter date
|
38 |
+
$gmtDate = Mage::getModel('core/date')->gmtDate(
|
39 |
+
null,
|
40 |
+
Mage::getModel('core/date')->timestamp() - ($config->getOrderExportDays() * 24 * 60 * 60)
|
41 |
+
);
|
42 |
+
|
43 |
+
//Get order collection and add filters
|
44 |
+
$orderItemCollection = Mage::getModel('sales/order_item')
|
45 |
+
->getCollection()
|
46 |
+
->addFieldToFilter('main_table.fraisr_product_id', array('notnull' => 'true'))
|
47 |
+
->addFieldToFilter('main_table.parent_item_id', array('null' => 'true'))
|
48 |
+
->addFieldToFilter('main_table.updated_at', array('gt' => $gmtDate))
|
49 |
+
;
|
50 |
+
|
51 |
+
//Join sales_order - table => necessary to filter for order_status and to get the increment_id
|
52 |
+
$orderItemCollection
|
53 |
+
->getSelect()
|
54 |
+
->join(
|
55 |
+
array(
|
56 |
+
'sales_order' => Mage::getSingleton('core/resource')->getTableName('sales/order')),
|
57 |
+
'main_table.order_id = sales_order.entity_id',
|
58 |
+
array(
|
59 |
+
'sales_order.increment_id',
|
60 |
+
'sales_order.status',
|
61 |
+
'sales_order.base_currency_code',
|
62 |
+
'sales_order.order_currency_code'
|
63 |
+
)
|
64 |
+
);
|
65 |
+
|
66 |
+
return $orderItemCollection;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get order item qty for fraisr-synchronisation
|
71 |
+
*
|
72 |
+
* @param Mage_Sales_Model_Order_Item $orderItem
|
73 |
+
* @return array
|
74 |
+
*/
|
75 |
+
public function getOrderItemQty($orderItem)
|
76 |
+
{
|
77 |
+
//reference ordered amount - depending on configuration ordered or invoiced items
|
78 |
+
if (true === Mage::getModel('fraisrconnect/config')->getOrderExportInvoiceReference()) {
|
79 |
+
return (int) ($orderItem->getQtyInvoiced() - $orderItem->getQtyRefunded());
|
80 |
+
} else {
|
81 |
+
return (int) ($orderItem->getQtyOrdered() - $orderItem->getQtyRefunded() - $orderItem->getQtyCanceled());
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Create a new order synchronisation cron task to continue the previous one (+x minutes)
|
87 |
+
*
|
88 |
+
* @param Mage_Cron_Model_Schedule $observer
|
89 |
+
* @return Mage_Cron_Core_Schedule
|
90 |
+
*/
|
91 |
+
public function createOrderSyncCronTask($observer)
|
92 |
+
{
|
93 |
+
//Check if the $observer consists the necessary data and has the correct jobCode
|
94 |
+
if ('fraisrconnect_synchronisation_orders' != $observer->getJobCode()) {
|
95 |
+
throw new Fraisr_Connect_Exception(
|
96 |
+
$this->__('Observer job code is missing.')
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
//Create new cron schedule
|
101 |
+
$schedule = Mage::getModel('cron/schedule');
|
102 |
+
$schedule
|
103 |
+
->setJobCode($observer->getJobCode())
|
104 |
+
->setStatus(Mage_Cron_Model_Schedule::STATUS_PENDING)
|
105 |
+
->setScheduledAt(
|
106 |
+
date(
|
107 |
+
'Y-m-d H:i:s',
|
108 |
+
strtotime($schedule->getScheduledAt(). ' + '.self::CRON_TASK_ADDITIONAL_MINUTES.' minutes')
|
109 |
+
)
|
110 |
+
)
|
111 |
+
->setMessages($this->__(
|
112 |
+
'This schedule was created to continue %s (schedule_id)',
|
113 |
+
$observer->getScheduleId())
|
114 |
+
)
|
115 |
+
->save();
|
116 |
+
|
117 |
+
return $schedule;
|
118 |
+
}
|
119 |
+
}
|
app/code/community/Fraisr/Connect/Helper/Synchronisation/Product.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Product Synchronisation Helper
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Helper_Synchronisation_Product extends Fraisr_Connect_Helper_Synchronisation_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const PRODUCT_MIN_QTY Minimum product qty in case it is 0 or can't be estimated
|
29 |
+
*/
|
30 |
+
const PRODUCT_MIN_QTY = 1;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Calculate price and special price information
|
34 |
+
*
|
35 |
+
* @param Mage_Catalog_Model_Product $product
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function calculatePrices($product)
|
39 |
+
{
|
40 |
+
$prices = array();
|
41 |
+
|
42 |
+
//active special price
|
43 |
+
if ($product->getPrice() > $product->getFinalPrice()) {
|
44 |
+
$prices["special_price"] = round($product->getFinalPrice(), 2);
|
45 |
+
$prices["price"] = round($product->getPrice(), 2);
|
46 |
+
} else { //normal price
|
47 |
+
$prices["special_price"] = "";
|
48 |
+
$prices["price"] = round($product->getFinalPrice(), 2);
|
49 |
+
}
|
50 |
+
|
51 |
+
return $prices;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Check if 'is_start_price'-flag should be set
|
56 |
+
*
|
57 |
+
* @param Mage_Catalog_Model_Product $product
|
58 |
+
* @return int
|
59 |
+
*/
|
60 |
+
public function getIsStartPrice($product)
|
61 |
+
{
|
62 |
+
/**
|
63 |
+
* Return 1 only if product type is bundle or configurable
|
64 |
+
* This is of course no real check about is_start_price but a legal issue
|
65 |
+
*/
|
66 |
+
if ('configurable' == $product->getTypeId() || 'bundle' == $product->getTypeId()) {
|
67 |
+
return 1;
|
68 |
+
} else {
|
69 |
+
return 0;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Mark product collection as to synchronize
|
75 |
+
*
|
76 |
+
* @param Mage_Catalog_Model_Resource_Product_Collection $products
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
public function markProductCollectionAsToSynchronize($products)
|
80 |
+
{
|
81 |
+
foreach ($products as $product) {
|
82 |
+
$product
|
83 |
+
->setFraisrUpdate(Fraisr_Connect_Model_Product::SYNCHRONISATION_ITERATIONS)
|
84 |
+
->getResource()
|
85 |
+
->saveAttribute($product, 'fraisr_update');
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get to delete fraisr products
|
91 |
+
*
|
92 |
+
* 1.) fraisr_enabled:no + fraisr_id existing
|
93 |
+
*
|
94 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
95 |
+
*/
|
96 |
+
public function getDeleteFraisrProducts()
|
97 |
+
{
|
98 |
+
return Mage::getModel('catalog/product')
|
99 |
+
->getCollection()
|
100 |
+
->addAttributeToSelect('*')
|
101 |
+
->addStoreFilter(Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId())
|
102 |
+
->addFieldToFilter('fraisr_enabled', 0)
|
103 |
+
->addFieldToFilter('fraisr_id', array('notnull' => true));
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get new and update fraisr products
|
108 |
+
*
|
109 |
+
* 1.) fraisr_enabled:yes
|
110 |
+
*
|
111 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
112 |
+
*/
|
113 |
+
public function getNewAndUpdateFraisrProducts()
|
114 |
+
{
|
115 |
+
return Mage::getModel('catalog/product')
|
116 |
+
->getCollection()
|
117 |
+
->addAttributeToSelect('*')
|
118 |
+
->addStoreFilter(Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId())
|
119 |
+
->addFieldToFilter('fraisr_enabled', 1); //Only products which are enabled for Fraisr sync
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get products which as marked as to sychronize
|
124 |
+
*
|
125 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
126 |
+
*/
|
127 |
+
public function getProductsToSynchronize()
|
128 |
+
{
|
129 |
+
return Mage::getModel('catalog/product')
|
130 |
+
->getCollection()
|
131 |
+
->addAttributeToSelect('*')
|
132 |
+
->addStoreFilter(Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId())
|
133 |
+
->addFieldToFilter(
|
134 |
+
'fraisr_update',
|
135 |
+
array('gt' => 0)
|
136 |
+
); //Only products which are marked as to update (iterations > 0)
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Mark a product as synchronized
|
141 |
+
*
|
142 |
+
* @param Mage_Catalog_Model_Product $product
|
143 |
+
* @return void
|
144 |
+
*/
|
145 |
+
public function markAsSynchronized($product)
|
146 |
+
{
|
147 |
+
$product
|
148 |
+
->setFraisrUpdate(0)
|
149 |
+
->getResource()
|
150 |
+
->saveAttribute($product, 'fraisr_update');
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Descrease the synchronisation iterations by 1
|
155 |
+
*
|
156 |
+
* @param Mage_Catalog_Model_Product $product
|
157 |
+
* @return void
|
158 |
+
*/
|
159 |
+
public function decreaseSyncIteration($product)
|
160 |
+
{
|
161 |
+
$fraisrUpdate = $product->getFraisrUpdate() - 1;
|
162 |
+
if ($fraisrUpdate < 0) {
|
163 |
+
$fraisrUpdate = 0;
|
164 |
+
}
|
165 |
+
$product
|
166 |
+
->setFraisrUpdate($fraisrUpdate)
|
167 |
+
->getResource()
|
168 |
+
->saveAttribute($product, 'fraisr_update');
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Create a new product synchronisation cron task to continue the previous one (+x minutes)
|
173 |
+
*
|
174 |
+
* @param Mage_Cron_Model_Schedule $observer
|
175 |
+
* @return Mage_Cron_Core_Schedule
|
176 |
+
*/
|
177 |
+
public function createProductSyncCronTask($observer)
|
178 |
+
{
|
179 |
+
//Check if the $observer consists the necessary data and has the correct jobCode
|
180 |
+
if ('fraisrconnect_synchronisation_products' != $observer->getJobCode()) {
|
181 |
+
throw new Fraisr_Connect_Exception(
|
182 |
+
$this->__('Observer job code is missing.')
|
183 |
+
);
|
184 |
+
}
|
185 |
+
|
186 |
+
//Create new cron schedule
|
187 |
+
$schedule = Mage::getModel('cron/schedule');
|
188 |
+
$schedule
|
189 |
+
->setJobCode($observer->getJobCode())
|
190 |
+
->setStatus(Mage_Cron_Model_Schedule::STATUS_PENDING)
|
191 |
+
->setScheduledAt(
|
192 |
+
date(
|
193 |
+
'Y-m-d H:i:s',
|
194 |
+
strtotime($schedule->getScheduledAt(). ' + '.self::CRON_TASK_ADDITIONAL_MINUTES.' minutes')
|
195 |
+
)
|
196 |
+
)
|
197 |
+
->setMessages($this->__(
|
198 |
+
'This schedule was created to continue %s (schedule_id)',
|
199 |
+
$observer->getScheduleId())
|
200 |
+
)
|
201 |
+
->save();
|
202 |
+
|
203 |
+
return $schedule;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Get product qty
|
208 |
+
*
|
209 |
+
* If qty = 0 (for configurable and bundle products) set "1" by default
|
210 |
+
*
|
211 |
+
* @param Mage_Catalog_Model_Product $product
|
212 |
+
* @return int
|
213 |
+
*/
|
214 |
+
public function getProductQty($product)
|
215 |
+
{
|
216 |
+
//If product type is "configurable" or "bundle" return the min qty
|
217 |
+
if ('configurable' == $product->getTypeId() || 'bundle' == $product->getTypeId()) {
|
218 |
+
return self::PRODUCT_MIN_QTY;
|
219 |
+
}
|
220 |
+
|
221 |
+
//Get regular product qty
|
222 |
+
$qty = (int) Mage::getModel('cataloginventory/stock_item')
|
223 |
+
->loadByProduct($product)
|
224 |
+
->getQty();
|
225 |
+
|
226 |
+
//If qty is < 0, return the min qty too
|
227 |
+
if ($qty < self::PRODUCT_MIN_QTY) {
|
228 |
+
$qty = self::PRODUCT_MIN_QTY;
|
229 |
+
}
|
230 |
+
|
231 |
+
return (int) $qty;
|
232 |
+
}
|
233 |
+
}
|
app/code/community/Fraisr/Connect/Model/Api/Exception.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* General Fraisr Connect Exception
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 |
+
{ }
|
app/code/community/Fraisr/Connect/Model/Api/Request.php
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Abstract Api
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Api_Request extends Zend_Http_Client
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const GET_LIMIT General Get Limit
|
29 |
+
*/
|
30 |
+
const GET_LIMIT = 100;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const API_KEY_LIMIT Limit Get Key
|
34 |
+
*/
|
35 |
+
const API_KEY_LIMIT = 'limit';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @const API_KEY_PAGE Limit Page Key
|
39 |
+
*/
|
40 |
+
const API_KEY_PAGE = 'page';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @const API_KEY_KEY Api Key
|
44 |
+
*/
|
45 |
+
const API_KEY_KEY = 'key';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @const API_KEY_SECRET Api Secret
|
49 |
+
*/
|
50 |
+
const API_KEY_SECRET = 'secret';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @const PLUGIN_IDENTIFICATION_KEY Plugin identification header key
|
54 |
+
*/
|
55 |
+
const PLUGIN_IDENTIFICATION_KEY = 'fraisr-plugin';
|
56 |
+
|
57 |
+
/**
|
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
|
65 |
+
*
|
66 |
+
* @return void
|
67 |
+
*/
|
68 |
+
public function __construct()
|
69 |
+
{
|
70 |
+
parent::__construct(null, null);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Run GET Request to Fraisr
|
75 |
+
*
|
76 |
+
* @param string $taskApiUri
|
77 |
+
* @param int $page
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
public function requestPaginatedGet($taskApiUri, $page = 0)
|
81 |
+
{
|
82 |
+
//Set Api Uri
|
83 |
+
$this->setUri($this->buildUri($taskApiUri));
|
84 |
+
|
85 |
+
//Set Adapter
|
86 |
+
$this->setAdapter('Zend_Http_Client_Adapter_Curl');
|
87 |
+
$adapter = $this->getAdapter();
|
88 |
+
|
89 |
+
//Set Authentication Header
|
90 |
+
$this->setAuthenticationHeader();
|
91 |
+
|
92 |
+
//Set Plugin Infomation Header
|
93 |
+
$this->setPluginInformationHeader();
|
94 |
+
|
95 |
+
//Set GET-Method
|
96 |
+
$this->setMethod(Zend_Http_Client::GET);
|
97 |
+
|
98 |
+
//Set Page and Limit
|
99 |
+
$this->setParameterGet(
|
100 |
+
array(
|
101 |
+
self::API_KEY_LIMIT => self::GET_LIMIT,
|
102 |
+
self::API_KEY_PAGE => $page
|
103 |
+
)
|
104 |
+
);
|
105 |
+
|
106 |
+
//Trigger request
|
107 |
+
parent::request();
|
108 |
+
|
109 |
+
//Validate and parse response
|
110 |
+
$responseHandler = $this->getResponseHandler();
|
111 |
+
$responseHandler
|
112 |
+
->setResponse($this->getLastResponse()) //Zend_Http_Response
|
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 |
+
/**
|
126 |
+
* Run POST Request to Fraisr
|
127 |
+
*
|
128 |
+
* @param string $taskApiUri
|
129 |
+
* @param array $postParameter
|
130 |
+
* @return array
|
131 |
+
*/
|
132 |
+
public function requestPost($taskApiUri, $postParameter)
|
133 |
+
{
|
134 |
+
//Set Api Uri
|
135 |
+
$this->setUri($this->buildUri($taskApiUri));
|
136 |
+
|
137 |
+
//Set Adapter
|
138 |
+
$this->setAdapter('Zend_Http_Client_Adapter_Curl');
|
139 |
+
$adapter = $this->getAdapter();
|
140 |
+
|
141 |
+
//Set Authentication Header
|
142 |
+
$this->setAuthenticationHeader();
|
143 |
+
|
144 |
+
//Set Plugin Infomation Header
|
145 |
+
$this->setPluginInformationHeader();
|
146 |
+
|
147 |
+
//Set POST-Method
|
148 |
+
$this->setMethod(Zend_Http_Client::POST);
|
149 |
+
|
150 |
+
//Set POST data
|
151 |
+
$this->setParameterPost($postParameter);
|
152 |
+
|
153 |
+
//Trigger request
|
154 |
+
parent::request();
|
155 |
+
|
156 |
+
//Validate and parse response
|
157 |
+
$responseHandler = $this->getResponseHandler();
|
158 |
+
$responseHandler
|
159 |
+
->setResponse($this->getLastResponse()) //Zend_Http_Response
|
160 |
+
->validatePost();
|
161 |
+
|
162 |
+
return Zend_Json::decode($this->getLastResponse()->getBody());
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Run PUT Request to Fraisr
|
167 |
+
*
|
168 |
+
* @param string $taskApiUri
|
169 |
+
* @param array $postParameter
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
+
public function requestPut($taskApiUri, $postParameter)
|
173 |
+
{
|
174 |
+
//Set Api Uri
|
175 |
+
$this->setUri($this->buildUri($taskApiUri));
|
176 |
+
|
177 |
+
//Set Adapter
|
178 |
+
$this->setAdapter('Zend_Http_Client_Adapter_Curl');
|
179 |
+
$adapter = $this->getAdapter();
|
180 |
+
|
181 |
+
//Set Authentication Header
|
182 |
+
$this->setAuthenticationHeader();
|
183 |
+
|
184 |
+
//Set Plugin Infomation Header
|
185 |
+
$this->setPluginInformationHeader();
|
186 |
+
|
187 |
+
//Set PUT-Method
|
188 |
+
$this->setMethod(Zend_Http_Client::PUT);
|
189 |
+
$this->setEncType(Zend_Http_Client::ENC_URLENCODED);
|
190 |
+
|
191 |
+
//Set POST data
|
192 |
+
$this->setParameterPost($postParameter);
|
193 |
+
|
194 |
+
//Trigger request
|
195 |
+
parent::request();
|
196 |
+
|
197 |
+
//Validate response
|
198 |
+
$responseHandler = $this->getResponseHandler();
|
199 |
+
$responseHandler
|
200 |
+
->setResponse($this->getLastResponse()) //Zend_Http_Response
|
201 |
+
->validate();
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Run DELETE Request to Fraisr
|
206 |
+
*
|
207 |
+
* @param string $taskApiUri
|
208 |
+
* @return array
|
209 |
+
*/
|
210 |
+
public function requestDelete($taskApiUri)
|
211 |
+
{
|
212 |
+
//Set Api Uri
|
213 |
+
$this->setUri($this->buildUri($taskApiUri));
|
214 |
+
|
215 |
+
//Set Adapter
|
216 |
+
$this->setAdapter('Zend_Http_Client_Adapter_Curl');
|
217 |
+
$adapter = $this->getAdapter();
|
218 |
+
|
219 |
+
//Set Authentication Header
|
220 |
+
$this->setAuthenticationHeader();
|
221 |
+
|
222 |
+
//Set Plugin Infomation Header
|
223 |
+
$this->setPluginInformationHeader();
|
224 |
+
|
225 |
+
//Set DELETE-Method
|
226 |
+
$this->setMethod(Zend_Http_Client::DELETE);
|
227 |
+
|
228 |
+
//Trigger request
|
229 |
+
parent::request();
|
230 |
+
|
231 |
+
//Validate and parse response
|
232 |
+
$responseHandler = $this->getResponseHandler();
|
233 |
+
$responseHandler
|
234 |
+
->setResponse($this->getLastResponse()) //Zend_Http_Response
|
235 |
+
//400 - Bad request is allowed too in case that the product is already deleted in fraisr
|
236 |
+
->setAllowedHttpStatusCodes(array(200, 400))
|
237 |
+
->validate();
|
238 |
+
|
239 |
+
return Zend_Json::decode($this->getLastResponse()->getBody());
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Build request Uri
|
244 |
+
*
|
245 |
+
* @param string $taskApiUri
|
246 |
+
* @return string
|
247 |
+
*/
|
248 |
+
protected function buildUri($taskApiUri)
|
249 |
+
{
|
250 |
+
return $this->getConfig()->getApiUri().$taskApiUri;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Get Config
|
255 |
+
*
|
256 |
+
* @return Fraisr_Connect_Model_Config
|
257 |
+
*/
|
258 |
+
protected function getConfig()
|
259 |
+
{
|
260 |
+
return Mage::getModel('fraisrconnect/config');
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Get Response Model
|
265 |
+
*
|
266 |
+
* @return Fraisr_Connect_Model_Api_Response
|
267 |
+
*/
|
268 |
+
protected function getResponseHandler()
|
269 |
+
{
|
270 |
+
return Mage::getModel('fraisrconnect/api_response');
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Set Authentication Header
|
275 |
+
*
|
276 |
+
* @throws Fraisr_Connect_Exception
|
277 |
+
* @return void
|
278 |
+
*/
|
279 |
+
protected function setAuthenticationHeader()
|
280 |
+
{
|
281 |
+
if (true === is_null($this->getConfig()->getApiKey())
|
282 |
+
|| '' == $this->getConfig()->getApiKey()) {
|
283 |
+
throw new Fraisr_Connect_Exception(
|
284 |
+
Mage::helper('fraisrconnect/data')->__('Api key is empty. Please complete the configuration.')
|
285 |
+
);
|
286 |
+
}
|
287 |
+
|
288 |
+
if (true === is_null($this->getConfig()->getApiSecret())
|
289 |
+
|| '' == $this->getConfig()->getApiSecret()) {
|
290 |
+
throw new Fraisr_Connect_Exception(
|
291 |
+
Mage::helper('fraisrconnect/data')->__('Api secret is empty. Please complete the configuration.')
|
292 |
+
);
|
293 |
+
}
|
294 |
+
|
295 |
+
$this->setAuth(
|
296 |
+
$this->getConfig()->getApiKey(),
|
297 |
+
$this->getConfig()->getApiSecret(),
|
298 |
+
self::AUTH_BASIC
|
299 |
+
);
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Set plugin information header to indentify the request as "Magento" in fraisr
|
304 |
+
*
|
305 |
+
* @return void
|
306 |
+
*/
|
307 |
+
protected function setPluginInformationHeader()
|
308 |
+
{
|
309 |
+
$this->setHeaders(
|
310 |
+
self::PLUGIN_IDENTIFICATION_KEY,
|
311 |
+
$this->getConfig()->getPluginIdentificationValue()
|
312 |
+
);
|
313 |
+
}
|
314 |
+
}
|
app/code/community/Fraisr/Connect/Model/Api/Response.php
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Abstract Api
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Api_Response
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Response of Zend_Http_Client
|
29 |
+
* @var Zend_Http_Response
|
30 |
+
*/
|
31 |
+
protected $response = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Allowed HTTP status codes of the response
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $allowedHttpStatusCodes = array(200);
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Validate GET response
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
* @throws Fraisr_Connect_Model_Api_Exception
|
45 |
+
*/
|
46 |
+
public function validateGet()
|
47 |
+
{
|
48 |
+
$helper = Mage::helper('fraisrconnect/data');
|
49 |
+
|
50 |
+
//General validate (Response Type and Code)
|
51 |
+
$this->validate();
|
52 |
+
|
53 |
+
try {
|
54 |
+
$jsonData = Zend_Json::decode($this->response->getBody());
|
55 |
+
|
56 |
+
if (false === is_array($jsonData)
|
57 |
+
|| false === array_key_exists('data', $jsonData)
|
58 |
+
|| false === is_array($jsonData['data'])) {
|
59 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
60 |
+
$helper->__('Api response is no valid JSON.')
|
61 |
+
);
|
62 |
+
}
|
63 |
+
} catch (Exception $e) {
|
64 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
65 |
+
$helper->__('Api response is no valid JSON.')
|
66 |
+
);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Validate POST response
|
72 |
+
*
|
73 |
+
* @return void
|
74 |
+
* @throws Fraisr_Connect_Model_Api_Exception
|
75 |
+
*/
|
76 |
+
public function validatePost()
|
77 |
+
{
|
78 |
+
$helper = Mage::helper('fraisrconnect/data');
|
79 |
+
|
80 |
+
//General validate (Response Type and Code)
|
81 |
+
$this->validate();
|
82 |
+
|
83 |
+
try {
|
84 |
+
$jsonData = Zend_Json::decode($this->response->getBody());
|
85 |
+
|
86 |
+
if (false === is_array($jsonData)) {
|
87 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
88 |
+
$helper->__('Api response is no valid JSON.')
|
89 |
+
);
|
90 |
+
}
|
91 |
+
} catch (Exception $e) {
|
92 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
93 |
+
$helper->__('Api response is no valid JSON.')
|
94 |
+
);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Validate response type & code
|
101 |
+
*
|
102 |
+
* @return void
|
103 |
+
* @throws Fraisr_Connect_Model_Api_Exception
|
104 |
+
*/
|
105 |
+
public function validate()
|
106 |
+
{
|
107 |
+
$helper = Mage::helper('fraisrconnect/data');
|
108 |
+
|
109 |
+
if (!$this->response instanceOf Zend_Http_Response) {
|
110 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
111 |
+
$helper->__(
|
112 |
+
'Api response class is "%s" instead of "%s".',
|
113 |
+
gettype($this->response),
|
114 |
+
'Zend_Http_Response'
|
115 |
+
)
|
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)
|
123 |
+
&& true === array_key_exists('error', $jsonData)
|
124 |
+
&& true === array_key_exists('message', $jsonData['error'])) {
|
125 |
+
$fraisrErrorMessage = $helper->__(
|
126 |
+
'fraisr error message: "%s".',
|
127 |
+
$jsonData['error']['message']
|
128 |
+
);
|
129 |
+
}
|
130 |
+
|
131 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
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 |
+
);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get complete Json Response
|
144 |
+
*
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function getJsonResponse()
|
148 |
+
{
|
149 |
+
return Zend_Json::decode($this->response->getBody());
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Get Json Response from 'data'-node
|
154 |
+
*
|
155 |
+
* @return array
|
156 |
+
*/
|
157 |
+
public function getJsonResponseData()
|
158 |
+
{
|
159 |
+
$jsonData = $this->getJsonResponse();
|
160 |
+
return $jsonData['data'];
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Check if the response contains a 'next_url'
|
165 |
+
*
|
166 |
+
* @return boolean
|
167 |
+
*/
|
168 |
+
public function isPaginateNextPage()
|
169 |
+
{
|
170 |
+
return array_key_exists('next_url', $this->getJsonResponse());
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Set response
|
175 |
+
* @param Zend_Http_Response $response
|
176 |
+
* @return Fraisr_Connect_Model_Api_Response
|
177 |
+
*/
|
178 |
+
public function setResponse($response)
|
179 |
+
{
|
180 |
+
$this->response = $response;
|
181 |
+
return $this;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Set allowed HTTP status codes for the response
|
186 |
+
*
|
187 |
+
* @param array $statusCodes
|
188 |
+
* @return Fraisr_Connect_Model_Api_Response
|
189 |
+
*/
|
190 |
+
public function setAllowedHttpStatusCodes($statusCodes)
|
191 |
+
{
|
192 |
+
$this->allowedHttpStatusCodes = $statusCodes;
|
193 |
+
return $this;
|
194 |
+
}
|
195 |
+
}
|
app/code/community/Fraisr/Connect/Model/Category.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Category Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Category extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$this->_init('fraisrconnect/category');
|
34 |
+
parent::_construct();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Synchronize category data - retrieve by API and save them in the local database
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function synchronize()
|
43 |
+
{
|
44 |
+
$helper = Mage::helper('fraisrconnect/adminhtml_data');
|
45 |
+
|
46 |
+
try {
|
47 |
+
//Retrieve category data
|
48 |
+
$categories = Mage::getModel('fraisrconnect/api_request')->requestPaginatedGet(
|
49 |
+
Mage::getModel('fraisrconnect/config')->getCategoryApiUri()
|
50 |
+
);
|
51 |
+
|
52 |
+
//Check is categories were retrieved
|
53 |
+
if (0 === count($categories)) {
|
54 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
55 |
+
$helper->__('0 categories retrieved. Abort synchronisation.'),
|
56 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CATEGORY_SYNC
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
//Delete current categories
|
61 |
+
Mage::getResourceModel('fraisrconnect/category')->deleteAllCategories();
|
62 |
+
|
63 |
+
//Save new retrieved categories
|
64 |
+
$this->saveRetrievedCategories($categories);
|
65 |
+
|
66 |
+
//Success Message
|
67 |
+
$helper->logAndAdminOutputSuccess(
|
68 |
+
$helper->__(
|
69 |
+
'Category synchronisation succeeded. Imported %s categories.',
|
70 |
+
count($categories)
|
71 |
+
),
|
72 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CATEGORY_SYNC
|
73 |
+
);
|
74 |
+
} catch (Fraisr_Connect_Model_Api_Exception $e) {
|
75 |
+
$helper->logAndAdminOutputException(
|
76 |
+
$helper->__(
|
77 |
+
'Category synchronisation failed during API request with message: "%s".',
|
78 |
+
$e->getMessage()
|
79 |
+
),
|
80 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CATEGORY_SYNC,
|
81 |
+
$e
|
82 |
+
);
|
83 |
+
} catch (Fraisr_Connect_Exception $e) {
|
84 |
+
$helper->logAndAdminOutputException(
|
85 |
+
$helper->__(
|
86 |
+
'Category synchronisation failed with message: "%s".',
|
87 |
+
$e->getMessage()
|
88 |
+
),
|
89 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CATEGORY_SYNC,
|
90 |
+
$e
|
91 |
+
);
|
92 |
+
} catch (Exception $e) {
|
93 |
+
$helper->logAndAdminOutputException(
|
94 |
+
$helper->__(
|
95 |
+
'An unknown error during category synchronisation happened with message: "%s"',
|
96 |
+
$e->getMessage()
|
97 |
+
),
|
98 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CATEGORY_SYNC,
|
99 |
+
$e
|
100 |
+
);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Save retrieved categories
|
107 |
+
*
|
108 |
+
* @param array $retrievedCategories
|
109 |
+
* @return void
|
110 |
+
*/
|
111 |
+
public function saveRetrievedCategories($retrievedCategories)
|
112 |
+
{
|
113 |
+
//For every retrieved category
|
114 |
+
foreach ($retrievedCategories as $retrievedCategorie) {
|
115 |
+
//Copy instance of this to have a fresh object for every save
|
116 |
+
$category = $this;
|
117 |
+
|
118 |
+
//Add data
|
119 |
+
$category
|
120 |
+
->setId($retrievedCategorie['_id'])
|
121 |
+
->setName($retrievedCategorie['name']);
|
122 |
+
|
123 |
+
//Set label if existing
|
124 |
+
if (true === array_key_exists('label', $retrievedCategorie)) {
|
125 |
+
$category->setLabel($retrievedCategorie['label']);
|
126 |
+
} else {
|
127 |
+
$category->setLabel(null);
|
128 |
+
}
|
129 |
+
|
130 |
+
//Check if parent category is given
|
131 |
+
if (true === array_key_exists('parent', $retrievedCategorie)
|
132 |
+
&& true === is_array($retrievedCategorie['parent'])
|
133 |
+
&& true === array_key_exists('_id', $retrievedCategorie['parent'])) {
|
134 |
+
$category->setParentId($retrievedCategorie['parent']['_id']);
|
135 |
+
} else {
|
136 |
+
$category->setParentId(null);
|
137 |
+
}
|
138 |
+
|
139 |
+
//save item
|
140 |
+
$category->save();
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
app/code/community/Fraisr/Connect/Model/Cause.php
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Cause Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Cause extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$this->_init('fraisrconnect/cause');
|
34 |
+
parent::_construct();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Synchronize cause data - retrieve by API and save them in the local database
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function synchronize()
|
43 |
+
{
|
44 |
+
$helper = Mage::helper('fraisrconnect/adminhtml_data');
|
45 |
+
|
46 |
+
try {
|
47 |
+
//Retrieve Cause data
|
48 |
+
$causes = Mage::getModel('fraisrconnect/api_request')->requestPaginatedGet(
|
49 |
+
Mage::getModel('fraisrconnect/config')->getCauseApiUri()
|
50 |
+
);
|
51 |
+
|
52 |
+
//Check is causes were retrieved
|
53 |
+
if (0 === count($causes)) {
|
54 |
+
$helper->logAndAdminOutputNotice(
|
55 |
+
$helper->__('0 causes retrieved during synchronisation.'),
|
56 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
//Delete current causes
|
61 |
+
Mage::getResourceModel('fraisrconnect/cause')->deleteAllCauses();
|
62 |
+
|
63 |
+
//Save new retrieved causes
|
64 |
+
$this->saveRetrievedCauses($causes);
|
65 |
+
|
66 |
+
//Success Message
|
67 |
+
$helper->logAndAdminOutputSuccess(
|
68 |
+
$helper->__(
|
69 |
+
'Cause synchronisation succeeded. Imported %s causes.',
|
70 |
+
count($causes)
|
71 |
+
),
|
72 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
73 |
+
);
|
74 |
+
} catch (Fraisr_Connect_Model_Api_Exception $e) {
|
75 |
+
$helper->logAndAdminOutputException(
|
76 |
+
$helper->__(
|
77 |
+
'Cause synchronisation failed during API request with message: "%s".',
|
78 |
+
$e->getMessage()
|
79 |
+
),
|
80 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC,
|
81 |
+
$e
|
82 |
+
);
|
83 |
+
} catch (Fraisr_Connect_Exception $e) {
|
84 |
+
$helper->logAndAdminOutputException(
|
85 |
+
$helper->__(
|
86 |
+
'Cause synchronisation failed with message: "%s".',
|
87 |
+
$e->getMessage()
|
88 |
+
),
|
89 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC,
|
90 |
+
$e
|
91 |
+
);
|
92 |
+
} catch (Exception $e) {
|
93 |
+
$helper->logAndAdminOutputException(
|
94 |
+
$helper->__(
|
95 |
+
'An unknown error during cause synchronisation happened with message: "%s"',
|
96 |
+
$e->getMessage()
|
97 |
+
),
|
98 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC,
|
99 |
+
$e
|
100 |
+
);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Save retrieved causes
|
106 |
+
*
|
107 |
+
* @param array $retrievedCauses
|
108 |
+
* @return void
|
109 |
+
*/
|
110 |
+
protected function saveRetrievedCauses($retrievedCauses)
|
111 |
+
{
|
112 |
+
//For every retrieved cause
|
113 |
+
foreach ($retrievedCauses as $retrievedCause) {
|
114 |
+
//Copy instance of this to have a fresh object for every save
|
115 |
+
$cause = $this;
|
116 |
+
|
117 |
+
//Add data and save item
|
118 |
+
$cause
|
119 |
+
->setId($retrievedCause['_id'])
|
120 |
+
->setName($retrievedCause['name'])
|
121 |
+
->setDescription($retrievedCause['description'])
|
122 |
+
->setUrl($retrievedCause['url'])
|
123 |
+
->setImageUrl($retrievedCause['images']['source'])
|
124 |
+
->setOfficial($retrievedCause['official'])
|
125 |
+
->setRestrictions($this->getRestrictions($retrievedCause))
|
126 |
+
->save();
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Check if products exists which causes doesn't exist anymore
|
132 |
+
* If some were find, set 'fraisr_enabled' to false
|
133 |
+
*
|
134 |
+
* @return void
|
135 |
+
*/
|
136 |
+
public function productCheck()
|
137 |
+
{
|
138 |
+
try {
|
139 |
+
//Get all current cause ids
|
140 |
+
$causeIds = $this->getCollection()->getAllIds();
|
141 |
+
|
142 |
+
//Get products which match multiple criterias so that their fraisr-active-status has to be disabled
|
143 |
+
$productsToDisableInFraisr = $this->getProductsToDisableInFraisr($causeIds);
|
144 |
+
|
145 |
+
//Stop processing if no products has to be fraisr-disabled
|
146 |
+
if ($productsToDisableInFraisr->count() == 0) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
|
150 |
+
//Set fraisr products as inactive
|
151 |
+
$this->disableProductsInFraisr($productsToDisableInFraisr);
|
152 |
+
} catch (Fraisr_Connect_Exception $e) {
|
153 |
+
$helper->logAndAdminOutputException(
|
154 |
+
$helper->__(
|
155 |
+
'Product cause check failed with message: "%s".',
|
156 |
+
$e->getMessage()
|
157 |
+
),
|
158 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
159 |
+
);
|
160 |
+
} catch (Exception $e) {
|
161 |
+
$helper->logAndAdminOutputException(
|
162 |
+
$helper->__(
|
163 |
+
'An unknown error during product cause check happened with message: "%s"',
|
164 |
+
$e->getMessage()
|
165 |
+
),
|
166 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
167 |
+
);
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get products which match multiple criterias so
|
173 |
+
* that their fraisr-active-status has to be disabled
|
174 |
+
*
|
175 |
+
* @param array $causeIds
|
176 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
177 |
+
*/
|
178 |
+
protected function getProductsToDisableInFraisr($causeIds)
|
179 |
+
{
|
180 |
+
$products = Mage::getModel('catalog/product')->getCollection();
|
181 |
+
$products
|
182 |
+
->addFieldToFilter('fraisr_enabled', 1); //Only products which are enabled for Fraisr sync
|
183 |
+
|
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 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Set 'fraisr_enabled' to no for all given products
|
195 |
+
*
|
196 |
+
* @param Mage_Catalog_Model_Resource_Product_Collection $productsToDisableInFraisr
|
197 |
+
* @return void
|
198 |
+
*/
|
199 |
+
protected function disableProductsInFraisr($productsToDisableInFraisr)
|
200 |
+
{
|
201 |
+
$helper = Mage::helper('fraisrconnect/adminhtml_data');
|
202 |
+
|
203 |
+
$disabledSkus = array();
|
204 |
+
foreach ($productsToDisableInFraisr as $product) {
|
205 |
+
$product
|
206 |
+
->setFraisrEnabled(0)
|
207 |
+
->save();
|
208 |
+
$disabledSkus[] = $product->getSku();
|
209 |
+
}
|
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 |
+
),
|
217 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
218 |
+
);
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Get restrictions list from api and transform it into a comma-separated string
|
223 |
+
*
|
224 |
+
* @param array $retrievedCause
|
225 |
+
* @return string|null
|
226 |
+
*/
|
227 |
+
protected function getRestrictions($retrievedCause)
|
228 |
+
{
|
229 |
+
//Return null if no restrictions were given
|
230 |
+
if (true === is_null($retrievedCause['restrictions'])) {
|
231 |
+
return null;
|
232 |
+
}
|
233 |
+
|
234 |
+
//Loop through restrictions
|
235 |
+
$restriction = array();
|
236 |
+
foreach ($retrievedCause['restrictions'] as $restrictionKey => $restrictionName) {
|
237 |
+
$restriction[] = $restrictionKey;
|
238 |
+
}
|
239 |
+
|
240 |
+
//Return restrictions comma-separated
|
241 |
+
return implode(',', $restriction);
|
242 |
+
}
|
243 |
+
}
|
app/code/community/Fraisr/Connect/Model/Config.php
ADDED
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Config Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Config
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Is extension activated
|
29 |
+
*
|
30 |
+
* @return boolean
|
31 |
+
*/
|
32 |
+
public function isActive()
|
33 |
+
{
|
34 |
+
return (1 == Mage::getStoreConfig('fraisrconnect/general/active'));
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Is sandbox mode on
|
39 |
+
*
|
40 |
+
* @return boolean
|
41 |
+
*/
|
42 |
+
public function isSandboxMode()
|
43 |
+
{
|
44 |
+
return (1 == Mage::getStoreConfig('fraisrconnect/general/sandbox'));
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get Api Key
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function getApiKey()
|
53 |
+
{
|
54 |
+
return (string) Mage::getStoreConfig('fraisrconnect/general/key');
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get Api Secret
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function getApiSecret()
|
63 |
+
{
|
64 |
+
return (string) Mage::getStoreConfig('fraisrconnect/general/secret');
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Get support email address
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function getSupportEmail()
|
73 |
+
{
|
74 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/support_email');
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Get commercial register url
|
79 |
+
*
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function getCommercialRegisterUrl()
|
83 |
+
{
|
84 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/commercial_register_url');
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get API URL depending on Sandbox/Live settings
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
public function getApiUri()
|
93 |
+
{
|
94 |
+
if (true === $this->isSandboxMode()) {
|
95 |
+
return $this->getSandboxApiUri();
|
96 |
+
} else {
|
97 |
+
return $this->getLiveApiUri();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get Live API URL
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getLiveApiUri()
|
107 |
+
{
|
108 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/api/live');
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get Sandbox API URL
|
113 |
+
*
|
114 |
+
* @return string
|
115 |
+
*/
|
116 |
+
public function getSandboxApiUri()
|
117 |
+
{
|
118 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/api/sandbox');
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get cause api url
|
123 |
+
*
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function getCauseApiUri()
|
127 |
+
{
|
128 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/api/cause');
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Get category api url
|
133 |
+
*
|
134 |
+
* @return string
|
135 |
+
*/
|
136 |
+
public function getCategoryApiUri()
|
137 |
+
{
|
138 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/api/category');
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Get plugin identification value
|
143 |
+
*
|
144 |
+
* @return string
|
145 |
+
*/
|
146 |
+
public function getPluginIdentificationValue()
|
147 |
+
{
|
148 |
+
return (string) Mage::getStoreConfig('fraisrconnect/static/api/plugin_identification_value');
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Get product api url
|
153 |
+
*
|
154 |
+
* @param string $fraisrProductId
|
155 |
+
* @return string
|
156 |
+
*/
|
157 |
+
public function getProductApiUri($fraisrProductId = '')
|
158 |
+
{
|
159 |
+
return (string) sprintf(
|
160 |
+
Mage::getStoreConfig('fraisrconnect/static/api/product'),
|
161 |
+
$fraisrProductId
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Get order api url
|
167 |
+
*
|
168 |
+
* @param string $fraisrOrderId
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public function getOrderApiUri($fraisrOrderId = '')
|
172 |
+
{
|
173 |
+
return (string) sprintf(
|
174 |
+
Mage::getStoreConfig('fraisrconnect/static/api/order'),
|
175 |
+
$fraisrOrderId
|
176 |
+
);
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Get donation label iframe url
|
181 |
+
*
|
182 |
+
* @param string $fraisrId
|
183 |
+
* @return string
|
184 |
+
*/
|
185 |
+
public function getDonationLabelIframeUri($fraisrId = '')
|
186 |
+
{
|
187 |
+
return (string) sprintf(
|
188 |
+
Mage::getStoreConfig('fraisrconnect/static/api/donation_label_iframe'),
|
189 |
+
$fraisrId
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Get fraisr widget js uri
|
195 |
+
*
|
196 |
+
* @return string
|
197 |
+
*/
|
198 |
+
public function getFrontendWidgetJsUri()
|
199 |
+
{
|
200 |
+
return $this->getApiUri().Mage::getStoreConfig('fraisrconnect/static/api/frontend_js');
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Get fraisr widget css uri
|
205 |
+
*
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
public function getFrontendWidgetCssUri()
|
209 |
+
{
|
210 |
+
return $this->getApiUri().Mage::getStoreConfig('fraisrconnect/static/api/frontend_css');
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Get store id for the product synchronisation
|
215 |
+
*
|
216 |
+
* @return int
|
217 |
+
*/
|
218 |
+
public function getCatalogExportStoreId()
|
219 |
+
{
|
220 |
+
return (int) Mage::getStoreConfig('fraisrconnect/catalog_export/scope');
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Get allowed order status for order synchronisation
|
225 |
+
*
|
226 |
+
* @return array
|
227 |
+
*/
|
228 |
+
public function getOrderExportOrderStatus()
|
229 |
+
{
|
230 |
+
return explode(',', Mage::getStoreConfig('fraisrconnect/order_export/order_status'));
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Get days to check in past for order synchronisation
|
235 |
+
*
|
236 |
+
* @return int
|
237 |
+
*/
|
238 |
+
public function getOrderExportDays()
|
239 |
+
{
|
240 |
+
return (int) Mage::getStoreConfig('fraisrconnect/order_export/synchronisation_days');
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Check if invoice item amount should be taken as reference instead of order item amount
|
245 |
+
*
|
246 |
+
* @return boolean
|
247 |
+
*/
|
248 |
+
public function getOrderExportInvoiceReference()
|
249 |
+
{
|
250 |
+
return (1 == Mage::getStoreConfig('fraisrconnect/order_export/invoice_items'));
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Get product attribute for fraisr description
|
255 |
+
*
|
256 |
+
* @return string
|
257 |
+
*/
|
258 |
+
public function getProductDescriptionAttribute()
|
259 |
+
{
|
260 |
+
return Mage::getStoreConfig('fraisrconnect/catalog_export/description_attribute');
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Get donation label
|
265 |
+
*
|
266 |
+
* @return string
|
267 |
+
*/
|
268 |
+
public function getDonationLabel()
|
269 |
+
{
|
270 |
+
return Mage::getStoreConfig('fraisrconnect/frontend/donation_label');
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Get donation label icon position
|
276 |
+
*
|
277 |
+
* @return string
|
278 |
+
*/
|
279 |
+
public function getDonationLabelIconPosition()
|
280 |
+
{
|
281 |
+
return Mage::getStoreConfig('fraisrconnect/frontend/icon_position');
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Get donation label banderole position
|
286 |
+
*
|
287 |
+
* @return string
|
288 |
+
*/
|
289 |
+
public function getDonationLabelBanderolePosition()
|
290 |
+
{
|
291 |
+
return Mage::getStoreConfig('fraisrconnect/frontend/banderole_position');
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Get donation label position
|
296 |
+
*
|
297 |
+
* @return string
|
298 |
+
*/
|
299 |
+
public function getDonationLabelPosition()
|
300 |
+
{
|
301 |
+
if (Fraisr_Connect_Model_System_Config_Source_DonationLabel::DONATION_LABEL_ICON
|
302 |
+
== $this->getDonationLabel()) {
|
303 |
+
return $this->getDonationLabelIconPosition();
|
304 |
+
} elseif (Fraisr_Connect_Model_System_Config_Source_DonationLabel::DONATION_LABEL_BANDEROLE
|
305 |
+
== $this->getDonationLabel()) {
|
306 |
+
return $this->getDonationLabelBanderolePosition();
|
307 |
+
}
|
308 |
+
return '';
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Get fraisr product delete queue
|
313 |
+
*
|
314 |
+
* returns array(
|
315 |
+
* 'sku' => string '<sku>'
|
316 |
+
* 'fraisr_id' => '<fraisr_id>''
|
317 |
+
* )
|
318 |
+
*
|
319 |
+
* @return array
|
320 |
+
*/
|
321 |
+
public function getProductsFromDeleteQueue()
|
322 |
+
{
|
323 |
+
$productsToDelete = Mage::getStoreConfig('fraisrconnect/dynamic/products_to_delete');
|
324 |
+
|
325 |
+
if (true === is_null($productsToDelete)) {
|
326 |
+
return array();
|
327 |
+
} elseif (true === is_array(unserialize($productsToDelete))) {
|
328 |
+
return unserialize($productsToDelete);
|
329 |
+
} else {
|
330 |
+
return array();
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Add a product to the fraisr delete queue
|
336 |
+
*
|
337 |
+
* @param Mage_Catalog_Model_Product $product
|
338 |
+
* @return void
|
339 |
+
*/
|
340 |
+
public function addProductToDeleteQueue($product)
|
341 |
+
{
|
342 |
+
//Get existing queue
|
343 |
+
$productsToDelete = $this->getProductsFromDeleteQueue();
|
344 |
+
$productsToDelete[$product->getSku()] = array(
|
345 |
+
'sku' => $product->getSku(),
|
346 |
+
'fraisr_id' => $product->getFraisrId()
|
347 |
+
);
|
348 |
+
|
349 |
+
Mage::getModel('core/config')
|
350 |
+
->saveConfig('fraisrconnect/dynamic/products_to_delete', serialize($productsToDelete));
|
351 |
+
|
352 |
+
//Clean configuration cache - otherwise the queue will be outdated until next cache cleaning
|
353 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Remove a product from fraisr delete queue
|
358 |
+
*
|
359 |
+
* @param Mage_Catalog_Model_Product $product
|
360 |
+
* @return void
|
361 |
+
*/
|
362 |
+
public function removeProductFromDeleteQueue($sku)
|
363 |
+
{
|
364 |
+
//Get existing queue
|
365 |
+
$productsToDelete = $this->getProductsFromDeleteQueue();
|
366 |
+
|
367 |
+
//If sku exists in delete queue, remove it
|
368 |
+
if (true === array_key_exists($sku, $productsToDelete)) {
|
369 |
+
unset($productsToDelete[$sku]);
|
370 |
+
|
371 |
+
Mage::getModel('core/config')
|
372 |
+
->saveConfig('fraisrconnect/dynamic/products_to_delete', serialize($productsToDelete));
|
373 |
+
}
|
374 |
+
|
375 |
+
//Clean configuration cache - otherwise the queue will be outdated until next cache cleaning
|
376 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
377 |
+
}
|
378 |
+
}
|
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Category.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Category Source Model for category product attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 = '';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve all categories
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getAllOptions()
|
39 |
+
{
|
40 |
+
if (is_null($this->_options)) {
|
41 |
+
$this->_options = array(
|
42 |
+
array(
|
43 |
+
'label' => Mage::helper('adminhtml/data')->__('-- Please Select --'),
|
44 |
+
'value' => '',
|
45 |
+
)
|
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) {
|
52 |
+
Mage::getSingleton('adminhtml/session')->addNotice(
|
53 |
+
Mage::helper('fraisrconnect/data')->__('fraisr categories have to be synchronized.')
|
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
|
60 |
+
if (true === is_null($category->getParentId())) {
|
61 |
+
$this->_options[$category->getId()] = array(
|
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
|
69 |
+
if (false === is_null($category->getLabel())) {
|
70 |
+
$label .= ' ('.$category->getLabel().')';
|
71 |
+
}
|
72 |
+
|
73 |
+
$this->_options[$category->getParentId()]['value'][] = array(
|
74 |
+
'label' => $label,
|
75 |
+
'value' => $category->getId(),
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
return $this->_options;
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Cause.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Cause Source Model for cause product attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 = '';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve all causes
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getAllOptions()
|
39 |
+
{
|
40 |
+
if (is_null($this->_options)) {
|
41 |
+
$this->_options = array(
|
42 |
+
array(
|
43 |
+
'label' => Mage::helper('adminhtml/data')->__('-- Please Select --'),
|
44 |
+
'value' => '',
|
45 |
+
)
|
46 |
+
);
|
47 |
+
|
48 |
+
$causeCollection = Mage::getModel('fraisrconnect/cause')->getCollection();
|
49 |
+
//If no causes exist, add a notice that causes have to be synched
|
50 |
+
if (true === Mage::getModel('fraisrconnect/config')->isActive()
|
51 |
+
&& $causeCollection->count() === 0) {
|
52 |
+
Mage::getSingleton('adminhtml/session')->addNotice(
|
53 |
+
Mage::helper('fraisrconnect/data')->__('fraisr causes have to be synchronized.')
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
//For every synched cause => create a select option
|
58 |
+
foreach ($causeCollection as $cause) {
|
59 |
+
//Add restriction in brackets if existing
|
60 |
+
$restriction = '';
|
61 |
+
if (false === is_null($cause->getRestrictions())) {
|
62 |
+
$restriction = ' ('.$cause->getRestrictions().')';
|
63 |
+
}
|
64 |
+
|
65 |
+
$this->_options[] = array(
|
66 |
+
'label' => $cause->getName().$restriction,
|
67 |
+
'value' => $cause->getId(),
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
return $this->_options;
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/DonationPercentage.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* DonationPercentage Source Model for donation product attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retrieve all donation percentages
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function getAllOptions()
|
48 |
+
{
|
49 |
+
if (is_null($this->_options)) {
|
50 |
+
$this->_options = array(
|
51 |
+
array(
|
52 |
+
'label' => Mage::helper('adminhtml/data')->__('-- Please Select --'),
|
53 |
+
'value' => '',
|
54 |
+
)
|
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,
|
62 |
+
);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this->_options;
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Fraisr/Connect/Model/Entity/Attribute/Source/Visibility.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Visibility Source Model for visibility product attribute
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Retrieve all causes
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
public function getAllOptions()
|
54 |
+
{
|
55 |
+
if (is_null($this->_options)) {
|
56 |
+
$this->_options = array(
|
57 |
+
array(
|
58 |
+
'label' => Mage::helper('fraisrconnect/data')->__(
|
59 |
+
self::FRAISR_VISIBILITY_KEY.self::FRAISR_VISIBILITY_BOTH
|
60 |
+
),
|
61 |
+
'value' => self::FRAISR_VISIBILITY_BOTH,
|
62 |
+
),
|
63 |
+
array(
|
64 |
+
'label' => Mage::helper('fraisrconnect/data')->__(
|
65 |
+
self::FRAISR_VISIBILITY_KEY.self::FRAISR_VISIBILITY_SHOP
|
66 |
+
),
|
67 |
+
'value' => self::FRAISR_VISIBILITY_SHOP,
|
68 |
+
),
|
69 |
+
array(
|
70 |
+
'label' => Mage::helper('fraisrconnect/data')->__(
|
71 |
+
self::FRAISR_VISIBILITY_KEY.self::FRAISR_VISIBILITY_FRAISR
|
72 |
+
),
|
73 |
+
'value' => self::FRAISR_VISIBILITY_FRAISR,
|
74 |
+
),
|
75 |
+
);
|
76 |
+
}
|
77 |
+
return $this->_options;
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Fraisr/Connect/Model/Log.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Log extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const TYPE_CODE_SUCCESS Success Type Key
|
29 |
+
*/
|
30 |
+
const TYPE_CODE_SUCCESS = "success";
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const TYPE_CODE_WARNING Warning Type Key
|
34 |
+
*/
|
35 |
+
const TYPE_CODE_WARNING = "warning";
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @const TYPE_CODE_ERROR Error Type Key
|
39 |
+
*/
|
40 |
+
const TYPE_CODE_ERROR = "error";
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @const TYPE_CODE_NOTICE Notice Type Key
|
44 |
+
*/
|
45 |
+
const TYPE_CODE_NOTICE = "notice";
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @const LOG_TASK_CAUSE_SYNC Get cause synchronisation task
|
49 |
+
*/
|
50 |
+
const LOG_TASK_CAUSE_SYNC = 'Cause synchronisation';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @const LOG_TASK_CATEGORY_SYNC Get category synchronisation task
|
54 |
+
*/
|
55 |
+
const LOG_TASK_CATEGORY_SYNC = 'Category synchronisation';
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @const LOG_TASK_PRODUCT_SYNC Get product synchronisation task
|
59 |
+
*/
|
60 |
+
const LOG_TASK_PRODUCT_SYNC = 'Product synchronisation';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @const LOG_TASK_ORDER_SYNC Get order synchronisation task
|
64 |
+
*/
|
65 |
+
const LOG_TASK_ORDER_SYNC = 'Order synchronisation';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @const LOG_TASK_CREDITMEMO_SYNC Get creditmemo synchronisation task
|
69 |
+
*/
|
70 |
+
const LOG_TASK_CREDITMEMO_SYNC = 'Creditmemo synchronisation';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Constructor
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
protected function _construct()
|
77 |
+
{
|
78 |
+
$this->_init('fraisrconnect/log');
|
79 |
+
parent::_construct();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get Log Tasks
|
84 |
+
*
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public function getTaskOptions()
|
88 |
+
{
|
89 |
+
$helper = Mage::helper('fraisrconnect/data');
|
90 |
+
|
91 |
+
return array(
|
92 |
+
self::LOG_TASK_CAUSE_SYNC => $helper->__(self::LOG_TASK_CAUSE_SYNC),
|
93 |
+
self::LOG_TASK_CATEGORY_SYNC => $helper->__(self::LOG_TASK_CATEGORY_SYNC),
|
94 |
+
self::LOG_TASK_PRODUCT_SYNC => $helper->__(self::LOG_TASK_PRODUCT_SYNC),
|
95 |
+
self::LOG_TASK_ORDER_SYNC => $helper->__(self::LOG_TASK_ORDER_SYNC),
|
96 |
+
self::LOG_TASK_CREDITMEMO_SYNC => $helper->__(self::LOG_TASK_CREDITMEMO_SYNC),
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get Log Types
|
102 |
+
*
|
103 |
+
* @return array
|
104 |
+
*/
|
105 |
+
public function getTypeOptions()
|
106 |
+
{
|
107 |
+
$helper = Mage::helper('fraisrconnect/data');
|
108 |
+
|
109 |
+
return array(
|
110 |
+
self::TYPE_CODE_SUCCESS => $helper->__('Success'),
|
111 |
+
self::TYPE_CODE_WARNING => $helper->__('Warning'),
|
112 |
+
self::TYPE_CODE_ERROR => $helper->__('Error'),
|
113 |
+
self::TYPE_CODE_NOTICE => $helper->__('Notice'),
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Log success entry
|
119 |
+
*
|
120 |
+
* @return Fraisr_Connect_Model_Log
|
121 |
+
*/
|
122 |
+
public function logSuccess()
|
123 |
+
{
|
124 |
+
$this
|
125 |
+
->setType(self::TYPE_CODE_SUCCESS)
|
126 |
+
->save();
|
127 |
+
return $this;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Log warning entry
|
132 |
+
*
|
133 |
+
* @return Fraisr_Connect_Model_Log
|
134 |
+
*/
|
135 |
+
public function logWarning()
|
136 |
+
{
|
137 |
+
$this
|
138 |
+
->setType(self::TYPE_CODE_WARNING)
|
139 |
+
->save();
|
140 |
+
return $this;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Log error entry
|
145 |
+
*
|
146 |
+
* @return Fraisr_Connect_Model_Log
|
147 |
+
*/
|
148 |
+
public function logError()
|
149 |
+
{
|
150 |
+
$this
|
151 |
+
->setType(self::TYPE_CODE_ERROR)
|
152 |
+
->save();
|
153 |
+
return $this;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Log notice entry
|
158 |
+
*
|
159 |
+
* @return Fraisr_Connect_Model_Log
|
160 |
+
*/
|
161 |
+
public function logNotice()
|
162 |
+
{
|
163 |
+
$this
|
164 |
+
->setType(self::TYPE_CODE_NOTICE)
|
165 |
+
->save();
|
166 |
+
return $this;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Rewrite save method to add the current GMT created_at date
|
171 |
+
*
|
172 |
+
* @return Fraisr_Connect_Model_Log
|
173 |
+
*/
|
174 |
+
public function save()
|
175 |
+
{
|
176 |
+
$this->setCreatedAt(Mage::getModel('core/date')->gmtDate());
|
177 |
+
return parent::save();
|
178 |
+
}
|
179 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Category.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Category Resource Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Primery key auto increment flag
|
29 |
+
*
|
30 |
+
* @var bool
|
31 |
+
*/
|
32 |
+
protected $_isPkAutoIncrement = false;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
$this->_init('fraisrconnect/category', 'id');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Delete all categories
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
public function deleteAllCategories()
|
50 |
+
{
|
51 |
+
$this
|
52 |
+
->_getConnection('core_write')
|
53 |
+
->delete(
|
54 |
+
$this->getTable('fraisrconnect/category')
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Category/Collection.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Category Resource Collection Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->_init('fraisrconnect/category');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Cause.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Cause Resource Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Cause extends Mage_Core_Model_Mysql4_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Primery key auto increment flag
|
29 |
+
*
|
30 |
+
* @var bool
|
31 |
+
*/
|
32 |
+
protected $_isPkAutoIncrement = false;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
$this->_init('fraisrconnect/cause', 'id');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Delete all causes
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
public function deleteAllCauses()
|
50 |
+
{
|
51 |
+
$this
|
52 |
+
->_getConnection('core_write')
|
53 |
+
->delete(
|
54 |
+
$this->getTable('fraisrconnect/cause')
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Cause/Collection.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Cause Resource Collection Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Cause_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->_init('fraisrconnect/cause');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Log.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Resource Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
$this->_init('fraisrconnect/log', 'id');
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Fraisr/Connect/Model/Mysql4/Log/Collection.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Resource Collection Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Constructor
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->_init('fraisrconnect/log');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fraisr/Connect/Model/Observer.php
ADDED
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Observer
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Observer
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Initiate cause synchronisation
|
29 |
+
* & check for products with non-existing causes
|
30 |
+
*
|
31 |
+
* @param Mage_Cron_Model_Schedule $observer
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function synchronizeCauses($observer)
|
35 |
+
{
|
36 |
+
//Check if extension is active
|
37 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
|
41 |
+
//Retrieve and save causes
|
42 |
+
Mage::getModel('fraisrconnect/cause')->synchronize();
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Check if products exists which causes doesn't exist anymore
|
46 |
+
* If some were find, set 'fraisr_enabled' to false
|
47 |
+
*/
|
48 |
+
Mage::getModel('fraisrconnect/cause')->productCheck();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Initiate category synchronisation
|
53 |
+
*
|
54 |
+
* @param Mage_Cron_Model_Schedule $observer
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
public function synchronizeCategories($observer)
|
58 |
+
{
|
59 |
+
//Check if extension is active
|
60 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
Mage::getModel('fraisrconnect/category')->synchronize();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Initiate product synchronisation
|
68 |
+
*
|
69 |
+
* @param Mage_Cron_Model_Schedule $observer
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function synchronizeProducts($observer)
|
73 |
+
{
|
74 |
+
//Check if extension is active
|
75 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
//Trigger product synchronisation
|
80 |
+
$productSyncronisation = Mage::getModel('fraisrconnect/product');
|
81 |
+
$productSyncronisation->synchronize();
|
82 |
+
|
83 |
+
try {
|
84 |
+
//Check if product synchronisation is complete, if not add a next cronjob task manually
|
85 |
+
if (false === $productSyncronisation->isSynchronisationComplete()) {
|
86 |
+
//Add a next cronjob task
|
87 |
+
$cronTask = Mage::helper('fraisrconnect/synchronisation_product')->createProductSyncCronTask(
|
88 |
+
$observer
|
89 |
+
);
|
90 |
+
|
91 |
+
//Log about adding a next cronjob task
|
92 |
+
$logTitle = Mage::helper('fraisrconnect/data')->__(
|
93 |
+
'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.',
|
94 |
+
$cronTask->getScheduledAt()
|
95 |
+
);
|
96 |
+
Mage::getModel('fraisrconnect/log')
|
97 |
+
->setTitle($logTitle)
|
98 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC)
|
99 |
+
->logNotice();
|
100 |
+
}
|
101 |
+
} catch (Exception $e) {
|
102 |
+
//Log error title
|
103 |
+
$logTitle = Mage::helper('fraisrconnect/data')->__(
|
104 |
+
'An error occured during the creation of the following cron task for the product sychronisation with message: "%s".',
|
105 |
+
$e->getMessage()
|
106 |
+
);
|
107 |
+
|
108 |
+
//Error message that the next crontask may could not be added
|
109 |
+
Mage::getModel('fraisrconnect/log')
|
110 |
+
->setTitle($logTitle)
|
111 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC)
|
112 |
+
->logError();
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Initiate mark products for synchronisation action
|
118 |
+
*
|
119 |
+
* @param Mage_Cron_Model_Schedule $observer
|
120 |
+
* @return void
|
121 |
+
*/
|
122 |
+
public function markProductsAsToSynchronize($observer)
|
123 |
+
{
|
124 |
+
//Check if extension is active
|
125 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
Mage::getModel('fraisrconnect/product')->markProductsAsToSynchronize();
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Add a product to the fraisr delete queue
|
133 |
+
*
|
134 |
+
* @param Mage_Cron_Model_Schedule $observer
|
135 |
+
* @return void
|
136 |
+
*/
|
137 |
+
public function addProductToQueue($observer)
|
138 |
+
{
|
139 |
+
$product = $observer->getEvent()->getProduct();
|
140 |
+
|
141 |
+
//Check if given product is valid and if the product has a fraisr_id
|
142 |
+
if ($product instanceof Mage_Catalog_Model_Product
|
143 |
+
&& false === is_null($product->getFraisrId())) {
|
144 |
+
//Add the product to the fraisr delete queue
|
145 |
+
Mage::getModel('fraisrconnect/config')->addProductToDeleteQueue($product);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Add the fraisr_id to the fraisr_product_id column of the quote_item - object
|
151 |
+
*
|
152 |
+
* @param Mage_Cron_Model_Schedule $observer
|
153 |
+
* @return void
|
154 |
+
*/
|
155 |
+
public function addFraisrIdToQuoteItem($observer)
|
156 |
+
{
|
157 |
+
//Check if extension is active
|
158 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
159 |
+
return;
|
160 |
+
}
|
161 |
+
|
162 |
+
$event = $observer->getEvent();
|
163 |
+
$quoteItem = $event->getQuoteItem();
|
164 |
+
$product = $quoteItem->getProduct();
|
165 |
+
|
166 |
+
if (false === is_null($product->getFraisrId())
|
167 |
+
&& 1 == $product->getFraisrEnabled()
|
168 |
+
&& false === is_null($product->getFraisrCause())
|
169 |
+
&& false === is_null($product->getFraisrDonationPercentage())) {
|
170 |
+
$quoteItem->setFraisrProductId($product->getFraisrId());
|
171 |
+
$quoteItem->setFraisrCauseId($product->getFraisrCause());
|
172 |
+
$quoteItem->setFraisrDonationPercentage($product->getFraisrDonationPercentage());
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Add the fraisr_id to the fraisr_product_id column of the order_item - object
|
178 |
+
*
|
179 |
+
* @param Mage_Cron_Model_Schedule $observer
|
180 |
+
* @return void
|
181 |
+
*/
|
182 |
+
public function addFraisrIdToOrderItem($observer)
|
183 |
+
{
|
184 |
+
//Check if extension is active
|
185 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
$event = $observer->getEvent();
|
190 |
+
$order_item = $event->getOrderItem();
|
191 |
+
$order_item->setFraisrProductId($event->getItem()->getFraisrProductId());
|
192 |
+
$order_item->setFraisrCauseId($event->getItem()->getFraisrCauseId());
|
193 |
+
$order_item->setFraisrDonationPercentage($event->getItem()->getFraisrDonationPercentage());
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Initiate order synchronisation
|
198 |
+
*
|
199 |
+
* @param Mage_Cron_Model_Schedule $observer
|
200 |
+
* @return void
|
201 |
+
*/
|
202 |
+
public function synchronizeOrders($observer)
|
203 |
+
{
|
204 |
+
//Check if extension is active
|
205 |
+
if (false === Mage::helper('fraisrconnect/adminhtml_data')->isActive(false)) {
|
206 |
+
return;
|
207 |
+
}
|
208 |
+
|
209 |
+
//Trigger order synchronisation
|
210 |
+
$orderSyncronisation = Mage::getModel('fraisrconnect/order');
|
211 |
+
$orderSyncronisation->synchronize();
|
212 |
+
|
213 |
+
try {
|
214 |
+
//Check if order synchronisation is complete, if not add a next cronjob task manually
|
215 |
+
if (false === $orderSyncronisation->isSynchronisationComplete()) {
|
216 |
+
//Add a next cronjob task
|
217 |
+
$cronTask = Mage::helper('fraisrconnect/synchronisation_order')->createOrderSyncCronTask(
|
218 |
+
$observer
|
219 |
+
);
|
220 |
+
|
221 |
+
//Log about adding a next cronjob task
|
222 |
+
$logTitle = Mage::helper('fraisrconnect/data')->__(
|
223 |
+
'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.',
|
224 |
+
$cronTask->getScheduledAt()
|
225 |
+
);
|
226 |
+
Mage::getModel('fraisrconnect/log')
|
227 |
+
->setTitle($logTitle)
|
228 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_ORDER_SYNC)
|
229 |
+
->logNotice();
|
230 |
+
}
|
231 |
+
} catch (Exception $e) {
|
232 |
+
//Log error title
|
233 |
+
$logTitle = Mage::helper('fraisrconnect/data')->__(
|
234 |
+
'An error occured during the creation of the following cron task for the order sychronisation with message: "%s".',
|
235 |
+
$e->getMessage()
|
236 |
+
);
|
237 |
+
|
238 |
+
//Error message that the next crontask may could not be added
|
239 |
+
Mage::getModel('fraisrconnect/log')
|
240 |
+
->setTitle($logTitle)
|
241 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_ORDER_SYNC)
|
242 |
+
->logError();
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
app/code/community/Fraisr/Connect/Model/Order.php
ADDED
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Order Sync Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Order extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
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
|
63 |
+
*
|
64 |
+
* @var boolean
|
65 |
+
*/
|
66 |
+
public $synchronisationFinished = false;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Synchronisation start time
|
70 |
+
*
|
71 |
+
* @var int
|
72 |
+
*/
|
73 |
+
public $synchronisationStartTime = null;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Synchronize order data
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
public function synchronize()
|
81 |
+
{
|
82 |
+
try {
|
83 |
+
//Set syncronisation start time
|
84 |
+
$this->synchronisationStartTime = time();
|
85 |
+
|
86 |
+
//Synchronize orders
|
87 |
+
$this->synchronizeOrders();
|
88 |
+
|
89 |
+
//Set synchronisation as finished if runtime is not exceeded
|
90 |
+
if (false === Mage::helper('fraisrconnect/synchronisation_order')
|
91 |
+
->isRuntimeExceeded($this->synchronisationStartTime)) {
|
92 |
+
$this->synchronisationFinished = true;
|
93 |
+
}
|
94 |
+
} catch (Fraisr_Connect_Exception $e) {
|
95 |
+
$this->getAdminHelper()->logAndAdminOutputException(
|
96 |
+
$this->getAdminHelper()->__(
|
97 |
+
'Order synchronisation aborted with message: "%s".',
|
98 |
+
$e->getMessage()
|
99 |
+
),
|
100 |
+
Fraisr_Connect_Model_Log::LOG_TASK_ORDER_SYNC,
|
101 |
+
$e
|
102 |
+
);
|
103 |
+
} catch (Exception $e) {
|
104 |
+
$this->getAdminHelper()->logAndAdminOutputException(
|
105 |
+
$this->getAdminHelper()->__(
|
106 |
+
'An unknown error during order synchronisation happened with message: "%s".',
|
107 |
+
$e->getMessage()
|
108 |
+
),
|
109 |
+
Fraisr_Connect_Model_Log::LOG_TASK_ORDER_SYNC,
|
110 |
+
$e
|
111 |
+
);
|
112 |
+
}
|
113 |
+
|
114 |
+
//Output order synchronisation report
|
115 |
+
$this->outputSynchronisationReport();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get order collection and loop through every order
|
120 |
+
*
|
121 |
+
* @return void
|
122 |
+
*/
|
123 |
+
public function synchronizeOrders()
|
124 |
+
{
|
125 |
+
$orderSyncHelper = Mage::helper('fraisrconnect/synchronisation_order');
|
126 |
+
$config = Mage::getModel('fraisrconnect/config');
|
127 |
+
$orderItemsToSynchronize = $orderSyncHelper->getOrderItemsToSynchronize();
|
128 |
+
|
129 |
+
//Loop through every order
|
130 |
+
foreach ($orderItemsToSynchronize as $orderItem) {
|
131 |
+
try {
|
132 |
+
//Validate order/order_item
|
133 |
+
if (false === $this->isOrderItemValid($orderItem)) {
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* New order
|
139 |
+
*
|
140 |
+
* Only if fraisr_order_id is empty (only the case if the order was not transmitted as a new order)
|
141 |
+
* AND the status is one of the allowed status for new orders
|
142 |
+
*/
|
143 |
+
if (true === is_null($orderItem->getFraisrOrderId())
|
144 |
+
&& true === in_array($orderItem->getData('status'), $config->getOrderExportOrderStatus())) {
|
145 |
+
$this->requestNewOrder($orderItem);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Update order
|
150 |
+
*
|
151 |
+
* Only if fraisr_order_id exists (only the case if the order was once transmitted as a new order)
|
152 |
+
* AND the transmitted fraisr_qty_ordered is different from the current calculated amount
|
153 |
+
*/
|
154 |
+
if (false === is_null($orderItem->getFraisrOrderId())
|
155 |
+
&& $orderItem->getFraisrQtyOrdered() != $orderSyncHelper->getOrderItemQty($orderItem)) {
|
156 |
+
$this->requestUpdateOrder($orderItem);
|
157 |
+
}
|
158 |
+
} catch (Fraisr_Connect_Model_Api_Exception $e) {
|
159 |
+
$logDetails = $this->prepareOrderRequestData($orderItem);
|
160 |
+
$logDetails['fraisr_order_id'] = $orderItem->getFraisrOrderId();
|
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
|
168 |
+
if (true === $orderSyncHelper->isRuntimeExceeded($this->synchronisationStartTime)) {
|
169 |
+
//Break the loop, stop the syncronisation and return
|
170 |
+
return;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Check if the order_item is valid to be transferred to fraisr
|
177 |
+
*
|
178 |
+
* @param Mage_Sales_Model_Order_Item $orderItem
|
179 |
+
* @return boolean
|
180 |
+
*/
|
181 |
+
protected function isOrderItemValid($orderItem)
|
182 |
+
{
|
183 |
+
//Check if all necessary data for the transfer is existing
|
184 |
+
if (true === is_null($orderItem->getFraisrProductId())
|
185 |
+
|| true === is_null($orderItem->getFraisrCauseId())
|
186 |
+
|| true === is_null($orderItem->getFraisrDonationPercentage())) {
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
|
190 |
+
//Check if 'base_currency_code' or 'order_currency_code' is EUR
|
191 |
+
if ('EUR' !== $orderItem->getBaseCurrencyCode()
|
192 |
+
&& 'EUR' === $orderItem->getOrderCurrencyCode()) {
|
193 |
+
return false;
|
194 |
+
}
|
195 |
+
|
196 |
+
return true;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Prepare the data for the fraisr order create request
|
201 |
+
*
|
202 |
+
* @param Mage_Sales_Model_Order_Item $orderItem
|
203 |
+
* @return array
|
204 |
+
*/
|
205 |
+
protected function prepareOrderRequestData($orderItem)
|
206 |
+
{
|
207 |
+
//Calculate price
|
208 |
+
$price = 0;
|
209 |
+
if ('EUR' === $orderItem->getBaseCurrencyCode()) {
|
210 |
+
$price = $orderItem->getBasePriceInclTax();
|
211 |
+
} elseif ('EUR' === $orderItem->getOrderCurrencyCode()) {
|
212 |
+
$price = $orderItem->getPriceInclTax();
|
213 |
+
}
|
214 |
+
|
215 |
+
return array(
|
216 |
+
'product' => $orderItem->getFraisrProductId(),
|
217 |
+
'amount' => Mage::helper('fraisrconnect/synchronisation_order')->getOrderItemQty($orderItem),
|
218 |
+
'price' => $price,
|
219 |
+
'cause' => $orderItem->getFraisrCauseId(),
|
220 |
+
'donation' => $orderItem->getFraisrDonationPercentage()
|
221 |
+
);
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Trigger create order request and save fraisr_order_id
|
226 |
+
*
|
227 |
+
* @param Mage_Sales_Model_Order_Item $orderItem
|
228 |
+
* @return void
|
229 |
+
*/
|
230 |
+
protected function requestNewOrder($orderItem)
|
231 |
+
{
|
232 |
+
$orderRequestData = $this->prepareOrderRequestData($orderItem);
|
233 |
+
|
234 |
+
//If amount is not greater then 0 -> continue
|
235 |
+
if ($orderRequestData['amount'] < 1) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
$reponse = Mage::getModel('fraisrconnect/api_request')->requestPost(
|
240 |
+
Mage::getModel('fraisrconnect/config')->getOrderApiUri(),
|
241 |
+
$orderRequestData
|
242 |
+
);
|
243 |
+
|
244 |
+
//Throw error in case that the fraisr_id was not transmitted
|
245 |
+
if (false === isset($reponse["_id"])) {
|
246 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
247 |
+
$this->getAdminHelper()->__(
|
248 |
+
'FraisrOrderId was not given for new order request, order "%s" and item "%s".',
|
249 |
+
$orderItem->getIncrementId(),
|
250 |
+
$orderItem->getFraisrProductId()
|
251 |
+
)
|
252 |
+
);
|
253 |
+
}
|
254 |
+
|
255 |
+
//Save FraisrOrderId and FraisrQtyOrdered
|
256 |
+
$orderItem
|
257 |
+
->setFraisrOrderId($reponse['_id'])
|
258 |
+
->setFraisrQtyOrdered($orderRequestData['amount'])
|
259 |
+
->save();
|
260 |
+
|
261 |
+
//Add order_id to success list
|
262 |
+
$this->newOrdersReport[] = array(
|
263 |
+
'magento_order_id' => $orderItem->getIncrementId(),
|
264 |
+
'fraisr_order_id' => $orderItem->getFraisrOrderId(),
|
265 |
+
'product' => $orderRequestData['product'],
|
266 |
+
'amount' => $orderRequestData['amount'],
|
267 |
+
'price' => $orderRequestData['price'],
|
268 |
+
'donation' => $orderRequestData['donation'],
|
269 |
+
'cause' => $orderRequestData['cause']
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Trigger update order request and save new fraisr_qty_ordered
|
275 |
+
*
|
276 |
+
* @param Mage_Sales_Model_Order_Item $orderItem
|
277 |
+
* @return void
|
278 |
+
*/
|
279 |
+
protected function requestUpdateOrder($orderItem)
|
280 |
+
{
|
281 |
+
$amount = Mage::helper('fraisrconnect/synchronisation_order')->getOrderItemQty($orderItem);
|
282 |
+
|
283 |
+
$reponse = Mage::getModel('fraisrconnect/api_request')->requestPut(
|
284 |
+
Mage::getModel('fraisrconnect/config')->getOrderApiUri(
|
285 |
+
$orderItem->getFraisrOrderId()
|
286 |
+
),
|
287 |
+
array('amount' => $amount)
|
288 |
+
);
|
289 |
+
|
290 |
+
//Save FraisrQtyOrdered
|
291 |
+
$orderItem
|
292 |
+
->setFraisrQtyOrdered($amount)
|
293 |
+
->save();
|
294 |
+
|
295 |
+
if ($amount > 0) {
|
296 |
+
//Add order_id to update success list
|
297 |
+
$this->updatedOrdersReport[] = array(
|
298 |
+
'magento_order_id' => $orderItem->getIncrementId(),
|
299 |
+
'fraisr_order_id' => $orderItem->getFraisrOrderId(),
|
300 |
+
'amount' => $amount,
|
301 |
+
);
|
302 |
+
} else {
|
303 |
+
//Add order_id to delete success list
|
304 |
+
$this->deletedOrdersReport[] = array(
|
305 |
+
'magento_order_id' => $orderItem->getIncrementId(),
|
306 |
+
'fraisr_order_id' => $orderItem->getFraisrProductId(),
|
307 |
+
'amount' => $amount,
|
308 |
+
);
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Output order synchronisation report
|
314 |
+
*
|
315 |
+
* Write admin notification messages
|
316 |
+
* And generate an overview log entry
|
317 |
+
*
|
318 |
+
* @return void
|
319 |
+
*/
|
320 |
+
protected function outputSynchronisationReport()
|
321 |
+
{
|
322 |
+
//Add admin notice message about new added orders
|
323 |
+
$newOrdersMessage = $this->getAdminHelper()->__(
|
324 |
+
'%s order(s) were successfully added to fraisr.',
|
325 |
+
(int) count($this->newOrdersReport)
|
326 |
+
);
|
327 |
+
if (count($this->newOrdersReport) > 0) {
|
328 |
+
Mage::getSingleton('adminhtml/session')->addNotice($newOrdersMessage);
|
329 |
+
}
|
330 |
+
|
331 |
+
//Add admin notice message about updated orders
|
332 |
+
$updatedOrdersMessage = $this->getAdminHelper()->__(
|
333 |
+
'%s order(s) were successfully updated in fraisr.',
|
334 |
+
(int) count($this->updatedOrdersReport)
|
335 |
+
);
|
336 |
+
if (count($this->updatedOrdersReport) > 0) {
|
337 |
+
Mage::getSingleton('adminhtml/session')->addNotice($updatedOrdersMessage);
|
338 |
+
}
|
339 |
+
|
340 |
+
//Add admin notice message about deleted orders
|
341 |
+
$deletedOrdersMessage = $this->getAdminHelper()->__(
|
342 |
+
'%s order(s) were successfully deleted from fraisr.',
|
343 |
+
(int) count($this->deletedOrdersReport)
|
344 |
+
);
|
345 |
+
if (count($this->deletedOrdersReport) > 0) {
|
346 |
+
Mage::getSingleton('adminhtml/session')->addNotice($deletedOrdersMessage);
|
347 |
+
}
|
348 |
+
|
349 |
+
//Add admin notice message about transmission failed orders
|
350 |
+
$failedOrdersMessage = $this->getAdminHelper()->__(
|
351 |
+
'The transmission of %s order(s) failed during fraisr synchronisation.',
|
352 |
+
(int) count($this->failedOrdersReport)
|
353 |
+
);
|
354 |
+
if (count($this->failedOrdersReport) > 0) {
|
355 |
+
Mage::getSingleton('adminhtml/session')->addNotice($failedOrdersMessage);
|
356 |
+
}
|
357 |
+
|
358 |
+
//Write detailed log report
|
359 |
+
$logMessage = sprintf(
|
360 |
+
"#%s\n%s\n\n"
|
361 |
+
."#%s\n%s\n\n"
|
362 |
+
."#%s\n%s\n\n"
|
363 |
+
."#%s\n%s\n\n",
|
364 |
+
$newOrdersMessage,
|
365 |
+
Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->newOrdersReport),
|
366 |
+
$updatedOrdersMessage,
|
367 |
+
Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->updatedOrdersReport),
|
368 |
+
$deletedOrdersMessage,
|
369 |
+
Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->deletedOrdersReport),
|
370 |
+
$failedOrdersMessage,
|
371 |
+
Mage::helper('fraisrconnect/synchronisation_order')->buildSyncReportDetails($this->failedOrdersReport)
|
372 |
+
);
|
373 |
+
Mage::getModel('fraisrconnect/log')
|
374 |
+
->setTitle($this->getAdminHelper()->__('Order synchronisation report'))
|
375 |
+
->setMessage($logMessage)
|
376 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_ORDER_SYNC)
|
377 |
+
->logNotice();
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Get admin helper
|
382 |
+
*
|
383 |
+
* @return Fraisr_Connect_Helper_Adminhtml_Data
|
384 |
+
*/
|
385 |
+
protected function getAdminHelper()
|
386 |
+
{
|
387 |
+
if (true === is_null($this->adminHelper)) {
|
388 |
+
$this->adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
|
389 |
+
}
|
390 |
+
return $this->adminHelper;
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Check if synchronisation was complete
|
395 |
+
*
|
396 |
+
* @return boolean
|
397 |
+
*/
|
398 |
+
public function isSynchronisationComplete()
|
399 |
+
{
|
400 |
+
//Return false if the internal synchronisation flag is already marked as false
|
401 |
+
if (false === $this->synchronisationFinished) {
|
402 |
+
return false;
|
403 |
+
}
|
404 |
+
|
405 |
+
return true;
|
406 |
+
}
|
407 |
+
}
|
app/code/community/Fraisr/Connect/Model/Product.php
ADDED
@@ -0,0 +1,534 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Product Sync Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_Product extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
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
|
63 |
+
*
|
64 |
+
* @var boolean
|
65 |
+
*/
|
66 |
+
public $synchronisationFinished = false;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Synchronisation start time
|
70 |
+
*
|
71 |
+
* @var int
|
72 |
+
*/
|
73 |
+
public $synchronisationStartTime = null;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @const SYNCHRONISATION_ITERATIONS Synchronisation iterations per product
|
77 |
+
*/
|
78 |
+
const SYNCHRONISATION_ITERATIONS = 3;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Synchronize product data
|
82 |
+
*
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function synchronize()
|
86 |
+
{
|
87 |
+
try {
|
88 |
+
//Set syncronisation start time
|
89 |
+
$this->synchronisationStartTime = time();
|
90 |
+
|
91 |
+
//Synchronize create,update and delete products
|
92 |
+
$this->synchronizeMarkedProducts();
|
93 |
+
|
94 |
+
//Synchronize products to delete (by deleted products from the queue)
|
95 |
+
$this->synchronizeDeleteProductsByQueue();
|
96 |
+
|
97 |
+
//Set synchronisation as finished if runtime is not exceeded
|
98 |
+
if (false === Mage::helper('fraisrconnect/synchronisation_product')
|
99 |
+
->isRuntimeExceeded($this->synchronisationStartTime)) {
|
100 |
+
$this->synchronisationFinished = true;
|
101 |
+
}
|
102 |
+
} catch (Fraisr_Connect_Exception $e) {
|
103 |
+
$this->getAdminHelper()->logAndAdminOutputException(
|
104 |
+
$this->getAdminHelper()->__(
|
105 |
+
'Product synchronisation aborted with message: "%s".',
|
106 |
+
$e->getMessage()
|
107 |
+
),
|
108 |
+
Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC,
|
109 |
+
$e
|
110 |
+
);
|
111 |
+
} catch (Exception $e) {
|
112 |
+
$this->getAdminHelper()->logAndAdminOutputException(
|
113 |
+
$this->getAdminHelper()->__(
|
114 |
+
'An unknown error during product synchronisation happened with message: "%s".',
|
115 |
+
$e->getMessage()
|
116 |
+
),
|
117 |
+
Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC,
|
118 |
+
$e
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
//Output product synchronisation report
|
123 |
+
$this->outputSynchronisationReport();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Synchronize marked products
|
128 |
+
*
|
129 |
+
* @return void
|
130 |
+
*/
|
131 |
+
public function synchronizeMarkedProducts()
|
132 |
+
{
|
133 |
+
$productsToSynchronize = Mage::helper('fraisrconnect/synchronisation_product')
|
134 |
+
->getProductsToSynchronize();
|
135 |
+
|
136 |
+
foreach ($productsToSynchronize as $product) {
|
137 |
+
try {
|
138 |
+
//Delete product
|
139 |
+
if (false === is_null($product->getFraisrId())
|
140 |
+
&& 0 == $product->getFraisrEnabled()) {
|
141 |
+
//Trigger delete request
|
142 |
+
$this->requestDeleteProduct($product->getFraisrId(), $product->getSku());
|
143 |
+
|
144 |
+
//Unset fraisr_id
|
145 |
+
$product->setFraisrId(null)->save();
|
146 |
+
}
|
147 |
+
|
148 |
+
//Update product
|
149 |
+
if (false === is_null($product->getFraisrId())
|
150 |
+
&& 1 == $product->getFraisrEnabled()) {
|
151 |
+
$this->requestUpdateProduct($product);
|
152 |
+
}
|
153 |
+
|
154 |
+
//New product
|
155 |
+
if (true === is_null($product->getFraisrId())
|
156 |
+
&& 1 == $product->getFraisrEnabled()) {
|
157 |
+
$this->requestNewProduct($product);
|
158 |
+
}
|
159 |
+
|
160 |
+
//Mark product as successfully synchronized
|
161 |
+
Mage::helper('fraisrconnect/synchronisation_product')->markAsSynchronized($product);
|
162 |
+
} catch (Fraisr_Connect_Model_Api_Exception $e) {
|
163 |
+
//Add sku to failed products list
|
164 |
+
$this->failedProductsReport[] = array(
|
165 |
+
'sku' => $product->getSku(),
|
166 |
+
'fraisr_id' => $product->getFraisrId(),
|
167 |
+
'error_message' => $e->getMessage(),
|
168 |
+
'task' => 'create/update'
|
169 |
+
);
|
170 |
+
|
171 |
+
/*
|
172 |
+
* If the error code is 5xx, just descrease the synchronisation iterations by 1 because
|
173 |
+
* it is maybe just a server timeout
|
174 |
+
*/
|
175 |
+
if ('5' == substr($e->getCode(), 0, 1)) {
|
176 |
+
Mage::helper('fraisrconnect/synchronisation_product')->decreaseSyncIteration($product);
|
177 |
+
} else {
|
178 |
+
/*
|
179 |
+
* If the error code is not 5xx (maybe 4xx), mark the product as synchronized
|
180 |
+
* because there is a logic problem
|
181 |
+
*/
|
182 |
+
Mage::helper('fraisrconnect/synchronisation_product')->markAsSynchronized($product);
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
//Check if the script runtime is already close to exceed
|
187 |
+
if (true === Mage::helper('fraisrconnect/synchronisation_product')
|
188 |
+
->isRuntimeExceeded($this->synchronisationStartTime)) {
|
189 |
+
//Break the loop, stop the syncronisation and return
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Trigger create product request and save fraisrId
|
197 |
+
*
|
198 |
+
* @param Mage_Catalog_Model_Product $product
|
199 |
+
* @return void
|
200 |
+
*/
|
201 |
+
protected function requestNewProduct($product)
|
202 |
+
{
|
203 |
+
$fraisrProductRequestData = $this->buildFaisrProductRequestData($product);
|
204 |
+
|
205 |
+
$reponse = Mage::getModel('fraisrconnect/api_request')->requestPost(
|
206 |
+
Mage::getModel('fraisrconnect/config')->getProductApiUri(),
|
207 |
+
$fraisrProductRequestData
|
208 |
+
);
|
209 |
+
|
210 |
+
//Throw error in case that the fraisr_id was not transmitted
|
211 |
+
if (false === isset($reponse["_id"])) {
|
212 |
+
throw new Fraisr_Connect_Model_Api_Exception(
|
213 |
+
$this->getAdminHelper()->__(
|
214 |
+
'FraisrId was not given for new product request and sku "%s".',
|
215 |
+
$product->getSku()
|
216 |
+
)
|
217 |
+
);
|
218 |
+
}
|
219 |
+
|
220 |
+
//Save FraisrId
|
221 |
+
$product->setFraisrId($reponse['_id'])->save();
|
222 |
+
|
223 |
+
//Add sku to success list
|
224 |
+
$this->newProductsReport[] = array(
|
225 |
+
'sku' => $product->getSku(),
|
226 |
+
'fraisr_id' => $reponse['_id']
|
227 |
+
);
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Trigger update product request and save fraisrId
|
232 |
+
*
|
233 |
+
* @param Mage_Catalog_Model_Product $product
|
234 |
+
* @return void
|
235 |
+
*/
|
236 |
+
protected function requestUpdateProduct($product)
|
237 |
+
{
|
238 |
+
$fraisrProductRequestData = $this->buildFaisrProductRequestData($product);
|
239 |
+
|
240 |
+
$reponse = Mage::getModel('fraisrconnect/api_request')->requestPut(
|
241 |
+
Mage::getModel('fraisrconnect/config')->getProductApiUri(
|
242 |
+
$product->getFraisrId()
|
243 |
+
),
|
244 |
+
$fraisrProductRequestData
|
245 |
+
);
|
246 |
+
|
247 |
+
//Add sku to success list
|
248 |
+
$this->updatedProductsReport[] = array(
|
249 |
+
'sku' => $product->getSku(),
|
250 |
+
'fraisr_id' => $product->getFraisrId()
|
251 |
+
);
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Trigger delete product request and unset fraisrId
|
256 |
+
*
|
257 |
+
* @param string $fraisrId
|
258 |
+
* @param string $sku
|
259 |
+
* @return void
|
260 |
+
*/
|
261 |
+
protected function requestDeleteProduct($fraisrId, $sku = '')
|
262 |
+
{
|
263 |
+
$reponse = Mage::getModel('fraisrconnect/api_request')->requestDelete(
|
264 |
+
Mage::getModel('fraisrconnect/config')->getProductApiUri($fraisrId)
|
265 |
+
);
|
266 |
+
|
267 |
+
//Add sku to delete list
|
268 |
+
$this->deletedProductsReport[] = array(
|
269 |
+
'sku' => $sku,
|
270 |
+
'fraisr_id' => $fraisrId
|
271 |
+
);
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Build fraisr product request data
|
276 |
+
*
|
277 |
+
* @param Mage_Catalog_Model_Product $product
|
278 |
+
* @return array
|
279 |
+
*/
|
280 |
+
protected function buildFaisrProductRequestData($product)
|
281 |
+
{
|
282 |
+
$productSynchronisationHelper = Mage::helper('fraisrconnect/synchronisation_product');
|
283 |
+
|
284 |
+
$requestData = array(
|
285 |
+
'internalid' => $product->getSku(),
|
286 |
+
'name' => $product->getName(),
|
287 |
+
'description' => strip_tags(
|
288 |
+
$product->getData(
|
289 |
+
Mage::getModel('fraisrconnect/config')->getProductDescriptionAttribute()
|
290 |
+
)
|
291 |
+
),
|
292 |
+
'category' => $product->getFraisrCategory(),
|
293 |
+
'url' => $product->getProductUrl(false),
|
294 |
+
'cause' => $product->getFraisrCause(),
|
295 |
+
'donation' => $product->getFraisrDonationPercentage(),
|
296 |
+
'qty' => $productSynchronisationHelper->getProductQty($product),
|
297 |
+
'is_start_price' => $productSynchronisationHelper->getIsStartPrice($product)
|
298 |
+
);
|
299 |
+
|
300 |
+
//Calculate prices
|
301 |
+
$prices = $productSynchronisationHelper->calculatePrices($product);
|
302 |
+
$requestData["price"] = $prices["price"];
|
303 |
+
if ($prices["special_price"] > 0) {
|
304 |
+
$requestData["special_price"] = $prices["special_price"];
|
305 |
+
} else {
|
306 |
+
$requestData["special_price"] = '';
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Retrieve images
|
311 |
+
*/
|
312 |
+
//Main Image
|
313 |
+
if (false === is_null($product->getSmallImage())) {
|
314 |
+
$requestData["images"][] =
|
315 |
+
Mage::app()
|
316 |
+
->getStore(
|
317 |
+
Mage::getModel('fraisrconnect/config')->getCatalogExportStoreId()
|
318 |
+
)
|
319 |
+
->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)
|
320 |
+
.'catalog/product'.$product->getImage();
|
321 |
+
}
|
322 |
+
|
323 |
+
//Gallery Images
|
324 |
+
$product->load('media_gallery');
|
325 |
+
$productImages = $product->getMediaGalleryImages();
|
326 |
+
if ($productImages) {
|
327 |
+
foreach ($productImages as $image) {
|
328 |
+
$requestData["images"][] = $image->getUrl();
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
return $requestData;
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Output product synchronisation report
|
337 |
+
*
|
338 |
+
* Write admin notification messages
|
339 |
+
* And generate an overview log entry
|
340 |
+
*
|
341 |
+
* @return void
|
342 |
+
*/
|
343 |
+
protected function outputSynchronisationReport()
|
344 |
+
{
|
345 |
+
//Add admin notice message about new added products
|
346 |
+
$newProductsMessage = $this->getAdminHelper()->__(
|
347 |
+
'%s product(s) were successfully added to fraisr.',
|
348 |
+
(int) count($this->newProductsReport)
|
349 |
+
);
|
350 |
+
if (count($this->newProductsReport) > 0) {
|
351 |
+
Mage::getSingleton('adminhtml/session')->addNotice($newProductsMessage);
|
352 |
+
}
|
353 |
+
|
354 |
+
//Add admin notice message about updated products
|
355 |
+
$updatedProductsMessage = $this->getAdminHelper()->__(
|
356 |
+
'%s product(s) were successfully updated in fraisr.',
|
357 |
+
(int) count($this->updatedProductsReport)
|
358 |
+
);
|
359 |
+
if (count($this->updatedProductsReport) > 0) {
|
360 |
+
Mage::getSingleton('adminhtml/session')->addNotice($updatedProductsMessage);
|
361 |
+
}
|
362 |
+
|
363 |
+
//Add admin notice message about deleted products
|
364 |
+
$deletedProductsMessage = $this->getAdminHelper()->__(
|
365 |
+
'%s product(s) were successfully deleted from fraisr.',
|
366 |
+
(int) count($this->deletedProductsReport)
|
367 |
+
);
|
368 |
+
if (count($this->deletedProductsReport) > 0) {
|
369 |
+
Mage::getSingleton('adminhtml/session')->addNotice($deletedProductsMessage);
|
370 |
+
}
|
371 |
+
|
372 |
+
//Add admin notice message about transmission failed products
|
373 |
+
$failedProductsMessage = $this->getAdminHelper()->__(
|
374 |
+
'The transmission of %s product(s) failed during fraisr synchronisation.',
|
375 |
+
(int) count($this->failedProductsReport)
|
376 |
+
);
|
377 |
+
if (count($this->failedProductsReport) > 0) {
|
378 |
+
Mage::getSingleton('adminhtml/session')->addNotice($failedProductsMessage);
|
379 |
+
}
|
380 |
+
|
381 |
+
//Write detailed log report
|
382 |
+
$logMessage = sprintf(
|
383 |
+
"#%s\n%s\n\n"
|
384 |
+
."#%s\n%s\n\n"
|
385 |
+
."#%s\n%s\n\n"
|
386 |
+
."#%s\n%s\n\n",
|
387 |
+
$newProductsMessage,
|
388 |
+
Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->newProductsReport),
|
389 |
+
$updatedProductsMessage,
|
390 |
+
Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->updatedProductsReport),
|
391 |
+
$deletedProductsMessage,
|
392 |
+
Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->deletedProductsReport),
|
393 |
+
$failedProductsMessage,
|
394 |
+
Mage::helper('fraisrconnect/synchronisation_product')->buildSyncReportDetails($this->failedProductsReport)
|
395 |
+
);
|
396 |
+
Mage::getModel('fraisrconnect/log')
|
397 |
+
->setTitle($this->getAdminHelper()->__('Product synchronisation report'))
|
398 |
+
->setMessage($logMessage)
|
399 |
+
->setTask(Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC)
|
400 |
+
->logNotice();
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Get admin helper
|
405 |
+
*
|
406 |
+
* @return Fraisr_Connect_Helper_Adminhtml_Data
|
407 |
+
*/
|
408 |
+
protected function getAdminHelper()
|
409 |
+
{
|
410 |
+
if (true === is_null($this->adminHelper)) {
|
411 |
+
$this->adminHelper = Mage::helper('fraisrconnect/adminhtml_data');
|
412 |
+
}
|
413 |
+
return $this->adminHelper;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Synchronize products to delete
|
418 |
+
*
|
419 |
+
* From delete queue
|
420 |
+
*
|
421 |
+
* @return void
|
422 |
+
*/
|
423 |
+
public function synchronizeDeleteProductsByQueue()
|
424 |
+
{
|
425 |
+
//Get product collection from delete queue
|
426 |
+
$deleteFraisrProducts = Mage::getModel('fraisrconnect/config')->getProductsFromDeleteQueue();
|
427 |
+
|
428 |
+
//For every product
|
429 |
+
foreach ($deleteFraisrProducts as $product) {
|
430 |
+
//Check if the script runtime is already close to exceed
|
431 |
+
if (true === Mage::helper('fraisrconnect/synchronisation_product')
|
432 |
+
->isRuntimeExceeded($this->synchronisationStartTime)) {
|
433 |
+
//Break the loop, stop the syncronisation and return
|
434 |
+
return;
|
435 |
+
}
|
436 |
+
|
437 |
+
try {
|
438 |
+
//Trigger delete request
|
439 |
+
$this->requestDeleteProduct(
|
440 |
+
$product['fraisr_id'],
|
441 |
+
$product['sku']
|
442 |
+
);
|
443 |
+
|
444 |
+
//Remove product from delete queue
|
445 |
+
Mage::getModel('fraisrconnect/config')->removeProductFromDeleteQueue($product['sku']);
|
446 |
+
} catch (Fraisr_Connect_Model_Api_Exception $e) {
|
447 |
+
//Add sku to delete products list
|
448 |
+
$this->failedProductsReport[] = array(
|
449 |
+
'sku' => $product['sku'],
|
450 |
+
'fraisr_id' => $product['fraisr_id'],
|
451 |
+
'error_message' => $e->getMessage(),
|
452 |
+
'task' => 'delete'
|
453 |
+
);
|
454 |
+
}
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Mark products as to synchronize
|
460 |
+
*
|
461 |
+
* @return void
|
462 |
+
*/
|
463 |
+
public function markProductsAsToSynchronize()
|
464 |
+
{
|
465 |
+
try {
|
466 |
+
//Get product collection of new and update products
|
467 |
+
$newAndUpdateFraisrProducts = Mage::helper('fraisrconnect/synchronisation_product')->getNewAndUpdateFraisrProducts();
|
468 |
+
|
469 |
+
//Mark as to synchronize
|
470 |
+
Mage::helper('fraisrconnect/synchronisation_product')->markProductCollectionAsToSynchronize(
|
471 |
+
$newAndUpdateFraisrProducts
|
472 |
+
);
|
473 |
+
//Success Message
|
474 |
+
if (count($newAndUpdateFraisrProducts) > 0) {
|
475 |
+
$this->getAdminHelper()->logAndAdminOutputSuccess(
|
476 |
+
$this->getAdminHelper()->__(
|
477 |
+
'%s product(s) were successfully marked as to synchronize (create/update) to fraisr.',
|
478 |
+
count($newAndUpdateFraisrProducts)
|
479 |
+
),
|
480 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
481 |
+
);
|
482 |
+
}
|
483 |
+
|
484 |
+
//Get product collection of to delete products
|
485 |
+
$toDeleteProducts = Mage::helper('fraisrconnect/synchronisation_product')->getDeleteFraisrProducts();
|
486 |
+
//Get product collection of to delete products (from queue)
|
487 |
+
$toDeleteProductsByQueue = Mage::getModel('fraisrconnect/config')->getProductsFromDeleteQueue();
|
488 |
+
|
489 |
+
//Mark as to synchronize
|
490 |
+
Mage::helper('fraisrconnect/synchronisation_product')->markProductCollectionAsToSynchronize(
|
491 |
+
$toDeleteProducts
|
492 |
+
);
|
493 |
+
//Success Message
|
494 |
+
if ((count($toDeleteProducts) + count($toDeleteProductsByQueue)) > 0) {
|
495 |
+
$this->getAdminHelper()->logAndAdminOutputSuccess(
|
496 |
+
$this->getAdminHelper()->__(
|
497 |
+
'%s product(s) were successfully marked as to synchronize (delete) to fraisr.',
|
498 |
+
count($toDeleteProducts) + count($toDeleteProductsByQueue)
|
499 |
+
),
|
500 |
+
Fraisr_Connect_Model_Log::LOG_TASK_CAUSE_SYNC
|
501 |
+
);
|
502 |
+
}
|
503 |
+
} catch (Exception $e) {
|
504 |
+
$this->getAdminHelper()->logAndAdminOutputException(
|
505 |
+
$this->getAdminHelper()->__(
|
506 |
+
'An unknown error happened during mark products to synchronisation action with message: "%s".',
|
507 |
+
$e->getMessage()
|
508 |
+
),
|
509 |
+
Fraisr_Connect_Model_Log::LOG_TASK_PRODUCT_SYNC,
|
510 |
+
$e
|
511 |
+
);
|
512 |
+
}
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* Check if synchronisation was complete
|
517 |
+
*
|
518 |
+
* @return boolean
|
519 |
+
*/
|
520 |
+
public function isSynchronisationComplete()
|
521 |
+
{
|
522 |
+
//Return false if the internal synchronisation flag is already marked as false
|
523 |
+
if (false === $this->synchronisationFinished) {
|
524 |
+
return false;
|
525 |
+
}
|
526 |
+
|
527 |
+
//Check if there are products with 'fraisr_update' > 0 are existing
|
528 |
+
if (0 < count(Mage::helper('fraisrconnect/synchronisation_product')->getProductsToSynchronize())) {
|
529 |
+
return false;
|
530 |
+
}
|
531 |
+
|
532 |
+
return true;
|
533 |
+
}
|
534 |
+
}
|
app/code/community/Fraisr/Connect/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Resource Setup Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 |
+
{ }
|
app/code/community/Fraisr/Connect/Model/System/Config/Source/BanderolePosition.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Banderole Position Source Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_System_Config_Source_BanderolePosition
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const DONATION_LABEL_BANDEROLE_POSITION_TOP fraisr banderole position top
|
29 |
+
*/
|
30 |
+
const DONATION_LABEL_BANDEROLE_POSITION_TOP = 'top';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const DONATION_LABEL_BANDEROLE_POSITION_BOTTOM fraisr banderole position bottom
|
34 |
+
*/
|
35 |
+
const DONATION_LABEL_BANDEROLE_POSITION_BOTTOM = 'bottom';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @const DONATION_LABEL_BANDEROLE_POSITION_CENTER fraisr banderole position center
|
39 |
+
*/
|
40 |
+
const DONATION_LABEL_BANDEROLE_POSITION_CENTER = 'center';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get fraisr banderole position source options
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function toOptionArray()
|
48 |
+
{
|
49 |
+
$banderolePositionOptions = array();
|
50 |
+
|
51 |
+
$banderolePositionOptions[] = array(
|
52 |
+
'value' => self::DONATION_LABEL_BANDEROLE_POSITION_TOP,
|
53 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Top')
|
54 |
+
);
|
55 |
+
$banderolePositionOptions[] = array(
|
56 |
+
'value' => self::DONATION_LABEL_BANDEROLE_POSITION_BOTTOM,
|
57 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Bottom')
|
58 |
+
);
|
59 |
+
$banderolePositionOptions[] = array(
|
60 |
+
'value' => self::DONATION_LABEL_BANDEROLE_POSITION_CENTER,
|
61 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Center')
|
62 |
+
);
|
63 |
+
|
64 |
+
return $banderolePositionOptions;
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Fraisr/Connect/Model/System/Config/Source/DonationLabel.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Donation Label Source Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_System_Config_Source_DonationLabel
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const DONATION_LABEL_ICON fraisr label in product list as icon
|
29 |
+
*/
|
30 |
+
const DONATION_LABEL_ICON = 'icon';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const DONATION_LABEL_BANDEROLE fraisr label in product list as a banderole
|
34 |
+
*/
|
35 |
+
const DONATION_LABEL_BANDEROLE = 'banderole';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get donation label source options
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function toOptionArray()
|
43 |
+
{
|
44 |
+
$donationLabelOptions = array();
|
45 |
+
|
46 |
+
$donationLabelOptions[] = array(
|
47 |
+
'value' => self::DONATION_LABEL_ICON,
|
48 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Icon')
|
49 |
+
);
|
50 |
+
$donationLabelOptions[] = array(
|
51 |
+
'value' => self::DONATION_LABEL_BANDEROLE,
|
52 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Banderole')
|
53 |
+
);
|
54 |
+
|
55 |
+
return $donationLabelOptions;
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Fraisr/Connect/Model/System/Config/Source/IconPosition.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Icon Position Source Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_System_Config_Source_IconPosition
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const DONATION_LABEL_ICON_POSITION_TOPLEFT fraisr icon position topleft
|
29 |
+
*/
|
30 |
+
const DONATION_LABEL_ICON_POSITION_TOPLEFT = 'topleft';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const DONATION_LABEL_ICON_POSITION_TOPRIGHT fraisr icon position topright
|
34 |
+
*/
|
35 |
+
const DONATION_LABEL_ICON_POSITION_TOPRIGHT = 'topright';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @const DONATION_LABEL_ICON_POSITION_BOTTOMLEFT fraisr icon position bottomleft
|
39 |
+
*/
|
40 |
+
const DONATION_LABEL_ICON_POSITION_BOTTOMLEFT = 'bottomleft';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @const DONATION_LABEL_ICON_POSITION_BOTTOMRIGHT fraisr icon position bottomright
|
44 |
+
*/
|
45 |
+
const DONATION_LABEL_ICON_POSITION_BOTTOMRIGHT = 'bottomright';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @const DONATION_LABEL_ICON_POSITION_CENTER fraisr icon position center
|
49 |
+
*/
|
50 |
+
const DONATION_LABEL_ICON_POSITION_CENTER = 'center';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get fraisr icon position source options
|
54 |
+
*
|
55 |
+
* @return array
|
56 |
+
*/
|
57 |
+
public function toOptionArray()
|
58 |
+
{
|
59 |
+
$iconPositionOptions = array();
|
60 |
+
|
61 |
+
$iconPositionOptions[] = array(
|
62 |
+
'value' => self::DONATION_LABEL_ICON_POSITION_TOPLEFT,
|
63 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Top left')
|
64 |
+
);
|
65 |
+
$iconPositionOptions[] = array(
|
66 |
+
'value' => self::DONATION_LABEL_ICON_POSITION_TOPRIGHT,
|
67 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Top right')
|
68 |
+
);
|
69 |
+
$iconPositionOptions[] = array(
|
70 |
+
'value' => self::DONATION_LABEL_ICON_POSITION_BOTTOMLEFT,
|
71 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Bottom left')
|
72 |
+
);
|
73 |
+
$iconPositionOptions[] = array(
|
74 |
+
'value' => self::DONATION_LABEL_ICON_POSITION_BOTTOMRIGHT,
|
75 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Bottom right')
|
76 |
+
);
|
77 |
+
$iconPositionOptions[] = array(
|
78 |
+
'value' => self::DONATION_LABEL_ICON_POSITION_CENTER,
|
79 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Center')
|
80 |
+
);
|
81 |
+
|
82 |
+
return $iconPositionOptions;
|
83 |
+
}
|
84 |
+
}
|
app/code/community/Fraisr/Connect/Model/System/Config/Source/ProductAttribute.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Product Attributes Source Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_System_Config_Source_ProductAttribute
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Get product attribures options for extension configuration
|
29 |
+
*
|
30 |
+
* @return array
|
31 |
+
*/
|
32 |
+
public function toOptionArray()
|
33 |
+
{
|
34 |
+
$productAttributesCollection = $this->getProductAttributesCollection();
|
35 |
+
|
36 |
+
$productAttributes = array();
|
37 |
+
foreach($productAttributesCollection->getItems() as $productAttribute) {
|
38 |
+
$productAttributes[] = array(
|
39 |
+
'value' => $productAttribute->getAttributeCode(),
|
40 |
+
'label' => $productAttribute->getFrontendLabel()
|
41 |
+
);
|
42 |
+
}
|
43 |
+
return $productAttributes;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve collection of all product attribures
|
48 |
+
*
|
49 |
+
* @return Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
|
50 |
+
*/
|
51 |
+
protected function getProductAttributesCollection() {
|
52 |
+
$collection = Mage::getResourceModel( 'catalog/product_attribute_collection' );
|
53 |
+
$collection->addFilter( 'is_visible', 1 );
|
54 |
+
return $collection;
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Fraisr/Connect/Model/System/Config/Source/Scope.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Scope Source Model
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Model_System_Config_Source_Scope
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @const SCOPE_GLOBAL Select value for global scope
|
29 |
+
*/
|
30 |
+
const SCOPE_GLOBAL = '#global#';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @const KEY_WEBSITE Value prefix to build optgroups in scope select box
|
34 |
+
*/
|
35 |
+
const KEY_WEBSITE = '#website#_';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get scope options for extension configuration
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function toOptionArray()
|
43 |
+
{
|
44 |
+
//Build option for global scope
|
45 |
+
$scopes[] = array(
|
46 |
+
'label' => Mage::helper('fraisrconnect/data')->__('Global'),
|
47 |
+
'value' => self::SCOPE_GLOBAL
|
48 |
+
);
|
49 |
+
|
50 |
+
//For every website
|
51 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
52 |
+
//Website optgroup option
|
53 |
+
$scopes[self::KEY_WEBSITE.$website->getId()] = array(
|
54 |
+
'value' => array(),
|
55 |
+
'label' => $website->getName()
|
56 |
+
);
|
57 |
+
|
58 |
+
//For every store
|
59 |
+
foreach ($website->getGroups() as $group) {
|
60 |
+
$stores = $group->getStores();
|
61 |
+
foreach ($stores as $store) {
|
62 |
+
//Store option
|
63 |
+
$scopes[self::KEY_WEBSITE.$website->getId()]['value'][] = array(
|
64 |
+
'value' => $store->getId(),
|
65 |
+
'label' => $store->getName()
|
66 |
+
);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
return $scopes;
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Fraisr/Connect/controllers/Adminhtml/LogController.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Log Controller
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
22 |
+
* @package Fraisr_Connect
|
23 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
24 |
+
*/
|
25 |
+
class Fraisr_Connect_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Log index
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function indexAction()
|
33 |
+
{
|
34 |
+
$this->loadLayout();
|
35 |
+
$this->_addContent(
|
36 |
+
$this->getLayout()->createBlock('fraisrconnect/adminhtml_log', 'fraisrconnect_adminhtml_log')
|
37 |
+
);
|
38 |
+
$this->renderLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Show log detail
|
43 |
+
*
|
44 |
+
* @return void
|
45 |
+
*/
|
46 |
+
public function editAction()
|
47 |
+
{
|
48 |
+
$this->loadLayout();
|
49 |
+
$this->_addContent(
|
50 |
+
$this->getLayout()->createBlock('fraisrconnect/adminhtml_log_edit', 'fraisrconnect_adminhtml_log_edit')
|
51 |
+
);
|
52 |
+
$this->renderLayout();
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Fraisr/Connect/controllers/Adminhtml/SynchronisationController.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Synchronisation Controller
|
20 |
+
*
|
21 |
+
* @category Fraisr
|
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 |
+
* Check if the admin user is allowed to execute this controller action
|
29 |
+
*
|
30 |
+
* @return boolean
|
31 |
+
*/
|
32 |
+
protected function _isAllowed()
|
33 |
+
{
|
34 |
+
return Mage::getSingleton('admin/session')
|
35 |
+
->isAllowed('system/tools/fraisrconnect_synchronisation');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Check if the admin user is allowed to see this section
|
40 |
+
*
|
41 |
+
* @param string $section
|
42 |
+
* @param boolean
|
43 |
+
*/
|
44 |
+
protected function _checkSectionAllowed($section)
|
45 |
+
{
|
46 |
+
if (false == Mage::getSingleton('admin/session')
|
47 |
+
->isAllowed('system/tools/fraisrconnect_synchronisation/')) {
|
48 |
+
$this->forward('denied');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Trigger cause synchronisation
|
54 |
+
*
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
public function causeAction()
|
58 |
+
{
|
59 |
+
if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
60 |
+
//Retrieve and save causes
|
61 |
+
Mage::getModel('fraisrconnect/cause')->synchronize();
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Check if products exists which causes doesn't exist anymore
|
65 |
+
* If some were find, set 'fraisr_enabled' to false
|
66 |
+
*/
|
67 |
+
Mage::getModel('fraisrconnect/cause')->productCheck();
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->_redirectReferer();
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Trigger category synchronisation
|
76 |
+
*
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
public function categoryAction()
|
80 |
+
{
|
81 |
+
if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
82 |
+
Mage::getModel('fraisrconnect/category')->synchronize();
|
83 |
+
}
|
84 |
+
|
85 |
+
$this->_redirectReferer();
|
86 |
+
return;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Trigger product synchronisation
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function productAction()
|
95 |
+
{
|
96 |
+
if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
97 |
+
$productSyncronisation = Mage::getModel('fraisrconnect/product');
|
98 |
+
$productSyncronisation->synchronize();
|
99 |
+
|
100 |
+
if (false === $productSyncronisation->isSynchronisationComplete()) {
|
101 |
+
Mage::getSingleton('adminhtml/session')->addWarning(
|
102 |
+
Mage::helper('fraisrconnect/data')->__('Not all products have been synchronized because of a transmission error or a script timeout. Please start the process again.')
|
103 |
+
);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->_redirectReferer();
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Trigger mark products to synchronisation
|
113 |
+
*
|
114 |
+
* @return void
|
115 |
+
*/
|
116 |
+
public function markProductAction()
|
117 |
+
{
|
118 |
+
if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
119 |
+
Mage::getModel('fraisrconnect/product')->markProductsAsToSynchronize();
|
120 |
+
}
|
121 |
+
|
122 |
+
$this->_redirectReferer();
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Trigger order synchronisation
|
128 |
+
*
|
129 |
+
* @return void
|
130 |
+
*/
|
131 |
+
public function orderAction()
|
132 |
+
{
|
133 |
+
if (true === Mage::helper('fraisrconnect/adminhtml_data')->isActive(true)) {
|
134 |
+
$orderSyncronisation = Mage::getModel('fraisrconnect/order');
|
135 |
+
$orderSyncronisation->synchronize();
|
136 |
+
|
137 |
+
if (false === $orderSyncronisation->isSynchronisationComplete()) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addWarning(
|
139 |
+
Mage::helper('fraisrconnect/data')->__('Not all orders have been synchronized because of a transmission error or a script timeout. Please start the process again.')
|
140 |
+
);
|
141 |
+
} else {
|
142 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
143 |
+
Mage::helper('fraisrconnect/data')->__('fraisr order synchronisation completed.')
|
144 |
+
);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
$this->_redirectReferer();
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
}
|
app/code/community/Fraisr/Connect/etc/adminhtml.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Fraisr
|
13 |
+
* @package Fraisr_Connect
|
14 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<admin>
|
23 |
+
<children>
|
24 |
+
<system>
|
25 |
+
<children>
|
26 |
+
<config>
|
27 |
+
<children>
|
28 |
+
<fraisrconnect translate="title" module="fraisrconnect">
|
29 |
+
<title>fraisr</title>
|
30 |
+
<sort_order>1000</sort_order>
|
31 |
+
</fraisrconnect>
|
32 |
+
</children>
|
33 |
+
</config>
|
34 |
+
<fraisr_log>
|
35 |
+
<title>fraisr log</title>
|
36 |
+
<sort_order>150</sort_order>
|
37 |
+
</fraisr_log>
|
38 |
+
</children>
|
39 |
+
</system>
|
40 |
+
</children>
|
41 |
+
</admin>
|
42 |
+
</resources>
|
43 |
+
</acl>
|
44 |
+
<menu>
|
45 |
+
<system>
|
46 |
+
<children>
|
47 |
+
<fraisr_log translate="title">
|
48 |
+
<sort_order>100</sort_order>
|
49 |
+
<title>fraisr log</title>
|
50 |
+
<action>fraisrconnect/adminhtml_log/index</action>
|
51 |
+
</fraisr_log>
|
52 |
+
</children>
|
53 |
+
</system>
|
54 |
+
</menu>
|
55 |
+
</config>
|
app/code/community/Fraisr/Connect/etc/config.xml
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Fraisr
|
13 |
+
* @package Fraisr_Connect
|
14 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Fraisr_Connect>
|
22 |
+
<version>0.3.5</version>
|
23 |
+
</Fraisr_Connect>
|
24 |
+
</modules>
|
25 |
+
<global>
|
26 |
+
<blocks>
|
27 |
+
<fraisrconnect>
|
28 |
+
<class>Fraisr_Connect_Block</class>
|
29 |
+
</fraisrconnect>
|
30 |
+
</blocks>
|
31 |
+
<models>
|
32 |
+
<fraisrconnect>
|
33 |
+
<class>Fraisr_Connect_Model</class>
|
34 |
+
<resourceModel>fraisrconnect_mysql4</resourceModel>
|
35 |
+
</fraisrconnect>
|
36 |
+
<fraisrconnect_mysql4>
|
37 |
+
<class>Fraisr_Connect_Model_Mysql4</class>
|
38 |
+
<entities>
|
39 |
+
<cause>
|
40 |
+
<table>fraisrconnect_cause</table>
|
41 |
+
</cause>
|
42 |
+
<category>
|
43 |
+
<table>fraisrconnect_category</table>
|
44 |
+
</category>
|
45 |
+
<log>
|
46 |
+
<table>fraisrconnect_log</table>
|
47 |
+
</log>
|
48 |
+
</entities>
|
49 |
+
</fraisrconnect_mysql4>
|
50 |
+
</models>
|
51 |
+
<helpers>
|
52 |
+
<fraisrconnect>
|
53 |
+
<class>Fraisr_Connect_Helper</class>
|
54 |
+
</fraisrconnect>
|
55 |
+
</helpers>
|
56 |
+
<resources>
|
57 |
+
<fraisrconnect_setup>
|
58 |
+
<setup>
|
59 |
+
<module>Fraisr_Connect</module>
|
60 |
+
<class>Fraisr_Connect_Model_Resource_Setup</class>
|
61 |
+
</setup>
|
62 |
+
</fraisrconnect_setup>
|
63 |
+
</resources>
|
64 |
+
<events>
|
65 |
+
<catalog_product_delete_before>
|
66 |
+
<observers>
|
67 |
+
<fraisr_add_product_to_queue>
|
68 |
+
<class>fraisrconnect/observer</class>
|
69 |
+
<method>addProductToQueue</method>
|
70 |
+
</fraisr_add_product_to_queue>
|
71 |
+
</observers>
|
72 |
+
</catalog_product_delete_before>
|
73 |
+
<sales_quote_add_item>
|
74 |
+
<observers>
|
75 |
+
<fraisr_add_fraisrid_to_quote_item>
|
76 |
+
<class>fraisrconnect/observer</class>
|
77 |
+
<method>addFraisrIdToQuoteItem</method>
|
78 |
+
<type>singleton</type>
|
79 |
+
</fraisr_add_fraisrid_to_quote_item>
|
80 |
+
</observers>
|
81 |
+
</sales_quote_add_item>
|
82 |
+
<sales_convert_quote_item_to_order_item>
|
83 |
+
<observers>
|
84 |
+
<fraisr_add_fraisrid_to_order_item>
|
85 |
+
<class>fraisrconnect/observer</class>
|
86 |
+
<method>addFraisrIdToOrderItem</method>
|
87 |
+
<type>singleton</type>
|
88 |
+
</fraisr_add_fraisrid_to_order_item>
|
89 |
+
</observers>
|
90 |
+
</sales_convert_quote_item_to_order_item>
|
91 |
+
</events>
|
92 |
+
</global>
|
93 |
+
<frontend>
|
94 |
+
<routers>
|
95 |
+
<fraisrconnect>
|
96 |
+
<use>standard</use>
|
97 |
+
<args>
|
98 |
+
<module>Fraisr_Connect</module>
|
99 |
+
<frontName>fraisr</frontName>
|
100 |
+
</args>
|
101 |
+
</fraisrconnect>
|
102 |
+
</routers>
|
103 |
+
<translate>
|
104 |
+
<modules>
|
105 |
+
<Fraisr_Connect>
|
106 |
+
<files>
|
107 |
+
<default>Fraisr_Connect.csv</default>
|
108 |
+
</files>
|
109 |
+
</Fraisr_Connect>
|
110 |
+
</modules>
|
111 |
+
</translate>
|
112 |
+
<layout>
|
113 |
+
<updates>
|
114 |
+
<fraisrconnect>
|
115 |
+
<file>fraisrconnect.xml</file>
|
116 |
+
</fraisrconnect>
|
117 |
+
</updates>
|
118 |
+
</layout>
|
119 |
+
</frontend>
|
120 |
+
<admin>
|
121 |
+
<routers>
|
122 |
+
<fraisrconnect>
|
123 |
+
<use>admin</use>
|
124 |
+
<args>
|
125 |
+
<module>Fraisr_Connect</module>
|
126 |
+
<frontName>fraisrconnect</frontName>
|
127 |
+
</args>
|
128 |
+
</fraisrconnect>
|
129 |
+
</routers>
|
130 |
+
</admin>
|
131 |
+
<adminhtml>
|
132 |
+
<translate>
|
133 |
+
<modules>
|
134 |
+
<Fraisr_Connect>
|
135 |
+
<files>
|
136 |
+
<default>Fraisr_Connect.csv</default>
|
137 |
+
</files>
|
138 |
+
</Fraisr_Connect>
|
139 |
+
</modules>
|
140 |
+
</translate>
|
141 |
+
</adminhtml>
|
142 |
+
<crontab>
|
143 |
+
<jobs>
|
144 |
+
<!-- Cause synchronisation -->
|
145 |
+
<fraisrconnect_synchronisation_cause>
|
146 |
+
<schedule>
|
147 |
+
<cron_expr>30 1 * * *</cron_expr>
|
148 |
+
</schedule>
|
149 |
+
<run>
|
150 |
+
<model>fraisrconnect/observer::synchronizeCauses</model>
|
151 |
+
</run>
|
152 |
+
</fraisrconnect_synchronisation_cause>
|
153 |
+
<!-- Category synchronisation -->
|
154 |
+
<fraisrconnect_synchronisation_category>
|
155 |
+
<schedule>
|
156 |
+
<cron_expr>0 2 * * *</cron_expr>
|
157 |
+
</schedule>
|
158 |
+
<run>
|
159 |
+
<model>fraisrconnect/observer::synchronizeCategories</model>
|
160 |
+
</run>
|
161 |
+
</fraisrconnect_synchronisation_category>
|
162 |
+
<!-- Mark products for synchronisation -->
|
163 |
+
<fraisrconnect_synchronisation_mark_products>
|
164 |
+
<schedule>
|
165 |
+
<cron_expr>30 2 * * *</cron_expr>
|
166 |
+
</schedule>
|
167 |
+
<run>
|
168 |
+
<model>fraisrconnect/observer::markProductsAsToSynchronize</model>
|
169 |
+
</run>
|
170 |
+
</fraisrconnect_synchronisation_mark_products>
|
171 |
+
<!-- Products synchronisation -->
|
172 |
+
<fraisrconnect_synchronisation_products>
|
173 |
+
<schedule>
|
174 |
+
<cron_expr>0 3 * * *</cron_expr>
|
175 |
+
</schedule>
|
176 |
+
<run>
|
177 |
+
<model>fraisrconnect/observer::synchronizeProducts</model>
|
178 |
+
</run>
|
179 |
+
</fraisrconnect_synchronisation_products>
|
180 |
+
<!-- Orders synchronisation -->
|
181 |
+
<fraisrconnect_synchronisation_orders>
|
182 |
+
<schedule>
|
183 |
+
<cron_expr>0 4 * * *</cron_expr>
|
184 |
+
</schedule>
|
185 |
+
<run>
|
186 |
+
<model>fraisrconnect/observer::synchronizeOrders</model>
|
187 |
+
</run>
|
188 |
+
</fraisrconnect_synchronisation_orders>
|
189 |
+
</jobs>
|
190 |
+
</crontab>
|
191 |
+
<default>
|
192 |
+
<fraisrconnect>
|
193 |
+
<general>
|
194 |
+
<active>0</active>
|
195 |
+
<sandbox>1</sandbox>
|
196 |
+
</general>
|
197 |
+
<catalog_export>
|
198 |
+
<scope>#global#</scope>
|
199 |
+
<description_attribute>description</description_attribute>
|
200 |
+
</catalog_export>
|
201 |
+
<order_export>
|
202 |
+
<order_status>processing,complete</order_status>
|
203 |
+
<synchronisation_days>7</synchronisation_days>
|
204 |
+
<invoice_items>0</invoice_items>
|
205 |
+
</order_export>
|
206 |
+
<frontend>
|
207 |
+
<donation_label>icon</donation_label>
|
208 |
+
<icon_position>topleft</icon_position>
|
209 |
+
<banderole_position>top</banderole_position>
|
210 |
+
</frontend>
|
211 |
+
<frontend_detailpage>
|
212 |
+
<area_top>1</area_top>
|
213 |
+
<area_bottom>0</area_bottom>
|
214 |
+
</frontend_detailpage>
|
215 |
+
<static>
|
216 |
+
<support_email>support@fraisr.zendesk.com</support_email>
|
217 |
+
<commercial_register_url>https://www.fraisr.com/register-business</commercial_register_url>
|
218 |
+
<api>
|
219 |
+
<live>https://www.fraisr.com/</live>
|
220 |
+
<sandbox>https://fraisr-test.herokuapp.com/</sandbox>
|
221 |
+
<cause>api/v1/causes/for-shops</cause>
|
222 |
+
<category>api/v1/categories</category>
|
223 |
+
<product>api/v1/products/%s</product>
|
224 |
+
<order>/api/v1/orders/%s</order>
|
225 |
+
<donation_label_iframe>de/trusted-shop/%s</donation_label_iframe>
|
226 |
+
<frontend_js>widgets/javascripts/magento/fraisr.js</frontend_js>
|
227 |
+
<frontend_css>widgets/stylesheets/magento/fraisr.css</frontend_css>
|
228 |
+
<plugin_identification_value>magento</plugin_identification_value>
|
229 |
+
</api>
|
230 |
+
</static>
|
231 |
+
</fraisrconnect>
|
232 |
+
</default>
|
233 |
+
</config>
|
app/code/community/Fraisr/Connect/etc/system.xml
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Fraisr
|
13 |
+
* @package Fraisr_Connect
|
14 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<sections>
|
21 |
+
<fraisrconnect translate="label" module="fraisrconnect">
|
22 |
+
<label>fraisr</label>
|
23 |
+
<tab>service</tab>
|
24 |
+
<sort_order>500</sort_order>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<groups>
|
30 |
+
<support translate="label">
|
31 |
+
<label>Support</label>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<frontend_model>fraisrconnect/adminhtml_system_config_support</frontend_model>
|
34 |
+
<sort_order>0</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</support>
|
39 |
+
<general translate="label comment" module="fraisrconnect">
|
40 |
+
<label>Basic configuration</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>100</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<active translate="label comment" module="adminhtml">
|
48 |
+
<label>Enabled</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>100</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</active>
|
56 |
+
<sandbox translate="label comment">
|
57 |
+
<label>Sandbox</label>
|
58 |
+
<comment>If activated all actions will be done against the Sandbox-API.</comment>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
+
<sort_order>150</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>0</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</sandbox>
|
66 |
+
<key translate="label comment">
|
67 |
+
<label>Key</label>
|
68 |
+
<comment><![CDATA[Your key is visible in the fraisr-Backend.]]></comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<validate>required-entry</validate>
|
71 |
+
<sort_order>200</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>0</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</key>
|
76 |
+
<secret translate="label comment">
|
77 |
+
<label>Secret</label>
|
78 |
+
<comment><![CDATA[Your secret is visible in the fraisr-Backend.]]></comment>
|
79 |
+
<frontend_type>password</frontend_type>
|
80 |
+
<validate>required-entry</validate>
|
81 |
+
<sort_order>300</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>0</show_in_website>
|
84 |
+
<show_in_store>0</show_in_store>
|
85 |
+
</secret>
|
86 |
+
</fields>
|
87 |
+
</general>
|
88 |
+
<catalog_export>
|
89 |
+
<label>Product synchronisation</label>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<sort_order>200</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>0</show_in_website>
|
94 |
+
<show_in_store>0</show_in_store>
|
95 |
+
<fields>
|
96 |
+
<scope translate="label comment">
|
97 |
+
<label>Scope</label>
|
98 |
+
<comment><![CDATA[Please select "Global" or a store as catalog export base.]]></comment>
|
99 |
+
<frontend_type>select</frontend_type>
|
100 |
+
<source_model>fraisrconnect/system_config_source_scope</source_model>
|
101 |
+
<sort_order>100</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>0</show_in_website>
|
104 |
+
<show_in_store>0</show_in_store>
|
105 |
+
</scope>
|
106 |
+
<description_attribute>
|
107 |
+
<label>Attribute for product description</label>
|
108 |
+
<comment><![CDATA[This attribute will be taken as product description for the export to fraisr.]]></comment>
|
109 |
+
<frontend_type>select</frontend_type>
|
110 |
+
<source_model>fraisrconnect/system_config_source_productAttribute</source_model>
|
111 |
+
<sort_order>200</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>0</show_in_website>
|
114 |
+
<show_in_store>0</show_in_store>
|
115 |
+
</description_attribute>
|
116 |
+
</fields>
|
117 |
+
</catalog_export>
|
118 |
+
<order_export>
|
119 |
+
<label>Order synchronisation</label>
|
120 |
+
<frontend_type>text</frontend_type>
|
121 |
+
<sort_order>250</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>0</show_in_website>
|
124 |
+
<show_in_store>0</show_in_store>
|
125 |
+
<fields>
|
126 |
+
<order_status translate="label comment">
|
127 |
+
<label>Order status (new orders)</label>
|
128 |
+
<comment><![CDATA[Only orders with this status will be added in fraisr.]]></comment>
|
129 |
+
<frontend_type>multiselect</frontend_type>
|
130 |
+
<source_model>Mage_Adminhtml_Model_System_Config_Source_Order_Status</source_model>
|
131 |
+
<sort_order>100</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>0</show_in_website>
|
134 |
+
<show_in_store>0</show_in_store>
|
135 |
+
</order_status>
|
136 |
+
<synchronisation_days>
|
137 |
+
<label>Recent days to synchronize</label>
|
138 |
+
<comment><![CDATA[All orders which were created and/or updated during the last defined days will be synchronized.]]></comment>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<validate>required-entry validate-number</validate>
|
141 |
+
<sort_order>200</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>0</show_in_website>
|
144 |
+
<show_in_store>0</show_in_store>
|
145 |
+
</synchronisation_days>
|
146 |
+
<invoice_items translate="label comment">
|
147 |
+
<label>Invoice items</label>
|
148 |
+
<comment>If activated invoice item amount will be taken as reference instead of order item amount.</comment>
|
149 |
+
<frontend_type>select</frontend_type>
|
150 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
151 |
+
<sort_order>300</sort_order>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>0</show_in_website>
|
154 |
+
<show_in_store>0</show_in_store>
|
155 |
+
</invoice_items>
|
156 |
+
</fields>
|
157 |
+
</order_export>
|
158 |
+
<frontend translate="label" module="fraisrconnect">
|
159 |
+
<label>Donation label product list</label>
|
160 |
+
<frontend_type>text</frontend_type>
|
161 |
+
<sort_order>300</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>1</show_in_store>
|
165 |
+
<fields>
|
166 |
+
<donation_label translate="label comment">
|
167 |
+
<label>Donation label</label>
|
168 |
+
<frontend_type>select</frontend_type>
|
169 |
+
<source_model>fraisrconnect/system_config_source_donationLabel</source_model>
|
170 |
+
<sort_order>100</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>1</show_in_store>
|
174 |
+
</donation_label>
|
175 |
+
<icon_position translate="label comment">
|
176 |
+
<label>Icon position</label>
|
177 |
+
<comment><![CDATA[This setup is used if "Donation label" is set to "Icon".]]></comment>
|
178 |
+
<frontend_type>select</frontend_type>
|
179 |
+
<source_model>fraisrconnect/system_config_source_iconPosition</source_model>
|
180 |
+
<sort_order>200</sort_order>
|
181 |
+
<show_in_default>1</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>1</show_in_store>
|
184 |
+
</icon_position>
|
185 |
+
<banderole_position translate="label comment">
|
186 |
+
<label>Banderole position</label>
|
187 |
+
<comment><![CDATA[This setup is used if "Donation label" is set to "Banderole".]]></comment>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<source_model>fraisrconnect/system_config_source_banderolePosition</source_model>
|
190 |
+
<sort_order>300</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>1</show_in_store>
|
194 |
+
</banderole_position>
|
195 |
+
</fields>
|
196 |
+
</frontend>
|
197 |
+
<frontend_detailpage translate="label" module="fraisrconnect">
|
198 |
+
<label>Donation label product view</label>
|
199 |
+
<frontend_type>text</frontend_type>
|
200 |
+
<sort_order>400</sort_order>
|
201 |
+
<show_in_default>1</show_in_default>
|
202 |
+
<show_in_website>1</show_in_website>
|
203 |
+
<show_in_store>1</show_in_store>
|
204 |
+
<fields>
|
205 |
+
<area_top translate="label comment">
|
206 |
+
<label>Top area</label>
|
207 |
+
<comment><![CDATA[Show the donation label in the top area. The donation label will be included under the short description if the structure of the product detail page wasn't modified.]]></comment>
|
208 |
+
<frontend_type>select</frontend_type>
|
209 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
210 |
+
<sort_order>100</sort_order>
|
211 |
+
<show_in_default>1</show_in_default>
|
212 |
+
<show_in_website>1</show_in_website>
|
213 |
+
<show_in_store>1</show_in_store>
|
214 |
+
</area_top>
|
215 |
+
<area_bottom translate="label comment">
|
216 |
+
<label>Bottom area</label>
|
217 |
+
<comment><![CDATA[Show the donation label in the bottom area. The donation label will be included above the additional informations if the structure of the product detail page wasn't modified.]]></comment>
|
218 |
+
<frontend_type>select</frontend_type>
|
219 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
220 |
+
<sort_order>200</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
</area_bottom>
|
225 |
+
</fields>
|
226 |
+
</frontend_detailpage>
|
227 |
+
</groups>
|
228 |
+
</fraisrconnect>
|
229 |
+
</sections>
|
230 |
+
</config>
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
DROP TABLE IF EXISTS {$this->getTable('fraisrconnect/cause')};
|
24 |
+
CREATE TABLE {$this->getTable('fraisrconnect/cause')} (
|
25 |
+
`id` varchar(50) NOT NULL,
|
26 |
+
`description` TEXT,
|
27 |
+
`name` varchar(255),
|
28 |
+
`url` varchar(255),
|
29 |
+
`image_url` varchar(255),
|
30 |
+
`official` smallint(1),
|
31 |
+
`created_at` timestamp default CURRENT_TIMESTAMP,
|
32 |
+
PRIMARY KEY (`id`)
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
34 |
+
");
|
35 |
+
|
36 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.0-0.1.2.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
$installer->run("
|
22 |
+
DROP TABLE IF EXISTS {$this->getTable('fraisrconnect/category')};
|
23 |
+
CREATE TABLE {$this->getTable('fraisrconnect/category')} (
|
24 |
+
`id` varchar(50) NOT NULL,
|
25 |
+
`name` varchar(255),
|
26 |
+
`parent_id` varchar(50),
|
27 |
+
PRIMARY KEY (`id`)
|
28 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
29 |
+
");
|
30 |
+
|
31 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.2-0.1.3.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Setup values
|
25 |
+
*/
|
26 |
+
$fraisrAttributeGroup = "fraisr";
|
27 |
+
$productTypes = array(
|
28 |
+
'bundle',
|
29 |
+
'virtual',
|
30 |
+
'simple',
|
31 |
+
'configurable',
|
32 |
+
'downloadable'
|
33 |
+
); //All types except "grouped"
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Add attribute group "fraisr" too all attribute sets
|
37 |
+
*/
|
38 |
+
$setup->addAttributeGroup(
|
39 |
+
'catalog_product',
|
40 |
+
'Default',
|
41 |
+
$fraisrAttributeGroup,
|
42 |
+
1000
|
43 |
+
);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add fraisr-Attributes to "fraisr" attribute group
|
47 |
+
*/
|
48 |
+
|
49 |
+
//Is fraisr article -> Yes/No
|
50 |
+
$setup->addAttribute(
|
51 |
+
'catalog_product',
|
52 |
+
'fraisr_enabled',
|
53 |
+
array(
|
54 |
+
'group' => $fraisrAttributeGroup,
|
55 |
+
'input' => 'select',
|
56 |
+
'type' => 'int',
|
57 |
+
'label' => $fraisrHelper->__("fraisr enabled"),
|
58 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
59 |
+
'default' => 0,
|
60 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
61 |
+
'apply_to' => implode(",", $productTypes),
|
62 |
+
'sort_order' => 100,
|
63 |
+
'visible' => 1,
|
64 |
+
'required' => 0,
|
65 |
+
'user_defined' => 1,
|
66 |
+
'searchable' => 1,
|
67 |
+
'filterable' => 0,
|
68 |
+
'comparable' => 1,
|
69 |
+
'visible_on_front' => 1,
|
70 |
+
'visible_in_advanced_search' => 0,
|
71 |
+
'is_html_allowed_on_front' => 0,
|
72 |
+
'used_in_product_listing' => 1,
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
//Cause
|
77 |
+
$setup->addAttribute(
|
78 |
+
'catalog_product',
|
79 |
+
'fraisr_cause',
|
80 |
+
array(
|
81 |
+
'group' => $fraisrAttributeGroup,
|
82 |
+
'input' => 'select',
|
83 |
+
'type' => 'varchar',
|
84 |
+
'label' => $fraisrHelper->__("fraisr cause"),
|
85 |
+
'source' => 'fraisrconnect/entity_attribute_source_cause',
|
86 |
+
'default' => Fraisr_Connect_Model_Entity_Attribute_Source_Cause::FRAISR_CAUSE_DEFAULT,
|
87 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
88 |
+
'apply_to' => implode(",", $productTypes),
|
89 |
+
'sort_order' => 200,
|
90 |
+
'visible' => 1,
|
91 |
+
'required' => 0,
|
92 |
+
'user_defined' => 1,
|
93 |
+
'searchable' => 1,
|
94 |
+
'filterable' => 0,
|
95 |
+
'comparable' => 1,
|
96 |
+
'visible_on_front' => 1,
|
97 |
+
'visible_in_advanced_search' => 0,
|
98 |
+
'is_html_allowed_on_front' => 0,
|
99 |
+
'used_in_product_listing' => 1,
|
100 |
+
)
|
101 |
+
);
|
102 |
+
|
103 |
+
//Donation percentage
|
104 |
+
$setup->addAttribute(
|
105 |
+
'catalog_product',
|
106 |
+
'fraisr_donation_percentage',
|
107 |
+
array(
|
108 |
+
'group' => $fraisrAttributeGroup,
|
109 |
+
'input' => 'select',
|
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,
|
117 |
+
'visible' => 1,
|
118 |
+
'required' => 0,
|
119 |
+
'user_defined' => 1,
|
120 |
+
'searchable' => 1,
|
121 |
+
'filterable' => 0,
|
122 |
+
'comparable' => 1,
|
123 |
+
'visible_on_front' => 1,
|
124 |
+
'visible_in_advanced_search' => 0,
|
125 |
+
'is_html_allowed_on_front' => 0,
|
126 |
+
'used_in_product_listing' => 1,
|
127 |
+
)
|
128 |
+
);
|
129 |
+
|
130 |
+
//Category
|
131 |
+
$setup->addAttribute(
|
132 |
+
'catalog_product',
|
133 |
+
'fraisr_category',
|
134 |
+
array(
|
135 |
+
'group' => $fraisrAttributeGroup,
|
136 |
+
'input' => 'select',
|
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,
|
144 |
+
'visible' => 1,
|
145 |
+
'required' => 0,
|
146 |
+
'user_defined' => 1,
|
147 |
+
'searchable' => 1,
|
148 |
+
'filterable' => 0,
|
149 |
+
'comparable' => 1,
|
150 |
+
'visible_on_front' => 1,
|
151 |
+
'visible_in_advanced_search' => 0,
|
152 |
+
'is_html_allowed_on_front' => 0,
|
153 |
+
'used_in_product_listing' => 1,
|
154 |
+
)
|
155 |
+
);
|
156 |
+
|
157 |
+
//Interne fraisr ID
|
158 |
+
$setup->addAttribute(
|
159 |
+
'catalog_product',
|
160 |
+
'fraisr_id',
|
161 |
+
array(
|
162 |
+
'group' => $fraisrAttributeGroup,
|
163 |
+
'input' => 'text',
|
164 |
+
'type' => 'varchar',
|
165 |
+
'default' => null,
|
166 |
+
'label' => $fraisrHelper->__("fraisr ID"),
|
167 |
+
//See explanation about german note in setup of attribute "fraisr_visibility"
|
168 |
+
'note' => $fraisrHelper->__("Wird bei der Produkt-Synchronisation vergeben."),
|
169 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
170 |
+
'apply_to' => implode(",", $productTypes),
|
171 |
+
'sort_order' => 500,
|
172 |
+
'visible' => 1,
|
173 |
+
'required' => 0,
|
174 |
+
'user_defined' => 1,
|
175 |
+
'searchable' => 1,
|
176 |
+
'filterable' => 0,
|
177 |
+
'comparable' => 1,
|
178 |
+
'visible_on_front' => 1,
|
179 |
+
'visible_in_advanced_search' => 0,
|
180 |
+
'is_html_allowed_on_front' => 0,
|
181 |
+
'used_in_product_listing' => 1,
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.3-0.1.4.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Change attribute type to varchar because fraisr IDs consist alphabetic chars too
|
25 |
+
*/
|
26 |
+
$setup->updateAttribute(
|
27 |
+
'catalog_product',
|
28 |
+
'fraisr_category',
|
29 |
+
'backend_type',
|
30 |
+
'varchar'
|
31 |
+
);
|
32 |
+
$setup->updateAttribute(
|
33 |
+
'catalog_product',
|
34 |
+
'fraisr_cause',
|
35 |
+
'backend_type',
|
36 |
+
'varchar'
|
37 |
+
);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Set frontend input renderer for fraisr ID to set this field as readonly in the backend
|
41 |
+
*/
|
42 |
+
$setup->updateAttribute(
|
43 |
+
'catalog_product',
|
44 |
+
'fraisr_id',
|
45 |
+
'frontend_input_renderer',
|
46 |
+
'fraisrconnect/adminhtml_entity_attribute_fraisrId'
|
47 |
+
);
|
48 |
+
|
49 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.4-0.1.5.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.5-0.1.6.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Setup values
|
25 |
+
*/
|
26 |
+
$productTypes = array(
|
27 |
+
'bundle',
|
28 |
+
'virtual',
|
29 |
+
'simple',
|
30 |
+
'configurable',
|
31 |
+
'downloadable'
|
32 |
+
); //All types except "grouped"
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Update product types
|
36 |
+
*/
|
37 |
+
$setup->updateAttribute(
|
38 |
+
'catalog_product',
|
39 |
+
'fraisr_enabled',
|
40 |
+
'apply_to',
|
41 |
+
implode(",", $productTypes)
|
42 |
+
);
|
43 |
+
$setup->updateAttribute(
|
44 |
+
'catalog_product',
|
45 |
+
'fraisr_cause',
|
46 |
+
'apply_to',
|
47 |
+
implode(",", $productTypes)
|
48 |
+
);
|
49 |
+
$setup->updateAttribute(
|
50 |
+
'catalog_product',
|
51 |
+
'fraisr_donation_percentage',
|
52 |
+
'apply_to',
|
53 |
+
implode(",", $productTypes)
|
54 |
+
);
|
55 |
+
$setup->updateAttribute(
|
56 |
+
'catalog_product',
|
57 |
+
'fraisr_category',
|
58 |
+
'apply_to',
|
59 |
+
implode(",", $productTypes)
|
60 |
+
);
|
61 |
+
$setup->updateAttribute(
|
62 |
+
'catalog_product',
|
63 |
+
'fraisr_id',
|
64 |
+
'apply_to',
|
65 |
+
implode(",", $productTypes)
|
66 |
+
);
|
67 |
+
|
68 |
+
|
69 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.6-0.1.7.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Delete visibility attribute -> is not needed anymore
|
24 |
+
*/
|
25 |
+
$setup->removeAttribute(
|
26 |
+
'catalog_product',
|
27 |
+
'fraisr_visibility'
|
28 |
+
);
|
29 |
+
|
30 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.7-0.1.8.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
$installer->run("
|
22 |
+
ALTER TABLE {$this->getTable('fraisrconnect/category')}
|
23 |
+
ADD `label` VARCHAR(255) AFTER `name`;
|
24 |
+
");
|
25 |
+
|
26 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.1.8-0.2.0.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
$installer->run("
|
22 |
+
DROP TABLE IF EXISTS {$this->getTable('fraisrconnect/log')};
|
23 |
+
|
24 |
+
CREATE TABLE {$this->getTable('fraisrconnect/log')} (
|
25 |
+
`id` INT(11) unsigned NOT NULL auto_increment,
|
26 |
+
`type` VARCHAR(20) NOT NULL,
|
27 |
+
`task` VARCHAR(50) NOT NULL,
|
28 |
+
`title` varchar(255) NOT NULL,
|
29 |
+
`message` TEXT,
|
30 |
+
`additional_information1` TEXT,
|
31 |
+
`additional_information2` TEXT,
|
32 |
+
`created_at` timestamp default CURRENT_TIMESTAMP,
|
33 |
+
PRIMARY KEY(`id`)
|
34 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
35 |
+
");
|
36 |
+
|
37 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.0-0.2.1.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Update product list visibility
|
25 |
+
*/
|
26 |
+
$setup->updateAttribute(
|
27 |
+
'catalog_product',
|
28 |
+
'fraisr_enabled',
|
29 |
+
'used_in_product_listing',
|
30 |
+
true
|
31 |
+
);
|
32 |
+
$setup->updateAttribute(
|
33 |
+
'catalog_product',
|
34 |
+
'fraisr_cause',
|
35 |
+
'used_in_product_listing',
|
36 |
+
true
|
37 |
+
);
|
38 |
+
$setup->updateAttribute(
|
39 |
+
'catalog_product',
|
40 |
+
'fraisr_donation_percentage',
|
41 |
+
'used_in_product_listing',
|
42 |
+
true
|
43 |
+
);
|
44 |
+
$setup->updateAttribute(
|
45 |
+
'catalog_product',
|
46 |
+
'fraisr_category',
|
47 |
+
'used_in_product_listing',
|
48 |
+
true
|
49 |
+
);
|
50 |
+
$setup->updateAttribute(
|
51 |
+
'catalog_product',
|
52 |
+
'fraisr_id',
|
53 |
+
'used_in_product_listing',
|
54 |
+
true
|
55 |
+
);
|
56 |
+
|
57 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.1-0.2.2.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Setup values
|
25 |
+
*/
|
26 |
+
$fraisrAttributeGroup = "fraisr";
|
27 |
+
$productTypes = array(
|
28 |
+
'bundle',
|
29 |
+
'virtual',
|
30 |
+
'simple',
|
31 |
+
'configurable',
|
32 |
+
'downloadable'
|
33 |
+
); //All types except "grouped"
|
34 |
+
|
35 |
+
//Fraisr update flag
|
36 |
+
$setup->addAttribute(
|
37 |
+
'catalog_product',
|
38 |
+
'fraisr_update',
|
39 |
+
array(
|
40 |
+
'group' => $fraisrAttributeGroup,
|
41 |
+
'input' => 'text',
|
42 |
+
'type' => 'int',
|
43 |
+
'default' => 0,
|
44 |
+
'label' => $fraisrHelper->__('fraisr synchronisation iterations'),
|
45 |
+
//See explanation about german note in setup of attribute "fraisr_visibility"
|
46 |
+
'note' => $fraisrHelper->__('Wird intern zur Artikel-Synchronisation verwendet.'),
|
47 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
48 |
+
'apply_to' => implode(",", $productTypes),
|
49 |
+
'sort_order' => 600,
|
50 |
+
'visible' => 1,
|
51 |
+
'required' => 0,
|
52 |
+
'user_defined' => 1,
|
53 |
+
'searchable' => 1,
|
54 |
+
'filterable' => 0,
|
55 |
+
'comparable' => 1,
|
56 |
+
'visible_on_front' => 1,
|
57 |
+
'visible_in_advanced_search' => 0,
|
58 |
+
'is_html_allowed_on_front' => 0,
|
59 |
+
'used_in_product_listing' => 1,
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Set frontend input renderer for 'fraisr_update' to set this field as readonly in the backend
|
65 |
+
*/
|
66 |
+
$setup->updateAttribute(
|
67 |
+
'catalog_product',
|
68 |
+
'fraisr_update',
|
69 |
+
'frontend_input_renderer',
|
70 |
+
'fraisrconnect/adminhtml_entity_attribute_fraisrUpdate'
|
71 |
+
);
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Update product type
|
75 |
+
*/
|
76 |
+
$setup->updateAttribute(
|
77 |
+
'catalog_product',
|
78 |
+
'fraisr_update',
|
79 |
+
'apply_to',
|
80 |
+
implode(",", $productTypes)
|
81 |
+
);
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Update product list visibility
|
85 |
+
*/
|
86 |
+
$setup->updateAttribute(
|
87 |
+
'catalog_product',
|
88 |
+
'fraisr_update',
|
89 |
+
'used_in_product_listing',
|
90 |
+
true
|
91 |
+
);
|
92 |
+
|
93 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.2.2-0.3.0.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `fraisr_product_id` VARCHAR(50) default NULL;
|
24 |
+
|
25 |
+
ALTER TABLE {$this->getTable('sales/order_item')} ADD `fraisr_product_id` VARCHAR(50) default NULL;
|
26 |
+
ALTER TABLE {$this->getTable('sales/order_item')} ADD `fraisr_order_id` VARCHAR(50) default NULL;
|
27 |
+
ALTER TABLE {$this->getTable('sales/order_item')} ADD `fraisr_qty_ordered` DECIMAL(12,4) default 0;
|
28 |
+
");
|
29 |
+
|
30 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.0-0.3.3.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `fraisr_cause_id` VARCHAR(50) default NULL;
|
24 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `fraisr_donation_percentage` INT(3) default NULL;
|
25 |
+
|
26 |
+
ALTER TABLE {$this->getTable('sales/order_item')} ADD `fraisr_cause_id` VARCHAR(50) default NULL;
|
27 |
+
ALTER TABLE {$this->getTable('sales/order_item')} ADD `fraisr_donation_percentage` INT(3) default NULL;
|
28 |
+
");
|
29 |
+
|
30 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.3-0.3.4.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
ALTER TABLE {$this->getTable('fraisrconnect/cause')}
|
24 |
+
ADD `restrictions` VARCHAR(255) default NULL
|
25 |
+
AFTER `official`;
|
26 |
+
");
|
27 |
+
|
28 |
+
$installer->endSetup();
|
app/code/community/Fraisr/Connect/sql/fraisrconnect_setup/mysql4-upgrade-0.3.4-0.3.5.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
|
18 |
+
$installer = $this;
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
$installer->startSetup();
|
21 |
+
$fraisrHelper = Mage::helper("fraisrconnect/data");
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Update cause description - add restriction legend
|
25 |
+
*/
|
26 |
+
|
27 |
+
$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 |
+
|
35 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/fraisrconnect/system/config/support.phtml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<table cellspacing="0" class="switcher" width="100%" class="form-list">
|
19 |
+
<col width="200px" />
|
20 |
+
<col />
|
21 |
+
<thead>
|
22 |
+
<tr>
|
23 |
+
<th colspan="2">
|
24 |
+
<?php echo $this->__('Support information'); ?>
|
25 |
+
</th>
|
26 |
+
</tr>
|
27 |
+
</thead>
|
28 |
+
<tbody>
|
29 |
+
<tr>
|
30 |
+
<td><?php echo $this->__('Extension Version'); ?></td>
|
31 |
+
<td><?php echo $this->getExtensionVersion(); ?></td>
|
32 |
+
</tr>
|
33 |
+
<tr>
|
34 |
+
<td class=label><?php echo $this->__('Support contact fraisr:'); ?></td>
|
35 |
+
<?php
|
36 |
+
$bodyInfo = array(
|
37 |
+
'',
|
38 |
+
'====',
|
39 |
+
$this->__('Magento version: ') . $this->getMageVersion(),
|
40 |
+
$this->__('Extension version: ') . $this->getExtensionVersion(),
|
41 |
+
$this->__('Shop URL: ') . Mage::getBaseUrl()
|
42 |
+
);
|
43 |
+
?>
|
44 |
+
<td>
|
45 |
+
<a href="mailto:<?php echo $this->getSupportEmail(); ?>?body=<?php echo rawurlencode(implode("\n", $bodyInfo)) ?>">
|
46 |
+
<?php echo $this->getSupportEmail() ?>
|
47 |
+
</a><br /><br />
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
<tr>
|
51 |
+
<td><?php echo $this->__('Register'); ?>:</td>
|
52 |
+
<td>
|
53 |
+
<?php echo $this->__('Register yourself as a commercial to synchronize your articles by the Magento-extension with fraisr.'); ?><br />
|
54 |
+
<a href="<?php echo $this->getCommercialRegisterUrl(); ?>" target="_blank">
|
55 |
+
<?php echo $this->__('Register'); ?>
|
56 |
+
</a>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
</tbody>
|
60 |
+
</table>
|
61 |
+
|
app/design/frontend/base/default/layout/fraisrconnect.xml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Fraisr
|
13 |
+
* @package Fraisr_Connect
|
14 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<layout>
|
20 |
+
<catalog_category_view>
|
21 |
+
<update handle="fraisr_catalog_product_json_list" />
|
22 |
+
</catalog_category_view>
|
23 |
+
<catalogsearch_result_index>
|
24 |
+
<update handle="fraisr_catalog_product_json_list" />
|
25 |
+
</catalogsearch_result_index>
|
26 |
+
<catalog_product_view>
|
27 |
+
<reference name="before_body_end">
|
28 |
+
<block
|
29 |
+
type="fraisrconnect/catalog_product_json_view"
|
30 |
+
name="fraisrconnect_catalog_product_json_view">
|
31 |
+
<action
|
32 |
+
ifconfig="fraisrconnect/general/active"
|
33 |
+
method="setTemplate">
|
34 |
+
<template>fraisrconnect/catalog/product/json/view.phtml</template>
|
35 |
+
</action>
|
36 |
+
</block>
|
37 |
+
<block
|
38 |
+
type="fraisrconnect/frontend_widget"
|
39 |
+
name="fraisrconnect_frontend_widget">
|
40 |
+
<action ifconfig="fraisrconnect/general/active" method="setTemplate">
|
41 |
+
<template>fraisrconnect/frontend/widget.phtml</template>
|
42 |
+
</action>
|
43 |
+
</block>
|
44 |
+
</reference>
|
45 |
+
|
46 |
+
<reference name="product.info">
|
47 |
+
<block
|
48 |
+
type="fraisrconnect/catalog_product_view_label"
|
49 |
+
name="fraisrconnect_catalog_product_view_label_top"
|
50 |
+
as="other">
|
51 |
+
<action
|
52 |
+
ifconfig="fraisrconnect/frontend_detailpage/area_top"
|
53 |
+
method="setTemplate">
|
54 |
+
<template>fraisrconnect/catalog/product/view/label_top.phtml</template>
|
55 |
+
</action>
|
56 |
+
</block>
|
57 |
+
|
58 |
+
<block
|
59 |
+
type="fraisrconnect/catalog_product_view_label"
|
60 |
+
name="fraisrconnect_catalog_product_view_label_bottom"
|
61 |
+
as="fraisrconnect-catalog-product-view-label-bottom"
|
62 |
+
before="-">
|
63 |
+
<action
|
64 |
+
method="addToParentGroup"
|
65 |
+
ifconfig="fraisrconnect/frontend_detailpage/area_bottom">
|
66 |
+
<group>detailed_info</group>
|
67 |
+
</action>
|
68 |
+
<action
|
69 |
+
method="setTemplate"
|
70 |
+
ifconfig="fraisrconnect/frontend_detailpage/area_bottom">
|
71 |
+
<template>fraisrconnect/catalog/product/view/label_bottom.phtml</template>
|
72 |
+
</action>
|
73 |
+
</block>
|
74 |
+
</reference>
|
75 |
+
</catalog_product_view>
|
76 |
+
|
77 |
+
<fraisr_catalog_product_json_list>
|
78 |
+
<reference name="before_body_end">
|
79 |
+
<block
|
80 |
+
type="fraisrconnect/catalog_product_json_list"
|
81 |
+
name="fraisrconnect_catalog_product_json_list">
|
82 |
+
<action ifconfig="fraisrconnect/general/active" method="setTemplate">
|
83 |
+
<template>fraisrconnect/catalog/product/json/list.phtml</template>
|
84 |
+
</action>
|
85 |
+
</block>
|
86 |
+
<block
|
87 |
+
type="fraisrconnect/frontend_widget"
|
88 |
+
name="fraisrconnect_frontend_widget">
|
89 |
+
<action ifconfig="fraisrconnect/general/active" method="setTemplate">
|
90 |
+
<template>fraisrconnect/frontend/widget.phtml</template>
|
91 |
+
</action>
|
92 |
+
</block>
|
93 |
+
</reference>
|
94 |
+
</fraisr_catalog_product_json_list>
|
95 |
+
</layout>
|
app/design/frontend/base/default/template/fraisrconnect/catalog/product/json/list.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<script type="text/javascript">
|
20 |
+
//<![CDATA[
|
21 |
+
var fraisrProductData = <?php echo $this->getProductListJson();?>;
|
22 |
+
var fraisrSettings = <?php echo Mage::helper('fraisrconnect/data')->getFraisrFrontendSettingsJson();?>;
|
23 |
+
//]]>
|
24 |
+
</script>
|
app/design/frontend/base/default/template/fraisrconnect/catalog/product/json/view.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<script type="text/javascript">
|
20 |
+
//<![CDATA[
|
21 |
+
var fraisrProductData = <?php echo $this->getProductDetailJson();?>;
|
22 |
+
var fraisrSettings = <?php echo Mage::helper('fraisrconnect/data')->getFraisrFrontendSettingsJson();?>;
|
23 |
+
//]]>
|
24 |
+
</script>
|
app/design/frontend/base/default/template/fraisrconnect/catalog/product/view/label_bottom.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<?php if ($this->productIsActiveInFraisr()): ?>
|
20 |
+
<iframe
|
21 |
+
src="<?php echo $this->getIframeUrl(); ?>"
|
22 |
+
style="border:0; width:100%;"
|
23 |
+
name="fraisr_donation_label"
|
24 |
+
class="fraisr_donation_label_bottom">
|
25 |
+
</iframe>
|
26 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/fraisrconnect/catalog/product/view/label_top.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<?php if ($this->productIsActiveInFraisr()): ?>
|
20 |
+
<iframe
|
21 |
+
src="<?php echo $this->getIframeUrl(); ?>"
|
22 |
+
style="border:0;"
|
23 |
+
name="fraisr_donation_label"
|
24 |
+
class="fraisr_donation_label_top">
|
25 |
+
</iframe>
|
26 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/fraisrconnect/frontend/widget.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Fraisr
|
12 |
+
* @package Fraisr_Connect
|
13 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<script
|
20 |
+
type="text/javascript"
|
21 |
+
src="https://s3-eu-west-1.amazonaws.com/fraisr-com/assets/magento/fraisr.js">
|
22 |
+
</script>
|
23 |
+
|
24 |
+
<link
|
25 |
+
rel="stylesheet"
|
26 |
+
type="text/css"
|
27 |
+
href="https://s3-eu-west-1.amazonaws.com/fraisr-com/assets/magento/fraisr.css"
|
28 |
+
media="all" />
|
app/etc/modules/Fraisr_Connect.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Fraisr
|
13 |
+
* @package Fraisr_Connect
|
14 |
+
* @copyright Copyright (c) 2013 das MedienKombinat Gmbh <kontakt@das-medienkombinat.de>
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
* @author André Herrn <andre.herrn@das-medienkombinat.de>
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Fraisr_Connect>
|
22 |
+
<active>true</active>
|
23 |
+
<codePool>community</codePool>
|
24 |
+
<depends>
|
25 |
+
<Mage_Sales/>
|
26 |
+
<Mage_Catalog/>
|
27 |
+
</depends>
|
28 |
+
</Fraisr_Connect>
|
29 |
+
</modules>
|
30 |
+
</config>
|
app/locale/de_DE/Fraisr_Connect.csv
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Your key is visible in the fraisr-Backend.","Ihr Key ist im fraisr-Backend einsehbar."
|
2 |
+
"Your secret is visible in the fraisr-Backend.","Ihr Secret ist im fraisr-Backend einsehbar."
|
3 |
+
"Key","Key"
|
4 |
+
"Secret","Secret"
|
5 |
+
"Basic configuration","Basiskonfiguration"
|
6 |
+
"Catalog export","Katalog Export"
|
7 |
+
"Global","Global"
|
8 |
+
"Please select ""Global"" or a store as catalog export base.","Bitte wählen Sie ""Global"" oder einen Store als Basis für den Katalog Export."
|
9 |
+
"Attribute for product description","Attribut für die Produktbeschreibung"
|
10 |
+
"This attribute will be taken as product description for the export to fraisr.","Dieses Attribut wird als Produktbeschreibung für den Export zu fraisr verwendet."
|
11 |
+
"Support information","Support Informationen"
|
12 |
+
"Magento version: ","Magento version: "
|
13 |
+
"Extension version: ","Extension version: "
|
14 |
+
"Shop URL: ","Shop URL: "
|
15 |
+
"Synchronize causes","Spendenpartner synchronisieren"
|
16 |
+
"Synchronize categories","Kategorien synchronisieren"
|
17 |
+
"Synchronize products","Produkte synchronisieren"
|
18 |
+
"Synchronize orders","Bestellungen synchronisieren"
|
19 |
+
"Synchronize returns","Stornierungen synchronisieren"
|
20 |
+
"fraisr Synchronisation","fraisr Synchronisierung"
|
21 |
+
"Sandbox","Sandbox"
|
22 |
+
"If activated all actions will be done against the Sandbox-API.","Sofern aktiviert werden alle Aktionen gegen die Sandbox-API ausgeführt."
|
23 |
+
"0 causes retrieved during synchronisation.","Es wurden 0 Spendenpartner während der Synchronisierung importiert."
|
24 |
+
"Cause synchronisation succeeded. Imported %s causes.","Die Spendenpartner-Synchronisierung wurde erfolgreich abgeschlossen (%s Spendenpartner)."
|
25 |
+
"Cause synchronisation failed during API request with message: ""%s"".","Die Spendenpartner-Synchronisierung ist während der Api-Anfrage fehlgeschlagen: ""%s""."
|
26 |
+
"Cause synchronisation failed with message: ""%s"".","Die Spendenpartner-Synchronisierung ist fehlgeschlagen: ""%s""."
|
27 |
+
"An unknown error during cause synchronisation happened with message: ""%s""","Ein unbekannter Fehler ist bei der Spendenpartner-Synchronisierung aufgetreten: ""%s"""
|
28 |
+
"Api key is empty. Please complete the configuration.","Der Api-Key ist leer. Bitte vervollständen Sie den Konfigurations-Prozess."
|
29 |
+
"Api secret is empty. Please complete the configuration.","Das Api-Secret ist leer. Bitte vervollständen Sie den Konfigurations-Prozess."
|
30 |
+
"Api response class is ""%s"" instead of ""%s"".","Die Api-Response-Klasse ist ""%s"" anstatt ""%s""."
|
31 |
+
"Api response code is ""%s"" instead of ""%s"".","Der Api-Response-Code ist ""%s"" anstatt ""%s""."
|
32 |
+
"Api response is no valid JSON.","Die Api-Response ist kein valides Json"
|
33 |
+
"0 categories retrieved. Abort synchronisation.","Es wurden 0 Kategorien importiert. Die Synchronisierung wird abgebrochen."
|
34 |
+
"Category synchronisation succeeded. Imported %s categories.","Die Kategorie-Synchronisierung wurde erfolgreich abgeschlossen (%s Kategorien)."
|
35 |
+
"Category synchronisation failed during API request with message: ""%s"".","Die Kategorie-Synchronisierung ist während der Api-Anfrage fehlgeschlagen: ""%s""."
|
36 |
+
"Category synchronisation failed with message: ""%s"".","Die Kategorie-Synchronisierung ist fehlgeschlagen: ""%s""."
|
37 |
+
"An unknown error during category synchronisation happened with message: ""%s""","Ein unbekannter Fehler ist bei der Kategorie-Synchronisierung aufgetreten: ""%s"""
|
38 |
+
"fraisr donation percentage","fraisr Spendenanteil"
|
39 |
+
"fraisr enabled","fraisr aktiv"
|
40 |
+
"fraisr cause","fraisr Spendenpartner"
|
41 |
+
"fraisr category","fraisr Kategorie"
|
42 |
+
"fraisr visibility","fraisr Sichtbarkeit"
|
43 |
+
"visibility_both","Beide"
|
44 |
+
"visibility_shop","Shop"
|
45 |
+
"visibility_fraisr","fraisr"
|
46 |
+
"fraisr ID","fraisr ID"
|
47 |
+
"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.","Für %s Produkt(e) wurde ""fraisr aktiv"" auf ""Nein"" geändert, da deren Spendenpartner nicht mehr verfügbar ist. Skus: ""%s"". Bei Fragen wenden Sie sich bitte an den fraisr-Support."
|
48 |
+
"Product cause check failed with message: ""%s"".","Der Spendenpartner-Produckt-Check ist fehlgeschlagen: ""%s""."
|
49 |
+
"An unknown error during product cause check happened with message: ""%s""","Ein unbekannter Fehler ist bei dem Spendenpartner-Produckt-Check aufgetreten: ""%s"""
|
50 |
+
"The fraisr-extension was disabled in the configuration.","Die fraisr-Extension wurde im Konfigurationsbereich deaktiviert"
|
51 |
+
"fraisr causes have to be synchronized.","Eine Synchronisierung der fraisr-Spendenpartner ist notwendig."
|
52 |
+
"fraisr categories have to be synchronized.","Eine Synchronisierung der fraisr-Kategorien ist notwendig."
|
53 |
+
"fraisr log","fraisr Protokoll"
|
54 |
+
"Title","Titel"
|
55 |
+
"Type","Art"
|
56 |
+
"Date","Datum"
|
57 |
+
"Task","Task"
|
58 |
+
"Message","Nachricht"
|
59 |
+
"Additional information 1","Zusatzinformationen 1"
|
60 |
+
"Additional information 2","Zusatzinformationen 2"
|
61 |
+
"Success","Erfolg"
|
62 |
+
"Warning","Warnung"
|
63 |
+
"Error","Fehler"
|
64 |
+
"Notice","Notiz"
|
65 |
+
"Cause synchronisation","Spendenpartner-Synchronisierung"
|
66 |
+
"Category synchronisation","Kategorie-Synchronisierung"
|
67 |
+
"Product synchronisation","Produkt-Synchronisierung"
|
68 |
+
"Order synchronisation","Bestellungs-Synchronisierung"
|
69 |
+
"Creditmemo synchronisation","Gutschrift-Synchronisierung"
|
70 |
+
"fraisr synchronisation iterations","fraisr Synchronisierungs-Durchläufe"
|
71 |
+
"Mark products as to synchronize","Produkte als zu Synchronisieren markieren"
|
72 |
+
"An unknown error happened during mark products to synchronisation action with message: ""%s"".","Ein unbekannter Fehler ist während der Markierung der Produkte zur Artikel-Synchronisierung aufgetreten: ""%s""."
|
73 |
+
"%s product(s) were successfully marked as to synchronize (create/update) to fraisr.","%s Produkt(e) wurden erfolgreich zur fraisr-Sychronisierung (Hinzufügen/Aktualisieren) markiert."
|
74 |
+
"%s product(s) were successfully marked as to synchronize (delete) to fraisr.","%s Produkt(e) wurden erfolgreich zur fraisr-Sychronisierung (Löschen) markiert."
|
75 |
+
"%s product(s) are waiting in the queue to be deleted in fraisr.","%s Produkt(e) befinden sich in der Warteschleife um in fraisr gelöscht zu werden."
|
76 |
+
"fraisr error message: ""%s"".","fraisr Fehlernachricht: ""%s""."
|
77 |
+
"Not all products have been synchronized because of a transmission error or a script timeout. Please start the process again.","Wegen eines Übertragungsfehlers oder eines Script Timeouts konnten nicht alle Produkte synchronisiert werden. Bitte starten Sie die Synchronisierung erneut."
|
78 |
+
"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.","Wegen eines Übertragungsfehlers oder eines Script Timeouts konnten nicht alle Produkte synchronisiert werden. Darum wurde ein neuer Cron Task für %s erstellt (GMT-Zeitzone)."
|
79 |
+
"Product synchronisation aborted with message: ""%s"".","Die Produkt-Synchronisierung wurde abgebrochen: ""%s""."
|
80 |
+
"An unknown error during product synchronisation happened with message: ""%s"".","Ein unbekannter Fehler ist während der Produkt-Synchronisierung aufgetreten: ""%s""."
|
81 |
+
"%s product(s) were successfully added to fraisr.","%s Produkt(e) wurden erfolgreich in fraisr hinzugefügt."
|
82 |
+
"%s product(s) were successfully updated in fraisr.","%s Produkt(e) wurden erfolgreich in fraisr aktualisiert."
|
83 |
+
"%s product(s) were successfully deleted from fraisr.","%s Produkt(e) wurden erfolgreich von fraisr gelöscht."
|
84 |
+
"The transmission of %s product(s) failed during fraisr synchronisation.","Die Übertragung von %s Produkt(en) ist bei der fraisr-Synchronisierung fehlgeschlagen."
|
85 |
+
"Observer job code is missing.","Der Observer 'job code' war nicht vorhanden."
|
86 |
+
"An error occured during the creation of the following cron task for the product sychronisation with message: ""%s"".","Ein Fehler ist während der Erstellung des Folge-Cron-Tasks der Produkt-Synchronisierung aufgetreten: ""%s""."
|
87 |
+
"Register yourself as a commercial to synchronize your articles by the Magento-extension with fraisr.","Melde Dich bei fraisr als Gewerblicher Händler an, um Deine Artikel über die Magento-Extension einzustellen."
|
88 |
+
"Register","Registrieren"
|
89 |
+
"Donation label product list","Spendenlabel Produktübersicht"
|
90 |
+
"Donation label","Spendenkennzeichnung"
|
91 |
+
"Icon","Icon"
|
92 |
+
"Banderole","Banderole"
|
93 |
+
"Top","Oben"
|
94 |
+
"Bottom","Unten"
|
95 |
+
"Center","Zentrum"
|
96 |
+
"Top left","Oben links"
|
97 |
+
"Top right","Oben rechts"
|
98 |
+
"Bottom left","Unten links"
|
99 |
+
"Bottom right","Unten rechts"
|
100 |
+
"Icon position","Icon-Position"
|
101 |
+
"This setup is used if ""Donation label"" is set to ""Icon"".","Diese Konfiguration wird verwendet wenn ""Spendenkennzeichnung"" auf ""Icon"" eingestellt ist."
|
102 |
+
"Banderole position","Banderole-Position"
|
103 |
+
"This setup is used if ""Donation label"" is set to ""Banderole"".","Diese Konfiguration wird verwendet wenn ""Spendenkennzeichnung"" auf ""Banderole"" eingestellt ist."
|
104 |
+
"Donation label product view","Spendenlabel Produktdetailansicht"
|
105 |
+
"Top area","Oberer Bereich"
|
106 |
+
"Show the donation label in the top area. The donation label will be included under the short description if the structure of the product detail page wasn't modified.","Zeigt das Spendenlabel im oberen Bereich der Produktdetailseite. Sofern die Struktur der Produktdetailseite nicht verändert wurde, erfolgt die Platzierung des Spendenlabels unter der Kurzbeschreibung."
|
107 |
+
"Bottom area","Unterer Bereich"
|
108 |
+
"Show the donation label in the bottom area. The donation label will be included above the additional informations if the structure of the product detail page wasn't modified.","Zeigt das Spendenlabel im unteren Bereich der Produktdetailseite. Sofern die Struktur der Produktdetailseite nicht verändert wurde, erfolgt die Platzierung des Spendenlabels über der langen Produktbeschreibung."
|
109 |
+
"Synchronize orders","Bestellungen synchronisieren"
|
110 |
+
"Not all orders have been synchronized because of a transmission error or a script timeout. Please start the process again.","Wegen eines Übertragungsfehlers oder eines Script Timeouts konnten nicht alle Bestellungen synchronisiert werden. Bitte starten Sie die Synchronisierung erneut."
|
111 |
+
"Order synchronisation aborted with message: ""%s"".","Die Bestellungs-Synchronisierung wurde abgebrochen: ""%s""."
|
112 |
+
"An unknown error during order synchronisation happened with message: ""%s"".","Ein unbekannter Fehler ist während der Bestellungs-Synchronisierung aufgetreten: ""%s""."
|
113 |
+
"FraisrOrderId was not given for new order request, order ""%s"" and item ""%s"".","Die fraisr-Bestellnummer wurde beim Anlegen einer neuen Bestellung nicht übermittelt, Bestellung ""%s"" und Produkt ""%s""."
|
114 |
+
"fraisr order synchronisation completed.","Die fraisr Bestellungs-Synchronisierung wurde erfolgreich durchgeführt."
|
115 |
+
"%s order(s) were successfully added to fraisr.","%s Bestellung(en) wurden erfolgreich in fraisr hinzugefügt."
|
116 |
+
"%s order(s) were successfully updated in fraisr.","%s Bestellung(en) wurden erfolgreich in fraisr aktualisiert."
|
117 |
+
"%s order(s) were successfully deleted from fraisr.","%s Bestellung(en) wurden erfolgreich von fraisr gelöscht."
|
118 |
+
"The transmission of %s order(s) failed during fraisr synchronisation.","Die Übertragung von %s Bestellung(en) ist bei der fraisr-Synchronisierung fehlgeschlagen."
|
119 |
+
"Order status (new orders)","Bestellstatus (neue Bestellungen)"
|
120 |
+
"Only orders with this status will be added in fraisr.","Nur Bestellungen mit diesem Status werden in fraisr hinzugefügt."
|
121 |
+
"Recent days to synchronize","Tage (Synchronisierungs-Zeitraum)"
|
122 |
+
"All orders which were created and/or updated during the last defined days will be synchronized.","Für alle Bestellungen, welche im definierten Zeitraum (jetzt - x Tage) erstellt und/oder aktualisiert wurden, erfolgt eine Übertragung an fraisr."
|
123 |
+
"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.","Wegen eines Übertragungsfehlers oder eines Script Timeouts konnten nicht alle Bestellungen synchronisiert werden. Darum wurde ein neuer Cron Task für %s erstellt (GMT-Zeitzone)."
|
124 |
+
"An error occured during the creation of the following cron task for the order sychronisation with message: ""%s"".","Ein Fehler ist während der Erstellung des Folge-Cron-Tasks der Bestellungs-Synchronisierung aufgetreten: ""%s""."
|
125 |
+
"Product synchronisation","Produkt-Synchronisierung"
|
126 |
+
"Order synchronisation","Bestellungs-Synchronisierung"
|
127 |
+
"Invoice items","Rechnungsartikel"
|
128 |
+
"If activated invoice item amount will be taken as reference instead of order item amount.","Sofern aktiviert, werden anstatt der Anzahl der bestellten Artikel die Anzahl der in Rechnung gestellten Artikel als Referenz verwendet."
|
app/locale/en_US/Fraisr_Connect.csv
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Your key is visible in the fraisr-Backend.","Your key is visible in the fraisr-Backend."
|
2 |
+
"Your secret is visible in the fraisr-Backend.","Your secret is visible in the fraisr-Backend."
|
3 |
+
"Key","Key"
|
4 |
+
"Secret","Secret"
|
5 |
+
"Basic configuration","Basic configuration"
|
6 |
+
"Catalog export","Catalog export"
|
7 |
+
"Global","Global"
|
8 |
+
"Please select ""Global"" or a store as catalog export base.","Please select ""Global"" or a store as catalog export base."
|
9 |
+
"Attribute for product description","Attribute for product description"
|
10 |
+
"This attribute will be taken as product description for the export to fraisr.","This attribute will be taken as product description for the export to fraisr."
|
11 |
+
"Support information","Support information"
|
12 |
+
"Magento version: ","Magento version: "
|
13 |
+
"Extension version: ","Extension version: "
|
14 |
+
"Shop URL: ","Shop URL: "
|
15 |
+
"Synchronize causes","Synchronize causes"
|
16 |
+
"Synchronize categories","Synchronize categories"
|
17 |
+
"Synchronize products","Synchronize products"
|
18 |
+
"Synchronize orders","Synchronize orders"
|
19 |
+
"Synchronize returns","Synchronize returns"
|
20 |
+
"fraisr Synchronisation","fraisr Synchronisation"
|
21 |
+
"Sandbox","Sandbox"
|
22 |
+
"If activated all actions will be done against the Sandbox-API.","If activated all actions will be done against the Sandbox-API."
|
23 |
+
"0 causes retrieved during synchronisation.","0 causes retrieved during synchronisation."
|
24 |
+
"Cause synchronisation succeeded. Imported %s causes.","Cause synchronisation succeeded. Imported %s causes."
|
25 |
+
"Cause synchronisation failed during API request with message: ""%s"".","Cause synchronisation failed during API request with message: ""%s""."
|
26 |
+
"Cause synchronisation failed with message: ""%s"".","Cause synchronisation failed with message: ""%s""."
|
27 |
+
"An unknown error during cause synchronisation happened with message: ""%s""","An unknown error during cause synchronisation happened with message: ""%s"""
|
28 |
+
"Api key is empty. Please complete the configuration.","Api key is empty. Please complete the configuration."
|
29 |
+
"Api secret is empty. Please complete the configuration.","Api secret is empty. Please complete the configuration."
|
30 |
+
"Api response class is ""%s"" instead of ""%s"".","Api response class is ""%s"" instead of ""%s""."
|
31 |
+
"Api response code is ""%s"" instead of ""%s"".","Api response code is ""%s"" instead of ""%s""."
|
32 |
+
"Api response is no valid JSON.","Api response is no valid JSON."
|
33 |
+
"0 categories retrieved. Abort synchronisation.","0 categories retrieved. Abort synchronisation."
|
34 |
+
"Category synchronisation succeeded. Imported %s categories.","Category synchronisation succeeded. Imported %s categories."
|
35 |
+
"Category synchronisation failed during API request with message: ""%s"".","Category synchronisation failed during API request with message: ""%s""."
|
36 |
+
"Category synchronisation failed with message: ""%s"".","Category synchronisation failed with message: ""%s""."
|
37 |
+
"An unknown error during category synchronisation happened with message: ""%s""","An unknown error during category synchronisation happened with message: ""%s"""
|
38 |
+
"fraisr donation percentage","fraisr donation percentage"
|
39 |
+
"fraisr enabled","fraisr enabled"
|
40 |
+
"fraisr cause","fraisr cause"
|
41 |
+
"fraisr category","fraisr category"
|
42 |
+
"fraisr visibility","fraisr visibility"
|
43 |
+
"visibility_both","Both"
|
44 |
+
"visibility_shop","Shop"
|
45 |
+
"visibility_fraisr","fraisr"
|
46 |
+
"fraisr ID","fraisr ID"
|
47 |
+
"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.","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."
|
48 |
+
"Product cause check failed with message: ""%s"".","Product cause check failed with message: ""%s""."
|
49 |
+
"An unknown error during product cause check happened with message: ""%s""","An unknown error during product cause check happened with message: ""%s"""
|
50 |
+
"The fraisr-extension was disabled in the configuration.","The fraisr-extension was disabled in the configuration."
|
51 |
+
"fraisr causes have to be synchronized.","fraisr causes have to be synchronized."
|
52 |
+
"fraisr categories have to be synchronized.","fraisr categories have to be synchronized."
|
53 |
+
"fraisr log","fraisr log"
|
54 |
+
"Title","Title"
|
55 |
+
"Type","Type"
|
56 |
+
"Date","Date"
|
57 |
+
"Task","Task"
|
58 |
+
"Message","Message"
|
59 |
+
"Additional information 1","Additional information 1"
|
60 |
+
"Additional information 2","Additional information 2"
|
61 |
+
"Success","Success"
|
62 |
+
"Warning","Warning"
|
63 |
+
"Error","Error"
|
64 |
+
"Notice","Notice"
|
65 |
+
"Cause synchronisation","Cause synchronisation"
|
66 |
+
"Category synchronisation","Category synchronisation"
|
67 |
+
"Product synchronisation","Product synchronisation"
|
68 |
+
"Order synchronisation","Order synchronisation"
|
69 |
+
"Creditmemo synchronisation","Creditmemo synchronisation"
|
70 |
+
"fraisr synchronisation iterations","fraisr synchronisation iterations"
|
71 |
+
"Mark products as to synchronize","Mark products as to synchronize"
|
72 |
+
"An unknown error happened during mark products to synchronisation action with message: ""%s"".","An unknown error happened during mark products to synchronisation action with message: ""%s""."
|
73 |
+
"%s product(s) were successfully marked as to synchronize (create/update) to fraisr.","%s product(s) were successfully marked as to synchronize (create/update) to fraisr."
|
74 |
+
"%s product(s) were successfully marked as to synchronize (delete) to fraisr.","%s product(s) were successfully marked as to synchronize (delete) to fraisr."
|
75 |
+
"%s product(s) are waiting in the queue to be deleted in fraisr.","%s product(s) are waiting in the queue to be deleted in fraisr."
|
76 |
+
"fraisr error message: ""%s"".","fraisr error message: ""%s""."
|
77 |
+
"Not all products have been synchronized because of a transmission error or a script timeout. Please start the process again.","Not all products have been synchronized because of a transmission error or a script timeout. Please start the process again."
|
78 |
+
"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.","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."
|
79 |
+
"Product synchronisation aborted with message: ""%s"".","Product synchronisation aborted with message: ""%s""."
|
80 |
+
"An unknown error during product synchronisation happened with message: ""%s"".","An unknown error during product synchronisation happened with message: ""%s""."
|
81 |
+
"%s product(s) were successfully added to fraisr.","%s product(s) were successfully added to fraisr."
|
82 |
+
"%s product(s) were successfully updated in fraisr.","%s product(s) were successfully updated in fraisr."
|
83 |
+
"%s product(s) were successfully deleted from fraisr.","%s product(s) were successfully deleted from fraisr."
|
84 |
+
"The transmission of %s product(s) failed during fraisr synchronisation.","The transmission of %s product(s) failed during fraisr synchronisation."
|
85 |
+
"Observer job code is missing.","Observer job code is missing."
|
86 |
+
"An error occured during the creation of the following cron task for the product sychronisation with message: ""%s"".","An error occured during the creation of the following cron task for the product sychronisation with message: ""%s""."
|
87 |
+
"Register yourself as a commercial to synchronize your articles by the Magento-extension with fraisr.","Register yourself as a commercial to synchronize your articles by the Magento-extension with fraisr."
|
88 |
+
"Register","Register"
|
89 |
+
"Donation label product list","Donation label product list"
|
90 |
+
"Donation label","Donation label"
|
91 |
+
"Icon","Icon"
|
92 |
+
"Banderole","Banderole"
|
93 |
+
"Top","Top"
|
94 |
+
"Bottom","Bottom"
|
95 |
+
"Center","Center"
|
96 |
+
"Top left","Top left"
|
97 |
+
"Top right","Top right"
|
98 |
+
"Bottom left","Bottom left"
|
99 |
+
"Bottom right","Bottom right"
|
100 |
+
"Icon position","Icon position"
|
101 |
+
"This setup is used if ""Donation label"" is set to ""Icon"".","This setup is used if ""Donation label"" is set to ""Icon""."
|
102 |
+
"Banderole position","Banderole position"
|
103 |
+
"This setup is used if ""Donation label"" is set to ""Banderole"".","This setup is used if ""Donation label"" is set to ""Banderole""."
|
104 |
+
"Donation label product view","Donation label product view"
|
105 |
+
"Top area","Top area"
|
106 |
+
"Show the donation label in the top area. The donation label will be included under the short description if the structure of the product detail page wasn't modified.","Show the donation label in the top area. The donation label will be included under the short description if the structure of the product detail page wasn't modified."
|
107 |
+
"Bottom area","Bottom area"
|
108 |
+
"Show the donation label in the bottom area. The donation label will be included above the additional informations if the structure of the product detail page wasn't modified.","Show the donation label in the bottom area. The donation label will be included above the additional informations if the structure of the product detail page wasn't modified."
|
109 |
+
"Synchronize orders","Synchronize orders"
|
110 |
+
"Not all orders have been synchronized because of a transmission error or a script timeout. Please start the process again.","Not all orders have been synchronized because of a transmission error or a script timeout. Please start the process again."
|
111 |
+
"Order synchronisation aborted with message: ""%s"".","Order synchronisation aborted with message: ""%s""."
|
112 |
+
"An unknown error during order synchronisation happened with message: ""%s"".","An unknown error during order synchronisation happened with message: ""%s""."
|
113 |
+
"FraisrOrderId was not given for new order request, order ""%s"" and item ""%s"".","FraisrOrderId was not given for new order request, order ""%s"" and item ""%s""."
|
114 |
+
"fraisr order synchronisation completed.","fraisr order synchronisation completed."
|
115 |
+
"%s order(s) were successfully added to fraisr.","%s order(s) were successfully added to fraisr."
|
116 |
+
"%s order(s) were successfully updated in fraisr.","%s order(s) were successfully updated in fraisr."
|
117 |
+
"%s order(s) were successfully deleted from fraisr.","%s order(s) were successfully deleted from fraisr."
|
118 |
+
"The transmission of %s order(s) failed during fraisr synchronisation.","The transmission of %s order(s) failed during fraisr synchronisation."
|
119 |
+
"Order status (new orders)","Order status (new orders)"
|
120 |
+
"Only orders with this status will be added in fraisr.","Only orders with this status will be added in fraisr."
|
121 |
+
"Recent days to synchronize","Recent days to synchronize"
|
122 |
+
"All orders which were created and/or updated during the last defined days will be synchronized.","All orders which were created and/or updated during the last defined days will be synchronized."
|
123 |
+
"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.","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."
|
124 |
+
"An error occured during the creation of the following cron task for the order sychronisation with message: ""%s"".","An error occured during the creation of the following cron task for the order sychronisation with message: ""%s""."
|
125 |
+
"Product synchronisation","Product synchronisation"
|
126 |
+
"Order synchronisation","Order synchronisation"
|
127 |
+
"Invoice items","Invoice items"
|
128 |
+
"If activated invoice item amount will be taken as reference instead of order item amount.","If activated invoice item amount will be taken as reference instead of order item amount."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Fraisr</name>
|
4 |
+
<version>0.3.5</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>Initial release</notes>
|
12 |
+
<authors><author><name>Andre Herrn</name><user>fraisr</user><email>andre.herrn@das-medienkombinat.de</email></author></authors>
|
13 |
+
<date>2013-08-30</date>
|
14 |
+
<time>13:24:14</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="738ccce441a380d9e550dbb195d4ca65"/></dir><file name="Edit.php" hash="a7a9d340645576c63d48f878e7f89553"/><file name="Grid.php" hash="5fdad267ad670efa9ff8219aa6e81f58"/></dir><file name="Log.php" hash="9f15118c8f790fb7001b534554399758"/><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="010195c62bded52ecaad7c5f2040f732"/></dir><dir name="View"><file name="Label.php" hash="52b29ac97fe57129371e10fcf887c823"/></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="b45dcbe778a89fbc1d17e75a1000641a"/><dir name="Synchronisation"><file name="Abstract.php" hash="ddb949841004ec8aeb9d03f03753d6aa"/><file name="Order.php" hash="e9bb90970ccac41b113b1150364c6876"/><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="288b2b042ba383a8495ce5a1f2aedeb8"/><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="a5efb6d6232167664b82e554005ec9d8"/><file name="Order.php" hash="875e051262ebdd12c8f01c1063525d97"/><file name="Product.php" hash="c7b3a18ce6e0f428929d2dc3e4fccc6f"/><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"><dir name="Adminhtml"><file name="LogController.php" hash="96be78d8f0bc0b927cb0296434066bed"/><file name="SynchronisationController.php" hash="963f1b7b6af3ed4da9c086e4dd4bb1d9"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c45830aa9aa1d61cb578280836fd1d77"/><file name="config.xml" hash="2de59316717bc5fde2e790ecf4c26e47"/><file name="system.xml" hash="3d33fe5e508b0667dc141b84d27e296e"/></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"/></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="95f14bb9e6f2591a6b81d54437352e86"/></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="31eb112fb42c472d3b20781442f4c0d7"/></dir><dir name="en_US"><file name="Fraisr_Connect.csv" hash="8b3cbd33722724a7183fbfe3d6c1e5a2"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|