Version Notes
New version includes the possibility to use the cart abandonment and behavioral targeting services
Download this release
Release Info
Developer | BrainSINS |
Extension | Brainsins_Recommender |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 2.0.0
- app/code/community/{Brainsins/Recsins/Model/Api/.DS_Store → .DS_Store} +0 -0
- app/code/community/Brainsins/.DS_Store +0 -0
- app/code/community/Brainsins/{Recsins/Block/Home.php → Recommender/Block/Adminhtml/System/Config/Fieldset/Expanded.php} +37 -36
- app/code/community/Brainsins/{Recsins/Block/Category.php → Recommender/Block/Adminhtml/System/Config/Fieldset/Help.php} +45 -37
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Form/Fieldset/Dashboard/Dashboard.php +58 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Feeds/ProductOffline.php +141 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Feeds/ProductOnline.php +108 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Cart.php +207 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Category.php +207 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Checkout.php +201 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Home.php +208 -0
- app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Product.php +208 -0
- app/code/community/Brainsins/Recommender/Helper/Data.php +671 -0
- app/code/community/Brainsins/Recommender/Helper/sendBrainsinsWS.log +19 -0
- app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Backend/Cron.php +84 -0
- app/code/community/Brainsins/{Recsins/Block/Product.php → Recommender/Model/Adminhtml/System/Config/Backend/Serialized.php} +43 -37
- app/code/community/Brainsins/{Recsins/Model/Mysql4/Recsins.php → Recommender/Model/Adminhtml/System/Config/Source/ApiMode.php} +11 -11
- app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Source/Attributes.php +42 -0
- app/code/community/Brainsins/{Recsins/Helper/Data.php → Recommender/Model/Adminhtml/System/Config/Source/Emailtracking.php} +13 -7
- app/code/community/Brainsins/{Recsins/Block/Adminhtml/Recsins/Edit/Tabs.php → Recommender/Model/Cron.php} +31 -25
- app/code/community/Brainsins/Recommender/Model/Observer.php +159 -0
- app/code/community/Brainsins/{Recsins/Model/Mysql4/Recsins/Collection.php → Recommender/controllers/Adminhtml/FeedsController.php} +11 -11
- app/code/community/Brainsins/Recommender/controllers/CartController.php +151 -0
- app/code/community/Brainsins/{Recsins/Model/Status.php → Recommender/controllers/FeedsController.php} +37 -39
- app/code/community/Brainsins/Recommender/etc/config.xml +247 -0
- app/code/community/Brainsins/Recommender/etc/system.xml +456 -0
- app/code/community/Brainsins/Recsins/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/.LCKRecsins.php~ +0 -1
- app/code/community/Brainsins/Recsins/Block/Adminhtml/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins.php +0 -57
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit.php +0 -45
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Form.php +0 -711
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Tab/Form.php +0 -80
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Grid.php +0 -116
- app/code/community/Brainsins/Recsins/Block/Checkout.php +0 -30
- app/code/community/Brainsins/Recsins/Block/Recsins.php +0 -674
- app/code/community/Brainsins/Recsins/COPYING.txt +0 -674
- app/code/community/Brainsins/Recsins/Entity/Setup.php +0 -29
- app/code/community/Brainsins/Recsins/Helper/Recsins.php +0 -64
- app/code/community/Brainsins/Recsins/Model/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Model/Api/Api.php +0 -284
- app/code/community/Brainsins/Recsins/Model/Api/ProductsApi.php +0 -328
- app/code/community/Brainsins/Recsins/Model/Cart.php +0 -31
- app/code/community/Brainsins/Recsins/Model/CartProduct.php +0 -31
- app/code/community/Brainsins/Recsins/Model/Client.php +0 -592
- app/code/community/Brainsins/Recsins/Model/NewFile.xml +0 -1
- app/code/community/Brainsins/Recsins/Model/Observer.php +0 -116
- app/code/community/Brainsins/Recsins/Model/Order.php +0 -32
- app/code/community/Brainsins/Recsins/Model/OrderProduct.php +0 -32
- app/code/community/Brainsins/Recsins/Model/Product.php +0 -31
- app/code/community/Brainsins/Recsins/Model/Recommender.php +0 -66
- app/code/community/Brainsins/Recsins/Model/Recsins.php +0 -690
- app/code/community/Brainsins/Recsins/Model/Resource/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Model/Resource/Eav/Mysql4/Recommender.php +0 -34
- app/code/community/Brainsins/Recsins/Model/Resource/Eav/Mysql4/Recommender/Collection.php +0 -32
- app/code/community/Brainsins/Recsins/Model/Resource/Setup.php +0 -29
- app/code/community/Brainsins/Recsins/Model/User.php +0 -35
- app/code/community/Brainsins/Recsins/controllers/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/controllers/Adminhtml/RecsinsController.php +0 -380
- app/code/community/Brainsins/Recsins/controllers/IndexController.php +0 -121
- app/code/community/Brainsins/Recsins/etc/api.xml +0 -74
- app/code/community/Brainsins/Recsins/etc/config.xml +0 -254
- app/code/community/Brainsins/Recsins/etc/widget.xml +0 -31
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-install-1.4.0.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.0-1.4.1.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.1-1.4.2.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.2-1.4.3.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.3-1.4.4.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.4-1.4.5.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.5-1.4.6.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.6-1.4.7.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.7-1.4.8.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.8-1.4.9.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.9-1.5.0.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.0-1.5.1.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.1-1.5.2.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.2-1.5.3.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.3-1.5.4.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.4-1.5.5.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.5-1.5.6.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.6-1.5.7.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.7-1.5.8.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.8-1.5.9.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.9-1.6.0.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.0-1.6.1.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.1-1.6.2.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.2-1.6.3.php +0 -47
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.3-1.6.4.php +0 -47
- app/code/community/Cm/RedisSession/Model/Session.php +731 -0
- app/code/community/Cm/RedisSession/etc/config.xml +16 -0
- app/code/community/Phoenix/Moneybookers/Block/Form.php +93 -0
- app/code/community/Phoenix/Moneybookers/Block/Info.php +51 -0
- app/code/community/Phoenix/Moneybookers/Block/Jsinit.php +49 -0
- app/code/community/Phoenix/Moneybookers/Block/Payment.php +39 -0
- app/code/community/Phoenix/Moneybookers/Block/Placeform.php +67 -0
- app/code/community/Phoenix/Moneybookers/Block/Redirect.php +30 -0
- app/code/community/Phoenix/Moneybookers/Helper/Data.php +130 -0
- app/code/community/Phoenix/Moneybookers/Model/Abstract.php +208 -0
- app/code/community/Phoenix/Moneybookers/Model/Acc.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Csi.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Did.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Dnk.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Ebt.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Ent.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Event.php +270 -0
- app/code/community/Phoenix/Moneybookers/Model/Gcb.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Gir.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Idl.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Lsr.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Mae.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Npy.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Obt.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Pli.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Psp.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Pwy.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Sft.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/So2.php +27 -0
- app/code/community/Phoenix/Moneybookers/Model/Wlt.php +28 -0
- app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php +87 -0
- app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php +146 -0
- app/code/community/Phoenix/Moneybookers/etc/config.xml +306 -0
- app/code/community/Phoenix/Moneybookers/etc/system.xml +1201 -0
- app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/install-1.6.0.0.php +22 -0
- app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/mysql4-upgrade-1.2-1.2.0.1.php +41 -0
- app/design/adminhtml/default/default/layout/recsins.xml +0 -32
- app/design/frontend/base/default/layout/recsins.xml +0 -57
- app/design/frontend/base/default/template/recsins/.DS_Store +0 -0
- app/design/frontend/base/default/template/recsins/cart.phtml +0 -1
- app/design/frontend/base/default/template/recsins/category.phtml +0 -1
- app/design/frontend/base/default/template/recsins/product.phtml +0 -1
- app/design/frontend/base/default/template/recsins/recsins.phtml +0 -0
- app/etc/modules/Brainsins_Recsins.xml +0 -33
- app/locale/en_US/Brainsins_Recsins.csv +0 -62
- app/locale/es_ES/Brainsins_Recsins.csv +0 -61
- package.xml +17 -20
- skin/adminhtml/default/default/brainsins/recommender/css/brainsins_recommender.css +142 -0
- skin/adminhtml/default/default/brainsins/recommender/images/brainsins.png +0 -0
- skin/adminhtml/default/default/brainsins/recommender/images/brainsins_logo.png +0 -0
- skin/adminhtml/default/default/brainsins/recommender/images/feed_file_nok.gif +0 -0
- skin/adminhtml/default/default/brainsins/recommender/images/feed_file_ok.gif +0 -0
- skin/adminhtml/default/default/brainsins/recommender/js/brainsins_recommender.js +347 -0
app/code/community/{Brainsins/Recsins/Model/Api/.DS_Store → .DS_Store}
RENAMED
Binary file
|
app/code/community/Brainsins/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/{Recsins/Block/Home.php → Recommender/Block/Adminhtml/System/Config/Fieldset/Expanded.php}
RENAMED
@@ -1,36 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
if ($
|
32 |
-
return
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
}
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Fieldset_Expanded
|
26 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
27 |
+
{
|
28 |
+
protected function _getCollapseState($element)
|
29 |
+
{
|
30 |
+
$extra = Mage::getSingleton('admin/session')->getUser()->getExtra();
|
31 |
+
if (isset($extra['configState'][$element->getId()])) {
|
32 |
+
return $extra['configState'][$element->getId()];
|
33 |
+
}
|
34 |
+
|
35 |
+
return true;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Brainsins/{Recsins/Block/Category.php → Recommender/Block/Adminhtml/System/Config/Fieldset/Help.php}
RENAMED
@@ -1,37 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
protected
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Fieldset_Help
|
26 |
+
extends Mage_Adminhtml_Block_Abstract
|
27 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
28 |
+
{
|
29 |
+
protected $_template = 'brainsins/recommender/help.phtml';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Render fieldset html
|
33 |
+
*
|
34 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
38 |
+
{
|
39 |
+
$elementOriginalData = $element->getOriginalData();
|
40 |
+
if (isset($elementOriginalData['help_link'])) {
|
41 |
+
$this->setHelpLink($elementOriginalData['help_link']);
|
42 |
+
}
|
43 |
+
return $this->toHtml();
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Form/Fieldset/Dashboard/Dashboard.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Form_Fieldset_Dashboard_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
26 |
+
{
|
27 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
28 |
+
{
|
29 |
+
$dashboard_url = 'http://analytics.brainsins.com/';
|
30 |
+
$html = '
|
31 |
+
<div id="dashboard" style="margin-top: -18px">
|
32 |
+
<iframe style="border-bottom:3px solid #dfdfdf" id="dashboardiframe" frameborder=0 src="'.$dashboard_url.'" height=700 width=100% scrolling="yes"></iframe>
|
33 |
+
</div>
|
34 |
+
<a href="http://analytics.brainsins.com" target="_newWindow">'.Mage::helper('brainsins_recommender')->__('Access the BrainSINS dashboard in a new window').'</a>.
|
35 |
+
<script langauge="javascript">
|
36 |
+
function GetHeight() {
|
37 |
+
var y = 0;
|
38 |
+
if (self.innerHeight) {
|
39 |
+
y = self.innerHeight;
|
40 |
+
} else if (document.documentElement && document.documentElement.clientHeight) {
|
41 |
+
y = document.documentElement.clientHeight;
|
42 |
+
} else if (document.body) {
|
43 |
+
y = document.body.clientHeight;
|
44 |
+
}
|
45 |
+
return y;
|
46 |
+
}
|
47 |
+
|
48 |
+
function doResize() {
|
49 |
+
document.getElementById("dashboardiframe").style.height= (GetHeight() - 180) + "px";
|
50 |
+
}
|
51 |
+
|
52 |
+
window.onresize = doResize;
|
53 |
+
doResize();
|
54 |
+
</script>
|
55 |
+
';
|
56 |
+
return $html;
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Feeds/ProductOffline.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Feeds_ProductOffline extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_viewButtonHtml = array();
|
28 |
+
protected $_runButtonHtml = array();
|
29 |
+
protected $_urlOfflineFeedController = array();
|
30 |
+
|
31 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
32 |
+
{
|
33 |
+
$this->setElement($element);
|
34 |
+
$html = '<div id="brainsins_recommender_feeds_template">';
|
35 |
+
$html .= $this->_getRowTemplateHtml();
|
36 |
+
$html .= '</div>';
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
41 |
+
{
|
42 |
+
if(Mage::app()->getRequest()->getParam('store') != '')
|
43 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore(Mage::app()->getRequest()->getParam('store'))->getStoreId());
|
44 |
+
elseif(Mage::app()->getRequest()->getParam('store') == '' && Mage::app()->getRequest()->getParam('website') != '')
|
45 |
+
{
|
46 |
+
Mage::app()->setCurrentStore(Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultGroup()->getDefaultStoreId());
|
47 |
+
$code = Mage::getSingleton('adminhtml/config_data')->getStore();
|
48 |
+
$store_id = Mage::getModel('core/store')->load($code)->getId();
|
49 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultGroup()->getDefaultStoreId());
|
50 |
+
Mage::app()->setCurrentStore(0);
|
51 |
+
}
|
52 |
+
else
|
53 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
|
54 |
+
|
55 |
+
$_feedfile = Mage::getBaseDir('media').DS.'brainsins_feeds/'.$bskey.'.xml';
|
56 |
+
$_file_exists = file_exists($_feedfile);
|
57 |
+
$_url = str_replace('/index.php', '', Mage::getBaseUrl()).'media/brainsins_feeds/'.$bskey.'.xml';
|
58 |
+
if($_file_exists)
|
59 |
+
{
|
60 |
+
$html = '<div style="margin:5px 0 10px;">';
|
61 |
+
$html .= $this->_getProductsFeedUrlHtml('', $_url, $_feedfile);
|
62 |
+
$html .= $this->_getViewButtonHtml('li', Mage::helper('brainsins_recommender')->__('View'), $_url);
|
63 |
+
$html .= $this->_getRunButtonHtml('li', Mage::helper('brainsins_recommender')->__('Run'), $_url, $bskey);
|
64 |
+
$html .= '</div>';
|
65 |
+
}
|
66 |
+
else
|
67 |
+
{
|
68 |
+
$html = '<div style="margin:5px 0 10px;">';
|
69 |
+
$html .= '<span class="feed-filenok">'.Mage::helper('brainsins_recommender')->__('The offline feed is not generated yet.').'</span>';
|
70 |
+
$html .= $this->_getRunButtonHtml('li', Mage::helper('brainsins_recommender')->__('Generate'), $_url, $bskey);
|
71 |
+
$html .= '</div>';
|
72 |
+
$html .= $this->_getUrlOfflineFeedControllerHtml('li', '', $_url, $bskey);
|
73 |
+
}
|
74 |
+
|
75 |
+
return $html;
|
76 |
+
}
|
77 |
+
|
78 |
+
protected function _getDisabled()
|
79 |
+
{
|
80 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
81 |
+
}
|
82 |
+
|
83 |
+
protected function _getValue($key)
|
84 |
+
{
|
85 |
+
return $this->getElement()->getData('value/' . $key);
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function _getSelected($key, $value)
|
89 |
+
{
|
90 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _getRadioSelected($key, $value)
|
94 |
+
{
|
95 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
96 |
+
}
|
97 |
+
|
98 |
+
protected function _getViewButtonHtml($selector = 'li', $title = 'View', $url = '')
|
99 |
+
{
|
100 |
+
if (!$this->_viewButtonHtml)
|
101 |
+
{
|
102 |
+
$this->_viewButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
103 |
+
->setType('button')
|
104 |
+
->setId('btnViewOfflineFeed')
|
105 |
+
->setClass('scalable go custom' . $this->_getDisabled())
|
106 |
+
->setLabel($this->__($title))
|
107 |
+
->setOnClick("window.open('" . $url . "')")
|
108 |
+
->setDisabled($this->_getDisabled())
|
109 |
+
->toHtml();
|
110 |
+
}
|
111 |
+
return $this->_viewButtonHtml;
|
112 |
+
}
|
113 |
+
|
114 |
+
protected function _getRunButtonHtml($selector = 'li', $title = 'Run', $url = '', $bskey = '')
|
115 |
+
{
|
116 |
+
if (!$this->_runButtonHtml)
|
117 |
+
{
|
118 |
+
$this->_runButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
119 |
+
->setType('button')
|
120 |
+
->setId('btnRunOfflineFeed')
|
121 |
+
->setClass('scalable go custom' . $this->_getDisabled())
|
122 |
+
->setLabel($this->__($title))
|
123 |
+
->setOnClick("runOfflineFeed('".Mage::helper('adminhtml')->getUrl('brainsins_recommender/adminhtml_feeds/run')."','".$url."','".$bskey."')")
|
124 |
+
->setDisabled($this->_getDisabled())
|
125 |
+
->toHtml();
|
126 |
+
}
|
127 |
+
return $this->_runButtonHtml;
|
128 |
+
}
|
129 |
+
|
130 |
+
protected function _getUrlOfflineFeedControllerHtml($selector = 'li', $title = 'Run', $url = '', $bskey)
|
131 |
+
{
|
132 |
+
$_url = str_replace('/index.php', '', Mage::getBaseUrl()).'media/brainsins_feeds/'.$bskey.'.xml';
|
133 |
+
return '<input type="hidden" id="urlOfflineFeedController" value="'.Mage::helper('adminhtml')->getUrl('brainsins_recommender/adminhtml_feeds/run').'bskey/'.$bskey.'" />
|
134 |
+
<input type="hidden" id="urlOfflineFeedFile" value="'.$_url.'" />';
|
135 |
+
}
|
136 |
+
|
137 |
+
protected function _getProductsFeedUrlHtml($default_value = '', $_url = '', $_feedfile)
|
138 |
+
{
|
139 |
+
return '<span class="url-feed-offline">'.$_url.' ('.date ("d/m/Y H:i", filemtime($_feedfile)).')</span>';
|
140 |
+
}
|
141 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Feeds/ProductOnline.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Feeds_ProductOnline extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_viewButtonHtml = array();
|
28 |
+
|
29 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
30 |
+
{
|
31 |
+
$this->setElement($element);
|
32 |
+
$html = '<div id="brainsins_recommender_feeds_template">';
|
33 |
+
$html .= $this->_getRowTemplateHtml();
|
34 |
+
$html .= '</div>';
|
35 |
+
|
36 |
+
return $html;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
40 |
+
{
|
41 |
+
if(Mage::app()->getRequest()->getParam('store') != '')
|
42 |
+
{
|
43 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore(Mage::app()->getRequest()->getParam('store'))->getStoreId());
|
44 |
+
}
|
45 |
+
/*elseif(Mage::app()->getRequest()->getParam('store') == '' && Mage::app()->getRequest()->getParam('website') != '')
|
46 |
+
{
|
47 |
+
Mage::app()->setCurrentStore(Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultGroup()->getDefaultStoreId());
|
48 |
+
$code = Mage::getSingleton('adminhtml/config_data')->getStore();
|
49 |
+
$store_id = Mage::getModel('core/store')->load($code)->getId();
|
50 |
+
$store_id = Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultGroup()->getDefaultStoreId();
|
51 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultGroup()->getDefaultStoreId());
|
52 |
+
}*/
|
53 |
+
else
|
54 |
+
{
|
55 |
+
$store_id = Mage::app()->getStore()->getStoreId();
|
56 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $store_id);
|
57 |
+
}
|
58 |
+
//$_key = substr(sha1($bskey),0,10);
|
59 |
+
$_url = str_replace('/index.php', '', Mage::getBaseUrl()).'brainsins/feeds/products/key/'.$bskey;
|
60 |
+
$html = '<div style="margin:5px 0 10px;">';
|
61 |
+
$html .= $this->_getProductsFeedUrlHtml('', $_url);
|
62 |
+
$html .= $this->_getViewButtonHtml('li', Mage::helper('brainsins_recommender')->__('View'), $_url);
|
63 |
+
$html .= '</div>';
|
64 |
+
|
65 |
+
return $html;
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function _getDisabled()
|
69 |
+
{
|
70 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
71 |
+
}
|
72 |
+
|
73 |
+
protected function _getValue($key)
|
74 |
+
{
|
75 |
+
return $this->getElement()->getData('value/' . $key);
|
76 |
+
}
|
77 |
+
|
78 |
+
protected function _getSelected($key, $value)
|
79 |
+
{
|
80 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
81 |
+
}
|
82 |
+
|
83 |
+
protected function _getRadioSelected($key, $value)
|
84 |
+
{
|
85 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function _getViewButtonHtml($selector = 'li', $title = 'View', $url = '')
|
89 |
+
{
|
90 |
+
if (!$this->_viewButtonHtml)
|
91 |
+
{
|
92 |
+
$this->_viewButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
93 |
+
->setType('button')
|
94 |
+
->setId('btnViewOnlineFeed')
|
95 |
+
->setClass('scalable go custom' . $this->_getDisabled())
|
96 |
+
->setLabel($this->__($title))
|
97 |
+
->setOnClick("window.open('" . $url . "')")
|
98 |
+
->setDisabled($this->_getDisabled())
|
99 |
+
->toHtml();
|
100 |
+
}
|
101 |
+
return $this->_viewButtonHtml;
|
102 |
+
}
|
103 |
+
|
104 |
+
protected function _getProductsFeedUrlHtml($default_value = '', $_url = '')
|
105 |
+
{
|
106 |
+
return '<span class="url-feed">'.$_url.'</span>';
|
107 |
+
}
|
108 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Cart.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Cart extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_addRowButtonHtml = array();
|
28 |
+
protected $_removeRowButtonHtml = array();
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->setElement($element);
|
33 |
+
$html = '<div id="brainsins_recommender_recommenders_cart_template" style="display:none">';
|
34 |
+
$html .= $this->_getRowTemplateHtml();
|
35 |
+
$html .= '</div>';
|
36 |
+
$html .= '<ul id="brainsins_recommender_recommenders_container_cart">';
|
37 |
+
if ($this->_getValue('custom_div_cart'))
|
38 |
+
{
|
39 |
+
foreach ($this->_getValue('custom_div_cart') as $i => $f)
|
40 |
+
{
|
41 |
+
if ($i)
|
42 |
+
$html .= $this->_getRowTemplateHtml($i);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$html .= '</ul>';
|
46 |
+
$html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_cart',
|
47 |
+
'brainsins_recommender_recommenders_cart_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
|
48 |
+
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
53 |
+
{
|
54 |
+
$html = '<li>';
|
55 |
+
$html .= '<div style="margin:5px 0 10px;">';
|
56 |
+
if($this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex) != '')
|
57 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex));
|
58 |
+
else
|
59 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
|
60 |
+
$html .= '<div style="height: 2px;"></div>';
|
61 |
+
if($this->_getValue('custom_div_cart/'.$rowIndex) != '')
|
62 |
+
$class = 'custom-select-after-before-hide';
|
63 |
+
else
|
64 |
+
$class = 'custom-select-after-before';
|
65 |
+
$html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_cart/'.$rowIndex), 'recommender_after_before_cart', $class);
|
66 |
+
if($this->getElement()->getData('value/'.'recommender_position_cart/'.$rowIndex) != '')
|
67 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_cart/'.$rowIndex));
|
68 |
+
else
|
69 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, 'crosssell');
|
70 |
+
$html .= '<p class="custom-p">';
|
71 |
+
$html .= '<span class="custom-div"';
|
72 |
+
if($this->_getValue('custom_div_cart/'.$rowIndex) == '')
|
73 |
+
$html .= ' style = "display:none;" ';
|
74 |
+
$html .= '>'.Mage::helper('brainsins_recommender')->__('Custom pos:').' </span>';
|
75 |
+
if($this->_getValue('custom_div_cart/'.$rowIndex) == '')
|
76 |
+
$class = 'custom-select-after-before-div-hide';
|
77 |
+
else
|
78 |
+
$class = 'custom-select-after-before-div';
|
79 |
+
$html .= $this->_getCustomDivPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'customdiv_after_before_cart/'.$rowIndex), 'customdiv_after_before_cart', $class).'<input type="text" class="custom-input-text" id="[custom_div_cart]['.$rowIndex.']" name="'
|
80 |
+
.$this->getElement()->getName().'[custom_div_cart][]" placeholder="'.Mage::helper('brainsins_recommender')->__('Custom position').'" value="'
|
81 |
+
.$this->_getValue('custom_div_cart/'.$rowIndex) . '" ';
|
82 |
+
if($this->_getValue('custom_div_cart/'.$rowIndex) == '')
|
83 |
+
$html .= ' style = "display:none;" ';
|
84 |
+
$html .= $this->_getDisabled().'/>';
|
85 |
+
$html .= $this->_getRemoveRowButtonHtml('li',Mage::helper('brainsins_recommender')->__('Delete'));
|
86 |
+
$html .= '</p></div>';
|
87 |
+
$html .= '<div class="recommender-separator"></div>';
|
88 |
+
$html .= '</li>';
|
89 |
+
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
protected function _getDisabled()
|
93 |
+
{
|
94 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
95 |
+
}
|
96 |
+
|
97 |
+
protected function _getValue($key)
|
98 |
+
{
|
99 |
+
return $this->getElement()->getData('value/' . $key);
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function _getSelected($key, $value)
|
103 |
+
{
|
104 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
105 |
+
}
|
106 |
+
|
107 |
+
protected function _getRadioSelected($key, $value)
|
108 |
+
{
|
109 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
113 |
+
{
|
114 |
+
if (!isset($this->_addRowButtonHtml[$container]))
|
115 |
+
{
|
116 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
117 |
+
->setType('button')
|
118 |
+
->setClass('add ' . $this->_getDisabled())
|
119 |
+
->setLabel($this->__($title))
|
120 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
121 |
+
->setDisabled($this->_getDisabled())
|
122 |
+
->toHtml();
|
123 |
+
}
|
124 |
+
return $this->_addRowButtonHtml[$container];
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
|
128 |
+
{
|
129 |
+
if (!$this->_removeRowButtonHtml)
|
130 |
+
{
|
131 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
132 |
+
->setType('button')
|
133 |
+
->setClass('delete v-middle custom' . $this->_getDisabled())
|
134 |
+
->setLabel($this->__($title))
|
135 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
136 |
+
->setDisabled($this->_getDisabled())
|
137 |
+
->toHtml();
|
138 |
+
}
|
139 |
+
return $this->_removeRowButtonHtml;
|
140 |
+
}
|
141 |
+
|
142 |
+
protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
|
143 |
+
{
|
144 |
+
$recommenders = Mage::helper('brainsins_recommender')->getRecommenders('3');
|
145 |
+
|
146 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
147 |
+
->setName($this->getElement()->getName().'[recommender_name_cart][]"'.$this->_getDisabled())
|
148 |
+
->setId('[recommender_name_cart]['.$rowIndex.']')
|
149 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
|
150 |
+
->setValue($default_value)
|
151 |
+
->setClass('custom-select-first required-recommender-cart');
|
152 |
+
$select = $tmp->setOptions($recommenders);
|
153 |
+
|
154 |
+
return $select->getHtml();
|
155 |
+
}
|
156 |
+
|
157 |
+
protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
|
158 |
+
{
|
159 |
+
$positions = Mage::helper('brainsins_recommender')->getPositions('3');
|
160 |
+
|
161 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
162 |
+
->setName($this->getElement()->getName().'[recommender_position_cart][]"'.$this->_getDisabled())
|
163 |
+
->setId('[recommender_position_cart]['.$rowIndex.']')
|
164 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
|
165 |
+
->setValue($default_value)
|
166 |
+
->setExtraParams('onchange="checkCustom(this)"')
|
167 |
+
->setClass('custom-select-last required-position-or-custom-div-cart');
|
168 |
+
$select = $tmp->setOptions($positions);
|
169 |
+
|
170 |
+
return $select->getHtml();
|
171 |
+
}
|
172 |
+
|
173 |
+
protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = 'before', $default_id = '', $class)
|
174 |
+
{
|
175 |
+
$positions = array();
|
176 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
177 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
178 |
+
|
179 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
180 |
+
->setName($this->getElement()->getName().'[recommender_after_before_cart][]"'.$this->_getDisabled())
|
181 |
+
->setId('[recommender_after_before_cart]['.$rowIndex.']')
|
182 |
+
->setValue($default_value)
|
183 |
+
->setClass($class);
|
184 |
+
$select = $tmp->setOptions($positions);
|
185 |
+
|
186 |
+
return $select->getHtml();
|
187 |
+
}
|
188 |
+
|
189 |
+
protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
|
190 |
+
{
|
191 |
+
$positions = array();
|
192 |
+
$positions[] = array('value' => 'replace', 'label' => Mage::helper('brainsins_recommender')->__('Replace'));
|
193 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
194 |
+
$positions[] = array('value' => 'first', 'label' => Mage::helper('brainsins_recommender')->__('First'));
|
195 |
+
$positions[] = array('value' => 'last', 'label' => Mage::helper('brainsins_recommender')->__('Last'));
|
196 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
197 |
+
|
198 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
199 |
+
->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
|
200 |
+
->setId('['.$id.']['.$rowIndex.']')
|
201 |
+
->setValue($default_value)
|
202 |
+
->setClass($class);
|
203 |
+
$select = $tmp->setOptions($positions);
|
204 |
+
|
205 |
+
return $select->getHtml();
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Category.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Category extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_addRowButtonHtml = array();
|
28 |
+
protected $_removeRowButtonHtml = array();
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->setElement($element);
|
33 |
+
$html = '<div id="brainsins_recommender_recommenders_category_template" style="display:none">';
|
34 |
+
$html .= $this->_getRowTemplateHtml();
|
35 |
+
$html .= '</div>';
|
36 |
+
$html .= '<ul id="brainsins_recommender_recommenders_container_category">';
|
37 |
+
if ($this->_getValue('custom_div_c'))
|
38 |
+
{
|
39 |
+
foreach ($this->_getValue('custom_div_c') as $i => $f)
|
40 |
+
{
|
41 |
+
if ($i)
|
42 |
+
$html .= $this->_getRowTemplateHtml($i);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$html .= '</ul>';
|
46 |
+
$html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_category',
|
47 |
+
'brainsins_recommender_recommenders_category_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
|
48 |
+
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
53 |
+
{
|
54 |
+
$html = '<li>';
|
55 |
+
$html .= '<div style="margin:5px 0 10px;">';
|
56 |
+
if($this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex) != '')
|
57 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex));
|
58 |
+
else
|
59 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
|
60 |
+
$html .= '<div style="height: 2px;"></div>';
|
61 |
+
if($this->_getValue('custom_div_c/'.$rowIndex) != '')
|
62 |
+
$class = 'custom-select-after-before-hide';
|
63 |
+
else
|
64 |
+
$class = 'custom-select-after-before';
|
65 |
+
$html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_c/'.$rowIndex), 'recommender_after_before_c', $class);
|
66 |
+
if($this->getElement()->getData('value/'.'recommender_position_c/'.$rowIndex) != '')
|
67 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_c/'.$rowIndex));
|
68 |
+
else
|
69 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, 'product_list');
|
70 |
+
$html .= '<p class="custom-p">';
|
71 |
+
$html .= '<span class="custom-div"';
|
72 |
+
if($this->_getValue('custom_div_c/'.$rowIndex) == '')
|
73 |
+
$html .= ' style = "display:none;" ';
|
74 |
+
$html .= '>'.Mage::helper('brainsins_recommender')->__('Custom pos:').' </span>';
|
75 |
+
if($this->_getValue('custom_div_c/'.$rowIndex) == '')
|
76 |
+
$class = 'custom-select-after-before-div-hide';
|
77 |
+
else
|
78 |
+
$class = 'custom-select-after-before-div';
|
79 |
+
$html .= $this->_getCustomDivPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'customdiv_after_before_c/'.$rowIndex), 'customdiv_after_before_c', $class).'<input type="text" class="custom-input-text" id="[custom_div_c]['.$rowIndex.']" name="'
|
80 |
+
.$this->getElement()->getName().'[custom_div_c][]" placeholder="'.Mage::helper('brainsins_recommender')->__('Custom position').'" value="'
|
81 |
+
.$this->_getValue('custom_div_c/'.$rowIndex) . '" ';
|
82 |
+
if($this->_getValue('custom_div_c/'.$rowIndex) == '')
|
83 |
+
$html .= ' style = "display:none;" ';
|
84 |
+
$html .= $this->_getDisabled().'/>';
|
85 |
+
$html .= $this->_getRemoveRowButtonHtml('li',Mage::helper('brainsins_recommender')->__('Delete'));
|
86 |
+
$html .= '</p></div>';
|
87 |
+
$html .= '<div class="recommender-separator"></div>';
|
88 |
+
$html .= '</li>';
|
89 |
+
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
protected function _getDisabled()
|
93 |
+
{
|
94 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
95 |
+
}
|
96 |
+
|
97 |
+
protected function _getValue($key)
|
98 |
+
{
|
99 |
+
return $this->getElement()->getData('value/' . $key);
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function _getSelected($key, $value)
|
103 |
+
{
|
104 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
105 |
+
}
|
106 |
+
|
107 |
+
protected function _getRadioSelected($key, $value)
|
108 |
+
{
|
109 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
113 |
+
{
|
114 |
+
if (!isset($this->_addRowButtonHtml[$container]))
|
115 |
+
{
|
116 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
117 |
+
->setType('button')
|
118 |
+
->setClass('add ' . $this->_getDisabled())
|
119 |
+
->setLabel($this->__($title))
|
120 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
121 |
+
->setDisabled($this->_getDisabled())
|
122 |
+
->toHtml();
|
123 |
+
}
|
124 |
+
return $this->_addRowButtonHtml[$container];
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
|
128 |
+
{
|
129 |
+
if (!$this->_removeRowButtonHtml)
|
130 |
+
{
|
131 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
132 |
+
->setType('button')
|
133 |
+
->setClass('delete v-middle custom' . $this->_getDisabled())
|
134 |
+
->setLabel($this->__($title))
|
135 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
136 |
+
->setDisabled($this->_getDisabled())
|
137 |
+
->toHtml();
|
138 |
+
}
|
139 |
+
return $this->_removeRowButtonHtml;
|
140 |
+
}
|
141 |
+
|
142 |
+
protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
|
143 |
+
{
|
144 |
+
$recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
|
145 |
+
|
146 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
147 |
+
->setName($this->getElement()->getName().'[recommender_name_c][]"'.$this->_getDisabled())
|
148 |
+
->setId('[recommender_name_c]['.$rowIndex.']')
|
149 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
|
150 |
+
->setValue($default_value)
|
151 |
+
->setClass('custom-select-first required-recommender-category');
|
152 |
+
$select = $tmp->setOptions($recommenders);
|
153 |
+
|
154 |
+
return $select->getHtml();
|
155 |
+
}
|
156 |
+
|
157 |
+
protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
|
158 |
+
{
|
159 |
+
$positions = Mage::helper('brainsins_recommender')->getPositions('7');
|
160 |
+
|
161 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
162 |
+
->setName($this->getElement()->getName().'[recommender_position_c][]"'.$this->_getDisabled())
|
163 |
+
->setId('[recommender_position_c]['.$rowIndex.']')
|
164 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
|
165 |
+
->setValue($default_value)
|
166 |
+
->setExtraParams('onchange="checkCustom(this)"')
|
167 |
+
->setClass('custom-select-last required-position-or-custom-div-category');
|
168 |
+
$select = $tmp->setOptions($positions);
|
169 |
+
|
170 |
+
return $select->getHtml();
|
171 |
+
}
|
172 |
+
|
173 |
+
protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = 'before', $default_id = '', $class)
|
174 |
+
{
|
175 |
+
$positions = array();
|
176 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
177 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
178 |
+
|
179 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
180 |
+
->setName($this->getElement()->getName().'[recommender_after_before_c][]"'.$this->_getDisabled())
|
181 |
+
->setId('[recommender_after_before_c]['.$rowIndex.']')
|
182 |
+
->setValue($default_value)
|
183 |
+
->setClass($class);
|
184 |
+
$select = $tmp->setOptions($positions);
|
185 |
+
|
186 |
+
return $select->getHtml();
|
187 |
+
}
|
188 |
+
|
189 |
+
protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
|
190 |
+
{
|
191 |
+
$positions = array();
|
192 |
+
$positions[] = array('value' => 'replace', 'label' => Mage::helper('brainsins_recommender')->__('Replace'));
|
193 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
194 |
+
$positions[] = array('value' => 'first', 'label' => Mage::helper('brainsins_recommender')->__('First'));
|
195 |
+
$positions[] = array('value' => 'last', 'label' => Mage::helper('brainsins_recommender')->__('Last'));
|
196 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
197 |
+
|
198 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
199 |
+
->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
|
200 |
+
->setId('['.$id.']['.$rowIndex.']')
|
201 |
+
->setValue($default_value)
|
202 |
+
->setClass($class);
|
203 |
+
$select = $tmp->setOptions($positions);
|
204 |
+
|
205 |
+
return $select->getHtml();
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Checkout.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Checkout extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_addRowButtonHtml = array();
|
28 |
+
protected $_removeRowButtonHtml = array();
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->setElement($element);
|
33 |
+
$html = '<div id="brainsins_recommender_recommenders_checkout_template" style="display:none">';
|
34 |
+
$html .= $this->_getRowTemplateHtml();
|
35 |
+
$html .= '</div>';
|
36 |
+
$html .= '<ul id="brainsins_recommender_recommenders_container_checkout">';
|
37 |
+
if ($this->_getValue('custom_div_check'))
|
38 |
+
{
|
39 |
+
foreach ($this->_getValue('custom_div_check') as $i => $f)
|
40 |
+
{
|
41 |
+
if ($i)
|
42 |
+
$html .= $this->_getRowTemplateHtml($i);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$html .= '</ul>';
|
46 |
+
$html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_checkout',
|
47 |
+
'brainsins_recommender_recommenders_checkout_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
|
48 |
+
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
53 |
+
{
|
54 |
+
$html = '<li>';
|
55 |
+
$html .= '<div style="margin:5px 0 10px;">';
|
56 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_check/'.$rowIndex));
|
57 |
+
$html .= '<div style="height: 2px;"></div>';
|
58 |
+
if($this->_getValue('custom_div_check/'.$rowIndex) != '')
|
59 |
+
$class = 'custom-select-after-before-hide';
|
60 |
+
else
|
61 |
+
$class = 'custom-select-after-before';
|
62 |
+
$html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_check/'.$rowIndex), 'recommender_after_before_check', $class);
|
63 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_check/'.$rowIndex));
|
64 |
+
$html .= '<p class="custom-p">';
|
65 |
+
$html .= '<span class="custom-div"';
|
66 |
+
if($this->_getValue('custom_div_check/'.$rowIndex) == '')
|
67 |
+
$html .= ' style = "display:none;" ';
|
68 |
+
$html .= '>'.Mage::helper('brainsins_recommender')->__('Custom pos:').' </span>';
|
69 |
+
if($this->_getValue('custom_div_check/'.$rowIndex) == '')
|
70 |
+
$class = 'custom-select-after-before-div-hide';
|
71 |
+
else
|
72 |
+
$class = 'custom-select-after-before-div';
|
73 |
+
$html .= $this->_getCustomDivPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'customdiv_after_before_check/'.$rowIndex), 'customdiv_after_before_check', $class).'<input type="text" class="custom-input-text" id="[custom_div_check]['.$rowIndex.']" name="'
|
74 |
+
.$this->getElement()->getName().'[custom_div_check][]" placeholder="'.Mage::helper('brainsins_recommender')->__('Custom position').'" value="'
|
75 |
+
.$this->_getValue('custom_div_check/'.$rowIndex) . '" ';
|
76 |
+
if($this->_getValue('custom_div_check/'.$rowIndex) == '')
|
77 |
+
$html .= ' style = "display:none;" ';
|
78 |
+
$html .= $this->_getDisabled().'/>';
|
79 |
+
$html .= $this->_getRemoveRowButtonHtml('li',Mage::helper('brainsins_recommender')->__('Delete'));
|
80 |
+
$html .= '</p></div>';
|
81 |
+
$html .= '<div class="recommender-separator"></div>';
|
82 |
+
$html .= '</li>';
|
83 |
+
|
84 |
+
return $html;
|
85 |
+
}
|
86 |
+
protected function _getDisabled()
|
87 |
+
{
|
88 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function _getValue($key)
|
92 |
+
{
|
93 |
+
return $this->getElement()->getData('value/' . $key);
|
94 |
+
}
|
95 |
+
|
96 |
+
protected function _getSelected($key, $value)
|
97 |
+
{
|
98 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
99 |
+
}
|
100 |
+
|
101 |
+
protected function _getRadioSelected($key, $value)
|
102 |
+
{
|
103 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
104 |
+
}
|
105 |
+
|
106 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
107 |
+
{
|
108 |
+
if (!isset($this->_addRowButtonHtml[$container]))
|
109 |
+
{
|
110 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
111 |
+
->setType('button')
|
112 |
+
->setClass('add ' . $this->_getDisabled())
|
113 |
+
->setLabel($this->__($title))
|
114 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
115 |
+
->setDisabled($this->_getDisabled())
|
116 |
+
->toHtml();
|
117 |
+
}
|
118 |
+
return $this->_addRowButtonHtml[$container];
|
119 |
+
}
|
120 |
+
|
121 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
|
122 |
+
{
|
123 |
+
if (!$this->_removeRowButtonHtml)
|
124 |
+
{
|
125 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
126 |
+
->setType('button')
|
127 |
+
->setClass('delete v-middle custom' . $this->_getDisabled())
|
128 |
+
->setLabel($this->__($title))
|
129 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
130 |
+
->setDisabled($this->_getDisabled())
|
131 |
+
->toHtml();
|
132 |
+
}
|
133 |
+
return $this->_removeRowButtonHtml;
|
134 |
+
}
|
135 |
+
|
136 |
+
protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
|
137 |
+
{
|
138 |
+
$recommenders = Mage::helper('brainsins_recommender')->getRecommenders('4');
|
139 |
+
|
140 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
141 |
+
->setName($this->getElement()->getName().'[recommender_name_check][]"'.$this->_getDisabled())
|
142 |
+
->setId('[recommender_name_check]['.$rowIndex.']')
|
143 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
|
144 |
+
->setValue($default_value)
|
145 |
+
->setClass('custom-select-first required-recommender-checkout');
|
146 |
+
$select = $tmp->setOptions($recommenders);
|
147 |
+
|
148 |
+
return $select->getHtml();
|
149 |
+
}
|
150 |
+
|
151 |
+
protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
|
152 |
+
{
|
153 |
+
$positions = Mage::helper('brainsins_recommender')->getPositions('4');
|
154 |
+
|
155 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
156 |
+
->setName($this->getElement()->getName().'[recommender_position_check][]"'.$this->_getDisabled())
|
157 |
+
->setId('[recommender_position_check]['.$rowIndex.']')
|
158 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
|
159 |
+
->setValue($default_value)
|
160 |
+
->setExtraParams('onchange="checkCustom(this)"')
|
161 |
+
->setClass('custom-select-last required-position-or-custom-div-checkout');
|
162 |
+
$select = $tmp->setOptions($positions);
|
163 |
+
|
164 |
+
return $select->getHtml();
|
165 |
+
}
|
166 |
+
|
167 |
+
protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = '', $default_id = '', $class)
|
168 |
+
{
|
169 |
+
$positions = array();
|
170 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
171 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
172 |
+
|
173 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
174 |
+
->setName($this->getElement()->getName().'[recommender_after_before_check][]"'.$this->_getDisabled())
|
175 |
+
->setId('[recommender_after_before_check]['.$rowIndex.']')
|
176 |
+
->setValue($default_value)
|
177 |
+
->setClass($class);
|
178 |
+
$select = $tmp->setOptions($positions);
|
179 |
+
|
180 |
+
return $select->getHtml();
|
181 |
+
}
|
182 |
+
|
183 |
+
protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
|
184 |
+
{
|
185 |
+
$positions = array();
|
186 |
+
$positions[] = array('value' => 'replace', 'label' => Mage::helper('brainsins_recommender')->__('Replace'));
|
187 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
188 |
+
$positions[] = array('value' => 'first', 'label' => Mage::helper('brainsins_recommender')->__('First'));
|
189 |
+
$positions[] = array('value' => 'last', 'label' => Mage::helper('brainsins_recommender')->__('Last'));
|
190 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
191 |
+
|
192 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
193 |
+
->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
|
194 |
+
->setId('['.$id.']['.$rowIndex.']')
|
195 |
+
->setValue($default_value)
|
196 |
+
->setClass($class);
|
197 |
+
$select = $tmp->setOptions($positions);
|
198 |
+
|
199 |
+
return $select->getHtml();
|
200 |
+
}
|
201 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Home.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Home extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_addRowButtonHtml = array();
|
28 |
+
protected $_removeRowButtonHtml = array();
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->setElement($element);
|
33 |
+
$html = '<div id="brainsins_recommender_recommenders_home_template" style="display:none">';
|
34 |
+
$html .= $this->_getRowTemplateHtml();
|
35 |
+
$html .= '</div>';
|
36 |
+
$html .= '<ul id="brainsins_recommender_recommenders_container_home">';
|
37 |
+
if ($this->_getValue('custom_div'))
|
38 |
+
{
|
39 |
+
foreach ($this->_getValue('custom_div') as $i => $f)
|
40 |
+
{
|
41 |
+
if ($i)
|
42 |
+
$html .= $this->_getRowTemplateHtml($i);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$html .= '</ul>';
|
46 |
+
$html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_home',
|
47 |
+
'brainsins_recommender_recommenders_home_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
|
48 |
+
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
53 |
+
{
|
54 |
+
$html = '<li>';
|
55 |
+
$html .= '<div style="margin:5px 0 10px;">';
|
56 |
+
if($this->getElement()->getData('value/'.'recommender_name/'.$rowIndex) != '')
|
57 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name/'.$rowIndex));
|
58 |
+
else
|
59 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
|
60 |
+
$html .= '<div style="height: 2px;"></div>';
|
61 |
+
if($this->_getValue('custom_div/'.$rowIndex) != '')
|
62 |
+
$class = 'custom-select-after-before-hide';
|
63 |
+
else
|
64 |
+
$class = 'custom-select-after-before';
|
65 |
+
$html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before/'.$rowIndex), 'recommender_after_before', $class);
|
66 |
+
if($this->getElement()->getData('value/'.'recommender_position/'.$rowIndex) != '')
|
67 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position/'.$rowIndex));
|
68 |
+
else
|
69 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, 'content');
|
70 |
+
$html .= '<p class="custom-p">';
|
71 |
+
$html .= '<span class="custom-div"';
|
72 |
+
if($this->_getValue('custom_div/'.$rowIndex) == '')
|
73 |
+
$html .= ' style = "display:none;" ';
|
74 |
+
$html .= '>'.Mage::helper('brainsins_recommender')->__('Custom pos:').' </span>';
|
75 |
+
if($this->_getValue('custom_div/'.$rowIndex) == '')
|
76 |
+
$class = 'custom-select-after-before-div-hide';
|
77 |
+
else
|
78 |
+
$class = 'custom-select-after-before-div';
|
79 |
+
$html .= $this->_getCustomDivPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'customdiv_after_before/'.$rowIndex), 'customdiv_after_before', $class).'<input type="text" class="custom-input-text" id="[custom_div]['.$rowIndex.']" name="'
|
80 |
+
.$this->getElement()->getName().'[custom_div][]" placeholder="'.Mage::helper('brainsins_recommender')->__('Custom position').'" value="'
|
81 |
+
.$this->_getValue('custom_div/'.$rowIndex) . '" ';
|
82 |
+
if($this->_getValue('custom_div/'.$rowIndex) == '')
|
83 |
+
$html .= ' style = "display:none;" ';
|
84 |
+
$html .= $this->_getDisabled().'/>';
|
85 |
+
$html .= $this->_getRemoveRowButtonHtml('li',Mage::helper('brainsins_recommender')->__('Delete'));
|
86 |
+
$html .= '</p></div>';
|
87 |
+
$html .= '<div class="recommender-separator"></div>';
|
88 |
+
$html .= '</li>';
|
89 |
+
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _getDisabled()
|
94 |
+
{
|
95 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
96 |
+
}
|
97 |
+
|
98 |
+
protected function _getValue($key)
|
99 |
+
{
|
100 |
+
return $this->getElement()->getData('value/' . $key);
|
101 |
+
}
|
102 |
+
|
103 |
+
protected function _getSelected($key, $value)
|
104 |
+
{
|
105 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function _getRadioSelected($key, $value)
|
109 |
+
{
|
110 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
114 |
+
{
|
115 |
+
if (!isset($this->_addRowButtonHtml[$container]))
|
116 |
+
{
|
117 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
118 |
+
->setType('button')
|
119 |
+
->setClass('add ' . $this->_getDisabled())
|
120 |
+
->setLabel($this->__($title))
|
121 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
122 |
+
->setDisabled($this->_getDisabled())
|
123 |
+
->toHtml();
|
124 |
+
}
|
125 |
+
return $this->_addRowButtonHtml[$container];
|
126 |
+
}
|
127 |
+
|
128 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
|
129 |
+
{
|
130 |
+
if (!$this->_removeRowButtonHtml)
|
131 |
+
{
|
132 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
133 |
+
->setType('button')
|
134 |
+
->setClass('delete v-middle custom' . $this->_getDisabled())
|
135 |
+
->setLabel($this->__($title))
|
136 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
137 |
+
->setDisabled($this->_getDisabled())
|
138 |
+
->toHtml();
|
139 |
+
}
|
140 |
+
return $this->_removeRowButtonHtml;
|
141 |
+
}
|
142 |
+
|
143 |
+
protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
|
144 |
+
{
|
145 |
+
$recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
|
146 |
+
|
147 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
148 |
+
->setName($this->getElement()->getName().'[recommender_name][]"'.$this->_getDisabled())
|
149 |
+
->setId('[recommender_name]['.$rowIndex.']')
|
150 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
|
151 |
+
->setValue($default_value)
|
152 |
+
->setClass('custom-select-first required-recommender-home');
|
153 |
+
$select = $tmp->setOptions($recommenders);
|
154 |
+
|
155 |
+
return $select->getHtml();
|
156 |
+
}
|
157 |
+
|
158 |
+
protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
|
159 |
+
{
|
160 |
+
$positions = Mage::helper('brainsins_recommender')->getPositions('1');
|
161 |
+
|
162 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
163 |
+
->setName($this->getElement()->getName().'[recommender_position][]"'.$this->_getDisabled())
|
164 |
+
->setId('[recommender_position]['.$rowIndex.']')
|
165 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
|
166 |
+
->setValue($default_value)
|
167 |
+
->setExtraParams('onchange="checkCustom(this)"')
|
168 |
+
->setClass('custom-select-last required-position-or-custom-div-home');
|
169 |
+
$select = $tmp->setOptions($positions);
|
170 |
+
|
171 |
+
return $select->getHtml();
|
172 |
+
}
|
173 |
+
|
174 |
+
protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = '', $default_id = '', $class)
|
175 |
+
{
|
176 |
+
$positions = array();
|
177 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
178 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
179 |
+
|
180 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
181 |
+
->setName($this->getElement()->getName().'[recommender_after_before][]"'.$this->_getDisabled())
|
182 |
+
->setId('[recommender_after_before]['.$rowIndex.']')
|
183 |
+
->setValue($default_value)
|
184 |
+
->setClass($class);
|
185 |
+
$select = $tmp->setOptions($positions);
|
186 |
+
|
187 |
+
return $select->getHtml();
|
188 |
+
}
|
189 |
+
|
190 |
+
protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
|
191 |
+
{
|
192 |
+
$positions = array();
|
193 |
+
$positions[] = array('value' => 'replace', 'label' => Mage::helper('brainsins_recommender')->__('Replace'));
|
194 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
195 |
+
$positions[] = array('value' => 'first', 'label' => Mage::helper('brainsins_recommender')->__('First'));
|
196 |
+
$positions[] = array('value' => 'last', 'label' => Mage::helper('brainsins_recommender')->__('Last'));
|
197 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
198 |
+
|
199 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
200 |
+
->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
|
201 |
+
->setId('['.$id.']['.$rowIndex.']')
|
202 |
+
->setValue($default_value)
|
203 |
+
->setClass($class);
|
204 |
+
$select = $tmp->setOptions($positions);
|
205 |
+
|
206 |
+
return $select->getHtml();
|
207 |
+
}
|
208 |
+
}
|
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Product.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Product extends Mage_Adminhtml_Block_System_Config_Form_Field
|
26 |
+
{
|
27 |
+
protected $_addRowButtonHtml = array();
|
28 |
+
protected $_removeRowButtonHtml = array();
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->setElement($element);
|
33 |
+
$html = '<div id="brainsins_recommender_recommenders_product_template" style="display:none">';
|
34 |
+
$html .= $this->_getRowTemplateHtml();
|
35 |
+
$html .= '</div>';
|
36 |
+
$html .= '<ul id="brainsins_recommender_recommenders_container_product">';
|
37 |
+
if ($this->_getValue('custom_div_p'))
|
38 |
+
{
|
39 |
+
foreach ($this->_getValue('custom_div_p') as $i => $f)
|
40 |
+
{
|
41 |
+
if ($i)
|
42 |
+
$html .= $this->_getRowTemplateHtml($i);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$html .= '</ul>';
|
46 |
+
$html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_product',
|
47 |
+
'brainsins_recommender_recommenders_product_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
|
48 |
+
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getRowTemplateHtml($rowIndex = 0)
|
53 |
+
{
|
54 |
+
$html = '<li>';
|
55 |
+
$html .= '<div style="margin:5px 0 10px;">';
|
56 |
+
if($this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex) != '')
|
57 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex));
|
58 |
+
else
|
59 |
+
$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
|
60 |
+
$html .= '<div style="height: 2px;"></div>';
|
61 |
+
if($this->_getValue('custom_div_p/'.$rowIndex) != '')
|
62 |
+
$class = 'custom-select-after-before-hide';
|
63 |
+
else
|
64 |
+
$class = 'custom-select-after-before';
|
65 |
+
$html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_p/'.$rowIndex), 'recommender_after_before_p', $class);
|
66 |
+
if($this->getElement()->getData('value/'.'recommender_position_p/'.$rowIndex) != '')
|
67 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_p/'.$rowIndex));
|
68 |
+
else
|
69 |
+
$html .= $this->_getPositionsHtmlSelect($rowIndex, 'upsell_products');
|
70 |
+
$html .= '<p class="custom-p">';
|
71 |
+
$html .= '<span class="custom-div"';
|
72 |
+
if($this->_getValue('custom_div_p/'.$rowIndex) == '')
|
73 |
+
$html .= ' style = "display:none;" ';
|
74 |
+
$html .= '>'.Mage::helper('brainsins_recommender')->__('Custom pos:').' </span>';
|
75 |
+
if($this->_getValue('custom_div_p/'.$rowIndex) == '')
|
76 |
+
$class = 'custom-select-after-before-div-hide';
|
77 |
+
else
|
78 |
+
$class = 'custom-select-after-before-div';
|
79 |
+
$html .= $this->_getCustomDivPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'customdiv_after_before_p/'.$rowIndex), 'customdiv_after_before_p', $class).'<input type="text" class="custom-input-text" id="[custom_div_p]['.$rowIndex.']" name="'
|
80 |
+
.$this->getElement()->getName().'[custom_div_p][]" placeholder="'.Mage::helper('brainsins_recommender')->__('Custom position').'" value="'
|
81 |
+
.$this->_getValue('custom_div_p/'.$rowIndex) . '" ';
|
82 |
+
if($this->_getValue('custom_div_p/'.$rowIndex) == '')
|
83 |
+
$html .= ' style = "display:none;" ';
|
84 |
+
$html .= $this->_getDisabled().'/>';
|
85 |
+
$html .= $this->_getRemoveRowButtonHtml('li',Mage::helper('brainsins_recommender')->__('Delete'));
|
86 |
+
$html .= '</p></div>';
|
87 |
+
$html .= '<div class="recommender-separator"></div>';
|
88 |
+
$html .= '</li>';
|
89 |
+
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _getDisabled()
|
94 |
+
{
|
95 |
+
return $this->getElement()->getDisabled() ? ' disabled' : '';
|
96 |
+
}
|
97 |
+
|
98 |
+
protected function _getValue($key)
|
99 |
+
{
|
100 |
+
return $this->getElement()->getData('value/' . $key);
|
101 |
+
}
|
102 |
+
|
103 |
+
protected function _getSelected($key, $value)
|
104 |
+
{
|
105 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function _getRadioSelected($key, $value)
|
109 |
+
{
|
110 |
+
return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
114 |
+
{
|
115 |
+
if (!isset($this->_addRowButtonHtml[$container]))
|
116 |
+
{
|
117 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
118 |
+
->setType('button')
|
119 |
+
->setClass('add ' . $this->_getDisabled())
|
120 |
+
->setLabel($this->__($title))
|
121 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
122 |
+
->setDisabled($this->_getDisabled())
|
123 |
+
->toHtml();
|
124 |
+
}
|
125 |
+
return $this->_addRowButtonHtml[$container];
|
126 |
+
}
|
127 |
+
|
128 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
|
129 |
+
{
|
130 |
+
if (!$this->_removeRowButtonHtml)
|
131 |
+
{
|
132 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
133 |
+
->setType('button')
|
134 |
+
->setClass('delete v-middle custom' . $this->_getDisabled())
|
135 |
+
->setLabel($this->__($title))
|
136 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
137 |
+
->setDisabled($this->_getDisabled())
|
138 |
+
->toHtml();
|
139 |
+
}
|
140 |
+
return $this->_removeRowButtonHtml;
|
141 |
+
}
|
142 |
+
|
143 |
+
protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
|
144 |
+
{
|
145 |
+
$recommenders = Mage::helper('brainsins_recommender')->getRecommenders('2');
|
146 |
+
|
147 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
148 |
+
->setName($this->getElement()->getName().'[recommender_name_p][]"'.$this->_getDisabled())
|
149 |
+
->setId('[recommender_name_p]['.$rowIndex.']')
|
150 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
|
151 |
+
->setValue($default_value)
|
152 |
+
->setClass('custom-select-first required-recommender-product');
|
153 |
+
$select = $tmp->setOptions($recommenders);
|
154 |
+
|
155 |
+
return $select->getHtml();
|
156 |
+
}
|
157 |
+
|
158 |
+
protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
|
159 |
+
{
|
160 |
+
$positions = Mage::helper('brainsins_recommender')->getPositions('2');
|
161 |
+
|
162 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
163 |
+
->setName($this->getElement()->getName().'[recommender_position_p][]"'.$this->_getDisabled())
|
164 |
+
->setId('[recommender_position_p]['.$rowIndex.']')
|
165 |
+
->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
|
166 |
+
->setValue($default_value)
|
167 |
+
->setExtraParams('onchange="checkCustom(this)"')
|
168 |
+
->setClass('custom-select-last required-position-or-custom-div-product');
|
169 |
+
$select = $tmp->setOptions($positions);
|
170 |
+
|
171 |
+
return $select->getHtml();
|
172 |
+
}
|
173 |
+
|
174 |
+
protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = 'before', $default_id = '', $class)
|
175 |
+
{
|
176 |
+
$positions = array();
|
177 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
178 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
179 |
+
|
180 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
181 |
+
->setName($this->getElement()->getName().'[recommender_after_before_p][]"'.$this->_getDisabled())
|
182 |
+
->setId('[recommender_after_before_p]['.$rowIndex.']')
|
183 |
+
->setValue($default_value)
|
184 |
+
->setClass($class);
|
185 |
+
$select = $tmp->setOptions($positions);
|
186 |
+
|
187 |
+
return $select->getHtml();
|
188 |
+
}
|
189 |
+
|
190 |
+
protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
|
191 |
+
{
|
192 |
+
$positions = array();
|
193 |
+
$positions[] = array('value' => 'replace', 'label' => Mage::helper('brainsins_recommender')->__('Replace'));
|
194 |
+
$positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
|
195 |
+
$positions[] = array('value' => 'first', 'label' => Mage::helper('brainsins_recommender')->__('First'));
|
196 |
+
$positions[] = array('value' => 'last', 'label' => Mage::helper('brainsins_recommender')->__('Last'));
|
197 |
+
$positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
|
198 |
+
|
199 |
+
$tmp = Mage::app()->getLayout()->createBlock('core/html_select')
|
200 |
+
->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
|
201 |
+
->setId('['.$id.']['.$rowIndex.']')
|
202 |
+
->setValue($default_value)
|
203 |
+
->setClass($class);
|
204 |
+
$select = $tmp->setOptions($positions);
|
205 |
+
|
206 |
+
return $select->getHtml();
|
207 |
+
}
|
208 |
+
}
|
app/code/community/Brainsins/Recommender/Helper/Data.php
ADDED
@@ -0,0 +1,671 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* ID BRAINSINS PAGE
|
27 |
+
* Home - 1
|
28 |
+
* Producto - 2
|
29 |
+
* Carrito - 3
|
30 |
+
* Thank you - 4
|
31 |
+
* E-mail - 5
|
32 |
+
* Abandono de carrito - 6
|
33 |
+
* Categoría - 7
|
34 |
+
*/
|
35 |
+
|
36 |
+
class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
|
37 |
+
{
|
38 |
+
protected static $_api_url = 'http://durotar.api.brainsins.com/RecSinsAPI/api/';
|
39 |
+
protected static $_pages = 'home,product,category,cart,checkout'; //-->Not needed yet
|
40 |
+
|
41 |
+
public static function getApiUrl() {
|
42 |
+
$apiMode = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/api_mode', Mage::app()->getStore()->getStoreId());
|
43 |
+
if ($apiMode == "1") {
|
44 |
+
return 'http://api.brainsins.com/RecSinsAPI/api/';
|
45 |
+
} else {
|
46 |
+
return 'http://durotar.api.brainsins.com/RecSinsAPI/api/';
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
public function getRecommenders($page)
|
52 |
+
{
|
53 |
+
$recommenders = array();
|
54 |
+
$extension_enabled = Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId());
|
55 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
|
56 |
+
$msg_not_available = Mage::helper('brainsins_recommender')->__('No available recommenders in this page');
|
57 |
+
|
58 |
+
if(!$extension_enabled || $bskey == '')
|
59 |
+
return array('value' => '', 'label' => $msg_not_available);
|
60 |
+
|
61 |
+
$response = @file_get_contents(self::getApiUrl()."recommender/retrieve.xml?token=".$bskey);
|
62 |
+
|
63 |
+
if ($response !== false)
|
64 |
+
{
|
65 |
+
$xmlData = simplexml_load_string($response);
|
66 |
+
$jsonData = json_decode(json_encode((array) $xmlData), true);
|
67 |
+
$recommenders[] = array('value' => '', 'label' => Mage::helper('brainsins_recommender')->__('--- Recommender name ---'));
|
68 |
+
foreach ($jsonData['recommenders']['recommender'] as $recommender)
|
69 |
+
{
|
70 |
+
if($recommender['page'] == $page)
|
71 |
+
$recommenders[] = array('value' => $recommender['id_recommender'], 'label' => $recommender['name']);
|
72 |
+
}
|
73 |
+
return $recommenders;
|
74 |
+
}
|
75 |
+
else
|
76 |
+
$recommenders[0] = array('value' => '', 'label' => $msg_not_available);
|
77 |
+
|
78 |
+
return $recommenders;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getPositions($page)
|
82 |
+
{
|
83 |
+
$positions = array();
|
84 |
+
$positions[] = array('value' => '', 'label' => Mage::helper('brainsins_recommender')->__('------------- Recommender position -------------'));
|
85 |
+
|
86 |
+
switch ($page) {
|
87 |
+
case '1':
|
88 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
89 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
90 |
+
$positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
91 |
+
$positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
|
92 |
+
$positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
|
93 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
94 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
95 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
96 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
97 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
98 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
99 |
+
$positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
|
100 |
+
$positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
|
101 |
+
$positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
|
102 |
+
$positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
|
103 |
+
break;
|
104 |
+
case '2':
|
105 |
+
$positions[] = array('value' => 'product.info', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
106 |
+
$positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
|
107 |
+
$positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
|
108 |
+
$positions[] = array('value' => 'description', 'label' => Mage::helper('brainsins_recommender')->__('Product description'));
|
109 |
+
$positions[] = array('value' => 'additional', 'label' => Mage::helper('brainsins_recommender')->__('Product attributes'));
|
110 |
+
$positions[] = array('value' => 'product_options', 'label' => Mage::helper('brainsins_recommender')->__('Product options'));
|
111 |
+
$positions[] = array('value' => 'prices', 'label' => Mage::helper('brainsins_recommender')->__('Product prices'));
|
112 |
+
$positions[] = array('value' => 'product_additional_data', 'label' => Mage::helper('brainsins_recommender')->__('Product additional information'));
|
113 |
+
$positions[] = array('value' => 'upsell_products', 'label' => Mage::helper('brainsins_recommender')->__('Upsell products'));
|
114 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
115 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
116 |
+
$positions[] = array('value' => 'catalog.product.related', 'label' => Mage::helper('brainsins_recommender')->__('Related products'));
|
117 |
+
$positions[] = array('value' => 'media', 'label' => Mage::helper('brainsins_recommender')->__('Product media gallery'));
|
118 |
+
$positions[] = array('value' => 'product_tag_list', 'label' => Mage::helper('brainsins_recommender')->__('Product tag list'));
|
119 |
+
$positions[] = array('value' => 'extrahint', 'label' => Mage::helper('brainsins_recommender')->__('Product extra hint'));
|
120 |
+
$positions[] = array('value' => 'product.info.addtocart', 'label' => Mage::helper('brainsins_recommender')->__('Product add to cart'));
|
121 |
+
$positions[] = array('value' => 'product.info.addto', 'label' => Mage::helper('brainsins_recommender')->__('Product other "add to" options'));
|
122 |
+
$positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
|
123 |
+
$positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
|
124 |
+
$positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
|
125 |
+
$positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
|
126 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
127 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
128 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
129 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
130 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
131 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
132 |
+
break;
|
133 |
+
case '3':
|
134 |
+
$positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
135 |
+
$positions[] = array('value' => 'crosssell', 'label' => Mage::helper('brainsins_recommender')->__('Cross sell area'));
|
136 |
+
$positions[] = array('value' => 'totals', 'label' => Mage::helper('brainsins_recommender')->__('Totals area'));
|
137 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
138 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
139 |
+
$positions[] = array('value' => 'coupon', 'label' => Mage::helper('brainsins_recommender')->__('Discount code area'));
|
140 |
+
$positions[] = array('value' => 'shipping', 'label' => Mage::helper('brainsins_recommender')->__('Shipping estimation area'));
|
141 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
142 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
143 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
144 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
145 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
146 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
147 |
+
break;
|
148 |
+
/*
|
149 |
+
case '4':
|
150 |
+
$positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
151 |
+
$positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
|
152 |
+
$positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
|
153 |
+
$positions[] = array('value' => 'checkout.progress', 'label' => Mage::helper('brainsins_recommender')->__('Checkout progress'));
|
154 |
+
$positions[] = array('value' => 'login', 'label' => Mage::helper('brainsins_recommender')->__('Login'));
|
155 |
+
$positions[] = array('value' => 'billing', 'label' => Mage::helper('brainsins_recommender')->__('Billing information'));
|
156 |
+
$positions[] = array('value' => 'shipping', 'label' => Mage::helper('brainsins_recommender')->__('Shipping information'));
|
157 |
+
$positions[] = array('value' => 'shipping_method', 'label' => Mage::helper('brainsins_recommender')->__('Shipping method'));
|
158 |
+
$positions[] = array('value' => 'payment', 'label' => Mage::helper('brainsins_recommender')->__('Payment information'));
|
159 |
+
$positions[] = array('value' => 'review', 'label' => Mage::helper('brainsins_recommender')->__('Order review'));
|
160 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
161 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
162 |
+
$positions[] = array('value' => 'billing.progress', 'label' => Mage::helper('brainsins_recommender')->__('Billing progress'));
|
163 |
+
$positions[] = array('value' => 'shipping.progress', 'label' => Mage::helper('brainsins_recommender')->__('Shipping progress'));
|
164 |
+
$positions[] = array('value' => 'shipping_method.progress', 'label' => Mage::helper('brainsins_recommender')->__('Shipping method progress'));
|
165 |
+
$positions[] = array('value' => 'payment.progress', 'label' => Mage::helper('brainsins_recommender')->__('Payment progress'));
|
166 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
167 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
168 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
169 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
170 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
171 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
172 |
+
break;
|
173 |
+
*/
|
174 |
+
case '4':
|
175 |
+
$positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
176 |
+
$positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
|
177 |
+
$positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
|
178 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
179 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
180 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
181 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
182 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
183 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
184 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
185 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
186 |
+
break;
|
187 |
+
case '7':
|
188 |
+
$positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
|
189 |
+
$positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
|
190 |
+
$positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
|
191 |
+
$positions[] = array('value' => 'product_list', 'label' => Mage::helper('brainsins_recommender')->__('Product list'));
|
192 |
+
$positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
|
193 |
+
$positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
|
194 |
+
$positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
|
195 |
+
$positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
|
196 |
+
$positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
|
197 |
+
$positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
|
198 |
+
$positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
|
199 |
+
$positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
|
200 |
+
$positions[] = array('value' => 'toolbar', 'label' => Mage::helper('brainsins_recommender')->__('Toolbar'));
|
201 |
+
break;
|
202 |
+
default:
|
203 |
+
$positions[] = array('value' => 'top', 'label' => Mage::helper('brainsins_recommender')->__('No available positions in this page'));
|
204 |
+
break;
|
205 |
+
}
|
206 |
+
return $positions;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function getConfiguration($page, $store = null)
|
210 |
+
{
|
211 |
+
if($store == null)
|
212 |
+
$store = Mage::app()->getStore()->getStoreId();
|
213 |
+
$jSonRecommendersConfig = '';
|
214 |
+
$config = array();
|
215 |
+
if($page == 'all')
|
216 |
+
{
|
217 |
+
$pages = explode(',', self::$_pages);
|
218 |
+
foreach ($pages as $key => $_page)
|
219 |
+
{
|
220 |
+
$jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$_page.'/recommenders_'.$_page, $store);
|
221 |
+
$arrayDatas = unserialize($jSonRecommendersConfig);
|
222 |
+
foreach ($arrayDatas as $key => $arrayData) {
|
223 |
+
foreach ($arrayData as $key => $data) {
|
224 |
+
$config[$key][] = $data;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
else
|
230 |
+
{
|
231 |
+
$jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$page.'/recommenders_'.$page, $store);
|
232 |
+
$arrayDatas = unserialize($jSonRecommendersConfig);
|
233 |
+
$config = array();
|
234 |
+
foreach ($arrayDatas as $key => $arrayData) {
|
235 |
+
foreach ($arrayData as $key => $data) {
|
236 |
+
$config[$key][] = $data;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
return $this->_cleanEmpties($config);
|
242 |
+
}
|
243 |
+
|
244 |
+
public function getRecommendersJs($recommenders)
|
245 |
+
{
|
246 |
+
$recommenders_js = '';
|
247 |
+
if($recommenders && count($recommenders) > 0)
|
248 |
+
{
|
249 |
+
$recommenders_js .= ',
|
250 |
+
recommenders: [';
|
251 |
+
foreach ($recommenders as $key => $_value)
|
252 |
+
{
|
253 |
+
if($_value[0] == '' || $_value[0] == '-')
|
254 |
+
continue;
|
255 |
+
if($_value[4] != '')
|
256 |
+
{
|
257 |
+
$_location = $_value[4];
|
258 |
+
$_position = $_value[3];
|
259 |
+
}
|
260 |
+
else {
|
261 |
+
$_location = 'brainSINS_recommender_'.$_value[0];
|
262 |
+
$_position = 'replace';
|
263 |
+
}
|
264 |
+
$recommenders_js .= "
|
265 |
+
{
|
266 |
+
recommenderId: ".$_value[0].",
|
267 |
+
location: '".$_location."',
|
268 |
+
position: '".$_position."'
|
269 |
+
},
|
270 |
+
";
|
271 |
+
}
|
272 |
+
$recommenders_js .= ']';
|
273 |
+
}
|
274 |
+
return $recommenders_js;
|
275 |
+
}
|
276 |
+
|
277 |
+
protected function _cleanEmpties($data)
|
278 |
+
{
|
279 |
+
$cleanedData = array();
|
280 |
+
foreach ($data as $key => $value) {
|
281 |
+
if($value[0] == '')
|
282 |
+
continue;
|
283 |
+
else
|
284 |
+
$cleanedData[] = $value;
|
285 |
+
}
|
286 |
+
|
287 |
+
return array_map('unserialize', array_unique(array_map('serialize', $cleanedData)));
|
288 |
+
}
|
289 |
+
|
290 |
+
public function getProductsFeed($key = '')
|
291 |
+
{
|
292 |
+
if($key == '')
|
293 |
+
$key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key');
|
294 |
+
$include_oos_products = Mage::getStoreConfig('brainsins_recommender_options/product_feed/include_oos_products', Mage::app()->getStore()->getStoreId());
|
295 |
+
$tax_included = Mage::getStoreConfig('brainsins_recommender_options/product_feed/tax_included', Mage::app()->getStore()->getStoreId());
|
296 |
+
$special_price = Mage::getStoreConfig('brainsins_recommender_options/product_feed/special_price', Mage::app()->getStore()->getStoreId());
|
297 |
+
$desc_attribute = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_description_attribute', Mage::app()->getStore()->getStoreId());
|
298 |
+
|
299 |
+
$pDomBrain = new DOMDocument('1.0','UTF-8');
|
300 |
+
$pDomBrain->formatOutput = true;
|
301 |
+
$pDomBrain->xmlStandalone = true;
|
302 |
+
|
303 |
+
$pRecsins = $pDomBrain->createElement('recsins');
|
304 |
+
$pRecsins->setAttribute('version', '0.1');
|
305 |
+
$pDomBrain->appendChild($pRecsins);
|
306 |
+
|
307 |
+
$pEntities = $pDomBrain->createElement('entities');
|
308 |
+
$pRecsins->appendChild($pEntities);
|
309 |
+
|
310 |
+
$rows = 0;
|
311 |
+
|
312 |
+
$languages = $this->_getStores($key);
|
313 |
+
$currencies = $this->_getCurrencies($key);
|
314 |
+
// $products = Mage::getResourceModel('catalog/product_collection')
|
315 |
+
// ->getCollection()
|
316 |
+
// ->addAttributeToSelect('entity_id')
|
317 |
+
// ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
318 |
+
// ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
319 |
+
// ->addAttributeToSort('entity_id','asc'); //Tablas EAV
|
320 |
+
$products = Mage::getModel('catalog/product')
|
321 |
+
->getCollection()
|
322 |
+
->addAttributeToSelect('entity_id')
|
323 |
+
->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
324 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
325 |
+
->addAttributeToSort('entity_id','asc'); //Tablas flat
|
326 |
+
|
327 |
+
if(!$desc_attribute || $desc_attribute == '')
|
328 |
+
$desc_attribute = 'description';
|
329 |
+
|
330 |
+
foreach ($products as $key => $entity)
|
331 |
+
{
|
332 |
+
$product = Mage::getModel('catalog/product')->load($entity->getId());
|
333 |
+
if(Mage::app()->getRequest()->getControllerName() != 'feeds')
|
334 |
+
{
|
335 |
+
$offline_stock_status = Mage::getModel('cataloginventory/stock_item') ->loadByProduct($product)->getIsInStock();
|
336 |
+
if($include_oos_products == '0' && $offline_stock_status == '0')
|
337 |
+
continue;
|
338 |
+
}
|
339 |
+
else
|
340 |
+
{
|
341 |
+
if($include_oos_products == '0' && !$product->isSaleable())
|
342 |
+
continue;
|
343 |
+
}
|
344 |
+
$pEntity = $pDomBrain->createElement('entity');
|
345 |
+
$pEntity->setAttribute('name', 'product');
|
346 |
+
$pEntities->appendChild($pEntity);
|
347 |
+
|
348 |
+
$pIDProd = $pDomBrain->createElement('property');
|
349 |
+
$pIDProd->setAttribute('name', 'idProduct');
|
350 |
+
$cdata = $pDomBrain->createTextNode($product->getId());
|
351 |
+
$pIDProd->appendChild($cdata);
|
352 |
+
$pEntity->appendChild($pIDProd);
|
353 |
+
|
354 |
+
$pMPName = $pDomBrain->createElement('multi_property');
|
355 |
+
$pMPName->setAttribute('name', 'name');
|
356 |
+
|
357 |
+
$pMPDesc = $pDomBrain->createElement('multi_property');
|
358 |
+
$pMPDesc->setAttribute('name', 'description');
|
359 |
+
|
360 |
+
$pMPUrl = $pDomBrain->createElement('multi_property');
|
361 |
+
$pMPUrl->setAttribute('name', 'url');
|
362 |
+
|
363 |
+
foreach ($languages as $store_id => $lang_code) {
|
364 |
+
$product_lang = Mage::getModel('catalog/product')
|
365 |
+
->setStoreId($store_id)
|
366 |
+
->load($product->getId());
|
367 |
+
//$lang_code = explode('_', $lang_code);
|
368 |
+
$pLangName = $pDomBrain->createElement('property');
|
369 |
+
$pLangName->setAttribute('lang', $lang_code);
|
370 |
+
$cdata = $pDomBrain->createCDATASection($product_lang->getName());
|
371 |
+
$pLangName->appendChild($cdata);
|
372 |
+
$pMPName->appendChild($pLangName);
|
373 |
+
|
374 |
+
$pLangDesc = $pDomBrain->createElement('property');
|
375 |
+
$pLangDesc->setAttribute('lang', $lang_code);
|
376 |
+
$cdata = $pDomBrain->createCDATASection(Mage::getResourceModel('catalog/product')
|
377 |
+
->getAttributeRawValue($product_lang->getId(), $desc_attribute, $store_id));
|
378 |
+
$pLangDesc->appendChild($cdata);
|
379 |
+
$pMPDesc->appendChild($pLangDesc);
|
380 |
+
|
381 |
+
$pLangLink = $pDomBrain->createElement('property');
|
382 |
+
$pLangLink->setAttribute('lang', $lang_code);
|
383 |
+
$product_link = preg_replace("/[\?&]?___store=[^\?&]*/", "", $product_lang->getProductUrl());
|
384 |
+
$cdata = $pDomBrain->createCDATASection($product_link);
|
385 |
+
$pLangLink->appendChild($cdata);
|
386 |
+
$pMPUrl->appendChild($pLangLink);
|
387 |
+
}
|
388 |
+
$pEntity->appendChild($pMPName);
|
389 |
+
$pEntity->appendChild($pMPDesc);
|
390 |
+
$pEntity->appendChild($pMPUrl);
|
391 |
+
|
392 |
+
$pPrice = $pDomBrain->createElement('property');
|
393 |
+
$pPrice->setAttribute('name', 'price');
|
394 |
+
|
395 |
+
if($tax_included == '1' && $special_price == '1')
|
396 |
+
$product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, false);
|
397 |
+
elseif($tax_included == '1' && $special_price == '0')
|
398 |
+
$product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, false);
|
399 |
+
if($tax_included == '0' && $special_price == '1')
|
400 |
+
$product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, true);
|
401 |
+
elseif($tax_included == '0' && $special_price == '0')
|
402 |
+
$product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, true);
|
403 |
+
|
404 |
+
if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
|
405 |
+
{
|
406 |
+
if($tax_included == '1' && $special_price == '1')
|
407 |
+
$product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
|
408 |
+
elseif($tax_included == '1' && $special_price == '0')
|
409 |
+
$product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
|
410 |
+
if($tax_included == '0' && $special_price == '1')
|
411 |
+
$product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
|
412 |
+
elseif($tax_included == '0' && $special_price == '0')
|
413 |
+
$product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
|
414 |
+
}
|
415 |
+
|
416 |
+
$cdata = $pDomBrain->createTextNode(number_format($product_price, 2, '.', ''));
|
417 |
+
$pPrice->appendChild($cdata);
|
418 |
+
$pEntity->appendChild($pPrice);
|
419 |
+
|
420 |
+
if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
|
421 |
+
{
|
422 |
+
$product_final_price = $this->_getBundlePrice($product, 'min', 1);
|
423 |
+
$product_regular_price = $this->_getBundlePrice($product, 'min', 1);
|
424 |
+
}
|
425 |
+
else
|
426 |
+
{
|
427 |
+
$product_final_price = $product->getFinalPrice();
|
428 |
+
$product_regular_price = $product->getPrice();
|
429 |
+
}
|
430 |
+
|
431 |
+
try
|
432 |
+
{
|
433 |
+
$pMPCur = $pDomBrain->createElement('multi_property');
|
434 |
+
$pMPCur->setAttribute('name', 'multiprice');
|
435 |
+
|
436 |
+
foreach ($currencies as $k => $curr){
|
437 |
+
$baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
|
438 |
+
$targetCurrency = Mage::getModel('directory/currency')->load($curr);
|
439 |
+
$pPrice = $pDomBrain->createElement('property');
|
440 |
+
$pPrice->setAttribute('currency', $curr);
|
441 |
+
$price_converted = number_format(Mage::helper('directory')->currencyConvert($product_final_price, $baseCurrency, $targetCurrency), 2, '.', '');
|
442 |
+
$cdata = $pDomBrain->createTextNode($price_converted);
|
443 |
+
$pPrice->appendChild($cdata);
|
444 |
+
$pMPCur->appendChild($pPrice);
|
445 |
+
}
|
446 |
+
$pEntity->appendChild($pMPCur);
|
447 |
+
unset($targetCurrency);
|
448 |
+
|
449 |
+
$pOPCur = $pDomBrain->createElement('multi_property');
|
450 |
+
$pOPCur->setAttribute('name', 'originalPrice');
|
451 |
+
|
452 |
+
foreach ($currencies as $k => $curr){
|
453 |
+
$baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
|
454 |
+
$targetCurrency = Mage::getModel('directory/currency')->load($curr);
|
455 |
+
$pPrice = $pDomBrain->createElement('property');
|
456 |
+
$pPrice->setAttribute('currency', $curr);
|
457 |
+
$price_converted = number_format(Mage::helper('directory')->currencyConvert($product_regular_price, $baseCurrency, $targetCurrency), 2, '.', '');
|
458 |
+
$cdata = $pDomBrain->createTextNode($price_converted);
|
459 |
+
$pPrice->appendChild($cdata);
|
460 |
+
$pOPCur->appendChild($pPrice);
|
461 |
+
}
|
462 |
+
$pEntity->appendChild($pOPCur);
|
463 |
+
unset($targetCurrency);
|
464 |
+
}
|
465 |
+
catch(Exception $e)
|
466 |
+
{
|
467 |
+
Mage::throwException(Mage::helper('brainsins_recommender')->__('ERROR IN CURRENCY CONVERT. ALL CURRENCY RATES ARE DEFINED?'));
|
468 |
+
}
|
469 |
+
|
470 |
+
$imageUrl;
|
471 |
+
|
472 |
+
$image_width = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_width', Mage::app()->getStore()->getStoreId());
|
473 |
+
$image_height = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_height', Mage::app()->getStore()->getStoreId());
|
474 |
+
|
475 |
+
if (!$image_width || $image_width == "" || $image_width == "0" || !is_numeric($image_width)) {
|
476 |
+
$image_width = null;
|
477 |
+
}
|
478 |
+
|
479 |
+
if (!$image_height || $image_height == "" || $image_height == "0" || !is_numeric($image_height)) {
|
480 |
+
$image_height = null;
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
+
if (!$image_width && !$image_height) {
|
485 |
+
$imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
|
486 |
+
} else {
|
487 |
+
$imageUrl = (string) Mage::helper('catalog/image')->init($product, "image")->resize($image_width, $image_height);
|
488 |
+
}
|
489 |
+
|
490 |
+
// $url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $height);
|
491 |
+
|
492 |
+
|
493 |
+
|
494 |
+
//$imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
|
495 |
+
$pImage = $pDomBrain->createElement('property');
|
496 |
+
$pImage->setAttribute('name', 'imageUrl');
|
497 |
+
$cdata = $pDomBrain->createCDATASection($imageUrl);
|
498 |
+
$pImage->appendChild($cdata);
|
499 |
+
$pEntity->appendChild($pImage);
|
500 |
+
|
501 |
+
$pCategory = $pDomBrain->createElement('property');
|
502 |
+
$pCategory->setAttribute('name', 'categories');
|
503 |
+
$cdata = $pDomBrain->createTextNode(implode(",", $product->getCategoryIds()));
|
504 |
+
$pCategory->appendChild($cdata);
|
505 |
+
$pEntity->appendChild($pCategory);
|
506 |
+
|
507 |
+
$rows++;
|
508 |
+
$image = null;
|
509 |
+
unset($image);
|
510 |
+
|
511 |
+
$imageObj = null;
|
512 |
+
unset($imageObj);
|
513 |
+
|
514 |
+
unset($product);
|
515 |
+
}
|
516 |
+
$feed = $pDomBrain->saveXML();
|
517 |
+
$products = null;unset($products);unset($pDomBrain);
|
518 |
+
|
519 |
+
return $feed;
|
520 |
+
}
|
521 |
+
|
522 |
+
public function updateCartInBrainsins($cart, $special = false)
|
523 |
+
{
|
524 |
+
if (!is_object($cart))
|
525 |
+
return;
|
526 |
+
|
527 |
+
$ruta = "order/trackOrder.xml?";
|
528 |
+
$url = self::getApiUrl().$ruta."token=".Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
|
529 |
+
|
530 |
+
$cartXML = new DOMDocument('1.0','UTF-8');
|
531 |
+
$cartXML->xmlStandalone = true;
|
532 |
+
|
533 |
+
$pRecsins = $cartXML->createElement('recsins');
|
534 |
+
$pRecsins->setAttribute('version', '0.1');
|
535 |
+
$cartXML->appendChild($pRecsins);
|
536 |
+
|
537 |
+
$pOrders = $cartXML->createElement('orders');
|
538 |
+
|
539 |
+
$pOrder = $cartXML->createElement('order');
|
540 |
+
$pIdBuyer = $cartXML->createElement('idBuyer', $this->_getUser());
|
541 |
+
$pOrder->appendChild($pIdBuyer);
|
542 |
+
|
543 |
+
$pCurrency = $cartXML->createElement('idCurrency', Mage::app()->getStore()->getCurrentCurrencyCode());
|
544 |
+
$pOrder->appendChild($pCurrency);
|
545 |
+
|
546 |
+
$pOrders->appendChild($pOrder);
|
547 |
+
|
548 |
+
$pRecsins->appendChild($pOrders);
|
549 |
+
|
550 |
+
$pProducts = $cartXML->createElement('products');
|
551 |
+
$pOrder->appendChild($pProducts);
|
552 |
+
|
553 |
+
if($special)
|
554 |
+
$items = $cart->getAllItems();
|
555 |
+
else
|
556 |
+
$items = $cart->getItems();
|
557 |
+
|
558 |
+
foreach ($items as $item) {
|
559 |
+
if($item->getType() == 'simple')
|
560 |
+
return;
|
561 |
+
$pProduct = $cartXML->createElement('product');
|
562 |
+
|
563 |
+
$pIdProduct = $cartXML->createElement('idProduct', $item->getProductId());
|
564 |
+
$pProduct->appendChild($pIdProduct);
|
565 |
+
|
566 |
+
$pPrice = $cartXML->createElement('price', number_format($item->getPriceInclTax(), 2, '.', ''));
|
567 |
+
$pProduct->appendChild($pPrice);
|
568 |
+
|
569 |
+
$pQuantity = $cartXML->createElement('quantity', $item->getQty());
|
570 |
+
$pProduct->appendChild($pQuantity);
|
571 |
+
|
572 |
+
$pProducts->appendChild($pProduct);
|
573 |
+
}
|
574 |
+
|
575 |
+
$content = $cartXML->saveXML($cartXML->documentElement);
|
576 |
+
return $this->_sendBrainsinsWS($url, $content);
|
577 |
+
}
|
578 |
+
|
579 |
+
protected function _sendBrainsinsWS($url, $content = null)
|
580 |
+
{
|
581 |
+
if(function_exists('curl_init')) {
|
582 |
+
$ch = curl_init($url);
|
583 |
+
//$logfh = fopen(dirname(__FILE__) . "/sendBrainsinsWS.log", 'a+');
|
584 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
585 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
586 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
587 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
|
588 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
589 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
|
590 |
+
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
591 |
+
//curl_setopt($ch, CURLOPT_STDERR, $logfh);
|
592 |
+
//fwrite($logfh, $content);
|
593 |
+
$response = curl_exec($ch);
|
594 |
+
curl_close($ch);
|
595 |
+
//fclose($logfh);
|
596 |
+
} else {
|
597 |
+
$opts = array('http' =>
|
598 |
+
array(
|
599 |
+
'method' => 'POST',
|
600 |
+
'header' => 'Content-type: text/xml',
|
601 |
+
'content' => $content
|
602 |
+
)
|
603 |
+
);
|
604 |
+
$context = stream_context_create($opts);
|
605 |
+
$response = file_get_contents($url, false, $context);
|
606 |
+
}
|
607 |
+
return $response;
|
608 |
+
}
|
609 |
+
|
610 |
+
protected function _getUser()
|
611 |
+
{
|
612 |
+
if (isset($_COOKIE['ul']) && $_COOKIE['ul'] == 1)
|
613 |
+
return $_COOKIE['uId'];
|
614 |
+
elseif (isset($_COOKIE['ul']) && $_COOKIE['ul'] == 0)
|
615 |
+
return $_COOKIE['coId'];
|
616 |
+
else
|
617 |
+
return;
|
618 |
+
}
|
619 |
+
|
620 |
+
protected function _getStores($key)
|
621 |
+
{
|
622 |
+
$stores = Mage::app()->getStores();
|
623 |
+
$store_ids = array();
|
624 |
+
foreach ($stores as $k => $store)
|
625 |
+
{
|
626 |
+
$_storeId = $store->getStoreId();
|
627 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
|
628 |
+
if($key == $bskey)
|
629 |
+
{
|
630 |
+
//$store_ids[$_storeId] = Mage::getStoreConfig('general/locale/code', $_storeId);
|
631 |
+
$store_ids[$_storeId] = $store->getCode();
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
/*
|
636 |
+
$website = Mage::app()->getWebsite($website_id);
|
637 |
+
foreach ($website->getGroups() as $group)
|
638 |
+
{
|
639 |
+
$stores = $group->getStores();
|
640 |
+
foreach ($stores as $store)
|
641 |
+
{
|
642 |
+
if($store->getIsActive())
|
643 |
+
$store_ids[Mage::getStoreConfig('general/locale/code', $store->getId())] = $store->getId();
|
644 |
+
}
|
645 |
+
}
|
646 |
+
*/
|
647 |
+
return $store_ids;
|
648 |
+
}
|
649 |
+
|
650 |
+
protected function _getCurrencies($key)
|
651 |
+
{
|
652 |
+
$stores = Mage::app()->getStores();
|
653 |
+
$currencies_ids = array();
|
654 |
+
foreach ($stores as $k => $store)
|
655 |
+
{
|
656 |
+
$_storeId = $store->getStoreId();
|
657 |
+
$bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
|
658 |
+
if($key == $bskey)
|
659 |
+
{
|
660 |
+
|
661 |
+
$currencies_ids[$_storeId] = Mage::app()->getStore($_storeId)->getCurrentCurrencyCode();
|
662 |
+
}
|
663 |
+
}
|
664 |
+
return $currencies_ids;
|
665 |
+
}
|
666 |
+
|
667 |
+
protected function _getBundlePrice($_product, $return_type, $tax)
|
668 |
+
{
|
669 |
+
return Mage::getModel('bundle/product_price')->getTotalPrices($_product, $return_type, $tax);
|
670 |
+
}
|
671 |
+
}
|
app/code/community/Brainsins/Recommender/Helper/sendBrainsinsWS.log
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<recsins version="0.1"><orders><order><idBuyer>2000000000009</idBuyer><idCurrency>EUR</idCurrency><products><product><idProduct>134</idProduct><price>17.55</price><quantity>1</quantity></product></products></order></orders></recsins>* About to connect() to api.brainsins.com port 80 (#0)
|
2 |
+
* Trying 46.137.183.197... * connected
|
3 |
+
* Connected to api.brainsins.com (46.137.183.197) port 80 (#0)
|
4 |
+
> POST /RecSinsAPI/api/order/trackOrder.xml?token=BS-0887432703-1 HTTP/1.1
|
5 |
+
Host: api.brainsins.com
|
6 |
+
Accept: */*
|
7 |
+
Content-Type: application/xml
|
8 |
+
Content-Length: 233
|
9 |
+
|
10 |
+
< HTTP/1.1 200 OK
|
11 |
+
< Content-Type: application/xml
|
12 |
+
< Date: Thu, 03 Apr 2014 14:22:36 GMT
|
13 |
+
< Server: GlassFish Server Open Source Edition 3.1.1
|
14 |
+
< X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.1 Java/Sun Microsystems Inc./1.6)
|
15 |
+
< Content-Length: 129
|
16 |
+
< Connection: keep-alive
|
17 |
+
<
|
18 |
+
* Connection #0 to host api.brainsins.com left intact
|
19 |
+
* Closing connection #0
|
app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Backend/Cron.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Model_Adminhtml_System_Config_Backend_Cron extends Mage_Core_Model_Config_Data
|
26 |
+
{
|
27 |
+
const CRON_STRING_PATH = 'crontab/jobs/brainsins_recommender_feeds_cron/schedule/cron_expr';
|
28 |
+
const CRON_MODEL_PATH = 'crontab/jobs/brainsins_recommender_feeds_cron/run/model';
|
29 |
+
|
30 |
+
protected function _afterSave()
|
31 |
+
{
|
32 |
+
$extension_enabled = $this->getData('groups/brainsins_recommender_general/fields/enabled/value');
|
33 |
+
$cron_enabled = $this->getData('groups/brainsins_recommender_feed/fields/cron_enabled/value');
|
34 |
+
|
35 |
+
$time = $this->getData('groups/brainsins_recommender_feed/fields/cron_time/value');
|
36 |
+
$frequency = $this->getData('groups/brainsins_recommender_feed/fields/cron_frequency/value');
|
37 |
+
$frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
|
38 |
+
$frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
|
39 |
+
$frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
|
40 |
+
$cronDayOfWeek = date('N');
|
41 |
+
$cronExprArray = array(
|
42 |
+
intval($time[1]), # Minute
|
43 |
+
intval($time[0]), # Hour
|
44 |
+
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
45 |
+
'*', # Month of the Year
|
46 |
+
($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week
|
47 |
+
);
|
48 |
+
|
49 |
+
$value = $this->getValue();
|
50 |
+
$cronExprString = join(' ', $cronExprArray);
|
51 |
+
|
52 |
+
try
|
53 |
+
{
|
54 |
+
Mage::getModel('core/config_data')
|
55 |
+
->load(self::CRON_STRING_PATH, 'path')
|
56 |
+
->setValue($cronExprString)
|
57 |
+
->setPath(self::CRON_STRING_PATH)
|
58 |
+
->save();
|
59 |
+
Mage::getModel('core/config_data')
|
60 |
+
->load(self::CRON_MODEL_PATH, 'path')
|
61 |
+
->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
|
62 |
+
->setPath(self::CRON_MODEL_PATH)
|
63 |
+
->save();
|
64 |
+
|
65 |
+
if($cron_enabled = '0' || $extension_enabled == '0')
|
66 |
+
{
|
67 |
+
Mage::getModel('core/config_data')
|
68 |
+
->load(self::CRON_STRING_PATH, 'path')
|
69 |
+
->setValue('')
|
70 |
+
->setPath(self::CRON_STRING_PATH)
|
71 |
+
->save();
|
72 |
+
Mage::getModel('core/config_data')
|
73 |
+
->load(self::CRON_MODEL_PATH, 'path')
|
74 |
+
->setValue('')
|
75 |
+
->setPath(self::CRON_MODEL_PATH)
|
76 |
+
->save();
|
77 |
+
}
|
78 |
+
}
|
79 |
+
catch (Exception $e)
|
80 |
+
{
|
81 |
+
throw new Exception(Mage::helper('cron')->__('Unable to save Cron expression'));
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
app/code/community/Brainsins/{Recsins/Block/Product.php → Recommender/Model/Adminhtml/System/Config/Backend/Serialized.php}
RENAMED
@@ -1,37 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Model_Adminhtml_System_Config_Backend_Serialized extends Mage_Core_Model_Config_Data
|
26 |
+
{
|
27 |
+
protected function _afterLoad()
|
28 |
+
{
|
29 |
+
if (!is_array($this->getValue()))
|
30 |
+
{
|
31 |
+
$value = $this->getValue();
|
32 |
+
$this->setValue(empty($value) ? false : unserialize($value));
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _beforeSave()
|
37 |
+
{
|
38 |
+
if (is_array($this->getValue()))
|
39 |
+
{
|
40 |
+
$this->setValue(serialize($this->getValue()));
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Brainsins/{Recsins/Model/Mysql4/Recsins.php → Recommender/Model/Adminhtml/System/Config/Source/ApiMode.php}
RENAMED
@@ -1,9 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c)
|
7 |
*
|
8 |
* This file is part of BrainSINS' Magento Extension.
|
9 |
*
|
@@ -21,14 +20,15 @@
|
|
21 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
*
|
23 |
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
|
25 |
-
*/
|
26 |
|
27 |
-
class
|
28 |
{
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
}
|
1 |
<?php
|
2 |
+
/**
|
|
|
3 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
*
|
7 |
* This file is part of BrainSINS' Magento Extension.
|
8 |
*
|
20 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
*
|
22 |
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
|
|
24 |
|
25 |
+
class Brainsins_Recommender_Model_Adminhtml_System_Config_Source_Apimode
|
26 |
{
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => 0, 'label'=>Mage::helper('brainsins_recommender')->__('A')), // durotar
|
31 |
+
array('value' => 1, 'label'=>Mage::helper('brainsins_recommender')->__('B')), // api
|
32 |
+
);
|
33 |
+
}
|
34 |
}
|
app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Source/Attributes.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Model_Adminhtml_System_Config_Source_Attributes
|
26 |
+
{
|
27 |
+
public function toOptionArray($isMultiSelect = false)
|
28 |
+
{
|
29 |
+
$_attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
|
30 |
+
$options = array();
|
31 |
+
foreach($_attributes as $_code => $_attribute)
|
32 |
+
{
|
33 |
+
if($_attribute->getFrontendLabel() == '')
|
34 |
+
$_label = $_attribute->getAttributecode();
|
35 |
+
else
|
36 |
+
$_label = $_attribute->getFrontendLabel();
|
37 |
+
$options[] = array('value' => $_attribute->getAttributecode(), 'label' => $_label);
|
38 |
+
}
|
39 |
+
array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
|
40 |
+
return $options;
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Brainsins/{Recsins/Helper/Data.php → Recommender/Model/Adminhtml/System/Config/Source/Emailtracking.php}
RENAMED
@@ -1,9 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c)
|
7 |
*
|
8 |
* This file is part of BrainSINS' Magento Extension.
|
9 |
*
|
@@ -21,10 +20,17 @@
|
|
21 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
*
|
23 |
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
|
25 |
-
*/
|
26 |
|
27 |
-
class
|
28 |
{
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
1 |
<?php
|
2 |
+
/**
|
|
|
3 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
*
|
7 |
* This file is part of BrainSINS' Magento Extension.
|
8 |
*
|
20 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
*
|
22 |
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
|
|
24 |
|
25 |
+
class Brainsins_Recommender_Model_Adminhtml_System_Config_Source_Emailtracking
|
26 |
{
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => '', 'label'=>Mage::helper('brainsins_recommender')->__('-- Select --')),
|
31 |
+
array('value' => 0, 'label'=>Mage::helper('brainsins_recommender')->__('None')),
|
32 |
+
array('value' => 1, 'label'=>Mage::helper('brainsins_recommender')->__('Subscribed to Newsletter')),
|
33 |
+
array('value' => 2, 'label'=>Mage::helper('brainsins_recommender')->__('All')),
|
34 |
+
);
|
35 |
+
}
|
36 |
}
|
app/code/community/Brainsins/{Recsins/Block/Adminhtml/Recsins/Edit/Tabs.php → Recommender/Model/Cron.php}
RENAMED
@@ -1,9 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c)
|
7 |
*
|
8 |
* This file is part of BrainSINS' Magento Extension.
|
9 |
*
|
@@ -21,28 +20,35 @@
|
|
21 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
*
|
23 |
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
28 |
-
{
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
}
|
1 |
<?php
|
2 |
+
/**
|
|
|
3 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
*
|
7 |
* This file is part of BrainSINS' Magento Extension.
|
8 |
*
|
20 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
*
|
22 |
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
class Brainsins_Recommender_Model_Cron
|
26 |
+
{
|
27 |
+
public function generateOfflineFeeds($bskey)
|
28 |
+
{
|
29 |
+
try
|
30 |
+
{
|
31 |
+
$this->_productsFeed($bskey);
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
catch(Exception $e)
|
35 |
+
{
|
36 |
+
Mage::throwException(Mage::helper('brainsins_recommender')->__('ERROR GENERATING OFFLINE FEEDS'));
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
}
|
40 |
|
41 |
+
protected function _productsFeed($bskey)
|
42 |
+
{
|
43 |
+
$feed = Mage::helper('brainsins_recommender')->getProductsFeed($bskey);
|
44 |
+
$io = new Varien_Io_File();
|
45 |
+
$path = Mage::getBaseDir('media') . DS . 'brainsins_feeds' . DS;
|
46 |
+
$file = $path . DS . $bskey . '.xml';
|
47 |
+
$io->setAllowCreateFolders(true);
|
48 |
+
$io->open(array('path' => $path));
|
49 |
+
$io->streamOpen($file, 'w+');
|
50 |
+
$io->streamLock(true);
|
51 |
+
$io->streamWrite($feed);
|
52 |
+
$io->streamClose();
|
53 |
+
}
|
54 |
}
|
app/code/community/Brainsins/Recommender/Model/Observer.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
|
26 |
+
{
|
27 |
+
public function updateCartEvent($observer)
|
28 |
+
{
|
29 |
+
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add' ||
|
30 |
+
$observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_delete' ||
|
31 |
+
$observer->getEvent()->getControllerAction()->getFullActionName() == 'sales_order_reorder')
|
32 |
+
{
|
33 |
+
Mage::dispatchEvent('checkout_update_cart_after', array());
|
34 |
+
}
|
35 |
+
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_updatePost') //TO DO: Genera 2 llamadas en la actualización del carrito
|
36 |
+
Mage::dispatchEvent('checkout_update_cart_after', array());
|
37 |
+
|
38 |
+
if(Mage::app()->getRequest()->getRouteName().'/'.Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'brainsins/cart/create') //Desde controller
|
39 |
+
Mage::dispatchEvent('checkout_update_cart_after', array());
|
40 |
+
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
public function insertBlock($observer)
|
44 |
+
{
|
45 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()))
|
46 |
+
return;
|
47 |
+
|
48 |
+
$_recommenders = array();
|
49 |
+
$_alias = $observer->getBlock()->getBlockAlias();
|
50 |
+
|
51 |
+
//HOME PAGE RECOMMENDERS
|
52 |
+
if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'index/index')
|
53 |
+
$_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('home', Mage::app()->getStore()->getStoreId());
|
54 |
+
|
55 |
+
//PRODUCT PAGE RECOMMENDERS
|
56 |
+
if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'product/view')
|
57 |
+
$_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('product', Mage::app()->getStore()->getStoreId());
|
58 |
+
|
59 |
+
//CATEGORY PAGE RECOMMENDERS
|
60 |
+
if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'category/view')
|
61 |
+
$_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('category', Mage::app()->getStore()->getStoreId());
|
62 |
+
|
63 |
+
//CART PAGE RECOMMENDERS
|
64 |
+
if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'cart/index')
|
65 |
+
$_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('cart', Mage::app()->getStore()->getStoreId());
|
66 |
+
|
67 |
+
//THANK YOU PAGE RECOMMENDERS
|
68 |
+
if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'onepage/success')
|
69 |
+
$_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('checkout', Mage::app()->getStore()->getStoreId());
|
70 |
+
|
71 |
+
foreach ($_recommenders as $key => $_value)
|
72 |
+
{
|
73 |
+
if ($_alias == $_value[2] && $_value[2] != '')
|
74 |
+
{
|
75 |
+
$_before = '';
|
76 |
+
$_after = '';
|
77 |
+
$_recommender = $_value[0];
|
78 |
+
$_position = $_value[1];
|
79 |
+
$_block = $_value[2];
|
80 |
+
$_custom_div_position = $_value[3];
|
81 |
+
$_custom_div = $_value[4];
|
82 |
+
$_content = $observer->getTransport()->getHtml();
|
83 |
+
if($_position == 'before')
|
84 |
+
{
|
85 |
+
$_before = $this->_getBrainsinsRecommenderHtml($_recommender);
|
86 |
+
$observer->getTransport()->setHtml($_before.$_content);
|
87 |
+
}
|
88 |
+
elseif($_position == 'after')
|
89 |
+
{
|
90 |
+
$_after = $this->_getBrainsinsRecommenderHtml($_recommender);
|
91 |
+
$observer->getTransport()->setHtml($_content.$_after);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
public function onCartUpdate($observer)
|
98 |
+
{
|
99 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
100 |
+
return;
|
101 |
+
Mage::helper('brainsins_recommender')->updateCartInBrainsins($observer->getCart());
|
102 |
+
}
|
103 |
+
|
104 |
+
public function updateCart($observer)
|
105 |
+
{
|
106 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
107 |
+
return;
|
108 |
+
Mage::helper('brainsins_recommender')->updateCartInBrainsins(Mage::getSingleton('checkout/session')->getQuote(), true);
|
109 |
+
}
|
110 |
+
|
111 |
+
public function customerRegister($observer)
|
112 |
+
{
|
113 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
114 |
+
return;
|
115 |
+
$customer = $observer->getCustomer();
|
116 |
+
if (!$observer->getCustomer()->getOrigData()) {
|
117 |
+
Mage::getSingleton('core/cookie')->set('brainsins_register', $customer->getId(), time()+86400, '/');
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
public function customerLogin($observer)
|
122 |
+
{
|
123 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
124 |
+
return;
|
125 |
+
$customer = $observer->getCustomer();
|
126 |
+
Mage::getSingleton('core/cookie')->set('brainsins_login', $customer->getId(), time()+86400, '/');
|
127 |
+
}
|
128 |
+
|
129 |
+
public function customerLogout($observer)
|
130 |
+
{
|
131 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
132 |
+
return;
|
133 |
+
$customer = $observer->getCustomer();
|
134 |
+
Mage::getSingleton('core/cookie')->set('brainsins_logout', $customer->getId(), time()+86400, '/');
|
135 |
+
}
|
136 |
+
|
137 |
+
public function subscribedToNewsletter($observer)
|
138 |
+
{
|
139 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
|
140 |
+
return;
|
141 |
+
$event = $observer->getEvent();
|
142 |
+
$subscriber = $event->getDataObject();
|
143 |
+
$statusChange = $subscriber->getIsStatusChanged();
|
144 |
+
if ($statusChange)
|
145 |
+
{
|
146 |
+
Mage::getSingleton('core/cookie')->set('brainsins_news', $subscriber->getCustomerId(), time()+86400, '/');
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
protected function _isApiRequest()
|
151 |
+
{
|
152 |
+
return Mage::app()->getRequest()->getModuleName() === 'api';
|
153 |
+
}
|
154 |
+
|
155 |
+
protected function _getBrainsinsRecommenderHtml($_recommender)
|
156 |
+
{
|
157 |
+
return '<div id="brainSINS_recommender_'.$_recommender.'"></div>';
|
158 |
+
}
|
159 |
+
}
|
app/code/community/Brainsins/{Recsins/Model/Mysql4/Recsins/Collection.php → Recommender/controllers/Adminhtml/FeedsController.php}
RENAMED
@@ -1,9 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c)
|
7 |
*
|
8 |
* This file is part of BrainSINS' Magento Extension.
|
9 |
*
|
@@ -21,14 +20,15 @@
|
|
21 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
*
|
23 |
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Mysql4_Recsins_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
{
|
29 |
-
public function
|
30 |
{
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
}
|
34 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
|
|
3 |
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
*
|
7 |
* This file is part of BrainSINS' Magento Extension.
|
8 |
*
|
20 |
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
*
|
22 |
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_Adminhtml_FeedsController extends Mage_Adminhtml_Controller_Action
|
|
|
26 |
{
|
27 |
+
public function runAction()
|
28 |
{
|
29 |
+
if(Mage::getModel('brainsins_recommender/cron')->generateOfflineFeeds($this->getRequest()->getParam('bskey')))
|
30 |
+
return true;
|
31 |
+
else
|
32 |
+
return false;
|
33 |
}
|
34 |
+
}
|
app/code/community/Brainsins/Recommender/controllers/CartController.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_CartController extends Mage_Core_Controller_Front_Action
|
26 |
+
{
|
27 |
+
public function createAction()
|
28 |
+
{
|
29 |
+
if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()))
|
30 |
+
{
|
31 |
+
$this->_redirectUrl(Mage::getBaseUrl());
|
32 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
if($this->getRequest()->getParam('p') && $this->getRequest()->getParam('q'))
|
37 |
+
{
|
38 |
+
$cart = Mage::getSingleton('checkout/cart');
|
39 |
+
$products = explode(',', $this->getRequest()->getParam('p'));
|
40 |
+
$qties = explode(',', $this->getRequest()->getParam('q'));
|
41 |
+
|
42 |
+
foreach ($products as $key => $product)
|
43 |
+
{
|
44 |
+
try
|
45 |
+
{
|
46 |
+
if(isset($qties[$key]) && intval($qties[$key]))
|
47 |
+
$qty = (int)$qties[$key];
|
48 |
+
else
|
49 |
+
$qty = 1;
|
50 |
+
|
51 |
+
$productObj = new Mage_Catalog_Model_Product();
|
52 |
+
$productObj->load($product);
|
53 |
+
|
54 |
+
if(!$productObj->getId())
|
55 |
+
continue;
|
56 |
+
|
57 |
+
if($productObj->getTypeId() == 'configurable' || $productObj->getTypeId() == 'grouped' || $productObj->getTypeId() == 'bundle')
|
58 |
+
{
|
59 |
+
$default = $this->_getDefaultProduct($productObj, $productObj->getTypeId());
|
60 |
+
if($default)
|
61 |
+
{
|
62 |
+
unset($productObj);
|
63 |
+
$productObj = new Mage_Catalog_Model_Product();
|
64 |
+
$productObj->load($default);
|
65 |
+
$product = $productObj->getId();
|
66 |
+
}
|
67 |
+
else
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
|
71 |
+
$existing_products = $cart->getItems();
|
72 |
+
if($this->_checkIfProductExistsInCart($product, $existing_products))
|
73 |
+
continue;
|
74 |
+
|
75 |
+
$params = array(
|
76 |
+
'product' => $product,
|
77 |
+
'qty' => $qty,
|
78 |
+
);
|
79 |
+
|
80 |
+
$cart->addProduct($productObj, $params);
|
81 |
+
unset($productObj);
|
82 |
+
}
|
83 |
+
catch(Exception $e)
|
84 |
+
{
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
$cart->save();
|
89 |
+
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
|
90 |
+
|
91 |
+
$this->_redirect('checkout/cart/');
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function _checkIfProductExistsInCart($id_product, $products)
|
96 |
+
{
|
97 |
+
foreach ($products as $product)
|
98 |
+
{
|
99 |
+
if($product->getProductId() == $id_product)
|
100 |
+
return true;
|
101 |
+
}
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
protected function _checkIfProductExists($id_product)
|
106 |
+
{
|
107 |
+
$product = new Mage_Catalog_Model_Product();
|
108 |
+
$product->load($id_product);
|
109 |
+
if($product->getId())
|
110 |
+
return true;
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
protected function _getDefaultProduct($product, $type)
|
115 |
+
{
|
116 |
+
if($type == 'configurable')
|
117 |
+
{
|
118 |
+
$childs = $product->getTypeInstance()->getUsedProducts();
|
119 |
+
foreach ($childs as $key => $child)
|
120 |
+
{
|
121 |
+
if($child->isSaleable())
|
122 |
+
return $child->getId();
|
123 |
+
}
|
124 |
+
}
|
125 |
+
if($type == 'grouped')
|
126 |
+
{
|
127 |
+
if($product->isGrouped())
|
128 |
+
{
|
129 |
+
$groupedProducts = Mage::getModel('catalog/product_type_grouped')->setProduct($product)->getAssociatedProducts();
|
130 |
+
foreach($groupedProducts as $p)
|
131 |
+
{
|
132 |
+
if($p->isSaleable())
|
133 |
+
return $p->getId();
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
if($type == 'bundle')
|
138 |
+
{
|
139 |
+
//TODO Qué opciones e ítems coger?
|
140 |
+
return false;
|
141 |
+
/*
|
142 |
+
$optionCollection = $product->getTypeInstance(true)->getOptionsCollection($product);
|
143 |
+
foreach ($optionCollection as $prdOptions)
|
144 |
+
{
|
145 |
+
|
146 |
+
}
|
147 |
+
*/
|
148 |
+
}
|
149 |
+
return false;
|
150 |
+
}
|
151 |
+
}
|
app/code/community/Brainsins/{Recsins/Model/Status.php → Recommender/controllers/FeedsController.php}
RENAMED
@@ -1,39 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
{
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Brainsins_Recommender_FeedsController extends Mage_Core_Controller_Front_Action
|
26 |
+
{
|
27 |
+
public function productsAction()
|
28 |
+
{
|
29 |
+
$key_param = $this->getRequest()->getParam('key');
|
30 |
+
if(!$key_param || !isset($key_param))
|
31 |
+
{
|
32 |
+
echo '[INVALID PARAMETERS]';die;
|
33 |
+
}
|
34 |
+
$feed = Mage::helper('brainsins_recommender')->getProductsFeed($key_param);
|
35 |
+
$this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/xml')->setBody($feed);
|
36 |
+
}
|
37 |
+
}
|
|
|
|
app/code/community/Brainsins/Recommender/etc/config.xml
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
4 |
+
* personalized product recommendations into a Magento Store.
|
5 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
6 |
+
*
|
7 |
+
* This file is part of BrainSINS' Magento Extension.
|
8 |
+
*
|
9 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
10 |
+
* and/or modify it under the terms of the GNU General Public License
|
11 |
+
* as published by the Free Software Foundation, either version 3 of the
|
12 |
+
* License, or (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Foobar is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
21 |
+
*
|
22 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
23 |
+
-->
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Brainsins_Recommender>
|
27 |
+
<version>2.0.0</version>
|
28 |
+
</Brainsins_Recommender>
|
29 |
+
</modules>
|
30 |
+
<global>
|
31 |
+
<models>
|
32 |
+
<brainsins_recommender>
|
33 |
+
<class>Brainsins_Recommender_Model</class>
|
34 |
+
</brainsins_recommender>
|
35 |
+
</models>
|
36 |
+
<helpers>
|
37 |
+
<brainsins_recommender>
|
38 |
+
<class>Brainsins_Recommender_Helper</class>
|
39 |
+
</brainsins_recommender>
|
40 |
+
</helpers>
|
41 |
+
<blocks>
|
42 |
+
<brainsins_recommender>
|
43 |
+
<class>Brainsins_Recommender_Block</class>
|
44 |
+
</brainsins_recommender>
|
45 |
+
</blocks>
|
46 |
+
<resources>
|
47 |
+
<brainsins_recommender_setup>
|
48 |
+
<setup>
|
49 |
+
<module>Brainsins_Recommender</module>
|
50 |
+
</setup>
|
51 |
+
<connection>
|
52 |
+
<use>core_setup</use>
|
53 |
+
</connection>
|
54 |
+
</brainsins_recommender_setup>
|
55 |
+
<brainsins_recommender_read>
|
56 |
+
<connection>
|
57 |
+
<use>core_read</use>
|
58 |
+
</connection>
|
59 |
+
</brainsins_recommender_read>
|
60 |
+
</resources>
|
61 |
+
</global>
|
62 |
+
<frontend>
|
63 |
+
<routers>
|
64 |
+
<brainsins_recommender>
|
65 |
+
<use>standard</use>
|
66 |
+
<args>
|
67 |
+
<module>Brainsins_Recommender</module>
|
68 |
+
<frontName>brainsins</frontName>
|
69 |
+
</args>
|
70 |
+
</brainsins_recommender>
|
71 |
+
</routers>
|
72 |
+
<layout>
|
73 |
+
<updates>
|
74 |
+
<brainsins_recommender>
|
75 |
+
<file>brainsins_recommender.xml</file>
|
76 |
+
</brainsins_recommender>
|
77 |
+
</updates>
|
78 |
+
</layout>
|
79 |
+
<events>
|
80 |
+
<core_block_abstract_to_html_after>
|
81 |
+
<observers>
|
82 |
+
<brainsins_recommender>
|
83 |
+
<type>model</type>
|
84 |
+
<class>brainsins_recommender/observer</class>
|
85 |
+
<method>insertBlock</method>
|
86 |
+
</brainsins_recommender>
|
87 |
+
</observers>
|
88 |
+
</core_block_abstract_to_html_after>
|
89 |
+
<customer_save_after>
|
90 |
+
<observers>
|
91 |
+
<brainsins_recommender>
|
92 |
+
<type>model</type>
|
93 |
+
<class>brainsins_recommender/observer</class>
|
94 |
+
<method>customerRegister</method>
|
95 |
+
</brainsins_recommender>
|
96 |
+
</observers>
|
97 |
+
</customer_save_after>
|
98 |
+
<customer_login>
|
99 |
+
<observers>
|
100 |
+
<brainsins_recommender>
|
101 |
+
<type>model</type>
|
102 |
+
<class>brainsins_recommender/observer</class>
|
103 |
+
<method>customerLogin</method>
|
104 |
+
</brainsins_recommender>
|
105 |
+
</observers>
|
106 |
+
</customer_login>
|
107 |
+
<customer_logout>
|
108 |
+
<observers>
|
109 |
+
<brainsins_recommender>
|
110 |
+
<type>model</type>
|
111 |
+
<class>brainsins_recommender/observer</class>
|
112 |
+
<method>customerLogout</method>
|
113 |
+
</brainsins_recommender>
|
114 |
+
</observers>
|
115 |
+
</customer_logout>
|
116 |
+
<newsletter_subscriber_save_commit_after>
|
117 |
+
<observers>
|
118 |
+
<brainsins_recommender>
|
119 |
+
<class>brainsins_recommender/observer</class>
|
120 |
+
<method>subscribedToNewsletter</method>
|
121 |
+
</brainsins_recommender>
|
122 |
+
</observers>
|
123 |
+
</newsletter_subscriber_save_commit_after>
|
124 |
+
<checkout_cart_update_items_after>
|
125 |
+
<observers>
|
126 |
+
<brainsins_recommender>
|
127 |
+
<class>brainsins_recommender/observer</class>
|
128 |
+
<method>onCartUpdate</method>
|
129 |
+
</brainsins_recommender>
|
130 |
+
</observers>
|
131 |
+
</checkout_cart_update_items_after>
|
132 |
+
<controller_action_postdispatch>
|
133 |
+
<observers>
|
134 |
+
<brainsins_recommender>
|
135 |
+
<type>singleton</type>
|
136 |
+
<class>brainsins_recommender/observer</class>
|
137 |
+
<method>updateCartEvent</method>
|
138 |
+
</brainsins_recommender>
|
139 |
+
</observers>
|
140 |
+
</controller_action_postdispatch>
|
141 |
+
<checkout_update_cart_after>
|
142 |
+
<observers>
|
143 |
+
<brainsins_recommender>
|
144 |
+
<type>singleton</type>
|
145 |
+
<class>brainsins_recommender/observer</class>
|
146 |
+
<method>updateCart</method>
|
147 |
+
</brainsins_recommender>
|
148 |
+
</observers>
|
149 |
+
</checkout_update_cart_after>
|
150 |
+
<!--
|
151 |
+
<checkout_cart_save_after>
|
152 |
+
<observers>
|
153 |
+
<brainsins_recommender>
|
154 |
+
<type>singleton</type>
|
155 |
+
<class>brainsins_recommender/observer</class>
|
156 |
+
<method>updateCart</method>
|
157 |
+
</brainsins_recommender>
|
158 |
+
</observers>
|
159 |
+
</checkout_cart_save_after>
|
160 |
+
-->
|
161 |
+
</events>
|
162 |
+
</frontend>
|
163 |
+
<admin>
|
164 |
+
<routers>
|
165 |
+
<brainsins_recommender>
|
166 |
+
<use>admin</use>
|
167 |
+
<args>
|
168 |
+
<module>Brainsins_Recommender</module>
|
169 |
+
<frontName>brainsins_admin</frontName>
|
170 |
+
</args>
|
171 |
+
</brainsins_recommender>
|
172 |
+
</routers>
|
173 |
+
<layout>
|
174 |
+
<updates>
|
175 |
+
<brainsins_recommender>
|
176 |
+
<file>brainsins_recommender.xml</file>
|
177 |
+
</brainsins_recommender>
|
178 |
+
</updates>
|
179 |
+
</layout>
|
180 |
+
</admin>
|
181 |
+
<adminhtml>
|
182 |
+
<translate>
|
183 |
+
<modules>
|
184 |
+
<brainsins_recommender>
|
185 |
+
<files>
|
186 |
+
<default>Brainsins_Recommender.csv</default>
|
187 |
+
</files>
|
188 |
+
</brainsins_recommender>
|
189 |
+
</modules>
|
190 |
+
</translate>
|
191 |
+
<acl>
|
192 |
+
<resources>
|
193 |
+
<all>
|
194 |
+
<title>Allow Everything</title>
|
195 |
+
</all>
|
196 |
+
<admin>
|
197 |
+
<children>
|
198 |
+
<system>
|
199 |
+
<children>
|
200 |
+
<config>
|
201 |
+
<children>
|
202 |
+
<brainsins_recommender_options>
|
203 |
+
<title>Brainsins Recommender Options</title>
|
204 |
+
<sort_order>100</sort_order>
|
205 |
+
</brainsins_recommender_options>
|
206 |
+
<brainsins_recommender_dashboard>
|
207 |
+
<title>Brainsins Recommender Dashboard</title>
|
208 |
+
<sort_order>101</sort_order>
|
209 |
+
</brainsins_recommender_dashboard>
|
210 |
+
</children>
|
211 |
+
</config>
|
212 |
+
</children>
|
213 |
+
</system>
|
214 |
+
</children>
|
215 |
+
</admin>
|
216 |
+
</resources>
|
217 |
+
</acl>
|
218 |
+
<layout>
|
219 |
+
<updates>
|
220 |
+
<brainsins_recommender>
|
221 |
+
<file>brainsins_recommender.xml</file>
|
222 |
+
</brainsins_recommender>
|
223 |
+
</updates>
|
224 |
+
</layout>
|
225 |
+
</adminhtml>
|
226 |
+
<default>
|
227 |
+
<brainsins_recommender_options>
|
228 |
+
<brainsins_recommender_general>
|
229 |
+
<enabled>0</enabled>
|
230 |
+
<email_tracking>1</email_tracking>
|
231 |
+
</brainsins_recommender_general>
|
232 |
+
<brainsins_recommender_feed>
|
233 |
+
<cron_enabled>1</cron_enabled>
|
234 |
+
<cron_time>02,00,00</cron_time>
|
235 |
+
</brainsins_recommender_feed>
|
236 |
+
</brainsins_recommender_options>
|
237 |
+
</default>
|
238 |
+
<crontab>
|
239 |
+
<jobs>
|
240 |
+
<brainsins_recommender_feeds_cron>
|
241 |
+
<run>
|
242 |
+
<model>brainsins_recommender/cron::generateOfflineFeeds</model>
|
243 |
+
</run>
|
244 |
+
</brainsins_recommender_feeds_cron>
|
245 |
+
</jobs>
|
246 |
+
</crontab>
|
247 |
+
</config>
|
app/code/community/Brainsins/Recommender/etc/system.xml
ADDED
@@ -0,0 +1,456 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!-- * BrainSINS' Magento Extension allows to integrate the BrainSINS * personalized
|
3 |
+
product recommendations into a Magento Store. * Copyright (c) 2014 Social
|
4 |
+
Gaming Platform S.R.L. * * This file is part of BrainSINS' Magento Extension.
|
5 |
+
* * BrainSINS' Magento Extension is free software: you can redistribute it
|
6 |
+
* and/or modify it under the terms of the GNU General Public License * as
|
7 |
+
published by the Free Software Foundation, either version 3 of the * License,
|
8 |
+
or (at your option) any later version. * * Foobar is distributed in the hope
|
9 |
+
that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied
|
10 |
+
warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11 |
+
* GNU General Public License for more details. * * You should have received
|
12 |
+
a copy of the GNU General Public License * along with Foobar. If not, see
|
13 |
+
<http://www.gnu.org/licenses/>. * * Please do not hesitate to contact us
|
14 |
+
at info@brainsins.com -->
|
15 |
+
<config>
|
16 |
+
<tabs>
|
17 |
+
<brainsins_recommender_tab translate="label"
|
18 |
+
module="brainsins_recommender">
|
19 |
+
<label>BrainSINS</label>
|
20 |
+
<sort_order>1000</sort_order>
|
21 |
+
<class>tab-brainsins-extensions</class>
|
22 |
+
</brainsins_recommender_tab>
|
23 |
+
</tabs>
|
24 |
+
<sections>
|
25 |
+
<brainsins_recommender_options
|
26 |
+
translate="label" module="brainsins_recommender">
|
27 |
+
<label>Configuration</label>
|
28 |
+
<tab>brainsins_recommender_tab</tab>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<groups>
|
35 |
+
<help translate="label" module="brainsins_recommender">
|
36 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_help
|
37 |
+
</frontend_model>
|
38 |
+
<help_link>http://developers.brainsins.com/plugins/magento.html
|
39 |
+
</help_link>
|
40 |
+
<sort_order>0</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</help>
|
45 |
+
<brainsins_recommender_general
|
46 |
+
translate="label comment" module="brainsins_recommender">
|
47 |
+
<label>General</label>
|
48 |
+
<comment><![CDATA[ <button type="button" class="scalable scalable go" onclick="window.open('http://www.brainsins.com')" style="display:none;"><span><span><span>I am not a BrainSINS user yet</span></span></span></button>]]></comment>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>0</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
<fields>
|
55 |
+
<enabled translate="label comment">
|
56 |
+
<label>Enabled</label>
|
57 |
+
<comment>Enable or disable the extension.</comment>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<sort_order>10</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
64 |
+
</enabled>
|
65 |
+
<bs_key translate="label comment">
|
66 |
+
<label>BS-KEY</label>
|
67 |
+
<comment>BrainSINS KEY format: BS-0123456789-1</comment>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<validate>required-entry validate-bskey-format</validate>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<depends>
|
75 |
+
<enabled>1</enabled>
|
76 |
+
</depends>
|
77 |
+
</bs_key>
|
78 |
+
<email_tracking translate="label comment">
|
79 |
+
<label>Customer email tracking</label>
|
80 |
+
<comment>Needed for cart abandonment service.</comment>
|
81 |
+
<frontend_type>select</frontend_type>
|
82 |
+
<source_model>brainsins_recommender/adminhtml_system_config_source_emailtracking
|
83 |
+
</source_model>
|
84 |
+
<sort_order>30</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
<depends>
|
89 |
+
<enabled>1</enabled>
|
90 |
+
</depends>
|
91 |
+
</email_tracking>
|
92 |
+
</fields>
|
93 |
+
</brainsins_recommender_general>
|
94 |
+
<brainsins_recommender_recommenders
|
95 |
+
translate="label comment" module="brainsins_recommender">
|
96 |
+
<label>Recommenders</label>
|
97 |
+
<comment></comment>
|
98 |
+
<frontend_type>text</frontend_type>
|
99 |
+
<sort_order>20</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>1</show_in_store>
|
103 |
+
<fields>
|
104 |
+
<brainsins_recommender_recommenders_home
|
105 |
+
type="group" tranlate="label comment">
|
106 |
+
<label>Home page recommenders</label>
|
107 |
+
<comment></comment>
|
108 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_expanded
|
109 |
+
</frontend_model>
|
110 |
+
<frontend_type>text</frontend_type>
|
111 |
+
<sort_order>10</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
<fields>
|
116 |
+
<recommenders_home tranlate="label comment">
|
117 |
+
<label>Enabled recommenders</label>
|
118 |
+
<comment>Recommenders
|
119 |
+
to enable at home page.<![CDATA[<br />]]>Custom
|
120 |
+
pos overrides the recommender position.
|
121 |
+
</comment>
|
122 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_home
|
123 |
+
</frontend_model>
|
124 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_serialized
|
125 |
+
</backend_model>
|
126 |
+
<sort_order>10</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
</recommenders_home>
|
131 |
+
</fields>
|
132 |
+
</brainsins_recommender_recommenders_home>
|
133 |
+
<brainsins_recommender_recommenders_product
|
134 |
+
type="group" tranlate="label comment">
|
135 |
+
<label>Product page recommenders</label>
|
136 |
+
<comment></comment>
|
137 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_expanded
|
138 |
+
</frontend_model>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<sort_order>20</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
<fields>
|
145 |
+
<recommenders_product tranlate="label comment">
|
146 |
+
<label>Enabled recommenders</label>
|
147 |
+
<comment>Recommenders
|
148 |
+
to enable at product page.<![CDATA[<br />]]>Custom
|
149 |
+
pos overrides the recommender position.
|
150 |
+
</comment>
|
151 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_product
|
152 |
+
</frontend_model>
|
153 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_serialized
|
154 |
+
</backend_model>
|
155 |
+
<sort_order>10</sort_order>
|
156 |
+
<show_in_default>1</show_in_default>
|
157 |
+
<show_in_website>1</show_in_website>
|
158 |
+
<show_in_store>1</show_in_store>
|
159 |
+
</recommenders_product>
|
160 |
+
</fields>
|
161 |
+
</brainsins_recommender_recommenders_product>
|
162 |
+
<brainsins_recommender_recommenders_category
|
163 |
+
type="group" tranlate="label comment">
|
164 |
+
<label>Category page recommenders</label>
|
165 |
+
<comment></comment>
|
166 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_expanded
|
167 |
+
</frontend_model>
|
168 |
+
<frontend_type>text</frontend_type>
|
169 |
+
<sort_order>25</sort_order>
|
170 |
+
<show_in_default>1</show_in_default>
|
171 |
+
<show_in_website>1</show_in_website>
|
172 |
+
<show_in_store>1</show_in_store>
|
173 |
+
<fields>
|
174 |
+
<recommenders_category tranlate="label comment">
|
175 |
+
<label>Enabled recommenders</label>
|
176 |
+
<comment>Recommenders
|
177 |
+
to enable at category page.<![CDATA[<br />]]>Custom
|
178 |
+
pos overrides the recommender position.
|
179 |
+
</comment>
|
180 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_category
|
181 |
+
</frontend_model>
|
182 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_serialized
|
183 |
+
</backend_model>
|
184 |
+
<sort_order>10</sort_order>
|
185 |
+
<show_in_default>1</show_in_default>
|
186 |
+
<show_in_website>1</show_in_website>
|
187 |
+
<show_in_store>1</show_in_store>
|
188 |
+
</recommenders_category>
|
189 |
+
</fields>
|
190 |
+
</brainsins_recommender_recommenders_category>
|
191 |
+
<brainsins_recommender_recommenders_cart
|
192 |
+
type="group" tranlate="label comment">
|
193 |
+
<label>Cart page recommenders</label>
|
194 |
+
<comment></comment>
|
195 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_expanded
|
196 |
+
</frontend_model>
|
197 |
+
<frontend_type>text</frontend_type>
|
198 |
+
<sort_order>30</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
<fields>
|
203 |
+
<recommenders_cart tranlate="label comment">
|
204 |
+
<label>Enabled recommenders</label>
|
205 |
+
<comment>Recommenders
|
206 |
+
to enable at cart page.<![CDATA[<br />]]>Custom
|
207 |
+
pos overrides the recommender position.
|
208 |
+
</comment>
|
209 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_cart
|
210 |
+
</frontend_model>
|
211 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_serialized
|
212 |
+
</backend_model>
|
213 |
+
<sort_order>10</sort_order>
|
214 |
+
<show_in_default>1</show_in_default>
|
215 |
+
<show_in_website>1</show_in_website>
|
216 |
+
<show_in_store>1</show_in_store>
|
217 |
+
</recommenders_cart>
|
218 |
+
</fields>
|
219 |
+
</brainsins_recommender_recommenders_cart>
|
220 |
+
<brainsins_recommender_recommenders_checkout
|
221 |
+
type="group" tranlate="label comment">
|
222 |
+
<label>Thank you page recommenders</label>
|
223 |
+
<comment></comment>
|
224 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_fieldset_expanded
|
225 |
+
</frontend_model>
|
226 |
+
<frontend_type>text</frontend_type>
|
227 |
+
<sort_order>40</sort_order>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>1</show_in_website>
|
230 |
+
<show_in_store>1</show_in_store>
|
231 |
+
<fields>
|
232 |
+
<recommenders_checkout tranlate="label comment">
|
233 |
+
<label>Enabled recommenders</label>
|
234 |
+
<comment>Recommenders
|
235 |
+
to enable at thank you page.<![CDATA[<br />]]>Custom
|
236 |
+
pos overrides the recommender position.
|
237 |
+
</comment>
|
238 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_checkout
|
239 |
+
</frontend_model>
|
240 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_serialized
|
241 |
+
</backend_model>
|
242 |
+
<sort_order>10</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
</recommenders_checkout>
|
247 |
+
</fields>
|
248 |
+
</brainsins_recommender_recommenders_checkout>
|
249 |
+
</fields>
|
250 |
+
</brainsins_recommender_recommenders>
|
251 |
+
<brainsins_recommender_feed translate="label comment"
|
252 |
+
module="brainsins_recommender">
|
253 |
+
<label>Feeds</label>
|
254 |
+
<comment></comment>
|
255 |
+
<frontend_type>text</frontend_type>
|
256 |
+
<sort_order>30</sort_order>
|
257 |
+
<show_in_default>1</show_in_default>
|
258 |
+
<show_in_website>1</show_in_website>
|
259 |
+
<show_in_store>1</show_in_store>
|
260 |
+
<fields>
|
261 |
+
<cron_enabled translate="label comment">
|
262 |
+
<label>Enable feeds auto generation</label>
|
263 |
+
<comment>Enable or disable the scheduled feed generation.
|
264 |
+
</comment>
|
265 |
+
<frontend_type>select</frontend_type>
|
266 |
+
<sort_order>10</sort_order>
|
267 |
+
<show_in_default>1</show_in_default>
|
268 |
+
<show_in_website>0</show_in_website>
|
269 |
+
<show_in_store>0</show_in_store>
|
270 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
271 |
+
</cron_enabled>
|
272 |
+
<cron_time translate="label comment">
|
273 |
+
<label>Start Time</label>
|
274 |
+
<comment></comment>
|
275 |
+
<frontend_type>time</frontend_type>
|
276 |
+
<sort_order>20</sort_order>
|
277 |
+
<show_in_default>1</show_in_default>
|
278 |
+
<show_in_website>0</show_in_website>
|
279 |
+
<show_in_store>0</show_in_store>
|
280 |
+
<depends>
|
281 |
+
<cron_enabled>1</cron_enabled>
|
282 |
+
</depends>
|
283 |
+
</cron_time>
|
284 |
+
<cron_frequency translate="label comment">
|
285 |
+
<label>Frequency</label>
|
286 |
+
<comment></comment>
|
287 |
+
<frontend_type>select</frontend_type>
|
288 |
+
<source_model>adminhtml/system_config_source_cron_frequency
|
289 |
+
</source_model>
|
290 |
+
<backend_model>brainsins_recommender/adminhtml_system_config_backend_cron
|
291 |
+
</backend_model>
|
292 |
+
<sort_order>30</sort_order>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>0</show_in_website>
|
295 |
+
<show_in_store>0</show_in_store>
|
296 |
+
<depends>
|
297 |
+
<cron_enabled>1</cron_enabled>
|
298 |
+
</depends>
|
299 |
+
</cron_frequency>
|
300 |
+
<product_feed type="group" tranlate="label comment">
|
301 |
+
<label>Products feed</label>
|
302 |
+
<comment></comment>
|
303 |
+
<frontend_type>text</frontend_type>
|
304 |
+
<sort_order>40</sort_order>
|
305 |
+
<show_in_default>1</show_in_default>
|
306 |
+
<show_in_website>1</show_in_website>
|
307 |
+
<show_in_store>1</show_in_store>
|
308 |
+
<depends>
|
309 |
+
<cron_enabled>1</cron_enabled>
|
310 |
+
</depends>
|
311 |
+
<fields>
|
312 |
+
<include_oos_products translate="label comment">
|
313 |
+
<label>Include out of stock products</label>
|
314 |
+
<comment></comment>
|
315 |
+
<frontend_type>select</frontend_type>
|
316 |
+
<source_model>adminhtml/system_config_source_yesno
|
317 |
+
</source_model>
|
318 |
+
<sort_order>10</sort_order>
|
319 |
+
<show_in_default>1</show_in_default>
|
320 |
+
<show_in_website>1</show_in_website>
|
321 |
+
<show_in_store>1</show_in_store>
|
322 |
+
</include_oos_products>
|
323 |
+
<tax_included translate="label comment">
|
324 |
+
<label>Prices with taxes included</label>
|
325 |
+
<comment></comment>
|
326 |
+
<frontend_type>select</frontend_type>
|
327 |
+
<source_model>adminhtml/system_config_source_yesno
|
328 |
+
</source_model>
|
329 |
+
<sort_order>20</sort_order>
|
330 |
+
<show_in_default>1</show_in_default>
|
331 |
+
<show_in_website>1</show_in_website>
|
332 |
+
<show_in_store>1</show_in_store>
|
333 |
+
</tax_included>
|
334 |
+
<special_price translate="label comment">
|
335 |
+
<label>Special price instead normal</label>
|
336 |
+
<comment></comment>
|
337 |
+
<frontend_type>select</frontend_type>
|
338 |
+
<source_model>adminhtml/system_config_source_yesno
|
339 |
+
</source_model>
|
340 |
+
<sort_order>30</sort_order>
|
341 |
+
<show_in_default>1</show_in_default>
|
342 |
+
<show_in_website>1</show_in_website>
|
343 |
+
<show_in_store>1</show_in_store>
|
344 |
+
</special_price>
|
345 |
+
<product_description_attribute
|
346 |
+
translate="label comment">
|
347 |
+
<label>Product description attribute</label>
|
348 |
+
<comment></comment>
|
349 |
+
<frontend_type>select</frontend_type>
|
350 |
+
<source_model>brainsins_recommender/adminhtml_system_config_source_attributes
|
351 |
+
</source_model>
|
352 |
+
<sort_order>40</sort_order>
|
353 |
+
<show_in_default>1</show_in_default>
|
354 |
+
<show_in_website>1</show_in_website>
|
355 |
+
<show_in_store>1</show_in_store>
|
356 |
+
</product_description_attribute>
|
357 |
+
<product_image_resize_width
|
358 |
+
translate="label comment">
|
359 |
+
<label>Custom image width</label>
|
360 |
+
<comment>Leave blank for default width</comment>
|
361 |
+
<frontend_type>text</frontend_type>
|
362 |
+
<sort_order>44</sort_order>
|
363 |
+
<show_in_default>1</show_in_default>
|
364 |
+
<show_in_website>1</show_in_website>
|
365 |
+
<show_in_store>1</show_in_store>
|
366 |
+
</product_image_resize_width>
|
367 |
+
<product_image_resize_height
|
368 |
+
translate="label comment">
|
369 |
+
<label>Custom image height</label>
|
370 |
+
<comment>Leave blank for default height</comment>
|
371 |
+
<frontend_type>text</frontend_type>
|
372 |
+
<sort_order>45</sort_order>
|
373 |
+
<show_in_default>1</show_in_default>
|
374 |
+
<show_in_website>1</show_in_website>
|
375 |
+
<show_in_store>1</show_in_store>
|
376 |
+
</product_image_resize_height>
|
377 |
+
<offline_feed translate="label comment">
|
378 |
+
<label>Offline feed</label>
|
379 |
+
<comment></comment>
|
380 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_feeds_productOffline
|
381 |
+
</frontend_model>
|
382 |
+
<sort_order>50</sort_order>
|
383 |
+
<show_in_default>1</show_in_default>
|
384 |
+
<show_in_website>1</show_in_website>
|
385 |
+
<show_in_store>1</show_in_store>
|
386 |
+
</offline_feed>
|
387 |
+
<online_feed translate="label comment">
|
388 |
+
<label>Online feed</label>
|
389 |
+
<comment></comment>
|
390 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_source_feeds_productOnline
|
391 |
+
</frontend_model>
|
392 |
+
<sort_order>60</sort_order>
|
393 |
+
<show_in_default>1</show_in_default>
|
394 |
+
<show_in_website>1</show_in_website>
|
395 |
+
<show_in_store>1</show_in_store>
|
396 |
+
</online_feed>
|
397 |
+
</fields>
|
398 |
+
</product_feed>
|
399 |
+
<!-- <cronjob_expression tranlate="label comment"> <label>Programacin
|
400 |
+
sincronizacin stock</label> <comment>Frecuencia de la sincronizacin del stock.
|
401 |
+
Introducir expresin Cron (p.e. "0 * * * *" para cada hora en punto).</comment>
|
402 |
+
<frontend_type>text</frontend_type> <backend_model>ecommbits_eral/adminhtml_system_config_backend_cron</backend_model>
|
403 |
+
<sort_order>20</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
|
404 |
+
<show_in_store>0</show_in_store> <depends> <cron_enabled>1</cron_enabled>
|
405 |
+
</depends> </cronjob_expression> -->
|
406 |
+
</fields>
|
407 |
+
</brainsins_recommender_feed>
|
408 |
+
<brainsins_recommender_advanced
|
409 |
+
translate="label comment" module="brainsins_recommender">
|
410 |
+
<label>Advanced Configuration</label>
|
411 |
+
<comment>Do not modify these values unless required by BrainSINS
|
412 |
+
</comment>
|
413 |
+
<frontend_type>text</frontend_type>
|
414 |
+
<sort_order>40</sort_order>
|
415 |
+
<show_in_default>1</show_in_default>
|
416 |
+
<show_in_website>1</show_in_website>
|
417 |
+
<show_in_store>1</show_in_store>
|
418 |
+
<fields>
|
419 |
+
<api_mode translate="label comment">
|
420 |
+
<label>Select BrainSINS API Mode</label>
|
421 |
+
<comment></comment>
|
422 |
+
<frontend_type>select</frontend_type>
|
423 |
+
<sort_order>10</sort_order>
|
424 |
+
<show_in_default>1</show_in_default>
|
425 |
+
<show_in_website>1</show_in_website>
|
426 |
+
<show_in_store>1</show_in_store>
|
427 |
+
<source_model>brainsins_recommender/adminhtml_system_config_source_apimode</source_model>
|
428 |
+
</api_mode>
|
429 |
+
</fields>
|
430 |
+
</brainsins_recommender_advanced>
|
431 |
+
</groups>
|
432 |
+
</brainsins_recommender_options>
|
433 |
+
<brainsins_recommender_dashboard
|
434 |
+
translate="label" module="brainsins_recommender">
|
435 |
+
<label>Dashboard</label>
|
436 |
+
<tab>brainsins_recommender_tab</tab>
|
437 |
+
<frontend_type>text</frontend_type>
|
438 |
+
<sort_order>2</sort_order>
|
439 |
+
<show_in_default>1</show_in_default>
|
440 |
+
<show_in_website>1</show_in_website>
|
441 |
+
<show_in_store>1</show_in_store>
|
442 |
+
<groups>
|
443 |
+
<dashboard translate="label">
|
444 |
+
<label>BrainSINS Dashboard</label>
|
445 |
+
<frontend_type>text</frontend_type>
|
446 |
+
<frontend_model>brainsins_recommender/adminhtml_system_config_form_fieldset_dashboard_dashboard
|
447 |
+
</frontend_model>
|
448 |
+
<sort_order>1</sort_order>
|
449 |
+
<show_in_default>1</show_in_default>
|
450 |
+
<show_in_website>1</show_in_website>
|
451 |
+
<show_in_store>1</show_in_store>
|
452 |
+
</dashboard>
|
453 |
+
</groups>
|
454 |
+
</brainsins_recommender_dashboard>
|
455 |
+
</sections>
|
456 |
+
</config>
|
app/code/community/Brainsins/Recsins/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Block/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Block/.LCKRecsins.php~
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
/Applications/MAMP/htdocs/Magento-Entity/Brainsins_Recsins/app/code/community/Brainsins/Recsins/Block/Recsins.php
|
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins extends Mage_Adminhtml_Block_Widget_Form_Container {//extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
28 |
-
|
29 |
-
public function __construct()
|
30 |
-
{
|
31 |
-
$this->_controller = 'adminhtml_recsins';
|
32 |
-
$this->_blockGroup = 'recsins';
|
33 |
-
$this->_headerText = Mage::helper('recsins')->__('Configuration');
|
34 |
-
$this->_addButtonLabel = Mage::helper('recsins')->__('Add Item');
|
35 |
-
parent::__construct();
|
36 |
-
}
|
37 |
-
|
38 |
-
protected function _prepareForm()
|
39 |
-
{
|
40 |
-
$form = new Varien_Data_Form(array(
|
41 |
-
'id' => 'edit_form',
|
42 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
43 |
-
'method' => 'post',
|
44 |
-
'enctype' => 'multipart/form-data'
|
45 |
-
)
|
46 |
-
);
|
47 |
-
|
48 |
-
$form->setUseContainer(true);
|
49 |
-
$this->setForm($form);
|
50 |
-
return parent::_prepareForm();
|
51 |
-
}
|
52 |
-
|
53 |
-
public function _loadCache() {
|
54 |
-
//always force to reload cache
|
55 |
-
return false;
|
56 |
-
}
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
|
9 |
-
$this->_objectId = 'id';
|
10 |
-
$this->_blockGroup = 'recsins';
|
11 |
-
$this->_controller = 'adminhtml_recsins';
|
12 |
-
|
13 |
-
$this->_updateButton('save', 'label', Mage::helper('recsins')->__('Save Item'));
|
14 |
-
$this->_updateButton('delete', 'label', Mage::helper('recsins')->__('Delete Item'));
|
15 |
-
|
16 |
-
$this->_addButton('saveandcontinue', array(
|
17 |
-
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
-
'onclick' => 'saveAndContinueEdit()',
|
19 |
-
'class' => 'save',
|
20 |
-
), -100);
|
21 |
-
|
22 |
-
$this->_formScripts[] = "
|
23 |
-
function toggleEditor() {
|
24 |
-
if (tinyMCE.getInstanceById('recsins_content') == null) {
|
25 |
-
tinyMCE.execCommand('mceAddControl', false, 'recsins_content');
|
26 |
-
} else {
|
27 |
-
tinyMCE.execCommand('mceRemoveControl', false, 'recsins_content');
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
function saveAndContinueEdit(){
|
32 |
-
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
-
}
|
34 |
-
";
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getHeaderText()
|
38 |
-
{
|
39 |
-
if( Mage::registry('recsins_data') && Mage::registry('recsins_data')->getId() ) {
|
40 |
-
return Mage::helper('recsins')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('recsins_data')->getTitle()));
|
41 |
-
} else {
|
42 |
-
return Mage::helper('recsins')->__('Add Item');
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Form.php
DELETED
@@ -1,711 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* BrainSINS' Magento Extension is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with BrainSINS' Magento Extension. If not, see
|
22 |
-
* <http://www.gnu.org/licenses/>.
|
23 |
-
*
|
24 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
25 |
-
*
|
26 |
-
*/
|
27 |
-
|
28 |
-
final class BS_Radios extends Varien_Data_Form_Element_Radios {
|
29 |
-
|
30 |
-
public function __construct($attributes=array()) {
|
31 |
-
parent::__construct($attributes);
|
32 |
-
}
|
33 |
-
|
34 |
-
protected function _optionToHtml($option, $selected) {
|
35 |
-
$html = '<input type="radio"' . $this->serialize(array('name', 'class', 'style'));
|
36 |
-
if (is_array($option)) {
|
37 |
-
$html.= 'value="' . $this->_escape($option['value']) . '" id="' . $this->getHtmlId() . $option['value'] . '"';
|
38 |
-
if ($option['value'] == $selected) {
|
39 |
-
$html.= ' checked="checked"';
|
40 |
-
}
|
41 |
-
$html.= ' />';
|
42 |
-
$html.= '<label class="inline" for="' . $this->getHtmlId() . $option['value'] . '">' . $option['label'] . '</label>';
|
43 |
-
} elseif ($option instanceof Varien_Object && $selected) {
|
44 |
-
$html.= 'id="' . $this->getHtmlId() . $option->getValue() . '"' . $option->serialize(array('label', 'title', 'value', 'class', 'style'));
|
45 |
-
if (in_array($option->getValue(), $selected)) {
|
46 |
-
$html.= ' checked="checked"';
|
47 |
-
}
|
48 |
-
$html.= ' />';
|
49 |
-
$html.= '<label style = "margin-left:10px" class="inline" for="' . $this->getHtmlId() . $option->getValue() . '">' . $option->getLabel() . '</label>';
|
50 |
-
} else {
|
51 |
-
$html.= 'id="' . $this->getHtmlId() . $option->getValue() . '"' . $option->serialize(array('label', 'title', 'value', 'class', 'style'));
|
52 |
-
$html.= ' />';
|
53 |
-
$html.= '<label style = "margin-left:10px" class="inline" for="' . $this->getHtmlId() . $option->getValue() . '">' . $option->getLabel() . '</label>';
|
54 |
-
}
|
55 |
-
if ($option['additional_text']) {
|
56 |
-
$html .= $option['additional_text'];
|
57 |
-
}
|
58 |
-
$html.= $this->getSeparator() . "\n";
|
59 |
-
return $html;
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
final class BS_Form extends Varien_Data_Form {
|
65 |
-
|
66 |
-
private $_extraHtml = "";
|
67 |
-
|
68 |
-
public function __construct($attributes=array()) {
|
69 |
-
parent::__construct($attributes);
|
70 |
-
}
|
71 |
-
|
72 |
-
public function toHtml() {
|
73 |
-
|
74 |
-
return parent::toHtml() . $this->_extraHtml;
|
75 |
-
}
|
76 |
-
|
77 |
-
public function setExtraHtml($html) {
|
78 |
-
$this->_extraHtml = $html;
|
79 |
-
}
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
84 |
-
|
85 |
-
//private $dev = true;
|
86 |
-
private $dev = false;
|
87 |
-
|
88 |
-
protected function _prepareForm() {
|
89 |
-
|
90 |
-
Mage::getConfig()->cleanCache();
|
91 |
-
|
92 |
-
$linkBaseUrl;
|
93 |
-
|
94 |
-
if ($this->dev) {
|
95 |
-
$linkBaseUrl = "http://dev-analytics.brainsins.com";
|
96 |
-
} else {
|
97 |
-
$linkBaseUrl = "http://analytics.brainsins.com";
|
98 |
-
}
|
99 |
-
|
100 |
-
$form = new BS_Form(array(
|
101 |
-
'id' => 'edit_form',
|
102 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
103 |
-
'method' => 'post',
|
104 |
-
'enctype' => 'multipart/form-data'
|
105 |
-
)
|
106 |
-
);
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
$data = $this->getRequest()->getPost();
|
111 |
-
|
112 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
113 |
-
$key = $key ? $key : '';
|
114 |
-
|
115 |
-
|
116 |
-
// print some non-visible html code to the page
|
117 |
-
|
118 |
-
|
119 |
-
$js = "<script type='text/javascript'>" . PHP_EOL;
|
120 |
-
$js .= "function bsImportConfig(){" . PHP_EOL;
|
121 |
-
$js .= "var import_config = document.getElementById('import_config');" . PHP_EOL;
|
122 |
-
$js .= "var edit_form = document.getElementById('edit_form');" . PHP_EOL;
|
123 |
-
$js .= "import_config.value = '1';" . PHP_EOL;
|
124 |
-
$js .= "edit_form.submit();" . PHP_EOL;
|
125 |
-
$js .= "}" . PHP_EOL;
|
126 |
-
$js.= "</script>" . PHP_EOL;
|
127 |
-
echo($js);
|
128 |
-
|
129 |
-
$style = "<style>";
|
130 |
-
$style .= ".entry-edit .field-row label {width: 250px;}";
|
131 |
-
|
132 |
-
$style .= "</style>";
|
133 |
-
echo($style);
|
134 |
-
|
135 |
-
// create form elements
|
136 |
-
|
137 |
-
$clientsLinkUrl = "javascript:window.open('" . $linkBaseUrl . "/settings/accountinfo')";
|
138 |
-
$nonClientsLinkUrl = "javascript:window.open('http://www.brainsins.es/tarifas')";
|
139 |
-
|
140 |
-
|
141 |
-
$form->setUseContainer(true);
|
142 |
-
$helper = $this->helper("recsins");
|
143 |
-
|
144 |
-
$text = new Varien_Data_Form_Element_Text(array('name' => 'bskey_text'));
|
145 |
-
$text->setId('bskey_text');
|
146 |
-
$text->setValue($key);
|
147 |
-
|
148 |
-
$keyQuestion = new Varien_Data_Form_Element_Label(array('value' => $helper->__('Do not have a BrainSINS KEY?')));
|
149 |
-
$clientsLink = new Varien_Data_Form_Element_Link(array('value' => $helper->__('I am a BrainSINS client'), 'href' => $clientsLinkUrl, 'style' => 'padding-left:20px;'));
|
150 |
-
$nonClientsLink = new Varien_Data_Form_Element_Link(array('value' => $helper->__('I am not a BrainSINS client yet'), 'href' => $nonClientsLinkUrl, 'style' => 'padding-left:20px;'));
|
151 |
-
|
152 |
-
|
153 |
-
$enabledValue = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
154 |
-
|
155 |
-
if (!$enabledValue && $enabledValue !== '0') {
|
156 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_ENABLED', '1');
|
157 |
-
$enabledValue = '1';
|
158 |
-
}
|
159 |
-
|
160 |
-
$enabledOptions = new BS_Radios(array('id' => 'bsenableoptions', 'name' => 'bsenableoptions', 'separator' => '<br><br>'));
|
161 |
-
$enabledOption = new Varien_Data_Form_Element_Radio(array('id' => 'bsenabledoption', 'name' => 'bsenabledoption', 'label' => $helper->__("Enabled"), 'value' => '1'));
|
162 |
-
$disabledOption = new Varien_Data_Form_Element_Radio(array('id' => 'bsdisabledoption', 'name' => 'bsdisabledoption', 'label' => $helper->__("Disabled"), 'value' => '0'));
|
163 |
-
|
164 |
-
if ($enabledValue === '1') {
|
165 |
-
$enabledOptions->setValue(array('1'));
|
166 |
-
} else {
|
167 |
-
$enabledOptions->setValue(array('0'));
|
168 |
-
}
|
169 |
-
|
170 |
-
$enabledOptions->setValues(array($enabledOption, $disabledOption));
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$keyFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bskeyfs'));
|
175 |
-
$keyFieldSet->setId('bskeyfs');
|
176 |
-
$keyFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('BrainSINS KEY'), 'bold' => true)));
|
177 |
-
$keyFieldSet->addElement($text);
|
178 |
-
$keyFieldSet->addElement($keyQuestion);
|
179 |
-
$keyFieldSet->addElement($clientsLink);
|
180 |
-
$keyFieldSet->addElement($nonClientsLink);
|
181 |
-
|
182 |
-
$enableFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bsenablefs'));
|
183 |
-
$enableFieldSet->setId('bsenablefs');
|
184 |
-
$enableFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Enable / Disable Extension'), 'bold' => true)));
|
185 |
-
$enableFieldSet->addElement($enabledOptions);
|
186 |
-
|
187 |
-
|
188 |
-
$model = Mage::getModel('recsins/recommender');
|
189 |
-
$entries = $model->getAllRecommenders();
|
190 |
-
$defaultText = $helper->__("Do not show");
|
191 |
-
|
192 |
-
$defaultHomeOption = new Varien_Data_Form_Element_Radio();
|
193 |
-
$defaultHomeOption->setLabel($defaultText);
|
194 |
-
$defaultHomeOption->setValue(0);
|
195 |
-
|
196 |
-
$defaultCategoryOption = new Varien_Data_Form_Element_Radio();
|
197 |
-
$defaultCategoryOption->setLabel($defaultText);
|
198 |
-
$defaultCategoryOption->setValue(0);
|
199 |
-
|
200 |
-
$defaultProductOption = new Varien_Data_Form_Element_Radio();
|
201 |
-
$defaultProductOption->setLabel($defaultText);
|
202 |
-
$defaultProductOption->setValue(0);
|
203 |
-
|
204 |
-
$defaultCartOption = new Varien_Data_Form_Element_Radio();
|
205 |
-
$defaultCartOption->setLabel($defaultText);
|
206 |
-
$defaultCartOption->setValue(0);
|
207 |
-
|
208 |
-
$defaultCheckoutOption = new Varien_Data_Form_Element_Radio();
|
209 |
-
$defaultCheckoutOption->setLabel($defaultText);
|
210 |
-
$defaultCheckoutOption->setValue(0);
|
211 |
-
|
212 |
-
|
213 |
-
$homeRadioOptions = array();
|
214 |
-
$categoryRadioOptions = array();
|
215 |
-
$productRadioOptions = array();
|
216 |
-
$cartRadioOptions = array();
|
217 |
-
$checkoutRadioOptions = array();
|
218 |
-
|
219 |
-
$homeRadioOptions[] = $defaultHomeOption;
|
220 |
-
$categoryRadioOptions[] = $defaultHomeOption;
|
221 |
-
$productRadioOptions[] = $defaultProductOption;
|
222 |
-
$cartRadioOptions[] = $defaultCartOption;
|
223 |
-
$checkoutRadioOptions[] = $defaultCheckoutOption;
|
224 |
-
|
225 |
-
$homeSelected = Mage::getStoreConfig('brainsins/BS_HOME_RECOMMENDER');
|
226 |
-
$categorySelected = Mage::getStoreConfig('brainsins/BS_CATEGORY_RECOMMENDER');
|
227 |
-
$productSelected = Mage::getStoreConfig('brainsins/BS_PRODUCT_RECOMMENDER');
|
228 |
-
$cartSelected = Mage::getStoreConfig('brainsins/BS_CART_RECOMMENDER');
|
229 |
-
$checkoutSelected = Mage::getStoreConfig('brainsins/BS_CHECKOUT_RECOMMENDER');
|
230 |
-
|
231 |
-
$outOfStockSelected = Mage::getStoreConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS');
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
foreach ($entries as $entry) {
|
236 |
-
$id = $entry['id'];
|
237 |
-
$name = $entry['name'];
|
238 |
-
$page = $entry['page'];
|
239 |
-
|
240 |
-
$radio = new Varien_Data_Form_Element_Radio();
|
241 |
-
$radioLink = "javascript:window.open(\"" . $linkBaseUrl . "/optimization/editrecommenderstyle?idRecommender=" . $id . "\")";
|
242 |
-
$radio->setLabel($name);
|
243 |
-
$radio->setValue($id);
|
244 |
-
$radio->setAdditional_text("<input type='button' onclick='" . $radioLink . "' value='" . $helper->__("Edit Style") . "' style='margin-left:20px'>");
|
245 |
-
|
246 |
-
switch ($page) {
|
247 |
-
case 1:
|
248 |
-
$optionsHome[$id] = $name;
|
249 |
-
$homeRadioOptions[] = $radio;
|
250 |
-
$optionsCategory[$id] = $name;
|
251 |
-
$categoryRadioOptions[] = $radio;
|
252 |
-
break;
|
253 |
-
case 2:
|
254 |
-
$optionsProduct[$id] = $name;
|
255 |
-
$productRadioOptions[] = $radio;
|
256 |
-
break;
|
257 |
-
case 3:
|
258 |
-
$optionsCart[$id] = $name;
|
259 |
-
$cartRadioOptions[] = $radio;
|
260 |
-
break;
|
261 |
-
case 4:
|
262 |
-
$checkoutRadioOptions[] = $radio;
|
263 |
-
$optionsCheckout[$id] = $name;
|
264 |
-
break;
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
// home
|
269 |
-
|
270 |
-
$homeRecommenders = new BS_Radios(array('name' => 'bshome_recommenders', 'separator' => '<br><br>'));
|
271 |
-
$homeRecommenders->setId('bshome_recommenders');
|
272 |
-
$homeRecommenders->setValues($homeRadioOptions);
|
273 |
-
if ($homeSelected !== null) {
|
274 |
-
$homeRecommenders->setValue(array($homeSelected));
|
275 |
-
} else {
|
276 |
-
$homeRecommenders->setValue(array(0));
|
277 |
-
}
|
278 |
-
|
279 |
-
$homeFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bshomerecommendersfs'));
|
280 |
-
$homeFieldSet->setId('bshomerecommendersfs');
|
281 |
-
$homeFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Home Page Recommender'), 'bold' => true)));
|
282 |
-
$homeFieldSet->addElement($homeRecommenders);
|
283 |
-
|
284 |
-
|
285 |
-
// category
|
286 |
-
|
287 |
-
$categoryRecommenders = new BS_Radios(array('name' => 'bscategory_recommenders', 'separator' => '<br><br>'));
|
288 |
-
$categoryRecommenders->setId('bscategory_recommenders');
|
289 |
-
$categoryRecommenders->setValues($categoryRadioOptions);
|
290 |
-
if ($categorySelected !== null) {
|
291 |
-
$categoryRecommenders->setValue(array($categorySelected));
|
292 |
-
} else {
|
293 |
-
$categoryRecommenders->setValue(array(0));
|
294 |
-
}
|
295 |
-
|
296 |
-
$categoryFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bscategoryrecommendersfs'));
|
297 |
-
$categoryFieldSet->setId('bscategoryrecommendersfs');
|
298 |
-
$categoryFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Category Page Recommender'), 'bold' => true)));
|
299 |
-
$categoryFieldSet->addElement($categoryRecommenders);
|
300 |
-
|
301 |
-
// product
|
302 |
-
|
303 |
-
$productRecommenders = new BS_Radios(array('name' => 'bsproduct_recommenders', 'separator' => '<br><br>'));
|
304 |
-
$productRecommenders->setId('bsproduct_recommenders');
|
305 |
-
$productRecommenders->setValues($productRadioOptions);
|
306 |
-
if ($productSelected !== null) {
|
307 |
-
$productRecommenders->setValue(array($productSelected));
|
308 |
-
} else {
|
309 |
-
$productRecommenders->setValue(array(0));
|
310 |
-
}
|
311 |
-
|
312 |
-
$productFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bsproductrecommendersfs'));
|
313 |
-
$productFieldSet->setId('bsproductrecommendersfs');
|
314 |
-
$productFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Product Page Recommender'), 'bold' => true)));
|
315 |
-
$productFieldSet->addElement($productRecommenders);
|
316 |
-
|
317 |
-
// cart
|
318 |
-
|
319 |
-
$cartRecommenders = new BS_Radios(array('name' => 'bscart_recommenders', 'separator' => '<br><br>'));
|
320 |
-
$cartRecommenders->setId('bscart_recommenders');
|
321 |
-
$cartRecommenders->setValues($cartRadioOptions);
|
322 |
-
if ($cartSelected !== null) {
|
323 |
-
$cartRecommenders->setValue(array($cartSelected));
|
324 |
-
} else {
|
325 |
-
$cartRecommenders->setValue(array(0));
|
326 |
-
}
|
327 |
-
|
328 |
-
$cartFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bscartrecommendersfs'));
|
329 |
-
$cartFieldSet->setId('bscartrecommendersfs');
|
330 |
-
$cartFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Cart Page Recommender'), 'bold' => true)));
|
331 |
-
$cartFieldSet->addElement($cartRecommenders);
|
332 |
-
|
333 |
-
// checkout
|
334 |
-
|
335 |
-
$checkoutRecommenders = new BS_Radios(array('name' => 'bscheckout_recommenders', 'separator' => '<br><br>'));
|
336 |
-
$checkoutRecommenders->setId('bscheckout_recommenders');
|
337 |
-
$checkoutRecommenders->setValues($checkoutRadioOptions);
|
338 |
-
if ($checkoutSelected !== null) {
|
339 |
-
$checkoutRecommenders->setValue(array($checkoutSelected));
|
340 |
-
} else {
|
341 |
-
$checkoutRecommenders->setValue(array(0));
|
342 |
-
}
|
343 |
-
|
344 |
-
$checkoutFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bscheckoutrecommendersfs'));
|
345 |
-
$checkoutFieldSet->setId('bscheckoutrecommendersfs');
|
346 |
-
$checkoutFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Checkout Page Recommender'), 'bold' => true)));
|
347 |
-
$checkoutFieldSet->addElement($checkoutRecommenders);
|
348 |
-
|
349 |
-
|
350 |
-
$advancedFieldSet = new Varien_Data_Form_Element_Fieldset(array('name' => 'bsadvancedoptionsfs'));
|
351 |
-
$advancedFieldSet->setId('bsadvancedoptionsfs');
|
352 |
-
$advancedFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__('Advanced Options'), 'bold' => true)));
|
353 |
-
|
354 |
-
$cautionText = "(" . $helper->__("please do not modify these values unless you are told so by BrainSINS' support team") . ")";
|
355 |
-
|
356 |
-
//$advancedFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $cautionText)));
|
357 |
-
//$advancedFieldSet->addElement(new Varien_Data_Form_Element_Label(array('value' => $helper->__("Catalog upload page size"), 'bold' => 'true')));
|
358 |
-
|
359 |
-
/*$radio1 = new Varien_Data_Form_Element_Radio();
|
360 |
-
$radio1->setLabel("1");
|
361 |
-
$radio1->setValue("page1");
|
362 |
-
$radio1->setAdditional_text("");
|
363 |
-
|
364 |
-
$radio10 = new Varien_Data_Form_Element_Radio();
|
365 |
-
$radio10->setLabel("10");
|
366 |
-
$radio10->setValue("page10");
|
367 |
-
$radio10->setAdditional_text("");
|
368 |
-
|
369 |
-
$radio20 = new Varien_Data_Form_Element_Radio();
|
370 |
-
$radio20->setLabel("20");
|
371 |
-
$radio20->setValue("page20");
|
372 |
-
$radio20->setAdditional_text("");
|
373 |
-
|
374 |
-
$radio50 = new Varien_Data_Form_Element_Radio();
|
375 |
-
$radio50->setLabel("50");
|
376 |
-
$radio50->setValue("page50");
|
377 |
-
$radio50->setAdditional_text("");
|
378 |
-
|
379 |
-
$radio100 = new Varien_Data_Form_Element_Radio();
|
380 |
-
$radio100->setLabel("100");
|
381 |
-
$radio100->setValue("page100");
|
382 |
-
$radio100->setAdditional_text("");
|
383 |
-
|
384 |
-
$radio200 = new Varien_Data_Form_Element_Radio();
|
385 |
-
$radio200->setLabel("200");
|
386 |
-
$radio200->setValue("page200");
|
387 |
-
$radio200->setAdditional_text("");
|
388 |
-
|
389 |
-
$advancedOptions = array();
|
390 |
-
$advancedOptions[] = $radio1;
|
391 |
-
$advancedOptions[] = $radio10;
|
392 |
-
$advancedOptions[] = $radio20;
|
393 |
-
$advancedOptions[] = $radio50;
|
394 |
-
$advancedOptions[] = $radio100;
|
395 |
-
$advancedOptions[] = $radio200;
|
396 |
-
|
397 |
-
$advancedRadios = new BS_Radios(array('name' => 'bsadvanced', 'separator' => '<br>'));
|
398 |
-
$advancedRadios->setId("bsadvanced_options");
|
399 |
-
$advancedRadios->setValues($advancedOptions);
|
400 |
-
|
401 |
-
$pageSize = Mage::getStoreConfig('brainsins/BS_PAGE_SIZE');
|
402 |
-
|
403 |
-
if (!isset($pageSize) || !($pageSize != 'page1' || $pageSize != 'page10' || $pageSize != 'page20' || $pageSize != 'page50' || $pageSize != 'page100' || $pageSize != 'page200')) {
|
404 |
-
$pageSize = 'page50';
|
405 |
-
}
|
406 |
-
|
407 |
-
$advancedRadios->setValue(array($pageSize));
|
408 |
-
*/
|
409 |
-
$includeOutOfStockLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Include out of stock products in catalog upload (out of stock products will be recommended)"), 'bold' => 'true'));
|
410 |
-
|
411 |
-
$outOfStockCheckbox = new Varien_Data_Form_Element_Checkbox(array('name' => 'out_of_stock_checkbox'));
|
412 |
-
$outOfStockCheckbox->setId('out_of_stock_checkbox');
|
413 |
-
$outOfStockCheckbox->setValue("checked");
|
414 |
-
if (isset($outOfStockSelected) && $outOfStockSelected != null) {
|
415 |
-
if ($outOfStockSelected == "1") {
|
416 |
-
$outOfStockCheckbox->setIsChecked(true);
|
417 |
-
}
|
418 |
-
} else {
|
419 |
-
//$outOfStockCheckbox->setIsChecked(true);
|
420 |
-
}
|
421 |
-
|
422 |
-
|
423 |
-
// currency symbols, positions and delimiters
|
424 |
-
|
425 |
-
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
426 |
-
$stores = Mage::app()->getStore()->getCollection();
|
427 |
-
|
428 |
-
$currencyOptions = array();
|
429 |
-
|
430 |
-
$currenciesLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Currency Display Options"), 'bold' => 'true'));
|
431 |
-
|
432 |
-
foreach($currencies as $currency) {
|
433 |
-
$currencyHeader = new Varien_Data_Form_Element_Label(array('value' => $helper->__($currency), 'bold' => 'false'));
|
434 |
-
$currencySymbolText = new Varien_Data_Form_Element_Text(array('name' => $currency.'_symb_text', "label" => $helper->__('Currency Symbol')));
|
435 |
-
|
436 |
-
$radioLeft = new Varien_Data_Form_Element_Radio();
|
437 |
-
$radioLeft->setLabel($helper->__("Left"));
|
438 |
-
$radioLeft->setValue("curr_symb_left");
|
439 |
-
$radioLeft->setAdditional_text("");
|
440 |
-
|
441 |
-
$radioRight = new Varien_Data_Form_Element_Radio();
|
442 |
-
$radioRight->setLabel($helper->__("Right"));
|
443 |
-
$radioRight->setValue("curr_symb_right");
|
444 |
-
$radioRight->setAdditional_text("");
|
445 |
-
|
446 |
-
$currSymbPosOptions = array();
|
447 |
-
$currSymbPosOptions[] = $radioLeft;
|
448 |
-
$currSymbPosOptions[] = $radioRight;
|
449 |
-
$currSymbPos = new BS_Radios(array('name' => $currency.'_symb_pos_options', 'separator' => '<br>'));
|
450 |
-
$currSymbPos->setId($currency . "_symb_pos_options");
|
451 |
-
$currSymbPos->setValues($currSymbPosOptions);
|
452 |
-
|
453 |
-
$currencyDelimiter = new Varien_Data_Form_Element_Text(array('name' => $currency .'_delim', "label" => $helper->__("Decimal Delimiter")));
|
454 |
-
|
455 |
-
$currencyOptions[$currency] = array();
|
456 |
-
$currencyOptions[$currency]['header'] = $currencyHeader;
|
457 |
-
$currencyOptions[$currency]['symbol'] = $currencySymbolText;
|
458 |
-
$currencyOptions[$currency]['position'] = $currSymbPos;
|
459 |
-
$currencyOptions[$currency]['delimiter'] = $currencyDelimiter;
|
460 |
-
|
461 |
-
//selected option
|
462 |
-
|
463 |
-
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currency . "_SYMBOL");
|
464 |
-
if (!isset($selectedSymbol) || !$selectedSymbol) {
|
465 |
-
$selectedSymbol = Mage::app()->getLocale()->currency($currency)->getSymbol();
|
466 |
-
}
|
467 |
-
$currencySymbolText->setValue($selectedSymbol);
|
468 |
-
|
469 |
-
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currency . "_POSITION");
|
470 |
-
if ((!isset($selectedPosition) || !$selectedPosition) || !($selectedPosition == "curr_symb_right" || $selectedPosition == "curr_symb_left")) {
|
471 |
-
$selectedPosition = "curr_symb_right";
|
472 |
-
}
|
473 |
-
$currSymbPos->setValue(array($selectedPosition));
|
474 |
-
|
475 |
-
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currency . "_DELIMITER");
|
476 |
-
if (!isset($selectedDelimiter) || !$selectedDelimiter) {
|
477 |
-
$selectedDelimiter = ",";
|
478 |
-
}
|
479 |
-
$currencyDelimiter->setValue($selectedDelimiter);
|
480 |
-
}
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
//
|
486 |
-
|
487 |
-
$imagesLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Select Image url type"), 'bold' => 'true'));
|
488 |
-
|
489 |
-
$radioNotResize = new Varien_Data_Form_Element_Radio();
|
490 |
-
$radioNotResize->setLabel($helper->__("Default value for product ''small'' image"));
|
491 |
-
$radioNotResize->setValue("image_no_resize");
|
492 |
-
$radioNotResize->setAdditional_text("");
|
493 |
-
|
494 |
-
$radioResize = new Varien_Data_Form_Element_Radio();
|
495 |
-
$radioResize->setLabel($helper->__("Resize product ''small'' image"));
|
496 |
-
$radioResize->setValue("image_resize");
|
497 |
-
$radioResize->setAdditional_text("");
|
498 |
-
|
499 |
-
$imageOptions = array();
|
500 |
-
$imageOptions[] = $radioNotResize;
|
501 |
-
$imageOptions[] = $radioResize;
|
502 |
-
$imageRadios = new BS_Radios(array('name' => 'bsimageoptions', 'separator' => '<br>'));
|
503 |
-
$imageRadios->setId("image_options");
|
504 |
-
$imageRadios->setValues($imageOptions);
|
505 |
-
|
506 |
-
$widthText = new Varien_Data_Form_Element_Text(array('name' => 'image_width_text', "label" => $helper->__('Width')));
|
507 |
-
$heigthText = new Varien_Data_Form_Element_Text(array('name' => 'image_heigth_text', "label" => $helper->__("Heigth")));
|
508 |
-
|
509 |
-
$imageSelectedOption = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE');
|
510 |
-
if (!isset($imageSelectedOption) || !($imageSelectedOption == 'image_no_resize' || $imageSelectedOption == 'image_resize')) {
|
511 |
-
$imageSelectedOption = 'image_no_resize';
|
512 |
-
}
|
513 |
-
|
514 |
-
$imageRadios->setValue(array($imageSelectedOption));
|
515 |
-
|
516 |
-
|
517 |
-
$imageSelectedWidth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_WIDTH');
|
518 |
-
$imageSelectedHeigth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH');
|
519 |
-
|
520 |
-
if (isset($imageSelectedWidth) && is_numeric($imageSelectedWidth) && $imageSelectedWidth > 0) {
|
521 |
-
$widthText->setValue($imageSelectedWidth);
|
522 |
-
}
|
523 |
-
|
524 |
-
if (isset($imageSelectedHeigth) && is_numeric($imageSelectedHeigth) && $imageSelectedHeigth > 0) {
|
525 |
-
$heigthText->setValue($imageSelectedHeigth);
|
526 |
-
}
|
527 |
-
|
528 |
-
|
529 |
-
$specialPriceLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Upload special price"), 'bold' => 'true'));
|
530 |
-
|
531 |
-
$specialPriceYes = new Varien_Data_Form_Element_Radio();
|
532 |
-
$specialPriceYes->setLabel($helper->__("Yes"));
|
533 |
-
$specialPriceYes->setValue("special_price_yes");
|
534 |
-
$specialPriceYes->setAdditional_text("");
|
535 |
-
|
536 |
-
$specialPriceNo = new Varien_Data_Form_Element_Radio();
|
537 |
-
$specialPriceNo->setLabel($helper->__("No"));
|
538 |
-
$specialPriceNo->setValue("special_price_no");
|
539 |
-
$specialPriceNo->setAdditional_text("");
|
540 |
-
|
541 |
-
$specialPriceOptions = array();
|
542 |
-
$specialPriceOptions[] = $specialPriceYes;
|
543 |
-
$specialPriceOptions[] = $specialPriceNo;
|
544 |
-
$specialPriceRadios = new BS_Radios(array('name' => 'bsspecialpriceoptions', 'separator' => '<br>'));
|
545 |
-
$specialPriceRadios->setId("special_price_options");
|
546 |
-
$specialPriceRadios->setValues($specialPriceOptions);
|
547 |
-
|
548 |
-
$specialPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_USE_SPECIAL_PRICE');
|
549 |
-
if (isset($specialPriceSelectedOption) && $specialPriceSelectedOption == '1') {
|
550 |
-
$specialPriceSelectedOption = 'special_price_yes';
|
551 |
-
} else if (!isset($spacialPriceSelectedOption)) {
|
552 |
-
$specialPriceSelectedOption = 'special_price_yes';
|
553 |
-
} else {
|
554 |
-
$specialPriceSelectedOption = 'special_price_no';
|
555 |
-
}
|
556 |
-
|
557 |
-
$specialPriceRadios->setValue(array($specialPriceSelectedOption));
|
558 |
-
|
559 |
-
$taxPriceLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Tax Prices"), 'bold' => 'true'));
|
560 |
-
|
561 |
-
$taxPriceEqual = new Varien_Data_Form_Element_Radio();
|
562 |
-
$taxPriceEqual->setLabel($helper->__("Display Prices are equal to Catalog Prices"));
|
563 |
-
$taxPriceEqual->setValue("tax_price_equal");
|
564 |
-
$taxPriceEqual->setAdditional_text("");
|
565 |
-
|
566 |
-
$taxPriceInDisplay = new Varien_Data_Form_Element_Radio();
|
567 |
-
$taxPriceInDisplay->setLabel($helper->__("Display Prices include taxes and Catalog Prices do not include taxes"));
|
568 |
-
$taxPriceInDisplay->setValue("tax_price_plus");
|
569 |
-
$taxPriceInDisplay->setAdditional_text("");
|
570 |
-
|
571 |
-
$taxPriceInCatalog = new Varien_Data_Form_Element_Radio();
|
572 |
-
$taxPriceInCatalog->setLabel($helper->__("Display Prices do not include taxes and Catalog Prices include taxes"));
|
573 |
-
$taxPriceInCatalog->setValue("tax_price_minus");
|
574 |
-
$taxPriceInCatalog->setAdditional_text("");
|
575 |
-
|
576 |
-
$taxPriceOptions = array();
|
577 |
-
$taxPriceOptions[] = $taxPriceEqual;
|
578 |
-
$taxPriceOptions[] = $taxPriceInDisplay;
|
579 |
-
$taxPriceOptions[] = $taxPriceInCatalog;
|
580 |
-
|
581 |
-
$taxPriceRadios = new BS_Radios(array('name' => 'bstaxpriceoptions', 'separator' => '<br>'));
|
582 |
-
$taxPriceRadios->setId("tax_price_options");
|
583 |
-
$taxPriceRadios->setValues($taxPriceOptions);
|
584 |
-
|
585 |
-
$taxPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_TAX_PRICE');
|
586 |
-
$taxPriceDisplayOption;
|
587 |
-
if (isset($taxPriceSelectedOption) && ($taxPriceSelectedOption == 'tax_price_equal' || $taxPriceSelectedOption == 'tax_price_plus' || $taxPriceSelectedOption == 'tax_price_minus')) {
|
588 |
-
$taxPriceDisplayOption = $taxPriceSelectedOption;
|
589 |
-
} else {
|
590 |
-
$taxPriceDisplayOption = 'tax_price_equal';
|
591 |
-
}
|
592 |
-
|
593 |
-
$taxPriceRadios->setValue(array($taxPriceDisplayOption));
|
594 |
-
|
595 |
-
|
596 |
-
$importScriptLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Custom style script (HTTP)"), 'bold' => 'true'));
|
597 |
-
$scriptUrl = Mage::getStoreConfig('brainsins/BS_SCRIPT_URL');
|
598 |
-
$importScript = new Varien_Data_Form_Element_Text(array('name' => 'bs_script', 'style' => 'width:400px'));
|
599 |
-
$importScript->setId('bs_script');
|
600 |
-
$importScript->setValue($scriptUrl);
|
601 |
-
|
602 |
-
$importScriptHttpsLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Custom style script (HTTPS)"), 'bold' => 'true'));
|
603 |
-
$scriptHttpsUrl = Mage::getStoreConfig('brainsins/BS_SCRIPT_THTTPS_URL');
|
604 |
-
$importScriptHttps = new Varien_Data_Form_Element_Text(array('name' => 'bs_script_https', 'style' => 'width:400px'));
|
605 |
-
$importScriptHttps->setId('bs_script_https');
|
606 |
-
$importScriptHttps->setValue($scriptHttpsUrl);
|
607 |
-
|
608 |
-
$useHighDetail = new Varien_Data_Form_Element_Checkbox(array('name' => 'use_high_detail'));
|
609 |
-
$useHighDetail->setId('use_high_detail');
|
610 |
-
$useHighDetail->setValue("checked");
|
611 |
-
$useHighDetailOption = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
612 |
-
if (isset($useHighDetailOption) && $useHighDetailOption != null) {
|
613 |
-
if ($useHighDetailOption == "1") {
|
614 |
-
$useHighDetail->setIsChecked(true);
|
615 |
-
} else {
|
616 |
-
$useHighDetail->setIsChecked(false);
|
617 |
-
}
|
618 |
-
} else {
|
619 |
-
$useHighDetail->setIsChecked(false);
|
620 |
-
}
|
621 |
-
$useHighDetailLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Use high detail in recommendation requests"), 'bold' => 'true'));
|
622 |
-
|
623 |
-
$useAjaxRequests = new Varien_Data_Form_Element_Checkbox(array('name' => 'use_ajax_requests'));
|
624 |
-
$useAjaxRequests->setId('use_ajax_requests');
|
625 |
-
$useAjaxRequests->setValue("checked");
|
626 |
-
$useAjaxRequestsOption = Mage::getStoreConfig('brainsins/BS_USE_AJAX_REQUESTS');
|
627 |
-
if (isset($useAjaxRequestsOption) && $useAjaxRequestsOption != null) {
|
628 |
-
if ($useAjaxRequestsOption == "1") {
|
629 |
-
$useAjaxRequests->setIsChecked(true);
|
630 |
-
} else {
|
631 |
-
$useAjaxRequests->setIsChecked(false);
|
632 |
-
}
|
633 |
-
} else {
|
634 |
-
$useAjaxRequests->setIsChecked(false);
|
635 |
-
}
|
636 |
-
$useAjaxRequestsLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Use ajax for recommendation requests"), 'bold' => 'true'));
|
637 |
-
|
638 |
-
|
639 |
-
//$advancedFieldSet->addElement($advancedRadios);
|
640 |
-
$advancedFieldSet->addElement($includeOutOfStockLabel);
|
641 |
-
$advancedFieldSet->addElement($outOfStockCheckbox);
|
642 |
-
|
643 |
-
$advancedFieldSet->addElement($currenciesLabel);
|
644 |
-
foreach($currencyOptions as $currency => $options) {
|
645 |
-
$advancedFieldSet->addElement($options['header']);
|
646 |
-
$advancedFieldSet->addElement($options['symbol']);
|
647 |
-
$advancedFieldSet->addElement($options['position']);
|
648 |
-
$advancedFieldSet->addElement($options['delimiter']);
|
649 |
-
}
|
650 |
-
|
651 |
-
|
652 |
-
$advancedFieldSet->addElement($imagesLabel);
|
653 |
-
$advancedFieldSet->addElement($imageRadios);
|
654 |
-
$advancedFieldSet->addElement($widthText);
|
655 |
-
$advancedFieldSet->addElement($heigthText);
|
656 |
-
$advancedFieldSet->addElement($specialPriceLabel);
|
657 |
-
$advancedFieldSet->addElement($specialPriceRadios);
|
658 |
-
$advancedFieldSet->addElement($taxPriceLabel);
|
659 |
-
$advancedFieldSet->addElement($taxPriceRadios);
|
660 |
-
$advancedFieldSet->addElement($importScriptLabel);
|
661 |
-
$advancedFieldSet->addElement($importScript);
|
662 |
-
$advancedFieldSet->addElement($importScriptHttpsLabel);
|
663 |
-
$advancedFieldSet->addElement($importScriptHttps);
|
664 |
-
$advancedFieldSet->addElement($useHighDetailLabel);
|
665 |
-
$advancedFieldSet->addElement($useHighDetail);
|
666 |
-
$advancedFieldSet->addElement($useAjaxRequestsLabel);
|
667 |
-
$advancedFieldSet->addElement($useAjaxRequests);
|
668 |
-
|
669 |
-
//$advancedFieldSet->addElement($imagesExplainLabel1);
|
670 |
-
//$advancedFieldSet->addElement($imagesExplainLabel2);
|
671 |
-
// buttons
|
672 |
-
|
673 |
-
$hiddenImport = new Varien_Data_Form_Element_Hidden(array('name' => 'import_config'));
|
674 |
-
$hiddenImport->setId("import_config");
|
675 |
-
$hiddenImport->setValue("0");
|
676 |
-
|
677 |
-
|
678 |
-
$importButton = new Varien_Data_Form_Element_Button(array('name' => 'import_config_button'));
|
679 |
-
$importButton->setId('import_config_button');
|
680 |
-
$importButton->setValue($helper->__('Import Recommenders'));
|
681 |
-
$importButton->setOnclick("bsImportConfig()");
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
// build the final form
|
688 |
-
|
689 |
-
$form->addElement($keyFieldSet);
|
690 |
-
$form->addElement($enableFieldSet);
|
691 |
-
$form->addElement($homeFieldSet);
|
692 |
-
$form->addElement($categoryFieldSet);
|
693 |
-
$form->addElement($productFieldSet);
|
694 |
-
$form->addElement($cartFieldSet);
|
695 |
-
$form->addElement($checkoutFieldSet);
|
696 |
-
$form->addElement($advancedFieldSet);
|
697 |
-
$form->addElement($hiddenImport);
|
698 |
-
//$form->addElement($hiddenUpload);
|
699 |
-
$form->addElement($importButton);
|
700 |
-
|
701 |
-
/*if (isset($uploading) && $uploading == '1') {
|
702 |
-
$form->addElement($abortButton);
|
703 |
-
} else {
|
704 |
-
$form->addElement($uploadButton);
|
705 |
-
}*/
|
706 |
-
$this->setForm($form);
|
707 |
-
|
708 |
-
return $form;
|
709 |
-
}
|
710 |
-
|
711 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Tab/Form.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
28 |
-
|
29 |
-
protected function _prepareForm() {
|
30 |
-
$form = new Varien_Data_Form();
|
31 |
-
$this->setForm($form);
|
32 |
-
$fieldset = $form->addFieldset('recsins_form', array('legend' => Mage::helper('recsins')->__('Item information')));
|
33 |
-
|
34 |
-
$fieldset->addField('title', 'text', array(
|
35 |
-
'label' => Mage::helper('recsins')->__('Title'),
|
36 |
-
'class' => 'required-entry',
|
37 |
-
'required' => true,
|
38 |
-
'name' => 'title',
|
39 |
-
));
|
40 |
-
|
41 |
-
$fieldset->addField('filename', 'file', array(
|
42 |
-
'label' => Mage::helper('recsins')->__('File'),
|
43 |
-
'required' => false,
|
44 |
-
'name' => 'filename',
|
45 |
-
));
|
46 |
-
|
47 |
-
$fieldset->addField('status', 'select', array(
|
48 |
-
'label' => Mage::helper('recsins')->__('Status'),
|
49 |
-
'name' => 'status',
|
50 |
-
'values' => array(
|
51 |
-
array(
|
52 |
-
'value' => 1,
|
53 |
-
'label' => Mage::helper('recsins')->__('Enabled'),
|
54 |
-
),
|
55 |
-
array(
|
56 |
-
'value' => 2,
|
57 |
-
'label' => Mage::helper('recsins')->__('Disabled'),
|
58 |
-
),
|
59 |
-
),
|
60 |
-
));
|
61 |
-
|
62 |
-
$fieldset->addField('content', 'editor', array(
|
63 |
-
'name' => 'content',
|
64 |
-
'label' => Mage::helper('recsins')->__('Content'),
|
65 |
-
'title' => Mage::helper('recsins')->__('Content'),
|
66 |
-
'style' => 'width:700px; height:500px;',
|
67 |
-
'wysiwyg' => false,
|
68 |
-
'required' => true,
|
69 |
-
));
|
70 |
-
|
71 |
-
if (Mage::getSingleton('adminhtml/session')->getRecsinsData()) {
|
72 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getRecsinsData());
|
73 |
-
Mage::getSingleton('adminhtml/session')->setRecsinsData(null);
|
74 |
-
} elseif (Mage::registry('recsins_data')) {
|
75 |
-
$form->setValues(Mage::registry('recsins_data')->getData());
|
76 |
-
}
|
77 |
-
return parent::_prepareForm();
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Grid.php
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Brainsins_Recsins_Block_Adminhtml_Recsins_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
$this->setId('recsinsGrid');
|
9 |
-
$this->setDefaultSort('recsins_id');
|
10 |
-
$this->setDefaultDir('ASC');
|
11 |
-
$this->setSaveParametersInSession(true);
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _prepareCollection()
|
15 |
-
{
|
16 |
-
$collection = Mage::getModel('recsins/recsins')->getCollection();
|
17 |
-
$this->setCollection($collection);
|
18 |
-
return parent::_prepareCollection();
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function _prepareColumns()
|
22 |
-
{
|
23 |
-
$this->addColumn('recsins_id', array(
|
24 |
-
'header' => Mage::helper('recsins')->__('ID'),
|
25 |
-
'align' =>'right',
|
26 |
-
'width' => '50px',
|
27 |
-
'index' => 'recsins_id',
|
28 |
-
));
|
29 |
-
|
30 |
-
$this->addColumn('title', array(
|
31 |
-
'header' => Mage::helper('recsins')->__('Title'),
|
32 |
-
'align' =>'left',
|
33 |
-
'index' => 'title',
|
34 |
-
));
|
35 |
-
|
36 |
-
/*
|
37 |
-
$this->addColumn('content', array(
|
38 |
-
'header' => Mage::helper('recsins')->__('Item Content'),
|
39 |
-
'width' => '150px',
|
40 |
-
'index' => 'content',
|
41 |
-
));
|
42 |
-
*/
|
43 |
-
|
44 |
-
$this->addColumn('status', array(
|
45 |
-
'header' => Mage::helper('recsins')->__('Status'),
|
46 |
-
'align' => 'left',
|
47 |
-
'width' => '80px',
|
48 |
-
'index' => 'status',
|
49 |
-
'type' => 'options',
|
50 |
-
'options' => array(
|
51 |
-
1 => 'Enabled',
|
52 |
-
2 => 'Disabled',
|
53 |
-
),
|
54 |
-
));
|
55 |
-
|
56 |
-
$this->addColumn('action',
|
57 |
-
array(
|
58 |
-
'header' => Mage::helper('recsins')->__('Action'),
|
59 |
-
'width' => '100',
|
60 |
-
'type' => 'action',
|
61 |
-
'getter' => 'getId',
|
62 |
-
'actions' => array(
|
63 |
-
array(
|
64 |
-
'caption' => Mage::helper('recsins')->__('Edit'),
|
65 |
-
'url' => array('base'=> '*/*/edit'),
|
66 |
-
'field' => 'id'
|
67 |
-
)
|
68 |
-
),
|
69 |
-
'filter' => false,
|
70 |
-
'sortable' => false,
|
71 |
-
'index' => 'stores',
|
72 |
-
'is_system' => true,
|
73 |
-
));
|
74 |
-
|
75 |
-
$this->addExportType('*/*/exportCsv', Mage::helper('recsins')->__('CSV'));
|
76 |
-
$this->addExportType('*/*/exportXml', Mage::helper('recsins')->__('XML'));
|
77 |
-
|
78 |
-
return parent::_prepareColumns();
|
79 |
-
}
|
80 |
-
|
81 |
-
protected function _prepareMassaction()
|
82 |
-
{
|
83 |
-
$this->setMassactionIdField('recsins_id');
|
84 |
-
$this->getMassactionBlock()->setFormFieldName('recsins');
|
85 |
-
|
86 |
-
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
-
'label' => Mage::helper('recsins')->__('Delete'),
|
88 |
-
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
-
'confirm' => Mage::helper('recsins')->__('Are you sure?')
|
90 |
-
));
|
91 |
-
|
92 |
-
$statuses = Mage::getSingleton('recsins/status')->getOptionArray();
|
93 |
-
|
94 |
-
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
-
$this->getMassactionBlock()->addItem('status', array(
|
96 |
-
'label'=> Mage::helper('recsins')->__('Change status'),
|
97 |
-
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
-
'additional' => array(
|
99 |
-
'visibility' => array(
|
100 |
-
'name' => 'status',
|
101 |
-
'type' => 'select',
|
102 |
-
'class' => 'required-entry',
|
103 |
-
'label' => Mage::helper('recsins')->__('Status'),
|
104 |
-
'values' => $statuses
|
105 |
-
)
|
106 |
-
)
|
107 |
-
));
|
108 |
-
return $this;
|
109 |
-
}
|
110 |
-
|
111 |
-
public function getRowUrl($row)
|
112 |
-
{
|
113 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Checkout.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/* This file is part of BrainSINS' Magento Extension.
|
4 |
-
*
|
5 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
6 |
-
* and/or modify it under the terms of the GNU General Public License
|
7 |
-
* as published by the Free Software Foundation, either version 3 of the
|
8 |
-
* License, or (at your option) any later version.
|
9 |
-
*
|
10 |
-
* Foobar is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
*/
|
19 |
-
|
20 |
-
class Brainsins_Recsins_Block_Checkout extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface {
|
21 |
-
|
22 |
-
protected function _toHtml() {
|
23 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
24 |
-
if ($enabled !== '1') {
|
25 |
-
return "";
|
26 |
-
}
|
27 |
-
return "<div id='checkout_recommendations'></div>";
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Block/Recsins.php
DELETED
@@ -1,674 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* BrainSINS' Magento Extension is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with BrainSINS' Magento Extension. If not, see
|
22 |
-
* <http://www.gnu.org/licenses/>.
|
23 |
-
*
|
24 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
25 |
-
*
|
26 |
-
*/
|
27 |
-
|
28 |
-
/*
|
29 |
-
* This block is attached to the footer of all front-end pages
|
30 |
-
*/
|
31 |
-
|
32 |
-
class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
33 |
-
|
34 |
-
//private $dev = true;
|
35 |
-
private $dev = false;
|
36 |
-
|
37 |
-
protected function _construct() {
|
38 |
-
|
39 |
-
$userId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
40 |
-
|
41 |
-
if (!isset($userId) || !$userId) {
|
42 |
-
if (array_key_exists('coId', $_COOKIE)) {
|
43 |
-
$userId = $_COOKIE['coId'];
|
44 |
-
} else {
|
45 |
-
$userId = '0';
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
public function _prepareLayout() {
|
51 |
-
return parent::_prepareLayout();
|
52 |
-
}
|
53 |
-
|
54 |
-
public function _loadCache() {
|
55 |
-
//always force to reload cache
|
56 |
-
return false;
|
57 |
-
}
|
58 |
-
|
59 |
-
public function getRecsins() {
|
60 |
-
if (!$this->hasData('recsins')) {
|
61 |
-
$this->setData('recsins', Mage::registry('recsins'));
|
62 |
-
}
|
63 |
-
return $this->getData('recsins');
|
64 |
-
}
|
65 |
-
|
66 |
-
public function getUserId() {
|
67 |
-
|
68 |
-
$userId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
69 |
-
if (!isset($userId) || !$userId) {
|
70 |
-
if (array_key_exists('coId', $_COOKIE)) {
|
71 |
-
$userId = $_COOKIE['coId'];
|
72 |
-
} else {
|
73 |
-
$userId = '0';
|
74 |
-
}
|
75 |
-
}
|
76 |
-
return $userId ? $userId : '0';
|
77 |
-
}
|
78 |
-
|
79 |
-
public function getCustomerId() {
|
80 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
81 |
-
if (isset($customer)) {
|
82 |
-
return Mage::getSingleton('customer/session')->getCustomer()->getId();
|
83 |
-
} else {
|
84 |
-
return "";
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
public function getCustomerEmail() {
|
89 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
90 |
-
if (isset($customer)) {
|
91 |
-
return Mage::getSingleton('customer/session')->getCustomer()->getEmail();
|
92 |
-
} else {
|
93 |
-
return "";
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
private function getTrackerUrl() {
|
98 |
-
if ($this->dev) {
|
99 |
-
return "dev-tracker.brainsins.com";
|
100 |
-
} else {
|
101 |
-
return "tracker.brainsins.com";
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
private function getRecommenderUrl() {
|
106 |
-
if ($this->dev) {
|
107 |
-
return "dev-recommender.brainsins.com";
|
108 |
-
} else {
|
109 |
-
return "recommender.brainsins.com";
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
public function _toHtml() {
|
114 |
-
|
115 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
116 |
-
if ($enabled !== '1') {
|
117 |
-
return "";
|
118 |
-
}
|
119 |
-
|
120 |
-
$trackerUrl = $this->getTrackerUrl();
|
121 |
-
$recUrl = $this->getRecommenderUrl();
|
122 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
123 |
-
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
124 |
-
|
125 |
-
$recScript = "";
|
126 |
-
|
127 |
-
if (!isset($key) || !$key || $key == '') {
|
128 |
-
return "";
|
129 |
-
}
|
130 |
-
|
131 |
-
$html = "";
|
132 |
-
$url = Mage::helper('core/url')->getCurrentUrl();
|
133 |
-
|
134 |
-
$jscriptFilePath = Mage::getBaseDir() . "/js/brainsins/brainsins.js";
|
135 |
-
$customCssFilePath = Mage::getBAseDir() . "/js/brainsins/brainsins.css";
|
136 |
-
|
137 |
-
if (file_exists($jscriptFilePath)) {
|
138 |
-
$jscriptUrlPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . "brainsins/brainsins.js";
|
139 |
-
$html .= '<script type="text/javascript" src="' . $jscriptUrlPath . '"></script>' . PHP_EOL;
|
140 |
-
}
|
141 |
-
|
142 |
-
if (file_exists($customCssFilePath)) {
|
143 |
-
$cssUrlPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . "brainsins/brainsins.css";
|
144 |
-
|
145 |
-
$script = "<script type='text/javascript'>";
|
146 |
-
$script .= "var head = document.getElementsByTagName('head')[0];";
|
147 |
-
$script .= "var link = document.createElement('link');";
|
148 |
-
$script .= "link.rel = 'stylesheet';";
|
149 |
-
$script .= "link.type = 'text/css';";
|
150 |
-
$script .= "link.href = '" . $cssUrlPath . "';";
|
151 |
-
$script .= "link.media = 'all';";
|
152 |
-
$script .= "head.appendChild(link);";
|
153 |
-
$script .= "</script>";
|
154 |
-
$html .= $script;
|
155 |
-
}
|
156 |
-
|
157 |
-
//custom js file from config
|
158 |
-
|
159 |
-
$scriptUrl = "";
|
160 |
-
|
161 |
-
if (Mage::app()->getStore()->isCurrentlySecure()) {
|
162 |
-
$scriptUrl = Mage::getStoreConfig('brainsins/BS_SCRIPT_THTTPS_URL');
|
163 |
-
} else {
|
164 |
-
$scriptUrl = Mage::getStoreConfig('brainsins/BS_SCRIPT_URL');
|
165 |
-
}
|
166 |
-
|
167 |
-
if (isset($scriptUrl) && $scriptUrl != "") {
|
168 |
-
$html .= "<script type='text/javascript' src='" . $scriptUrl . "'></script>";
|
169 |
-
}
|
170 |
-
|
171 |
-
$html .= '<script type="text/javascript">';
|
172 |
-
$html .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
173 |
-
$html .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $trackerUrl . '/bstracker.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
174 |
-
$html .= "</script>";
|
175 |
-
|
176 |
-
|
177 |
-
//$html .= '<script type="text/javascript" src="' . $trackerUrl . '"></script>' . PHP_EOL;
|
178 |
-
$html .='<script type="text/javascript"> try{ var BrainSINSTracker = BrainSINS.getTracker( "' . $key . '");} catch (err) { }</script>' . PHP_EOL;
|
179 |
-
|
180 |
-
$recommendersSccript = '<script type="text/javascript" src="' . $recUrl . '">';
|
181 |
-
|
182 |
-
$page = Mage::app()->getFrontController()->getRequest()->getRouteName();
|
183 |
-
|
184 |
-
$script = "<script type='text/javascript'>" . PHP_EOL;
|
185 |
-
|
186 |
-
//captured events have set flags
|
187 |
-
|
188 |
-
$loginFlag = $session->getData("recsins_login");
|
189 |
-
$logoutFlag = $session->getData("recsins_logout");
|
190 |
-
$cartFlag = $session->getData("recsins_cart");
|
191 |
-
$checkoutSuccessFlag = $session->getData("recsins_checkout_success");
|
192 |
-
|
193 |
-
$isValidUl = array_key_exists('ul', $_COOKIE) && isset($_COOKIE['ul']) && $_COOKIE['ul'];
|
194 |
-
|
195 |
-
if ($this->getCustomerId() && (!$isValidUl || ($loginFlag && $loginFlag == '1'))) {
|
196 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
197 |
-
$isNewUser = Mage::getModel("recsins/recsins")->checkNewUser($customer, $this->getCustomerEmail());
|
198 |
-
|
199 |
-
if (!$isNewUser) {
|
200 |
-
$script .= "BrainSINSTracker.trackUserLoggedIn(" . $this->getCustomerId() . ");" . PHP_EOL;
|
201 |
-
}
|
202 |
-
// if it is a new user, login is performed automatically in the checkNewUser method
|
203 |
-
}
|
204 |
-
|
205 |
-
if (!$this->getCustomerId() && $isValidUl) {
|
206 |
-
$script .= "if (BrainSINSTracker.isLogged()) { BrainSINSTracker.trackUserLoggedOut();}" . PHP_EOL;
|
207 |
-
}
|
208 |
-
|
209 |
-
$userId = $this->getUserId();
|
210 |
-
|
211 |
-
//end captured events
|
212 |
-
|
213 |
-
$btPage = "any";
|
214 |
-
|
215 |
-
if ($page == 'cms') {
|
216 |
-
$pageId = Mage::getSingleton('cms/page')->getIdentifier();
|
217 |
-
$current_page = "cms->" . $pageId;
|
218 |
-
$url = Mage::helper('core/url')->getCurrentUrl();
|
219 |
-
|
220 |
-
if ($pageId == 'home') {
|
221 |
-
$btPage = "home";
|
222 |
-
$recScript = $this->getJSRecommendations('brainsins/BS_HOME_RECOMMENDER', 'home_recommendations', $userId, null);
|
223 |
-
}
|
224 |
-
} else if ($page == 'catalog') {
|
225 |
-
|
226 |
-
$product = Mage::registry('current_product');
|
227 |
-
$category = Mage::registry('current_category');
|
228 |
-
|
229 |
-
if (isset($product) && $product) {
|
230 |
-
$btPage = "product";
|
231 |
-
$productId = $product->getId();
|
232 |
-
$store = Mage::app()->getStore();
|
233 |
-
$url = $product->getUrlModel()->getUrl($product, array('_ignore_category' => true)) . "?___store=" . Mage::app()->getStore()->getCode();
|
234 |
-
|
235 |
-
$recScript = $this->getJSRecommendations('brainsins/BS_PRODUCT_RECOMMENDER', 'product_recommendations', $userId, $productId);
|
236 |
-
} else if(isset($category) && $category) {
|
237 |
-
$btPage = "category";
|
238 |
-
$categoryId = $category->getId();
|
239 |
-
$recScript = $this->getJSRecommendations('brainsins/BS_CATEGORY_RECOMMENDER', 'category_recommendations', $userId, $categoryId);
|
240 |
-
} else {
|
241 |
-
$current_page = "into catalog but no product nor category";
|
242 |
-
}
|
243 |
-
} else if ($page == "checkout" || $page == "gomage_checkout") {
|
244 |
-
$request = Mage::app()->getFrontController()->getRequest();
|
245 |
-
|
246 |
-
if ($request->getControllerName() == "cart") {
|
247 |
-
$btPage = "cart";
|
248 |
-
$recScript = $this->getJSRecommendations('brainsins/BS_CART_RECOMMENDER', 'cart_recommendations', $userId, null);
|
249 |
-
} else if ($request->getControllerName() == "onepage" || $request->getControllerName() == "multishipping") {
|
250 |
-
if ($request->getActionName() == "success") {
|
251 |
-
$btPage = "checkout";
|
252 |
-
$recScript = $this->getJSRecommendations('brainsins/BS_CHECKOUT_RECOMMENDER', 'checkout_recommendations', $userId, null);
|
253 |
-
}
|
254 |
-
}
|
255 |
-
}
|
256 |
-
|
257 |
-
//Set up page type for behavioural targeting
|
258 |
-
$script .= 'BrainSINSTracker.setPageType("' . $btPage . '");' . PHP_EOL;
|
259 |
-
|
260 |
-
//track page url
|
261 |
-
$product = Mage::registry('current_product');
|
262 |
-
if (isset($product) && $product) {
|
263 |
-
|
264 |
-
$pid = $product->getId();
|
265 |
-
$name = $product->getName();
|
266 |
-
$name = str_replace("\r\n", " ", $name);
|
267 |
-
$name = str_replace("\n", " ", $name);
|
268 |
-
$name = strip_tags($name);
|
269 |
-
$description = $product->getShortDescription();
|
270 |
-
$description = str_replace("\r\n", " ", $description);
|
271 |
-
$description = str_replace("\n", " ", $description);
|
272 |
-
$description = strip_tags($description);
|
273 |
-
|
274 |
-
$imageUrl = $product->getImageUrl();
|
275 |
-
$price = "";
|
276 |
-
|
277 |
-
$priceModel = $product->getPriceModel();
|
278 |
-
if (method_exists($priceModel, "getPrices")) {
|
279 |
-
$prices = $priceModel->getPrices($product);
|
280 |
-
if (is_array($prices) && isset($prices[0])) {
|
281 |
-
$price = $prices[0];
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
if ($price === "") {
|
286 |
-
if (method_exists($price, "getFinalPrice")) {
|
287 |
-
$price = $product->getFinalPrice();
|
288 |
-
if (!isset($price) || !$price) {
|
289 |
-
$price = $product->getPrice();
|
290 |
-
}
|
291 |
-
} else {
|
292 |
-
$price = $product->getPrice();
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
$categoryList = array();
|
297 |
-
$categoryIds = $product->getCategoryIds();
|
298 |
-
|
299 |
-
if (isset($categoryIds) && is_array($categoryIds)) {
|
300 |
-
foreach ($categoryIds as $catId) {
|
301 |
-
$category = Mage::getModel('catalog/category')->load($catId);
|
302 |
-
$parents = $category->getParentIds();
|
303 |
-
|
304 |
-
if (!in_array($catId, $categoryList)) {
|
305 |
-
if (is_numeric($catId)) {
|
306 |
-
$categoryList[] = $catId;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
if (isset($parents) && is_array($parents)) {
|
311 |
-
foreach ($parents as $parent) {
|
312 |
-
if (is_numeric($parent)) {
|
313 |
-
if (!in_array($parent, $categoryList)) {
|
314 |
-
$categoryList[] = $parent;
|
315 |
-
}
|
316 |
-
}
|
317 |
-
}
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
$categories = "";
|
323 |
-
|
324 |
-
foreach ($categoryList as $category) {
|
325 |
-
$categories .= $category . ",";
|
326 |
-
}
|
327 |
-
|
328 |
-
$typeId = $product->getTypeId();
|
329 |
-
if (isset($typeId) && $typeId == "grouped") {
|
330 |
-
$type = $product->getTypeInstance();
|
331 |
-
if (isset($type) && is_object($type)) {
|
332 |
-
if (method_exists($type, "getChildrenIds")) {
|
333 |
-
$ids = $type->getChildrenIds($product->getId());
|
334 |
-
if (isset($ids) && is_array($ids)) {
|
335 |
-
foreach($ids as $idsList) {
|
336 |
-
if (is_array($idsList)) {
|
337 |
-
foreach($idsList as $id) {
|
338 |
-
$pid .= "," . $id;
|
339 |
-
}
|
340 |
-
}
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
}
|
345 |
-
}
|
346 |
-
|
347 |
-
$script .= 'BrainSINSTracker.trackProductview("' . $pid . '");' . PHP_EOL;
|
348 |
-
$script .= "if (typeof BrainSINS != undefined) {" . PHP_EOL;
|
349 |
-
$script .= "BrainSINS.BrainsinsProductInfo = Object();" . PHP_EOL;
|
350 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.id = '" . utf8_encode(htmlspecialchars($pid, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
351 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.price = '" . utf8_encode(htmlspecialchars($price, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
352 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.name = '" . utf8_encode(htmlspecialchars($name, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
353 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.description = '" . utf8_encode(htmlspecialchars($description, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
354 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.imageUrl = '" . utf8_encode(htmlspecialchars($imageUrl, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
355 |
-
$script .= "try{BrainSINS.BrainsinsProductInfo.categories = '" . utf8_encode(htmlspecialchars($categories, ENT_QUOTES)) . "';}catch(err){}" . PHP_EOL;
|
356 |
-
$script .= "}" . PHP_EOL;
|
357 |
-
|
358 |
-
} else {
|
359 |
-
$script .= 'BrainSINSTracker.trackPageview("' . $url . '");' . PHP_EOL;
|
360 |
-
}
|
361 |
-
|
362 |
-
if ($cartFlag && $userId) {
|
363 |
-
$cart = Mage::helper('checkout/cart')->getCart();
|
364 |
-
$quote = $cart->getQuote();
|
365 |
-
$recsinsModel = Mage::getModel("recsins/recsins");
|
366 |
-
$cartUpload = $recsinsModel->uploadQuotes(array($quote), $userId);
|
367 |
-
}
|
368 |
-
|
369 |
-
if ($checkoutSuccessFlag && $userId) {
|
370 |
-
$recsinsModel = Mage::getModel("recsins/recsins");
|
371 |
-
$lastOrder = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
372 |
-
$recsinsModel->trackCheckoutBegin($userId);
|
373 |
-
$recsinsModel->trackCheckoutSuccess($lastOrder, $userId);
|
374 |
-
}
|
375 |
-
|
376 |
-
// reset flags
|
377 |
-
|
378 |
-
$session->setData("recsins_login", null);
|
379 |
-
$session->setData("recsins_logout", null);
|
380 |
-
$session->setData("recsins_cart", null);
|
381 |
-
$session->setData("recsins_checkout_success", null);
|
382 |
-
|
383 |
-
|
384 |
-
$script .= "</script>" . PHP_EOL;
|
385 |
-
|
386 |
-
$html .= $script;
|
387 |
-
|
388 |
-
if ($recScript !== "") {
|
389 |
-
$html .= $recScript;
|
390 |
-
}
|
391 |
-
|
392 |
-
return $html;
|
393 |
-
}
|
394 |
-
|
395 |
-
public function getAjaxRequestRecommendations($placeKey, $divId, $userId, $productId) {
|
396 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
397 |
-
|
398 |
-
$recommenderId = Mage::getStoreConfig($placeKey);
|
399 |
-
|
400 |
-
if (!isset($recommenderId) || !$recommenderId) {
|
401 |
-
return "";
|
402 |
-
}
|
403 |
-
|
404 |
-
if (!isset($productId)) {
|
405 |
-
$productId = 0;
|
406 |
-
}
|
407 |
-
|
408 |
-
//$prodId = $productId ? "'" . $productId . "'" : 'null';
|
409 |
-
|
410 |
-
$recUrl = $this->getRecommenderUrl();
|
411 |
-
|
412 |
-
$script = "";
|
413 |
-
$filter = '';
|
414 |
-
|
415 |
-
if (isset($key) && $key != null && isset($recommenderId)) {
|
416 |
-
|
417 |
-
$paintCallback = "null";
|
418 |
-
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
419 |
-
$paintCallback = "bsPaintHomeRecommendations";
|
420 |
-
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
421 |
-
$paintCallback = "bsPaintProductRecommendations";
|
422 |
-
} elseif ($placeKey == 'brainsins/BS_CART_RECOMMENDER') {
|
423 |
-
$paintCallback = "bsPaintCartRecommendations";
|
424 |
-
} elseif ($placeKey == 'brainsins/BS_CHECKOUT_RECOMMENDER') {
|
425 |
-
$paintCallback = "bsPaintCheckoutRecommendations";
|
426 |
-
} elseif ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
427 |
-
$paintCallback = "bsPaintCategoryRecommendations";
|
428 |
-
}
|
429 |
-
|
430 |
-
$script .= '<script type="text/javascript">' . PHP_EOL;
|
431 |
-
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
432 |
-
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
433 |
-
$script .= "</script>" . PHP_EOL;
|
434 |
-
|
435 |
-
$script .= '<script type="text/javascript">' . PHP_EOL;
|
436 |
-
$script .= 'var BrainSINSRecommender = BrainSINS.getRecommender(BrainSINSTracker);' . PHP_EOL;
|
437 |
-
$script .= 'BrainSINSRecommender.loadCSS(' . $recommenderId . ");" . PHP_EOL;
|
438 |
-
|
439 |
-
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
440 |
-
if (isset($useHighDetail) && $useHighDetail == "1") {
|
441 |
-
$script .= 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
442 |
-
}
|
443 |
-
|
444 |
-
|
445 |
-
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
|
446 |
-
|
447 |
-
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_SYMBOL");
|
448 |
-
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_POSITION");
|
449 |
-
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_DELIMITER");
|
450 |
-
|
451 |
-
if (isset($selectedSymbol) && $selectedSymbol) {
|
452 |
-
$currencySymbol = $selectedSymbol;
|
453 |
-
} else {
|
454 |
-
$currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
455 |
-
}
|
456 |
-
|
457 |
-
$currencyPosition = "curr_symb_right";
|
458 |
-
if (isset($selectedPosition) && ($selectedPosition == "curr_symb_left" || $selectedPosition == "curr_symb_right")) {
|
459 |
-
$currencyPosition = $selectedPosition;
|
460 |
-
}
|
461 |
-
|
462 |
-
$currencyDelimiter = ",";
|
463 |
-
if (isset($selectedDelimiter) && $selectedDelimiter) {
|
464 |
-
$currencyDelimiter = $selectedDelimiter;
|
465 |
-
}
|
466 |
-
|
467 |
-
if ($currencyPosition == "curr_symb_left") {
|
468 |
-
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
469 |
-
} else {
|
470 |
-
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.rightPosition );" . PHP_EOL;
|
471 |
-
}
|
472 |
-
$script .= "BrainSINSRecommender.setCurrencyDelimiter( '$currencyDelimiter' );" . PHP_EOL;
|
473 |
-
|
474 |
-
|
475 |
-
$currencyJs = "";
|
476 |
-
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
477 |
-
|
478 |
-
if ($currencySymbol == "$") {
|
479 |
-
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
480 |
-
} else if ($currencySymbol == "£") {
|
481 |
-
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
482 |
-
} else if ($currencySymbol == "€") {
|
483 |
-
//default behaviour
|
484 |
-
} else {
|
485 |
-
$script .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
486 |
-
}
|
487 |
-
|
488 |
-
$script .= "</script>" . PHP_EOL;
|
489 |
-
|
490 |
-
$script .= '<script type="text/javascript">' . PHP_EOL;
|
491 |
-
|
492 |
-
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
493 |
-
$pos = strpos($baseUrl, "/", 8);
|
494 |
-
$callUrl = "";
|
495 |
-
if ($pos !== false) {
|
496 |
-
$callUrl = substr($baseUrl, $pos);
|
497 |
-
$callUrl .= "recsins/index/getRecommendations";
|
498 |
-
} else {
|
499 |
-
$callUrl .= "/recsins/index/getRecommendations";
|
500 |
-
}
|
501 |
-
|
502 |
-
if ($placeKey != 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
503 |
-
$script .= 'var brainsins_filter_url = ""' . PHP_EOL;
|
504 |
-
$script.= 'if (typeof brainsins_filter != "undefined"){' . PHP_EOL;
|
505 |
-
$script .= 'brainsins_filter_url = "/categories/" + brainsins_filter + "/filter/all";';
|
506 |
-
$script .= '}' .PHP_EOL;
|
507 |
-
}
|
508 |
-
|
509 |
-
$script .= 'new Ajax.Request("' . $callUrl;
|
510 |
-
|
511 |
-
$script .= '/recId/' . $recommenderId;
|
512 |
-
$script .= '/userId/' . $userId;
|
513 |
-
|
514 |
-
if ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
515 |
-
$script .= '/categories/' . $productId;
|
516 |
-
$script .= '/filter/all';
|
517 |
-
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
518 |
-
$script .= '/prodId/' . $productId;
|
519 |
-
}
|
520 |
-
|
521 |
-
if ($placeKey != 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
522 |
-
$script .= '" + brainsins_filter_url + "';
|
523 |
-
}
|
524 |
-
|
525 |
-
$script .= '/lang/' . $langCode;
|
526 |
-
$script .= '/divName/' . $divId;
|
527 |
-
|
528 |
-
$script .= '",{';
|
529 |
-
$script .= 'method : "get",' . PHP_EOL;
|
530 |
-
$script .= 'onSuccess : function(transport) {' . PHP_EOL;
|
531 |
-
$script .= 'if (typeof ' . $paintCallback . ' == "function") {';
|
532 |
-
$script .= $paintCallback . "(transport.responseJSON);";
|
533 |
-
$script .= "} else {";
|
534 |
-
$script .= "BrainSINSRecommender.paintRecommendations(transport.responseJSON);";
|
535 |
-
$script .="}";
|
536 |
-
|
537 |
-
$script .= '}' . PHP_EOL;
|
538 |
-
$script .= '});' . PHP_EOL;
|
539 |
-
|
540 |
-
$script .= "</script>" . PHP_EOL;
|
541 |
-
}
|
542 |
-
|
543 |
-
return $script;
|
544 |
-
}
|
545 |
-
|
546 |
-
public function getJSRecommendations($placeKey, $divId, $userId, $productId) {
|
547 |
-
|
548 |
-
$useAjax = Mage::getStoreConfig('brainsins/BS_USE_AJAX_REQUESTS');
|
549 |
-
|
550 |
-
if (isset($useAjax) && $useAjax == "1") {
|
551 |
-
return $this->getAjaxRequestRecommendations($placeKey, $divId, $userId, $productId);
|
552 |
-
}
|
553 |
-
|
554 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
555 |
-
|
556 |
-
$recommenderId = Mage::getStoreConfig($placeKey);
|
557 |
-
|
558 |
-
if (!isset($recommenderId) || !$recommenderId) {
|
559 |
-
return "";
|
560 |
-
}
|
561 |
-
|
562 |
-
if (!isset($productId)) {
|
563 |
-
$productId = 0;
|
564 |
-
}
|
565 |
-
|
566 |
-
$prodId = $productId ? "'" . $productId . "'" : 'null';
|
567 |
-
|
568 |
-
$recUrl = $this->getRecommenderUrl();
|
569 |
-
|
570 |
-
$script = "";
|
571 |
-
$filter = '';
|
572 |
-
|
573 |
-
if (isset($key) && $key != null && isset($recommenderId)) {
|
574 |
-
|
575 |
-
$paintCallback = "null";
|
576 |
-
|
577 |
-
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
|
578 |
-
|
579 |
-
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_SYMBOL");
|
580 |
-
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_POSITION");
|
581 |
-
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_DELIMITER");
|
582 |
-
if (isset($selectedSymbol) && $selectedSymbol) {
|
583 |
-
$currencySymbol = $selectedSymbol;
|
584 |
-
} else {
|
585 |
-
$currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
586 |
-
}
|
587 |
-
|
588 |
-
$currencyPosition = "curr_symb_right";
|
589 |
-
if (isset($selectedPosition) && ($selectedPosition == "curr_symb_left" || $selectedPosition == "curr_symb_right")) {
|
590 |
-
$currencyPosition = $selectedPosition;
|
591 |
-
}
|
592 |
-
|
593 |
-
$currencyDelimiter = ",";
|
594 |
-
if (isset($selectedDelimiter) && $selectedDelimiter) {
|
595 |
-
$currencyDelimiter = $selectedDelimiter;
|
596 |
-
}
|
597 |
-
|
598 |
-
$currencyJs = "";
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
if ($currencyPosition == "curr_symb_left") {
|
603 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
604 |
-
} else {
|
605 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.rightPosition );" . PHP_EOL;
|
606 |
-
}
|
607 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencyDelimiter( '$currencyDelimiter' );" . PHP_EOL;
|
608 |
-
|
609 |
-
|
610 |
-
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
611 |
-
|
612 |
-
if ($currencySymbol == "$") {
|
613 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
614 |
-
} else if ($currencySymbol == "£") {
|
615 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
616 |
-
} else if ($currencySymbol == "€") {
|
617 |
-
//default behaviour
|
618 |
-
} else {
|
619 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
620 |
-
}
|
621 |
-
|
622 |
-
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
623 |
-
$paintCallback = "typeof bsPaintHomeRecommendations == 'undefined' ? null : bsPaintHomeRecommendations";
|
624 |
-
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
625 |
-
$paintCallback = "typeof bsPaintProductRecommendations == 'undefined' ? null : bsPaintProductRecommendations";
|
626 |
-
} elseif ($placeKey == 'brainsins/BS_CART_RECOMMENDER') {
|
627 |
-
$paintCallback = "typeof bsPaintCartRecommendations == 'undefined' ? null : bsPaintCartRecommendations";
|
628 |
-
} elseif ($placeKey == 'brainsins/BS_CHECKOUT_RECOMMENDER') {
|
629 |
-
$paintCallback = "typeof bsPaintCheckoutRecommendations == 'undefined' ? null : bsPaintCheckoutRecommendations";
|
630 |
-
} elseif ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
631 |
-
$paintCallback = "typeof bsPaintCategoryRecommendations == 'undefined' ? null : bsPaintCategoryRecommendations";
|
632 |
-
//category id is passed in the product id parameter
|
633 |
-
$categoryId = $productId;
|
634 |
-
$filter = 'BrainSINSRecommender.setFilterCategories( "' . $categoryId . '" );' . PHP_EOL;
|
635 |
-
$filter .= 'BrainSINSRecommender.setFilter(BrainSINS.RecommenderConstants.all);';
|
636 |
-
}
|
637 |
-
|
638 |
-
if ($placeKey != 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
639 |
-
$filter .= 'if (typeof brainsins_filter != "undefined"){' . PHP_EOL;
|
640 |
-
$filter .= 'BrainSINSRecommender.setFilterCategories( brainsins_filter );' . PHP_EOL;
|
641 |
-
$filter .= 'BrainSINSRecommender.setFilter(BrainSINS.RecommenderConstants.all);' . PHP_EOL;
|
642 |
-
$filter .= '}' . PHP_EOL;
|
643 |
-
}
|
644 |
-
|
645 |
-
|
646 |
-
$script .= '<script type="text/javascript">' . PHP_EOL;
|
647 |
-
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
648 |
-
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
649 |
-
$script .= "</script>" . PHP_EOL;
|
650 |
-
|
651 |
-
$useHighDetailScript = "";
|
652 |
-
|
653 |
-
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
654 |
-
if (isset($useHighDetail) && $useHighDetail == "1") {
|
655 |
-
$useHighDetailScript = 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
656 |
-
}
|
657 |
-
|
658 |
-
$script .= '
|
659 |
-
<script type="text/javascript">
|
660 |
-
try{
|
661 |
-
BrainSINSTracker.setCustomAttribute("currencySymbol", "' . $currencySymbol . '");
|
662 |
-
var BrainSINSRecommender = BrainSINS.getRecommender( BrainSINSTracker );
|
663 |
-
' . $filter . '
|
664 |
-
' . $currencyJs . '
|
665 |
-
' . $useHighDetailScript .'
|
666 |
-
BrainSINSRecommender.loadWidget("' . $recommenderId . '",' . $prodId . ',"' . $langCode . '","' . $divId . '", null,' . $paintCallback . ');
|
667 |
-
}catch(err) { }
|
668 |
-
</script>
|
669 |
-
';
|
670 |
-
}
|
671 |
-
|
672 |
-
return $script;
|
673 |
-
}
|
674 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/COPYING.txt
DELETED
@@ -1,674 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
<one line to give the program's name and a brief idea of what it does.>
|
635 |
-
Copyright (C) <year> <name of author>
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
<program> Copyright (C) <year> <name of author>
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<http://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
-
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Entity/Setup.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Helper/Recsins.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Helper_Recsins extends Mage_Core_Helper_Abstract {
|
28 |
-
|
29 |
-
public function getImageUrl($id) {
|
30 |
-
if (isset($id) && $id) {
|
31 |
-
$product = Mage::getModel("catalog/product")->load($id);
|
32 |
-
if (isset($product)) {
|
33 |
-
$imageSelectedOption = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE');
|
34 |
-
if (isset($imageSelectedOption) && $imageSelectedOption == 'image_resize') {
|
35 |
-
|
36 |
-
$width = 0;
|
37 |
-
$heigth = 0;
|
38 |
-
|
39 |
-
$imageSelectedWidth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_WIDTH');
|
40 |
-
$imageSelectedHeigth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH');
|
41 |
-
|
42 |
-
if (isset($imageSelectedWidth) && is_numeric($imageSelectedWidth) && $imageSelectedWidth > 0) {
|
43 |
-
$width = $imageSelectedWidth;
|
44 |
-
$url = "";
|
45 |
-
|
46 |
-
if (isset($imageSelectedHeigth) && is_numeric($imageSelectedHeigth) && $imageSelectedHeigth > 0) {
|
47 |
-
$heigth = $imageSelectedHeigth;
|
48 |
-
$url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $heigth);
|
49 |
-
} else {
|
50 |
-
$url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width);
|
51 |
-
}
|
52 |
-
return $url;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
$prodImage = $product->getSmallImage();
|
57 |
-
if (isset($prodImage) && $prodImage != null && $prodImage != "no_selection") {
|
58 |
-
return ((string) Mage::helper('catalog/image')->init($product, "small_image"));
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
return false;
|
63 |
-
}
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Model/Api/Api.php
DELETED
@@ -1,284 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Api_Api extends Mage_Api_Model_Resource_Abstract {
|
28 |
-
|
29 |
-
public function test($param) {
|
30 |
-
return array("text" => "hey, i was invoked and i return something! like " . $param);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function storeList() {
|
34 |
-
$stores = Mage::app()->getStore()->getCollection();
|
35 |
-
$result = array();
|
36 |
-
foreach($stores as $store) {
|
37 |
-
$result[$store->getId()] = array("id" => $store->getId(), "code" => $store->getCode());
|
38 |
-
}
|
39 |
-
return $result;
|
40 |
-
}
|
41 |
-
|
42 |
-
public function currencyList() {
|
43 |
-
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
44 |
-
return $currencies;
|
45 |
-
}
|
46 |
-
|
47 |
-
public function productInfo($productId, $store = null, $options = array(), $filter = array()) {
|
48 |
-
|
49 |
-
$productsApi = new Brainsins_Recsins_Model_Api_ProductsApi();
|
50 |
-
|
51 |
-
return ($productsApi->bsInfo($productId, $store));
|
52 |
-
}
|
53 |
-
|
54 |
-
public function productCount($options = array()) {
|
55 |
-
|
56 |
-
if (array_key_exists("skipStatusFilter", $options) && $options['skipStatusFilter'] == "1") {
|
57 |
-
return array(Mage::getModel("catalog/product")->getCollection()
|
58 |
-
->count());
|
59 |
-
} else {
|
60 |
-
return array(Mage::getModel("catalog/product")->getCollection()
|
61 |
-
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
62 |
-
->count());
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
public function productPage($numPage, $size, $visibility = 2, $options = array(), $filter = array()) {
|
67 |
-
|
68 |
-
$visibility = 2;
|
69 |
-
$visibilityComparator = "ge";
|
70 |
-
|
71 |
-
if (array_key_exists("visibility", $options)) {
|
72 |
-
$visibility = $options["visibility"];
|
73 |
-
}
|
74 |
-
|
75 |
-
if (array_key_exists("visibilityComparator", $options)) {
|
76 |
-
$visibilityComparator = $options["visibilityComparator"];
|
77 |
-
}
|
78 |
-
|
79 |
-
$products = array();
|
80 |
-
if (array_key_exists("skipStatusFilter", $options) && $options['skipStatusFilter'] == "1") {
|
81 |
-
$products = Mage::getModel('catalog/product')->getCollection()
|
82 |
-
->addAttributeToSelect('id')->
|
83 |
-
addAttributeToSelect('visibility')->
|
84 |
-
addAttributeToSelect('store_ids')->
|
85 |
-
setPage($numPage, $size);
|
86 |
-
} else {
|
87 |
-
$products = Mage::getModel('catalog/product')->getCollection()
|
88 |
-
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
89 |
-
->addAttributeToSelect('id')->
|
90 |
-
addAttributeToSelect('visibility')->
|
91 |
-
addAttributeToSelect('store_ids')->
|
92 |
-
setPage($numPage, $size);
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
$result = array();
|
98 |
-
$productsApi = new Brainsins_Recsins_Model_Api_ProductsApi();
|
99 |
-
|
100 |
-
foreach($products as $product) {
|
101 |
-
$id = $product->getId();
|
102 |
-
$prodVisibility = $product->getVisibility();
|
103 |
-
|
104 |
-
if (
|
105 |
-
$visibilityComparator == "eq" && $prodVisibility == $visibility ||
|
106 |
-
$visibilityComparator == "ne" && $prodVisibility != $visibility ||
|
107 |
-
$visibilityComparator == "gt" && $prodVisibility > $visibility ||
|
108 |
-
$visibilityComparator == "ge" && $prodVisibility >= $visibility ||
|
109 |
-
$visibilityComparator == "lt" && $prodVisibility < $visibility ||
|
110 |
-
$visibilityComparator == "le" && $prodVisibility <= $visibility
|
111 |
-
) {
|
112 |
-
$stores = $product->getStoreIds();
|
113 |
-
|
114 |
-
if (isset($stores) && is_array($stores)) {
|
115 |
-
$result[$id] = array();
|
116 |
-
|
117 |
-
foreach($stores as $storeId) {
|
118 |
-
$product->setStoreId($storeId);
|
119 |
-
$prodInfo = $productsApi->bsInfo($id, $storeId, $options, $filter);
|
120 |
-
$result[$id][$storeId] = $prodInfo;
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
return $result;
|
126 |
-
}
|
127 |
-
|
128 |
-
public function userCount() {
|
129 |
-
return array(Mage::getModel("customer/customer")->getCollection()->count());
|
130 |
-
}
|
131 |
-
|
132 |
-
public function userPage($numPage, $size) {
|
133 |
-
$customers = Mage::getModel("customer/customer")->getCollection()->setPage($numPage, $size);
|
134 |
-
$result = array();
|
135 |
-
|
136 |
-
foreach($customers as $customer) {
|
137 |
-
$customerInfo = array();
|
138 |
-
$customerInfo['id'] = $customer->getId();
|
139 |
-
|
140 |
-
$subscriber = Mage::getModel("newsletter/subscriber");
|
141 |
-
$subscriber->loadByCustomer($customer);
|
142 |
-
|
143 |
-
$email = $customer->getEmail();
|
144 |
-
$subscribed = "0";
|
145 |
-
if ($subscriber->isSubscribed()) {
|
146 |
-
$subscribed = "1";
|
147 |
-
}
|
148 |
-
|
149 |
-
$customerInfo['email'] = $email;
|
150 |
-
$customerInfo['bs_lang_code'] = Mage::app()->getStore($customer->getStoreId())->getCode();
|
151 |
-
$customerInfo['bs_is_subscribed'] = $subscribed;
|
152 |
-
$result[] = $customerInfo;
|
153 |
-
}
|
154 |
-
|
155 |
-
return $result;
|
156 |
-
}
|
157 |
-
|
158 |
-
public function getExtensionOptions() {
|
159 |
-
|
160 |
-
$result = array();
|
161 |
-
|
162 |
-
$version = Mage::getStoreConfig('brainsins/BS_VERSION');
|
163 |
-
|
164 |
-
if (isset($version)) {
|
165 |
-
$result['version'] = $version;
|
166 |
-
} else {
|
167 |
-
$result['version'] = "0";
|
168 |
-
}
|
169 |
-
|
170 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
171 |
-
|
172 |
-
if (isset($key)) {
|
173 |
-
$result['key'] = $key;
|
174 |
-
} else {
|
175 |
-
$result['key'] = "0";
|
176 |
-
}
|
177 |
-
|
178 |
-
$enabledValue = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
179 |
-
|
180 |
-
if (isset($enabledValue)) {
|
181 |
-
$result['enabled'] = $enabledValue;
|
182 |
-
} else {
|
183 |
-
$result['enabled'] = "0";
|
184 |
-
}
|
185 |
-
|
186 |
-
$homeSelected = Mage::getStoreConfig('brainsins/BS_HOME_RECOMMENDER');
|
187 |
-
|
188 |
-
if (isset($homeSelected)) {
|
189 |
-
$result['home_recommender'] = $homeSelected;
|
190 |
-
} else {
|
191 |
-
$result['home_recommender'] = "0";
|
192 |
-
}
|
193 |
-
|
194 |
-
$categorySelected = Mage::getStoreConfig('brainsins/BS_CATEGORY_RECOMMENDER');
|
195 |
-
|
196 |
-
if (isset($categorySelected)) {
|
197 |
-
$result['category_recommender'] = $categorySelected;
|
198 |
-
} else {
|
199 |
-
$result['category_recommender'] = "0";
|
200 |
-
}
|
201 |
-
|
202 |
-
$productSelected = Mage::getStoreConfig('brainsins/BS_PRODUCT_RECOMMENDER');
|
203 |
-
|
204 |
-
if (isset($productSelected)) {
|
205 |
-
$result['product_recommender'] = $productSelected;
|
206 |
-
} else {
|
207 |
-
$result['product_recommender'] = "0";
|
208 |
-
}
|
209 |
-
|
210 |
-
|
211 |
-
$cartSelected = Mage::getStoreConfig('brainsins/BS_CART_RECOMMENDER');
|
212 |
-
|
213 |
-
if (isset($cartSelected)) {
|
214 |
-
$result['cart_recommender'] = $cartSelected;
|
215 |
-
} else {
|
216 |
-
$result['cart_recommender'] = "0";
|
217 |
-
}
|
218 |
-
|
219 |
-
$checkoutSelected = Mage::getStoreConfig('brainsins/BS_CHECKOUT_RECOMMENDER');
|
220 |
-
|
221 |
-
if (isset($checkoutSelected)) {
|
222 |
-
$result['checkout_recommender'] = $checkoutSelected;
|
223 |
-
} else {
|
224 |
-
$result['checkout_recommender'] = "0";
|
225 |
-
}
|
226 |
-
|
227 |
-
|
228 |
-
$outOfStockSelected = Mage::getStoreConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS');
|
229 |
-
|
230 |
-
if (isset($outOfStockSelected)) {
|
231 |
-
$result['upload_out_of_stock'] = $outOfStockSelected;
|
232 |
-
} else {
|
233 |
-
$result['upload_out_of_stock'] = "0";
|
234 |
-
}
|
235 |
-
|
236 |
-
$imageSelectedOption = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE');
|
237 |
-
|
238 |
-
if (isset($imageSelectedOption)) {
|
239 |
-
$result['image_option'] = $imageSelectedOption;
|
240 |
-
} else {
|
241 |
-
$result['image_option'] = "image_no_resize";
|
242 |
-
}
|
243 |
-
|
244 |
-
$imageSelectedWidth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_WIDTH');
|
245 |
-
|
246 |
-
if (isset($imageSelectedWidth)) {
|
247 |
-
$result['image_resize_width'] = $imageSelectedWidth;
|
248 |
-
} else {
|
249 |
-
$result['image_resize_width'] = "0";
|
250 |
-
}
|
251 |
-
|
252 |
-
$imageSelectedHeigth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH');
|
253 |
-
|
254 |
-
if (isset($imageSelectedHeigth)) {
|
255 |
-
$result['image_resize_heigth'] = $imageSelectedHeigth;
|
256 |
-
} else {
|
257 |
-
$result['image_resize_heigth'] = "0";
|
258 |
-
}
|
259 |
-
|
260 |
-
$specialPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_USE_SPECIAL_PRICE');
|
261 |
-
|
262 |
-
if (isset($specialPriceSelectedOption)) {
|
263 |
-
$result['use_special_price'] = $specialPriceSelectedOption;
|
264 |
-
} else {
|
265 |
-
$result['use_special_price'] = "0";
|
266 |
-
}
|
267 |
-
|
268 |
-
$taxPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_TAX_PRICE');
|
269 |
-
|
270 |
-
if (isset($taxPriceSelectedOption)) {
|
271 |
-
$result['tax_price'] = $taxPriceSelectedOption;
|
272 |
-
} else {
|
273 |
-
$result['tax_price'] = "tax_price_equal";
|
274 |
-
}
|
275 |
-
|
276 |
-
return $result;
|
277 |
-
}
|
278 |
-
|
279 |
-
public function notifyVersion($version) {
|
280 |
-
if (isset ($version)) {
|
281 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_LAST_AVAILABLE_VERSION', $version);
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Api/ProductsApi.php
DELETED
@@ -1,328 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Api_ProductsApi extends Mage_Catalog_Model_Product_Api {
|
28 |
-
|
29 |
-
|
30 |
-
protected function _getProduct($productId, $storeId = null, $identifierType = null)
|
31 |
-
{
|
32 |
-
$product = Mage::getModel('catalog/product');
|
33 |
-
|
34 |
-
if (isset($storeId) && $storeId != null) {
|
35 |
-
$product->setStoreId($storeId);
|
36 |
-
}
|
37 |
-
|
38 |
-
$product->load($productId);
|
39 |
-
return $product;
|
40 |
-
}
|
41 |
-
|
42 |
-
protected function _getRealImageUrl($product, $store) {
|
43 |
-
$prodImage = $product->getSmallImage();
|
44 |
-
|
45 |
-
$img = Mage::getModel("catalog/product_image");
|
46 |
-
$img->setDestinationSubdir("small_image");
|
47 |
-
$img->setBaseFile($prodImage);
|
48 |
-
|
49 |
-
$baseDir = Mage::getBaseDir('media');
|
50 |
-
$path = str_replace($baseDir . DS, "", $img->getBaseFile());
|
51 |
-
return $store->getBaseUrl('media') . str_replace(DS, '/', $path) ;
|
52 |
-
}
|
53 |
-
|
54 |
-
protected function _getResizedImageUrl($product) {
|
55 |
-
|
56 |
-
$width = 0;
|
57 |
-
$heigth = 0;
|
58 |
-
|
59 |
-
$imageSelectedOption = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE');
|
60 |
-
if (isset($imageSelectedOption) && $imageSelectedOption == 'image_resize') {
|
61 |
-
|
62 |
-
$imageSelectedWidth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_WIDTH');
|
63 |
-
$imageSelectedHeigth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH');
|
64 |
-
|
65 |
-
if (isset($imageSelectedWidth) && is_numeric($imageSelectedWidth) && $imageSelectedWidth > 0) {
|
66 |
-
$width = $imageSelectedWidth;
|
67 |
-
if (isset($imageSelectedHeigth) && is_numeric($imageSelectedHeigth) && $imageSelectedHeigth > 0) {
|
68 |
-
$heigth = $imageSelectedHeigth;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
$url = (string) Mage::helper('catalog/image')->init($product, "small_image");
|
74 |
-
|
75 |
-
if (isset ($width) && is_numeric($width) && $width > 0) {
|
76 |
-
if (isset($heigth) && is_numeric($heigth) && $heigth > 0) {
|
77 |
-
$url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $heigth);
|
78 |
-
} else {
|
79 |
-
$url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
return $url;
|
84 |
-
}
|
85 |
-
|
86 |
-
private function checkOption($option, $options) {
|
87 |
-
return array_key_exists($option, $options) && $options[$option] == "1";
|
88 |
-
}
|
89 |
-
|
90 |
-
private function _getGalleryImageUrls($id) {
|
91 |
-
|
92 |
-
$result = array();
|
93 |
-
|
94 |
-
$gallery = Mage::getModel('catalog/product')->load($id)->getMediaGalleryImages();
|
95 |
-
$count = Mage::getModel('catalog/product')->load($id)->getMediaGalleryImages()->count();
|
96 |
-
foreach($gallery as $image) {
|
97 |
-
$result[] = $image->getUrl();
|
98 |
-
}
|
99 |
-
|
100 |
-
return $result;
|
101 |
-
}
|
102 |
-
|
103 |
-
public function info($productId, $storeId = null, $options = array(), $filter = array())
|
104 |
-
{
|
105 |
-
$product = $this->_getProduct($productId, $storeId, $identifierType);
|
106 |
-
$store = Mage::app()->getStore($storeId);
|
107 |
-
|
108 |
-
if (!$product->getId()) {
|
109 |
-
$this->_fault('not_exists');
|
110 |
-
}
|
111 |
-
|
112 |
-
$result = array( // Basic product data
|
113 |
-
'product_id' => $product->getId(),
|
114 |
-
'sku' => $product->getSku(),
|
115 |
-
'set' => $product->getAttributeSetId(),
|
116 |
-
'type' => $product->getTypeId(),
|
117 |
-
'categories' => $product->getCategoryIds(),
|
118 |
-
'websites' => $product->getWebsiteIds()
|
119 |
-
);
|
120 |
-
|
121 |
-
foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
|
122 |
-
if ($this->_isAllowedAttribute($attribute, $attributes) && !in_array($attribute->getAttributeCode(), $filter)) {
|
123 |
-
$result[$attribute->getAttributeCode()] = $product->getData(
|
124 |
-
$attribute->getAttributeCode());
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
//option dependent values. Every non-standard value starts with bs_
|
129 |
-
|
130 |
-
if ($this->checkOption("getPricesInStoreCurrency", $options)) {
|
131 |
-
$result["bs_currency_final_price"] = $store->getBaseCurrency()->convert($product->getFinalPrice(), $store->getCurrentCurrencyCode());
|
132 |
-
$result["bs_currency_special_price"] = $store->getBaseCurrency()->convert($product->getSpecialPrice(), $store->getCurrentCurrencyCode());
|
133 |
-
$result["bs_currency_price"] = $store->getBaseCurrency()->convert($product->getPrice(), $store->getCurrentCurrencyCode());
|
134 |
-
|
135 |
-
$price = $store->getBaseCurrency()->convert($product->getPrice(), $store->getCurrentCurrencyCode());
|
136 |
-
$specialPrice = $store->getBaseCurrency()->convert($product->getSpecialPrice(), $store->getCurrentCurrencyCode());
|
137 |
-
|
138 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $price, true, null, null, null, $store, false);
|
139 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $price, false, null, null, null, $store, true);
|
140 |
-
$plusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, true, null, null, null, $store, false);
|
141 |
-
$minusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, false, null, null, null, $store, true);
|
142 |
-
|
143 |
-
$result['bs_price_currency_plus_tax'] = $plusTaxPrice;
|
144 |
-
$result['bs_price_currency_minus_tax'] = $minusTaxPrice;
|
145 |
-
$result['bs_special_currency_price_plus_tax'] = $plusTaxSpecialPrice;
|
146 |
-
$result['bs_special_currency_price_minus_tax'] = $minusTaxSpecialPrice;
|
147 |
-
}
|
148 |
-
|
149 |
-
if ($this->checkOption("getConversionRates", $options)) {
|
150 |
-
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
151 |
-
$currencyRates = array();
|
152 |
-
foreach($currencies as $currency) {
|
153 |
-
$currencyRates[$currency] = $store->getBaseCurrency()->getRate($currency);
|
154 |
-
}
|
155 |
-
$result['bs_currency_rates'] = $currencyRates;
|
156 |
-
} else {
|
157 |
-
$result['options'] = $options;
|
158 |
-
}
|
159 |
-
|
160 |
-
if ($this->checkOption("getAllImages", $options)) {
|
161 |
-
//add images and url info (store dependent)
|
162 |
-
$prodCachedImageUrl = (string)Mage::helper('catalog/image')->init($product, "small_image");
|
163 |
-
$prodImageUrl = $this->_getRealImageUrl($product, $store);
|
164 |
-
$imageControllerUrl = $store->getBaseUrl() . "recsins/index/getRecProdImg?id=" . $product->getId();
|
165 |
-
|
166 |
-
$result['bs_cached_image'] = $prodCachedImageUrl;
|
167 |
-
$result['bs_real_image'] = $prodImageUrl;
|
168 |
-
$result['bs_controller_image'] = $imageControllerUrl;
|
169 |
-
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
if ($this->checkOption("getResizedImageUrls", $options)) {
|
174 |
-
$result['bs_resized_image'] = $this->_getResizedImageUrl($product);
|
175 |
-
}
|
176 |
-
|
177 |
-
if ($this->checkOption("getMinimalPrices", $options)) {
|
178 |
-
$minPrice = 0;
|
179 |
-
|
180 |
-
if ($product->getTypeId() == "bundle") {
|
181 |
-
list($minPrice, $maxPrice) = $product->getPriceModel()->getPrices($product);
|
182 |
-
if (isset($minPrice)) {
|
183 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $minPrice, true, null, null, null, $store, false);
|
184 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $minPrice, false, null, null, null, $store, true);
|
185 |
-
$result['bs_min_price'] = $minPrice;
|
186 |
-
$result['bs_min_price_plus_tax'] = $plusTaxPrice;
|
187 |
-
$result['bs_min_price_minus_tax'] = $minusTaxPrice;
|
188 |
-
} else {
|
189 |
-
$result['bs_min_price'] = 0;
|
190 |
-
$result['bs_min_price_plus_tax'] = 0;
|
191 |
-
$result['bs_min_price_minus_tax'] = 0;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
if ($this->checkOption("getUrl", $options)) {
|
197 |
-
$url = $store->getBaseUrl() . $product->getUrlPath();
|
198 |
-
|
199 |
-
$result['bs_product_url'] = $url;//$product->getProductUrl();
|
200 |
-
}
|
201 |
-
|
202 |
-
if ($this->checkOption("getTags", $options)) {
|
203 |
-
$tags = Mage::getModel("tag/tag")->getResourceCollection()
|
204 |
-
->joinRel()
|
205 |
-
->addProductFilter($productId)
|
206 |
-
->addTagGroup()
|
207 |
-
->load();
|
208 |
-
|
209 |
-
$result['tags'] = array();
|
210 |
-
foreach($tags as $tag) {
|
211 |
-
$result['bs_tags'][] = $tag->getName();
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
if ($this->checkOption("getManufacter", $options)) {
|
216 |
-
$result['bs_manufacter_name'] = $product->getAttributeText('manufacturer');
|
217 |
-
}
|
218 |
-
|
219 |
-
if ($this->checkOption("getTaxedPrices", $options)) {
|
220 |
-
$price = $minPrice == 0 ? $product->getPrice() : $minPrice;
|
221 |
-
$specialPrice = 0;
|
222 |
-
|
223 |
-
$specialPrice = $product->getSpecialPrice();
|
224 |
-
if (!isset($specialPrice) || $specialPrice == null) {
|
225 |
-
$specialPrice = 0;
|
226 |
-
}
|
227 |
-
|
228 |
-
$store = Mage::app()->getStore($storeId);
|
229 |
-
|
230 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $price, true, null, null, null, $store, false);
|
231 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $price, false, null, null, null, $store, true);
|
232 |
-
$plusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, true, null, null, null, $store, false);
|
233 |
-
$minusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, false, null, null, null, $store, true);
|
234 |
-
|
235 |
-
$result['bs_price_plus_tax'] = $plusTaxPrice;
|
236 |
-
$result['bs_price_minus_tax'] = $minusTaxPrice;
|
237 |
-
$result['bs_special_price_plus_tax'] = $plusTaxSpecialPrice;
|
238 |
-
$result['bs_special_price_minus_tax'] = $minusTaxSpecialPrice;
|
239 |
-
}
|
240 |
-
|
241 |
-
if ($this->checkOption("getChildrenStock", $options)) {
|
242 |
-
if ($product->getTypeId() == "configurable") {
|
243 |
-
//sometimes "salable" attribute is not good enought to determine wether a configurable product
|
244 |
-
//is out of stock. Just iterate through all the sub-products and check their stock status.
|
245 |
-
$inStock = false;
|
246 |
-
$children = $product->getTypeInstance()->getUsedProducts();
|
247 |
-
foreach($children as $child) {
|
248 |
-
$inStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($child)->getIs_in_stock() == "1";
|
249 |
-
if ($inStock) {
|
250 |
-
break;
|
251 |
-
}
|
252 |
-
}
|
253 |
-
|
254 |
-
$result['bs_configurable_in_stock'] = $inStock ? "1" : "0";
|
255 |
-
} else {
|
256 |
-
//returns a value, but should not be used as product is not configurable
|
257 |
-
$result['bs_configurable_in_stock'] = "0";
|
258 |
-
}
|
259 |
-
}
|
260 |
-
|
261 |
-
if ($this->checkOption("getStock", $options)) {
|
262 |
-
$result['bs_in_stock'] = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getIs_in_stock() !== '0' ? "1" : "0";
|
263 |
-
}
|
264 |
-
|
265 |
-
if ($this->checkOption("getSalable", $options)) {
|
266 |
-
if (method_exists($product, "isAvailable")) {
|
267 |
-
$result['bs_is_salable'] = $product->isAvailable() ? "1" : "0";
|
268 |
-
} else if (method_exists($product, "isSalable")) {
|
269 |
-
$result['bs_is_salable'] = $product->isSalable() ? "1" : "0";
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
if ($this->checkOption("getVisibility", $options)) {
|
274 |
-
$visibility = $product->getVisibility();
|
275 |
-
$result["bs_visibility"] = $visibility;
|
276 |
-
}
|
277 |
-
|
278 |
-
if ($this->checkOption("getFullGallery", $options)) {
|
279 |
-
$galleryUrls = $this->_getGalleryImageUrls($productId);
|
280 |
-
$result["bs_gallery_images"] = $galleryUrls;
|
281 |
-
}
|
282 |
-
|
283 |
-
return $result;
|
284 |
-
}
|
285 |
-
|
286 |
-
public function bsInfo($productId, $storeId, $options = array(), $filter = array()) {
|
287 |
-
|
288 |
-
$result = $this->info($productId, $storeId, $options, $filter);
|
289 |
-
return $result;
|
290 |
-
}
|
291 |
-
|
292 |
-
public function items($filters = null, $store = null)
|
293 |
-
{
|
294 |
-
$collection = Mage::getModel('catalog/product')->getCollection()
|
295 |
-
->addStoreFilter($this->_getStoreId($store))
|
296 |
-
->addAttributeToSelect('name')->addAttributeToSelect('visibility');
|
297 |
-
|
298 |
-
if (is_array($filters)) {
|
299 |
-
try {
|
300 |
-
foreach ($filters as $field => $value) {
|
301 |
-
if (isset($this->_filtersMap[$field])) {
|
302 |
-
$field = $this->_filtersMap[$field];
|
303 |
-
}
|
304 |
-
|
305 |
-
$collection->addFieldToFilter($field, $value);
|
306 |
-
}
|
307 |
-
} catch (Mage_Core_Exception $e) {
|
308 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
309 |
-
}
|
310 |
-
}
|
311 |
-
|
312 |
-
$result = array();
|
313 |
-
|
314 |
-
foreach ($collection as $product) {
|
315 |
-
// $result[] = $product->getData();
|
316 |
-
$result[] = array( // Basic product data
|
317 |
-
'product_id' => $product->getId(),
|
318 |
-
'sku' => $product->getSku(),
|
319 |
-
'name' => $product->getName(),
|
320 |
-
'set' => $product->getAttributeSetId(),
|
321 |
-
'type' => $product->getTypeId(),
|
322 |
-
'category_ids' => $product->getCategoryIds(),
|
323 |
-
'visibility' => $product->getVisibility()
|
324 |
-
);
|
325 |
-
}
|
326 |
-
return $result;
|
327 |
-
}
|
328 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Cart.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Cart extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
}
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/CartProduct.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_CartProduct extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
}
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Client.php
DELETED
@@ -1,592 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Client extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
private $products;
|
30 |
-
private $users;
|
31 |
-
private $orders;
|
32 |
-
private $carts;
|
33 |
-
private $storeKey;
|
34 |
-
private $server;
|
35 |
-
|
36 |
-
protected function _construct() {
|
37 |
-
$this->products = array();
|
38 |
-
$this->users = array();
|
39 |
-
$this->orders = array();
|
40 |
-
$this->carts = array();
|
41 |
-
$this->storeKey = $this->_data['storeKey'];
|
42 |
-
$this->server = $this->_data['server'];
|
43 |
-
}
|
44 |
-
|
45 |
-
public function addProduct($product) {
|
46 |
-
$this->products[] = $product;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function addUser($user) {
|
50 |
-
$this->users[] = $user;
|
51 |
-
}
|
52 |
-
|
53 |
-
public function addOrder($order) {
|
54 |
-
$this->orders[] = $order;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function addCart($cart) {
|
58 |
-
$this->carts[] = $cart;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function resetProducts() {
|
62 |
-
$this->products = array();
|
63 |
-
}
|
64 |
-
|
65 |
-
public function resetUsers() {
|
66 |
-
$this->users = array();
|
67 |
-
}
|
68 |
-
|
69 |
-
public function resetOrders() {
|
70 |
-
$this->orders = array();
|
71 |
-
}
|
72 |
-
|
73 |
-
public function resetAll() {
|
74 |
-
$this->resetProducts();
|
75 |
-
$this->resetUsers();
|
76 |
-
$this->resetOrders();
|
77 |
-
}
|
78 |
-
|
79 |
-
public function checkResult($res) {
|
80 |
-
$xml = simplexml_load_string($res);
|
81 |
-
|
82 |
-
if ($xml && $xml->status && $xml->status == '200') {
|
83 |
-
return true;
|
84 |
-
} else {
|
85 |
-
return false;
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
public function sendUsers($firstTransaction = false) {
|
90 |
-
|
91 |
-
if (empty($this->users)) {
|
92 |
-
return true;
|
93 |
-
}
|
94 |
-
|
95 |
-
$xml = $this->createEmptyXML();
|
96 |
-
$entities = $xml->addChild('entities');
|
97 |
-
|
98 |
-
foreach ($this->users as $user) {
|
99 |
-
$entity = $entities->addChild('entity');
|
100 |
-
$entity->addAttribute('name', 'user');
|
101 |
-
$prop = $entity->addChild('property', $user->getUser_id());
|
102 |
-
$prop->addAttribute('name', 'iduser');
|
103 |
-
$email = $entity->addChild('property', $user->getEmail());
|
104 |
-
$email->addAttribute('name', 'email');
|
105 |
-
}
|
106 |
-
|
107 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
108 |
-
|
109 |
-
$curl = curl_init();
|
110 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/entity/' . $resourceName . '?token=' . $this->storeKey);
|
111 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
112 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
113 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
114 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml->asXML());
|
115 |
-
|
116 |
-
|
117 |
-
$result = curl_exec($curl);
|
118 |
-
|
119 |
-
curl_close($curl);
|
120 |
-
return $this->checkResult($result);
|
121 |
-
}
|
122 |
-
|
123 |
-
public function sendProducts($firstTransaction = false) {
|
124 |
-
|
125 |
-
if (empty($this->products)) {
|
126 |
-
return true;
|
127 |
-
}
|
128 |
-
|
129 |
-
$xml = $this->createEmptyXML();
|
130 |
-
|
131 |
-
$firstProduct = $this->products[0];
|
132 |
-
|
133 |
-
if (isset($firstProduct) && $firstProduct) {
|
134 |
-
if ($firstProduct->getIsMultilanguage()) {
|
135 |
-
$names = $firstProduct->getNames();
|
136 |
-
$langKeys = array_keys($names);
|
137 |
-
if (isset($langKeys[0]) && $langKeys[0]) {
|
138 |
-
$config = $xml->addChild("config");
|
139 |
-
$defaultLang = $config->addChild("property", utf8_encode($langKeys[0]));
|
140 |
-
$defaultLang->addAttribute("name", "defaultLanguage");
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
$entities = $xml->addChild('entities');
|
146 |
-
foreach ($this->products as $product) {
|
147 |
-
$entity = $entities->addChild('entity');
|
148 |
-
$entity->addAttribute('name', 'product');
|
149 |
-
|
150 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getProduct_id())));
|
151 |
-
$prop->addAttribute('name', 'idproduct');
|
152 |
-
|
153 |
-
if ($product->getIsMultilanguage()) {
|
154 |
-
$multiprop = $entity->addChild('multi_property');
|
155 |
-
$multiprop->addAttribute('name', 'name');
|
156 |
-
|
157 |
-
foreach ($product->getNames() as $lang_code => $name) {
|
158 |
-
$prop = $multiprop->addChild('property', utf8_encode(htmlspecialchars($name, ENT_QUOTES)));
|
159 |
-
|
160 |
-
$prop->addAttribute('lang', $lang_code);
|
161 |
-
}
|
162 |
-
|
163 |
-
$multiprop = $entity->addChild('multi_property');
|
164 |
-
$multiprop->addAttribute('name', 'description');
|
165 |
-
|
166 |
-
foreach ($product->getDescriptions() as $lang_code => $description) {
|
167 |
-
$prop = $multiprop->addChild('property', utf8_encode(htmlspecialchars($description, ENT_QUOTES)));
|
168 |
-
$prop->addAttribute('lang', $lang_code);
|
169 |
-
}
|
170 |
-
|
171 |
-
$multiprop = $entity->addChild('multi_property');
|
172 |
-
$multiprop->addAttribute('name', 'url');
|
173 |
-
|
174 |
-
foreach ($product->getUrls() as $lang_code => $url) {
|
175 |
-
$prop = $multiprop->addChild('property', utf8_encode(htmlspecialchars($url)));
|
176 |
-
$prop->addAttribute('lang', $lang_code);
|
177 |
-
}
|
178 |
-
|
179 |
-
$multiprop = $entity->addChild('multi_property');
|
180 |
-
$multiprop->addAttribute('name', 'multiprice');
|
181 |
-
|
182 |
-
foreach ($product->getPrices() as $lang_code => $price) {
|
183 |
-
$prop = $multiprop->addChild('property', utf8_encode(htmlspecialchars($price)));
|
184 |
-
$prop->addAttribute('lang', $lang_code);
|
185 |
-
}
|
186 |
-
|
187 |
-
$multiprop = $entity->addChild('multi_property');
|
188 |
-
$multiprop->addAttribute('name', 'imageurl');
|
189 |
-
|
190 |
-
foreach ($product->getImageUrls() as $lang_code => $imageUrl) {
|
191 |
-
$prop = $multiprop->addChild('property', utf8_encode(htmlspecialchars($imageUrl)));
|
192 |
-
$prop->addAttribute('lang', $lang_code);
|
193 |
-
}
|
194 |
-
} else {
|
195 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getNames())));
|
196 |
-
$prop->addAttribute('name', 'name');
|
197 |
-
|
198 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getDescriptions())));
|
199 |
-
$prop->addAttribute('name', 'description');
|
200 |
-
|
201 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getUrls())));
|
202 |
-
$prop->addAttribute('name', 'url');
|
203 |
-
|
204 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getPrice())));
|
205 |
-
$prop->addAttribute('name', 'price');
|
206 |
-
|
207 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($product->getImage_url())));
|
208 |
-
$prop->addAttribute('name', 'imageurl');
|
209 |
-
}
|
210 |
-
|
211 |
-
$categories_text = '';
|
212 |
-
$categories = $product->getCategories();
|
213 |
-
|
214 |
-
if (isset($categories)) {
|
215 |
-
if (is_array($categories)) {
|
216 |
-
for ($i = 0; $i < count($categories); $i++) {
|
217 |
-
if (is_numeric($categories[$i])) {
|
218 |
-
$categories_text .= $categories[$i];
|
219 |
-
} else {
|
220 |
-
$categoryDump = var_export($categories[$i], true);
|
221 |
-
Mage::getModel('recsins/recsins')->log("Category is not numeric. Dump: " . PHP_EOL . $categoryDump);
|
222 |
-
}
|
223 |
-
if ($categories_text != '' && $i != count($categories) - 1) {
|
224 |
-
$categories_text .= ', ';
|
225 |
-
}
|
226 |
-
}
|
227 |
-
} else {
|
228 |
-
$categoriesDump = var_export($categories, true);
|
229 |
-
Mage::getModel('recsins/recsins')->log("Categories is not array. Dump: " . PHP_EOL . $categoriesDump);
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
$prop = $entity->addChild('property', utf8_encode(htmlspecialchars($categories_text)));
|
234 |
-
$prop->addAttribute('name', 'categories');
|
235 |
-
}
|
236 |
-
|
237 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
238 |
-
$text = $xml->asXML();
|
239 |
-
$curl = curl_init();
|
240 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/entity/' . $resourceName . '?token=' . $this->storeKey);
|
241 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
242 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
243 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
244 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
245 |
-
$result = curl_exec($curl);
|
246 |
-
curl_close($curl);
|
247 |
-
return $this->checkResult($result);
|
248 |
-
}
|
249 |
-
|
250 |
-
public function sendCatalogPurchases($firstTransaction = false) {
|
251 |
-
if (empty($this->orders)) {
|
252 |
-
return true;
|
253 |
-
}
|
254 |
-
|
255 |
-
$xmlPurchases = $this->createEmptyXML();
|
256 |
-
|
257 |
-
$orders = $xmlPurchases->addChild('orders');
|
258 |
-
|
259 |
-
foreach ($this->orders as $order) {
|
260 |
-
|
261 |
-
$idPurchase = $order->getIdPurchase();
|
262 |
-
|
263 |
-
if (!isset($idPurchase)) {
|
264 |
-
continue;
|
265 |
-
}
|
266 |
-
|
267 |
-
$xml_order = $orders->addChild('order');
|
268 |
-
|
269 |
-
$orderDate = $order->getDate();
|
270 |
-
|
271 |
-
if (!$orderDate) {
|
272 |
-
$orderDate = $order->getFinishDate();
|
273 |
-
}
|
274 |
-
$normalizedDate = $this->normalizeDate($orderDate);
|
275 |
-
|
276 |
-
$xml_order->addChild('amount', $order->getAmount());
|
277 |
-
$xml_order->addChild('idBuyer', $order->getIdUser());
|
278 |
-
$xml_order->addChild('idPurchase', $order->getIdPurchase());
|
279 |
-
$xml_order->addChild('idOrder', $order->getIdCart());
|
280 |
-
$xml_order->addChild('startDate', $normalizedDate);
|
281 |
-
$xml_order->addChild('finishDate', $normalizedDate);
|
282 |
-
$xml_products = $xml_order->addChild('products');
|
283 |
-
|
284 |
-
foreach ($order->getProducts() as $id => $info) {
|
285 |
-
$xml_product = $xml_products->addChild('product');
|
286 |
-
$xml_product->addChild('date', $normalizedDate);
|
287 |
-
$xml_product->addChild('idProduct', $id);
|
288 |
-
$xml_product->addChild('price', $info['price']);
|
289 |
-
$xml_product->addChild('productType', 'product');
|
290 |
-
$xml_product->addChild('quantity', $info['qty']);
|
291 |
-
}
|
292 |
-
}
|
293 |
-
|
294 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
295 |
-
|
296 |
-
$text = $xmlPurchases->asXML();
|
297 |
-
$curl = curl_init();
|
298 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/purchase/upload.xml?token=' . $this->storeKey);
|
299 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
300 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
301 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
302 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
303 |
-
$result = curl_exec($curl);
|
304 |
-
|
305 |
-
curl_close($curl);
|
306 |
-
return $this->checkResult($result);
|
307 |
-
}
|
308 |
-
|
309 |
-
public function sendPurchases($firstTransaction = false) {
|
310 |
-
|
311 |
-
if (empty($this->orders)) {
|
312 |
-
return true;
|
313 |
-
}
|
314 |
-
|
315 |
-
$xmlPurchases = $this->createEmptyXML();
|
316 |
-
$orders = $xmlPurchases->addChild('orders');
|
317 |
-
|
318 |
-
foreach ($this->orders as $order) {
|
319 |
-
|
320 |
-
if (!$order->getCartId()) {
|
321 |
-
continue;
|
322 |
-
}
|
323 |
-
|
324 |
-
$xml_order = $orders->addChild('order');
|
325 |
-
|
326 |
-
$orderDate = $order->getDate();
|
327 |
-
if (!$orderDate) {
|
328 |
-
$orderDate = $order->getFinishDate();
|
329 |
-
}
|
330 |
-
|
331 |
-
$normalizedDate = $this->normalizeDate($orderDate);
|
332 |
-
|
333 |
-
$xml_order->addChild('amount', $order->getAmount());
|
334 |
-
$xml_order->addChild('idBuyer', $order->getUserId());
|
335 |
-
$xml_order->addChild('idPurchase', $order->getOrderId());
|
336 |
-
$xml_order->addChild('startDate', $normalizedDate);
|
337 |
-
$xml_order->addChild('finishDate', $normalizedDate);
|
338 |
-
$xml_products = $xml_order->addChild('products');
|
339 |
-
$xml_order->addChild('idOrder', $order->getCartId());
|
340 |
-
|
341 |
-
|
342 |
-
foreach ($order->getProducts() as $product) {
|
343 |
-
$xml_product = $xml_products->addChild('product');
|
344 |
-
$xml_product->addChild('date', $normalizedDate);
|
345 |
-
$xml_product->addChild('idProduct', $product->getProduct_id());
|
346 |
-
$xml_product->addChild('price', $product->getPrice());
|
347 |
-
$xml_product->addChild('productType', 'product');
|
348 |
-
$xml_product->addChild('quantity', $product->getQuantity());
|
349 |
-
}
|
350 |
-
}
|
351 |
-
|
352 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
353 |
-
|
354 |
-
$text = $xmlPurchases->asXML();
|
355 |
-
$curl = curl_init();
|
356 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/purchase/' . $resourceName . 'token=' . $this->storeKey);
|
357 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
358 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
359 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
360 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
361 |
-
$result = curl_exec($curl);
|
362 |
-
|
363 |
-
curl_close($curl);
|
364 |
-
return $this->checkResult($result);
|
365 |
-
}
|
366 |
-
|
367 |
-
public function sendCatalogCarts($firstTransaction = false) {
|
368 |
-
|
369 |
-
if (empty($this->carts)) {
|
370 |
-
return true;
|
371 |
-
}
|
372 |
-
|
373 |
-
$xml = $this->createEmptyXML();
|
374 |
-
$orders = $xml->addChild('orders');
|
375 |
-
|
376 |
-
foreach ($this->carts as $cart) {
|
377 |
-
|
378 |
-
$xml_order = $orders->addChild('order');
|
379 |
-
$xml_order->addChild('idBuyer', $cart->getIdUser());
|
380 |
-
$xml_order->addChild('idOrder', $cart->getIdCart());
|
381 |
-
|
382 |
-
if ($cart->getStart_date()) {
|
383 |
-
$xml_order->addChild('startDate', $this->normalizeDate($cart->getStartDate()));
|
384 |
-
} if ($cart->getFinish_date()) {
|
385 |
-
$xml_order->addChild('finishDate', $this->normalizeDate($cart->getFinishDate()));
|
386 |
-
}
|
387 |
-
|
388 |
-
$xml_products = $xml_order->addChild('products');
|
389 |
-
|
390 |
-
foreach ($cart->getProducts() as $id => $info) {
|
391 |
-
|
392 |
-
$xml_product = $xml_products->addChild('product');
|
393 |
-
|
394 |
-
$xml_product->addChild('date', $this->normalizeDate($cart->getStartDate()));
|
395 |
-
|
396 |
-
$xml_product->addChild('idProduct', $id);
|
397 |
-
$xml_product->addChild('productType', 'product');
|
398 |
-
$xml_product->addChild('quantity', $info['qty']);
|
399 |
-
if (isset($info['price'])) {
|
400 |
-
$xml_product->addChild('price', $info['price']);
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}
|
404 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
405 |
-
$text = $xml->asXML();
|
406 |
-
$curl = curl_init();
|
407 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/order/upload.xml?token=' . $this->storeKey);
|
408 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
409 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
410 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
411 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
412 |
-
$result = curl_exec($curl);
|
413 |
-
curl_close($curl);
|
414 |
-
return $this->checkResult($result);
|
415 |
-
}
|
416 |
-
|
417 |
-
public function sendFullCarts($firstTransaction = false) {
|
418 |
-
|
419 |
-
if (empty($this->carts)) {
|
420 |
-
return true;
|
421 |
-
}
|
422 |
-
|
423 |
-
$xml = $this->createEmptyXML();
|
424 |
-
$orders = $xml->addChild('orders');
|
425 |
-
|
426 |
-
foreach ($this->carts as $cart) {
|
427 |
-
|
428 |
-
$xml_order = $orders->addChild('order');
|
429 |
-
$xml_order->addChild('idBuyer', $cart->getUserId());
|
430 |
-
//$xml_order->addChild('idOrder', $cart->getIdCart());
|
431 |
-
|
432 |
-
if ($cart->getStart_date()) {
|
433 |
-
$xml_order->addChild('startDate', $this->normalizeDate($cart->getStart_date()));
|
434 |
-
} if ($cart->getFinish_date()) {
|
435 |
-
$xml_order->addChild('finishDate', $this->normalizeDate($cart->getFinish_date()));
|
436 |
-
}
|
437 |
-
|
438 |
-
$xml_products = $xml_order->addChild('products');
|
439 |
-
|
440 |
-
$eldestProduct;
|
441 |
-
|
442 |
-
foreach ($cart->getProducts() as $product) {
|
443 |
-
|
444 |
-
$normalizedDate = $this->normalizeDate($product->getDate_added());
|
445 |
-
|
446 |
-
$xml_product = $xml_products->addChild('product');
|
447 |
-
|
448 |
-
if ($product->getDate_added()) {
|
449 |
-
$xml_product->addChild('date', $this->normalizeDate($product->getDate_added()));
|
450 |
-
} else {
|
451 |
-
$xml_product->addChild('date', $this->normalizeDate($cart->getStart_date()));
|
452 |
-
}
|
453 |
-
|
454 |
-
$xml_product->addChild('idProduct', $product->getProduct_id());
|
455 |
-
$xml_product->addChild('productType', 'product');
|
456 |
-
$xml_product->addChild('quantity', $product->getQuantity());
|
457 |
-
if ($product->getPrice()) {
|
458 |
-
$xml_product->addChild('price', $product->getPrice());
|
459 |
-
}
|
460 |
-
}
|
461 |
-
}
|
462 |
-
$resourceName = $firstTransaction ? "replace.xml" : "upload.xml";
|
463 |
-
$text = $xml->asXML();
|
464 |
-
|
465 |
-
$curl = curl_init();
|
466 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/order/' . $resourceName . '?token=' . $this->storeKey);
|
467 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
468 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
469 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
470 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
471 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, 1);
|
472 |
-
$result = curl_exec($curl);
|
473 |
-
curl_close($curl);
|
474 |
-
return $this->checkResult($result);
|
475 |
-
}
|
476 |
-
|
477 |
-
private function normalizeDate($date) {
|
478 |
-
$serverTimezone = new DateTimeZone(date_default_timezone_get());
|
479 |
-
|
480 |
-
$dateOffset = $serverTimezone->getOffset(new DateTime("now", new DateTimeZone('GMT')));
|
481 |
-
$unixTime = strtotime($date);
|
482 |
-
$normalizedDate = date('Y-m-d H:i:s', $unixTime - $dateOffset);
|
483 |
-
return $normalizedDate;
|
484 |
-
}
|
485 |
-
|
486 |
-
private function createEmptyXML() {
|
487 |
-
$xmlstr = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
488 |
-
<recsins version='0.1'>
|
489 |
-
</recsins>";
|
490 |
-
|
491 |
-
return new SimpleXMLElement($xmlstr);
|
492 |
-
}
|
493 |
-
|
494 |
-
private function createOkXML() {
|
495 |
-
return "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><recsins version='0.1'><message>Ok</message><status>200</status></recsins>";
|
496 |
-
}
|
497 |
-
|
498 |
-
public function getAllRecommenders() {
|
499 |
-
$curl = curl_init();
|
500 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/recommender/retrieve.xml?token=' . $this->storeKey);
|
501 |
-
$timeout = 5;
|
502 |
-
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
|
503 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
504 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
505 |
-
$result = curl_exec($curl);
|
506 |
-
curl_close($curl);
|
507 |
-
return $result;
|
508 |
-
}
|
509 |
-
|
510 |
-
// curl track functions
|
511 |
-
|
512 |
-
public function beginCheckout($idUser) {
|
513 |
-
|
514 |
-
$xml = $this->createEmptyXML();
|
515 |
-
$xml_orders = $xml->addChild('orders');
|
516 |
-
$xml_order = $xml_orders->addChild('order');
|
517 |
-
$xml_order->addChild('idBuyer', $idUser);
|
518 |
-
|
519 |
-
$text = $xml->asXML();
|
520 |
-
|
521 |
-
$curl = curl_init();
|
522 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/purchase/create.xml?token=' . $this->storeKey);
|
523 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
524 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
525 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
526 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $text);
|
527 |
-
$result = curl_exec($curl);
|
528 |
-
curl_close($curl);
|
529 |
-
return $result;
|
530 |
-
}
|
531 |
-
|
532 |
-
public function endCheckout($idOrder, $idUser, $amount) {
|
533 |
-
|
534 |
-
$xml = $this->createEmptyXML();
|
535 |
-
|
536 |
-
$orders = $xml->addChild("orders");
|
537 |
-
$order = $orders->addChild("order");
|
538 |
-
$order->addChild("idPurchase", $idOrder);
|
539 |
-
$order->addChild("idBuyer", $idUser);
|
540 |
-
$order->addChild("amount", $amount);
|
541 |
-
|
542 |
-
$curl = curl_init();
|
543 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/purchase/close/' . $idOrder . '/' . $idUser . '/' . $amount . '.xml?token=' . $this->storeKey);
|
544 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
545 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
546 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
547 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, "");
|
548 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, 1);
|
549 |
-
$result = curl_exec($curl);
|
550 |
-
curl_close($curl);
|
551 |
-
return $result;
|
552 |
-
}
|
553 |
-
|
554 |
-
public function sendUserLogin($idUser, $cookieId) {
|
555 |
-
|
556 |
-
$curl = curl_init();
|
557 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/order/logIn.json?cookieId=' . $cookieId . '&userId=' . $idUser . '&token=' . $this->storeKey);
|
558 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
559 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Accept: application/json"));
|
560 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
561 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, "");
|
562 |
-
|
563 |
-
$result = curl_exec($curl);
|
564 |
-
return $result;
|
565 |
-
}
|
566 |
-
|
567 |
-
public function sendUser($idUser, $email) {
|
568 |
-
$xml = $this->createEmptyXML();
|
569 |
-
$entities = $xml->addChild('entities');
|
570 |
-
|
571 |
-
$entity = $entities->addChild('entity');
|
572 |
-
$entity->addAttribute('name', 'user');
|
573 |
-
$prop = $entity->addChild('property', $idUser);
|
574 |
-
$prop->addAttribute('name', 'iduser');
|
575 |
-
$email = $entity->addChild('property', $email);
|
576 |
-
$email->addAttribute('name', 'email');
|
577 |
-
$resourceName = "upload.xml";
|
578 |
-
|
579 |
-
$curl = curl_init();
|
580 |
-
curl_setopt($curl, CURLOPT_URL, $this->server . '/RecSinsAPI/api/entity/' . $resourceName . '?token=' . $this->storeKey);
|
581 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
582 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/xml", "Accept: application/xml"));
|
583 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
584 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, 3);
|
585 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml->asXML());
|
586 |
-
|
587 |
-
$result = curl_exec($curl);
|
588 |
-
curl_close($curl);
|
589 |
-
return $this->checkResult($result);
|
590 |
-
}
|
591 |
-
|
592 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/NewFile.xml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
app/code/community/Brainsins/Recsins/Model/Observer.php
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Observer {
|
28 |
-
|
29 |
-
private function getUserId() {
|
30 |
-
|
31 |
-
$session = Mage::getSingleton('customer/session');
|
32 |
-
if (!isset($session)) {
|
33 |
-
return '0';
|
34 |
-
}
|
35 |
-
|
36 |
-
$customer = $session->getCustomer();
|
37 |
-
if (!isset($customer)) {
|
38 |
-
return '0';
|
39 |
-
}
|
40 |
-
|
41 |
-
$userId = $customer->getId();
|
42 |
-
|
43 |
-
if (!isset($userId) || !$userId) {
|
44 |
-
if (array_key_exists('coId', $_COOKIE)) {
|
45 |
-
$userId = $_COOKIE['coId'];
|
46 |
-
if (!is_numeric($userId)) {
|
47 |
-
$userId = '0';
|
48 |
-
}
|
49 |
-
} else {
|
50 |
-
$userId = '0';
|
51 |
-
}
|
52 |
-
}
|
53 |
-
return $userId ? $userId : '0';
|
54 |
-
}
|
55 |
-
|
56 |
-
public function onLogin($observer) {
|
57 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
58 |
-
if ($enabled !== '1') {
|
59 |
-
return $this;
|
60 |
-
}
|
61 |
-
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
62 |
-
$session->setData("recsins_login", "1");
|
63 |
-
return $this;
|
64 |
-
}
|
65 |
-
|
66 |
-
public function onCart($observer) {
|
67 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
68 |
-
if ($enabled !== '1') {
|
69 |
-
return $this;
|
70 |
-
}
|
71 |
-
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
72 |
-
$session->setData("recsins_cart", "1");
|
73 |
-
return $this;
|
74 |
-
}
|
75 |
-
|
76 |
-
public function onCheckoutSuccess($observer) {
|
77 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
78 |
-
if (!isset($enabled) || $enabled !== '1') {
|
79 |
-
return $this;
|
80 |
-
}
|
81 |
-
|
82 |
-
$userId = $this->getUserId();
|
83 |
-
$recsinsModel = Mage::getModel("recsins/recsins");
|
84 |
-
$recsinsModel->trackCheckoutBegin($userId);
|
85 |
-
$recsinsModel->trackCheckoutSuccess($observer->getEvent()->getPayment()->getOrder(), $userId);
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
public function onCheckoutStart($observer) {
|
90 |
-
$enabled = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
91 |
-
if (!isset($enabled) || $enabled !== '1') {
|
92 |
-
return $this;
|
93 |
-
}
|
94 |
-
|
95 |
-
$userId = $this->getUserId();
|
96 |
-
$recsinsModel = Mage::getModel("recsins/recsins");
|
97 |
-
$recsinsModel->trackCheckoutBegin($userId);
|
98 |
-
return $this;
|
99 |
-
}
|
100 |
-
|
101 |
-
public function onCreateAccount($observer) {
|
102 |
-
|
103 |
-
}
|
104 |
-
|
105 |
-
public function onCustomerSave($observer) {
|
106 |
-
$subscriber = $observer->getEvent()->getSubscriber();
|
107 |
-
$userId = $subscriber->getCustomerId();
|
108 |
-
$email = "";
|
109 |
-
if ($subscriber->isSubscribed()) {
|
110 |
-
$email = $subscriber->getEmail();
|
111 |
-
}
|
112 |
-
$recsinsModel = Mage::getModel("recsins/recsins");
|
113 |
-
$res = $recsinsModel->sendUpdatedUser($userId, $email);
|
114 |
-
|
115 |
-
}
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Order.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Order extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
}
|
31 |
-
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/OrderProduct.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_OrderProduct extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
}
|
31 |
-
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Product.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Product extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
}
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Recommender.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Recommender extends Mage_Core_Model_Abstract {
|
28 |
-
public function __construct() {
|
29 |
-
$this->_init('recsins/recommender');
|
30 |
-
}
|
31 |
-
|
32 |
-
public function getAllRecommenders() {
|
33 |
-
$resource = Mage::getSingleton('core/resource');
|
34 |
-
$conn = Mage::getSingleton('core/resource')->getConnection('recsins_read');
|
35 |
-
$table = $resource->getTableName('recsins_recommender');
|
36 |
-
$dbRecommenders = $conn->fetchAll("SELECT * FROM $table;");
|
37 |
-
$result = array();
|
38 |
-
foreach($dbRecommenders as $dbRecommender) {
|
39 |
-
$recommender = array();
|
40 |
-
$recommender['id'] = $dbRecommender['id'];
|
41 |
-
$recommender['name'] = $dbRecommender['name'];
|
42 |
-
$recommender['page'] = $dbRecommender['page'];
|
43 |
-
$result[] = $recommender;
|
44 |
-
}
|
45 |
-
return $result;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function setAllRecommenders($recommenders) {
|
49 |
-
$resource = Mage::getSingleton('core/resource');
|
50 |
-
$conn = Mage::getSingleton('core/resource')->getConnection('recsins_write');
|
51 |
-
$table = $resource->getTableName('recsins_recommender');
|
52 |
-
$delQuery = "delete from $table";
|
53 |
-
$conn->query($delQuery);
|
54 |
-
|
55 |
-
foreach($recommenders as $recommender) {
|
56 |
-
$id = $recommender['id'];
|
57 |
-
$name = $recommender['name'];
|
58 |
-
$page = $recommender['page'];
|
59 |
-
|
60 |
-
$query = "insert into $table (`id`, `name`, `page`) values ('$id', '$name', '$page') on duplicate key update name='$name', page='$page';";
|
61 |
-
$conn->query($query);
|
62 |
-
}
|
63 |
-
|
64 |
-
return true;
|
65 |
-
}
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Recsins.php
DELETED
@@ -1,690 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Recsins extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
private $bsClient;
|
30 |
-
//private $dev = true;
|
31 |
-
private $dev = false;
|
32 |
-
private $server;
|
33 |
-
|
34 |
-
protected function _construct() {
|
35 |
-
parent::_construct();
|
36 |
-
$this->_init('recsins/recsins');
|
37 |
-
|
38 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
39 |
-
|
40 |
-
|
41 |
-
if ($this->dev) {
|
42 |
-
$this->server = "dev-api.brainsins.com";
|
43 |
-
} else {
|
44 |
-
$this->server = "api.brainsins.com";
|
45 |
-
}
|
46 |
-
|
47 |
-
$this->bsClient = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
48 |
-
}
|
49 |
-
|
50 |
-
public function importRecommenders() {
|
51 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
52 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
53 |
-
|
54 |
-
$recommenders = simplexml_load_string($client->getAllRecommenders());
|
55 |
-
$result = false;
|
56 |
-
if (isset($recommenders) && isset($recommenders->recommenders)) {
|
57 |
-
//delete previous recommenders
|
58 |
-
|
59 |
-
$recModel = Mage::getModel('recsins/recommender');
|
60 |
-
$dbRecommenders = array();
|
61 |
-
|
62 |
-
foreach ($recommenders->recommenders->recommender as $recommender) {
|
63 |
-
|
64 |
-
$dbRecommender = array();
|
65 |
-
$dbRecommender['id'] = $recommender->id_recommender;
|
66 |
-
$dbRecommender['name'] = $recommender->name;
|
67 |
-
$dbRecommender['page'] = $recommender->page;
|
68 |
-
|
69 |
-
$dbRecommenders[] = $dbRecommender;
|
70 |
-
}
|
71 |
-
|
72 |
-
$result = $recModel->setAllRecommenders($dbRecommenders);
|
73 |
-
}
|
74 |
-
return $result;
|
75 |
-
}
|
76 |
-
|
77 |
-
public function uploadCatalogUsers($pageSize, $lastPage, $firstTransaction = false) {
|
78 |
-
|
79 |
-
$lastCustomerId = 0;
|
80 |
-
|
81 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
82 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
83 |
-
|
84 |
-
$customers = Mage::getModel("customer/customer")->getCollection()->addAttributeToSelect('*')->setPage($lastPage + 1, $pageSize);
|
85 |
-
|
86 |
-
$result = true;
|
87 |
-
|
88 |
-
$firstUploadChanged = false;
|
89 |
-
|
90 |
-
foreach ($customers as $customer) {
|
91 |
-
|
92 |
-
if ($firstTransaction && !$firstUploadChanged) {
|
93 |
-
$firstUploadChanged = true;
|
94 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->getData('brainsins_FIRST_TRANSACTION', '0');
|
95 |
-
}
|
96 |
-
|
97 |
-
$user = Mage::getModel('recsins/user', array('user_id' => $customer->getId(), 'email' => $customer->getEmail()));
|
98 |
-
$client->addUser($user);
|
99 |
-
if ($customer->getId() > $lastCustomerId) {
|
100 |
-
$lastCustomerId = $customer->getId();
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
$result = $client->sendUsers($firstTransaction);
|
105 |
-
|
106 |
-
$lastUploadedId = Mage::getStoreConfig('brainsins/BS_LAST_CUSTOMER_ID_UPLOADED');
|
107 |
-
|
108 |
-
if (!isset($lastUploadedId) || $lastUploadedId < $lastCustomerId) {
|
109 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_LAST_CUSTOMER_ID_UPLOADED', $lastCustomerId);
|
110 |
-
}
|
111 |
-
|
112 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_LAST_PAGE_SENT', $lastPage + 1);
|
113 |
-
//Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_LAST_CUSTOMER_ID_UPLOADED', $lastCustomerId);
|
114 |
-
|
115 |
-
return $result;
|
116 |
-
}
|
117 |
-
|
118 |
-
public function uploadCatalogProducts($pageSize, $lastPage, $firstTransaction = false, $uploadOutOfStock = false) {
|
119 |
-
$stores = Mage::app()->getStore()->getCollection();
|
120 |
-
|
121 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
122 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
123 |
-
|
124 |
-
$transactionCounter = 0;
|
125 |
-
|
126 |
-
$result = true;
|
127 |
-
|
128 |
-
//get first store id
|
129 |
-
$firstStoreId = $stores->getFirstItem();
|
130 |
-
|
131 |
-
if ($firstStoreId) {
|
132 |
-
$firstStoreId = $firstStoreId->getId();
|
133 |
-
} else {
|
134 |
-
return;
|
135 |
-
}
|
136 |
-
|
137 |
-
if (!isset($firstStoreId)) {
|
138 |
-
return;
|
139 |
-
}
|
140 |
-
|
141 |
-
$client->resetAll();
|
142 |
-
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->setPage($lastPage + 1, $pageSize)->addPriceData(null, $firstStoreId);
|
143 |
-
|
144 |
-
$firstUploadChanged = false;
|
145 |
-
|
146 |
-
|
147 |
-
foreach ($products as $product) {
|
148 |
-
$id = $product->getId();
|
149 |
-
|
150 |
-
$visibility = $product->getVisibility();
|
151 |
-
$configurable_product_model = Mage::getModel('catalog/product_type_configurable');
|
152 |
-
$parentIdArray = $configurable_product_model->getParentIdsByChild($product->getId());
|
153 |
-
|
154 |
-
if (!$uploadOutOfStock && (!Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getIs_in_stock() || Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty() <= 0)) {
|
155 |
-
continue;
|
156 |
-
}
|
157 |
-
|
158 |
-
if ($firstTransaction && !$firstUploadChanged) {
|
159 |
-
$firstUploadChanged = true;
|
160 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_FIRST_TRANSACTION', '0');
|
161 |
-
}
|
162 |
-
|
163 |
-
if (count($parentIdArray) == 0 && $visibility > 1 && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
|
164 |
-
|
165 |
-
$bsProduct = Mage::getModel('recsins/product');
|
166 |
-
|
167 |
-
|
168 |
-
$bsProduct->setIsMultilanguage(true);
|
169 |
-
|
170 |
-
$names = array();
|
171 |
-
$descriptions = array();
|
172 |
-
$urls = array();
|
173 |
-
$prices = array();
|
174 |
-
$imageUrls = array();
|
175 |
-
|
176 |
-
$bsProduct->setProduct_id($product->getId());
|
177 |
-
|
178 |
-
$categoryList = array();
|
179 |
-
$categoryIds = $product->getCategoryIds();
|
180 |
-
|
181 |
-
|
182 |
-
if (isset($categoryIds) && is_array($categoryIds)) {
|
183 |
-
foreach ($categoryIds as $catId) {
|
184 |
-
$category = Mage::getModel('catalog/category')->load($catId);
|
185 |
-
$parents = $category->getParentIds();
|
186 |
-
|
187 |
-
if (!in_array($catId, $categoryList)) {
|
188 |
-
$categoryList[] = $catId;
|
189 |
-
}
|
190 |
-
|
191 |
-
if (isset($parents) && is_array($parents)) {
|
192 |
-
foreach ($parents as $parent) {
|
193 |
-
if (!in_array($parent, $categoryList)) {
|
194 |
-
$categoryList[] = $parent;
|
195 |
-
}
|
196 |
-
}
|
197 |
-
}
|
198 |
-
}
|
199 |
-
}
|
200 |
-
$bsProduct->setCategories($categoryList);
|
201 |
-
|
202 |
-
foreach ($stores as $store) {
|
203 |
-
|
204 |
-
$storeCode = $store->getCode();
|
205 |
-
$storeId = $store->getId();
|
206 |
-
|
207 |
-
$product->setStoreId($storeId);
|
208 |
-
$product->load($id);
|
209 |
-
|
210 |
-
$price = $product->getPrice();
|
211 |
-
|
212 |
-
if ($price == 0.0 && $product->getTypeId() == "bundle") {
|
213 |
-
list($minPrice, $maxPrice) = $product->getPriceModel()->getPrices($product);
|
214 |
-
$price = $minPrice;
|
215 |
-
}
|
216 |
-
|
217 |
-
$prices[$storeCode] = $price;
|
218 |
-
$useSpecialPrice = Mage::getStoreConfig('brainsins/BS_USE_SPECIAL_PRICE');
|
219 |
-
if (isset($useSpecialPrice) && $useSpecialPrice == '1') {
|
220 |
-
|
221 |
-
$specialPrice = $product->getSpecialPrice();
|
222 |
-
if (isset($specialPrice) && $specialPrice) {
|
223 |
-
|
224 |
-
$specialFrom = $product->getSpecialFromDate();
|
225 |
-
$specialTo = $product->getSpecialToDate();
|
226 |
-
$specialFromTS;
|
227 |
-
$specialToTS;
|
228 |
-
|
229 |
-
$nowTS = time();
|
230 |
-
|
231 |
-
$specialValidRange = true;
|
232 |
-
|
233 |
-
if (isset($specialFrom)) {
|
234 |
-
$specialFromTS = strtotime($specialFrom);
|
235 |
-
if ($specialFromTS > $nowTS) {
|
236 |
-
$specialValidRange = false;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
if (isset($specialTo)) {
|
241 |
-
$specialToTS = strtotime($specialTo);
|
242 |
-
if ($specialToTS < $nowTS) {
|
243 |
-
$specialValidRange = false;
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
if ($specialValidRange && $product->getTypeId() != "bundle") {
|
248 |
-
$prices[$storeCode] = $specialPrice;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
|
254 |
-
$resize = false;
|
255 |
-
$width = 0;
|
256 |
-
$heigth = 0;
|
257 |
-
|
258 |
-
$imageSelectedOption = Mage::getSingleton("core/session", array("name" => "adminhtml"))->getData('brainsins_BS_IMAGE_RESIZE');
|
259 |
-
if (isset($imageSelectedOption) && $imageSelectedOption == 'image_resize') {
|
260 |
-
$resize = true;
|
261 |
-
}
|
262 |
-
|
263 |
-
$imageSelectedWidth = Mage::getSingleton("core/session", array("name" => "adminhtml"))->getData('brainsins_BS_IMAGE_RESIZE_WIDTH');
|
264 |
-
$imageSelectedHeigth = Mage::getSingleton("core/session", array("name" => "adminhtml"))->getData('brainsins_BS_IMAGE_RESIZE_HEIGTH');
|
265 |
-
|
266 |
-
if (isset($imageSelectedWidth) && is_numeric($imageSelectedWidth) && $imageSelectedWidth > 0) {
|
267 |
-
$width = $imageSelectedWidth;
|
268 |
-
}
|
269 |
-
|
270 |
-
if (isset($imageSelectedHeigth) && is_numeric($imageSelectedHeigth) && $imageSelectedHeigth > 0) {
|
271 |
-
$heigth = $imageSelectedHeigth;
|
272 |
-
}
|
273 |
-
|
274 |
-
if ($resize && $width > 0) {
|
275 |
-
$prodImage = $product->getSmallImage();
|
276 |
-
if (isset($prodImage) && $prodImage != null && $prodImage != "no_selection") {
|
277 |
-
if ($heigth > 0) {
|
278 |
-
$imageUrls[$storeCode] = ((string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $heigth));
|
279 |
-
} else {
|
280 |
-
$imageUrls[$storeCode] = ((string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width));
|
281 |
-
}
|
282 |
-
}
|
283 |
-
} else {
|
284 |
-
$prodImage = $product->getSmallImage();
|
285 |
-
if (isset($prodImage) && $prodImage != null && $prodImage != "no_selection") {
|
286 |
-
|
287 |
-
$img = Mage::getModel("catalog/product_image");
|
288 |
-
$img->setDestinationSubdir("small_image");
|
289 |
-
$img->setBaseFile($prodImage);
|
290 |
-
|
291 |
-
$baseDir = Mage::getBaseDir('media');
|
292 |
-
$path = str_replace($baseDir . DS, "", $img->getBaseFile());
|
293 |
-
$url = $store->getBaseUrl('media') . str_replace(DS, '/', $path);
|
294 |
-
$imageUrls[$storeCode] = $url;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
|
298 |
-
//if resize is selected, override image url with controller call. Previous code will leave a copy of the image ready in the cache
|
299 |
-
if ($resize) {
|
300 |
-
$imageUrls[$storeCode] = $store->getBaseUrl() . "recsins/index/getRecProdImg?id=" . $id;
|
301 |
-
}
|
302 |
-
$names[$storeCode] = utf8_decode($product->getName());
|
303 |
-
$descriptions[$storeCode] = utf8_decode($product->getShortDescription());
|
304 |
-
$urls[$storeCode] = $product->getProductUrl();
|
305 |
-
}
|
306 |
-
|
307 |
-
$bsProduct->setNames($names);
|
308 |
-
$bsProduct->setDescriptions($descriptions);
|
309 |
-
$bsProduct->setUrls($urls);
|
310 |
-
$bsProduct->setPrices($prices);
|
311 |
-
$bsProduct->setImageUrls($imageUrls);
|
312 |
-
|
313 |
-
$client->addProduct($bsProduct);
|
314 |
-
} else {
|
315 |
-
//this product is a configuration of a more general product(id)
|
316 |
-
// or a non visible product
|
317 |
-
}
|
318 |
-
}
|
319 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_LAST_PAGE_SENT', $lastPage + 1);
|
320 |
-
$result = $client->sendProducts($firstTransaction);
|
321 |
-
return $result;
|
322 |
-
}
|
323 |
-
|
324 |
-
private function getNextFakeId($lastFakeId) {
|
325 |
-
if (!isset($lastFakeId) || $lastFakeId == 0) {
|
326 |
-
return 999999999999;
|
327 |
-
} else {
|
328 |
-
return $lastFakeId - 1;
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
-
public function uploadCatalogQuotes($pageSize, $lastPage, $lastFakeId = 0, $firstTransaction = false) {
|
333 |
-
|
334 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
335 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
336 |
-
|
337 |
-
$quotes = Mage::getModel('sales/quote')->getCollection()->setPageSize($pageSize)->setCurPage($lastPage + 1); //($lastPage + 1, 1);
|
338 |
-
foreach ($quotes as $quote) {
|
339 |
-
|
340 |
-
$quote->load($quote->getId());
|
341 |
-
$items = $quote->getAllItems();
|
342 |
-
$idCustomer = $quote->getCustomerId();
|
343 |
-
|
344 |
-
if (!isset($idCustomer)) {
|
345 |
-
$lastFakeId = $this->getNextFakeId($lastFakeId);
|
346 |
-
$idCustomer = $lastFakeId;
|
347 |
-
}
|
348 |
-
$bsCart = Mage::getModel('recsins/cart');
|
349 |
-
$bsCart->setIdCart($quote->getId());
|
350 |
-
$bsCart->setIdUser($idCustomer);
|
351 |
-
$bsCart->setStartDate($quote->getCreated_at());
|
352 |
-
$bsCart->setFinishDate($quote->getUpdated_at());
|
353 |
-
|
354 |
-
$cartItems = array();
|
355 |
-
foreach ($items as $item) {
|
356 |
-
|
357 |
-
if ($item->getParentItemId()) {
|
358 |
-
continue;
|
359 |
-
}
|
360 |
-
|
361 |
-
//TODO ? $product = $item->getProduct();
|
362 |
-
$qty = $item->getQty();
|
363 |
-
$price = $item->getPrice();
|
364 |
-
$idProduct = $item->getProduct_id();
|
365 |
-
|
366 |
-
if (array_key_exists($idProduct, $cartItems)) {
|
367 |
-
$newQty = $cartItems[$idProduct]['qty'] + $qty;
|
368 |
-
$newPrice = ($cartItems[$idProduct]['price'] * $cartItems[$idProduct]['qty'] + $price * $qty) / $newQty;
|
369 |
-
$cartItems[$idProduct]['qty'] = $newQty;
|
370 |
-
$cartItems[$idProduct]['price'] = $newPrice;
|
371 |
-
} else {
|
372 |
-
$cartItems[$idProduct] = array();
|
373 |
-
$cartItems[$idProduct]['qty'] = $qty;
|
374 |
-
$cartItems[$idProduct]['price'] = $price;
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
$bsCart->setProducts($cartItems);
|
379 |
-
$client->addCart($bsCart);
|
380 |
-
}
|
381 |
-
|
382 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_LAST_PAGE_SENT', $lastPage + 1);
|
383 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_LAST_FAKE_ID', $lastFakeId);
|
384 |
-
return $client->sendCatalogCarts($firstTransaction);
|
385 |
-
}
|
386 |
-
|
387 |
-
public function uploadCatalogOrders($pageSize, $lastPage, $lastFakeId, $firstTransaction = false) {
|
388 |
-
|
389 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
390 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
391 |
-
|
392 |
-
$orders = Mage::getModel('sales/order')->getCollection()->setPageSize($pageSize)->setCurPage($lastPage + 1);
|
393 |
-
|
394 |
-
foreach ($orders as $order) {
|
395 |
-
|
396 |
-
$order->load($order->getId());
|
397 |
-
$idCustomer = $order->getCustomer_id();
|
398 |
-
$quoteId = $order->getQuote_id();
|
399 |
-
|
400 |
-
if (!isset($idCustomer)) {
|
401 |
-
$idCustomer = $this->getNextFakeId($lastFakeId);
|
402 |
-
}
|
403 |
-
|
404 |
-
$bsOrder = Mage::getModel('recsins/order');
|
405 |
-
$bsOrder->setIdPurchase($order->getIncrementId());
|
406 |
-
$bsOrder->setIdCart($quoteId);
|
407 |
-
$bsOrder->setIdUser($idCustomer);
|
408 |
-
$bsOrder->setDate($order->getCreated_at());
|
409 |
-
$bsOrder->setAmount($order->getSubtotal());
|
410 |
-
|
411 |
-
$bsCart = Mage::getModel('recsins/cart');
|
412 |
-
$bsCart->setIdCart($quoteId);
|
413 |
-
$bsCart->setIdUser($idCustomer);
|
414 |
-
$bsCart->setStartDate($order->getCreated_at());
|
415 |
-
$bsCart->setFinishDate($order->getCreated_at());
|
416 |
-
|
417 |
-
$orderItems = array();
|
418 |
-
$cartItems = array();
|
419 |
-
|
420 |
-
$items = $order->getAllItems();
|
421 |
-
foreach ($items as $item) {
|
422 |
-
|
423 |
-
if ($item->getParentItemId()) {
|
424 |
-
continue;
|
425 |
-
}
|
426 |
-
|
427 |
-
$idProduct = $item->getProduct_id();
|
428 |
-
$price = $item->getPrice();
|
429 |
-
$qty = (int) $item->getQty_ordered();
|
430 |
-
|
431 |
-
if (array_key_exists($idProduct, $orderItems)) {
|
432 |
-
$newQty = $orderItems[$idProduct]['qty'] + $qty;
|
433 |
-
$newPrice = ($orderItems[$idProduct]['price'] * $orderItems[$idProduct]['qty'] + $price * $qty) / $newQty;
|
434 |
-
$orderItems[$idProduct]['qty'] = $newQty;
|
435 |
-
$orderItems[$idProduct]['price'] = $newPrice;
|
436 |
-
$cartItems[$idProduct]['qty'] = $newQty;
|
437 |
-
$cartItems[$idProduct]['price'] = $newPrice;
|
438 |
-
} else {
|
439 |
-
$orderItems[$idProduct] = array();
|
440 |
-
$cartItems[$idProduct] = array();
|
441 |
-
$orderItems[$idProduct]['qty'] = $qty;
|
442 |
-
$orderItems[$idProduct]['price'] = $price;
|
443 |
-
$cartItems[$idProduct]['qty'] = $qty;
|
444 |
-
$cartItems[$idProduct]['price'] = $price;
|
445 |
-
}
|
446 |
-
}
|
447 |
-
|
448 |
-
$bsCart->setProducts($cartItems);
|
449 |
-
$bsOrder->setProducts($orderItems);
|
450 |
-
|
451 |
-
$client->addCart($bsCart);
|
452 |
-
$client->addOrder($bsOrder);
|
453 |
-
}
|
454 |
-
|
455 |
-
$result = $client->sendCatalogCarts();
|
456 |
-
$result = $result && $client->sendCatalogPurchases($firstTransaction);
|
457 |
-
|
458 |
-
Mage::getModel('core/config')->saveConfig('brainsins/LAST_PAGE_SENT', $lastPage + 1);
|
459 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_LAST_FAKE_ID', $lastFakeId);
|
460 |
-
return $result;
|
461 |
-
}
|
462 |
-
|
463 |
-
public function uploadQuotes($quotes, $userId = null) {
|
464 |
-
|
465 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
466 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
467 |
-
|
468 |
-
foreach ($quotes as $quote) {
|
469 |
-
|
470 |
-
$orderId = $quote->getOrig_order_id();
|
471 |
-
if ($orderId == 0) {
|
472 |
-
$orderId = $quote->getReserved_order_id();
|
473 |
-
}
|
474 |
-
|
475 |
-
if ($orderId == 0) {
|
476 |
-
$items = $quote->getAllItems();
|
477 |
-
|
478 |
-
if (count($items) > 0) {
|
479 |
-
$idCustomer = $userId ? $userId : $quote->getCustomer()->getId();
|
480 |
-
if ($idCustomer) {
|
481 |
-
|
482 |
-
$cartCustomerId = $userId ? $userId : $quote->getCustomer()->getId();
|
483 |
-
|
484 |
-
$bsCart = Mage::getModel('recsins/cart');
|
485 |
-
$bsCart->setIdCart($quote->getId());
|
486 |
-
$bsCart->setUserId($cartCustomerId);
|
487 |
-
|
488 |
-
$bsCart->setStart_date($quote->getCreated_at());
|
489 |
-
$bsCart->setFinish_date($quote->getUpdated_at());
|
490 |
-
$cartItems = array();
|
491 |
-
|
492 |
-
|
493 |
-
foreach ($items as $item) {
|
494 |
-
if ($item->getParentItemId()) {
|
495 |
-
continue;
|
496 |
-
}
|
497 |
-
|
498 |
-
$qty = $item->getQty();
|
499 |
-
$price = $item->getBasePriceInclTax();
|
500 |
-
|
501 |
-
|
502 |
-
$product = $item->getProduct();
|
503 |
-
|
504 |
-
$productId = $product->getId();
|
505 |
-
$configurable_product_model = Mage::getModel('catalog/product_type_configurable');
|
506 |
-
$parentIdArray = $configurable_product_model->getParentIdsByChild($productId);
|
507 |
-
|
508 |
-
$found = false;
|
509 |
-
|
510 |
-
foreach ($cartItems as $storedItem) {
|
511 |
-
|
512 |
-
if ($productId == $storedItem->getProduct_id()) {
|
513 |
-
|
514 |
-
$storedQty = $storedItem->getQuantity();
|
515 |
-
$storedPrice = $storedItem->getPrice();
|
516 |
-
|
517 |
-
$newQty = $storedQty + $qty;
|
518 |
-
$newPrice = ($storedPrice * $storedQty + $price * $qty) / $newQty;
|
519 |
-
|
520 |
-
$storedItem->setQuantity($newQty);
|
521 |
-
$storedItem->setPrice($newPrice);
|
522 |
-
|
523 |
-
$found = true;
|
524 |
-
break;
|
525 |
-
}
|
526 |
-
}
|
527 |
-
|
528 |
-
if (!$found) {
|
529 |
-
$cartItem = Mage::getModel('recsins/cartProduct');
|
530 |
-
|
531 |
-
$cartItem->setProduct_id($productId);
|
532 |
-
$cartItem->setQuantity($qty);
|
533 |
-
$cartItem->setPrice($price);
|
534 |
-
|
535 |
-
$cartItems[] = $cartItem;
|
536 |
-
}
|
537 |
-
}
|
538 |
-
|
539 |
-
$bsCart->setProducts($cartItems);
|
540 |
-
$client->addCart($bsCart);
|
541 |
-
}
|
542 |
-
} else {
|
543 |
-
//empty cart -> nothing to upload
|
544 |
-
}
|
545 |
-
}
|
546 |
-
}
|
547 |
-
$result = $client->sendFullCarts();
|
548 |
-
return $result;
|
549 |
-
}
|
550 |
-
|
551 |
-
public function trackCheckoutBegin($userId) {
|
552 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
553 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
554 |
-
|
555 |
-
$result = $client->beginCheckout($userId);
|
556 |
-
}
|
557 |
-
|
558 |
-
public function trackCheckoutSuccess($order, $user) {
|
559 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
560 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
561 |
-
|
562 |
-
$idOrder;
|
563 |
-
|
564 |
-
$total = 0;
|
565 |
-
|
566 |
-
$idsMultipleArray = Mage::getSingleton('core/session')->getOrderIds(true);
|
567 |
-
$firstElement = true;
|
568 |
-
|
569 |
-
if ($idsMultipleArray && is_array($idsMultipleArray)) {
|
570 |
-
foreach ($idsMultipleArray as $id) {
|
571 |
-
if ($firstElement) {
|
572 |
-
$idOrder = $id;
|
573 |
-
$firstElement = false;
|
574 |
-
}
|
575 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($id);
|
576 |
-
$total += $order->getBaseSubtotalInclTax();
|
577 |
-
}
|
578 |
-
} else {
|
579 |
-
$idOrder = $order->getIncrementId();
|
580 |
-
$total = $order->getBaseSubtotalInclTax();
|
581 |
-
//$total = $order->getBase_grand_total();
|
582 |
-
}
|
583 |
-
|
584 |
-
$result = $client->endCheckout($idOrder, $user, $total);
|
585 |
-
|
586 |
-
return $result;
|
587 |
-
}
|
588 |
-
|
589 |
-
public function sendUpdatedUser($idUser, $email) {
|
590 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
591 |
-
$client = Mage::getModel("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
592 |
-
$user = Mage::getModel('recsins/user', array('user_id' => $idUser, 'email' => $email));
|
593 |
-
$res = $client->sendUser($idUser, $email);
|
594 |
-
return $res;
|
595 |
-
}
|
596 |
-
|
597 |
-
public function checkNewUser($customer) {
|
598 |
-
|
599 |
-
if (!isset($customer) || !$customer) {
|
600 |
-
return;
|
601 |
-
}
|
602 |
-
|
603 |
-
$lastId = Mage::getStoreConfig('brainsins/BS_LAST_CUSTOMER_ID_UPLOADED');
|
604 |
-
$idUser = $customer->getId();
|
605 |
-
$email = "";
|
606 |
-
|
607 |
-
if (!isset($lastId) || !$lastId || $idUser > $lastId) {
|
608 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_LAST_CUSTOMER_ID_UPLOADED', $idUser);
|
609 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
610 |
-
$client = Mage::getSingleton("recsins/client", array("server" => $this->server, "storeKey" => $key));
|
611 |
-
|
612 |
-
$subscriber = Mage::getModel("newsletter/subscriber");
|
613 |
-
$subscriber->loadByCustomer($customer);
|
614 |
-
|
615 |
-
if ($subscriber->isSubscribed()) {
|
616 |
-
$email = $subscriber->getEmail();
|
617 |
-
}
|
618 |
-
|
619 |
-
$user = Mage::getModel('recsins/user', array('user_id' => $idUser, 'email' => $email));
|
620 |
-
|
621 |
-
$client->addUser($user);
|
622 |
-
$client->sendUsers();
|
623 |
-
$res = $client->sendUserLogin($idUser, $_COOKIE['coId']);
|
624 |
-
|
625 |
-
setcookie("ul", 1);
|
626 |
-
setcookie("uId", $idUser);
|
627 |
-
|
628 |
-
return true;
|
629 |
-
} else {
|
630 |
-
return false;
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
public function requestRecommendations($recommenderId, $productId, $clientId, $lang, $divName, $categories, $filter) {
|
635 |
-
|
636 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
637 |
-
|
638 |
-
$url = "http://recommender.brainsins.com/recommender.php";
|
639 |
-
|
640 |
-
$url .= "?token=" . $key;
|
641 |
-
$url .= "&userId=" . $clientId;
|
642 |
-
|
643 |
-
$url .= "&recId=" . $recommenderId;
|
644 |
-
|
645 |
-
if (isset($productId) && $productId != "") {
|
646 |
-
$url .= "&prodId=" . $productId;
|
647 |
-
}
|
648 |
-
|
649 |
-
if (isset($lang) && $lang != "") {
|
650 |
-
$url .= "&lang=" . $lang;
|
651 |
-
}
|
652 |
-
|
653 |
-
$url .= "&dN=" . $divName;
|
654 |
-
|
655 |
-
if (isset($categories) && $categories != "") {
|
656 |
-
$url .= "&cat=" . $categories;
|
657 |
-
}
|
658 |
-
|
659 |
-
if (isset($filter) && $filter != "") {
|
660 |
-
$url .= "&filter=" . $filter;
|
661 |
-
}
|
662 |
-
$curl = curl_init();
|
663 |
-
curl_setopt($curl, CURLOPT_URL, $url);
|
664 |
-
$timeout = 2;
|
665 |
-
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
|
666 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
667 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/plain", "Accept: text/plain"));
|
668 |
-
$result = curl_exec($curl);
|
669 |
-
curl_close($curl);
|
670 |
-
return($result);
|
671 |
-
|
672 |
-
}
|
673 |
-
|
674 |
-
public function log($message) {
|
675 |
-
$pathToBsLogDir = Mage::getBaseDir('base') . "/errors/bsins";
|
676 |
-
|
677 |
-
if (isset($pathToBsLogDir) && !is_dir($pathToBsLogDir)) {
|
678 |
-
mkdir($pathToBsLogDir);
|
679 |
-
}
|
680 |
-
|
681 |
-
if (isset($pathToBsLogDir) && is_dir($pathToBsLogDir)) {
|
682 |
-
$f = fopen($pathToBsLogDir . "/bslog.txt", "a");
|
683 |
-
if ($f !== false) {
|
684 |
-
fwrite($f, "[" . date('j-m-y H:m:s') . "] -> ");
|
685 |
-
fwrite($f, $message);
|
686 |
-
fwrite($f, PHP_EOL);
|
687 |
-
}
|
688 |
-
}
|
689 |
-
}
|
690 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Resource/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Model/Resource/Eav/Mysql4/Recommender.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Resource_Eav_Mysql4_Recommender extends Mage_Eav_Model_Entity_Abstract {
|
28 |
-
|
29 |
-
public function _construct() {
|
30 |
-
$resource = Mage::getSingleton('core/resource');
|
31 |
-
$this->setType('recsins_recommender');
|
32 |
-
$this->setConnection($resource->getConnection('recsins_read'), $resource->getConnection('recsins_write'));
|
33 |
-
}
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Resource/Eav/Mysql4/Recommender/Collection.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Resource_Eav_Mysql4_Recommender_Collection extends Mage_Eav_Model_Entity_Collection_Abstract {
|
28 |
-
|
29 |
-
protected function _construct() {
|
30 |
-
$this->_init('recsins/recommender');
|
31 |
-
}
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Resource/Setup.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/User.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_User extends Mage_Core_Model_Abstract {
|
28 |
-
|
29 |
-
private $user_id;
|
30 |
-
|
31 |
-
protected function _construct() {
|
32 |
-
$this->user_id = $this->_data['user_id'];
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/controllers/.DS_Store
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/controllers/Adminhtml/RecsinsController.php
DELETED
@@ -1,380 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
function bsErrorHandler($errno, $errstr, $errfile, $errline) {
|
28 |
-
//Mage::getModel('recsins/recsins')->log($errno . " | " . $errstr . " | " . $errfile . " at line " . $errline);
|
29 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('recsins')->__('Error. Please try again'));
|
30 |
-
return mageCoreErrorHandler($errno, $errstr, $errfile, $errline);
|
31 |
-
}
|
32 |
-
|
33 |
-
class Brainsins_Recsins_Adminhtml_RecsinsController extends Mage_Adminhtml_Controller_Action {
|
34 |
-
|
35 |
-
protected function _initAction() {
|
36 |
-
$this->loadLayout()
|
37 |
-
->_setActiveMenu('recsins/items')
|
38 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
39 |
-
|
40 |
-
return $this;
|
41 |
-
}
|
42 |
-
|
43 |
-
public function indexAction() {
|
44 |
-
//TODO just for testing
|
45 |
-
$currentVersion = Mage::getStoreConfig('brainsins/BS_VERSION');
|
46 |
-
$lastVersion = Mage::getStoreConfig('brainsins/BS_LAST_AVAILABLE_VERSION');
|
47 |
-
if (isset($lastVersion) && isset($currentVersion)) {
|
48 |
-
if ($lastVersion > $currentVersion) {
|
49 |
-
Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('recsins')->__('There is a new Version Available: BrainSINS extension for Magento v') . $lastVersion);
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
$this->_initAction()
|
54 |
-
->renderLayout();
|
55 |
-
}
|
56 |
-
|
57 |
-
public function editAction() {
|
58 |
-
$id = $this->getRequest()->getParam('id');
|
59 |
-
$model = Mage::getModel('recsins/recsins')->load($id);
|
60 |
-
|
61 |
-
if ($model->getId() || $id == 0) {
|
62 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
63 |
-
if (!empty($data)) {
|
64 |
-
$model->setData($data);
|
65 |
-
}
|
66 |
-
|
67 |
-
Mage::register('recsins_data', $model);
|
68 |
-
|
69 |
-
$this->loadLayout();
|
70 |
-
$this->_setActiveMenu('recsins/items');
|
71 |
-
|
72 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
73 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
74 |
-
|
75 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
76 |
-
|
77 |
-
$this->_addContent($this->getLayout()->createBlock('recsins/adminhtml_recsins_edit'))
|
78 |
-
->_addLeft($this->getLayout()->createBlock('recsins/adminhtml_recsins_edit_tabs'));
|
79 |
-
|
80 |
-
$this->renderLayout();
|
81 |
-
} else {
|
82 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('recsins')->__('Item does not exist'));
|
83 |
-
$this->_redirect('*/*/');
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
public function newAction() {
|
88 |
-
$this->_forward('edit');
|
89 |
-
}
|
90 |
-
|
91 |
-
private function validateBSKey($key) {
|
92 |
-
$pattern = '/^BS-\d{10}-\d+$/';
|
93 |
-
if (preg_match($pattern, $key)) {
|
94 |
-
return true;
|
95 |
-
} else {
|
96 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('recsins')->__('"' . $key . '" is not a valid BS-KEY. The BS-KEY must be like "BS-0123456789-1"'));
|
97 |
-
return false;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
public function saveAction() {
|
102 |
-
|
103 |
-
$old_error_handler = set_error_handler("bsErrorHandler");
|
104 |
-
|
105 |
-
try {
|
106 |
-
|
107 |
-
//throw new Exception("BSException: extrange category");
|
108 |
-
|
109 |
-
$data = $this->getRequest()->getPost();
|
110 |
-
|
111 |
-
if ($data) {
|
112 |
-
|
113 |
-
$key = $data['bskey_text'];
|
114 |
-
|
115 |
-
if (!$this->validateBSKey($key)) {
|
116 |
-
$this->_redirect('*/*/');
|
117 |
-
return;
|
118 |
-
}
|
119 |
-
|
120 |
-
if (isset($key)) {
|
121 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BSKEY', $key);
|
122 |
-
}
|
123 |
-
|
124 |
-
$enabled = $data['bsenableoptions'];
|
125 |
-
|
126 |
-
if ($enabled === '0') {
|
127 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_ENABLED', '0');
|
128 |
-
} else {
|
129 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_ENABLED', '1');
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
$homeRecommender;
|
134 |
-
$categoryRecommender;
|
135 |
-
$productRecommender;
|
136 |
-
$cartRecommender;
|
137 |
-
$checkoutRecommender;
|
138 |
-
|
139 |
-
if (array_key_exists('bshome_recommenders', $data)) {
|
140 |
-
$homeRecommender = $data['bshome_recommenders'];
|
141 |
-
} else {
|
142 |
-
$homeRecommender = 0;
|
143 |
-
}
|
144 |
-
|
145 |
-
if (array_key_exists('bscategory_recommenders', $data)) {
|
146 |
-
$categoryRecommender = $data['bscategory_recommenders'];
|
147 |
-
} else {
|
148 |
-
$categoryRecommender = 0;
|
149 |
-
}
|
150 |
-
|
151 |
-
if (array_key_exists('bsproduct_recommenders', $data)) {
|
152 |
-
$productRecommender = $data['bsproduct_recommenders'];
|
153 |
-
} else {
|
154 |
-
$productRecommender = 0;
|
155 |
-
}
|
156 |
-
|
157 |
-
if (array_key_exists('bscart_recommenders', $data)) {
|
158 |
-
$cartRecommender = $data['bscart_recommenders'];
|
159 |
-
} else {
|
160 |
-
$cartRecommender = 0;
|
161 |
-
}
|
162 |
-
|
163 |
-
if (array_key_exists('bscheckout_recommenders', $data)) {
|
164 |
-
$checkoutRecommender = $data['bscheckout_recommenders'];
|
165 |
-
} else {
|
166 |
-
$checkoutRecommender = 0;
|
167 |
-
}
|
168 |
-
|
169 |
-
if (isset($homeRecommender) && $homeRecommender !== null) {
|
170 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_HOME_RECOMMENDER', $homeRecommender);
|
171 |
-
}
|
172 |
-
|
173 |
-
if (isset($categoryRecommender) && $categoryRecommender !== null) {
|
174 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_CATEGORY_RECOMMENDER', $categoryRecommender);
|
175 |
-
}
|
176 |
-
|
177 |
-
if (isset($productRecommender) && $productRecommender !== null) {
|
178 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_PRODUCT_RECOMMENDER', $productRecommender);
|
179 |
-
}
|
180 |
-
|
181 |
-
if (isset($checkoutRecommender) && $checkoutRecommender !== null) {
|
182 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_CHECKOUT_RECOMMENDER', $checkoutRecommender);
|
183 |
-
}
|
184 |
-
|
185 |
-
if (isset($cartRecommender) && $cartRecommender !== null) {
|
186 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_CART_RECOMMENDER', $cartRecommender);
|
187 |
-
}
|
188 |
-
|
189 |
-
$uploadOutOfStockProducts = false;
|
190 |
-
|
191 |
-
if (array_key_exists("out_of_stock_checkbox", $data)) {
|
192 |
-
$uploadOutOfStockValue = $data['out_of_stock_checkbox'];
|
193 |
-
if (isset($uploadOutOfStockValue) && $uploadOutOfStockValue == "checked") {
|
194 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS', "1");
|
195 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_SEND_OUT_OF_STOCK_PRODUCTS', "1");
|
196 |
-
} else {
|
197 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
198 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
199 |
-
}
|
200 |
-
} else {
|
201 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
202 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
203 |
-
}
|
204 |
-
|
205 |
-
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
206 |
-
foreach($currencies as $currency) {
|
207 |
-
if (array_key_exists($currency.'_symb_text', $data)) {
|
208 |
-
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_SYMBOL", $data[$currency.'_symb_text']);
|
209 |
-
}
|
210 |
-
|
211 |
-
if (array_key_exists($currency . "_symb_pos_options", $data)) {
|
212 |
-
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_POSITION", $data[$currency.'_symb_pos_options']);
|
213 |
-
}
|
214 |
-
|
215 |
-
if (array_key_exists($currency .'_delim', $data)) {
|
216 |
-
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_DELIMITER", $data[$currency .'_delim']);
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
|
223 |
-
if (array_key_exists("bsimageoptions", $data)) {
|
224 |
-
$resizeImages = $data['bsimageoptions'];
|
225 |
-
if (isset($resizeImages)) {
|
226 |
-
if ($resizeImages == 'image_no_resize') {
|
227 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE', "image_no_resize");
|
228 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE', "image_no_resize");
|
229 |
-
} else if ($resizeImages == 'image_resize') {
|
230 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE', "image_resize");
|
231 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE', "image_resize");
|
232 |
-
if (array_key_exists('image_width_text', $data) && isset($data['image_width_text'])) {
|
233 |
-
$width = $data['image_width_text'];
|
234 |
-
if (is_numeric($width) && $width > 0) {
|
235 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE_WIDTH', $width);
|
236 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE_WIDTH', $width);
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
if (array_key_exists('image_heigth_text', $data) && isset($data['image_heigth_text'])) {
|
241 |
-
$heigth = $data['image_heigth_text'];
|
242 |
-
if (is_numeric($heigth) && $heigth > 0) {
|
243 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH', $heigth);
|
244 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE_HEIGTH', $heigth);
|
245 |
-
} else {
|
246 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH', "");
|
247 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE_HEIGTH', "");
|
248 |
-
}
|
249 |
-
}
|
250 |
-
} else {
|
251 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_IMAGE_RESIZE', "image_no_resize");
|
252 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_IMAGE_RESIZE', "image_no_resize");
|
253 |
-
}
|
254 |
-
}
|
255 |
-
}
|
256 |
-
|
257 |
-
if (array_key_exists("bsspecialpriceoptions", $data)) {
|
258 |
-
$specialPrice = $data['bsspecialpriceoptions'];
|
259 |
-
if (isset($specialPrice)) {
|
260 |
-
if ($specialPrice == 'special_price_yes') {
|
261 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_SPECIAL_PRICE', "1");
|
262 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins/BS_USE_SPECIAL_PRICE', "1");
|
263 |
-
} else {
|
264 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_SPECIAL_PRICE', "0");
|
265 |
-
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins/BS_USE_SPECIAL_PRICE', "0");
|
266 |
-
}
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
if (array_key_exists("bstaxpriceoptions", $data)) {
|
271 |
-
$taxPrice = $data['bstaxpriceoptions'];
|
272 |
-
if (isset($taxPrice)) {
|
273 |
-
if ($taxPrice == 'tax_price_equal') {
|
274 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_TAX_PRICE', "tax_price_equal");
|
275 |
-
} else if ($taxPrice == 'tax_price_plus') {
|
276 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_TAX_PRICE', "tax_price_plus");
|
277 |
-
} else if ($taxPrice == 'tax_price_minus') {
|
278 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_TAX_PRICE', "tax_price_minus");
|
279 |
-
} else {
|
280 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_TAX_PRICE', "tax_price_equal");
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
if (array_key_exists("bs_script", $data)) {
|
286 |
-
$bsScript = $data['bs_script'];
|
287 |
-
if (isset($bsScript)) {
|
288 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_URL', $bsScript);
|
289 |
-
}
|
290 |
-
}
|
291 |
-
|
292 |
-
if (array_key_exists("bs_script_https", $data)) {
|
293 |
-
$bsScriptHttps = $data['bs_script_https'];
|
294 |
-
if (isset($bsScriptHttps)) {
|
295 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_THTTPS_URL', $bsScriptHttps);
|
296 |
-
}
|
297 |
-
}
|
298 |
-
|
299 |
-
if (array_key_exists("use_high_detail", $data)) {
|
300 |
-
$useHighDetailValue = $data['use_high_detail'];
|
301 |
-
if (isset($useHighDetailValue) && $useHighDetailValue == "checked") {
|
302 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "1");
|
303 |
-
} else {
|
304 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "0");
|
305 |
-
}
|
306 |
-
} else {
|
307 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "0");
|
308 |
-
}
|
309 |
-
|
310 |
-
if (array_key_exists("use_ajax_requests", $data)) {
|
311 |
-
$useAjaxRequestsValue = $data['use_ajax_requests'];
|
312 |
-
if (isset($useAjaxRequestsValue) && $useAjaxRequestsValue == "checked") {
|
313 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_AJAX_REQUESTS', "1");
|
314 |
-
} else {
|
315 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_AJAX_REQUESTS', "0");
|
316 |
-
}
|
317 |
-
} else {
|
318 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_AJAX_REQUESTS', "0");
|
319 |
-
}
|
320 |
-
|
321 |
-
$importConfig = $data['import_config'];
|
322 |
-
if (isset($importConfig) && $importConfig == '1') {
|
323 |
-
|
324 |
-
$recsins = Mage::getSingleton('recsins/recsins');
|
325 |
-
$result = $recsins->importRecommenders();
|
326 |
-
if ($result === true) {
|
327 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('recsins')->__('Recommenders imported sucssessfully'));
|
328 |
-
} else {
|
329 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('recsins')->__('Error while importing recommenders'));
|
330 |
-
}
|
331 |
-
$this->_redirect('*/*/');
|
332 |
-
}
|
333 |
-
}
|
334 |
-
} catch (Exception $e) {
|
335 |
-
Mage::getModel('recsins/recsins')->log($e);
|
336 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('recsins')->__('Error. Please try again'));
|
337 |
-
}
|
338 |
-
|
339 |
-
$this->_redirect('*/*/');
|
340 |
-
|
341 |
-
|
342 |
-
return;
|
343 |
-
}
|
344 |
-
|
345 |
-
public function deleteAction() {
|
346 |
-
$this->_redirect('*/*/');
|
347 |
-
}
|
348 |
-
|
349 |
-
public function massDeleteAction() {
|
350 |
-
$this->_redirect('*/*/index');
|
351 |
-
}
|
352 |
-
|
353 |
-
public function massStatusAction() {
|
354 |
-
$this->_redirect('*/*/index');
|
355 |
-
}
|
356 |
-
|
357 |
-
public function exportCsvAction() {
|
358 |
-
|
359 |
-
}
|
360 |
-
|
361 |
-
public function exportXmlAction() {
|
362 |
-
|
363 |
-
}
|
364 |
-
|
365 |
-
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
|
366 |
-
$response = $this->getResponse();
|
367 |
-
$response->setHeader('HTTP/1.1 200 OK', '');
|
368 |
-
$response->setHeader('Pragma', 'public', true);
|
369 |
-
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
370 |
-
$response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
|
371 |
-
$response->setHeader('Last-Modified', date('r'));
|
372 |
-
$response->setHeader('Accept-Ranges', 'bytes');
|
373 |
-
$response->setHeader('Content-Length', strlen($content));
|
374 |
-
$response->setHeader('Content-type', $contentType);
|
375 |
-
$response->setBody($content);
|
376 |
-
$response->sendResponse();
|
377 |
-
die;
|
378 |
-
}
|
379 |
-
|
380 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/controllers/IndexController.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_IndexController extends Mage_Core_Controller_Front_Action {
|
28 |
-
|
29 |
-
public function indexAction() {
|
30 |
-
|
31 |
-
$model = Mage::getModel('recsins/recommender');
|
32 |
-
$this->loadLayout();
|
33 |
-
$this->renderLayout();
|
34 |
-
}
|
35 |
-
|
36 |
-
public function getRecProdImgAction() {
|
37 |
-
|
38 |
-
$id = $this->getRequest()->getParam("id");
|
39 |
-
$helper = Mage::helper("recsins/recsins");
|
40 |
-
$url = $helper->getImageUrl($id);
|
41 |
-
if (isset($url) && $url) {
|
42 |
-
$this->_redirectUrl($url);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
public function getRecProdImgUrlAction() {
|
47 |
-
|
48 |
-
$id = $this->getRequest()->getParam("id");
|
49 |
-
$helper = Mage::helper("recsins/recsins");
|
50 |
-
$url = $helper->getImageUrl($id);
|
51 |
-
|
52 |
-
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
53 |
-
$url = "https://www.gemln.com/media/catalog/product/cache/7/small_image/149x155/9df78eab33525d08d6e5fb8d27136e95/T/r/Tresara-DiamondRing-GBRIN0060085-227.jpg";
|
54 |
-
$pos = strpos($url, "/", 8);
|
55 |
-
if ($pos !== false) {
|
56 |
-
$relativeUrl = substr($url, $pos);
|
57 |
-
return $relativeUrl;
|
58 |
-
} else {
|
59 |
-
return $url;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
public function getRecProdImgRelativeUrl($id) {
|
64 |
-
|
65 |
-
$helper = Mage::helper("recsins/recsins");
|
66 |
-
$url = $helper->getImageUrl($id);
|
67 |
-
|
68 |
-
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
69 |
-
$pos = strpos($url, "/", 8);
|
70 |
-
if ($pos !== false) {
|
71 |
-
$relativeUrl = substr($url, $pos);
|
72 |
-
return $relativeUrl;
|
73 |
-
} else {
|
74 |
-
return $url;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @return JSON Object
|
80 |
-
*/
|
81 |
-
public function getRecommendationsAction() {
|
82 |
-
|
83 |
-
|
84 |
-
$recommenderId = $this->getRequest()->getParam("recId");
|
85 |
-
$userId = $this->getRequest()->getParam("userId");
|
86 |
-
$productId = $this->getRequest()->getParam("prodId");
|
87 |
-
$lang = $this->getRequest()->getParam("lang");
|
88 |
-
$divName = $this->getRequest()->getParam("divName");
|
89 |
-
$numRecs = $this->getRequest()->getParam("numRecs");
|
90 |
-
$categories = $this->getRequest()->getParam("categories");
|
91 |
-
$filter = $this->getRequest()->getParam("filter");
|
92 |
-
$detail = $this->getRequest()->getParam("detail");
|
93 |
-
$currSymbol = $this->getRequest()->getParam("currSymbol");
|
94 |
-
$currPosition = $this->getRequest()->getParam("currPosition");
|
95 |
-
$currDelimiter = $this->getRequest()->getParam("currDelimiter");
|
96 |
-
$callback = $this->getRequest()->getParam("callback");
|
97 |
-
|
98 |
-
$model = Mage::getSingleton("recsins/recsins");
|
99 |
-
$model = new Brainsins_Recsins_Model_Recsins();
|
100 |
-
$result = $model->requestRecommendations($recommenderId, $productId, $userId, $lang, $divName, $categories, $filter);
|
101 |
-
|
102 |
-
$json = json_decode($result, true);
|
103 |
-
|
104 |
-
foreach($json["data"]["list"] as &$item) {
|
105 |
-
$item['imageUrl'] = $this->getRecProdImgRelativeUrl($item["id"]);
|
106 |
-
}
|
107 |
-
|
108 |
-
$updatedJson = json_encode($json);
|
109 |
-
|
110 |
-
$script = "";
|
111 |
-
|
112 |
-
if (!isset($callback) || $calback == "") {
|
113 |
-
$callback = "BrainSINSRecommender.paintRecommendations";
|
114 |
-
}
|
115 |
-
|
116 |
-
$this->getResponse()->setHeader('Content-type', 'application/json');
|
117 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($json));
|
118 |
-
|
119 |
-
return;
|
120 |
-
}
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/etc/api.xml
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<api>
|
4 |
-
<resources>
|
5 |
-
<bsApi translate="title" module="brainsins_recsins">
|
6 |
-
<title>BrainSINS API Extension</title>
|
7 |
-
<model>Brainsins_Recsins_Model_Api_Api</model>
|
8 |
-
<methods>
|
9 |
-
<test translate="title" module="brainsins_recsins">
|
10 |
-
<title>Just a test call</title>
|
11 |
-
<method>test</method>
|
12 |
-
<acl>catalog/product</acl>
|
13 |
-
</test>
|
14 |
-
<storeList translate="title" module="brainsins_recsins">
|
15 |
-
<title>get all the stores</title>
|
16 |
-
<method>storeList</method>
|
17 |
-
<acl>catalog/product</acl>
|
18 |
-
</storeList>
|
19 |
-
<currencyList translate="title" module="brainsins_recsins">
|
20 |
-
<title>get all the currencies</title>
|
21 |
-
<method>currencyList</method>
|
22 |
-
<acl>catalog/product</acl>
|
23 |
-
</currencyList>
|
24 |
-
<productInfo translate="title" module="brainsins_recsins">
|
25 |
-
<title>get product info</title>
|
26 |
-
<method>productInfo</method>
|
27 |
-
<acl>catalog/product</acl>
|
28 |
-
</productInfo>
|
29 |
-
<productList translate="title" module="brainsins_recsins">
|
30 |
-
<title>get product list with basic info</title>
|
31 |
-
<method>productList</method>
|
32 |
-
<acl>catalog/product</acl>
|
33 |
-
</productList>
|
34 |
-
<productCount translate="title" module="brainsins_recsins">
|
35 |
-
<title>get number of products</title>
|
36 |
-
<method>productCount</method>
|
37 |
-
<acl>catalog/product</acl>
|
38 |
-
</productCount>
|
39 |
-
<productPage translate="title" module="brainsins_recsins">
|
40 |
-
<title>get a page of products</title>
|
41 |
-
<method>productPage</method>
|
42 |
-
<acl>catalog/product</acl>
|
43 |
-
</productPage>
|
44 |
-
<extensionOptions translate="title" module="brainsins_recsins">
|
45 |
-
<title>get brainsins selected options</title>
|
46 |
-
<method>getExtensionOptions</method>
|
47 |
-
<acl>catalog/product</acl>
|
48 |
-
</extensionOptions>
|
49 |
-
<userCount translate="title" module="brainsins_recsins">
|
50 |
-
<title>get number of users</title>
|
51 |
-
<method>userCount</method>
|
52 |
-
<acl>catalog/product</acl>
|
53 |
-
</userCount>
|
54 |
-
<userPage translate="title" module="brainsins_recsins">
|
55 |
-
<title>get a page of users</title>
|
56 |
-
<method>userPage</method>
|
57 |
-
<acl>catalog/product</acl>
|
58 |
-
</userPage>
|
59 |
-
<notifyVersion translate="title" module="brainsins_recsins">
|
60 |
-
<title>notify last version</title>
|
61 |
-
<method>notifyVersion</method>
|
62 |
-
<acl>catalog/product</acl>
|
63 |
-
</notifyVersion>
|
64 |
-
</methods>
|
65 |
-
</bsApi>
|
66 |
-
</resources>
|
67 |
-
<acl>
|
68 |
-
<resources>
|
69 |
-
<all>
|
70 |
-
</all>
|
71 |
-
</resources>
|
72 |
-
</acl>
|
73 |
-
</api>
|
74 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/etc/config.xml
DELETED
@@ -1,254 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
-->
|
25 |
-
|
26 |
-
<config>
|
27 |
-
<modules>
|
28 |
-
<Brainsins_Recsins>
|
29 |
-
<version>1.6.3</version>
|
30 |
-
</Brainsins_Recsins>
|
31 |
-
</modules>
|
32 |
-
<frontend>
|
33 |
-
<routers>
|
34 |
-
<recsins>
|
35 |
-
<use>standard</use>
|
36 |
-
<args>
|
37 |
-
<module>Brainsins_Recsins</module>
|
38 |
-
<frontName>recsins</frontName>
|
39 |
-
</args>
|
40 |
-
</recsins>
|
41 |
-
</routers>
|
42 |
-
<layout>
|
43 |
-
<updates>
|
44 |
-
<recsins>
|
45 |
-
<file>recsins.xml</file>
|
46 |
-
</recsins>
|
47 |
-
</updates>
|
48 |
-
</layout>
|
49 |
-
</frontend>
|
50 |
-
<admin>
|
51 |
-
<menu>
|
52 |
-
<recsins module="recsins">
|
53 |
-
<title>BrainSINS</title>
|
54 |
-
<sort_order>73</sort_order>
|
55 |
-
<children>
|
56 |
-
<items module="recsins">
|
57 |
-
<title>Configure</title>
|
58 |
-
<sort_order>0</sort_order>
|
59 |
-
<action>admin/recsins</action>
|
60 |
-
</items>
|
61 |
-
</children>
|
62 |
-
</recsins>
|
63 |
-
</menu>
|
64 |
-
<routers>
|
65 |
-
<recsins>
|
66 |
-
<use>admin</use>
|
67 |
-
<args>
|
68 |
-
<module>Brainsins_Recsins</module>
|
69 |
-
<frontName>recsinsAdmin</frontName>
|
70 |
-
</args>
|
71 |
-
</recsins>
|
72 |
-
</routers>
|
73 |
-
<layout>
|
74 |
-
<updates>
|
75 |
-
<recsins>
|
76 |
-
<file>recsins.xml</file>
|
77 |
-
</recsins>
|
78 |
-
</updates>
|
79 |
-
</layout>
|
80 |
-
</admin>
|
81 |
-
<adminhtml>
|
82 |
-
<menu>
|
83 |
-
<recsins module="recsins">
|
84 |
-
<title>BrainSINS</title>
|
85 |
-
<sort_order>71</sort_order>
|
86 |
-
<children>
|
87 |
-
<items module="recsins">
|
88 |
-
<title>Configure</title>
|
89 |
-
<sort_order>0</sort_order>
|
90 |
-
<action>recsins/adminhtml_recsins</action>
|
91 |
-
</items>
|
92 |
-
</children>
|
93 |
-
</recsins>
|
94 |
-
</menu>
|
95 |
-
<translate>
|
96 |
-
<modules>
|
97 |
-
<recsins_recommender>
|
98 |
-
<files>
|
99 |
-
<default>Brainsins_Recsins.csv</default>
|
100 |
-
</files>
|
101 |
-
</recsins_recommender>
|
102 |
-
</modules>
|
103 |
-
</translate>
|
104 |
-
<acl>
|
105 |
-
<resources>
|
106 |
-
<all>
|
107 |
-
<title>Allow Everything</title>
|
108 |
-
</all>
|
109 |
-
<admin>
|
110 |
-
<children>
|
111 |
-
<Brainsins_Recsins>
|
112 |
-
<title>Recsins Module</title>
|
113 |
-
<sort_order>10</sort_order>
|
114 |
-
</Brainsins_Recsins>
|
115 |
-
</children>
|
116 |
-
</admin>
|
117 |
-
</resources>
|
118 |
-
</acl>
|
119 |
-
<layout>
|
120 |
-
<updates>
|
121 |
-
<recsins>
|
122 |
-
<file>recsins.xml</file>
|
123 |
-
</recsins>
|
124 |
-
</updates>
|
125 |
-
</layout>
|
126 |
-
</adminhtml>
|
127 |
-
<global>
|
128 |
-
<models>
|
129 |
-
<recsins>
|
130 |
-
<class>Brainsins_Recsins_Model</class>
|
131 |
-
</recsins>
|
132 |
-
<recommender>
|
133 |
-
<class>Brainsins_Recsins_Model</class>
|
134 |
-
</recommender>
|
135 |
-
<client>
|
136 |
-
<class>Brainsins_Recsins_Model</class>
|
137 |
-
</client>
|
138 |
-
<product>
|
139 |
-
<class>Brainsins_Recsins_Model</class>
|
140 |
-
</product>
|
141 |
-
<orderProduct>
|
142 |
-
<class>Brainsins_Recsins_Model</class>
|
143 |
-
</orderProduct>
|
144 |
-
<cartProduct>
|
145 |
-
<class>Brainsins_Recsins_Model</class>
|
146 |
-
</cartProduct>
|
147 |
-
<user>
|
148 |
-
<class>Brainsins_Recsins_Model</class>
|
149 |
-
</user>
|
150 |
-
<order>
|
151 |
-
<class>Brainsins_Recsins_Model</class>
|
152 |
-
</order>
|
153 |
-
<cart>
|
154 |
-
<class>Brainsins_Recsins_Model</class>
|
155 |
-
</cart>
|
156 |
-
</models>
|
157 |
-
<resources>
|
158 |
-
<recsins_write>
|
159 |
-
<connection>
|
160 |
-
<use>core_write</use>
|
161 |
-
</connection>
|
162 |
-
</recsins_write>
|
163 |
-
<recsins_read>
|
164 |
-
<connection>
|
165 |
-
<use>core_read</use>
|
166 |
-
</connection>
|
167 |
-
</recsins_read>
|
168 |
-
<recsins_setup>
|
169 |
-
<setup>
|
170 |
-
<module>Brainsins_Recsins</module>
|
171 |
-
<class>Brainsins_Recsins_Model_Resource_Setup</class>
|
172 |
-
</setup>
|
173 |
-
<connection>
|
174 |
-
<use>core_setup</use>
|
175 |
-
</connection>
|
176 |
-
</recsins_setup>
|
177 |
-
</resources>
|
178 |
-
<blocks>
|
179 |
-
<recsins>
|
180 |
-
<class>Brainsins_Recsins_Block</class>
|
181 |
-
</recsins>
|
182 |
-
</blocks>
|
183 |
-
<helpers>
|
184 |
-
<recsins>
|
185 |
-
<class>Brainsins_Recsins_Helper</class>
|
186 |
-
</recsins>
|
187 |
-
</helpers>
|
188 |
-
<events>
|
189 |
-
<customer_login>
|
190 |
-
<observers>
|
191 |
-
<Brainsins_Recsins>
|
192 |
-
<type>singleton</type>
|
193 |
-
<class>recsins/observer</class>
|
194 |
-
<method>onLogin</method>
|
195 |
-
</Brainsins_Recsins>
|
196 |
-
</observers>
|
197 |
-
</customer_login>
|
198 |
-
<checkout_cart_save_after>
|
199 |
-
<observers>
|
200 |
-
<Brainsins_Recsins>
|
201 |
-
<type>singleton</type>
|
202 |
-
<class>recsins/observer</class>
|
203 |
-
<method>onCart</method>
|
204 |
-
</Brainsins_Recsins>
|
205 |
-
</observers>
|
206 |
-
</checkout_cart_save_after>
|
207 |
-
<sales_order_payment_place_end>
|
208 |
-
<observers>
|
209 |
-
<Brainsins_Recsins>
|
210 |
-
<type>singleton</type>
|
211 |
-
<class>recsins/observer</class>
|
212 |
-
<method>onCheckoutSuccess</method>
|
213 |
-
</Brainsins_Recsins>
|
214 |
-
</observers>
|
215 |
-
</sales_order_payment_place_end>
|
216 |
-
<controller_action_postdispatch_checkout_multishipping_addresses>
|
217 |
-
<observers>
|
218 |
-
<Brainsins_Recsins>
|
219 |
-
<type>singleton</type>
|
220 |
-
<class>recsins/observer</class>
|
221 |
-
<method>onCheckoutStart</method>
|
222 |
-
</Brainsins_Recsins>
|
223 |
-
</observers>
|
224 |
-
</controller_action_postdispatch_checkout_multishipping_addresses>
|
225 |
-
<controller_action_postdispatch_checkout_onepage_index>
|
226 |
-
<observers>
|
227 |
-
<Brainsins_Recsins>
|
228 |
-
<type>singleton</type>
|
229 |
-
<class>recsins/observer</class>
|
230 |
-
<method>onCheckoutStart</method>
|
231 |
-
</Brainsins_Recsins>
|
232 |
-
</observers>
|
233 |
-
</controller_action_postdispatch_checkout_onepage_index>
|
234 |
-
<controller_action_postdispatch_customer_account_createpost>
|
235 |
-
<observers>
|
236 |
-
<Brainsins_Recsins>
|
237 |
-
<type>singleton</type>
|
238 |
-
<class>recsins/observer</class>
|
239 |
-
<method>onCreateAccount</method>
|
240 |
-
</Brainsins_Recsins>
|
241 |
-
</observers>
|
242 |
-
</controller_action_postdispatch_customer_account_createpost>
|
243 |
-
<newsletter_subscriber_save_after>
|
244 |
-
<observers>
|
245 |
-
<Brainsins_Recsins>
|
246 |
-
<type>singleton</type>
|
247 |
-
<class>recsins/observer</class>
|
248 |
-
<method>onCustomerSave</method>
|
249 |
-
</Brainsins_Recsins>
|
250 |
-
</observers>
|
251 |
-
</newsletter_subscriber_save_after>
|
252 |
-
</events>
|
253 |
-
</global>
|
254 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/etc/widget.xml
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
-->
|
25 |
-
|
26 |
-
<widgets>
|
27 |
-
<recsins_home type="recsins/home">
|
28 |
-
<name>BRAINSINS: Home</name>
|
29 |
-
<description type="desc">Recomendador de home</description>
|
30 |
-
</recsins_home>
|
31 |
-
</widgets>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-install-1.4.0.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
$installer = $this;
|
28 |
-
|
29 |
-
$table = $installer->getTable('recsins_recommender');
|
30 |
-
|
31 |
-
$installer->startSetup();
|
32 |
-
|
33 |
-
if (!$installer->tableExists($table)) {
|
34 |
-
$installer->run("
|
35 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
36 |
-
`id` int(10) unsigned NOT NULL,
|
37 |
-
`name` varchar(255),
|
38 |
-
`page` smallint(8),
|
39 |
-
PRIMARY KEY (`id`)
|
40 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
41 |
-
");
|
42 |
-
}
|
43 |
-
|
44 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.0');
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.0-1.4.1.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.1');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.1-1.4.2.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.2');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.2-1.4.3.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.3');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.3-1.4.4.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.4');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.4-1.4.5.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.5');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.5-1.4.6.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.6');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.6-1.4.7.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.7');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.7-1.4.8.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.8');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.8-1.4.9.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.4.9');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.4.9-1.5.0.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.0');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.0-1.5.1.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.1');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.1-1.5.2.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.2');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.2-1.5.3.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.3');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.3-1.5.4.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.4');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.4-1.5.5.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.5');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.5-1.5.6.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.6');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.6-1.5.7.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.7');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.7-1.5.8.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.8');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.8-1.5.9.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.9');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.9-1.6.0.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.6.0');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.0-1.6.1.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.6.1');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.1-1.6.2.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.6.2');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.2-1.6.3.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.6.3');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.6.3-1.6.4.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
$installer = $this;
|
27 |
-
|
28 |
-
$table = $installer->getTable('recsins_recommender');
|
29 |
-
|
30 |
-
$installer->startSetup();
|
31 |
-
|
32 |
-
if (!$installer->tableExists($table)) {
|
33 |
-
$installer->run("
|
34 |
-
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
-
`id` int(10) unsigned NOT NULL,
|
36 |
-
`name` varchar(255),
|
37 |
-
`page` smallint(8),
|
38 |
-
PRIMARY KEY (`id`)
|
39 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
-
");
|
41 |
-
}
|
42 |
-
|
43 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.6.4');
|
44 |
-
|
45 |
-
$installer->endSetup();
|
46 |
-
|
47 |
-
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Cm/RedisSession/Model/Session.php
ADDED
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Redis session handler with optimistic locking.
|
4 |
+
*
|
5 |
+
* Features:
|
6 |
+
* - Falls back to mysql handler if it can't connect to redis. Mysql handler falls back to file handler.
|
7 |
+
* - When a session's data exceeds the compression threshold the session data will be compressed.
|
8 |
+
* - Compression libraries supported are 'gzip', 'lzf' and 'snappy'. Lzf and Snappy are much faster than gzip.
|
9 |
+
* - Compression can be enabled, disabled, or reconfigured on the fly with no loss of session data.
|
10 |
+
* - Expiration is handled by Redis. No garbage collection needed.
|
11 |
+
* - Logs when sessions are not written due to not having or losing their lock.
|
12 |
+
* - Limits the number of concurrent lock requests before a 503 error is returned.
|
13 |
+
*
|
14 |
+
* Locking Algorithm Properties:
|
15 |
+
* - Only one process may get a write lock on a session.
|
16 |
+
* - A process may lose it's lock if another process breaks it, in which case the session will not be written.
|
17 |
+
* - The lock may be broken after BREAK_AFTER seconds and the process that gets the lock is indeterminate.
|
18 |
+
* - Only MAX_CONCURRENCY processes may be waiting for a lock for the same session or else a 503 error is returned.
|
19 |
+
* - Detects crashed processes to prevent session deadlocks (Linux only).
|
20 |
+
* - Detects inactive waiting processes to prevent false-positives in concurrency throttling.
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
class Cm_RedisSession_Model_Session extends Mage_Core_Model_Mysql4_Session
|
24 |
+
{
|
25 |
+
const BREAK_MODULO = 5; /* The lock will only be broken one of of this many tries to prevent multiple processes breaking the same lock */
|
26 |
+
const FAIL_AFTER = 15; /* Try to break lock for at most this many seconds */
|
27 |
+
const DETECT_ZOMBIES = 10; /* Try to detect zombies every this many seconds */
|
28 |
+
const MAX_LIFETIME = 2592000; /* Redis backend limit */
|
29 |
+
const SESSION_PREFIX = 'sess_';
|
30 |
+
const LOG_FILE = 'redis_session.log';
|
31 |
+
|
32 |
+
/* Bots get shorter session lifetimes */
|
33 |
+
const BOT_REGEX = '/^alexa|^blitz\.io|bot|^browsermob|crawl|^curl|^facebookexternalhit|feed|google web preview|^ia_archiver|^java|jakarta|^load impact|^magespeedtest|monitor|nagios|^pinterest|postrank|slurp|spider|uptime|yandex/i';
|
34 |
+
|
35 |
+
const XML_PATH_HOST = 'global/redis_session/host';
|
36 |
+
const XML_PATH_PORT = 'global/redis_session/port';
|
37 |
+
const XML_PATH_PASS = 'global/redis_session/password';
|
38 |
+
const XML_PATH_TIMEOUT = 'global/redis_session/timeout';
|
39 |
+
const XML_PATH_PERSISTENT = 'global/redis_session/persistent';
|
40 |
+
const XML_PATH_DB = 'global/redis_session/db';
|
41 |
+
const XML_PATH_COMPRESSION_THRESHOLD = 'global/redis_session/compression_threshold';
|
42 |
+
const XML_PATH_COMPRESSION_LIB = 'global/redis_session/compression_lib';
|
43 |
+
const XML_PATH_LOG_LEVEL = 'global/redis_session/log_level';
|
44 |
+
const XML_PATH_MAX_CONCURRENCY = 'global/redis_session/max_concurrency';
|
45 |
+
const XML_PATH_BREAK_AFTER = 'global/redis_session/break_after_%s';
|
46 |
+
const XML_PATH_BOT_LIFETIME = 'global/redis_session/bot_lifetime';
|
47 |
+
|
48 |
+
const DEFAULT_TIMEOUT = 2.5;
|
49 |
+
const DEFAULT_COMPRESSION_THRESHOLD = 2048;
|
50 |
+
const DEFAULT_COMPRESSION_LIB = 'gzip';
|
51 |
+
const DEFAULT_LOG_LEVEL = 1;
|
52 |
+
const DEFAULT_MAX_CONCURRENCY = 6; /* The maximum number of concurrent lock waiters per session */
|
53 |
+
const DEFAULT_BREAK_AFTER = 30; /* Try to break the lock after this many seconds */
|
54 |
+
const DEFAULT_BOT_LIFETIME = 7200; /* The session lifetime for bots - shorter to prevent bots from wasting backend storage */
|
55 |
+
|
56 |
+
/** @var bool */
|
57 |
+
protected $_useRedis;
|
58 |
+
|
59 |
+
/** @var Credis_Client */
|
60 |
+
protected $_redis;
|
61 |
+
|
62 |
+
/** @var int */
|
63 |
+
protected $_dbNum;
|
64 |
+
|
65 |
+
protected $_compressionThreshold;
|
66 |
+
protected $_compressionLib;
|
67 |
+
protected $_logLevel;
|
68 |
+
protected $_maxConcurrency;
|
69 |
+
protected $_breakAfter;
|
70 |
+
protected $_botLifetime;
|
71 |
+
protected $_isBot = FALSE;
|
72 |
+
protected $_hasLock;
|
73 |
+
protected $_sessionWritten; // avoid infinite loops
|
74 |
+
protected $_timeStart; // re-usable for timing instrumentation
|
75 |
+
|
76 |
+
static public $failedLockAttempts = 0; // for debug or informational purposes
|
77 |
+
|
78 |
+
public function __construct()
|
79 |
+
{
|
80 |
+
$this->_timeStart = microtime(true);
|
81 |
+
$host = (string) (Mage::getConfig()->getNode(self::XML_PATH_HOST) ?: '127.0.0.1');
|
82 |
+
$port = (int) (Mage::getConfig()->getNode(self::XML_PATH_PORT) ?: '6379');
|
83 |
+
$pass = (string) (Mage::getConfig()->getNode(self::XML_PATH_PASS) ?: '');
|
84 |
+
$timeout = (float) (Mage::getConfig()->getNode(self::XML_PATH_TIMEOUT) ?: self::DEFAULT_TIMEOUT);
|
85 |
+
$persistent = (string) (Mage::getConfig()->getNode(self::XML_PATH_PERSISTENT) ?: '');
|
86 |
+
$this->_dbNum = (int) (Mage::getConfig()->getNode(self::XML_PATH_DB) ?: 0);
|
87 |
+
$this->_compressionThreshold = (int) (Mage::getConfig()->getNode(self::XML_PATH_COMPRESSION_THRESHOLD) ?: self::DEFAULT_COMPRESSION_THRESHOLD);
|
88 |
+
$this->_compressionLib = (string) (Mage::getConfig()->getNode(self::XML_PATH_COMPRESSION_LIB) ?: self::DEFAULT_COMPRESSION_LIB);
|
89 |
+
$this->_logLevel = (int) (Mage::getConfig()->getNode(self::XML_PATH_LOG_LEVEL) ?: self::DEFAULT_LOG_LEVEL);
|
90 |
+
$this->_maxConcurrency = (int) (Mage::getConfig()->getNode(self::XML_PATH_MAX_CONCURRENCY) ?: self::DEFAULT_MAX_CONCURRENCY);
|
91 |
+
$this->_breakAfter = (int) (Mage::getConfig()->getNode(sprintf(self::XML_PATH_BREAK_AFTER, session_name())) ?: self::DEFAULT_BREAK_AFTER);
|
92 |
+
$this->_botLifetime = (int) (Mage::getConfig()->getNode(self::XML_PATH_BOT_LIFETIME) ?: self::DEFAULT_BOT_LIFETIME);
|
93 |
+
if ($this->_botLifetime) {
|
94 |
+
$userAgent = empty($_SERVER['HTTP_USER_AGENT']) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
|
95 |
+
$this->_isBot = ! $userAgent || preg_match(self::BOT_REGEX, $userAgent);
|
96 |
+
}
|
97 |
+
$this->_redis = new Credis_Client($host, $port, $timeout, $persistent);
|
98 |
+
if (!empty($pass)) {
|
99 |
+
$this->_redis->auth($pass) or Zend_Cache::throwException('Unable to authenticate with the redis server.');
|
100 |
+
}
|
101 |
+
$this->_redis->setCloseOnDestruct(FALSE); // Destructor order cannot be predicted
|
102 |
+
$this->_useRedis = TRUE;
|
103 |
+
if ($this->_logLevel >= 7) {
|
104 |
+
Mage::log(
|
105 |
+
sprintf(
|
106 |
+
"%s: %s initialized for connection to %s:%s after %.5f seconds",
|
107 |
+
$this->_getPid(),
|
108 |
+
get_class($this),
|
109 |
+
$host,
|
110 |
+
$port,
|
111 |
+
(microtime(true) - $this->_timeStart)
|
112 |
+
),
|
113 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
114 |
+
);
|
115 |
+
if ($this->_isBot) {
|
116 |
+
Mage::log(
|
117 |
+
sprintf(
|
118 |
+
"%s: Bot detected for user agent: %s",
|
119 |
+
$this->_getPid(),
|
120 |
+
$userAgent
|
121 |
+
),
|
122 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
123 |
+
);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Check DB connection
|
130 |
+
*
|
131 |
+
* @return bool
|
132 |
+
*/
|
133 |
+
public function hasConnection()
|
134 |
+
{
|
135 |
+
if( ! $this->_useRedis) return parent::hasConnection();
|
136 |
+
|
137 |
+
try {
|
138 |
+
$this->_redis->connect();
|
139 |
+
if ($this->_logLevel >= 7) {
|
140 |
+
Mage::log(
|
141 |
+
sprintf("%s: Connected to Redis",
|
142 |
+
$this->_getPid()
|
143 |
+
),
|
144 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
145 |
+
);
|
146 |
+
// reset timer
|
147 |
+
$this->_timeStart = microtime(true);
|
148 |
+
}
|
149 |
+
return TRUE;
|
150 |
+
}
|
151 |
+
catch (Exception $e) {
|
152 |
+
Mage::logException($e);
|
153 |
+
$this->_redis = NULL;
|
154 |
+
if ($this->_logLevel >= 0) {
|
155 |
+
Mage::log(
|
156 |
+
sprintf(
|
157 |
+
"%s: Unable to connect to Redis; falling back to MySQL handler",
|
158 |
+
$this->_getPid()
|
159 |
+
),
|
160 |
+
Zend_Log::EMERG, self::LOG_FILE
|
161 |
+
);
|
162 |
+
}
|
163 |
+
|
164 |
+
// Fall-back to MySQL handler. If this fails, the file handler will be used.
|
165 |
+
$this->_useRedis = FALSE;
|
166 |
+
parent::__construct();
|
167 |
+
return parent::hasConnection();
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Fetch session data
|
173 |
+
*
|
174 |
+
* @param string $sessionId
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public function read($sessionId)
|
178 |
+
{
|
179 |
+
if ( ! $this->_useRedis) return parent::read($sessionId);
|
180 |
+
|
181 |
+
// Get lock on session. Increment the "lock" field and if the new value is 1, we have the lock.
|
182 |
+
// If the new value is a multiple of BREAK_MODULO then we are breaking the lock.
|
183 |
+
$sessionId = self::SESSION_PREFIX.$sessionId;
|
184 |
+
$tries = $waiting = $lock = 0;
|
185 |
+
$detectZombies = FALSE;
|
186 |
+
if ($this->_logLevel >= 7) {
|
187 |
+
Mage::log(
|
188 |
+
sprintf(
|
189 |
+
"%s: Attempting read lock on ID %s",
|
190 |
+
$this->_getPid(),
|
191 |
+
$sessionId
|
192 |
+
),
|
193 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
194 |
+
);
|
195 |
+
// reset timer
|
196 |
+
$this->_timeStart = microtime(true);
|
197 |
+
}
|
198 |
+
if($this->_dbNum) $this->_redis->select($this->_dbNum);
|
199 |
+
while(1)
|
200 |
+
{
|
201 |
+
// Increment lock value for this session and retrieve the new value
|
202 |
+
$oldLock = $lock;
|
203 |
+
$lock = $this->_redis->hIncrBy($sessionId, 'lock', 1);
|
204 |
+
|
205 |
+
// If we got the lock, update with our pid and reset lock and expiration
|
206 |
+
if ($lock == 1 || ($tries >= $this->_breakAfter && $lock % self::BREAK_MODULO == 0)) {
|
207 |
+
$setData = array(
|
208 |
+
'pid' => $this->_getPid(),
|
209 |
+
'lock' => 1,
|
210 |
+
);
|
211 |
+
|
212 |
+
// Save request data in session so if a lock is broken we can know which page it was for debugging
|
213 |
+
if ($this->_logLevel >= 6)
|
214 |
+
{
|
215 |
+
$additionalDetails = sprintf(
|
216 |
+
"(%s attempts)",
|
217 |
+
$tries
|
218 |
+
);
|
219 |
+
if ($this->_logLevel >= 7)
|
220 |
+
{
|
221 |
+
$additionalDetails = sprintf(
|
222 |
+
"after %.5f seconds ",
|
223 |
+
(microtime(true) - $this->_timeStart),
|
224 |
+
$tries
|
225 |
+
) . $additionalDetails;
|
226 |
+
}
|
227 |
+
if (empty($_SERVER['REQUEST_METHOD'])) {
|
228 |
+
$setData['req'] = $_SERVER['SCRIPT_NAME'];
|
229 |
+
} else {
|
230 |
+
$setData['req'] = "{$_SERVER['REQUEST_METHOD']} {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
|
231 |
+
}
|
232 |
+
if ($lock != 1) {
|
233 |
+
Mage::log(
|
234 |
+
sprintf("%s: Successfully broke lock for ID %s %s. Lock: %s, BREAK_MODULO: %s\nLast request of broken lock: %s",
|
235 |
+
$this->_getPid(),
|
236 |
+
$sessionId,
|
237 |
+
$additionalDetails,
|
238 |
+
$lock,
|
239 |
+
self::BREAK_MODULO,
|
240 |
+
$this->_redis->hGet($sessionId, 'req')
|
241 |
+
),
|
242 |
+
Zend_Log::INFO, self::LOG_FILE
|
243 |
+
);
|
244 |
+
}
|
245 |
+
}
|
246 |
+
$this->_redis->pipeline()
|
247 |
+
->hMSet($sessionId, $setData)
|
248 |
+
->expire($sessionId, min($this->getLifeTime(), self::MAX_LIFETIME))
|
249 |
+
->exec();
|
250 |
+
$this->_hasLock = TRUE;
|
251 |
+
break;
|
252 |
+
}
|
253 |
+
|
254 |
+
// Otherwise, add to "wait" counter and continue
|
255 |
+
else if ( ! $waiting) {
|
256 |
+
$i = 0;
|
257 |
+
do {
|
258 |
+
$waiting = $this->_redis->hIncrBy($sessionId, 'wait', 1);
|
259 |
+
if ($this->_logLevel >= 7) {
|
260 |
+
Mage::log(
|
261 |
+
sprintf(
|
262 |
+
"%s: Waiting for lock on ID %s (%s tries, %s waiting, %.5f seconds elapsed)",
|
263 |
+
$this->_getPid(),
|
264 |
+
$sessionId,
|
265 |
+
$tries,
|
266 |
+
$waiting,
|
267 |
+
(microtime(true) - $this->_timeStart)
|
268 |
+
),
|
269 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
270 |
+
);
|
271 |
+
}
|
272 |
+
} while (++$i < $this->_maxConcurrency && $waiting < 1);
|
273 |
+
}
|
274 |
+
|
275 |
+
// Handle overloaded sessions
|
276 |
+
else {
|
277 |
+
// Detect broken sessions (e.g. caused by fatal errors)
|
278 |
+
if ($detectZombies) {
|
279 |
+
$detectZombies = FALSE;
|
280 |
+
if ( $lock > $oldLock // lock shouldn't be less than old lock (another process broke the lock)
|
281 |
+
&& $lock + 1 < $oldLock + $waiting // lock should be old+waiting, otherwise there must be a dead process
|
282 |
+
) {
|
283 |
+
// Reset session to fresh state
|
284 |
+
if ($this->_logLevel >= 6)
|
285 |
+
{
|
286 |
+
Mage::log(
|
287 |
+
sprintf("%s: Detected zombie waiter after %.5f seconds for ID %s (%s waiting)\n %s (%s - %s)",
|
288 |
+
$this->_getPid(),
|
289 |
+
(microtime(true) - $this->_timeStart),
|
290 |
+
$sessionId, $waiting,
|
291 |
+
Mage::app()->getRequest()->getRequestUri(), Mage::app()->getRequest()->getClientIp(), Mage::app()->getRequest()->getHeader('User-Agent')
|
292 |
+
),
|
293 |
+
Zend_Log::INFO, self::LOG_FILE
|
294 |
+
);
|
295 |
+
}
|
296 |
+
$waiting = $this->_redis->hIncrBy($sessionId, 'wait', -1);
|
297 |
+
continue;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
// Limit concurrent lock waiters to prevent server resource hogging
|
302 |
+
if ($waiting >= $this->_maxConcurrency) {
|
303 |
+
// Overloaded sessions get 503 errors
|
304 |
+
$this->_redis->hIncrBy($sessionId, 'wait', -1);
|
305 |
+
$this->_sessionWritten = TRUE; // Prevent session from getting written
|
306 |
+
$writes = $this->_redis->hGet($sessionId, 'writes');
|
307 |
+
if ($this->_logLevel >= 4)
|
308 |
+
{
|
309 |
+
Mage::log(
|
310 |
+
sprintf("%s: Session concurrency exceeded for ID %s; displaying HTTP 503 (%s waiting, %s total requests)\n %s (%s - %s)",
|
311 |
+
$this->_getPid(),
|
312 |
+
$sessionId, $waiting, $writes,
|
313 |
+
Mage::app()->getRequest()->getRequestUri(), Mage::app()->getRequest()->getClientIp(), Mage::app()->getRequest()->getHeader('User-Agent')
|
314 |
+
),
|
315 |
+
Zend_Log::WARN, self::LOG_FILE
|
316 |
+
);
|
317 |
+
}
|
318 |
+
require_once(Mage::getBaseDir() . DS . 'errors' . DS . '503.php');
|
319 |
+
exit;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
$tries++;
|
324 |
+
|
325 |
+
// Detect dead waiters
|
326 |
+
if ($tries == 1 /* TODO - $tries % 10 == 0 ? */) {
|
327 |
+
$detectZombies = TRUE;
|
328 |
+
// TODO: allow configuration of sleep period?
|
329 |
+
usleep(1500000); // 1.5 seconds
|
330 |
+
}
|
331 |
+
// Detect dead processes every 10 seconds
|
332 |
+
if ($tries % self::DETECT_ZOMBIES == 0) {
|
333 |
+
if ($this->_logLevel >= 7) {
|
334 |
+
Mage::log(
|
335 |
+
sprintf(
|
336 |
+
"%s: Checking for zombies after %.5f seconds of waiting...",
|
337 |
+
$this->_getPid(),
|
338 |
+
(microtime(true) - $this->_timeStart)
|
339 |
+
),
|
340 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
341 |
+
);
|
342 |
+
}
|
343 |
+
$pid = $this->_redis->hGet($sessionId, 'pid');
|
344 |
+
if ($pid && ! $this->_pidExists($pid)) {
|
345 |
+
// Allow a live process to get the lock
|
346 |
+
$this->_redis->hSet($sessionId, 'lock', 0);
|
347 |
+
if ($this->_logLevel >= 6)
|
348 |
+
{
|
349 |
+
Mage::log(
|
350 |
+
sprintf("%s: Detected zombie process (%s) for %s (%s waiting)\n %s (%s - %s)",
|
351 |
+
$this->_getPid(),
|
352 |
+
$pid, $sessionId, $waiting,
|
353 |
+
Mage::app()->getRequest()->getRequestUri(),
|
354 |
+
Mage::app()->getRequest()->getClientIp(),
|
355 |
+
Mage::app()->getRequest()->getHeader('User-Agent')
|
356 |
+
),
|
357 |
+
Zend_Log::INFO, self::LOG_FILE
|
358 |
+
);
|
359 |
+
}
|
360 |
+
continue;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
// Timeout
|
364 |
+
if ($tries >= $this->_breakAfter+self::FAIL_AFTER) {
|
365 |
+
$this->_hasLock = FALSE;
|
366 |
+
if ($this->_logLevel >= 5) {
|
367 |
+
$additionalDetails = sprintf(
|
368 |
+
"(%s attempts)",
|
369 |
+
$tries
|
370 |
+
);
|
371 |
+
if ($this->_logLevel >= 7)
|
372 |
+
{
|
373 |
+
$additionalDetails = sprintf(
|
374 |
+
"after %.5f seconds ",
|
375 |
+
(microtime(true) - $this->_timeStart),
|
376 |
+
$tries
|
377 |
+
) . $additionalDetails;
|
378 |
+
}
|
379 |
+
Mage::log(
|
380 |
+
sprintf(
|
381 |
+
"%s: Giving up on read lock for ID %s %s",
|
382 |
+
$this->_getPid(),
|
383 |
+
$sessionId,
|
384 |
+
$additionalDetails
|
385 |
+
),
|
386 |
+
Zend_Log::NOTICE, self::LOG_FILE
|
387 |
+
);
|
388 |
+
}
|
389 |
+
break;
|
390 |
+
}
|
391 |
+
else {
|
392 |
+
// TODO: configurable wait period?
|
393 |
+
sleep(1);
|
394 |
+
}
|
395 |
+
}
|
396 |
+
self::$failedLockAttempts = $tries;
|
397 |
+
|
398 |
+
// This process is no longer waiting for a lock
|
399 |
+
if ($tries > 0) {
|
400 |
+
$this->_redis->hIncrBy($sessionId, 'wait', -1);
|
401 |
+
}
|
402 |
+
|
403 |
+
// Session can be read even if it was not locked by this pid!
|
404 |
+
$sessionData = $this->_redis->hGet($sessionId, 'data');
|
405 |
+
if ($this->_logLevel >= 7) {
|
406 |
+
Mage::log(
|
407 |
+
sprintf(
|
408 |
+
"%s: Data read for ID %s after %.5f seconds",
|
409 |
+
$this->_getPid(),
|
410 |
+
$sessionId,
|
411 |
+
(microtime(true) - $this->_timeStart)
|
412 |
+
),
|
413 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
414 |
+
);
|
415 |
+
}
|
416 |
+
return $sessionData ? $this->_decodeData($sessionData) : '';
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Update session
|
421 |
+
*
|
422 |
+
* @param string $sessionId
|
423 |
+
* @param string $sessionData
|
424 |
+
* @return boolean
|
425 |
+
*/
|
426 |
+
public function write($sessionId, $sessionData)
|
427 |
+
{
|
428 |
+
if ( ! $this->_useRedis) return parent::write($sessionId, $sessionData);
|
429 |
+
if ($this->_sessionWritten) {
|
430 |
+
if ($this->_logLevel >= 7) {
|
431 |
+
Mage::log(
|
432 |
+
sprintf(
|
433 |
+
"%s: Repeated session write detected; skipping for ID %s",
|
434 |
+
$this->_getPid(),
|
435 |
+
$sessionId
|
436 |
+
),
|
437 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
438 |
+
);
|
439 |
+
}
|
440 |
+
return TRUE;
|
441 |
+
}
|
442 |
+
$this->_sessionWritten = TRUE;
|
443 |
+
if ($this->_logLevel >= 7) {
|
444 |
+
Mage::log(
|
445 |
+
sprintf(
|
446 |
+
"%s: Attempting write to ID %s",
|
447 |
+
$this->_getPid(),
|
448 |
+
$sessionId
|
449 |
+
),
|
450 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
451 |
+
);
|
452 |
+
// reset timer
|
453 |
+
$this->_timeStart = microtime(true);
|
454 |
+
}
|
455 |
+
|
456 |
+
// Do not overwrite the session if it is locked by another pid
|
457 |
+
try {
|
458 |
+
if($this->_dbNum) $this->_redis->select($this->_dbNum); // Prevent conflicts with other connections?
|
459 |
+
$pid = $this->_redis->hGet('sess_'.$sessionId, 'pid'); // PHP Fatal errors cause self::SESSION_PREFIX to not work..
|
460 |
+
if ( ! $pid || $pid == $this->_getPid()) {
|
461 |
+
if ($this->_logLevel >= 7) {
|
462 |
+
Mage::log(
|
463 |
+
sprintf(
|
464 |
+
"%s: Write lock obtained on ID %s",
|
465 |
+
$this->_getPid(),
|
466 |
+
$sessionId
|
467 |
+
),
|
468 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
469 |
+
);
|
470 |
+
}
|
471 |
+
$this->_writeRawSession($sessionId, $sessionData, $this->getLifeTime());
|
472 |
+
if ($this->_logLevel >= 7) {
|
473 |
+
Mage::log(
|
474 |
+
sprintf(
|
475 |
+
"%s: Data written to ID %s after %.5f seconds",
|
476 |
+
$this->_getPid(),
|
477 |
+
$sessionId,
|
478 |
+
(microtime(true) - $this->_timeStart)
|
479 |
+
),
|
480 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
481 |
+
);
|
482 |
+
}
|
483 |
+
}
|
484 |
+
else {
|
485 |
+
if ($this->_logLevel >= 4) {
|
486 |
+
if ($this->_hasLock) {
|
487 |
+
Mage::log(
|
488 |
+
sprintf("%s: Unable to write session after %.5f seconds, another process took the lock for ID %s",
|
489 |
+
$this->_getPid(),
|
490 |
+
(microtime(true) - $this->_timeStart),
|
491 |
+
$sessionId
|
492 |
+
),
|
493 |
+
Zend_Log::WARN,
|
494 |
+
self::LOG_FILE
|
495 |
+
);
|
496 |
+
} else {
|
497 |
+
Mage::log(
|
498 |
+
sprintf("%s: Unable to write session after %.5f seconds, unable to acquire lock on ID %s",
|
499 |
+
$this->_getPid(),
|
500 |
+
(microtime(true) - $this->_timeStart),
|
501 |
+
$sessionId
|
502 |
+
),
|
503 |
+
Zend_Log::WARN,
|
504 |
+
self::LOG_FILE
|
505 |
+
);
|
506 |
+
}
|
507 |
+
}
|
508 |
+
}
|
509 |
+
}
|
510 |
+
catch(Exception $e) {
|
511 |
+
if (class_exists('Mage', false)) {
|
512 |
+
Mage::logException($e);
|
513 |
+
} else {
|
514 |
+
error_log("$e");
|
515 |
+
}
|
516 |
+
return FALSE;
|
517 |
+
}
|
518 |
+
return TRUE;
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Destroy session
|
523 |
+
*
|
524 |
+
* @param string $sessionId
|
525 |
+
* @return boolean
|
526 |
+
*/
|
527 |
+
public function destroy($sessionId)
|
528 |
+
{
|
529 |
+
if ( ! $this->_useRedis) return parent::destroy($sessionId);
|
530 |
+
|
531 |
+
if ($this->_logLevel >= 7) {
|
532 |
+
Mage::log(
|
533 |
+
sprintf(
|
534 |
+
"%s: Destroying ID %s",
|
535 |
+
$this->_getPid(),
|
536 |
+
$sessionId
|
537 |
+
),
|
538 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
539 |
+
);
|
540 |
+
}
|
541 |
+
$this->_redis->pipeline();
|
542 |
+
if($this->_dbNum) $this->_redis->select($this->_dbNum);
|
543 |
+
$this->_redis->del(self::SESSION_PREFIX.$sessionId);
|
544 |
+
$this->_redis->exec();
|
545 |
+
return TRUE;
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Overridden to prevent calling getLifeTime at shutdown
|
550 |
+
*
|
551 |
+
* @return bool
|
552 |
+
*/
|
553 |
+
public function close()
|
554 |
+
{
|
555 |
+
if ( ! $this->_useRedis) return parent::close();
|
556 |
+
if ($this->_logLevel >= 7) {
|
557 |
+
Mage::log(
|
558 |
+
sprintf(
|
559 |
+
"%s: Closing connection",
|
560 |
+
$this->_getPid()
|
561 |
+
),
|
562 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
563 |
+
);
|
564 |
+
}
|
565 |
+
if ($this->_redis) $this->_redis->close();
|
566 |
+
return TRUE;
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Garbage collection
|
571 |
+
*
|
572 |
+
* @param int $maxLifeTime ignored
|
573 |
+
* @return boolean
|
574 |
+
*/
|
575 |
+
public function gc($maxLifeTime)
|
576 |
+
{
|
577 |
+
if ( ! $this->_useRedis) return parent::gc($maxLifeTime);
|
578 |
+
return TRUE;
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* @return int|mixed
|
583 |
+
*/
|
584 |
+
public function getLifeTime()
|
585 |
+
{
|
586 |
+
if ($this->_isBot) {
|
587 |
+
return min(parent::getLifeTime(), $this->_botLifetime);
|
588 |
+
}
|
589 |
+
return parent::getLifeTime();
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Public for testing purposes only.
|
594 |
+
*
|
595 |
+
* @param string $data
|
596 |
+
* @return string
|
597 |
+
*/
|
598 |
+
public function _encodeData($data)
|
599 |
+
{
|
600 |
+
$originalDataSize = strlen($data);
|
601 |
+
if ($this->_compressionThreshold > 0 && $this->_compressionLib != 'none' && $originalDataSize >= $this->_compressionThreshold) {
|
602 |
+
if ($this->_logLevel >= 7) {
|
603 |
+
Mage::log(
|
604 |
+
sprintf(
|
605 |
+
"%s: Compressing %s bytes with %s",
|
606 |
+
$this->_getPid(),
|
607 |
+
$originalDataSize,
|
608 |
+
$this->_compressionLib
|
609 |
+
),
|
610 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
611 |
+
);
|
612 |
+
// reset timer
|
613 |
+
$this->_timeStart = microtime(true);
|
614 |
+
}
|
615 |
+
switch($this->_compressionLib) {
|
616 |
+
case 'snappy': $data = snappy_compress($data); break;
|
617 |
+
case 'lzf': $data = lzf_compress($data); break;
|
618 |
+
case 'gzip': $data = gzcompress($data, 1); break;
|
619 |
+
}
|
620 |
+
if($data) {
|
621 |
+
$data = ':'.substr($this->_compressionLib,0,2).':'.$data;
|
622 |
+
if ($this->_logLevel >= 7) {
|
623 |
+
Mage::log(
|
624 |
+
sprintf(
|
625 |
+
"%s: Data compressed by %.1f percent in %.5f seconds",
|
626 |
+
$this->_getPid(),
|
627 |
+
($originalDataSize == 0 ? 0 : (100 - (strlen($data) / $originalDataSize * 100))),
|
628 |
+
(microtime(true) - $this->_timeStart)
|
629 |
+
),
|
630 |
+
Zend_Log::DEBUG, self::LOG_FILE
|
631 |
+
);
|
632 |
+
}
|
633 |
+
} else if ($this->_logLevel >= 4) {
|
634 |
+
Mage::log(
|
635 |
+
sprintf("%s: Could not compress session data using %s",
|
636 |
+
$this->_getPid(),
|
637 |
+
$this->_compressionLib
|
638 |
+
),
|
639 |
+
Zend_Log::WARN,
|
640 |
+
self::LOG_FILE
|
641 |
+
);
|
642 |
+
}
|
643 |
+
}
|
644 |
+
return $data;
|
645 |
+
}
|
646 |
+
|
647 |
+
/**
|
648 |
+
* Public for testing purposes only.
|
649 |
+
*
|
650 |
+
* @param string $data
|
651 |
+
* @return string
|
652 |
+
*/
|
653 |
+
public function _decodeData($data)
|
654 |
+
{
|
655 |
+
switch (substr($data,0,4)) {
|
656 |
+
// asking the data which library it uses allows for transparent changes of libraries
|
657 |
+
case ':sn:': return snappy_uncompress(substr($data,4));
|
658 |
+
case ':lz:': return lzf_decompress(substr($data,4));
|
659 |
+
case ':gz:': return gzuncompress(substr($data,4));
|
660 |
+
}
|
661 |
+
return $data;
|
662 |
+
}
|
663 |
+
|
664 |
+
/**
|
665 |
+
* Public for testing/import purposes only.
|
666 |
+
*
|
667 |
+
* @param $id
|
668 |
+
* @param $data
|
669 |
+
* @param $lifetime
|
670 |
+
* @throws Exception
|
671 |
+
*/
|
672 |
+
public function _writeRawSession($id, $data, $lifetime)
|
673 |
+
{
|
674 |
+
if ( ! $this->_useRedis) {
|
675 |
+
throw new Exception('Not connected to redis!');
|
676 |
+
}
|
677 |
+
|
678 |
+
$sessionId = 'sess_' . $id;
|
679 |
+
$this->_redis->pipeline()
|
680 |
+
->select($this->_dbNum)
|
681 |
+
->hMSet($sessionId, array(
|
682 |
+
'data' => $this->_encodeData($data),
|
683 |
+
'lock' => 0, // 0 so that next lock attempt will get 1
|
684 |
+
))
|
685 |
+
->hIncrBy($sessionId, 'writes', 1) // For informational purposes only
|
686 |
+
->expire($sessionId, min($lifetime, 2592000))
|
687 |
+
->exec();
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* @param string $id
|
692 |
+
* @return array
|
693 |
+
* @throws Exception
|
694 |
+
*/
|
695 |
+
public function _inspectSession($id)
|
696 |
+
{
|
697 |
+
if ( ! $this->_useRedis) {
|
698 |
+
throw new Exception('Not connected to redis!');
|
699 |
+
}
|
700 |
+
|
701 |
+
$sessionId = 'sess_' . $id;
|
702 |
+
$this->_redis->select($this->_dbNum);
|
703 |
+
$data = $this->_redis->hGetAll($sessionId);
|
704 |
+
if ($data && isset($data['data'])) {
|
705 |
+
$data['data'] = $this->_decodeData($data['data']);
|
706 |
+
}
|
707 |
+
return $data;
|
708 |
+
}
|
709 |
+
|
710 |
+
/**
|
711 |
+
* @return string
|
712 |
+
*/
|
713 |
+
public function _getPid()
|
714 |
+
{
|
715 |
+
return gethostname().'|'.getmypid();
|
716 |
+
}
|
717 |
+
|
718 |
+
/**
|
719 |
+
* @param $pid
|
720 |
+
* @return bool
|
721 |
+
*/
|
722 |
+
public function _pidExists($pid)
|
723 |
+
{
|
724 |
+
list($host,$pid) = explode('|', $pid);
|
725 |
+
if (PHP_OS != 'Linux' || $host != gethostname()) {
|
726 |
+
return TRUE;
|
727 |
+
}
|
728 |
+
return @file_exists('/proc/'.$pid);
|
729 |
+
}
|
730 |
+
|
731 |
+
}
|
app/code/community/Cm/RedisSession/etc/config.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Cm_RedisSession>
|
4 |
+
<version>0.2</version>
|
5 |
+
</Cm_RedisSession>
|
6 |
+
</modules>
|
7 |
+
<global>
|
8 |
+
<models>
|
9 |
+
<core_mysql4>
|
10 |
+
<rewrite>
|
11 |
+
<session>Cm_RedisSession_Model_Session</session>
|
12 |
+
</rewrite>
|
13 |
+
</core_mysql4>
|
14 |
+
</models>
|
15 |
+
</global>
|
16 |
+
</config>
|
app/code/community/Phoenix/Moneybookers/Block/Form.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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Form extends Mage_Payment_Block_Form
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Available locales for content URL generation
|
24 |
+
*
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
protected $_supportedInfoLocales = array('de');
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Default locale for content URL generation
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
protected $_defaultInfoLocale = 'en';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Constructor. Set template.
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
parent::_construct();
|
42 |
+
$this->setTemplate('moneybookers/form.phtml');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Return payment logo image src
|
47 |
+
*
|
48 |
+
* @param string $payment Payment Code
|
49 |
+
* @return string|bool
|
50 |
+
*/
|
51 |
+
public function getPaymentImageSrc($payment)
|
52 |
+
{
|
53 |
+
if ($payment == 'moneybookers_obt') {
|
54 |
+
$payment .= '_'.$this->getInfoLocale();
|
55 |
+
}
|
56 |
+
|
57 |
+
$imageFilename = Mage::getDesign()
|
58 |
+
->getFilename('images' . DS . 'moneybookers' . DS . $payment, array('_type' => 'skin'));
|
59 |
+
|
60 |
+
if (file_exists($imageFilename . '.png')) {
|
61 |
+
return $this->getSkinUrl('images/moneybookers/' . $payment . '.png');
|
62 |
+
} else if (file_exists($imageFilename . '.gif')) {
|
63 |
+
return $this->getSkinUrl('images/moneybookers/' . $payment . '.gif');
|
64 |
+
}
|
65 |
+
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return supported locale for information text
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function getInfoLocale()
|
75 |
+
{
|
76 |
+
$locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
|
77 |
+
if (!in_array($locale, $this->_supportedInfoLocales)) {
|
78 |
+
$locale = $this->_defaultInfoLocale;
|
79 |
+
}
|
80 |
+
return $locale;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Return info URL for eWallet payment
|
85 |
+
*
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function getWltInfoUrl()
|
89 |
+
{
|
90 |
+
$locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
|
91 |
+
return 'http://www.moneybookers.com/app/?l=' . strtoupper($locale);
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Phoenix/Moneybookers/Block/Info.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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Info extends Mage_Payment_Block_Info
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Constructor. Set template.
|
24 |
+
*/
|
25 |
+
protected function _construct()
|
26 |
+
{
|
27 |
+
parent::_construct();
|
28 |
+
$this->setTemplate('moneybookers/info.phtml');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns code of payment method
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getMethodCode()
|
37 |
+
{
|
38 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Build PDF content of info block
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function toPdf()
|
47 |
+
{
|
48 |
+
$this->setTemplate('moneybookers/pdf/info.phtml');
|
49 |
+
return $this->toHtml();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Phoenix/Moneybookers/Block/Jsinit.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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Jsinit extends Mage_Adminhtml_Block_Template
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Include JS in head if section is moneybookers
|
24 |
+
*/
|
25 |
+
protected function _prepareLayout()
|
26 |
+
{
|
27 |
+
$section = $this->getAction()->getRequest()->getParam('section', false);
|
28 |
+
if ($section == 'moneybookers') {
|
29 |
+
$this->getLayout()
|
30 |
+
->getBlock('head')
|
31 |
+
->addJs('mage/adminhtml/moneybookers.js');
|
32 |
+
}
|
33 |
+
parent::_prepareLayout();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Print init JS script into body
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
protected function _toHtml()
|
41 |
+
{
|
42 |
+
$section = $this->getAction()->getRequest()->getParam('section', false);
|
43 |
+
if ($section == 'moneybookers') {
|
44 |
+
return parent::_toHtml();
|
45 |
+
} else {
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Phoenix/Moneybookers/Block/Payment.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Payment extends Mage_Core_Block_Template
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Return Payment logo src
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function getMoneybookersLogoSrc()
|
28 |
+
{
|
29 |
+
$locale = Mage::getModel('moneybookers/acc')->getLocale();
|
30 |
+
$logoFilename = Mage::getDesign()
|
31 |
+
->getFilename('images' . DS . 'moneybookers' . DS . 'banner_120_' . $locale . '.gif', array('_type' => 'skin'));
|
32 |
+
|
33 |
+
if (file_exists($logoFilename)) {
|
34 |
+
return $this->getSkinUrl('images/moneybookers/banner_120_'.$locale.'.gif');
|
35 |
+
}
|
36 |
+
|
37 |
+
return $this->getSkinUrl('images/moneybookers/banner_120_int.gif');
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Phoenix/Moneybookers/Block/Placeform.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Placeform extends Mage_Core_Block_Template
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Return checkout session instance
|
24 |
+
*
|
25 |
+
* @return Mage_Checkout_Model_Session
|
26 |
+
*/
|
27 |
+
protected function _getCheckout()
|
28 |
+
{
|
29 |
+
return Mage::getSingleton('checkout/session');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Return order instance
|
34 |
+
*
|
35 |
+
* @return Mage_Sales_Model_Order|null
|
36 |
+
*/
|
37 |
+
protected function _getOrder()
|
38 |
+
{
|
39 |
+
if ($this->getOrder()) {
|
40 |
+
return $this->getOrder();
|
41 |
+
} elseif ($orderIncrementId = $this->_getCheckout()->getLastRealOrderId()) {
|
42 |
+
return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
43 |
+
} else {
|
44 |
+
return null;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get Form data by using ogone payment api
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
public function getFormData()
|
54 |
+
{
|
55 |
+
return $this->_getOrder()->getPayment()->getMethodInstance()->getFormFields();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Getting gateway url
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getFormAction()
|
64 |
+
{
|
65 |
+
return $this->_getOrder()->getPayment()->getMethodInstance()->getUrl();
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Phoenix/Moneybookers/Block/Redirect.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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Block_Redirect extends Mage_Core_Block_Template
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Constructor. Set template.
|
24 |
+
*/
|
25 |
+
protected function _construct()
|
26 |
+
{
|
27 |
+
parent::_construct();
|
28 |
+
$this->setTemplate('moneybookers/redirect.phtml');
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Phoenix/Moneybookers/Helper/Data.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Helper_Data extends Mage_Payment_Helper_Data
|
21 |
+
{
|
22 |
+
const XML_PATH_EMAIL = 'moneybookers/settings/moneybookers_email';
|
23 |
+
const XML_PATH_CUSTOMER_ID = 'moneybookers/settings/customer_id';
|
24 |
+
const XML_PATH_SECRET_KEY = 'moneybookers/settings/secret_key';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Internal parameters for validation
|
28 |
+
*/
|
29 |
+
protected $_moneybookersServer = 'https://www.moneybookers.com';
|
30 |
+
protected $_checkEmailUrl = '/app/email_check.pl';
|
31 |
+
protected $_checkEmailCustId = '6999315';
|
32 |
+
protected $_checkEmailPassword = 'a4ce5a98a8950c04a3d34a2e2cb8c89f';
|
33 |
+
protected $_checkSecretUrl = '/app/secret_word_check.pl';
|
34 |
+
protected $_activationEmailTo = 'ecommerce@moneybookers.com';
|
35 |
+
protected $_activationEmailSubject = 'Magento Moneybookers Activation';
|
36 |
+
protected $_moneybookersMasterCustId = '7283403';
|
37 |
+
protected $_moneybookersMasterSecretHash = 'c18524b6b1082653039078a4700367f0';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Send activation Email to Moneybookers
|
41 |
+
*/
|
42 |
+
public function activateEmail()
|
43 |
+
{
|
44 |
+
$storeId = Mage::app()->getStore()->getId();
|
45 |
+
|
46 |
+
$translate = Mage::getSingleton('core/translate');
|
47 |
+
/* @var $translate Mage_Core_Model_Translate */
|
48 |
+
$translate->setTranslateInline(false);
|
49 |
+
|
50 |
+
Mage::getModel('core/email_template')
|
51 |
+
->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
|
52 |
+
->sendTransactional(
|
53 |
+
'moneybookers_activateemail',
|
54 |
+
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),
|
55 |
+
$this->_activationEmailTo,
|
56 |
+
null,
|
57 |
+
array(
|
58 |
+
'subject' => $this->_activationEmailSubject,
|
59 |
+
'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL),
|
60 |
+
'url' => Mage::getBaseUrl(),
|
61 |
+
'customer_id' => Mage::getStoreConfig(self::XML_PATH_CUSTOMER_ID),
|
62 |
+
'language' => Mage::getModel('core/locale')->getDefaultLocale()
|
63 |
+
)
|
64 |
+
);
|
65 |
+
|
66 |
+
$translate->setTranslateInline(true);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Check if email is registered at Moneybookers
|
71 |
+
*
|
72 |
+
* @param array $params
|
73 |
+
* @return array
|
74 |
+
*/
|
75 |
+
public function checkEmailRequest(Array $params) {
|
76 |
+
$response = null;
|
77 |
+
try {
|
78 |
+
$response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkEmailUrl, array(
|
79 |
+
'email' => $params['email'],
|
80 |
+
'cust_id' => $this->_checkEmailCustId,
|
81 |
+
'password' => $this->_checkEmailPassword)
|
82 |
+
);
|
83 |
+
} catch (Exception $e) {
|
84 |
+
Mage::log($e->getMessage());
|
85 |
+
return null;
|
86 |
+
}
|
87 |
+
return $response;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Check if entered secret is valid
|
92 |
+
* @param array $params
|
93 |
+
* @return array
|
94 |
+
*/
|
95 |
+
public function checkSecretRequest(Array $params)
|
96 |
+
{
|
97 |
+
$response = null;
|
98 |
+
try {
|
99 |
+
$response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkSecretUrl, array(
|
100 |
+
'email' => $params['email'],
|
101 |
+
'secret' => md5(md5($params['secret']) . $this->_moneybookersMasterSecretHash),
|
102 |
+
'cust_id' => $this->_moneybookersMasterCustId)
|
103 |
+
);
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::log($e->getMessage());
|
106 |
+
return null;
|
107 |
+
}
|
108 |
+
return $response;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Reading a page via HTTPS and returning its content.
|
113 |
+
*/
|
114 |
+
protected function _getHttpsPage($host, $parameter)
|
115 |
+
{
|
116 |
+
$client = new Varien_Http_Client();
|
117 |
+
$client->setUri($host)
|
118 |
+
->setConfig(array('timeout' => 30))
|
119 |
+
->setHeaders('accept-encoding', '')
|
120 |
+
->setParameterGet($parameter)
|
121 |
+
->setMethod(Zend_Http_Client::GET);
|
122 |
+
$request = $client->request();
|
123 |
+
// Workaround for pseudo chunked messages which are yet too short, so
|
124 |
+
// only an exception is is thrown instead of returning raw body
|
125 |
+
if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $request->getRawBody(), $m))
|
126 |
+
return $request->getRawBody();
|
127 |
+
|
128 |
+
return $request->getBody();
|
129 |
+
}
|
130 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Abstract.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
abstract class Phoenix_Moneybookers_Model_Abstract extends Mage_Payment_Model_Method_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_abstract';
|
26 |
+
|
27 |
+
protected $_formBlockType = 'moneybookers/form';
|
28 |
+
protected $_infoBlockType = 'moneybookers/info';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Availability options
|
32 |
+
*/
|
33 |
+
protected $_isGateway = true;
|
34 |
+
protected $_canAuthorize = true;
|
35 |
+
protected $_canCapture = true;
|
36 |
+
protected $_canCapturePartial = false;
|
37 |
+
protected $_canRefund = false;
|
38 |
+
protected $_canVoid = false;
|
39 |
+
protected $_canUseInternal = false;
|
40 |
+
protected $_canUseCheckout = true;
|
41 |
+
protected $_canUseForMultishipping = false;
|
42 |
+
|
43 |
+
protected $_paymentMethod = 'abstract';
|
44 |
+
protected $_defaultLocale = 'en';
|
45 |
+
protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr');
|
46 |
+
protected $_hidelogin = '1';
|
47 |
+
|
48 |
+
protected $_order;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get order model
|
52 |
+
*
|
53 |
+
* @return Mage_Sales_Model_Order
|
54 |
+
*/
|
55 |
+
public function getOrder()
|
56 |
+
{
|
57 |
+
if (!$this->_order) {
|
58 |
+
$this->_order = $this->getInfoInstance()->getOrder();
|
59 |
+
}
|
60 |
+
return $this->_order;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Return url for redirection after order placed
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getOrderPlaceRedirectUrl()
|
68 |
+
{
|
69 |
+
return Mage::getUrl('moneybookers/processing/payment');
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Capture payment through Moneybookers api
|
74 |
+
*
|
75 |
+
* @param Varien_Object $payment
|
76 |
+
* @param decimal $amount
|
77 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
78 |
+
*/
|
79 |
+
public function capture(Varien_Object $payment, $amount)
|
80 |
+
{
|
81 |
+
$payment->setStatus(self::STATUS_APPROVED)
|
82 |
+
->setTransactionId($this->getTransactionId())
|
83 |
+
->setIsTransactionClosed(0);
|
84 |
+
|
85 |
+
return $this;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Camcel payment
|
90 |
+
*
|
91 |
+
* @param Varien_Object $payment
|
92 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
93 |
+
*/
|
94 |
+
public function cancel(Varien_Object $payment)
|
95 |
+
{
|
96 |
+
$payment->setStatus(self::STATUS_DECLINED)
|
97 |
+
->setTransactionId($this->getTransactionId())
|
98 |
+
->setIsTransactionClosed(1);
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Return url of payment method
|
105 |
+
*
|
106 |
+
* @return string
|
107 |
+
*/
|
108 |
+
public function getUrl()
|
109 |
+
{
|
110 |
+
return 'https://www.moneybookers.com/app/payment.pl';
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Return url of payment method
|
115 |
+
*
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public function getLocale()
|
119 |
+
{
|
120 |
+
$locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
|
121 |
+
if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
|
122 |
+
return $locale[0];
|
123 |
+
}
|
124 |
+
return $this->getDefaultLocale();
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* prepare params array to send it to gateway page via POST
|
129 |
+
*
|
130 |
+
* @return array
|
131 |
+
*/
|
132 |
+
public function getFormFields()
|
133 |
+
{
|
134 |
+
$order_id = $this->getOrder()->getRealOrderId();
|
135 |
+
$billing = $this->getOrder()->getBillingAddress();
|
136 |
+
if ($this->getOrder()->getBillingAddress()->getEmail()) {
|
137 |
+
$email = $this->getOrder()->getBillingAddress()->getEmail();
|
138 |
+
} else {
|
139 |
+
$email = $this->getOrder()->getCustomerEmail();
|
140 |
+
}
|
141 |
+
|
142 |
+
$params = array(
|
143 |
+
'merchant_fields' => 'partner',
|
144 |
+
'partner' => 'magento',
|
145 |
+
'pay_to_email' => Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_EMAIL),
|
146 |
+
'transaction_id' => $order_id,
|
147 |
+
'return_url' => Mage::getUrl('moneybookers/processing/success', array('transaction_id' => $order_id)),
|
148 |
+
'cancel_url' => Mage::getUrl('moneybookers/processing/cancel', array('transaction_id' => $order_id)),
|
149 |
+
'status_url' => Mage::getUrl('moneybookers/processing/status'),
|
150 |
+
'language' => $this->getLocale(),
|
151 |
+
'amount' => round($this->getOrder()->getGrandTotal(), 2),
|
152 |
+
'currency' => $this->getOrder()->getOrderCurrencyCode(),
|
153 |
+
'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),
|
154 |
+
'firstname' => $billing->getFirstname(),
|
155 |
+
'lastname' => $billing->getLastname(),
|
156 |
+
'address' => $billing->getStreet(-1),
|
157 |
+
'postal_code' => $billing->getPostcode(),
|
158 |
+
'city' => $billing->getCity(),
|
159 |
+
'country' => $billing->getCountryModel()->getIso3Code(),
|
160 |
+
'pay_from_email' => $email,
|
161 |
+
'phone_number' => $billing->getTelephone(),
|
162 |
+
'detail1_description' => Mage::helper('moneybookers')->__('Order ID'),
|
163 |
+
'detail1_text' => $order_id,
|
164 |
+
'payment_methods' => $this->_paymentMethod,
|
165 |
+
'hide_login' => $this->_hidelogin,
|
166 |
+
'new_window_redirect' => '1'
|
167 |
+
);
|
168 |
+
|
169 |
+
// add optional day of birth
|
170 |
+
if ($billing->getDob()) {
|
171 |
+
$params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');
|
172 |
+
}
|
173 |
+
|
174 |
+
return $params;
|
175 |
+
}
|
176 |
+
/**
|
177 |
+
* Get initialized flag status
|
178 |
+
* @return true
|
179 |
+
*/
|
180 |
+
public function isInitializeNeeded()
|
181 |
+
{
|
182 |
+
return true;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Instantiate state and set it to state onject
|
187 |
+
* //@param
|
188 |
+
* //@param
|
189 |
+
*/
|
190 |
+
public function initialize($paymentAction, $stateObject)
|
191 |
+
{
|
192 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
193 |
+
$stateObject->setState($state);
|
194 |
+
$stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
195 |
+
$stateObject->setIsNotified(false);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Get config action to process initialization
|
200 |
+
*
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
+
public function getConfigPaymentAction()
|
204 |
+
{
|
205 |
+
$paymentAction = $this->getConfigData('payment_action');
|
206 |
+
return empty($paymentAction) ? true : $paymentAction;
|
207 |
+
}
|
208 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Acc.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Acc extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_acc';
|
26 |
+
protected $_paymentMethod = 'ACC';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Csi.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Csi extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_csi';
|
26 |
+
protected $_paymentMethod = 'CSI';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Did.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Did extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_did';
|
26 |
+
protected $_paymentMethod = 'DID';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Dnk.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Dnk extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_dnk';
|
26 |
+
protected $_paymentMethod = 'DNK';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Ebt.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Ebt extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_ebt';
|
26 |
+
protected $_paymentMethod = 'EBT';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Ent.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Ent extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_ent';
|
26 |
+
protected $_paymentMethod = 'ENT';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Event.php
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Moneybookers notification processor model
|
23 |
+
*/
|
24 |
+
class Phoenix_Moneybookers_Model_Event
|
25 |
+
{
|
26 |
+
const MONEYBOOKERS_STATUS_FAIL = -2;
|
27 |
+
const MONEYBOOKERS_STATUS_CANCEL = -1;
|
28 |
+
const MONEYBOOKERS_STATUS_PENDING = 0;
|
29 |
+
const MONEYBOOKERS_STATUS_SUCCESS = 2;
|
30 |
+
|
31 |
+
/*
|
32 |
+
* @param Mage_Sales_Model_Order
|
33 |
+
*/
|
34 |
+
protected $_order = null;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Event request data
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
protected $_eventData = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Enent request data setter
|
44 |
+
* @param array $data
|
45 |
+
* @return Phoenix_Moneybookers_Model_Event
|
46 |
+
*/
|
47 |
+
public function setEventData(array $data)
|
48 |
+
{
|
49 |
+
$this->_eventData = $data;
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Event request data getter
|
55 |
+
* @param string $key
|
56 |
+
* @return array|string
|
57 |
+
*/
|
58 |
+
public function getEventData($key = null)
|
59 |
+
{
|
60 |
+
if (null === $key) {
|
61 |
+
return $this->_eventData;
|
62 |
+
}
|
63 |
+
return isset($this->_eventData[$key]) ? $this->_eventData[$key] : null;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Get singleton of Checkout Session Model
|
68 |
+
*
|
69 |
+
* @return Mage_Checkout_Model_Session
|
70 |
+
*/
|
71 |
+
protected function _getCheckout()
|
72 |
+
{
|
73 |
+
return Mage::getSingleton('checkout/session');
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Process status notification from Monebookers server
|
78 |
+
*
|
79 |
+
* @return String
|
80 |
+
*/
|
81 |
+
public function processStatusEvent()
|
82 |
+
{
|
83 |
+
try {
|
84 |
+
$params = $this->_validateEventData();
|
85 |
+
$msg = '';
|
86 |
+
switch($params['status']) {
|
87 |
+
case self::MONEYBOOKERS_STATUS_FAIL: //fail
|
88 |
+
$msg = Mage::helper('moneybookers')->__('Payment failed.');
|
89 |
+
$this->_processCancel($msg);
|
90 |
+
break;
|
91 |
+
case self::MONEYBOOKERS_STATUS_CANCEL: //cancel
|
92 |
+
$msg = Mage::helper('moneybookers')->__('Payment was canceled.');
|
93 |
+
$this->_processCancel($msg);
|
94 |
+
break;
|
95 |
+
case self::MONEYBOOKERS_STATUS_PENDING: //pending
|
96 |
+
$msg = Mage::helper('moneybookers')->__('Pending bank transfer created.');
|
97 |
+
$this->_processSale($params['status'], $msg);
|
98 |
+
break;
|
99 |
+
case self::MONEYBOOKERS_STATUS_SUCCESS: //ok
|
100 |
+
$msg = Mage::helper('moneybookers')->__('The amount has been authorized and captured by Moneybookers.');
|
101 |
+
$this->_processSale($params['status'], $msg);
|
102 |
+
break;
|
103 |
+
}
|
104 |
+
return $msg;
|
105 |
+
} catch (Mage_Core_Exception $e) {
|
106 |
+
return $e->getMessage();
|
107 |
+
} catch(Exception $e) {
|
108 |
+
Mage::logException($e);
|
109 |
+
}
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Process cancelation
|
115 |
+
*/
|
116 |
+
public function cancelEvent() {
|
117 |
+
try {
|
118 |
+
$this->_validateEventData(false);
|
119 |
+
$this->_processCancel('Payment was canceled.');
|
120 |
+
return Mage::helper('moneybookers')->__('The order has been canceled.');
|
121 |
+
} catch (Mage_Core_Exception $e) {
|
122 |
+
return $e->getMessage();
|
123 |
+
} catch(Exception $e) {
|
124 |
+
Mage::logException($e);
|
125 |
+
}
|
126 |
+
return '';
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Validate request and return QuoteId
|
131 |
+
* Can throw Mage_Core_Exception and Exception
|
132 |
+
*
|
133 |
+
* @return int
|
134 |
+
*/
|
135 |
+
public function successEvent(){
|
136 |
+
$this->_validateEventData(false);
|
137 |
+
return $this->_order->getQuoteId();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Processed order cancelation
|
142 |
+
* @param string $msg Order history message
|
143 |
+
*/
|
144 |
+
protected function _processCancel($msg)
|
145 |
+
{
|
146 |
+
$this->_order->cancel();
|
147 |
+
$this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, $msg);
|
148 |
+
$this->_order->save();
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Processes payment confirmation, creates invoice if necessary, updates order status,
|
153 |
+
* sends order confirmation to customer
|
154 |
+
* @param string $msg Order history message
|
155 |
+
*/
|
156 |
+
protected function _processSale($status, $msg)
|
157 |
+
{
|
158 |
+
switch ($status) {
|
159 |
+
case self::MONEYBOOKERS_STATUS_SUCCESS:
|
160 |
+
$this->_createInvoice();
|
161 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $msg);
|
162 |
+
// save transaction ID
|
163 |
+
$this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
|
164 |
+
// send new order email
|
165 |
+
$this->_order->sendNewOrderEmail();
|
166 |
+
$this->_order->setEmailSent(true);
|
167 |
+
break;
|
168 |
+
case self::MONEYBOOKERS_STATUS_PENDING:
|
169 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $msg);
|
170 |
+
// save transaction ID
|
171 |
+
$this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
$this->_order->save();
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Builds invoice for order
|
179 |
+
*/
|
180 |
+
protected function _createInvoice()
|
181 |
+
{
|
182 |
+
if (!$this->_order->canInvoice()) {
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
$invoice = $this->_order->prepareInvoice();
|
186 |
+
$invoice->register()->capture();
|
187 |
+
$this->_order->addRelatedObject($invoice);
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Checking returned parameters
|
192 |
+
* Thorws Mage_Core_Exception if error
|
193 |
+
* @param bool $fullCheck Whether to make additional validations such as payment status, transaction signature etc.
|
194 |
+
*
|
195 |
+
* @return array $params request params
|
196 |
+
*/
|
197 |
+
protected function _validateEventData($fullCheck = true)
|
198 |
+
{
|
199 |
+
// get request variables
|
200 |
+
$params = $this->_eventData;
|
201 |
+
if (empty($params)) {
|
202 |
+
Mage::throwException('Request does not contain any elements.');
|
203 |
+
}
|
204 |
+
|
205 |
+
// check order ID
|
206 |
+
if (empty($params['transaction_id'])
|
207 |
+
|| ($fullCheck == false && $this->_getCheckout()->getMoneybookersRealOrderId() != $params['transaction_id'])
|
208 |
+
) {
|
209 |
+
Mage::throwException('Missing or invalid order ID.');
|
210 |
+
}
|
211 |
+
// load order for further validation
|
212 |
+
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transaction_id']);
|
213 |
+
if (!$this->_order->getId()) {
|
214 |
+
Mage::throwException('Order not found.');
|
215 |
+
}
|
216 |
+
|
217 |
+
if (0 !== strpos($this->_order->getPayment()->getMethodInstance()->getCode(), 'moneybookers_')) {
|
218 |
+
Mage::throwException('Unknown payment method.');
|
219 |
+
}
|
220 |
+
|
221 |
+
// make additional validation
|
222 |
+
if ($fullCheck) {
|
223 |
+
// check payment status
|
224 |
+
if (empty($params['status'])) {
|
225 |
+
Mage::throwException('Unknown payment status.');
|
226 |
+
}
|
227 |
+
|
228 |
+
// check transaction signature
|
229 |
+
if (empty($params['md5sig'])) {
|
230 |
+
Mage::throwException('Invalid transaction signature.');
|
231 |
+
}
|
232 |
+
|
233 |
+
$checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status');
|
234 |
+
$md5String = '';
|
235 |
+
foreach ($checkParams as $key) {
|
236 |
+
if ($key == 'merchant_id') {
|
237 |
+
$md5String .= Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_CUSTOMER_ID,
|
238 |
+
$this->_order->getStoreId()
|
239 |
+
);
|
240 |
+
} elseif ($key == 'secret') {
|
241 |
+
$secretKey = Mage::getStoreConfig(
|
242 |
+
Phoenix_Moneybookers_Helper_Data::XML_PATH_SECRET_KEY,
|
243 |
+
$this->_order->getStoreId()
|
244 |
+
);
|
245 |
+
|
246 |
+
if (empty($secretKey)) {
|
247 |
+
Mage::throwException('Secret key is empty.');
|
248 |
+
}
|
249 |
+
|
250 |
+
$md5String .= strtoupper(md5($secretKey));
|
251 |
+
} elseif (isset($params[$key])) {
|
252 |
+
$md5String .= $params[$key];
|
253 |
+
}
|
254 |
+
}
|
255 |
+
$md5String = strtoupper(md5($md5String));
|
256 |
+
|
257 |
+
if ($md5String != $params['md5sig']) {
|
258 |
+
Mage::throwException('Hash is not valid.');
|
259 |
+
}
|
260 |
+
|
261 |
+
// check transaction amount if currency matches
|
262 |
+
if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) {
|
263 |
+
if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) {
|
264 |
+
Mage::throwException('Transaction amount does not match.');
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
return $params;
|
269 |
+
}
|
270 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Gcb.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Gcb extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_gcb';
|
26 |
+
protected $_paymentMethod = 'GCB';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Gir.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Gir extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_gir';
|
26 |
+
protected $_paymentMethod = 'GIR';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Idl.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Idl extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_idl';
|
26 |
+
protected $_paymentMethod = 'IDL';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Lsr.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Lsr extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_lsr';
|
26 |
+
protected $_paymentMethod = 'LSR';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Mae.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Mae extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_mae';
|
26 |
+
protected $_paymentMethod = 'MAE';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Npy.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Npy extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_npy';
|
26 |
+
protected $_paymentMethod = 'NPY';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Obt.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Obt extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_obt';
|
26 |
+
protected $_paymentMethod = 'OBT';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Pli.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Pli extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_pli';
|
26 |
+
protected $_paymentMethod = 'PLI';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Psp.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Psp extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_psp';
|
26 |
+
protected $_paymentMethod = 'PSP';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Pwy.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Pwy extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_pwy';
|
26 |
+
protected $_paymentMethod = 'PWY';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Sft.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Sft extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_sft';
|
26 |
+
protected $_paymentMethod = 'SFT';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/So2.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_So2 extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_so2';
|
26 |
+
protected $_paymentMethod = 'SO2';
|
27 |
+
}
|
app/code/community/Phoenix/Moneybookers/Model/Wlt.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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_Model_Wlt extends Phoenix_Moneybookers_Model_Abstract
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* unique internal payment method identifier
|
24 |
+
*/
|
25 |
+
protected $_code = 'moneybookers_wlt';
|
26 |
+
protected $_paymentMethod = 'WLT';
|
27 |
+
protected $_hidelogin = '0';
|
28 |
+
}
|
app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_MoneybookersController extends Mage_Adminhtml_Controller_Action
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Retrieve Moneybookers helper
|
24 |
+
*
|
25 |
+
* @return Phoenix_Moneybookers_Helper_Data
|
26 |
+
*/
|
27 |
+
protected function _getHelper()
|
28 |
+
{
|
29 |
+
return Mage::helper('moneybookers');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Send activation Email to Moneybookers
|
34 |
+
*/
|
35 |
+
public function activateemailAction()
|
36 |
+
{
|
37 |
+
$this->_getHelper()->activateEmail();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Check if email is registered at Moneybookers
|
42 |
+
*/
|
43 |
+
public function checkemailAction()
|
44 |
+
{
|
45 |
+
try {
|
46 |
+
$params = $this->getRequest()->getParams();
|
47 |
+
if (empty($params['email'])) {
|
48 |
+
Mage::throwException('Error: No parameters specified');
|
49 |
+
}
|
50 |
+
$response = $this->_getHelper()->checkEmailRequest($params);
|
51 |
+
if (empty($response)) {
|
52 |
+
Mage::throwException('Error: Connection to moneybookers.com failed');
|
53 |
+
}
|
54 |
+
$this->getResponse()->setBody($response);
|
55 |
+
return;
|
56 |
+
} catch (Mage_Core_Exception $e) {
|
57 |
+
$response = $e->getMessage();
|
58 |
+
} catch (Exception $e) {
|
59 |
+
$response = 'Error: System error during request';
|
60 |
+
}
|
61 |
+
$this->getResponse()->setBody($response);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check if entered secret is valid
|
66 |
+
*/
|
67 |
+
public function checksecretAction()
|
68 |
+
{
|
69 |
+
try {
|
70 |
+
$params = $this->getRequest()->getParams();
|
71 |
+
if (empty($params['email']) || empty($params['secret'])) {
|
72 |
+
Mage::throwException('Error: No parameters specified');
|
73 |
+
}
|
74 |
+
$response = $this->_getHelper()->checkSecretRequest($params);
|
75 |
+
if (empty($response)) {
|
76 |
+
Mage::throwException('Error: Connection to moneybookers.com failed');
|
77 |
+
}
|
78 |
+
$this->getResponse()->setBody($response);
|
79 |
+
return;
|
80 |
+
} catch (Mage_Core_Exception $e) {
|
81 |
+
$response = $e->getMessage();
|
82 |
+
} catch (Exception $e) {
|
83 |
+
$response = 'Error: System error during request';
|
84 |
+
}
|
85 |
+
$this->getResponse()->setBody($response);
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Phoenix_Moneybookers_ProcessingController extends Mage_Core_Controller_Front_Action
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Get singleton of Checkout Session Model
|
24 |
+
*
|
25 |
+
* @return Mage_Checkout_Model_Session
|
26 |
+
*/
|
27 |
+
protected function _getCheckout()
|
28 |
+
{
|
29 |
+
return Mage::getSingleton('checkout/session');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Iframe page which submits the payment data to Moneybookers.
|
34 |
+
*/
|
35 |
+
public function placeformAction()
|
36 |
+
{
|
37 |
+
$this->loadLayout();
|
38 |
+
$this->renderLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Show orderPlaceRedirect page which contains the Moneybookers iframe.
|
43 |
+
*/
|
44 |
+
public function paymentAction()
|
45 |
+
{
|
46 |
+
try {
|
47 |
+
$session = $this->_getCheckout();
|
48 |
+
|
49 |
+
$order = Mage::getModel('sales/order');
|
50 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
51 |
+
if (!$order->getId()) {
|
52 |
+
Mage::throwException('No order for processing found');
|
53 |
+
}
|
54 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
55 |
+
Mage::helper('moneybookers')->__('The customer was redirected to Moneybookers.')
|
56 |
+
);
|
57 |
+
$order->save();
|
58 |
+
|
59 |
+
$session->setMoneybookersQuoteId($session->getQuoteId());
|
60 |
+
$session->setMoneybookersRealOrderId($session->getLastRealOrderId());
|
61 |
+
$session->getQuote()->setIsActive(false)->save();
|
62 |
+
$session->clear();
|
63 |
+
|
64 |
+
$this->loadLayout();
|
65 |
+
$this->renderLayout();
|
66 |
+
} catch (Exception $e){
|
67 |
+
Mage::logException($e);
|
68 |
+
parent::_redirect('checkout/cart');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Action to which the customer will be returned when the payment is made.
|
74 |
+
*/
|
75 |
+
public function successAction()
|
76 |
+
{
|
77 |
+
$event = Mage::getModel('moneybookers/event')
|
78 |
+
->setEventData($this->getRequest()->getParams());
|
79 |
+
try {
|
80 |
+
$quoteId = $event->successEvent();
|
81 |
+
$this->_getCheckout()->setLastSuccessQuoteId($quoteId);
|
82 |
+
$this->_redirect('checkout/onepage/success');
|
83 |
+
return;
|
84 |
+
} catch (Mage_Core_Exception $e) {
|
85 |
+
$this->_getCheckout()->addError($e->getMessage());
|
86 |
+
} catch(Exception $e) {
|
87 |
+
Mage::logException($e);
|
88 |
+
}
|
89 |
+
$this->_redirect('checkout/cart');
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Action to which the customer will be returned if the payment process is
|
94 |
+
* cancelled.
|
95 |
+
* Cancel order and redirect user to the shopping cart.
|
96 |
+
*/
|
97 |
+
public function cancelAction()
|
98 |
+
{
|
99 |
+
$event = Mage::getModel('moneybookers/event')
|
100 |
+
->setEventData($this->getRequest()->getParams());
|
101 |
+
$message = $event->cancelEvent();
|
102 |
+
|
103 |
+
// set quote to active
|
104 |
+
$session = $this->_getCheckout();
|
105 |
+
if ($quoteId = $session->getMoneybookersQuoteId()) {
|
106 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
107 |
+
if ($quote->getId()) {
|
108 |
+
$quote->setIsActive(true)->save();
|
109 |
+
$session->setQuoteId($quoteId);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
$session->addError($message);
|
114 |
+
$this->_redirect('checkout/cart');
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Action to which the transaction details will be posted after the payment
|
119 |
+
* process is complete.
|
120 |
+
*/
|
121 |
+
public function statusAction()
|
122 |
+
{
|
123 |
+
$event = Mage::getModel('moneybookers/event')
|
124 |
+
->setEventData($this->getRequest()->getParams());
|
125 |
+
$message = $event->processStatusEvent();
|
126 |
+
$this->getResponse()->setBody($message);
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Set redirect into responce. This has to be encapsulated in an JavaScript
|
131 |
+
* call to jump out of the iframe.
|
132 |
+
*
|
133 |
+
* @param string $path
|
134 |
+
* @param array $arguments
|
135 |
+
*/
|
136 |
+
protected function _redirect($path, $arguments=array())
|
137 |
+
{
|
138 |
+
$this->getResponse()->setBody(
|
139 |
+
$this->getLayout()
|
140 |
+
->createBlock('moneybookers/redirect')
|
141 |
+
->setRedirectUrl(Mage::getUrl($path, $arguments))
|
142 |
+
->toHtml()
|
143 |
+
);
|
144 |
+
return $this;
|
145 |
+
}
|
146 |
+
}
|
app/code/community/Phoenix/Moneybookers/etc/config.xml
ADDED
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Phoenix
|
17 |
+
* @package Phoenix_Moneybookers
|
18 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<Phoenix_Moneybookers>
|
25 |
+
<version>1.6.0.0</version>
|
26 |
+
</Phoenix_Moneybookers>
|
27 |
+
</modules>
|
28 |
+
<global>
|
29 |
+
<models>
|
30 |
+
<moneybookers>
|
31 |
+
<class>Phoenix_Moneybookers_Model</class>
|
32 |
+
</moneybookers>
|
33 |
+
</models>
|
34 |
+
<helpers>
|
35 |
+
<moneybookers>
|
36 |
+
<class>Phoenix_Moneybookers_Helper</class>
|
37 |
+
</moneybookers>
|
38 |
+
</helpers>
|
39 |
+
<resources>
|
40 |
+
<moneybookers_setup>
|
41 |
+
<setup>
|
42 |
+
<module>Phoenix_Moneybookers</module>
|
43 |
+
</setup>
|
44 |
+
</moneybookers_setup>
|
45 |
+
</resources>
|
46 |
+
<blocks>
|
47 |
+
<moneybookers><class>Phoenix_Moneybookers_Block</class></moneybookers>
|
48 |
+
</blocks>
|
49 |
+
<template>
|
50 |
+
<email>
|
51 |
+
<moneybookers_activateemail>
|
52 |
+
<label>Moneybookers activate email</label>
|
53 |
+
<file>moneybookers_activateemail.html</file>
|
54 |
+
<type>html</type>
|
55 |
+
</moneybookers_activateemail>
|
56 |
+
</email>
|
57 |
+
</template>
|
58 |
+
<payment>
|
59 |
+
<groups>
|
60 |
+
<mbookers>Moneybookers</mbookers>
|
61 |
+
</groups>
|
62 |
+
</payment>
|
63 |
+
</global>
|
64 |
+
<frontend>
|
65 |
+
<secure_url>
|
66 |
+
<moneybookers_processing>/moneybookers/processing</moneybookers_processing>
|
67 |
+
</secure_url>
|
68 |
+
<routers>
|
69 |
+
<moneybookers>
|
70 |
+
<use>standard</use>
|
71 |
+
<args>
|
72 |
+
<module>Phoenix_Moneybookers</module>
|
73 |
+
<frontName>moneybookers</frontName>
|
74 |
+
</args>
|
75 |
+
</moneybookers>
|
76 |
+
</routers>
|
77 |
+
<translate>
|
78 |
+
<modules>
|
79 |
+
<Phoenix_Moneybookers>
|
80 |
+
<files>
|
81 |
+
<default>Phoenix_Moneybookers.csv</default>
|
82 |
+
</files>
|
83 |
+
</Phoenix_Moneybookers>
|
84 |
+
</modules>
|
85 |
+
</translate>
|
86 |
+
<layout>
|
87 |
+
<updates>
|
88 |
+
<moneybookers>
|
89 |
+
<file>moneybookers.xml</file>
|
90 |
+
</moneybookers>
|
91 |
+
</updates>
|
92 |
+
</layout>
|
93 |
+
</frontend>
|
94 |
+
<admin>
|
95 |
+
<routers>
|
96 |
+
<adminhtml>
|
97 |
+
<args>
|
98 |
+
<modules>
|
99 |
+
<moneybookers after="Mage_Adminhtml">Phoenix_Moneybookers</moneybookers>
|
100 |
+
</modules>
|
101 |
+
</args>
|
102 |
+
</adminhtml>
|
103 |
+
</routers>
|
104 |
+
</admin>
|
105 |
+
<adminhtml>
|
106 |
+
<translate>
|
107 |
+
<modules>
|
108 |
+
<Phoenix_Moneybookers>
|
109 |
+
<files>
|
110 |
+
<default>Phoenix_Moneybookers.csv</default>
|
111 |
+
</files>
|
112 |
+
</Phoenix_Moneybookers>
|
113 |
+
</modules>
|
114 |
+
</translate>
|
115 |
+
<layout>
|
116 |
+
<updates>
|
117 |
+
<moneybookers>
|
118 |
+
<file>moneybookers.xml</file>
|
119 |
+
</moneybookers>
|
120 |
+
</updates>
|
121 |
+
</layout>
|
122 |
+
<acl>
|
123 |
+
<resources>
|
124 |
+
<admin>
|
125 |
+
<children>
|
126 |
+
<system>
|
127 |
+
<children>
|
128 |
+
<config>
|
129 |
+
<children>
|
130 |
+
<moneybookers translate="title" module="moneybookers">
|
131 |
+
<title>Moneybookers Settings</title>
|
132 |
+
</moneybookers>
|
133 |
+
</children>
|
134 |
+
</config>
|
135 |
+
</children>
|
136 |
+
</system>
|
137 |
+
</children>
|
138 |
+
</admin>
|
139 |
+
</resources>
|
140 |
+
</acl>
|
141 |
+
</adminhtml>
|
142 |
+
<phoenix>
|
143 |
+
<moneybookers>
|
144 |
+
<verify_url>http://www.phoenix-medien.de/index.php?id=105</verify_url>
|
145 |
+
</moneybookers>
|
146 |
+
</phoenix>
|
147 |
+
<default>
|
148 |
+
<payment>
|
149 |
+
<moneybookers_acc>
|
150 |
+
<group>mbookers</group>
|
151 |
+
<active>0</active>
|
152 |
+
<model>moneybookers/acc</model>
|
153 |
+
<title>Credit Card / Visa, Mastercard, AMEX, JCB, Diners</title>
|
154 |
+
<allowspecific>0</allowspecific>
|
155 |
+
</moneybookers_acc>
|
156 |
+
<moneybookers_csi>
|
157 |
+
<group>mbookers</group>
|
158 |
+
<active>0</active>
|
159 |
+
<model>moneybookers/csi</model>
|
160 |
+
<title>CartaSi</title>
|
161 |
+
<allowspecific>1</allowspecific>
|
162 |
+
<specificcountry>IT</specificcountry>
|
163 |
+
</moneybookers_csi>
|
164 |
+
<moneybookers_did>
|
165 |
+
<group>mbookers</group>
|
166 |
+
<active>0</active>
|
167 |
+
<model>moneybookers/did</model>
|
168 |
+
<title>Lastschrift (ELV)</title>
|
169 |
+
<allowspecific>1</allowspecific>
|
170 |
+
<specificcountry>DE</specificcountry>
|
171 |
+
</moneybookers_did>
|
172 |
+
<moneybookers_dnk>
|
173 |
+
<group>mbookers</group>
|
174 |
+
<active>0</active>
|
175 |
+
<model>moneybookers/dnk</model>
|
176 |
+
<title>Dankort</title>
|
177 |
+
<allowspecific>1</allowspecific>
|
178 |
+
<specificcountry>DK</specificcountry>
|
179 |
+
</moneybookers_dnk>
|
180 |
+
<moneybookers_ebt>
|
181 |
+
<group>mbookers</group>
|
182 |
+
<active>0</active>
|
183 |
+
<model>moneybookers/ebt</model>
|
184 |
+
<title>Nordea Solo</title>
|
185 |
+
<allowspecific>1</allowspecific>
|
186 |
+
<specificcountry>SE</specificcountry>
|
187 |
+
</moneybookers_ebt>
|
188 |
+
<moneybookers_ent>
|
189 |
+
<group>mbookers</group>
|
190 |
+
<active>0</active>
|
191 |
+
<model>moneybookers/ent</model>
|
192 |
+
<title>eNETS</title>
|
193 |
+
<allowspecific>1</allowspecific>
|
194 |
+
<specificcountry>SG</specificcountry>
|
195 |
+
</moneybookers_ent>
|
196 |
+
<moneybookers_gcb>
|
197 |
+
<group>mbookers</group>
|
198 |
+
<active>0</active>
|
199 |
+
<model>moneybookers/gcb</model>
|
200 |
+
<title>Carte Bleue</title>
|
201 |
+
<allowspecific>1</allowspecific>
|
202 |
+
<specificcountry>FR</specificcountry>
|
203 |
+
</moneybookers_gcb>
|
204 |
+
<moneybookers_gir>
|
205 |
+
<group>mbookers</group>
|
206 |
+
<active>0</active>
|
207 |
+
<model>moneybookers/gir</model>
|
208 |
+
<title>Giropay</title>
|
209 |
+
<allowspecific>1</allowspecific>
|
210 |
+
<specificcountry>DE</specificcountry>
|
211 |
+
</moneybookers_gir>
|
212 |
+
<moneybookers_idl>
|
213 |
+
<group>mbookers</group>
|
214 |
+
<active>0</active>
|
215 |
+
<model>moneybookers/idl</model>
|
216 |
+
<title>iDeal</title>
|
217 |
+
<allowspecific>1</allowspecific>
|
218 |
+
<specificcountry>NL</specificcountry>
|
219 |
+
</moneybookers_idl>
|
220 |
+
<moneybookers_lsr>
|
221 |
+
<group>mbookers</group>
|
222 |
+
<active>0</active>
|
223 |
+
<model>moneybookers/lsr</model>
|
224 |
+
<title>Laser</title>
|
225 |
+
<allowspecific>1</allowspecific>
|
226 |
+
<specificcountry>IE</specificcountry>
|
227 |
+
</moneybookers_lsr>
|
228 |
+
<moneybookers_mae>
|
229 |
+
<group>mbookers</group>
|
230 |
+
<active>0</active>
|
231 |
+
<model>moneybookers/mae</model>
|
232 |
+
<title>Maestro</title>
|
233 |
+
<allowspecific>1</allowspecific>
|
234 |
+
<specificcountry>GB,AT,ES</specificcountry>
|
235 |
+
</moneybookers_mae>
|
236 |
+
<moneybookers_npy>
|
237 |
+
<group>mbookers</group>
|
238 |
+
<active>0</active>
|
239 |
+
<model>moneybookers/npy</model>
|
240 |
+
<title>EPS Online-Überweisung</title>
|
241 |
+
<allowspecific>1</allowspecific>
|
242 |
+
<specificcountry>AT</specificcountry>
|
243 |
+
</moneybookers_npy>
|
244 |
+
<moneybookers_pli>
|
245 |
+
<group>mbookers</group>
|
246 |
+
<active>0</active>
|
247 |
+
<model>moneybookers/pli</model>
|
248 |
+
<title>POLi</title>
|
249 |
+
<allowspecific>1</allowspecific>
|
250 |
+
<specificcountry>AU</specificcountry>
|
251 |
+
</moneybookers_pli>
|
252 |
+
<moneybookers_psp>
|
253 |
+
<group>mbookers</group>
|
254 |
+
<active>0</active>
|
255 |
+
<model>moneybookers/psp</model>
|
256 |
+
<title>Postepay</title>
|
257 |
+
<allowspecific>1</allowspecific>
|
258 |
+
<specificcountry>IT</specificcountry>
|
259 |
+
</moneybookers_psp>
|
260 |
+
<moneybookers_pwy>
|
261 |
+
<group>mbookers</group>
|
262 |
+
<active>0</active>
|
263 |
+
<model>moneybookers/pwy</model>
|
264 |
+
<title>All Polish Banks</title>
|
265 |
+
<allowspecific>1</allowspecific>
|
266 |
+
<specificcountry>PL</specificcountry>
|
267 |
+
</moneybookers_pwy>
|
268 |
+
<moneybookers_sft>
|
269 |
+
<group>mbookers</group>
|
270 |
+
<active>0</active>
|
271 |
+
<model>moneybookers/sft</model>
|
272 |
+
<title>Sofortüberweisung</title>
|
273 |
+
<allowspecific>1</allowspecific>
|
274 |
+
<specificcountry>DE</specificcountry>
|
275 |
+
</moneybookers_sft>
|
276 |
+
<moneybookers_so2>
|
277 |
+
<group>mbookers</group>
|
278 |
+
<active>0</active>
|
279 |
+
<model>moneybookers/so2</model>
|
280 |
+
<title>Nordea Solo</title>
|
281 |
+
<allowspecific>1</allowspecific>
|
282 |
+
<specificcountry>FI</specificcountry>
|
283 |
+
</moneybookers_so2>
|
284 |
+
<moneybookers_wlt>
|
285 |
+
<group>mbookers</group>
|
286 |
+
<active>0</active>
|
287 |
+
<model>moneybookers/wlt</model>
|
288 |
+
<title>Moneybookers eWallet</title>
|
289 |
+
<allowspecific>0</allowspecific>
|
290 |
+
</moneybookers_wlt>
|
291 |
+
<moneybookers_obt>
|
292 |
+
<group>mbookers</group>
|
293 |
+
<active>0</active>
|
294 |
+
<model>moneybookers/obt</model>
|
295 |
+
<title>Onlineüberweisung (empfohlen)</title>
|
296 |
+
<allowspecific>1</allowspecific>
|
297 |
+
<specificcountry>GB,DE</specificcountry>
|
298 |
+
</moneybookers_obt>
|
299 |
+
</payment>
|
300 |
+
<moneybookers>
|
301 |
+
<settings>
|
302 |
+
<activationstatus>0</activationstatus>
|
303 |
+
</settings>
|
304 |
+
</moneybookers>
|
305 |
+
</default>
|
306 |
+
</config>
|
app/code/community/Phoenix/Moneybookers/etc/system.xml
ADDED
@@ -0,0 +1,1201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Phoenix
|
17 |
+
* @package Phoenix_Moneybookers
|
18 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<sections>
|
24 |
+
<moneybookers translate="label" module="moneybookers">
|
25 |
+
<label>Moneybookers</label>
|
26 |
+
<tab>sales</tab>
|
27 |
+
<frontend_type>text</frontend_type>
|
28 |
+
<sort_order>990</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>1</show_in_store>
|
32 |
+
<groups>
|
33 |
+
<settings translate="label">
|
34 |
+
<label>Moneybookers Settings</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>1</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
<fields>
|
41 |
+
<moneybookers_email translate="label,comment">
|
42 |
+
<label>Email Address of Your Moneybookers Account</label>
|
43 |
+
<comment><![CDATA[To have access to the international payment network of Moneybookers please register <a href="http://www.moneybookers.com/partners/magento/" target="_blank">here</a> for a free account if you don’t have one yet.]]></comment>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>1</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
</moneybookers_email>
|
50 |
+
<customer_id translate="label">
|
51 |
+
<label>Customer ID</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>2</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</customer_id>
|
58 |
+
<secret_key translate="label,comment">
|
59 |
+
<label>Secret Word</label>
|
60 |
+
<comment>Pre-shared secret key to secure the transaction. After activation Moneybookers will give you access to a new section in your Moneybookers account called "Merchant tools". Please choose a secret word (do not use your password for this) and provide it in your Moneybookers admin area and above.</comment>
|
61 |
+
<frontend_type>text</frontend_type>
|
62 |
+
<sort_order>3</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</secret_key>
|
67 |
+
<activationstatus>
|
68 |
+
<comment></comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>4</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</activationstatus>
|
75 |
+
</fields>
|
76 |
+
</settings>
|
77 |
+
<moneybookers_acc translate="label" module="moneybookers">
|
78 |
+
<label>All Credit Cards / Visa, Mastercard, AMEX, JCB, Diners (powered by Moneybookers) - International</label>
|
79 |
+
<frontend_type>text</frontend_type>
|
80 |
+
<sort_order>201</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<fields>
|
85 |
+
<active translate="label">
|
86 |
+
<label>Enabled</label>
|
87 |
+
<frontend_type>select</frontend_type>
|
88 |
+
<config_path>payment/moneybookers_acc/active</config_path>
|
89 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
90 |
+
<sort_order>1</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
</active>
|
95 |
+
<sort_order translate="label">
|
96 |
+
<label>Sort Order</label>
|
97 |
+
<frontend_type>text</frontend_type>
|
98 |
+
<config_path>payment/moneybookers_acc/sort_order</config_path>
|
99 |
+
<sort_order>3</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>1</show_in_store>
|
103 |
+
</sort_order>
|
104 |
+
<title translate="label">
|
105 |
+
<label>Title</label>
|
106 |
+
<frontend_type>text</frontend_type>
|
107 |
+
<config_path>payment/moneybookers_acc/title</config_path>
|
108 |
+
<sort_order>5</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</title>
|
113 |
+
<allowspecific translate="label">
|
114 |
+
<label>Payment from Applicable Countries</label>
|
115 |
+
<frontend_type>allowspecific</frontend_type>
|
116 |
+
<config_path>payment/moneybookers_acc/allowspecific</config_path>
|
117 |
+
<sort_order>6</sort_order>
|
118 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>1</show_in_store>
|
122 |
+
</allowspecific>
|
123 |
+
<specificcountry translate="label">
|
124 |
+
<label>Payment from Specific Countries</label>
|
125 |
+
<frontend_type>multiselect</frontend_type>
|
126 |
+
<config_path>payment/moneybookers_acc/specificcountry</config_path>
|
127 |
+
<sort_order>7</sort_order>
|
128 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
<can_be_empty>1</can_be_empty>
|
133 |
+
</specificcountry>
|
134 |
+
</fields>
|
135 |
+
</moneybookers_acc>
|
136 |
+
<moneybookers_csi translate="label" module="moneybookers">
|
137 |
+
<label>CartaSi (powered by Moneybookers) - Italy</label>
|
138 |
+
<frontend_type>text</frontend_type>
|
139 |
+
<sort_order>252</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>1</show_in_store>
|
143 |
+
<fields>
|
144 |
+
<active translate="label">
|
145 |
+
<label>Enabled</label>
|
146 |
+
<frontend_type>select</frontend_type>
|
147 |
+
<config_path>payment/moneybookers_csi/active</config_path>
|
148 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
149 |
+
<sort_order>1</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
</active>
|
154 |
+
<sort_order translate="label">
|
155 |
+
<label>Sort Order</label>
|
156 |
+
<frontend_type>text</frontend_type>
|
157 |
+
<config_path>payment/moneybookers_csi/sort_order</config_path>
|
158 |
+
<sort_order>3</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</sort_order>
|
163 |
+
<title translate="label">
|
164 |
+
<label>Title</label>
|
165 |
+
<frontend_type>text</frontend_type>
|
166 |
+
<config_path>payment/moneybookers_csi/title</config_path>
|
167 |
+
<sort_order>5</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>1</show_in_store>
|
171 |
+
</title>
|
172 |
+
<allowspecific translate="label">
|
173 |
+
<label>Payment from Applicable Countries</label>
|
174 |
+
<frontend_type>allowspecific</frontend_type>
|
175 |
+
<config_path>payment/moneybookers_csi/allowspecific</config_path>
|
176 |
+
<sort_order>6</sort_order>
|
177 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</allowspecific>
|
182 |
+
<specificcountry translate="label">
|
183 |
+
<label>Payment from Specific Countries</label>
|
184 |
+
<frontend_type>multiselect</frontend_type>
|
185 |
+
<config_path>payment/moneybookers_csi/specificcountry</config_path>
|
186 |
+
<sort_order>7</sort_order>
|
187 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
<can_be_empty>1</can_be_empty>
|
192 |
+
</specificcountry>
|
193 |
+
</fields>
|
194 |
+
</moneybookers_csi>
|
195 |
+
<moneybookers_did translate="label" module="moneybookers">
|
196 |
+
<label>Lastschrift (ELV) (powered by Moneybookers) - Germany</label>
|
197 |
+
<frontend_type>text</frontend_type>
|
198 |
+
<sort_order>211</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
<fields>
|
203 |
+
<active translate="label">
|
204 |
+
<label>Enabled</label>
|
205 |
+
<frontend_type>select</frontend_type>
|
206 |
+
<config_path>payment/moneybookers_did/active</config_path>
|
207 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
208 |
+
<sort_order>1</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>1</show_in_store>
|
212 |
+
</active>
|
213 |
+
<sort_order translate="label">
|
214 |
+
<label>Sort Order</label>
|
215 |
+
<frontend_type>text</frontend_type>
|
216 |
+
<config_path>payment/moneybookers_did/sort_order</config_path>
|
217 |
+
<sort_order>3</sort_order>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>1</show_in_website>
|
220 |
+
<show_in_store>1</show_in_store>
|
221 |
+
</sort_order>
|
222 |
+
<title translate="label">
|
223 |
+
<label>Title</label>
|
224 |
+
<frontend_type>text</frontend_type>
|
225 |
+
<config_path>payment/moneybookers_did/title</config_path>
|
226 |
+
<sort_order>5</sort_order>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>1</show_in_website>
|
229 |
+
<show_in_store>1</show_in_store>
|
230 |
+
</title>
|
231 |
+
<allowspecific translate="label">
|
232 |
+
<label>Payment from Applicable Countries</label>
|
233 |
+
<frontend_type>allowspecific</frontend_type>
|
234 |
+
<config_path>payment/moneybookers_did/allowspecific</config_path>
|
235 |
+
<sort_order>6</sort_order>
|
236 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
</allowspecific>
|
241 |
+
<specificcountry translate="label">
|
242 |
+
<label>Payment from Specific Countries</label>
|
243 |
+
<frontend_type>multiselect</frontend_type>
|
244 |
+
<config_path>payment/moneybookers_did/specificcountry</config_path>
|
245 |
+
<sort_order>7</sort_order>
|
246 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
247 |
+
<show_in_default>1</show_in_default>
|
248 |
+
<show_in_website>1</show_in_website>
|
249 |
+
<show_in_store>1</show_in_store>
|
250 |
+
<can_be_empty>1</can_be_empty>
|
251 |
+
</specificcountry>
|
252 |
+
</fields>
|
253 |
+
</moneybookers_did>
|
254 |
+
<moneybookers_dnk translate="label" module="moneybookers">
|
255 |
+
<label>Dankort (powered by Moneybookers) - Denmark</label>
|
256 |
+
<frontend_type>text</frontend_type>
|
257 |
+
<sort_order>241</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>1</show_in_website>
|
260 |
+
<show_in_store>1</show_in_store>
|
261 |
+
<fields>
|
262 |
+
<active translate="label">
|
263 |
+
<label>Enabled</label>
|
264 |
+
<frontend_type>select</frontend_type>
|
265 |
+
<config_path>payment/moneybookers_dnk/active</config_path>
|
266 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
267 |
+
<sort_order>1</sort_order>
|
268 |
+
<show_in_default>1</show_in_default>
|
269 |
+
<show_in_website>1</show_in_website>
|
270 |
+
<show_in_store>1</show_in_store>
|
271 |
+
</active>
|
272 |
+
<sort_order translate="label">
|
273 |
+
<label>Sort Order</label>
|
274 |
+
<frontend_type>text</frontend_type>
|
275 |
+
<config_path>payment/moneybookers_dnk/sort_order</config_path>
|
276 |
+
<sort_order>3</sort_order>
|
277 |
+
<show_in_default>1</show_in_default>
|
278 |
+
<show_in_website>1</show_in_website>
|
279 |
+
<show_in_store>1</show_in_store>
|
280 |
+
</sort_order>
|
281 |
+
<title translate="label">
|
282 |
+
<label>Title</label>
|
283 |
+
<frontend_type>text</frontend_type>
|
284 |
+
<config_path>payment/moneybookers_dnk/title</config_path>
|
285 |
+
<sort_order>5</sort_order>
|
286 |
+
<show_in_default>1</show_in_default>
|
287 |
+
<show_in_website>1</show_in_website>
|
288 |
+
<show_in_store>1</show_in_store>
|
289 |
+
</title>
|
290 |
+
<allowspecific translate="label">
|
291 |
+
<label>Payment from Applicable Countries</label>
|
292 |
+
<frontend_type>allowspecific</frontend_type>
|
293 |
+
<config_path>payment/moneybookers_dnk/allowspecific</config_path>
|
294 |
+
<sort_order>6</sort_order>
|
295 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
296 |
+
<show_in_default>1</show_in_default>
|
297 |
+
<show_in_website>1</show_in_website>
|
298 |
+
<show_in_store>1</show_in_store>
|
299 |
+
</allowspecific>
|
300 |
+
<specificcountry translate="label">
|
301 |
+
<label>Payment from Specific Countries</label>
|
302 |
+
<frontend_type>multiselect</frontend_type>
|
303 |
+
<config_path>payment/moneybookers_dnk/specificcountry</config_path>
|
304 |
+
<sort_order>7</sort_order>
|
305 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
306 |
+
<show_in_default>1</show_in_default>
|
307 |
+
<show_in_website>1</show_in_website>
|
308 |
+
<show_in_store>1</show_in_store>
|
309 |
+
<can_be_empty>1</can_be_empty>
|
310 |
+
</specificcountry>
|
311 |
+
</fields>
|
312 |
+
</moneybookers_dnk>
|
313 |
+
<moneybookers_ebt translate="label" module="moneybookers">
|
314 |
+
<label>Nordea Solo (powered by Moneybookers) - Sweden</label>
|
315 |
+
<frontend_type>text</frontend_type>
|
316 |
+
<sort_order>271</sort_order>
|
317 |
+
<show_in_default>1</show_in_default>
|
318 |
+
<show_in_website>1</show_in_website>
|
319 |
+
<show_in_store>1</show_in_store>
|
320 |
+
<fields>
|
321 |
+
<active translate="label">
|
322 |
+
<label>Enabled</label>
|
323 |
+
<frontend_type>select</frontend_type>
|
324 |
+
<config_path>payment/moneybookers_ebt/active</config_path>
|
325 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
326 |
+
<sort_order>1</sort_order>
|
327 |
+
<show_in_default>1</show_in_default>
|
328 |
+
<show_in_website>1</show_in_website>
|
329 |
+
<show_in_store>1</show_in_store>
|
330 |
+
</active>
|
331 |
+
<sort_order translate="label">
|
332 |
+
<label>Sort Order</label>
|
333 |
+
<frontend_type>text</frontend_type>
|
334 |
+
<config_path>payment/moneybookers_ebt/sort_order</config_path>
|
335 |
+
<sort_order>3</sort_order>
|
336 |
+
<show_in_default>1</show_in_default>
|
337 |
+
<show_in_website>1</show_in_website>
|
338 |
+
<show_in_store>1</show_in_store>
|
339 |
+
</sort_order>
|
340 |
+
<title translate="label">
|
341 |
+
<label>Title</label>
|
342 |
+
<frontend_type>text</frontend_type>
|
343 |
+
<config_path>payment/moneybookers_ebt/title</config_path>
|
344 |
+
<sort_order>5</sort_order>
|
345 |
+
<show_in_default>1</show_in_default>
|
346 |
+
<show_in_website>1</show_in_website>
|
347 |
+
<show_in_store>1</show_in_store>
|
348 |
+
</title>
|
349 |
+
<allowspecific translate="label">
|
350 |
+
<label>Payment from Applicable Countries</label>
|
351 |
+
<config_path>payment/moneybookers_ebt/allowspecific</config_path>
|
352 |
+
<frontend_type>allowspecific</frontend_type>
|
353 |
+
<sort_order>6</sort_order>
|
354 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
355 |
+
<show_in_default>1</show_in_default>
|
356 |
+
<show_in_website>1</show_in_website>
|
357 |
+
<show_in_store>1</show_in_store>
|
358 |
+
</allowspecific>
|
359 |
+
<specificcountry translate="label">
|
360 |
+
<label>Payment from Specific Countries</label>
|
361 |
+
<frontend_type>multiselect</frontend_type>
|
362 |
+
<config_path>payment/moneybookers_ebt/specificcountry</config_path>
|
363 |
+
<sort_order>7</sort_order>
|
364 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
365 |
+
<show_in_default>1</show_in_default>
|
366 |
+
<show_in_website>1</show_in_website>
|
367 |
+
<show_in_store>1</show_in_store>
|
368 |
+
<can_be_empty>1</can_be_empty>
|
369 |
+
</specificcountry>
|
370 |
+
</fields>
|
371 |
+
</moneybookers_ebt>
|
372 |
+
<moneybookers_ent translate="label" module="moneybookers">
|
373 |
+
<label>eNETS (powered by Moneybookers) - Singapore</label>
|
374 |
+
<frontend_type>text</frontend_type>
|
375 |
+
<sort_order>261</sort_order>
|
376 |
+
<show_in_default>1</show_in_default>
|
377 |
+
<show_in_website>1</show_in_website>
|
378 |
+
<show_in_store>1</show_in_store>
|
379 |
+
<fields>
|
380 |
+
<active translate="label">
|
381 |
+
<label>Enabled</label>
|
382 |
+
<frontend_type>select</frontend_type>
|
383 |
+
<config_path>payment/moneybookers_ent/active</config_path>
|
384 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
385 |
+
<sort_order>1</sort_order>
|
386 |
+
<show_in_default>1</show_in_default>
|
387 |
+
<show_in_website>1</show_in_website>
|
388 |
+
<show_in_store>1</show_in_store>
|
389 |
+
</active>
|
390 |
+
<sort_order translate="label">
|
391 |
+
<label>Sort Order</label>
|
392 |
+
<frontend_type>text</frontend_type>
|
393 |
+
<config_path>payment/moneybookers_ent/sort_order</config_path>
|
394 |
+
<sort_order>3</sort_order>
|
395 |
+
<show_in_default>1</show_in_default>
|
396 |
+
<show_in_website>1</show_in_website>
|
397 |
+
<show_in_store>1</show_in_store>
|
398 |
+
</sort_order>
|
399 |
+
<title translate="label">
|
400 |
+
<label>Title</label>
|
401 |
+
<frontend_type>text</frontend_type>
|
402 |
+
<config_path>payment/moneybookers_ent/title</config_path>
|
403 |
+
<sort_order>5</sort_order>
|
404 |
+
<show_in_default>1</show_in_default>
|
405 |
+
<show_in_website>1</show_in_website>
|
406 |
+
<show_in_store>1</show_in_store>
|
407 |
+
</title>
|
408 |
+
<allowspecific translate="label">
|
409 |
+
<label>Payment from Applicable Countries</label>
|
410 |
+
<frontend_type>allowspecific</frontend_type>
|
411 |
+
<config_path>payment/moneybookers_ent/allowspecific</config_path>
|
412 |
+
<sort_order>6</sort_order>
|
413 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
414 |
+
<show_in_default>1</show_in_default>
|
415 |
+
<show_in_website>1</show_in_website>
|
416 |
+
<show_in_store>1</show_in_store>
|
417 |
+
</allowspecific>
|
418 |
+
<specificcountry translate="label">
|
419 |
+
<label>Payment from Specific Countries</label>
|
420 |
+
<frontend_type>multiselect</frontend_type>
|
421 |
+
<config_path>payment/moneybookers_ent/specificcountry</config_path>
|
422 |
+
<sort_order>7</sort_order>
|
423 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
424 |
+
<show_in_default>1</show_in_default>
|
425 |
+
<show_in_website>1</show_in_website>
|
426 |
+
<show_in_store>1</show_in_store>
|
427 |
+
<can_be_empty>1</can_be_empty>
|
428 |
+
</specificcountry>
|
429 |
+
</fields>
|
430 |
+
</moneybookers_ent>
|
431 |
+
<moneybookers_gcb translate="label" module="moneybookers">
|
432 |
+
<label>Carte Bleue (powered by Moneybookers) - France</label>
|
433 |
+
<frontend_type>text</frontend_type>
|
434 |
+
<sort_order>231</sort_order>
|
435 |
+
<show_in_default>1</show_in_default>
|
436 |
+
<show_in_website>1</show_in_website>
|
437 |
+
<show_in_store>1</show_in_store>
|
438 |
+
<fields>
|
439 |
+
<active translate="label">
|
440 |
+
<label>Enabled</label>
|
441 |
+
<frontend_type>select</frontend_type>
|
442 |
+
<config_path>payment/moneybookers_gcb/active</config_path>
|
443 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
444 |
+
<sort_order>1</sort_order>
|
445 |
+
<show_in_default>1</show_in_default>
|
446 |
+
<show_in_website>1</show_in_website>
|
447 |
+
<show_in_store>1</show_in_store>
|
448 |
+
</active>
|
449 |
+
<sort_order translate="label">
|
450 |
+
<label>Sort Order</label>
|
451 |
+
<frontend_type>text</frontend_type>
|
452 |
+
<config_path>payment/moneybookers_gcb/sort_order</config_path>
|
453 |
+
<sort_order>3</sort_order>
|
454 |
+
<show_in_default>1</show_in_default>
|
455 |
+
<show_in_website>1</show_in_website>
|
456 |
+
<show_in_store>1</show_in_store>
|
457 |
+
</sort_order>
|
458 |
+
<title translate="label">
|
459 |
+
<label>Title</label>
|
460 |
+
<frontend_type>text</frontend_type>
|
461 |
+
<config_path>payment/moneybookers_gcb/title</config_path>
|
462 |
+
<sort_order>5</sort_order>
|
463 |
+
<show_in_default>1</show_in_default>
|
464 |
+
<show_in_website>1</show_in_website>
|
465 |
+
<show_in_store>1</show_in_store>
|
466 |
+
</title>
|
467 |
+
<allowspecific translate="label">
|
468 |
+
<label>Payment from Applicable Countries</label>
|
469 |
+
<frontend_type>allowspecific</frontend_type>
|
470 |
+
<config_path>payment/moneybookers_gcb/allowspecific</config_path>
|
471 |
+
<sort_order>6</sort_order>
|
472 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
473 |
+
<show_in_default>1</show_in_default>
|
474 |
+
<show_in_website>1</show_in_website>
|
475 |
+
<show_in_store>1</show_in_store>
|
476 |
+
</allowspecific>
|
477 |
+
<specificcountry translate="label">
|
478 |
+
<label>Payment from Specific Countries</label>
|
479 |
+
<frontend_type>multiselect</frontend_type>
|
480 |
+
<config_path>payment/moneybookers_gcb/specificcountry</config_path>
|
481 |
+
<sort_order>7</sort_order>
|
482 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
483 |
+
<show_in_default>1</show_in_default>
|
484 |
+
<show_in_website>1</show_in_website>
|
485 |
+
<show_in_store>1</show_in_store>
|
486 |
+
<can_be_empty>1</can_be_empty>
|
487 |
+
</specificcountry>
|
488 |
+
</fields>
|
489 |
+
</moneybookers_gcb>
|
490 |
+
<moneybookers_gir translate="label" module="moneybookers">
|
491 |
+
<label>Giropay (powered by Moneybookers) - Germany</label>
|
492 |
+
<frontend_type>text</frontend_type>
|
493 |
+
<sort_order>212</sort_order>
|
494 |
+
<show_in_default>1</show_in_default>
|
495 |
+
<show_in_website>1</show_in_website>
|
496 |
+
<show_in_store>1</show_in_store>
|
497 |
+
<fields>
|
498 |
+
<active translate="label">
|
499 |
+
<label>Enabled</label>
|
500 |
+
<frontend_type>select</frontend_type>
|
501 |
+
<config_path>payment/moneybookers_gir/active</config_path>
|
502 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
503 |
+
<sort_order>1</sort_order>
|
504 |
+
<show_in_default>1</show_in_default>
|
505 |
+
<show_in_website>1</show_in_website>
|
506 |
+
<show_in_store>1</show_in_store>
|
507 |
+
</active>
|
508 |
+
<sort_order translate="label">
|
509 |
+
<label>Sort Order</label>
|
510 |
+
<frontend_type>text</frontend_type>
|
511 |
+
<config_path>payment/moneybookers_gir/sort_order</config_path>
|
512 |
+
<sort_order>3</sort_order>
|
513 |
+
<show_in_default>1</show_in_default>
|
514 |
+
<show_in_website>1</show_in_website>
|
515 |
+
<show_in_store>1</show_in_store>
|
516 |
+
</sort_order>
|
517 |
+
<title translate="label">
|
518 |
+
<label>Title</label>
|
519 |
+
<frontend_type>text</frontend_type>
|
520 |
+
<config_path>payment/moneybookers_gir/title</config_path>
|
521 |
+
<sort_order>5</sort_order>
|
522 |
+
<show_in_default>1</show_in_default>
|
523 |
+
<show_in_website>1</show_in_website>
|
524 |
+
<show_in_store>1</show_in_store>
|
525 |
+
</title>
|
526 |
+
<allowspecific translate="label">
|
527 |
+
<label>Payment from Applicable Countries</label>
|
528 |
+
<frontend_type>allowspecific</frontend_type>
|
529 |
+
<config_path>payment/moneybookers_gir/allowspecific</config_path>
|
530 |
+
<sort_order>6</sort_order>
|
531 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
532 |
+
<show_in_default>1</show_in_default>
|
533 |
+
<show_in_website>1</show_in_website>
|
534 |
+
<show_in_store>1</show_in_store>
|
535 |
+
</allowspecific>
|
536 |
+
<specificcountry translate="label">
|
537 |
+
<label>Payment from Specific Countries</label>
|
538 |
+
<frontend_type>multiselect</frontend_type>
|
539 |
+
<config_path>payment/moneybookers_gir/specificcountry</config_path>
|
540 |
+
<sort_order>7</sort_order>
|
541 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
542 |
+
<show_in_default>1</show_in_default>
|
543 |
+
<show_in_website>1</show_in_website>
|
544 |
+
<show_in_store>1</show_in_store>
|
545 |
+
<can_be_empty>1</can_be_empty>
|
546 |
+
</specificcountry>
|
547 |
+
</fields>
|
548 |
+
</moneybookers_gir>
|
549 |
+
<moneybookers_idl translate="label" module="moneybookers">
|
550 |
+
<label>iDeal (powered by Moneybookers) - Netherlands</label>
|
551 |
+
<frontend_type>text</frontend_type>
|
552 |
+
<sort_order>291</sort_order>
|
553 |
+
<show_in_default>1</show_in_default>
|
554 |
+
<show_in_website>1</show_in_website>
|
555 |
+
<show_in_store>1</show_in_store>
|
556 |
+
<fields>
|
557 |
+
<active translate="label">
|
558 |
+
<label>Enabled</label>
|
559 |
+
<frontend_type>select</frontend_type>
|
560 |
+
<config_path>payment/moneybookers_idl/active</config_path>
|
561 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
562 |
+
<sort_order>1</sort_order>
|
563 |
+
<show_in_default>1</show_in_default>
|
564 |
+
<show_in_website>1</show_in_website>
|
565 |
+
<show_in_store>1</show_in_store>
|
566 |
+
</active>
|
567 |
+
<sort_order translate="label">
|
568 |
+
<label>Sort Order</label>
|
569 |
+
<frontend_type>text</frontend_type>
|
570 |
+
<config_path>payment/moneybookers_idl/sort_order</config_path>
|
571 |
+
<sort_order>3</sort_order>
|
572 |
+
<show_in_default>1</show_in_default>
|
573 |
+
<show_in_website>1</show_in_website>
|
574 |
+
<show_in_store>1</show_in_store>
|
575 |
+
</sort_order>
|
576 |
+
<title translate="label">
|
577 |
+
<label>Title</label>
|
578 |
+
<frontend_type>text</frontend_type>
|
579 |
+
<config_path>payment/moneybookers_idl/title</config_path>
|
580 |
+
<sort_order>5</sort_order>
|
581 |
+
<show_in_default>1</show_in_default>
|
582 |
+
<show_in_website>1</show_in_website>
|
583 |
+
<show_in_store>1</show_in_store>
|
584 |
+
</title>
|
585 |
+
<allowspecific translate="label">
|
586 |
+
<label>Payment from Applicable Countries</label>
|
587 |
+
<frontend_type>allowspecific</frontend_type>
|
588 |
+
<config_path>payment/moneybookers_idl/allowspecific</config_path>
|
589 |
+
<sort_order>6</sort_order>
|
590 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
591 |
+
<show_in_default>1</show_in_default>
|
592 |
+
<show_in_website>1</show_in_website>
|
593 |
+
<show_in_store>1</show_in_store>
|
594 |
+
</allowspecific>
|
595 |
+
<specificcountry translate="label">
|
596 |
+
<label>Payment from Specific Countries</label>
|
597 |
+
<frontend_type>multiselect</frontend_type>
|
598 |
+
<config_path>payment/moneybookers_idl/specificcountry</config_path>
|
599 |
+
<sort_order>7</sort_order>
|
600 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
601 |
+
<show_in_default>1</show_in_default>
|
602 |
+
<show_in_website>1</show_in_website>
|
603 |
+
<show_in_store>1</show_in_store>
|
604 |
+
<can_be_empty>1</can_be_empty>
|
605 |
+
</specificcountry>
|
606 |
+
</fields>
|
607 |
+
</moneybookers_idl>
|
608 |
+
<moneybookers_lsr translate="label" module="moneybookers">
|
609 |
+
<label>Laser (powered by Moneybookers) - Ireland</label>
|
610 |
+
<frontend_type>text</frontend_type>
|
611 |
+
<sort_order>221</sort_order>
|
612 |
+
<show_in_default>1</show_in_default>
|
613 |
+
<show_in_website>1</show_in_website>
|
614 |
+
<show_in_store>1</show_in_store>
|
615 |
+
<fields>
|
616 |
+
<active translate="label">
|
617 |
+
<label>Enabled</label>
|
618 |
+
<frontend_type>select</frontend_type>
|
619 |
+
<config_path>payment/moneybookers_lsr/active</config_path>
|
620 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
621 |
+
<sort_order>1</sort_order>
|
622 |
+
<show_in_default>1</show_in_default>
|
623 |
+
<show_in_website>1</show_in_website>
|
624 |
+
<show_in_store>1</show_in_store>
|
625 |
+
</active>
|
626 |
+
<sort_order translate="label">
|
627 |
+
<label>Sort Order</label>
|
628 |
+
<frontend_type>text</frontend_type>
|
629 |
+
<config_path>payment/moneybookers_lsr/sort_order</config_path>
|
630 |
+
<sort_order>3</sort_order>
|
631 |
+
<show_in_default>1</show_in_default>
|
632 |
+
<show_in_website>1</show_in_website>
|
633 |
+
<show_in_store>1</show_in_store>
|
634 |
+
</sort_order>
|
635 |
+
<title translate="label">
|
636 |
+
<label>Title</label>
|
637 |
+
<frontend_type>text</frontend_type>
|
638 |
+
<config_path>payment/moneybookers_lsr/title</config_path>
|
639 |
+
<sort_order>5</sort_order>
|
640 |
+
<show_in_default>1</show_in_default>
|
641 |
+
<show_in_website>1</show_in_website>
|
642 |
+
<show_in_store>1</show_in_store>
|
643 |
+
</title>
|
644 |
+
<allowspecific translate="label">
|
645 |
+
<label>Payment from Applicable Countries</label>
|
646 |
+
<frontend_type>allowspecific</frontend_type>
|
647 |
+
<config_path>payment/moneybookers_lsr/allowspecific</config_path>
|
648 |
+
<sort_order>6</sort_order>
|
649 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
650 |
+
<show_in_default>1</show_in_default>
|
651 |
+
<show_in_website>1</show_in_website>
|
652 |
+
<show_in_store>1</show_in_store>
|
653 |
+
</allowspecific>
|
654 |
+
<specificcountry translate="label">
|
655 |
+
<label>Payment from Specific Countries</label>
|
656 |
+
<frontend_type>multiselect</frontend_type>
|
657 |
+
<config_path>payment/moneybookers_lsr/specificcountry</config_path>
|
658 |
+
<sort_order>7</sort_order>
|
659 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
660 |
+
<show_in_default>1</show_in_default>
|
661 |
+
<show_in_website>1</show_in_website>
|
662 |
+
<show_in_store>1</show_in_store>
|
663 |
+
<can_be_empty>1</can_be_empty>
|
664 |
+
</specificcountry>
|
665 |
+
</fields>
|
666 |
+
</moneybookers_lsr>
|
667 |
+
<moneybookers_mae translate="label" module="moneybookers">
|
668 |
+
<label>Maestro (powered by Moneybookers) - United Kingdom, Austria, Spain</label>
|
669 |
+
<frontend_type>text</frontend_type>
|
670 |
+
<sort_order>231</sort_order>
|
671 |
+
<show_in_default>1</show_in_default>
|
672 |
+
<show_in_website>1</show_in_website>
|
673 |
+
<show_in_store>1</show_in_store>
|
674 |
+
<fields>
|
675 |
+
<active translate="label">
|
676 |
+
<label>Enabled</label>
|
677 |
+
<frontend_type>select</frontend_type>
|
678 |
+
<config_path>payment/moneybookers_mae/active</config_path>
|
679 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
680 |
+
<sort_order>1</sort_order>
|
681 |
+
<show_in_default>1</show_in_default>
|
682 |
+
<show_in_website>1</show_in_website>
|
683 |
+
<show_in_store>1</show_in_store>
|
684 |
+
</active>
|
685 |
+
<sort_order translate="label">
|
686 |
+
<label>Sort Order</label>
|
687 |
+
<frontend_type>text</frontend_type>
|
688 |
+
<config_path>payment/moneybookers_mae/sort_order</config_path>
|
689 |
+
<sort_order>3</sort_order>
|
690 |
+
<show_in_default>1</show_in_default>
|
691 |
+
<show_in_website>1</show_in_website>
|
692 |
+
<show_in_store>1</show_in_store>
|
693 |
+
</sort_order>
|
694 |
+
<title translate="label">
|
695 |
+
<label>Title</label>
|
696 |
+
<frontend_type>text</frontend_type>
|
697 |
+
<config_path>payment/moneybookers_mae/title</config_path>
|
698 |
+
<sort_order>5</sort_order>
|
699 |
+
<show_in_default>1</show_in_default>
|
700 |
+
<show_in_website>1</show_in_website>
|
701 |
+
<show_in_store>1</show_in_store>
|
702 |
+
</title>
|
703 |
+
<allowspecific translate="label">
|
704 |
+
<label>Payment from Applicable Countries</label>
|
705 |
+
<frontend_type>allowspecific</frontend_type>
|
706 |
+
<config_path>payment/moneybookers_mae/allowspecific</config_path>
|
707 |
+
<sort_order>6</sort_order>
|
708 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
709 |
+
<show_in_default>1</show_in_default>
|
710 |
+
<show_in_website>1</show_in_website>
|
711 |
+
<show_in_store>1</show_in_store>
|
712 |
+
</allowspecific>
|
713 |
+
<specificcountry translate="label">
|
714 |
+
<label>Payment from Specific Countries</label>
|
715 |
+
<frontend_type>multiselect</frontend_type>
|
716 |
+
<config_path>payment/moneybookers_mae/specificcountry</config_path>
|
717 |
+
<sort_order>7</sort_order>
|
718 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
719 |
+
<show_in_default>1</show_in_default>
|
720 |
+
<show_in_website>1</show_in_website>
|
721 |
+
<show_in_store>1</show_in_store>
|
722 |
+
<can_be_empty>1</can_be_empty>
|
723 |
+
</specificcountry>
|
724 |
+
</fields>
|
725 |
+
</moneybookers_mae>
|
726 |
+
<moneybookers_npy translate="label" module="moneybookers">
|
727 |
+
<label>EPS Online-Überweisung (powered by Moneybookers) - Austria</label>
|
728 |
+
<frontend_type>text</frontend_type>
|
729 |
+
<sort_order>301</sort_order>
|
730 |
+
<show_in_default>1</show_in_default>
|
731 |
+
<show_in_website>1</show_in_website>
|
732 |
+
<show_in_store>1</show_in_store>
|
733 |
+
<fields>
|
734 |
+
<active translate="label">
|
735 |
+
<label>Enabled</label>
|
736 |
+
<frontend_type>select</frontend_type>
|
737 |
+
<config_path>payment/moneybookers_npy/active</config_path>
|
738 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
739 |
+
<sort_order>1</sort_order>
|
740 |
+
<show_in_default>1</show_in_default>
|
741 |
+
<show_in_website>1</show_in_website>
|
742 |
+
<show_in_store>1</show_in_store>
|
743 |
+
</active>
|
744 |
+
<sort_order translate="label">
|
745 |
+
<label>Sort Order</label>
|
746 |
+
<frontend_type>text</frontend_type>
|
747 |
+
<config_path>payment/moneybookers_npy/sort_order</config_path>
|
748 |
+
<sort_order>3</sort_order>
|
749 |
+
<show_in_default>1</show_in_default>
|
750 |
+
<show_in_website>1</show_in_website>
|
751 |
+
<show_in_store>1</show_in_store>
|
752 |
+
</sort_order>
|
753 |
+
<title translate="label">
|
754 |
+
<label>Title</label>
|
755 |
+
<frontend_type>text</frontend_type>
|
756 |
+
<config_path>payment/moneybookers_npy/title</config_path>
|
757 |
+
<sort_order>5</sort_order>
|
758 |
+
<show_in_default>1</show_in_default>
|
759 |
+
<show_in_website>1</show_in_website>
|
760 |
+
<show_in_store>1</show_in_store>
|
761 |
+
</title>
|
762 |
+
<allowspecific translate="label">
|
763 |
+
<label>Payment from Applicable Countries</label>
|
764 |
+
<frontend_type>allowspecific</frontend_type>
|
765 |
+
<config_path>payment/moneybookers_npy/allowspecific</config_path>
|
766 |
+
<sort_order>6</sort_order>
|
767 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
768 |
+
<show_in_default>1</show_in_default>
|
769 |
+
<show_in_website>1</show_in_website>
|
770 |
+
<show_in_store>1</show_in_store>
|
771 |
+
</allowspecific>
|
772 |
+
<specificcountry translate="label">
|
773 |
+
<label>Payment from Specific Countries</label>
|
774 |
+
<frontend_type>multiselect</frontend_type>
|
775 |
+
<config_path>payment/moneybookers_npy/specificcountry</config_path>
|
776 |
+
<sort_order>7</sort_order>
|
777 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
778 |
+
<show_in_default>1</show_in_default>
|
779 |
+
<show_in_website>1</show_in_website>
|
780 |
+
<show_in_store>1</show_in_store>
|
781 |
+
<can_be_empty>1</can_be_empty>
|
782 |
+
</specificcountry>
|
783 |
+
</fields>
|
784 |
+
</moneybookers_npy>
|
785 |
+
<moneybookers_pli translate="label" module="moneybookers">
|
786 |
+
<label>POLi (powered by Moneybookers) - Australia</label>
|
787 |
+
<frontend_type>text</frontend_type>
|
788 |
+
<sort_order>311</sort_order>
|
789 |
+
<show_in_default>1</show_in_default>
|
790 |
+
<show_in_website>1</show_in_website>
|
791 |
+
<show_in_store>1</show_in_store>
|
792 |
+
<fields>
|
793 |
+
<active translate="label">
|
794 |
+
<label>Enabled</label>
|
795 |
+
<frontend_type>select</frontend_type>
|
796 |
+
<config_path>payment/moneybookers_pli/active</config_path>
|
797 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
798 |
+
<sort_order>1</sort_order>
|
799 |
+
<show_in_default>1</show_in_default>
|
800 |
+
<show_in_website>1</show_in_website>
|
801 |
+
<show_in_store>1</show_in_store>
|
802 |
+
</active>
|
803 |
+
<sort_order translate="label">
|
804 |
+
<label>Sort Order</label>
|
805 |
+
<frontend_type>text</frontend_type>
|
806 |
+
<config_path>payment/moneybookers_pli/sort_order</config_path>
|
807 |
+
<sort_order>3</sort_order>
|
808 |
+
<show_in_default>1</show_in_default>
|
809 |
+
<show_in_website>1</show_in_website>
|
810 |
+
<show_in_store>1</show_in_store>
|
811 |
+
</sort_order>
|
812 |
+
<title translate="label">
|
813 |
+
<label>Title</label>
|
814 |
+
<frontend_type>text</frontend_type>
|
815 |
+
<config_path>payment/moneybookers_pli/title</config_path>
|
816 |
+
<sort_order>5</sort_order>
|
817 |
+
<show_in_default>1</show_in_default>
|
818 |
+
<show_in_website>1</show_in_website>
|
819 |
+
<show_in_store>1</show_in_store>
|
820 |
+
</title>
|
821 |
+
<allowspecific translate="label">
|
822 |
+
<label>Payment from Applicable Countries</label>
|
823 |
+
<frontend_type>allowspecific</frontend_type>
|
824 |
+
<config_path>payment/moneybookers_pli/allowspecific</config_path>
|
825 |
+
<sort_order>6</sort_order>
|
826 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
827 |
+
<show_in_default>1</show_in_default>
|
828 |
+
<show_in_website>1</show_in_website>
|
829 |
+
<show_in_store>1</show_in_store>
|
830 |
+
</allowspecific>
|
831 |
+
<specificcountry translate="label">
|
832 |
+
<label>Payment from Specific Countries</label>
|
833 |
+
<frontend_type>multiselect</frontend_type>
|
834 |
+
<config_path>payment/moneybookers_pli/specificcountry</config_path>
|
835 |
+
<sort_order>7</sort_order>
|
836 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
837 |
+
<show_in_default>1</show_in_default>
|
838 |
+
<show_in_website>1</show_in_website>
|
839 |
+
<show_in_store>1</show_in_store>
|
840 |
+
<can_be_empty>1</can_be_empty>
|
841 |
+
</specificcountry>
|
842 |
+
</fields>
|
843 |
+
</moneybookers_pli>
|
844 |
+
<moneybookers_psp translate="label" module="moneybookers">
|
845 |
+
<label>Postepay (powered by Moneybookers) - Italy</label>
|
846 |
+
<frontend_type>text</frontend_type>
|
847 |
+
<sort_order>251</sort_order>
|
848 |
+
<show_in_default>1</show_in_default>
|
849 |
+
<show_in_website>1</show_in_website>
|
850 |
+
<show_in_store>1</show_in_store>
|
851 |
+
<fields>
|
852 |
+
<active translate="label">
|
853 |
+
<label>Enabled</label>
|
854 |
+
<frontend_type>select</frontend_type>
|
855 |
+
<config_path>payment/moneybookers_psp/active</config_path>
|
856 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
857 |
+
<sort_order>1</sort_order>
|
858 |
+
<show_in_default>1</show_in_default>
|
859 |
+
<show_in_website>1</show_in_website>
|
860 |
+
<show_in_store>1</show_in_store>
|
861 |
+
</active>
|
862 |
+
<sort_order translate="label">
|
863 |
+
<label>Sort Order</label>
|
864 |
+
<frontend_type>text</frontend_type>
|
865 |
+
<config_path>payment/moneybookers_psp/sort_order</config_path>
|
866 |
+
<sort_order>3</sort_order>
|
867 |
+
<show_in_default>1</show_in_default>
|
868 |
+
<show_in_website>1</show_in_website>
|
869 |
+
<show_in_store>1</show_in_store>
|
870 |
+
</sort_order>
|
871 |
+
<title translate="label">
|
872 |
+
<label>Title</label>
|
873 |
+
<frontend_type>text</frontend_type>
|
874 |
+
<config_path>payment/moneybookers_psp/title</config_path>
|
875 |
+
<sort_order>5</sort_order>
|
876 |
+
<show_in_default>1</show_in_default>
|
877 |
+
<show_in_website>1</show_in_website>
|
878 |
+
<show_in_store>1</show_in_store>
|
879 |
+
</title>
|
880 |
+
<allowspecific translate="label">
|
881 |
+
<label>Payment from Applicable Countries</label>
|
882 |
+
<frontend_type>allowspecific</frontend_type>
|
883 |
+
<config_path>payment/moneybookers_psp/allowspecific</config_path>
|
884 |
+
<sort_order>6</sort_order>
|
885 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
886 |
+
<show_in_default>1</show_in_default>
|
887 |
+
<show_in_website>1</show_in_website>
|
888 |
+
<show_in_store>1</show_in_store>
|
889 |
+
</allowspecific>
|
890 |
+
<specificcountry translate="label">
|
891 |
+
<label>Payment from Specific Countries</label>
|
892 |
+
<frontend_type>multiselect</frontend_type>
|
893 |
+
<config_path>payment/moneybookers_psp/specificcountry</config_path>
|
894 |
+
<sort_order>7</sort_order>
|
895 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
896 |
+
<show_in_default>1</show_in_default>
|
897 |
+
<show_in_website>1</show_in_website>
|
898 |
+
<show_in_store>1</show_in_store>
|
899 |
+
<can_be_empty>1</can_be_empty>
|
900 |
+
</specificcountry>
|
901 |
+
</fields>
|
902 |
+
</moneybookers_psp>
|
903 |
+
<moneybookers_pwy translate="label" module="moneybookers">
|
904 |
+
<label>Przelewy24 (powered by Moneybookers) - Poland</label>
|
905 |
+
<frontend_type>text</frontend_type>
|
906 |
+
<sort_order>321</sort_order>
|
907 |
+
<show_in_default>1</show_in_default>
|
908 |
+
<show_in_website>1</show_in_website>
|
909 |
+
<show_in_store>1</show_in_store>
|
910 |
+
<fields>
|
911 |
+
<active translate="label">
|
912 |
+
<label>Enabled</label>
|
913 |
+
<frontend_type>select</frontend_type>
|
914 |
+
<config_path>payment/moneybookers_pwy/active</config_path>
|
915 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
916 |
+
<sort_order>1</sort_order>
|
917 |
+
<show_in_default>1</show_in_default>
|
918 |
+
<show_in_website>1</show_in_website>
|
919 |
+
<show_in_store>1</show_in_store>
|
920 |
+
</active>
|
921 |
+
<sort_order translate="label">
|
922 |
+
<label>Sort Order</label>
|
923 |
+
<frontend_type>text</frontend_type>
|
924 |
+
<config_path>payment/moneybookers_pwy/sort_order</config_path>
|
925 |
+
<sort_order>3</sort_order>
|
926 |
+
<show_in_default>1</show_in_default>
|
927 |
+
<show_in_website>1</show_in_website>
|
928 |
+
<show_in_store>1</show_in_store>
|
929 |
+
</sort_order>
|
930 |
+
<title translate="label">
|
931 |
+
<label>Title</label>
|
932 |
+
<frontend_type>text</frontend_type>
|
933 |
+
<config_path>payment/moneybookers_pwy/title</config_path>
|
934 |
+
<sort_order>5</sort_order>
|
935 |
+
<show_in_default>1</show_in_default>
|
936 |
+
<show_in_website>1</show_in_website>
|
937 |
+
<show_in_store>1</show_in_store>
|
938 |
+
</title>
|
939 |
+
<allowspecific translate="label">
|
940 |
+
<label>Payment from Applicable Countries</label>
|
941 |
+
<frontend_type>allowspecific</frontend_type>
|
942 |
+
<config_path>payment/moneybookers_pwy/allowspecific</config_path>
|
943 |
+
<sort_order>6</sort_order>
|
944 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
945 |
+
<show_in_default>1</show_in_default>
|
946 |
+
<show_in_website>1</show_in_website>
|
947 |
+
<show_in_store>1</show_in_store>
|
948 |
+
</allowspecific>
|
949 |
+
<specificcountry translate="label">
|
950 |
+
<label>Payment from Specific Countries</label>
|
951 |
+
<frontend_type>multiselect</frontend_type>
|
952 |
+
<config_path>payment/moneybookers_pwy/specificcountry</config_path>
|
953 |
+
<sort_order>7</sort_order>
|
954 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
955 |
+
<show_in_default>1</show_in_default>
|
956 |
+
<show_in_website>1</show_in_website>
|
957 |
+
<show_in_store>1</show_in_store>
|
958 |
+
<can_be_empty>1</can_be_empty>
|
959 |
+
</specificcountry>
|
960 |
+
</fields>
|
961 |
+
</moneybookers_pwy>
|
962 |
+
<moneybookers_sft translate="label" module="moneybookers">
|
963 |
+
<label>Sofortüberweisung (powered by Moneybookers) - Germany</label>
|
964 |
+
<frontend_type>text</frontend_type>
|
965 |
+
<sort_order>213</sort_order>
|
966 |
+
<show_in_default>1</show_in_default>
|
967 |
+
<show_in_website>1</show_in_website>
|
968 |
+
<show_in_store>1</show_in_store>
|
969 |
+
<fields>
|
970 |
+
<active translate="label">
|
971 |
+
<label>Enabled</label>
|
972 |
+
<frontend_type>select</frontend_type>
|
973 |
+
<config_path>payment/moneybookers_sft/active</config_path>
|
974 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
975 |
+
<sort_order>1</sort_order>
|
976 |
+
<show_in_default>1</show_in_default>
|
977 |
+
<show_in_website>1</show_in_website>
|
978 |
+
<show_in_store>1</show_in_store>
|
979 |
+
</active>
|
980 |
+
<sort_order translate="label">
|
981 |
+
<label>Sort Order</label>
|
982 |
+
<frontend_type>text</frontend_type>
|
983 |
+
<config_path>payment/moneybookers_sft/sort_order</config_path>
|
984 |
+
<sort_order>3</sort_order>
|
985 |
+
<show_in_default>1</show_in_default>
|
986 |
+
<show_in_website>1</show_in_website>
|
987 |
+
<show_in_store>1</show_in_store>
|
988 |
+
</sort_order>
|
989 |
+
<title translate="label">
|
990 |
+
<label>Title</label>
|
991 |
+
<frontend_type>text</frontend_type>
|
992 |
+
<config_path>payment/moneybookers_sft/title</config_path>
|
993 |
+
<sort_order>5</sort_order>
|
994 |
+
<show_in_default>1</show_in_default>
|
995 |
+
<show_in_website>1</show_in_website>
|
996 |
+
<show_in_store>1</show_in_store>
|
997 |
+
</title>
|
998 |
+
<allowspecific translate="label">
|
999 |
+
<label>Payment from Applicable Countries</label>
|
1000 |
+
<frontend_type>allowspecific</frontend_type>
|
1001 |
+
<config_path>payment/moneybookers_sft/allowspecific</config_path>
|
1002 |
+
<sort_order>6</sort_order>
|
1003 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
1004 |
+
<show_in_default>1</show_in_default>
|
1005 |
+
<show_in_website>1</show_in_website>
|
1006 |
+
<show_in_store>1</show_in_store>
|
1007 |
+
</allowspecific>
|
1008 |
+
<specificcountry translate="label">
|
1009 |
+
<label>Payment from Specific Countries</label>
|
1010 |
+
<frontend_type>multiselect</frontend_type>
|
1011 |
+
<config_path>payment/moneybookers_sft/specificcountry</config_path>
|
1012 |
+
<sort_order>7</sort_order>
|
1013 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
1014 |
+
<show_in_default>1</show_in_default>
|
1015 |
+
<show_in_website>1</show_in_website>
|
1016 |
+
<show_in_store>1</show_in_store>
|
1017 |
+
<can_be_empty>1</can_be_empty>
|
1018 |
+
</specificcountry>
|
1019 |
+
</fields>
|
1020 |
+
</moneybookers_sft>
|
1021 |
+
<moneybookers_so2 translate="label" module="moneybookers">
|
1022 |
+
<label>Nordea Solo (powered by Moneybookers) - Finland</label>
|
1023 |
+
<frontend_type>text</frontend_type>
|
1024 |
+
<sort_order>281</sort_order>
|
1025 |
+
<show_in_default>1</show_in_default>
|
1026 |
+
<show_in_website>1</show_in_website>
|
1027 |
+
<show_in_store>1</show_in_store>
|
1028 |
+
<fields>
|
1029 |
+
<active translate="label">
|
1030 |
+
<label>Enabled</label>
|
1031 |
+
<frontend_type>select</frontend_type>
|
1032 |
+
<config_path>payment/moneybookers_so2/active</config_path>
|
1033 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1034 |
+
<sort_order>1</sort_order>
|
1035 |
+
<show_in_default>1</show_in_default>
|
1036 |
+
<show_in_website>1</show_in_website>
|
1037 |
+
<show_in_store>1</show_in_store>
|
1038 |
+
</active>
|
1039 |
+
<sort_order translate="label">
|
1040 |
+
<label>Sort Order</label>
|
1041 |
+
<frontend_type>text</frontend_type>
|
1042 |
+
<config_path>payment/moneybookers_so2/sort_order</config_path>
|
1043 |
+
<sort_order>3</sort_order>
|
1044 |
+
<show_in_default>1</show_in_default>
|
1045 |
+
<show_in_website>1</show_in_website>
|
1046 |
+
<show_in_store>1</show_in_store>
|
1047 |
+
</sort_order>
|
1048 |
+
<title translate="label">
|
1049 |
+
<label>Title</label>
|
1050 |
+
<frontend_type>text</frontend_type>
|
1051 |
+
<config_path>payment/moneybookers_so2/title</config_path>
|
1052 |
+
<sort_order>5</sort_order>
|
1053 |
+
<show_in_default>1</show_in_default>
|
1054 |
+
<show_in_website>1</show_in_website>
|
1055 |
+
<show_in_store>1</show_in_store>
|
1056 |
+
</title>
|
1057 |
+
<allowspecific translate="label">
|
1058 |
+
<label>Payment from Applicable Countries</label>
|
1059 |
+
<frontend_type>allowspecific</frontend_type>
|
1060 |
+
<config_path>payment/moneybookers_so2/allowspecific</config_path>
|
1061 |
+
<sort_order>6</sort_order>
|
1062 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
1063 |
+
<show_in_default>1</show_in_default>
|
1064 |
+
<show_in_website>1</show_in_website>
|
1065 |
+
<show_in_store>1</show_in_store>
|
1066 |
+
</allowspecific>
|
1067 |
+
<specificcountry translate="label">
|
1068 |
+
<label>Payment from Specific Countries</label>
|
1069 |
+
<frontend_type>multiselect</frontend_type>
|
1070 |
+
<config_path>payment/moneybookers_so2/specificcountry</config_path>
|
1071 |
+
<sort_order>7</sort_order>
|
1072 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
1073 |
+
<show_in_default>1</show_in_default>
|
1074 |
+
<show_in_website>1</show_in_website>
|
1075 |
+
<show_in_store>1</show_in_store>
|
1076 |
+
<can_be_empty>1</can_be_empty>
|
1077 |
+
</specificcountry>
|
1078 |
+
</fields>
|
1079 |
+
</moneybookers_so2>
|
1080 |
+
<moneybookers_wlt translate="label" module="moneybookers">
|
1081 |
+
<label>Moneybookers eWallet</label>
|
1082 |
+
<frontend_type>text</frontend_type>
|
1083 |
+
<sort_order>331</sort_order>
|
1084 |
+
<show_in_default>1</show_in_default>
|
1085 |
+
<show_in_website>1</show_in_website>
|
1086 |
+
<show_in_store>1</show_in_store>
|
1087 |
+
<fields>
|
1088 |
+
<active translate="label">
|
1089 |
+
<label>Enabled</label>
|
1090 |
+
<frontend_type>select</frontend_type>
|
1091 |
+
<config_path>payment/moneybookers_wlt/active</config_path>
|
1092 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1093 |
+
<sort_order>1</sort_order>
|
1094 |
+
<show_in_default>1</show_in_default>
|
1095 |
+
<show_in_website>1</show_in_website>
|
1096 |
+
<show_in_store>1</show_in_store>
|
1097 |
+
</active>
|
1098 |
+
<sort_order translate="label">
|
1099 |
+
<label>Sort Order</label>
|
1100 |
+
<frontend_type>text</frontend_type>
|
1101 |
+
<config_path>payment/moneybookers_wlt/sort_order</config_path>
|
1102 |
+
<sort_order>3</sort_order>
|
1103 |
+
<show_in_default>1</show_in_default>
|
1104 |
+
<show_in_website>1</show_in_website>
|
1105 |
+
<show_in_store>1</show_in_store>
|
1106 |
+
</sort_order>
|
1107 |
+
<title translate="label">
|
1108 |
+
<label>Title</label>
|
1109 |
+
<frontend_type>text</frontend_type>
|
1110 |
+
<config_path>payment/moneybookers_wlt/title</config_path>
|
1111 |
+
<sort_order>5</sort_order>
|
1112 |
+
<show_in_default>1</show_in_default>
|
1113 |
+
<show_in_website>1</show_in_website>
|
1114 |
+
<show_in_store>1</show_in_store>
|
1115 |
+
</title>
|
1116 |
+
<allowspecific translate="label">
|
1117 |
+
<label>Payment from Applicable Countries</label>
|
1118 |
+
<frontend_type>allowspecific</frontend_type>
|
1119 |
+
<config_path>payment/moneybookers_wlt/allowspecific</config_path>
|
1120 |
+
<sort_order>6</sort_order>
|
1121 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
1122 |
+
<show_in_default>1</show_in_default>
|
1123 |
+
<show_in_website>1</show_in_website>
|
1124 |
+
<show_in_store>1</show_in_store>
|
1125 |
+
</allowspecific>
|
1126 |
+
<specificcountry translate="label">
|
1127 |
+
<label>Payment from Specific Countries</label>
|
1128 |
+
<frontend_type>multiselect</frontend_type>
|
1129 |
+
<config_path>payment/moneybookers_wlt/specificcountry</config_path>
|
1130 |
+
<sort_order>7</sort_order>
|
1131 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
1132 |
+
<show_in_default>1</show_in_default>
|
1133 |
+
<show_in_website>1</show_in_website>
|
1134 |
+
<show_in_store>1</show_in_store>
|
1135 |
+
<can_be_empty>1</can_be_empty>
|
1136 |
+
</specificcountry>
|
1137 |
+
</fields>
|
1138 |
+
</moneybookers_wlt>
|
1139 |
+
<moneybookers_obt translate="label" module="moneybookers">
|
1140 |
+
<label>Online Bank Transfer (powered by Moneybookers)</label>
|
1141 |
+
<frontend_type>text</frontend_type>
|
1142 |
+
<sort_order>381</sort_order>
|
1143 |
+
<show_in_default>1</show_in_default>
|
1144 |
+
<show_in_website>1</show_in_website>
|
1145 |
+
<show_in_store>1</show_in_store>
|
1146 |
+
<fields>
|
1147 |
+
<active translate="label">
|
1148 |
+
<label>Enabled</label>
|
1149 |
+
<frontend_type>select</frontend_type>
|
1150 |
+
<config_path>payment/moneybookers_obt/active</config_path>
|
1151 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1152 |
+
<sort_order>1</sort_order>
|
1153 |
+
<show_in_default>1</show_in_default>
|
1154 |
+
<show_in_website>1</show_in_website>
|
1155 |
+
<show_in_store>1</show_in_store>
|
1156 |
+
</active>
|
1157 |
+
<sort_order translate="label">
|
1158 |
+
<label>Sort Order</label>
|
1159 |
+
<frontend_type>text</frontend_type>
|
1160 |
+
<config_path>payment/moneybookers_obt/sort_order</config_path>
|
1161 |
+
<sort_order>3</sort_order>
|
1162 |
+
<show_in_default>1</show_in_default>
|
1163 |
+
<show_in_website>1</show_in_website>
|
1164 |
+
<show_in_store>1</show_in_store>
|
1165 |
+
</sort_order>
|
1166 |
+
<title translate="label">
|
1167 |
+
<label>Title</label>
|
1168 |
+
<frontend_type>text</frontend_type>
|
1169 |
+
<config_path>payment/moneybookers_obt/title</config_path>
|
1170 |
+
<sort_order>5</sort_order>
|
1171 |
+
<show_in_default>1</show_in_default>
|
1172 |
+
<show_in_website>1</show_in_website>
|
1173 |
+
<show_in_store>1</show_in_store>
|
1174 |
+
</title>
|
1175 |
+
<allowspecific translate="label">
|
1176 |
+
<label>Payment from Applicable Countries</label>
|
1177 |
+
<frontend_type>allowspecific</frontend_type>
|
1178 |
+
<config_path>payment/moneybookers_obt/allowspecific</config_path>
|
1179 |
+
<sort_order>6</sort_order>
|
1180 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
1181 |
+
<show_in_default>1</show_in_default>
|
1182 |
+
<show_in_website>1</show_in_website>
|
1183 |
+
<show_in_store>1</show_in_store>
|
1184 |
+
</allowspecific>
|
1185 |
+
<specificcountry translate="label">
|
1186 |
+
<label>Payment from Specific Countries</label>
|
1187 |
+
<frontend_type>multiselect</frontend_type>
|
1188 |
+
<config_path>payment/moneybookers_obt/specificcountry</config_path>
|
1189 |
+
<sort_order>7</sort_order>
|
1190 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
1191 |
+
<show_in_default>1</show_in_default>
|
1192 |
+
<show_in_website>1</show_in_website>
|
1193 |
+
<show_in_store>1</show_in_store>
|
1194 |
+
<can_be_empty>1</can_be_empty>
|
1195 |
+
</specificcountry>
|
1196 |
+
</fields>
|
1197 |
+
</moneybookers_obt>
|
1198 |
+
</groups>
|
1199 |
+
</moneybookers>
|
1200 |
+
</sections>
|
1201 |
+
</config>
|
app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/install-1.6.0.0.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
$installer = $this;
|
22 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/mysql4-upgrade-1.2-1.2.0.1.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_Moneybookers
|
17 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
22 |
+
$installer = $this;
|
23 |
+
|
24 |
+
$installer->startSetup();
|
25 |
+
$conn = $installer->getConnection();
|
26 |
+
|
27 |
+
$select = $conn
|
28 |
+
->select()
|
29 |
+
->from($this->getTable('core/config_data'), array('scope', 'scope_id', 'path', 'value'))
|
30 |
+
->where(new Zend_Db_Expr("path LIKE 'moneybookers/moneybookers%'"));
|
31 |
+
$data = $conn->fetchAll($select);
|
32 |
+
|
33 |
+
if (!empty($data)) {
|
34 |
+
foreach ($data as $key => $value) {
|
35 |
+
$data[$key]['path'] = preg_replace('/^moneybookers\/moneybookers/', 'payment/moneybookers', $value['path']);
|
36 |
+
}
|
37 |
+
$conn->insertOnDuplicate($this->getTable('core/config_data'), $data, array('path'));
|
38 |
+
$conn->delete($this->getTable('core/config_data'), new Zend_Db_Expr("path LIKE 'moneybookers/moneybookers%'"));
|
39 |
+
}
|
40 |
+
|
41 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/recsins.xml
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
-->
|
25 |
-
|
26 |
-
<layout version="0.1.0">
|
27 |
-
<recsins_adminhtml_recsins_index>
|
28 |
-
<reference name="content">
|
29 |
-
<block type="recsins/adminhtml_recsins" name="recsins" />
|
30 |
-
</reference>
|
31 |
-
</recsins_adminhtml_recsins_index>
|
32 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/recsins.xml
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
-->
|
25 |
-
|
26 |
-
<layout version="0.1.0">
|
27 |
-
<default>
|
28 |
-
<reference name="before_body_end">
|
29 |
-
<block type="recsins/recsins" name="recsins">
|
30 |
-
</block>
|
31 |
-
</reference>
|
32 |
-
</default>
|
33 |
-
<catalog_product_view>
|
34 |
-
<reference name="product.info.upsell">
|
35 |
-
<action method="setTemplate">
|
36 |
-
<template>recsins/product.phtml</template>
|
37 |
-
</action>
|
38 |
-
</reference>
|
39 |
-
</catalog_product_view>
|
40 |
-
<checkout_cart_index>
|
41 |
-
<reference name="checkout.cart.crosssell">
|
42 |
-
<action method="setTemplate">
|
43 |
-
<template>recsins/cart.phtml</template>
|
44 |
-
</action>
|
45 |
-
</reference>
|
46 |
-
</checkout_cart_index>
|
47 |
-
<checkout_onepage_success>
|
48 |
-
<reference name="content">
|
49 |
-
<block type="recsins/checkout" name="recsins.checkout"></block>
|
50 |
-
</reference>
|
51 |
-
</checkout_onepage_success>
|
52 |
-
<checkout_multishipping_success>
|
53 |
-
<reference name="content">
|
54 |
-
<block type="recsins/checkout" name="recsins.checkout"></block>
|
55 |
-
</reference>
|
56 |
-
</checkout_multishipping_success>
|
57 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/recsins/.DS_Store
DELETED
Binary file
|
app/design/frontend/base/default/template/recsins/cart.phtml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<div id="cart_recommendations"></div>
|
|
app/design/frontend/base/default/template/recsins/category.phtml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<div id="category_recommendations"></div><br>
|
|
app/design/frontend/base/default/template/recsins/product.phtml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<div id="product_recommendations"></div><br>
|
|
app/design/frontend/base/default/template/recsins/recsins.phtml
DELETED
File without changes
|
app/etc/modules/Brainsins_Recsins.xml
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
-->
|
25 |
-
|
26 |
-
<config>
|
27 |
-
<modules>
|
28 |
-
<Brainsins_Recsins>
|
29 |
-
<active>true</active>
|
30 |
-
<codePool>community</codePool>
|
31 |
-
</Brainsins_Recsins>
|
32 |
-
</modules>
|
33 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/locale/en_US/Brainsins_Recsins.csv
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
"Configuration", "Configuration"
|
2 |
-
"BrainSINS KEY", "BrainSINS KEY"
|
3 |
-
"Home Page Recommender", "Home Page Recommender"
|
4 |
-
"Category Page Recommender", "Category Page Recommender"
|
5 |
-
"Product Page Recommender", "Product Page Recommender"
|
6 |
-
"Cart Page Recommender", "Cart Page Recommender"
|
7 |
-
"Checkout Page Recommender", "Checkout Page Recommender"
|
8 |
-
"Import Recommenders", "Import Recommenders"
|
9 |
-
"Send Catalog", "Send Catalog"
|
10 |
-
"Do not show", "Do not show"
|
11 |
-
"Edit Style", "Edit Style"
|
12 |
-
"Enabled", "Enabled"
|
13 |
-
"Disabled", "Disabled"
|
14 |
-
"Enable / Disable Extension", "Enable / Disable Extension"
|
15 |
-
"Catalog uploaded successfully", "Catalog uploaded successfully"
|
16 |
-
"Error while uploading the catalog", "Error while uploading the catalog"
|
17 |
-
"Recommenders imported sucssessfully", "Recommenders imported sucssessfully"
|
18 |
-
"Error while importing recommenders", "Error while importing recommenders"
|
19 |
-
"Abort Catalog Upload", "Abort Catalog Upload"
|
20 |
-
"Catalog upload aborted", "Catalog upload aborted"
|
21 |
-
"Uploading Clients", "Uploading Clients"
|
22 |
-
"Clients uploaded OK", "Clients uploaded OK"
|
23 |
-
"Uploading Products", "Uploading Products"
|
24 |
-
"Products uploaded OK", "Products uploaded OK"
|
25 |
-
"Uploading Carts", "Uploading Carts"
|
26 |
-
"Carts uploaded OK", "Carts uploaded OK"
|
27 |
-
"Uploading Purchases", "Uploading Purchases"
|
28 |
-
"Purchases uploaded OK", "Purchases uploaded OK"
|
29 |
-
"Error occurred while uploading Clients", "Error occurred while uploading Clients"
|
30 |
-
"Error occurred while uploading Products", "Error occurred while uploading Products"
|
31 |
-
"Error occurred while uploading Carts", "Error occurred while uploading Carts"
|
32 |
-
"Error occurred while uploading Purchases", "Error occurred while uploading Purchases"
|
33 |
-
"Catalog upload aborted", "Catalog upload aborted"
|
34 |
-
"Do not have a BrainSINS KEY?", "Do not have a BrainSINS KEY?"
|
35 |
-
"I am a BrainSINS client", "I am a BrainSINS client"
|
36 |
-
"I am not a BrainSINS client yet", "I am not a BrainSINS client yet"
|
37 |
-
"Advanced Options", "Advanced Options"
|
38 |
-
"please do not modify these values unless you are told so by BrainSINS' support team", "please do not modify these values unless you are told so by BrainSINS' support team"
|
39 |
-
"Catalog upload page size", "Catalog upload page size"
|
40 |
-
"Include out of stock products in catalog upload (out of stock products will be recommended)", "Include out of stock products in catalog upload (out of stock products will be recommended)"
|
41 |
-
"Select Image url type", "Select Image url type"
|
42 |
-
"Default value for product ''small'' image", "Default value for product ''small'' image"
|
43 |
-
"Resize product ''small'' image", "Resize product ''small'' image"
|
44 |
-
"Width", "Width"
|
45 |
-
"Heigth", "Heigth"
|
46 |
-
"Upload special price", "Upload special price"
|
47 |
-
"Yes", "Yes"
|
48 |
-
"No", "No"
|
49 |
-
"Tax Prices", "Tax Prices"
|
50 |
-
"Display Prices are equal to Catalog Prices", "Display Prices are equal to Catalog Prices"
|
51 |
-
"Display Prices include taxes and Catalog Prices do not include taxes", "Display Prices include taxes and Catalog Prices do not include taxes"
|
52 |
-
"Display Prices do not include taxes and Catalog Prices include taxes", "Display Prices do not include taxes and Catalog Prices include taxes
|
53 |
-
"Currency Display Options", "Currency Display Options"
|
54 |
-
"Currency Symbol", "Currency Symbol"
|
55 |
-
"Left", "Left"
|
56 |
-
"Right", "Right"
|
57 |
-
"Decimal Delimiter", "Decimal Delimiter"
|
58 |
-
"Custom style script (HTTP)", "Custom style script (HTTP)"
|
59 |
-
"Custom style script (HTTPS)", "Custom style script (HTTPS)"
|
60 |
-
"Use high detail in recommendation requests", "Use high detail in recommendation requests"
|
61 |
-
"Use ajax for recommendation requests", "Use ajax for recommendation requests"
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/locale/es_ES/Brainsins_Recsins.csv
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
"Configuration", "Configuración"
|
2 |
-
"BrainSINS KEY", "BrainSINS KEY"
|
3 |
-
"Home Page Recommender", "Recomendador en la página Home"
|
4 |
-
"Category Page Recommender", "Recomendador en página de categoría"
|
5 |
-
"Product Page Recommender", "Recomendador en la página de Producto"
|
6 |
-
"Cart Page Recommender", "Recomendador en la página de Carrito"
|
7 |
-
"Checkout Page Recommender", "Recomendador en la página de Checkout"
|
8 |
-
"Import Recommenders", "Importar Recomendadores"
|
9 |
-
"Send Catalog", "Enviar Catálogo"
|
10 |
-
"Do not show", "No mostrar"
|
11 |
-
"Edit Style", "Editar Estilo"
|
12 |
-
"Enabled", "Habilitada"
|
13 |
-
"Disabled", "Deshabilitada"
|
14 |
-
"Enable / Disable Extension", "Habilitar / Deshabilitar Extensión"
|
15 |
-
"Catalog uploaded successfully", "Catálogo enviado correctamente"
|
16 |
-
"Error while uploading the catalog", "Error al enviar el catálogo"
|
17 |
-
"Recommenders imported sucssessfully", "Recomendadores importados correctamente"
|
18 |
-
"Error while importing recommenders", "Error al importar los recomendadores"
|
19 |
-
"Abort Catalog Upload", "Abortar Subida de Catálogo"
|
20 |
-
"Catalog upload aborted", "Subida de catálogo abortada"
|
21 |
-
"Uploading Clients", "Enviando Usuarios"
|
22 |
-
"Clients uploaded OK", "Usuarios enviados OK"
|
23 |
-
"Uploading Products", "Enviando Productos"
|
24 |
-
"Products uploaded OK", "Productos enviados OK"
|
25 |
-
"Uploading Carts", "Enviando Carritos"
|
26 |
-
"Carts uploaded OK", "Carritos enviados OK"
|
27 |
-
"Uploading Purchases", "Enviando Compras"
|
28 |
-
"Purchases uploaded OK", "Compras enviadas OK"
|
29 |
-
"Error occurred while uploading Clients", "Error en el envío de Usuarios"
|
30 |
-
"Error occurred while uploading Products", "Error en el envío de Productos"
|
31 |
-
"Error occurred while uploading Carts", "Error en el envío de Carritos"
|
32 |
-
"Error occurred while uploading Purchases", "Error en el envío de Compras"
|
33 |
-
"Catalog upload aborted", "Envío de catálogo abortado"
|
34 |
-
"Do not have a BrainSINS KEY?", "¿No dispone de una clave ''BrainSINS KEY''?"
|
35 |
-
"I am a BrainSINS client", "Ya soy cliente de BrainSINS"
|
36 |
-
"I am not a BrainSINS client yet", "Todavía no soy cliente de BrainSINS"
|
37 |
-
"Advanced Options", "Opciones Avanzadas"
|
38 |
-
"please do not modify these values unless you are told so by BrainSINS' support team", "por favor no modifique estos valores si no es por indicación del equipo de soporte de BrainSINS"
|
39 |
-
"Catalog upload page size", "Tamaño de página para el envío de catálogo"
|
40 |
-
"Include out of stock products in catalog upload (out of stock products will be recommended)", "Incluir productos fuera de stock en la subida de catálogo (estos productos podrán ser recomendados)"
|
41 |
-
"Select Image url type", "Selección del tipo de imágenes(url)"
|
42 |
-
"Default value for product ''small'' image", "Valor por defecto de la imagen ''small''"
|
43 |
-
"Resize product ''small'' image", "Valor redimensionado de la imagen ''small''"
|
44 |
-
"Width", "Ancho"
|
45 |
-
"Heigth", "Alto"
|
46 |
-
"Upload special price", "Enviar precio ''special''"
|
47 |
-
"Yes", "Sí"
|
48 |
-
"No", "No"
|
49 |
-
"Tax Prices", "Impuestos en Precios"
|
50 |
-
"Display Prices are equal to Catalog Prices", "Los precios se muestran igual que en el catálogo"
|
51 |
-
"Display Prices include taxes and Catalog Prices do not include taxes", "Los precios se muestran con impuestos y en el catálogo no incluyen inpuestos"
|
52 |
-
"Display Prices do not include taxes and Catalog Prices include taxes", "Los precios se muestran sin impuestos y en el catálogo sí incluyen impuestos"
|
53 |
-
"Currency Display Options", "Opciones de Visualización de Moneda"
|
54 |
-
"Currency Symbol", "Símbolo de Moneda"
|
55 |
-
"Left", "Izquierda"
|
56 |
-
"Right", "Derecha"
|
57 |
-
"Decimal Delimiter", "Delimitador de decimales"
|
58 |
-
"Custom style script (HTTP)", "Script de estilo personalizado (HTTP)"
|
59 |
-
"Custom style script (HTTPS)", "Script de estilo personalizado (HTTPS)"
|
60 |
-
"Use high detail in recommendation requests", "Usar nivel de detalle alto en la información de recomendaciones"
|
61 |
-
"Use ajax for recommendation requests", "Usar AJAX para solicitar las recomendaciones"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,31 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Brainsins_Recommender</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>BrainSINS
|
11 |

|
12 |
-
|
13 |
-
* increase sales up to 30%.
|
14 |
-
* increase conversions up to 30%.
|
15 |
-
* up to 70% of your customers will make more purchases.
|
16 |

|
17 |
-
|
18 |

|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
</notes>
|
25 |
-
<authors><author><name>BrainSINS</name><user>acuevas</user><email>
|
26 |
-
<date>
|
27 |
-
<time>
|
28 |
-
<contents><target name="magecommunity"><dir name="Brainsins"><dir name="
|
29 |
<compatible/>
|
30 |
-
<dependencies><required><php><min>5.2.0</min><max>
|
31 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Brainsins_Recommender</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>BrainSINS Smart eCommerce is a 360º personalization suite for eCommerce that helps eCommerce websites to increase up to 30% their sales.</summary>
|
10 |
+
<description>BrainSINS Smart eCommerce is a 360º personalization suite for eCommerce that helps eCommerce websites to increase up to 30% their sales. BrainSINS Smart eCommerce integrates personalized recommendations, eMail Retargeting, Behavioral Targeting, Gamification and eCommerce Analytics, all in one solution.
|
11 |

|
12 |
+
BrainSINS provides personalization technology that drives sales and conversion to more than 200 online retailers all around the globe, including large multichannel retailers such as Toys'R Us, MotherCare and Caterpillar, and solely online retail companies such as Gemln, Mimub, Zacatrus, etc.+
|
|
|
|
|
|
|
13 |

|
14 |
+
Some key features:
|
15 |

|
16 |
+
* Integrate into your e-commerce Amazon-like recommendations that drive conversions and sales, and make it easier for your customers to find what they are looking for.
|
17 |
+
* Personalize all email communication with your customers, encourage engagement and recover abandoned shopping carts.
|
18 |
+
* Easily create marketing rules that modify your e-commerce website or interact with your customers according to user behavior.
|
19 |
+
* Use gamification to engage and cultivate the loyalty of your customers and grow a community of prescribers.
|
20 |
+
* We provide a full e-commerce analytics solution to help you understand the evolution of your online business.</description>
|
21 |
+
<notes>New version includes the possibility to use the cart abandonment and behavioral targeting services</notes>
|
22 |
+
<authors><author><name>BrainSINS</name><user>acuevas</user><email>support@brainsins.com</email></author></authors>
|
23 |
+
<date>2014-09-01</date>
|
24 |
+
<time>14:42:33</time>
|
25 |
+
<contents><target name="magecommunity"><dir><dir name="Brainsins"><dir name="Recommender"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Expanded.php" hash="8fb32bbec5454610a8aab055c8891bf7"/><file name="Help.php" hash="df89b5f0a9d7510aa1393c888324e6dd"/></dir><dir name="Form"><dir name="Fieldset"><dir name="Dashboard"><file name="Dashboard.php" hash="7fcdcc0b077e1fcd40f209ada40d183e"/></dir></dir></dir><dir name="Source"><dir name="Feeds"><file name="ProductOffline.php" hash="d2480bf9d3a79f41b5889c46f747c008"/><file name="ProductOnline.php" hash="8a64b9b4cf0b1e57e0afa19889271934"/></dir><dir name="Recommenders"><file name="Cart.php" hash="7ed517187468da5c9878ac1230d45d79"/><file name="Category.php" hash="28a9b7de22a6d63decd1f619b68096a8"/><file name="Checkout.php" hash="3eb762e84f77767bde8a4f68aaf510c9"/><file name="Home.php" hash="5c4cd039a134f428bd083a955ce69f4c"/><file name="Product.php" hash="0b8420fbd092066dd8e2cb132ac218e3"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f524b9a6f3460c3eb9842f5cd6463516"/><file name="sendBrainsinsWS.log" hash="980c17cfaeb0e50531639415ca6f99ca"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="f0187336296261795b3163d7da20a24d"/><file name="Serialized.php" hash="c68122c82e7e1fc13a2575ac4e417d78"/></dir><dir name="Source"><file name="ApiMode.php" hash="80852b4069d03c7a3b70390d67d2f875"/><file name="Attributes.php" hash="c223fe5451b35bb8779ec8d3e077d4b7"/><file name="Emailtracking.php" hash="cad497a703313a2c664ca1426f4640d5"/></dir></dir></dir></dir><file name="Cron.php" hash="bc4accfcba862a6559173111d656bccd"/><file name="Observer.php" hash="1dd050207b28e838567f7904f2a434c5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeedsController.php" hash="d318a3d4ba80b9587229a4f364bd3de3"/></dir><file name="CartController.php" hash="7620ccf7257d06e7180ed48898ffe966"/><file name="FeedsController.php" hash="81a7c6c7f78ea6686cbda2f1c0da6658"/></dir><dir name="etc"><file name="config.xml" hash="0828af9f521d32c3cb5f78ab0abca89f"/><file name="system.xml" hash="263bc620bc682cbf40f955f82b026240"/></dir></dir></dir><dir name="Cm"><dir name="RedisSession"><dir name="Model"><file name="Session.php" hash="fd4d16e73989a8b93582f8c11f8fdc40"/></dir><dir name="etc"><file name="config.xml" hash="4173754174f995f9f7a141747f417abc"/></dir></dir></dir><dir name="Phoenix"><dir name="Moneybookers"><dir name="Block"><file name="Form.php" hash="d370e3ba59cc15b139c7e1e79e2ec3a8"/><file name="Info.php" hash="62e0b852138497e92e28c9b739fdeb51"/><file name="Jsinit.php" hash="806c21c3c1f6891e056c4fe217e5374b"/><file name="Payment.php" hash="47d945df55393205e90df2bdee7f57ee"/><file name="Placeform.php" hash="bb0a62dde1c87ee4518fad309ecca426"/><file name="Redirect.php" hash="690db6960e1d664f98071cc3363bbf82"/></dir><dir name="Helper"><file name="Data.php" hash="1bcfdee03be9c9b9f1de57945bc10fd8"/></dir><dir name="Model"><file name="Abstract.php" hash="a2baa08ad86464916d7ffff3911c6615"/><file name="Acc.php" hash="9acaa3fe91835c9b5cd76ca6c9652c24"/><file name="Csi.php" hash="800984e5e8f2dd8389db023f0bf94ba8"/><file name="Did.php" hash="2aabc76e6b2fce0fcd2b79fcdae2f39f"/><file name="Dnk.php" hash="5f6a72c8b66d82e1b596af71ff7761ef"/><file name="Ebt.php" hash="6f0700837364d81149375a5aff3cb432"/><file name="Ent.php" hash="e14c39741e0fa1685695f7b03ade94c7"/><file name="Event.php" hash="2157aee0bbdd7e617e38d93aa7ea25cb"/><file name="Gcb.php" hash="164aaab54b6588476311553fa1e8aa8e"/><file name="Gir.php" hash="8cbbe836c24a75f96ca254cc64b37530"/><file name="Idl.php" hash="406ea46922aec31a9a36e7546b536e93"/><file name="Lsr.php" hash="b6123f853a9c50e8a9042f22322a3c6a"/><file name="Mae.php" hash="27d52b915464d18e796e40ee1934eda4"/><file name="Npy.php" hash="3e7de0ae735d2ab2ed25f699760c0aa1"/><file name="Obt.php" hash="50574d80cbef899ede7d633578b2e501"/><file name="Pli.php" hash="03287f56e87f6c3e49b85e1f3da924c6"/><file name="Psp.php" hash="6d332cc36358e9f3f5ac620cba9af1d9"/><file name="Pwy.php" hash="51c8d18558856ad32d72cba9f98a855f"/><file name="Sft.php" hash="0b9ed6c8854b102c4a517e173254980f"/><file name="So2.php" hash="ddfb8422fcbf683bc638d30b444a33cf"/><file name="Wlt.php" hash="274c375afcbfb88771c46a690de0a28e"/></dir><dir name="controllers"><file name="MoneybookersController.php" hash="1053419f00a59f2066eba6cee216a268"/><file name="ProcessingController.php" hash="abbb7c0deac91e3706bec90441ce1d93"/></dir><dir name="etc"><file name="config.xml" hash="e4ef3eb7e2c9e2034b4742d17a1c5172"/><file name="system.xml" hash="88c6ba64f6818bec99318033a65d21ce"/></dir><dir name="sql"><dir name="moneybookers_setup"><file name="install-1.6.0.0.php" hash="a5edad640edce622fc5d38cf5c66690b"/><file name="mysql4-upgrade-1.2-1.2.0.1.php" hash="b5cdb216060dedaf870604fdfd6dc931"/></dir></dir></dir></dir><dir><file name=".DS_Store" hash="c7a63c203a59292d521472373612a165"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="brainsins"><dir name="recommender"><dir name="css"><file name="brainsins_recommender.css" hash="2f78edfcf818a7c73f88c6f90fcae4bd"/></dir><dir name="images"><file name="brainsins.png" hash="98f06e0c5eb7668dd7293fc89614f7bc"/><file name="brainsins_logo.png" hash="cb4086cde3e5eef572159bd9f2ebd298"/><file name="feed_file_nok.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="feed_file_ok.gif" hash="834dfafd5f8b44c4b24a4c00add56fcf"/></dir><dir name="js"><file name="brainsins_recommender.js" hash="7714eec6618fade6d59fe6e9d6670e78"/></dir></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
28 |
</package>
|
skin/adminhtml/default/default/brainsins/recommender/css/brainsins_recommender.css
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.columns .section-config .form-list td.value {
|
2 |
+
width: auto!important;
|
3 |
+
padding-right: 5px !important;
|
4 |
+
}
|
5 |
+
|
6 |
+
li.tab-brainsins-extensions dl dt {
|
7 |
+
background: url(../images/brainsins.png) no-repeat scroll 3% 40% #d1dedf;
|
8 |
+
color: #306375;
|
9 |
+
padding-left: 26px;
|
10 |
+
min-height: 18px;
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
select.custom-select-first {
|
15 |
+
border-width: 1px;
|
16 |
+
border-style: solid;
|
17 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
18 |
+
background: #fff;
|
19 |
+
font: 12px arial, helvetica, sans-serif;
|
20 |
+
min-height: 17px;
|
21 |
+
width: 381px!important;
|
22 |
+
margin-left: -36px;
|
23 |
+
}
|
24 |
+
|
25 |
+
select.custom-select-last {
|
26 |
+
border-width: 1px;
|
27 |
+
border-style: solid;
|
28 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
29 |
+
background: #fff;
|
30 |
+
font: 12px arial, helvetica, sans-serif;
|
31 |
+
min-height: 17px;
|
32 |
+
width: 317px!important;
|
33 |
+
margin-left: 2px;
|
34 |
+
}
|
35 |
+
|
36 |
+
select.custom-select-after-before {
|
37 |
+
border-width: 1px;
|
38 |
+
border-style: solid;
|
39 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
40 |
+
background: #fff;
|
41 |
+
font: 12px arial, helvetica, sans-serif;
|
42 |
+
min-height: 17px;
|
43 |
+
width: 62px!important;
|
44 |
+
min-width: 62px!important;
|
45 |
+
margin-left: -36px;
|
46 |
+
}
|
47 |
+
|
48 |
+
select.custom-select-after-before-hide {
|
49 |
+
border-width: 1px;
|
50 |
+
border-style: solid;
|
51 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
52 |
+
background: #fff;
|
53 |
+
font: 12px arial, helvetica, sans-serif;
|
54 |
+
min-height: 17px;
|
55 |
+
width: 62px!important;
|
56 |
+
min-width: 62px!important;
|
57 |
+
margin-left: -36px;
|
58 |
+
display: none;
|
59 |
+
}
|
60 |
+
|
61 |
+
select.custom-select-after-before-div {
|
62 |
+
border-width: 1px;
|
63 |
+
border-style: solid;
|
64 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
65 |
+
background: #fff;
|
66 |
+
font: 12px arial, helvetica, sans-serif;
|
67 |
+
min-height: 21px;
|
68 |
+
width: 71px!important;
|
69 |
+
margin-right: 1px;
|
70 |
+
}
|
71 |
+
|
72 |
+
select.custom-select-after-before-div-hide {
|
73 |
+
border-width: 1px;
|
74 |
+
border-style: solid;
|
75 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
76 |
+
background: #fff;
|
77 |
+
font: 12px arial, helvetica, sans-serif;
|
78 |
+
min-height: 21px;
|
79 |
+
width: 71px!important;
|
80 |
+
margin-right: 1px;
|
81 |
+
display: none;
|
82 |
+
}
|
83 |
+
|
84 |
+
input.custom-input-text {
|
85 |
+
border-width: 1px;
|
86 |
+
border-style: solid;
|
87 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
88 |
+
background: #fff;
|
89 |
+
font: 12px arial, helvetica, sans-serif;
|
90 |
+
padding: 2px;
|
91 |
+
width: 156px!important;
|
92 |
+
}
|
93 |
+
|
94 |
+
p.custom-p {
|
95 |
+
margin-top: 3px;
|
96 |
+
margin-left: -36px;
|
97 |
+
min-height: 21px;
|
98 |
+
}
|
99 |
+
|
100 |
+
button.custom {
|
101 |
+
float: right!important;
|
102 |
+
margin-left: 2px;
|
103 |
+
}
|
104 |
+
|
105 |
+
div.recommender-separator {
|
106 |
+
border-bottom: 1px solid black;
|
107 |
+
margin-bottom: 6px;
|
108 |
+
margin-left: -36px;
|
109 |
+
}
|
110 |
+
|
111 |
+
.form-list td.value p.note {
|
112 |
+
width: 275px!important;
|
113 |
+
}
|
114 |
+
|
115 |
+
span.url-feed {
|
116 |
+
margin-left: -80px!important;
|
117 |
+
margin-right: 5px!important;
|
118 |
+
}
|
119 |
+
|
120 |
+
span.url-feed-offline {
|
121 |
+
margin-left: -80px!important;
|
122 |
+
margin-right: 5px!important;
|
123 |
+
background: url(../images/feed_file_ok.gif) no-repeat scroll 100% 50%;
|
124 |
+
padding-right: 22px;
|
125 |
+
}
|
126 |
+
|
127 |
+
span.feed-filenok {
|
128 |
+
margin-left: -80px!important;
|
129 |
+
margin-right: 5px!important;
|
130 |
+
background: url(../images/feed_file_nok.gif) no-repeat scroll 100% 50%;
|
131 |
+
padding-right: 22px;
|
132 |
+
}
|
133 |
+
|
134 |
+
span.custom-div {
|
135 |
+
font-weight: bold;
|
136 |
+
color: #eb5e00;
|
137 |
+
}
|
138 |
+
|
139 |
+
.brainsins-help {
|
140 |
+
font-weight: bold;
|
141 |
+
margin: -10px 0 10px 0;
|
142 |
+
}
|
skin/adminhtml/default/default/brainsins/recommender/images/brainsins.png
ADDED
Binary file
|
skin/adminhtml/default/default/brainsins/recommender/images/brainsins_logo.png
ADDED
Binary file
|
skin/adminhtml/default/default/brainsins/recommender/images/feed_file_nok.gif
ADDED
Binary file
|
skin/adminhtml/default/default/brainsins/recommender/images/feed_file_ok.gif
ADDED
Binary file
|
skin/adminhtml/default/default/brainsins/recommender/js/brainsins_recommender.js
ADDED
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
3 |
+
* personalized product recommendations into a Magento Store.
|
4 |
+
* Copyright (c) 2014 Social Gaming Platform S.R.L.
|
5 |
+
*
|
6 |
+
* This file is part of BrainSINS' Magento Extension.
|
7 |
+
*
|
8 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
9 |
+
* and/or modify it under the terms of the GNU General Public License
|
10 |
+
* as published by the Free Software Foundation, either version 3 of the
|
11 |
+
* License, or (at your option) any later version.
|
12 |
+
*
|
13 |
+
* Foobar is distributed in the hope that it will be useful,
|
14 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
* GNU General Public License for more details.
|
17 |
+
*
|
18 |
+
* You should have received a copy of the GNU General Public License
|
19 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
20 |
+
*
|
21 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
Event.observe(window, 'load', function() {
|
25 |
+
if($('brainsins_recommender_options_brainsins_recommender_general_bs_key').value == '')
|
26 |
+
{
|
27 |
+
$('brainsins_recommender_options_brainsins_recommender_general').down(2).show();
|
28 |
+
}
|
29 |
+
if($('urlOfflineFeedController'))
|
30 |
+
{
|
31 |
+
runOfflineFeed($('urlOfflineFeedController').value, $('urlOfflineFeedFile').value, '');
|
32 |
+
$('btnRunOfflineFeed').hide();
|
33 |
+
}
|
34 |
+
else
|
35 |
+
{
|
36 |
+
$('btnRunOfflineFeed').removeClassName('disabled');
|
37 |
+
$('btnRunOfflineFeed').removeClassName('disabled');
|
38 |
+
$('btnRunOfflineFeed').enable();
|
39 |
+
$('btnViewOfflineFeed').removeClassName('disabled');
|
40 |
+
$('btnViewOfflineFeed').removeClassName('disabled');
|
41 |
+
$('btnViewOfflineFeed').enable();
|
42 |
+
$('btnViewOnlineFeed').removeClassName('disabled');
|
43 |
+
$('btnViewOnlineFeed').removeClassName('disabled');
|
44 |
+
$('btnViewOnlineFeed').enable();
|
45 |
+
}
|
46 |
+
if($('brainsins_recommender_options_product_feed_product_description_attribute').value == '')
|
47 |
+
{
|
48 |
+
var options = $('brainsins_recommender_options_product_feed_product_description_attribute');
|
49 |
+
var len = options.length;
|
50 |
+
for (var i = 0; i < len; i++) {
|
51 |
+
if(options[i].value == 'description')
|
52 |
+
{
|
53 |
+
options[i].selected = true;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$('brainsins_recommender_options_product_feed_product_description_attribute').value == 'description';
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
function runOfflineFeed(url, file, bskey) {
|
61 |
+
var now = new Date();
|
62 |
+
//var msg = file + ' (' + FormatNu(now.getDay()-1) + '/' + FormatNu(now.getMonth()+1) + '/' + now.getFullYear() + ' ' + now.getHours() + ':' + FormatNu(now.getMinutes()) + ')';
|
63 |
+
var msg = file + ' (' + now.getHours() + ':' + FormatNu(now.getMinutes()) + ':' + FormatNu(now.getSeconds()) + ')';
|
64 |
+
if(bskey != '')
|
65 |
+
{
|
66 |
+
url = url + 'bskey/' + bskey;
|
67 |
+
}
|
68 |
+
new Ajax.Request(url, {
|
69 |
+
onSuccess: function(response) {
|
70 |
+
$$('.url-feed-offline')[0].update(msg);
|
71 |
+
},
|
72 |
+
onComplete: function(response) {
|
73 |
+
if (200 == response.status)
|
74 |
+
if($$('.feed-filenok')[0])
|
75 |
+
{
|
76 |
+
$$('.feed-filenok')[0].update(msg);
|
77 |
+
$$('.feed-filenok')[0].toggleClassName('url-feed-offline');
|
78 |
+
$$('.feed-filenok')[0].removeClassName('feed-filenok');
|
79 |
+
}
|
80 |
+
}
|
81 |
+
});
|
82 |
+
}
|
83 |
+
|
84 |
+
Validation.addAllThese([
|
85 |
+
['validate-bskey-format', 'BrainSINS Key not valid.', function (v) {
|
86 |
+
return Validation.get('IsEmpty').test(v) || /^BS-\d{10}-\d+$/.test(v)
|
87 |
+
}],
|
88 |
+
['required-recommender-home', 'Recommender name is required.', function (v,elm) {
|
89 |
+
if(elm.up(2).getStyle('display') == 'block')
|
90 |
+
{
|
91 |
+
result = ((v != "none") && (v != null) && (v.length != 0));
|
92 |
+
if(!result)
|
93 |
+
{
|
94 |
+
goToError('brainsins_recommender_recommenders_container_home');
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
else
|
98 |
+
{
|
99 |
+
return true;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
else
|
103 |
+
{
|
104 |
+
return true;
|
105 |
+
}
|
106 |
+
}],
|
107 |
+
['required-recommender-product', 'Recommender name is required.', function (v,elm) {
|
108 |
+
if(elm.up(2).getStyle('display') == 'block')
|
109 |
+
{
|
110 |
+
result = ((v != "none") && (v != null) && (v.length != 0));
|
111 |
+
if(!result)
|
112 |
+
{
|
113 |
+
goToError('brainsins_recommender_recommenders_container_product');
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
else
|
117 |
+
{
|
118 |
+
return true;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
else
|
122 |
+
{
|
123 |
+
return true;
|
124 |
+
}
|
125 |
+
}],
|
126 |
+
['required-recommender-category', 'Recommender name is required.', function (v,elm) {
|
127 |
+
if(elm.up(2).getStyle('display') == 'block')
|
128 |
+
{
|
129 |
+
result = ((v != "none") && (v != null) && (v.length != 0));
|
130 |
+
if(!result)
|
131 |
+
{
|
132 |
+
goToError('brainsins_recommender_recommenders_container_category');
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
else
|
136 |
+
{
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
else
|
141 |
+
{
|
142 |
+
return true;
|
143 |
+
}
|
144 |
+
}],
|
145 |
+
['required-recommender-cart', 'Recommender name is required.', function (v,elm) {
|
146 |
+
if(elm.up(2).getStyle('display') == 'block')
|
147 |
+
{
|
148 |
+
result = ((v != "none") && (v != null) && (v.length != 0));
|
149 |
+
if(!result)
|
150 |
+
{
|
151 |
+
goToError('brainsins_recommender_recommenders_container_cart');
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
else
|
155 |
+
{
|
156 |
+
return true;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
else
|
160 |
+
{
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
}],
|
164 |
+
['required-recommender-checkout', 'Recommender name is required.', function (v,elm) {
|
165 |
+
if(elm.up(2).getStyle('display') == 'block')
|
166 |
+
{
|
167 |
+
result = ((v != "none") && (v != null) && (v.length != 0));
|
168 |
+
if(!result)
|
169 |
+
{
|
170 |
+
goToError('brainsins_recommender_recommenders_container_checkout');
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
else
|
174 |
+
{
|
175 |
+
return true;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
else
|
179 |
+
{
|
180 |
+
return true;
|
181 |
+
}
|
182 |
+
}],
|
183 |
+
['required-position-or-custom-div-home', 'Position or custom div is required.', function (v,elm) {
|
184 |
+
if(elm.up(2).getStyle('display') == 'block')
|
185 |
+
{
|
186 |
+
custom_div = elm.next().down(1).next();
|
187 |
+
if((v != "none") && (v != null) && (v != '-') && (v != 'custom') && (v.length != 0))
|
188 |
+
{
|
189 |
+
return true;
|
190 |
+
}
|
191 |
+
else
|
192 |
+
{
|
193 |
+
if((custom_div.value != '') && (custom_div.length != 0))
|
194 |
+
{
|
195 |
+
return true;
|
196 |
+
}
|
197 |
+
else
|
198 |
+
{
|
199 |
+
goToError('brainsins_recommender_recommenders_container_home');
|
200 |
+
return false;
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
else
|
205 |
+
{
|
206 |
+
return true;
|
207 |
+
}
|
208 |
+
}],
|
209 |
+
['required-position-or-custom-div-product', 'Position or custom div is required.', function (v,elm) {
|
210 |
+
if(elm.up(2).getStyle('display') == 'block')
|
211 |
+
{
|
212 |
+
custom_div = elm.next().down(1).next();
|
213 |
+
if((v != "none") && (v != null) && (v != '-') && (v != 'custom') && (v.length != 0))
|
214 |
+
{
|
215 |
+
return true;
|
216 |
+
}
|
217 |
+
else
|
218 |
+
{
|
219 |
+
if((custom_div.value != '') && (custom_div.length != 0))
|
220 |
+
{
|
221 |
+
return true;
|
222 |
+
}
|
223 |
+
else
|
224 |
+
{
|
225 |
+
goToError('brainsins_recommender_recommenders_container_product');
|
226 |
+
return false;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
else
|
231 |
+
{
|
232 |
+
return true;
|
233 |
+
}
|
234 |
+
}],
|
235 |
+
['required-position-or-custom-div-category', 'Position or custom div is required.', function (v,elm) {
|
236 |
+
if(elm.up(2).getStyle('display') == 'block')
|
237 |
+
{
|
238 |
+
custom_div = elm.next().down(1).next();
|
239 |
+
if((v != "none") && (v != null) && (v != '-') && (v != 'custom') && (v.length != 0))
|
240 |
+
{
|
241 |
+
return true;
|
242 |
+
}
|
243 |
+
else
|
244 |
+
{
|
245 |
+
if((custom_div.value != '') && (custom_div.length != 0))
|
246 |
+
{
|
247 |
+
return true;
|
248 |
+
}
|
249 |
+
else
|
250 |
+
{
|
251 |
+
goToError('brainsins_recommender_recommenders_container_category');
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
else
|
257 |
+
{
|
258 |
+
return true;
|
259 |
+
}
|
260 |
+
}],
|
261 |
+
['required-position-or-custom-div-cart', 'Position or custom div is required.', function (v,elm) {
|
262 |
+
if(elm.up(2).getStyle('display') == 'block')
|
263 |
+
{
|
264 |
+
custom_div = elm.next().down(1).next();
|
265 |
+
if((v != "none") && (v != null) && (v != '-') && (v != 'custom') && (v.length != 0))
|
266 |
+
{
|
267 |
+
return true;
|
268 |
+
}
|
269 |
+
else
|
270 |
+
{
|
271 |
+
if((custom_div.value != '') && (custom_div.length != 0))
|
272 |
+
{
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
else
|
276 |
+
{
|
277 |
+
goToError('brainsins_recommender_recommenders_container_cart');
|
278 |
+
return false;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
else
|
283 |
+
{
|
284 |
+
return true;
|
285 |
+
}
|
286 |
+
}],
|
287 |
+
['required-position-or-custom-div-checkout', 'Position or custom div is required.', function (v,elm) {
|
288 |
+
if(elm != $$('.required-position-or-custom-div-checkout')[0])
|
289 |
+
{
|
290 |
+
if(elm.up(2).getStyle('display') == 'block')
|
291 |
+
{
|
292 |
+
custom_div = elm.next().down(1).next();
|
293 |
+
if((v != "none") && (v != null) && (v != '-') && (v != 'custom') && (v.length != 0))
|
294 |
+
{
|
295 |
+
return true;
|
296 |
+
}
|
297 |
+
else
|
298 |
+
{
|
299 |
+
if((custom_div.value != '') && (custom_div.length != 0))
|
300 |
+
{
|
301 |
+
return true;
|
302 |
+
}
|
303 |
+
else
|
304 |
+
{
|
305 |
+
goToError('brainsins_recommender_recommenders_container_checkout');
|
306 |
+
return false;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
else
|
311 |
+
{
|
312 |
+
return true;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
return true;
|
316 |
+
}]
|
317 |
+
]);
|
318 |
+
|
319 |
+
function checkCustom(object) {
|
320 |
+
if(object.value == 'custom')
|
321 |
+
{
|
322 |
+
object.next().down().show();
|
323 |
+
object.next().down().next().toggleClassName('custom-select-after-before-div');
|
324 |
+
object.next().down().next().removeClassName('custom-select-after-before-div-hide');
|
325 |
+
object.previous().toggleClassName('custom-select-after-before-hide');
|
326 |
+
object.previous().removeClassName('custom-select-after-before');
|
327 |
+
object.next().down().next().next().show();
|
328 |
+
}
|
329 |
+
else
|
330 |
+
{
|
331 |
+
object.next().down().hide();
|
332 |
+
object.next().down().next().removeClassName('custom-select-after-before-div');
|
333 |
+
object.next().down().next().addClassName('custom-select-after-before-div-hide');
|
334 |
+
object.next().down().next().next().setValue('');
|
335 |
+
object.next().down().next().next().hide();
|
336 |
+
object.previous().addClassName('custom-select-after-before');
|
337 |
+
object.previous().removeClassName('custom-select-after-before-hide');
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
function goToError(div) {
|
342 |
+
Effect.ScrollTo(div, {duration:'1.4', offset: -50});
|
343 |
+
}
|
344 |
+
|
345 |
+
function FormatNu(nu) {
|
346 |
+
return nu>9?nu:'0'+nu;
|
347 |
+
}
|