Version Notes
First Stable Release
Download this release
Release Info
Developer | alfa9 |
Extension | ApiAutoApplyRules |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/community/Alfa9/AutoApplyRules/Helper/Data.php +38 -0
- app/code/community/Alfa9/AutoApplyRules/Model/Catalog/Product/Api.php +25 -0
- app/code/community/Alfa9/AutoApplyRules/Model/Catalog/Product/Api/V2.php +25 -0
- app/code/community/Alfa9/AutoApplyRules/etc/config.xml +63 -0
- app/code/community/Alfa9/AutoApplyRules/etc/system.xml +36 -0
- app/code/community/Alfa9/MageForce/Block/Map/Button.php +69 -0
- app/code/community/Alfa9/MageForce/Block/Map/Button/Customer.php +5 -0
- app/code/community/Alfa9/MageForce/Block/Map/Field/Attributes.php +59 -0
- app/code/community/Alfa9/MageForce/Block/Map/Field/Help.php +16 -0
- app/code/community/Alfa9/MageForce/Helper/Data.php +167 -0
- app/code/community/Alfa9/MageForce/Model/Adminhtml/System/Config/Backend/Xml.php +59 -0
- app/code/community/Alfa9/MageForce/Model/Observer.php +84 -0
- app/code/community/Alfa9/MageForce/Model/Observer/Customer.php +4 -0
- app/code/community/Alfa9/MageForce/Model/Observer/Order.php +4 -0
- app/code/community/Alfa9/MageForce/Model/Observer/Product.php +4 -0
- app/code/community/Alfa9/MageForce/Model/Observer/Quote.php +4 -0
- app/code/community/Alfa9/MageForce/Model/Resource/Setup.php +4 -0
- app/code/community/Alfa9/MageForce/controllers/SyncController.php +19 -0
- app/code/community/Alfa9/MageForce/etc/config.xml +196 -0
- app/code/community/Alfa9/MageForce/etc/system.xml +330 -0
- app/code/community/Alfa9/MageForce/sql/a9mageforce_setup/install-0.0.1.php +69 -0
- app/code/local/Alfa9/Adminhtml/etc/config.xml +20 -0
- app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset.php +88 -0
- app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset/A9base/Extensions.php +8 -0
- app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset/A9base/Installed.php +8 -0
- app/code/local/Alfa9/Base/Helper/Data.php +13 -0
- app/code/local/Alfa9/Base/Model/Rss/Modules.php +26 -0
- app/code/local/Alfa9/Base/etc/config.xml +100 -0
- app/code/local/Alfa9/Base/etc/system.xml +91 -0
- app/code/local/Alfa9/Checkout/Model/Type/Onepage.php +5 -0
- app/code/local/Alfa9/Checkout/etc/config.xml +24 -0
- app/code/local/Alfa9/VentasEnGrupo/Block/Adminhtml/Catalog/Product/Grid.php +249 -0
- app/code/local/Alfa9/VentasEnGrupo/Block/Adminhtml/System/Config/Date.php +10 -0
- app/code/local/Alfa9/VentasEnGrupo/Block/Grupo/Selector.php +25 -0
- app/code/local/Alfa9/VentasEnGrupo/Block/Productor/Totals.php +62 -0
- app/code/local/Alfa9/VentasEnGrupo/Helper/Data.php +231 -0
- app/code/local/Alfa9/VentasEnGrupo/Helper/Order.php +80 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Date/Days.php +41 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Date/Freq.php +44 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Partner.php +76 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Dailydeal/Task.php +41 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Order.php +22 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Order/Partner.php +26 -0
- app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Product.php +21 -0
- app/code/local/Alfa9/VentasEnGrupo/etc/config.xml +137 -0
- app/code/local/Alfa9/VentasEnGrupo/etc/system.xml +230 -0
- app/etc/modules/Alfa9_AutoApplyRules.xml +16 -0
- app/etc/modules/Alfa9_Base.xml +16 -0
- package.xml +22 -0
app/code/community/Alfa9/AutoApplyRules/Helper/Data.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Alfa9 AutoApplyRules Helper
|
4 |
+
*
|
5 |
+
* @category Alfa9
|
6 |
+
* @package Alfa9_AutoApplyRules
|
7 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
class Alfa9_AutoApplyRules_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
const XML_PATH_A9AAR_ENABLED = 'a9auto_apply_rules/options/enabled';
|
12 |
+
|
13 |
+
public function autoApplyProductRules($productId) {
|
14 |
+
if (!Mage::getStoreConfig(Alfa9_AutoApplyRules_Helper_Data::XML_PATH_A9AAR_ENABLED)) return;
|
15 |
+
try {
|
16 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
17 |
+
if (!$product) return;
|
18 |
+
$productWebsiteIds = $product->getWebsiteIds();
|
19 |
+
$rules = Mage::getModel('catalogrule/rule')->getCollection()
|
20 |
+
->addFieldToFilter('is_active', 1);
|
21 |
+
foreach ($rules as $rule) {
|
22 |
+
if ($rule->getConditions()->validate($product)) {
|
23 |
+
if (!is_array($rule->getWebsiteIds())) {
|
24 |
+
$ruleWebsiteIds = (array)explode(',',$rule->getWebsiteIds());
|
25 |
+
} else {
|
26 |
+
$ruleWebsiteIds = $rule->getWebsiteIds();
|
27 |
+
}
|
28 |
+
$websiteIds = array_intersect($productWebsiteIds, $ruleWebsiteIds);
|
29 |
+
$rule->applyToProduct($product, $websiteIds);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
Mage::log('Applied catalogrules to productId: '.$productId.'.');
|
33 |
+
} catch(Exception $e) {
|
34 |
+
Mage::logException($e);
|
35 |
+
Mage::log('Failed to apply catalogrules to productId: '.$productId.'.');
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Alfa9/AutoApplyRules/Model/Catalog/Product/Api.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product api
|
4 |
+
*
|
5 |
+
* @category Alfa9
|
6 |
+
* @package Alfa9_AutoApplyRules
|
7 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
class Alfa9_AutoApplyRules_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Update product data
|
13 |
+
*
|
14 |
+
* @param int|string $productId
|
15 |
+
* @param array $productData
|
16 |
+
* @param string|int $store
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function update($productId, $productData, $store = null, $identifierType = null)
|
20 |
+
{
|
21 |
+
$result = parent::update($productId, $productData, $store, $identifierType);
|
22 |
+
Mage::helper('a9auto_apply_rules')->autoApplyProductRules($productId);
|
23 |
+
return $result;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Alfa9/AutoApplyRules/Model/Catalog/Product/Api/V2.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product api V2
|
4 |
+
*
|
5 |
+
* @category Alfa9
|
6 |
+
* @package Alfa9_AutoApplyRules
|
7 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
class Alfa9_AutoApplyRules_Model_Catalog_Product_Api_V2 extends Mage_Catalog_Model_Product_Api_V2
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Update product data
|
13 |
+
*
|
14 |
+
* @param int|string $productId
|
15 |
+
* @param array $productData
|
16 |
+
* @param string|int $store
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function update($productId, $productData, $store = null, $identifierType = null)
|
20 |
+
{
|
21 |
+
$result = parent::update($productId, $productData, $store, $identifierType);
|
22 |
+
Mage::helper('a9auto_apply_rules')->autoApplyProductRules($productId);
|
23 |
+
return $result;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Alfa9/AutoApplyRules/etc/config.xml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_AutoApplyRules
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_AutoApplyRules>
|
12 |
+
<version>0.0.1</version>
|
13 |
+
<depends>
|
14 |
+
<Mage_Adminhtml />
|
15 |
+
<Mage_Core />
|
16 |
+
<Mage_Catalog />
|
17 |
+
</depends>
|
18 |
+
</Alfa9_AutoApplyRules>
|
19 |
+
</modules>
|
20 |
+
<global>
|
21 |
+
<models>
|
22 |
+
<catalog>
|
23 |
+
<rewrite>
|
24 |
+
<product_api>Alfa9_AutoApplyRules_Model_Catalog_Product_Api</product_api>
|
25 |
+
<product_api_v2>Alfa9_AutoApplyRules_Model_Catalog_Product_Api_V2</product_api_v2>
|
26 |
+
</rewrite>
|
27 |
+
</catalog>
|
28 |
+
</models>
|
29 |
+
<helpers>
|
30 |
+
<a9auto_apply_rules>
|
31 |
+
<class>Alfa9_AutoApplyRules_Helper</class>
|
32 |
+
</a9auto_apply_rules>
|
33 |
+
</helpers>
|
34 |
+
</global>
|
35 |
+
<adminhtml>
|
36 |
+
<acl>
|
37 |
+
<resources>
|
38 |
+
<admin>
|
39 |
+
<children>
|
40 |
+
<system>
|
41 |
+
<children>
|
42 |
+
<config>
|
43 |
+
<children>
|
44 |
+
<a9auto_apply_rules translate="label" module="a9auto_apply_rules">
|
45 |
+
<title>Auto Apply Catalog Rules</title>
|
46 |
+
</a9auto_apply_rules>
|
47 |
+
</children>
|
48 |
+
</config>
|
49 |
+
</children>
|
50 |
+
</system>
|
51 |
+
</children>
|
52 |
+
</admin>
|
53 |
+
</resources>
|
54 |
+
</acl>
|
55 |
+
</adminhtml>
|
56 |
+
<default>
|
57 |
+
<a9auto_apply_rules>
|
58 |
+
<options>
|
59 |
+
<enabled>0</enabled>
|
60 |
+
</options>
|
61 |
+
</a9auto_apply_rules>
|
62 |
+
</default>
|
63 |
+
</config>
|
app/code/community/Alfa9/AutoApplyRules/etc/system.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config><!-- http://w-hat.com/name2key?terse=1&name=%20Trullo%20Oh -->
|
3 |
+
<sections>
|
4 |
+
<a9auto_apply_rules translate="label" module="a9auto_apply_rules">
|
5 |
+
<label>Auto Apply Catalog Rules</label>
|
6 |
+
<tab>a9base</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>10100</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<options translate="label">
|
14 |
+
<label>Configuration</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>0</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<enabled translate="label">
|
22 |
+
<label>Enabled</label>
|
23 |
+
<comment>Enable it to auto apply existent catalogrules after a product is updated using the SOAP Api.</comment>
|
24 |
+
<frontend_type>select</frontend_type>
|
25 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</enabled>
|
31 |
+
</fields>
|
32 |
+
</options>
|
33 |
+
</groups>
|
34 |
+
</a9auto_apply_rules>
|
35 |
+
</sections>
|
36 |
+
</config>
|
app/code/community/Alfa9/MageForce/Block/Map/Button.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Block_Map_Button
|
3 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected $entity;
|
6 |
+
/*
|
7 |
+
* Set template
|
8 |
+
*/
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
$this->entity = strtolower ( substr (
|
13 |
+
get_class ( $this ),
|
14 |
+
1 + strrpos ( get_class ( $this ), '_' )
|
15 |
+
) );
|
16 |
+
Mage::getDesign()->setTheme('template', 'alfa9');
|
17 |
+
$this->setTemplate('a9mageforce/map/button.phtml');
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Generate synchronize button html
|
22 |
+
*
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function getButtonHtml()
|
26 |
+
{
|
27 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
+
->setData(array(
|
29 |
+
'id' => 'a9mageforce_map_'.$this->entity.'_a9mageforce_entity_create_object',
|
30 |
+
'label' => $this->helper('adminhtml')->__('Create Object in SalesForce'),
|
31 |
+
'onclick' => 'javascript:'.$this->entity.'_sync(); return false;'
|
32 |
+
));
|
33 |
+
|
34 |
+
return $button->toHtml();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Remove scope label
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
44 |
+
{
|
45 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
46 |
+
return parent::render($element);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Return element html
|
51 |
+
*
|
52 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
56 |
+
{
|
57 |
+
return $this->_toHtml();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Return ajax url for synchronize button
|
62 |
+
*
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getSyncUrl()
|
66 |
+
{
|
67 |
+
return Mage::getSingleton('adminhtml/url')->getUrl('*/object/sync');
|
68 |
+
}
|
69 |
+
}
|
app/code/community/Alfa9/MageForce/Block/Map/Button/Customer.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Block_Map_Button_Customer
|
3 |
+
extends Alfa9_MageForce_Block_Map_Button
|
4 |
+
{
|
5 |
+
}
|
app/code/community/Alfa9/MageForce/Block/Map/Field/Attributes.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Block_Map_Field_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->addColumn('magento', array(
|
7 |
+
'label' => Mage::helper('adminhtml')->__('Magento Attributes'),
|
8 |
+
'style' => 'width:200px',
|
9 |
+
));
|
10 |
+
$this->addColumn('salesforce', array(
|
11 |
+
'label' => Mage::helper('adminhtml')->__('SalesForce Fields'),
|
12 |
+
'style' => 'width:200px',
|
13 |
+
));
|
14 |
+
$this->_addAfter = false;
|
15 |
+
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Field Mapping');
|
16 |
+
parent::__construct();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Render array cell for prototypeJS template
|
21 |
+
*
|
22 |
+
* @param string $columnName
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
protected function _renderCellTemplate($columnName)
|
26 |
+
{
|
27 |
+
if (empty($this->_columns[$columnName])) {
|
28 |
+
throw new Exception('Wrong column name specified.');
|
29 |
+
}
|
30 |
+
$column = $this->_columns[$columnName];
|
31 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
32 |
+
|
33 |
+
if ($column['renderer']) {
|
34 |
+
return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
|
35 |
+
->toHtml();
|
36 |
+
}
|
37 |
+
|
38 |
+
return '<select id="' . $inputName . '" name="' . $inputName . '" value="#{' . $columnName . '}" ' .
|
39 |
+
($column['size'] ? 'size="' . $column['size'] . '"' : '') . ' class="' .
|
40 |
+
(isset($column['class']) ? $column['class'] : 'input-text custgroup required-entry') . '"'.
|
41 |
+
(isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '>'
|
42 |
+
.$this->getDataKeys($columnName, substr($inputName, strpos($inputName, 'groups[map_')+11, strpos($inputName, '][fields][ua_attr][value]')-11))
|
43 |
+
.'<\/select><script>$("'.$inputName.'").value = "#{' . $columnName . '}";<\/script>';
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getDataKeys($platform, $entity) {
|
47 |
+
$attributes = array();
|
48 |
+
try {
|
49 |
+
$attributes = Mage::helper('a9mageforce')->{'getDataKeysFrom'.ucfirst($platform)}($entity);
|
50 |
+
sort($attributes);
|
51 |
+
} catch (Exception $e) {
|
52 |
+
Mage::logException($e);
|
53 |
+
}
|
54 |
+
$options = '<option value=""><\/option>';;
|
55 |
+
foreach($attributes as $attribute)
|
56 |
+
$options .= '<option value="'.$attribute.'">'.$attribute.'<\/option>';
|
57 |
+
return $options;
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Alfa9/MageForce/Block/Map/Field/Help.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Block_Map_Field_Help
|
3 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$this->setElement($element);
|
8 |
+
$html = $this->_getHeaderHtml($element);
|
9 |
+
|
10 |
+
$html.= Mage::getSingleton('core/layout')->createBlock('core/template')->setTemplate('a9mageforce/map/help.phtml')->toHtml();
|
11 |
+
|
12 |
+
$html .= $this->_getFooterHtml($element);
|
13 |
+
|
14 |
+
return $html;
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Alfa9/MageForce/Helper/Data.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once(Mage::getBaseDir() . '/lib/salesforceAPI/soapclient/SforceEnterpriseClient.php');
|
3 |
+
|
4 |
+
class Alfa9_MageForce_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
+
{
|
6 |
+
const VAR_LOG_FILE = 'salesforce.log';
|
7 |
+
|
8 |
+
const XML_PATH_LOGIN_USERNAME = 'a9mageforce/login/username';
|
9 |
+
const XML_PATH_LOGIN_PASSWORD = 'a9mageforce/login/password';
|
10 |
+
const XML_PATH_LOGIN_TOKEN = 'a9mageforce/login/token';
|
11 |
+
|
12 |
+
const XML_PATH_WSDL_enterprise = 'a9mageforce/wsdl/enterprise';
|
13 |
+
const XML_PATH_WSDL_metadata = 'a9mageforce/wsdl/metadata';
|
14 |
+
|
15 |
+
const XML_PATH_DEBUG_FILE_ENABLED = 'a9mageforce/debug/file_enabled';
|
16 |
+
const XML_PATH_DEBUG_MAIL_ENABLED = 'a9mageforce/debug_mail/enabled';
|
17 |
+
const XML_PATH_DEBUG_MAIL_FROM = 'a9mageforce/debug/mail_from';
|
18 |
+
const XML_PATH_DEBUG_MAIL_TO = 'a9mageforce/debug/mail_to';
|
19 |
+
|
20 |
+
const XML_PATH_MAP_customer_enabled = 'a9mageforce/map_customer/enabled';
|
21 |
+
const XML_PATH_MAP_customer_magento_entity = 'a9mageforce/map_customer/magento_entity';
|
22 |
+
const XML_PATH_MAP_customer_salesforce_entity = 'a9mageforce/map_customer/salesforce_entity';
|
23 |
+
const XML_PATH_MAP_customer_ua_attr = 'a9mageforce/map_customer/ua_attr';
|
24 |
+
|
25 |
+
const XML_PATH_MAP_product_enabled = 'a9mageforce/map_product/enabled';
|
26 |
+
const XML_PATH_MAP_product_magento_entity = 'a9mageforce/map_product/magento_entity';
|
27 |
+
const XML_PATH_MAP_product_salesforce_entity = 'a9mageforce/map_product/salesforce_entity';
|
28 |
+
const XML_PATH_MAP_product_ua_attr = 'a9mageforce/map_product/ua_attr';
|
29 |
+
|
30 |
+
const XML_PATH_MAP_quote_enabled = 'a9mageforce/map_quote/enabled';
|
31 |
+
const XML_PATH_MAP_quote_magento_entity = 'a9mageforce/map_quote/magento_entity';
|
32 |
+
const XML_PATH_MAP_quote_salesforce_entity = 'a9mageforce/map_quote/salesforce_entity';
|
33 |
+
const XML_PATH_MAP_quote_ua_attr = 'a9mageforce/map_quote/ua_attr';
|
34 |
+
|
35 |
+
const XML_PATH_MAP_order_enabled = 'a9mageforce/map_order/enabled';
|
36 |
+
const XML_PATH_MAP_order_magento_entity = 'a9mageforce/map_order/magento_entity';
|
37 |
+
const XML_PATH_MAP_order_salesforce_entity = 'a9mageforce/map_order/salesforce_entity';
|
38 |
+
const XML_PATH_MAP_order_ua_attr = 'a9mageforce/map_order/ua_attr';
|
39 |
+
|
40 |
+
public function log($log) {
|
41 |
+
if (Mage::getStoreConfig(self::XML_PATH_DEBUG_FILE_ENABLED))
|
42 |
+
Mage::log($log, NULL, self::VAR_LOG_FILE);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getWSDL($wsdl = 'enterprise') {
|
46 |
+
return Mage::getBaseDir() . '/lib/salesforceAPI/soapclient/wsdl/'
|
47 |
+
. Mage::getStoreConfig(constant('self::XML_PATH_WSDL_'.$wsdl));
|
48 |
+
}
|
49 |
+
|
50 |
+
public function callSF($method, $entity, $id = NULL, $data = NULL) {
|
51 |
+
$return = array();
|
52 |
+
$this->log('OPENING REMOTE CONNECTION: '.strtoupper($entity.' '.$method));
|
53 |
+
try {
|
54 |
+
$sfdc = new SforceEnterpriseClient();
|
55 |
+
$client = $sfdc->createConnection($this->getWSDL());
|
56 |
+
$sfdc->login(Mage::getStoreConfig(self::XML_PATH_LOGIN_USERNAME), Mage::getStoreConfig(self::XML_PATH_LOGIN_PASSWORD). Mage::getStoreConfig(self::XML_PATH_LOGIN_TOKEN));
|
57 |
+
$this->log(strtoupper($entity.' '.$method).': LOGGED. STARTING DATA TRANSFER.');
|
58 |
+
switch($method) {
|
59 |
+
case 'upsert':
|
60 |
+
foreach($data as $entity => $object)
|
61 |
+
$return[] = call_user_func_array(
|
62 |
+
array($sfdc, $method),
|
63 |
+
array($id, array((object)$object), $entity)
|
64 |
+
);
|
65 |
+
break;
|
66 |
+
default:
|
67 |
+
$return[] = call_user_func_array(array($sfdc, $method), $id);
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
$this->log(strtoupper($entity.' '.$method).': SET REQUEST:'.PHP_EOL.$client->__getLastRequest());
|
71 |
+
$this->log(strtoupper($entity.' '.$method).': GET RESPONSE:'.PHP_EOL.$client->__getLastResponse());
|
72 |
+
$sfdc->logout();
|
73 |
+
$this->log(strtoupper($entity.' '.$method).': LOGOUT. DATA TRANSMISSION FINISHED.');
|
74 |
+
} catch (Exception $e) {
|
75 |
+
Mage::logException($e);
|
76 |
+
$this->log(strtoupper($entity.' '.$method).': ERROR:'.PHP_EOL.$e->getMessage());
|
77 |
+
try {
|
78 |
+
$request = strtoupper($entity.' '.$method).': SET REQUEST:'.PHP_EOL.$client->__getLastRequest();
|
79 |
+
$response = strtoupper($entity.' '.$method).': GET RESPONSE:'.PHP_EOL.$client->__getLastResponse();
|
80 |
+
$this->log($request);
|
81 |
+
$this->log($response);
|
82 |
+
if (Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_ENABLED) and Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_TO) and Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_FROM))
|
83 |
+
Mage::getModel('core/email')
|
84 |
+
->setToName(Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_TO))
|
85 |
+
->setToEmail(Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_TO))
|
86 |
+
->setSubject('SalesForce Error: '.strtoupper($entity.' '.$method))
|
87 |
+
->setBody($request.$response)
|
88 |
+
->setFromEmail(Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_FROM))
|
89 |
+
->setFromName(Mage::getStoreConfig(self::XML_PATH_DEBUG_MAIL_FROM))
|
90 |
+
->setType('text')
|
91 |
+
->send();
|
92 |
+
} catch (Exception $e) {}
|
93 |
+
}
|
94 |
+
$this->log('REMOTE CONNECTION CLOSED: '.strtoupper($entity.' '.$method));
|
95 |
+
return (count($return)==1) ? current($return) : $return;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getDataKeysFromMagento($entity) {
|
99 |
+
$attributes = array();
|
100 |
+
$model = Mage::getStoreConfig(constant('self::XML_PATH_MAP_'.$entity.'_magento_entity'));
|
101 |
+
if (in_array($entity, array('product', 'customer')))
|
102 |
+
$attributes = array_keys(Mage::getModel($model)->getAttributes());
|
103 |
+
else if (in_array($entity, array('quote', 'order')))
|
104 |
+
foreach(Mage::getSingleton('core/resource')
|
105 |
+
->getConnection('core_write')
|
106 |
+
->query("SHOW COLUMNS FROM ".Mage::getResourceModel($model)->getTable($model))
|
107 |
+
->fetchAll()
|
108 |
+
as $attr)
|
109 |
+
array_push($attributes, $attr['Field']);
|
110 |
+
return $attributes;
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getDataKeysFromSalesforce($entity) {
|
114 |
+
$attributes = array();
|
115 |
+
$xml = simplexml_load_file($this->getWSDL());
|
116 |
+
$xml->registerXPathNamespace('api', 'http://schemas.xmlsoap.org/wsdl/');
|
117 |
+
$a = $xml->xpath('//api:types');
|
118 |
+
$xml->registerXPathNamespace('api', 'http://www.w3.org/2001/XMLSchema');
|
119 |
+
$xpath = $xml->xpath('//api:complexType[@name="'.Mage::getStoreConfig(constant('self::XML_PATH_MAP_'.$entity.'_salesforce_entity')).'"]');
|
120 |
+
foreach($xpath[0]->complexContent->extension->sequence->element as $element)
|
121 |
+
foreach($element->attributes() as $attr => $value)
|
122 |
+
if ($attr=='name') array_push($attributes, $value->__toString());
|
123 |
+
return $attributes;
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getDataMapFixed($entity, $magento, $salesforce, $attr, $object) {
|
127 |
+
switch($entity) {
|
128 |
+
case 'product':
|
129 |
+
if ($magento=='url_path' and $salesforce=='URL__c')
|
130 |
+
$attr = Mage::app()->getStore()->getUrl().$attr;
|
131 |
+
break;
|
132 |
+
case 'quote':
|
133 |
+
case 'order':
|
134 |
+
if ($salesforce=='Magento_ID__c')
|
135 |
+
$attr = substr($entity, 0, 1).$attr;
|
136 |
+
else if ($magento=='customer_is_guest' and $salesforce=='Type')
|
137 |
+
$attr = $attr ? 'New Customer' : 'Existing Customer - Upgrade';
|
138 |
+
else if ($magento=='entity_id' and $salesforce=='Name')
|
139 |
+
$attr = 'Quote '.$attr;
|
140 |
+
if ($magento=='grand_total' and $salesforce=='Amount')
|
141 |
+
$attr = (float)$attr;
|
142 |
+
else if ($magento=='customer_id' and $salesforce=='AccountId')
|
143 |
+
$attr = Mage::getModel('customer/customer')->load($attr)->getSalesforceId();
|
144 |
+
else if ($magento=='is_active' and $salesforce=='StageName')
|
145 |
+
if ($attr)
|
146 |
+
$attr = 'Proposal/Price Quote';
|
147 |
+
else if($object->getReservedOrderId())
|
148 |
+
$attr = 'Closed Won';
|
149 |
+
else
|
150 |
+
$attr = 'Closed Lost';
|
151 |
+
case 'order':
|
152 |
+
if ($magento=='increment_id' and $salesforce=='Name')
|
153 |
+
$attr = 'Order '.$attr;
|
154 |
+
if ($magento=='total_paid' and $salesforce=='Amount')
|
155 |
+
$attr = (float)$attr;
|
156 |
+
else if ($magento=='state' and $salesforce=='StageName')
|
157 |
+
if ($attr=='complete')
|
158 |
+
$attr = 'Closed Won';
|
159 |
+
else if($attr=='canceled')
|
160 |
+
$attr = 'Closed Lost';
|
161 |
+
else
|
162 |
+
$attr = 'Proposal/Price Quote';
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
return (is_scalar($attr)) ? $attr : (is_null($attr) ? '' : @serialize($attr));
|
166 |
+
}
|
167 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Adminhtml/System/Config/Backend/Xml.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Adminhtml_System_Config_Backend_Xml extends Mage_Adminhtml_Model_System_Config_Backend_File
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* The tail part of directory path for uploading
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
const UPLOAD_DIR = 'salesforceAPI/soapclient/wsdl';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Token for the root part of directory path for uploading
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
const UPLOAD_ROOT = 'lib';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Return path to directory for upload file
|
18 |
+
*
|
19 |
+
* @return string
|
20 |
+
* @throw Mage_Core_Exception
|
21 |
+
*/
|
22 |
+
protected function _getUploadDir()
|
23 |
+
{
|
24 |
+
$uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
|
25 |
+
$uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
|
26 |
+
$uploadDir = $uploadRoot . '/' . $uploadDir;
|
27 |
+
return $uploadDir;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Makes a decision about whether to add info about the scope.
|
32 |
+
*
|
33 |
+
* @return boolean
|
34 |
+
*/
|
35 |
+
protected function _addWhetherScopeInfo()
|
36 |
+
{
|
37 |
+
return true;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Getter for allowed extensions of uploaded files.
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
protected function _getAllowedExtensions()
|
46 |
+
{
|
47 |
+
return array('xml','wsdl');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get real dir path
|
52 |
+
*
|
53 |
+
* @param $token
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
protected function _getUploadRoot($token) {
|
57 |
+
return Mage::getBaseDir($token);
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Observer.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Observer
|
3 |
+
{
|
4 |
+
private function getClassSuffix() {
|
5 |
+
$class_name = get_class($this);
|
6 |
+
return strtolower(substr($class_name, strrpos($class_name,'_')+1));
|
7 |
+
}
|
8 |
+
|
9 |
+
private function config($option) {
|
10 |
+
$return = Mage::getStoreConfig(
|
11 |
+
constant('Alfa9_MageForce_Helper_Data::XML_PATH_MAP_'.$this->getClassSuffix().'_'.$option)
|
12 |
+
);
|
13 |
+
if ($option=='ua_attr') {
|
14 |
+
$return = @unserialize($return);
|
15 |
+
if (!is_array($return)) $return = array();
|
16 |
+
}
|
17 |
+
return $return;
|
18 |
+
}
|
19 |
+
|
20 |
+
private function getIdField() {
|
21 |
+
$idField = NULL;
|
22 |
+
foreach($this->config('ua_attr') as $ua_attr)
|
23 |
+
if ($ua_attr['magento']=='entity_id') {
|
24 |
+
$idField = $ua_attr['salesforce'];
|
25 |
+
break;
|
26 |
+
}
|
27 |
+
return $idField;
|
28 |
+
}
|
29 |
+
|
30 |
+
private function getData($object) {
|
31 |
+
$data = array();
|
32 |
+
foreach($this->config('ua_attr') as $ua_attr)
|
33 |
+
$data[$ua_attr['salesforce']] = Mage::helper('a9mageforce')->getDataMapFixed(
|
34 |
+
$this->getClassSuffix(),
|
35 |
+
$ua_attr['magento'],
|
36 |
+
$ua_attr['salesforce'],
|
37 |
+
$object->getData($ua_attr['magento']),
|
38 |
+
$object
|
39 |
+
);
|
40 |
+
try {
|
41 |
+
foreach($data as $k => $v) if (!$k or is_null($v)) unset($data[$k]);
|
42 |
+
} catch (Exception $e) {
|
43 |
+
Mage::logException($e);
|
44 |
+
}
|
45 |
+
return $data;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function upsert(Varien_Event_Observer $observer) {
|
49 |
+
if (!$this->config('enabled') or Mage::registry('SKIP_NEXT_'.__FUNCTION__))
|
50 |
+
return;
|
51 |
+
try {
|
52 |
+
$entity = $this->getClassSuffix();
|
53 |
+
$object = $observer->getData($entity);
|
54 |
+
$return = Mage::helper('a9mageforce')->callSF(
|
55 |
+
'upsert',
|
56 |
+
$entity,
|
57 |
+
$this->getIdField(),
|
58 |
+
array($this->config('salesforce_entity') => $this->getData($object))
|
59 |
+
);
|
60 |
+
if($return[0]->success and $return[0]->id and $return[0]->id!=$object->getSalesforceId()) {
|
61 |
+
Mage::register('SKIP_NEXT_'.__FUNCTION__, TRUE);
|
62 |
+
$object->setSalesforceId($return[0]->id)->save();
|
63 |
+
Mage::unregister('SKIP_NEXT_'.__FUNCTION__);
|
64 |
+
}
|
65 |
+
} catch (Exception $e) {
|
66 |
+
Mage::logException($e);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
public function delete(Varien_Event_Observer $observer) {
|
71 |
+
if (!$this->config('enabled')) return;
|
72 |
+
try {
|
73 |
+
$entity = $this->getClassSuffix();
|
74 |
+
$object = $observer->getData($entity);
|
75 |
+
Mage::helper('a9mageforce')->callSF(
|
76 |
+
'delete',
|
77 |
+
$entity,
|
78 |
+
array($object->getSalesforceId())
|
79 |
+
);
|
80 |
+
} catch (Exception $e) {
|
81 |
+
Mage::logException($e);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Observer/Customer.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Observer_Customer extends Alfa9_MageForce_Model_Observer
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Observer/Order.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Observer_Order extends Alfa9_MageForce_Model_Observer
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Observer/Product.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Observer_Product extends Alfa9_MageForce_Model_Observer
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Observer/Quote.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Observer_Quote extends Alfa9_MageForce_Model_Observer
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Alfa9/MageForce/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_MageForce_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Alfa9/MageForce/controllers/SyncController.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Alfa9
|
4 |
+
* @package Alfa9_MageForce
|
5 |
+
* @author ctubio (ctubio@alfa9.com)
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
class Alfa9_MageForce_ObjectController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
|
11 |
+
public function syncAction()
|
12 |
+
{
|
13 |
+
if (!isset($_REQUEST['entity'])) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
Mage::helper('a9mageforce')->{'sync'.ucwords($_REQUEST['entity'])}($_REQUEST['entity']);
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Alfa9/MageForce/etc/config.xml
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Core
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_MageForce>
|
12 |
+
<version>1.0.0</version>
|
13 |
+
<depends>
|
14 |
+
<Mage_Core />
|
15 |
+
<Mage_Customer />
|
16 |
+
</depends>
|
17 |
+
</Alfa9_MageForce>
|
18 |
+
</modules>
|
19 |
+
<global>
|
20 |
+
<blocks>
|
21 |
+
<a9mageforce>
|
22 |
+
<class>Alfa9_MageForce_Block</class>
|
23 |
+
</a9mageforce>
|
24 |
+
</blocks>
|
25 |
+
<models>
|
26 |
+
<a9mageforce>
|
27 |
+
<class>Alfa9_MageForce_Model</class>
|
28 |
+
</a9mageforce>
|
29 |
+
</models>
|
30 |
+
<helpers>
|
31 |
+
<a9mageforce>
|
32 |
+
<class>Alfa9_MageForce_Helper</class>
|
33 |
+
</a9mageforce>
|
34 |
+
</helpers>
|
35 |
+
<resources>
|
36 |
+
<a9mageforce_setup>
|
37 |
+
<setup>
|
38 |
+
<module>Alfa9_MageForce</module>
|
39 |
+
<class>Alfa9_MageForce_Model_Resource_Setup</class>
|
40 |
+
</setup>
|
41 |
+
<connection>
|
42 |
+
<use>core_setup</use>
|
43 |
+
</connection>
|
44 |
+
</a9mageforce_setup>
|
45 |
+
</resources>
|
46 |
+
<events>
|
47 |
+
<catalog_product_save_after>
|
48 |
+
<observers>
|
49 |
+
<a9mageforce_catalog_product_save_after>
|
50 |
+
<type>singleton</type>
|
51 |
+
<class>Alfa9_MageForce_Model_Observer_Product</class>
|
52 |
+
<method>upsert</method>
|
53 |
+
</a9mageforce_catalog_product_save_after>
|
54 |
+
</observers>
|
55 |
+
</catalog_product_save_after>
|
56 |
+
<catalog_product_delete_after>
|
57 |
+
<observers>
|
58 |
+
<a9mageforce_catalog_product_delete_after>
|
59 |
+
<type>singleton</type>
|
60 |
+
<class>Alfa9_MageForce_Model_Observer_Product</class>
|
61 |
+
<method>delete</method>
|
62 |
+
</a9mageforce_catalog_product_delete_after>
|
63 |
+
</observers>
|
64 |
+
</catalog_product_delete_after>
|
65 |
+
<customer_save_after>
|
66 |
+
<observers>
|
67 |
+
<a9mageforce_customer_save_after>
|
68 |
+
<type>singleton</type>
|
69 |
+
<class>Alfa9_MageForce_Model_Observer_Customer</class>
|
70 |
+
<method>upsert</method>
|
71 |
+
</a9mageforce_customer_save_after>
|
72 |
+
</observers>
|
73 |
+
</customer_save_after>
|
74 |
+
<customer_delete_after>
|
75 |
+
<observers>
|
76 |
+
<a9mageforce_customer_delete_after>
|
77 |
+
<type>singleton</type>
|
78 |
+
<class>Alfa9_MageForce_Model_Observer_Customer</class>
|
79 |
+
<method>delete</method>
|
80 |
+
</a9mageforce_customer_delete_after>
|
81 |
+
</observers>
|
82 |
+
</customer_delete_after>
|
83 |
+
<sales_quote_save_after>
|
84 |
+
<observers>
|
85 |
+
<a9mageforce_sales_quote_save_after>
|
86 |
+
<type>singleton</type>
|
87 |
+
<class>Alfa9_MageForce_Model_Observer_Quote</class>
|
88 |
+
<method>upsert</method>
|
89 |
+
</a9mageforce_sales_quote_save_after>
|
90 |
+
</observers>
|
91 |
+
</sales_quote_save_after>
|
92 |
+
<sales_quote_delete_after>
|
93 |
+
<observers>
|
94 |
+
<a9mageforce_sales_quote_delete_after>
|
95 |
+
<type>singleton</type>
|
96 |
+
<class>Alfa9_MageForce_Model_Observer_Quote</class>
|
97 |
+
<method>delete</method>
|
98 |
+
</a9mageforce_sales_quote_delete_after>
|
99 |
+
</observers>
|
100 |
+
</sales_quote_delete_after>
|
101 |
+
<sales_order_save_after>
|
102 |
+
<observers>
|
103 |
+
<a9mageforce_sales_order_save_after>
|
104 |
+
<type>singleton</type>
|
105 |
+
<class>Alfa9_MageForce_Model_Observer_Order</class>
|
106 |
+
<method>upsert</method>
|
107 |
+
</a9mageforce_sales_order_save_after>
|
108 |
+
</observers>
|
109 |
+
</sales_order_save_after>
|
110 |
+
<sales_order_delete_after>
|
111 |
+
<observers>
|
112 |
+
<a9mageforce_sales_order_delete_after>
|
113 |
+
<type>singleton</type>
|
114 |
+
<class>Alfa9_MageForce_Model_Observer_Order</class>
|
115 |
+
<method>delete</method>
|
116 |
+
</a9mageforce_sales_order_delete_after>
|
117 |
+
</observers>
|
118 |
+
</sales_order_delete_after>
|
119 |
+
</events>
|
120 |
+
</global>
|
121 |
+
<admin>
|
122 |
+
<routers>
|
123 |
+
<adminhtml>
|
124 |
+
<args>
|
125 |
+
<modules>
|
126 |
+
<a9mageforce before="Mage_Adminhtml">Alfa9_MageForce</a9mageforce>
|
127 |
+
</modules>
|
128 |
+
</args>
|
129 |
+
</adminhtml>
|
130 |
+
</routers>
|
131 |
+
</admin>
|
132 |
+
<adminhtml>
|
133 |
+
<acl>
|
134 |
+
<resources>
|
135 |
+
<admin>
|
136 |
+
<children>
|
137 |
+
<system>
|
138 |
+
<children>
|
139 |
+
<config>
|
140 |
+
<children>
|
141 |
+
<a9mageforce translate="label" module="a9mageforce">
|
142 |
+
<title>SalesForce Connector</title>
|
143 |
+
</a9mageforce>
|
144 |
+
</children>
|
145 |
+
</config>
|
146 |
+
</children>
|
147 |
+
</system>
|
148 |
+
</children>
|
149 |
+
</admin>
|
150 |
+
</resources>
|
151 |
+
</acl>
|
152 |
+
</adminhtml>
|
153 |
+
<default>
|
154 |
+
<a9mageforce>
|
155 |
+
<login>
|
156 |
+
<username>knalbandian.mageforce@alfa9.com</username>
|
157 |
+
<password>alfa9.com123A</password>
|
158 |
+
<token>grSFEmGlNMH4yjI4YaMG1RfqK</token>
|
159 |
+
</login>
|
160 |
+
<wsdl>
|
161 |
+
<enterprise></enterprise>
|
162 |
+
<metadata></metadata>
|
163 |
+
</wsdl>
|
164 |
+
<debug>
|
165 |
+
<file_enabled>0</file_enabled>
|
166 |
+
<mail_enabled>0</mail_enabled>
|
167 |
+
<mail_from>salesforce.error@alfa9.com</mail_from>
|
168 |
+
<mail_to>ctubio@alfa9.com</mail_to>
|
169 |
+
</debug>
|
170 |
+
<map_product>
|
171 |
+
<enabled>0</enabled>
|
172 |
+
<magento_entity>catalog/product</magento_entity>
|
173 |
+
<salesforce_entity>Product2</salesforce_entity>
|
174 |
+
<ua_attr>a:5:{s:18:"_1385871259503_503";a:2:{s:7:"magento";s:3:"sku";s:10:"salesforce";s:11:"ProductCode";}s:18:"_1385871297760_760";a:2:{s:7:"magento";s:8:"url_path";s:10:"salesforce";s:6:"URL__c";}s:17:"_1385871310058_58";a:2:{s:7:"magento";s:4:"name";s:10:"salesforce";s:4:"Name";}s:18:"_1385880073846_846";a:2:{s:7:"magento";s:9:"entity_id";s:10:"salesforce";s:13:"Magento_ID__c";}s:18:"_1386002425783_783";a:2:{s:7:"magento";s:6:"status";s:10:"salesforce";s:8:"IsActive";}}</ua_attr>
|
175 |
+
</map_product>
|
176 |
+
<map_customer>
|
177 |
+
<enabled>0</enabled>
|
178 |
+
<magento_entity>customer/customer</magento_entity>
|
179 |
+
<salesforce_entity>Account</salesforce_entity>
|
180 |
+
<ua_attr>a:2:{s:18:"_1385997596698_698";a:2:{s:7:"magento";s:9:"entity_id";s:10:"salesforce";s:13:"Magento_ID__c";}s:18:"_1385997613930_930";a:2:{s:7:"magento";s:9:"firstname";s:10:"salesforce";s:4:"Name";}}</ua_attr>
|
181 |
+
</map_customer>
|
182 |
+
<map_quote>
|
183 |
+
<enabled>0</enabled>
|
184 |
+
<magento_entity>sales/quote</magento_entity>
|
185 |
+
<salesforce_entity>Opportunity</salesforce_entity>
|
186 |
+
<ua_attr>a:8:{s:17:"_1386003039017_17";a:2:{s:7:"magento";s:9:"entity_id";s:10:"salesforce";s:13:"Magento_ID__c";}s:17:"_1386003057050_50";a:2:{s:7:"magento";s:11:"customer_id";s:10:"salesforce";s:9:"AccountId";}s:18:"_1386003064778_778";a:2:{s:7:"magento";s:11:"grand_total";s:10:"salesforce";s:6:"Amount";}s:18:"_1386003307679_679";a:2:{s:7:"magento";s:9:"entity_id";s:10:"salesforce";s:4:"Name";}s:17:"_1386004007051_51";a:2:{s:7:"magento";s:10:"created_at";s:10:"salesforce";s:9:"CloseDate";}s:18:"_1386004017711_711";a:2:{s:7:"magento";s:9:"is_active";s:10:"salesforce";s:9:"StageName";}s:18:"_1386012308186_186";a:2:{s:7:"magento";s:17:"customer_is_guest";s:10:"salesforce";s:4:"Type";}s:18:"_1386013148563_563";a:2:{s:7:"magento";s:17:"reserved_order_id";s:10:"salesforce";s:14:"OrderNumber__c";}}</ua_attr>
|
187 |
+
</map_quote>
|
188 |
+
<map_order>
|
189 |
+
<enabled>0</enabled>
|
190 |
+
<magento_entity>sales/order</magento_entity>
|
191 |
+
<salesforce_entity>Opportunity</salesforce_entity>
|
192 |
+
<ua_attr>a:8:{s:18:"_1386015113831_831";a:2:{s:7:"magento";s:9:"entity_id";s:10:"salesforce";s:13:"Magento_ID__c";}s:18:"_1386015149821_821";a:2:{s:7:"magento";s:10:"created_at";s:10:"salesforce";s:9:"CloseDate";}s:18:"_1386015150396_396";a:2:{s:7:"magento";s:12:"increment_id";s:10:"salesforce";s:14:"OrderNumber__c";}s:18:"_1386015151104_104";a:2:{s:7:"magento";s:12:"increment_id";s:10:"salesforce";s:4:"Name";}s:18:"_1386015244825_825";a:2:{s:7:"magento";s:17:"customer_is_guest";s:10:"salesforce";s:4:"Type";}s:18:"_1386015275676_676";a:2:{s:7:"magento";s:5:"state";s:10:"salesforce";s:9:"StageName";}s:18:"_1386017731415_415";a:2:{s:7:"magento";s:11:"customer_id";s:10:"salesforce";s:9:"AccountId";}s:18:"_1386017802506_506";a:2:{s:7:"magento";s:10:"total_paid";s:10:"salesforce";s:6:"Amount";}}</ua_attr>
|
193 |
+
</map_order>
|
194 |
+
</a9mageforce>
|
195 |
+
</default>
|
196 |
+
</config>
|
app/code/community/Alfa9/MageForce/etc/system.xml
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<a9mageforce translate="label" module="a9mageforce">
|
5 |
+
<label>SalesForce Connector</label>
|
6 |
+
<tab>a9base</tab>
|
7 |
+
<class>a9connector-section</class>
|
8 |
+
<sort_order>10050</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<login translate="label">
|
14 |
+
<label>SalesForce Authentication</label>
|
15 |
+
<sort_order>10</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<username translate="label">
|
21 |
+
<label>Username</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
</username>
|
28 |
+
<password translate="label">
|
29 |
+
<label>Password</label>
|
30 |
+
<frontend_type>password</frontend_type>
|
31 |
+
<sort_order>20</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</password>
|
36 |
+
<token translate="label">
|
37 |
+
<label>Security Token</label>
|
38 |
+
<frontend_type>password</frontend_type>
|
39 |
+
<sort_order>30</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</token>
|
44 |
+
</fields>
|
45 |
+
</login>
|
46 |
+
<wsdl translate="label">
|
47 |
+
<label>WSDL Files</label>
|
48 |
+
<sort_order>20</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<fields>
|
53 |
+
<enterprise translate="label">
|
54 |
+
<label>SalesForce Enterprise<?php echo 33; ?> WSDL</label>
|
55 |
+
<comment>Allowed file types: XML, WSDL.<br />(Not all browsers support these formats!)</comment>
|
56 |
+
<backend_model>a9mageforce/adminhtml_system_config_backend_xml</backend_model>
|
57 |
+
<frontend_type>file</frontend_type>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</enterprise>
|
63 |
+
<metadata translate="label">
|
64 |
+
<label>SalesForce Metadata WSDL</label>
|
65 |
+
<comment>Allowed file types: XML, WSDL.<br />(Not all browsers support these formats!)</comment>
|
66 |
+
<backend_model>a9mageforce/adminhtml_system_config_backend_xml</backend_model>
|
67 |
+
<frontend_type>file</frontend_type>
|
68 |
+
<sort_order>20</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</metadata>
|
73 |
+
</fields>
|
74 |
+
</wsdl>
|
75 |
+
<debug translate="label">
|
76 |
+
<label>WS Debug Log</label>
|
77 |
+
<sort_order>30</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
<fields>
|
82 |
+
<file_enabled translate="label">
|
83 |
+
<label>Enabled debug log to local file</label>
|
84 |
+
<comment>Output will go to /var/log/salesforce.log file.</comment>
|
85 |
+
<frontend_type>select</frontend_type>
|
86 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
87 |
+
<sort_order>10</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
</file_enabled>
|
92 |
+
<mail_enabled translate="label">
|
93 |
+
<label>Enabled error log to email</label>
|
94 |
+
<frontend_type>select</frontend_type>
|
95 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
96 |
+
<sort_order>20</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
</mail_enabled>
|
101 |
+
<mail_from translate="label">
|
102 |
+
<label>Debug Email FROM</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<validate>validate-email</validate>
|
105 |
+
<depends><mail_enabled>1</mail_enabled></depends>
|
106 |
+
<sort_order>30</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
</mail_from>
|
111 |
+
<mail_to translate="label">
|
112 |
+
<label>Debug Email TO</label>
|
113 |
+
<frontend_type>text</frontend_type>
|
114 |
+
<validate>validate-email</validate>
|
115 |
+
<depends><mail_enabled>1</mail_enabled></depends>
|
116 |
+
<sort_order>40</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
</mail_to>
|
121 |
+
</fields>
|
122 |
+
</debug>
|
123 |
+
<map_product translate="label">
|
124 |
+
<label>Field Mapping - Product</label>
|
125 |
+
<sort_order>40</sort_order>
|
126 |
+
<show_in_default>1</show_in_default>
|
127 |
+
<show_in_website>1</show_in_website>
|
128 |
+
<show_in_store>1</show_in_store>
|
129 |
+
<fields>
|
130 |
+
<enabled translate="label">
|
131 |
+
<label>Synchronization Enabled</label>
|
132 |
+
<comment>Enable synchronization for Products.</comment>
|
133 |
+
<frontend_type>select</frontend_type>
|
134 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
135 |
+
<sort_order>10</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
</enabled>
|
140 |
+
<magento_entity translate="label">
|
141 |
+
<label>Magento Object</label>
|
142 |
+
<comment>Identifier name of the Model in Magento.</comment>
|
143 |
+
<frontend_type>text</frontend_type>
|
144 |
+
<sort_order>20</sort_order>
|
145 |
+
<validate>required-entry</validate>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
</magento_entity>
|
150 |
+
<salesforce_entity translate="label">
|
151 |
+
<label>SalesForce Object</label>
|
152 |
+
<comment>Identifier name of the API entity in SalesForce.</comment>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>30</sort_order>
|
155 |
+
<validate>required-entry validate-data</validate>
|
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 |
+
</salesforce_entity>
|
160 |
+
<ua_attr translate="comment">
|
161 |
+
<label>Map Fields</label>
|
162 |
+
<frontend_model>a9mageforce/map_field_attributes</frontend_model>
|
163 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
164 |
+
<sort_order>40</sort_order>
|
165 |
+
<show_in_default>1</show_in_default>
|
166 |
+
<show_in_website>1</show_in_website>
|
167 |
+
<show_in_store>1</show_in_store>
|
168 |
+
<comment>Match Magento attributes against SalesForce fields.</comment>
|
169 |
+
</ua_attr>
|
170 |
+
</fields>
|
171 |
+
</map_product>
|
172 |
+
<map_customer translate="label">
|
173 |
+
<label>Field Mapping - Customer</label>
|
174 |
+
<sort_order>50</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>1</show_in_store>
|
178 |
+
<fields>
|
179 |
+
<enabled translate="label">
|
180 |
+
<label>Synchronization Enabled</label>
|
181 |
+
<comment>Enable synchronization for Customers.</comment>
|
182 |
+
<frontend_type>select</frontend_type>
|
183 |
+
<source_model>adminhtml/system_config_source_yesno</source_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 |
+
</enabled>
|
189 |
+
<magento_entity translate="label">
|
190 |
+
<label>Magento Object</label>
|
191 |
+
<comment>Identifier name of the Model in Magento.</comment>
|
192 |
+
<frontend_type>text</frontend_type>
|
193 |
+
<sort_order>20</sort_order>
|
194 |
+
<validate>required-entry</validate>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
</magento_entity>
|
199 |
+
<salesforce_entity translate="label">
|
200 |
+
<label>SalesForce Object</label>
|
201 |
+
<comment>Identifier name of the API entity in SalesForce.</comment>
|
202 |
+
<frontend_type>text</frontend_type>
|
203 |
+
<sort_order>30</sort_order>
|
204 |
+
<validate>required-entry validate-data</validate>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>1</show_in_store>
|
208 |
+
</salesforce_entity>
|
209 |
+
<ua_attr translate="comment">
|
210 |
+
<label>Map Fields</label>
|
211 |
+
<frontend_model>a9mageforce/map_field_attributes</frontend_model>
|
212 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
213 |
+
<sort_order>40</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 |
+
<comment>Match Magento attributes against SalesForce fields.</comment>
|
218 |
+
</ua_attr>
|
219 |
+
</fields>
|
220 |
+
</map_customer>
|
221 |
+
<map_quote translate="label">
|
222 |
+
<label>Field Mapping - Quote</label>
|
223 |
+
<sort_order>60</sort_order>
|
224 |
+
<show_in_default>1</show_in_default>
|
225 |
+
<show_in_website>1</show_in_website>
|
226 |
+
<show_in_store>1</show_in_store>
|
227 |
+
<fields>
|
228 |
+
<enabled translate="label">
|
229 |
+
<label>Synchronization Enabled</label>
|
230 |
+
<comment>Enable synchronization for Quotes.</comment>
|
231 |
+
<frontend_type>select</frontend_type>
|
232 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
233 |
+
<sort_order>10</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>1</show_in_website>
|
236 |
+
<show_in_store>1</show_in_store>
|
237 |
+
</enabled>
|
238 |
+
<magento_entity translate="label">
|
239 |
+
<label>Magento Object</label>
|
240 |
+
<comment>Identifier name of the Model in Magento.</comment>
|
241 |
+
<frontend_type>text</frontend_type>
|
242 |
+
<sort_order>20</sort_order>
|
243 |
+
<validate>required-entry</validate>
|
244 |
+
<show_in_default>1</show_in_default>
|
245 |
+
<show_in_website>1</show_in_website>
|
246 |
+
<show_in_store>1</show_in_store>
|
247 |
+
</magento_entity>
|
248 |
+
<salesforce_entity translate="label">
|
249 |
+
<label>SalesForce Object</label>
|
250 |
+
<comment>Identifier name of the API entity in SalesForce.</comment>
|
251 |
+
<frontend_type>text</frontend_type>
|
252 |
+
<sort_order>30</sort_order>
|
253 |
+
<validate>required-entry validate-data</validate>
|
254 |
+
<show_in_default>1</show_in_default>
|
255 |
+
<show_in_website>1</show_in_website>
|
256 |
+
<show_in_store>1</show_in_store>
|
257 |
+
</salesforce_entity>
|
258 |
+
<ua_attr translate="comment">
|
259 |
+
<label>Map Fields</label>
|
260 |
+
<frontend_model>a9mageforce/map_field_attributes</frontend_model>
|
261 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
262 |
+
<sort_order>40</sort_order>
|
263 |
+
<show_in_default>1</show_in_default>
|
264 |
+
<show_in_website>1</show_in_website>
|
265 |
+
<show_in_store>1</show_in_store>
|
266 |
+
<comment>Match Magento attributes against SalesForce fields.</comment>
|
267 |
+
</ua_attr>
|
268 |
+
</fields>
|
269 |
+
</map_quote>
|
270 |
+
<map_order translate="label">
|
271 |
+
<label>Field Mapping - Order</label>
|
272 |
+
<sort_order>70</sort_order>
|
273 |
+
<show_in_default>1</show_in_default>
|
274 |
+
<show_in_website>1</show_in_website>
|
275 |
+
<show_in_store>1</show_in_store>
|
276 |
+
<fields>
|
277 |
+
<enabled translate="label">
|
278 |
+
<label>Synchronization Enabled</label>
|
279 |
+
<comment>Enable synchronization for Orders.</comment>
|
280 |
+
<frontend_type>select</frontend_type>
|
281 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
282 |
+
<sort_order>10</sort_order>
|
283 |
+
<show_in_default>1</show_in_default>
|
284 |
+
<show_in_website>1</show_in_website>
|
285 |
+
<show_in_store>1</show_in_store>
|
286 |
+
</enabled>
|
287 |
+
<magento_entity translate="label">
|
288 |
+
<label>Magento Object</label>
|
289 |
+
<comment>Identifier name of the Model in Magento.</comment>
|
290 |
+
<frontend_type>text</frontend_type>
|
291 |
+
<sort_order>20</sort_order>
|
292 |
+
<validate>required-entry</validate>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>1</show_in_website>
|
295 |
+
<show_in_store>1</show_in_store>
|
296 |
+
</magento_entity>
|
297 |
+
<salesforce_entity translate="label">
|
298 |
+
<label>SalesForce Object</label>
|
299 |
+
<comment>Identifier name of the API entity in SalesForce.</comment>
|
300 |
+
<frontend_type>text</frontend_type>
|
301 |
+
<sort_order>30</sort_order>
|
302 |
+
<validate>required-entry validate-data</validate>
|
303 |
+
<show_in_default>1</show_in_default>
|
304 |
+
<show_in_website>1</show_in_website>
|
305 |
+
<show_in_store>1</show_in_store>
|
306 |
+
</salesforce_entity>
|
307 |
+
<ua_attr translate="comment">
|
308 |
+
<label>Map Fields</label>
|
309 |
+
<frontend_model>a9mageforce/map_field_attributes</frontend_model>
|
310 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
311 |
+
<sort_order>40</sort_order>
|
312 |
+
<show_in_default>1</show_in_default>
|
313 |
+
<show_in_website>1</show_in_website>
|
314 |
+
<show_in_store>1</show_in_store>
|
315 |
+
<comment>Match Magento attributes against SalesForce fields.</comment>
|
316 |
+
</ua_attr>
|
317 |
+
</fields>
|
318 |
+
</map_order>
|
319 |
+
<help translate="label">
|
320 |
+
<label>Help Document</label>
|
321 |
+
<frontend_model>a9mageforce/map_field_help</frontend_model>
|
322 |
+
<sort_order>80</sort_order>
|
323 |
+
<show_in_default>1</show_in_default>
|
324 |
+
<show_in_website>1</show_in_website>
|
325 |
+
<show_in_store>1</show_in_store>
|
326 |
+
</help>
|
327 |
+
</groups>
|
328 |
+
</a9mageforce>
|
329 |
+
</sections>
|
330 |
+
</config>
|
app/code/community/Alfa9/MageForce/sql/a9mageforce_setup/install-0.0.1.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
$installer->addAttribute('catalog_product', 'salesforce_id', array(
|
7 |
+
'group' => 'General',
|
8 |
+
'label' => 'SalesForce ID',
|
9 |
+
'note' => 'Leave empty if you are creating a new product.',
|
10 |
+
'type' => 'varchar',
|
11 |
+
'input' => 'text',
|
12 |
+
'frontend_class' => '',
|
13 |
+
'source' => '',
|
14 |
+
'backend' => '',
|
15 |
+
'frontend' => '',
|
16 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
17 |
+
'required' => false,
|
18 |
+
'visible_on_front' => false,
|
19 |
+
'apply_to' => 'simple',
|
20 |
+
'is_configurable' => false,
|
21 |
+
'used_in_product_listing' => false,
|
22 |
+
'sort_order' => 4,
|
23 |
+
));
|
24 |
+
|
25 |
+
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
|
26 |
+
$setup->addAttribute('customer', 'salesforce_id', array(
|
27 |
+
'type' => 'varchar',
|
28 |
+
'input' => 'text',
|
29 |
+
'label' => 'SalesForce ID',
|
30 |
+
'note' => 'Leave empty if you are creating a new customer.',
|
31 |
+
'global' => 1,
|
32 |
+
'visible' => 1,
|
33 |
+
'required' => 0,
|
34 |
+
'user_defined' => 0,
|
35 |
+
'default' => '',
|
36 |
+
'visible_on_front' => 0,
|
37 |
+
));
|
38 |
+
if (version_compare(Mage::getVersion(), '1.6.0', '<=')) {
|
39 |
+
$customer = Mage::getModel('customer/customer');
|
40 |
+
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
|
41 |
+
$setup->addAttributeToSet('customer', $attrSetId, 'General', 'salesforce_id');
|
42 |
+
}
|
43 |
+
if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
|
44 |
+
Mage::getSingleton('eav/config')
|
45 |
+
->getAttribute('customer', 'salesforce_id')
|
46 |
+
->setData('used_in_forms', array(
|
47 |
+
'adminhtml_customer'
|
48 |
+
))
|
49 |
+
->save();
|
50 |
+
}
|
51 |
+
|
52 |
+
$setup = new Mage_Sales_Model_Resource_Setup('core_setup');
|
53 |
+
$entities = array(
|
54 |
+
'quote',
|
55 |
+
#'quote_address',
|
56 |
+
#'quote_item',
|
57 |
+
#'quote_address_item',
|
58 |
+
'order',
|
59 |
+
#'order_item'
|
60 |
+
);
|
61 |
+
$options = array(
|
62 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
63 |
+
'visible' => true,
|
64 |
+
'required' => false
|
65 |
+
);
|
66 |
+
foreach ($entities as $entity) {
|
67 |
+
$setup->addAttribute($entity, 'salesforce_id', $options);
|
68 |
+
}
|
69 |
+
$installer->endSetup();
|
app/code/local/Alfa9/Adminhtml/etc/config.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Alfa9_Adminhtml>
|
5 |
+
<version>0.0.1</version>
|
6 |
+
</Alfa9_Adminhtml>
|
7 |
+
</modules>
|
8 |
+
<stores>
|
9 |
+
<admin>
|
10 |
+
<design>
|
11 |
+
<package>
|
12 |
+
<name>default</name>
|
13 |
+
</package>
|
14 |
+
<theme>
|
15 |
+
<default>alfa9</default>
|
16 |
+
</theme>
|
17 |
+
</design>
|
18 |
+
</admin>
|
19 |
+
</stores>
|
20 |
+
</config>
|
app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_Base_Block_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
private $currentSection = NULL;
|
5 |
+
|
6 |
+
private $modules = NULL;
|
7 |
+
|
8 |
+
protected $modules_rss = array();
|
9 |
+
|
10 |
+
protected function getCurrentSection()
|
11 |
+
{
|
12 |
+
if (is_null($this->currentSection)) {
|
13 |
+
$this->currentSection = $this->getAction()->getRequest()->getParam('section', FALSE);
|
14 |
+
}
|
15 |
+
return $this->currentSection;
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _toHtml()
|
19 |
+
{
|
20 |
+
return (in_array($this->getCurrentSection(), array('a9extensions', 'a9store')))
|
21 |
+
? parent::_toHtml()
|
22 |
+
: NULL;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function getModules()
|
26 |
+
{
|
27 |
+
if (is_null($this->modules)) {
|
28 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
29 |
+
$this->modules = array();
|
30 |
+
foreach ($modules as $moduleId => $module) {
|
31 |
+
if (strstr($moduleId, 'Alfa9_')===FALSE) continue;
|
32 |
+
$rssData = $this->getModuleRss($moduleId);
|
33 |
+
$this->modules[] = new Varien_Object(array(
|
34 |
+
'module_id' => $moduleId,
|
35 |
+
'name' => $rssData->getName()?$rssData->getName():($module->name?$module->name:$moduleId),
|
36 |
+
'active' => !Mage::getStoreConfig('advanced/modules_disable_output/'.$moduleId),
|
37 |
+
'version' => $module->version,
|
38 |
+
'last_version' => $rssData->getLastVersion(),
|
39 |
+
'url' => $rssData->getUrl(),
|
40 |
+
'description' => $rssData->getDescription(),
|
41 |
+
));
|
42 |
+
}
|
43 |
+
usort($this->modules, create_function('$a,$b','$a=$a["name"];$b=$b["name"];return strcmp($a,$b);'));
|
44 |
+
}
|
45 |
+
return $this->modules;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param $moduleId
|
50 |
+
* @return bool|Varien_Object
|
51 |
+
*/
|
52 |
+
private function getModuleRss($moduleId)
|
53 |
+
{
|
54 |
+
if (!count($this->modules_rss)) {
|
55 |
+
if ($modules_rss = Mage::app()->loadCache('a9base_modules_rss')) {
|
56 |
+
$this->modules_rss = @unserialize($modules_rss);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
$module_rss = array();
|
60 |
+
if (array_key_exists($moduleId, $this->modules_rss)) {
|
61 |
+
$module_rss = @$this->modules_rss[$moduleId];
|
62 |
+
}
|
63 |
+
return new Varien_Object($module_rss);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Fetch store data and return as Varien Object
|
68 |
+
* @return Varien_Object
|
69 |
+
*/
|
70 |
+
protected function getExtensions()
|
71 |
+
{
|
72 |
+
if (!(Mage::app()->loadCache('alfa9_modules_html')) ||
|
73 |
+
(time() - Mage::app()->loadCache('alfa9_modules_html_timestamp')) > Mage::getStoreConfig(Alfa9_Base_Helper_Data::XML_PATH_RSS_DELAY)
|
74 |
+
) {
|
75 |
+
$client = new Zend_Http_Client(Alfa9_Base_Helper_Data::HTML_MODULES_URL);
|
76 |
+
$response = $client->request();
|
77 |
+
if ($response->getStatus()==200) {
|
78 |
+
$extensions = new Zend_Dom_Query($response->getBody());
|
79 |
+
Mage::app()->saveCache(time(), 'alfa9_modules_html_timestamp');
|
80 |
+
} else {
|
81 |
+
$extensions = NULL;
|
82 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Our online shop is under maintenance right now. We are sorry for the inconveniences, but we will return back to bussines shortly.'));
|
83 |
+
}
|
84 |
+
Mage::app()->saveCache(serialize($extensions), 'alfa9_modules_html');
|
85 |
+
}
|
86 |
+
return @unserialize(Mage::app()->loadCache('alfa9_modules_html'));
|
87 |
+
}
|
88 |
+
}
|
app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset/A9base/Extensions.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_Base_Block_System_Config_Form_Fieldset_A9base_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
3 |
+
{
|
4 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
return '<div id="' . $element->getId() . '"></div>';
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Alfa9/Base/Block/System/Config/Form/Fieldset/A9base/Installed.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_Base_Block_System_Config_Form_Fieldset_A9base_Installed extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
3 |
+
{
|
4 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
return $this->_getHeaderHtml($element) . $this->_getFooterHtml($element);
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Alfa9/Base/Helper/Data.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_Base_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const XML_PATH_RSS_DELAY = 'a9base/rss_modules/delay';
|
5 |
+
|
6 |
+
const LINK_ALFA_WEBSITE = 'http://www.alfa9.com';
|
7 |
+
const LINK_ALFA_EXTENSION_STORE = 'http://www.plazamagento.com';
|
8 |
+
const LINK_ALFA_SUPPORT = 'mailto:info@alfa9.com';
|
9 |
+
|
10 |
+
const RSS_MODULES_URL = 'http://www.plazamagento.com/en/rss/catalog/modules';
|
11 |
+
const HTML_MODULES_URL = 'http://www.plazamagento.com/en/extensions.html';
|
12 |
+
|
13 |
+
}
|
app/code/local/Alfa9/Base/Model/Rss/Modules.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_Base_Model_Rss_Modules extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function saveRss()
|
5 |
+
{
|
6 |
+
try {
|
7 |
+
$rss = 'a9base_modules_rss';
|
8 |
+
if (!(Mage::app()->loadCache($rss)) ||
|
9 |
+
(time() - Mage::app()->loadCache($rss.'_timestamp')) > Mage::getStoreConfig(Alfa9_Base_Helper_Data::XML_PATH_RSS_DELAY)
|
10 |
+
) {
|
11 |
+
$channel = new Zend_Feed_Rss(Alfa9_Base_Helper_Data::RSS_MODULES_URL);
|
12 |
+
$modules = array();
|
13 |
+
foreach($channel as $item) {
|
14 |
+
$modules[$item->module_id()] = array(
|
15 |
+
'name' => $item->title(),
|
16 |
+
'description' => $item->description(),
|
17 |
+
'last_version' => $item->module_version(),
|
18 |
+
'url' => $item->link()
|
19 |
+
);
|
20 |
+
}
|
21 |
+
Mage::app()->saveCache(serialize($modules), $rss);
|
22 |
+
Mage::app()->saveCache(time(), $rss.'_timestamp');
|
23 |
+
}
|
24 |
+
} catch (Exception $e) {}
|
25 |
+
}
|
26 |
+
}
|
app/code/local/Alfa9/Base/etc/config.xml
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Base
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_Base>
|
12 |
+
<version>0.0.2</version>
|
13 |
+
<name>Alfa9 Support</name>
|
14 |
+
<depends>
|
15 |
+
<Mage_Core />
|
16 |
+
</depends>
|
17 |
+
</Alfa9_Base>
|
18 |
+
</modules>
|
19 |
+
<global>
|
20 |
+
<blocks>
|
21 |
+
<a9base>
|
22 |
+
<class>Alfa9_Base_Block</class>
|
23 |
+
</a9base>
|
24 |
+
</blocks>
|
25 |
+
<helpers>
|
26 |
+
<a9base>
|
27 |
+
<class>Alfa9_Base_Helper</class>
|
28 |
+
</a9base>
|
29 |
+
</helpers>
|
30 |
+
<models>
|
31 |
+
<a9base>
|
32 |
+
<class>Alfa9_Base_Model</class>
|
33 |
+
</a9base>
|
34 |
+
</models>
|
35 |
+
</global>
|
36 |
+
<stores>
|
37 |
+
<admin>
|
38 |
+
<design>
|
39 |
+
<package>
|
40 |
+
<name>default</name>
|
41 |
+
</package>
|
42 |
+
<theme>
|
43 |
+
<default>alfa9</default>
|
44 |
+
</theme>
|
45 |
+
</design>
|
46 |
+
</admin>
|
47 |
+
</stores>
|
48 |
+
<adminhtml>
|
49 |
+
<layout>
|
50 |
+
<updates>
|
51 |
+
<a9base module="a9base">
|
52 |
+
<file>a9base.xml</file>
|
53 |
+
</a9base>
|
54 |
+
</updates>
|
55 |
+
</layout>
|
56 |
+
<acl>
|
57 |
+
<resources>
|
58 |
+
<all>
|
59 |
+
<title>Allow Everything</title>
|
60 |
+
</all>
|
61 |
+
<admin>
|
62 |
+
<children>
|
63 |
+
<system>
|
64 |
+
<children>
|
65 |
+
<config>
|
66 |
+
<children>
|
67 |
+
<a9extensions>
|
68 |
+
<title>Alfa9 Extensions Support</title>
|
69 |
+
</a9extensions>
|
70 |
+
<a9store>
|
71 |
+
<title>Alfa9 Extensions Store</title>
|
72 |
+
</a9store>
|
73 |
+
</children>
|
74 |
+
</config>
|
75 |
+
</children>
|
76 |
+
</system>
|
77 |
+
</children>
|
78 |
+
</admin>
|
79 |
+
</resources>
|
80 |
+
</acl>
|
81 |
+
<events>
|
82 |
+
<controller_action_predispatch>
|
83 |
+
<observers>
|
84 |
+
<a9base_modules_rss_check>
|
85 |
+
<type>singleton</type>
|
86 |
+
<class>a9base/rss_modules</class>
|
87 |
+
<method>saveRss</method>
|
88 |
+
</a9base_modules_rss_check>
|
89 |
+
</observers>
|
90 |
+
</controller_action_predispatch>
|
91 |
+
</events>
|
92 |
+
</adminhtml>
|
93 |
+
<default>
|
94 |
+
<a9base>
|
95 |
+
<rss_modules>
|
96 |
+
<delay>86400</delay>
|
97 |
+
</rss_modules>
|
98 |
+
</a9base>
|
99 |
+
</default>
|
100 |
+
</config>
|
app/code/local/Alfa9/Base/etc/system.xml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Base
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<tabs>
|
11 |
+
<a9base translate="label" module="a9base">
|
12 |
+
<label>Alfa9 Servicios Web SL</label>
|
13 |
+
<sort_order>101</sort_order>
|
14 |
+
</a9base>
|
15 |
+
</tabs>
|
16 |
+
<sections>
|
17 |
+
<a9extensions translate="label" module="a9base">
|
18 |
+
<label>Alfa9 Extensions Support</label>
|
19 |
+
<tab>a9base</tab>
|
20 |
+
<class>a9extensions-section</class>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>100</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<groups>
|
27 |
+
<installed translate="label">
|
28 |
+
<label>Installed Alfa9 Extensions</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<frontend_model>a9base/system_config_form_fieldset_a9base_installed</frontend_model>
|
31 |
+
<sort_order>100</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</installed>
|
36 |
+
<news>
|
37 |
+
<label>Alfa9 Extensions Notifications</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>200</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<fields>
|
44 |
+
<!--enabled translate="label">
|
45 |
+
<label>Enable </label>
|
46 |
+
<comment>Will check for aheadWorks extensions updates</comment>
|
47 |
+
<frontend_type>select</frontend_type>
|
48 |
+
<sort_order>90</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
53 |
+
</enabled>
|
54 |
+
<interests translate="label">
|
55 |
+
<label>I'd like to be informed by aheadWorks about:</label>
|
56 |
+
<comment></comment>
|
57 |
+
<frontend_type>multiselect</frontend_type>
|
58 |
+
<sort_order>100</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
<can_be_empty>1</can_be_empty>
|
63 |
+
<source_model>awall/source_updates_type</source_model>
|
64 |
+
</interests-->
|
65 |
+
</fields>
|
66 |
+
</news>
|
67 |
+
</groups>
|
68 |
+
</a9extensions>
|
69 |
+
<a9store>
|
70 |
+
<label>Alfa9 Extensions Store</label>
|
71 |
+
<tab>a9base</tab>
|
72 |
+
<class>a9store-section</class>
|
73 |
+
<frontend_type>text</frontend_type>
|
74 |
+
<sort_order>9999</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>1</show_in_store>
|
78 |
+
<groups>
|
79 |
+
<extensions translate="label">
|
80 |
+
<label>Alfa9 Extensions Store</label>
|
81 |
+
<frontend_type>text</frontend_type>
|
82 |
+
<frontend_model>a9base/system_config_form_fieldset_a9base_extensions</frontend_model>
|
83 |
+
<sort_order>2</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</extensions>
|
88 |
+
</groups>
|
89 |
+
</a9store>
|
90 |
+
</sections>
|
91 |
+
</config>
|
app/code/local/Alfa9/Checkout/Model/Type/Onepage.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Alfa9_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
|
4 |
+
{
|
5 |
+
}
|
app/code/local/Alfa9/Checkout/etc/config.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Checkout
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <xsanz@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_Checkout>
|
12 |
+
<version>0.0.1</version>
|
13 |
+
</Alfa9_Checkout>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<models>
|
17 |
+
<checkout>
|
18 |
+
<rewrite>
|
19 |
+
<type_onepage>Alfa9_Checkout_Model_Type_Onepage</type_onepage>
|
20 |
+
</rewrite>
|
21 |
+
</checkout>
|
22 |
+
</models>
|
23 |
+
</global>
|
24 |
+
</config>
|
app/code/local/Alfa9/VentasEnGrupo/Block/Adminhtml/Catalog/Product/Grid.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Block_Adminhtml_Catalog_Product_Grid extends TBT_Enhancedgrid_Block_Catalog_Product_Grid
|
3 |
+
{
|
4 |
+
|
5 |
+
protected function _prepareColumns() {
|
6 |
+
// Loads all the column options for each applicable column.
|
7 |
+
foreach ($this->columnSettings as $col => $true) {
|
8 |
+
$this->loadColumnOptions( $col );
|
9 |
+
}
|
10 |
+
|
11 |
+
$store = $this->_getStore();
|
12 |
+
if ( $this->colIsVisible( 'id' ) ) {
|
13 |
+
$this->addColumn( 'id',
|
14 |
+
array(
|
15 |
+
'header' => Mage::helper( 'catalog' )->__( 'ID' ),
|
16 |
+
'width' => '50px',
|
17 |
+
'type' => 'number',
|
18 |
+
'index' => 'entity_id'
|
19 |
+
) );
|
20 |
+
}
|
21 |
+
|
22 |
+
$imgWidth = Mage::getStoreConfig( 'enhancedgrid/images/width' ) + "px";
|
23 |
+
|
24 |
+
if ( $this->colIsVisible( 'thumbnail' ) ) {
|
25 |
+
$this->addColumn( 'thumbnail',
|
26 |
+
array(
|
27 |
+
'header' => Mage::helper( 'catalog' )->__( 'Thumbnail' ),
|
28 |
+
'type' => 'image',
|
29 |
+
'width' => $imgWidth,
|
30 |
+
'index' => 'thumbnail'
|
31 |
+
) );
|
32 |
+
}
|
33 |
+
if ( $this->colIsVisible( 'small_image' ) ) {
|
34 |
+
$this->addColumn( 'small_image',
|
35 |
+
array(
|
36 |
+
'header' => Mage::helper( 'catalog' )->__( 'Small Img' ),
|
37 |
+
'type' => 'image',
|
38 |
+
'width' => $imgWidth,
|
39 |
+
'index' => 'small_image'
|
40 |
+
) );
|
41 |
+
}
|
42 |
+
if ( $this->colIsVisible( 'image' ) ) {
|
43 |
+
$this->addColumn( 'image',
|
44 |
+
array(
|
45 |
+
'header' => Mage::helper( 'catalog' )->__( 'Image' ),
|
46 |
+
'type' => 'image',
|
47 |
+
'width' => $imgWidth,
|
48 |
+
'index' => 'image'
|
49 |
+
) );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $this->colIsVisible( 'name' ) ) {
|
53 |
+
$this->addColumn( 'name',
|
54 |
+
array(
|
55 |
+
'header' => Mage::helper( 'catalog' )->__( 'Name' ),
|
56 |
+
'index' => 'name'
|
57 |
+
)// 'width' => '150px'
|
58 |
+
);
|
59 |
+
}
|
60 |
+
if ( $this->colIsVisible( 'name' ) ) {
|
61 |
+
if ( $store->getId() ) {
|
62 |
+
$this->addColumn( 'custom_name',
|
63 |
+
array(
|
64 |
+
'header' => Mage::helper( 'catalog' )->__( 'Name In %s', $store->getName() ),
|
65 |
+
'index' => 'custom_name',
|
66 |
+
'width' => '150px'
|
67 |
+
) );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( $this->colIsVisible( 'type_id' ) ) {
|
72 |
+
$this->addColumn( 'type',
|
73 |
+
array(
|
74 |
+
'header' => Mage::helper( 'catalog' )->__( 'Type' ),
|
75 |
+
'width' => '60px',
|
76 |
+
'index' => 'type_id',
|
77 |
+
'type' => 'options',
|
78 |
+
'options' => Mage::getSingleton( 'catalog/product_type' )->getOptionArray()
|
79 |
+
) );
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( $this->colIsVisible( 'attribute_set_id' ) ) {
|
83 |
+
$sets = Mage::getResourceModel( 'eav/entity_attribute_set_collection' )->setEntityTypeFilter(
|
84 |
+
Mage::getModel( 'catalog/product' )->getResource()
|
85 |
+
->getTypeId() )
|
86 |
+
->load()
|
87 |
+
->toOptionHash();
|
88 |
+
|
89 |
+
$this->addColumn( 'set_name',
|
90 |
+
array(
|
91 |
+
'header' => Mage::helper( 'catalog' )->__( 'Attrib. Set Name' ),
|
92 |
+
'width' => '100px',
|
93 |
+
'index' => 'attribute_set_id',
|
94 |
+
'type' => 'options',
|
95 |
+
'options' => $sets
|
96 |
+
) );
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( $this->colIsVisible( 'sku' ) ) {
|
100 |
+
$this->addColumn( 'sku',
|
101 |
+
array(
|
102 |
+
'header' => Mage::helper( 'catalog' )->__( 'SKU' ),
|
103 |
+
'width' => '80px',
|
104 |
+
'index' => 'sku'
|
105 |
+
) );
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( $this->colIsVisible( 'price' ) ) {
|
109 |
+
$this->addColumn( 'price',
|
110 |
+
array(
|
111 |
+
'header' => Mage::helper( 'catalog' )->__( 'Price' ),
|
112 |
+
'type' => 'price',
|
113 |
+
'currency_code' => $store->getBaseCurrency()
|
114 |
+
->getCode(),
|
115 |
+
'index' => 'price'
|
116 |
+
) );
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( $this->colIsVisible( 'qty' ) ) {
|
120 |
+
$this->addColumn( 'qty',
|
121 |
+
array(
|
122 |
+
'header' => Mage::helper( 'catalog' )->__( 'Qty' ),
|
123 |
+
'width' => '100px',
|
124 |
+
'type' => 'number',
|
125 |
+
'index' => 'qty'
|
126 |
+
) );
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $this->colIsVisible( 'visibility' ) ) {
|
130 |
+
$this->addColumn( 'visibility',
|
131 |
+
array(
|
132 |
+
'header' => Mage::helper( 'catalog' )->__( 'Visibility' ),
|
133 |
+
'width' => '70px',
|
134 |
+
'index' => 'visibility',
|
135 |
+
'type' => 'options',
|
136 |
+
'options' => Mage::getModel( 'catalog/product_visibility' )->getOptionArray()
|
137 |
+
) );
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( $this->colIsVisible( 'status' ) ) {
|
141 |
+
$this->addColumn( 'status',
|
142 |
+
array(
|
143 |
+
'header' => Mage::helper( 'catalog' )->__( 'Status' ),
|
144 |
+
'width' => '70px',
|
145 |
+
'index' => 'status',
|
146 |
+
'type' => 'options',
|
147 |
+
'options' => Mage::getSingleton( 'catalog/product_status' )->getOptionArray()
|
148 |
+
) );
|
149 |
+
}
|
150 |
+
|
151 |
+
if ( $this->colIsVisible( 'websites' ) ) {
|
152 |
+
if ( ! Mage::app()->isSingleStoreMode() ) {
|
153 |
+
$this->addColumn( 'websites',
|
154 |
+
array(
|
155 |
+
'header' => Mage::helper( 'catalog' )->__( 'Websites' ),
|
156 |
+
'width' => '100px',
|
157 |
+
'sortable' => false,
|
158 |
+
'index' => 'websites',
|
159 |
+
'type' => 'options',
|
160 |
+
'options' => Mage::getModel( 'core/website' )->getCollection()
|
161 |
+
->toOptionHash()
|
162 |
+
) );
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( $this->colIsVisible( 'categories' ) ) {
|
167 |
+
$this->addColumn( 'categories',
|
168 |
+
array(
|
169 |
+
'header' => Mage::helper( 'catalog' )->__( 'Categories' ),
|
170 |
+
'width' => '100px',
|
171 |
+
'sortable' => true,
|
172 |
+
'index' => 'categories',
|
173 |
+
'sort_index' => 'category',
|
174 |
+
'filter_index' => 'category'
|
175 |
+
) );
|
176 |
+
}
|
177 |
+
|
178 |
+
$this->_addVariableColumns();
|
179 |
+
|
180 |
+
if (Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId()<5 and $this->getCollection())
|
181 |
+
$this->addColumn( 'action',
|
182 |
+
array(
|
183 |
+
'header' => Mage::helper( 'catalog' )->__( 'Action' ),
|
184 |
+
'width' => '50px',
|
185 |
+
'type' => 'action',
|
186 |
+
'getter' => 'getId',
|
187 |
+
'actions' => array(
|
188 |
+
array(
|
189 |
+
'caption' => Mage::helper( 'catalog' )->__( 'Edit' ),
|
190 |
+
'id' => "editlink",
|
191 |
+
'url' => array(
|
192 |
+
'base' => 'adminhtml/*/edit',
|
193 |
+
'params' => array(
|
194 |
+
'store' => $this->getRequest()
|
195 |
+
->getParam( 'store' )
|
196 |
+
)
|
197 |
+
),
|
198 |
+
'field' => 'id'
|
199 |
+
)
|
200 |
+
),
|
201 |
+
'filter' => false,
|
202 |
+
'sortable' => false,
|
203 |
+
'index' => 'stores'
|
204 |
+
) );
|
205 |
+
|
206 |
+
$this->addRssList( 'rss/catalog/notifystock', Mage::helper( 'catalog' )->__( 'Notify Low Stock RSS' ) );
|
207 |
+
|
208 |
+
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
|
209 |
+
}
|
210 |
+
|
211 |
+
public function getRowUrl($row) {
|
212 |
+
//@nelkaake -m 16/11/10: Changed to use _getStore function
|
213 |
+
return (Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId()<5)?$this->getUrl( 'adminhtml/catalog_product/edit',
|
214 |
+
array(
|
215 |
+
'store' => $this->_getStore(),
|
216 |
+
'id' => $row->getId()
|
217 |
+
) ):NULL;
|
218 |
+
}
|
219 |
+
|
220 |
+
|
221 |
+
protected function _prepareMassaction()
|
222 |
+
{
|
223 |
+
if (Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId()<5) {
|
224 |
+
return parent::_prepareMassaction();
|
225 |
+
}
|
226 |
+
|
227 |
+
$this->setMassactionIdField('entity_id');
|
228 |
+
$this->getMassactionBlock()->setFormFieldName('product');
|
229 |
+
|
230 |
+
$visibility = Mage::getSingleton('catalog/product_visibility')->getOptionArray();
|
231 |
+
$visibility = array_merge(array_slice($visibility,0,1),array_slice($visibility,-1));
|
232 |
+
array_unshift($visibility, array('label'=>'', 'value'=>''));
|
233 |
+
$this->getMassactionBlock()->addItem('visibility', array(
|
234 |
+
'label'=> Mage::helper('catalog')->__('Change visibility'),
|
235 |
+
'url' => $this->getUrl('*/*/massVisibility', array('_current'=>true)),
|
236 |
+
'additional' => array(
|
237 |
+
'visibility' => array(
|
238 |
+
'name' => 'visibility',
|
239 |
+
'type' => 'select',
|
240 |
+
'class' => 'required-entry',
|
241 |
+
'label' => Mage::helper('catalog')->__('Visibility'),
|
242 |
+
'values' => $visibility
|
243 |
+
)
|
244 |
+
)
|
245 |
+
));
|
246 |
+
|
247 |
+
return $this;
|
248 |
+
}
|
249 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Block/Adminhtml/System/Config/Date.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT);
|
7 |
+
$element->setImage($this->getSkinUrl('images/grid-cal.gif'));
|
8 |
+
return parent::render($element);
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Block/Grupo/Selector.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Order Observer Model
|
4 |
+
*
|
5 |
+
* @category Model
|
6 |
+
* @package Alfa9
|
7 |
+
* @author ctubio <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Alfa9_VentasEnGrupo_Block_Grupo_Selector extends Mage_Core_Block_Template {
|
11 |
+
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
parent::__construct();
|
15 |
+
|
16 |
+
if (Mage::helper('a9veg')->isMainStore())
|
17 |
+
$this->setTemplate('alfa9/grupo_consumo/selector.phtml');
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getStores() {
|
22 |
+
return Mage::app()->getStores();
|
23 |
+
}
|
24 |
+
}
|
25 |
+
?>
|
app/code/local/Alfa9/VentasEnGrupo/Block/Productor/Totals.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Order Observer Model
|
4 |
+
*
|
5 |
+
* @category Model
|
6 |
+
* @package Alfa9
|
7 |
+
* @author ctubio <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Alfa9_VentasEnGrupo_Block_Productor_Totals extends Mage_Core_Block_Template
|
11 |
+
{
|
12 |
+
protected $totals = array();
|
13 |
+
|
14 |
+
public function getTotals($customerId = NULL) {
|
15 |
+
$customerId = $this->fixCustomerId($customerId);
|
16 |
+
if (!$customerId) {
|
17 |
+
return array();
|
18 |
+
}
|
19 |
+
if (!isset($this->totals[$customerId])) {
|
20 |
+
$this->totals[$customerId] = Mage::helper('a9veg')->collectPartnerSales($customerId);
|
21 |
+
}
|
22 |
+
return $this->totals[$customerId];
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getTotal($customerId = NULL) {
|
26 |
+
$customerId = $this->fixCustomerId($customerId);
|
27 |
+
if (!$customerId) {
|
28 |
+
return 0;
|
29 |
+
}
|
30 |
+
$totals = $this->getTotals($customerId);
|
31 |
+
return $totals['total'];
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getMinimumOrderType($customerId = NULL) {
|
35 |
+
$customerId = $this->fixCustomerId($customerId);
|
36 |
+
if (!$customerId) {
|
37 |
+
return 0;
|
38 |
+
}
|
39 |
+
|
40 |
+
return Mage::getSingleton('core/resource')
|
41 |
+
->getConnection('core_write')
|
42 |
+
->query("select minimumordertype from ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_saleperpartner where mageuserid = $customerId")
|
43 |
+
->fetchColumn();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getSold($customerId = NULL) {
|
47 |
+
$customerId = $this->fixCustomerId($customerId);
|
48 |
+
if (!$customerId) {
|
49 |
+
return 0;
|
50 |
+
}
|
51 |
+
$totals = $this->getTotals($customerId);
|
52 |
+
return $totals['sold'];
|
53 |
+
}
|
54 |
+
|
55 |
+
private function fixCustomerId($customerId = NULL) {
|
56 |
+
if (!$customerId and isset($_GET["id"])) {
|
57 |
+
$customerId = $_GET["id"];
|
58 |
+
}
|
59 |
+
return $customerId;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
?>
|
app/code/local/Alfa9/VentasEnGrupo/Helper/Data.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function isAdminStore() {
|
5 |
+
return (Mage::app()->getStore()->getCode()=='admin');
|
6 |
+
}
|
7 |
+
|
8 |
+
public function isMainStore() {
|
9 |
+
return (Mage::app()->getStore()->getCode()=='default');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function isGrupoConsumoStore() {
|
13 |
+
return !$this->isAdminStore() and !$this->isMainStore();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCurrentGrupoConsumo() {
|
17 |
+
return $this->isGrupoConsumoStore() ? Mage::app()->getStore() : NULL;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function collectPartnerSales($customerId) {
|
21 |
+
if (!$customerId) {
|
22 |
+
return NULL;
|
23 |
+
}
|
24 |
+
|
25 |
+
$sold = 0;
|
26 |
+
|
27 |
+
$saleWeeks = Array();
|
28 |
+
$saleWeeks[] = $this->getDailySalesBlockData()->getCurrent();
|
29 |
+
|
30 |
+
$type = Mage::getSingleton('core/resource')
|
31 |
+
->getConnection('core_write')
|
32 |
+
->query("select minimumordertype from ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_saleperpartner where mageuserid = $customerId")
|
33 |
+
->fetchColumn();
|
34 |
+
|
35 |
+
foreach($saleWeeks as $saleWeek) {
|
36 |
+
if(is_object($saleWeek)) {
|
37 |
+
if (!$type) {
|
38 |
+
$sold += (int)Mage::getModel('sales/order')
|
39 |
+
->getCollection()
|
40 |
+
->addFieldToFilter ('created_at', array(
|
41 |
+
"from" => $saleWeek->getBegin(),
|
42 |
+
"to" => $saleWeek->getEnd(),
|
43 |
+
"datetime" => true))
|
44 |
+
->addFieldToFilter ('store_id', Mage::app()->getStore()->getStoreId())
|
45 |
+
->load()
|
46 |
+
->count();
|
47 |
+
} else {
|
48 |
+
$sales = Mage::getModel('sales/order')
|
49 |
+
->getCollection()
|
50 |
+
->addFieldToFilter ('created_at', array(
|
51 |
+
"from" => $saleWeek->getBegin(),
|
52 |
+
"to" => $saleWeek->getEnd(),
|
53 |
+
"datetime" => true))
|
54 |
+
->addFieldToFilter ('store_id', Mage::app()->getStore()->getStoreId())
|
55 |
+
->load();
|
56 |
+
foreach($sales as $order) {
|
57 |
+
if (!$order->isCanceled()) {
|
58 |
+
foreach($order->getAllItems() as $item) {
|
59 |
+
if ($item->getPartner() == $customerId) {
|
60 |
+
$sold += $item->getPrice();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
return count($saleWeeks)
|
69 |
+
? array(
|
70 |
+
'total' => (string)(int)Mage::getSingleton('core/resource')
|
71 |
+
->getConnection('core_write')
|
72 |
+
->query("select minimumorder from ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_saleperpartner where mageuserid = $customerId")
|
73 |
+
->fetchColumn(),
|
74 |
+
'sold' => (string)$sold
|
75 |
+
) : NULL;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getDailySalesBlockData($store = NULL) {
|
79 |
+
// Evita problemas de timezone (UTC vs Local)
|
80 |
+
date_default_timezone_set(Mage::app()->getStore($store)->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
|
81 |
+
|
82 |
+
// Obtiene los segundos de cada fecha
|
83 |
+
$date = time();
|
84 |
+
$referencedate = strtotime(Mage::getStoreConfig('a9veg/etc/referencedate', $store));
|
85 |
+
|
86 |
+
// Calcula los nº de semana (referencia 29 diciembre 1969)
|
87 |
+
$weekRD = ceil((($referencedate - (60*60*24*3))/(60*60*24*7)) + 1);
|
88 |
+
$weekNOW = ceil((($date - (60*60*24*3))/(60*60*24*7)) + 1);
|
89 |
+
|
90 |
+
if (Mage::getModel('a9veg/adminhtml_system_config_source_date_freq')->toArrayFlip('Ninguna') == Mage::getStoreConfig('a9veg/etc/freq', $store)) {
|
91 |
+
$current = NULL;
|
92 |
+
$next = NULL;
|
93 |
+
} else if (date('Y-m-d H:i:s', $referencedate) > date('Y-m-d H:i:s', $date)) {
|
94 |
+
$selectedWeek = $weekRD - $weekNOW;
|
95 |
+
|
96 |
+
// Comprueba si hubo periodo de venta en la semana de referencia o en la siguiente.
|
97 |
+
if (Mage::getStoreConfig('a9veg/etc/start', $store) < date('N',$referencedate)) {
|
98 |
+
$selectedWeek += 1;
|
99 |
+
}
|
100 |
+
|
101 |
+
$current = NULL;
|
102 |
+
$next = $this->getStoreSaleWeek($date, $store, $selectedWeek);
|
103 |
+
} else {
|
104 |
+
$selectedWeek = $diffWeeks = $weekNOW - $weekRD;
|
105 |
+
|
106 |
+
switch(Mage::getStoreConfig('a9veg/etc/freq', $store)) {
|
107 |
+
case Mage::getModel('a9veg/adminhtml_system_config_source_date_freq')->toArrayFlip('Semanal'):
|
108 |
+
$selectedWeek = 0;
|
109 |
+
$weeksDifference = 1;
|
110 |
+
break;
|
111 |
+
case Mage::getModel('a9veg/adminhtml_system_config_source_date_freq')->toArrayFlip('Quincenal'):
|
112 |
+
$selectedWeek = $selectedWeek % 2;
|
113 |
+
// Comprueba si hubo periodo de venta en la semana de referencia o en la siguiente.
|
114 |
+
if (Mage::getStoreConfig('a9veg/etc/start', $store) < date('N',$referencedate)) {
|
115 |
+
$selectedWeek += 1;
|
116 |
+
}
|
117 |
+
$weeksDifference = 2;
|
118 |
+
break;
|
119 |
+
case Mage::getModel('a9veg/adminhtml_system_config_source_date_freq')->toArrayFlip('Mensual'):
|
120 |
+
$selectedWeek = (4 - $selectedWeek % 4) % 4;
|
121 |
+
// Comprueba si hubo periodo de venta en la semana de referencia o en la siguiente.
|
122 |
+
if (Mage::getStoreConfig('a9veg/etc/start', $store) < date('N',$referencedate)) {
|
123 |
+
$selectedWeek += 1;
|
124 |
+
}
|
125 |
+
$weeksDifference = 4;
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ($this->getStoreSaleWeek($date, $store, $selectedWeek)->getBegin() <= date('Y-m-d H:i:s', $date)
|
130 |
+
&& date('Y-m-d H:i:s', $date) <= $this->getStoreSaleWeek($date, $store, $selectedWeek)->getEnd()) {
|
131 |
+
$current = $this->getStoreSaleWeek($date, $store, $selectedWeek);
|
132 |
+
$next = $this->getStoreSaleWeek($date, $store, $selectedWeek + $weeksDifference);
|
133 |
+
} else {
|
134 |
+
$current = NULL;
|
135 |
+
$next = $this->getStoreSaleWeek($date, $store, $selectedWeek);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
return new Varien_Object(array(
|
140 |
+
'active' => (bool)$current,
|
141 |
+
'current' => $current,
|
142 |
+
'next' => $next));
|
143 |
+
}
|
144 |
+
|
145 |
+
/* Deplecated */
|
146 |
+
public function getStoreSaleWeeks($date, $store = NULL, $lastSaleWeek = 3) {
|
147 |
+
$saleWeeks = array();
|
148 |
+
for ($i = 0; $i <= $lastSaleWeek; $i++) {
|
149 |
+
$saleWeeks[] = $this->getStoreSaleWeek($date, $store, $i);
|
150 |
+
}
|
151 |
+
|
152 |
+
return $saleWeeks;
|
153 |
+
}
|
154 |
+
|
155 |
+
private function getStoreSaleWeek($date, $store, $modWeek) {
|
156 |
+
if (is_null($store)) {
|
157 |
+
$store = Mage::app()->getStore();
|
158 |
+
}
|
159 |
+
|
160 |
+
$dateValue = - date('N', $date) + $modWeek * 7;
|
161 |
+
|
162 |
+
$beginValue = Mage::getStoreConfig('a9veg/etc/start', $store) + $dateValue;
|
163 |
+
$endValue = Mage::getStoreConfig('a9veg/etc/end', $store) + $dateValue;
|
164 |
+
$deliveryValue = Mage::getStoreConfig('a9veg/etc/delivery', $store) + $dateValue;
|
165 |
+
|
166 |
+
$strtotime = new Varien_Object(array(
|
167 |
+
'begin' => $beginValue,
|
168 |
+
'end' => $endValue,
|
169 |
+
'delivery' => $deliveryValue));
|
170 |
+
|
171 |
+
if (Mage::getStoreConfig('a9veg/etc/end', $store) < Mage::getStoreConfig('a9veg/etc/start', $store)) {
|
172 |
+
$strtotime->setEnd($strtotime->getEnd() + 7);
|
173 |
+
$strtotime->setDelivery($strtotime->getDelivery() + 7);
|
174 |
+
}
|
175 |
+
|
176 |
+
if (Mage::getStoreConfig('a9veg/etc/delivery', $store) <= Mage::getStoreConfig('a9veg/etc/end', $store)) {
|
177 |
+
$strtotime->setDelivery($strtotime->getDelivery() + 7);
|
178 |
+
}
|
179 |
+
|
180 |
+
if ($strtotime->getBegin() > 0) {
|
181 |
+
$strtotime->setBegin(strtotime(date('Y-m-d',$date).' + '.$strtotime->getBegin().' days'));
|
182 |
+
} else {
|
183 |
+
$strtotime->setBegin(strtotime(date('Y-m-d',$date).' - '.abs($strtotime->getBegin()).' days'));
|
184 |
+
}
|
185 |
+
|
186 |
+
if ($strtotime->getEnd() > 0) {
|
187 |
+
$strtotime->setEnd(strtotime(date('Y-m-d',$date).' + '.$strtotime->getEnd().' days'));
|
188 |
+
} else {
|
189 |
+
$strtotime->setEnd(strtotime(date('Y-m-d',$date).' - '.abs($strtotime->getEnd()).' days'));
|
190 |
+
}
|
191 |
+
|
192 |
+
if ($strtotime->getDelivery() > 0) {
|
193 |
+
$strtotime->setDelivery(strtotime(date('Y-m-d',$date).' + '.$strtotime->getDelivery().' days'));
|
194 |
+
} else {
|
195 |
+
$strtotime->setDelivery(strtotime(date('Y-m-d',$date).' - '.abs($strtotime->getDelivery()).' days'));
|
196 |
+
}
|
197 |
+
|
198 |
+
return new Varien_Object(array(
|
199 |
+
'begin' => date('Y-m-d', $strtotime->getBegin()) . ' 00:00:00',
|
200 |
+
'end' => date('Y-m-d', $strtotime->getEnd()) . ' 23:59:59',
|
201 |
+
'delivery' => date('Y-m-d', $strtotime->getDelivery()),
|
202 |
+
'begin_formated' => $this->strtr(date('l', $strtotime->getBegin())).' '.date('d', $strtotime->getBegin()).' de '.$this->strtr(date('F', $strtotime->getBegin())),
|
203 |
+
'end_formated' => $this->strtr(date('l', $strtotime->getEnd())).' '.date('d', $strtotime->getEnd()).' de '.$this->strtr(date('F', $strtotime->getEnd())),
|
204 |
+
'delivery_formated' => $this->strtr(date('l', $strtotime->getDelivery())).' '.date('d', $strtotime->getDelivery()).' de '.$this->strtr(date('F', $strtotime->getDelivery())),));
|
205 |
+
}
|
206 |
+
|
207 |
+
public function strtr($str) {
|
208 |
+
return strtr(
|
209 |
+
strtr(
|
210 |
+
$str,
|
211 |
+
array('Monday' => 'Lunes',
|
212 |
+
'Tuesday' => 'Martes',
|
213 |
+
'Wednesday' => 'Miércoles',
|
214 |
+
'Thursday' => 'Jueves',
|
215 |
+
'Friday' => 'Viernes',
|
216 |
+
'Saturday' => 'Sábado',
|
217 |
+
'Sunday' => 'Domingo')),
|
218 |
+
array('January' => 'Enero',
|
219 |
+
'February' => 'Febrero',
|
220 |
+
'March' => 'Marzo',
|
221 |
+
'April' => 'Abril',
|
222 |
+
'May' => 'Mayo',
|
223 |
+
'June' => 'Junio',
|
224 |
+
'July' => 'Julio',
|
225 |
+
'August' => 'Agosto',
|
226 |
+
'September' => 'Septiembre',
|
227 |
+
'October' => 'Octubre',
|
228 |
+
'November' => 'Noviembre',
|
229 |
+
'December' => 'Diciembre'));
|
230 |
+
}
|
231 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Helper/Order.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Helper_Order extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function notify($order) {
|
5 |
+
if (is_numeric($order)) $order = Mage::getModel('sales/order')->load($order);
|
6 |
+
$notify = array();
|
7 |
+
$items = $order->getItemsCollection();
|
8 |
+
foreach ( $items as $item ) {
|
9 |
+
$products = Mage::getModel('catalog/product')
|
10 |
+
->getCollection()
|
11 |
+
->addAttributeToSelect('partner')
|
12 |
+
->addAttributeToFilter('entity_id', $item->getProductId())
|
13 |
+
->load();
|
14 |
+
foreach($products as $product) {
|
15 |
+
if ($product->getPartner() and Mage::getModel('customer/customer')->load($product->getPartner())->getIsActive()) {
|
16 |
+
if (!isset($notify[$product->getPartner()])) {
|
17 |
+
$notify[$product->getPartner()] = array();
|
18 |
+
}
|
19 |
+
$notify[$product->getPartner()][] = array(
|
20 |
+
$item->getProductId() => $item->getQtyOrdered()
|
21 |
+
);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if (count($notify)) {
|
27 |
+
foreach ( $notify as $partnerId => $items ) {
|
28 |
+
$this->sendEmail($partnerId, $items, $order);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
private function sendEmail($partnerId, $items, $order) {
|
34 |
+
$html = '';
|
35 |
+
|
36 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
37 |
+
$queryResult=$db->query("SELECT email, CONCAT(firstname, ' ',lastname) as name FROM ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_userdata WHERE mageuserid='".$partnerId."';");
|
38 |
+
$partner = $queryResult->fetch();
|
39 |
+
|
40 |
+
foreach ( $items as $item ) {
|
41 |
+
foreach ( $item as $product_id => $qty ) {
|
42 |
+
$_product = Mage::getModel( 'catalog/product' )->load( $product_id );
|
43 |
+
$html .= '<tr><td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA;">'. $_product->getName() .' ( '. $_product->getSku() .' )</td>';
|
44 |
+
$html .= '<td align="center" valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">'. number_format( $qty, 2 ) .'</td></tr>';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( $html != '' ) {
|
49 |
+
$to_email = $partner['email'];
|
50 |
+
$to_name = $partner['name'];
|
51 |
+
|
52 |
+
$email_template = Mage::getModel( 'core/email_template' )->loadDefault('a9_partner_email');
|
53 |
+
|
54 |
+
try {
|
55 |
+
$email_content = utf8_decode($email_template->getProcessedTemplate( array(
|
56 |
+
'partner' => Mage::getModel('customer/customer')->load($partnerId),
|
57 |
+
'title_order' => 'Detalle del Pedido Número',
|
58 |
+
'title_billing' => 'Datos de Facturación del Cliente:',
|
59 |
+
'title_shipping' => 'Dirección del Grupo de Consumo:',
|
60 |
+
'order' => $order,
|
61 |
+
'store' => Mage::app()->getStore(),
|
62 |
+
'items_html' => $html
|
63 |
+
) ));
|
64 |
+
|
65 |
+
$email_subject = $email_template->getProcessedTemplateSubject( array( 'order' => $order, 'store' => Mage::app()->getStore(), 'items_html' => $html ) );
|
66 |
+
$mail = Mage::getModel( 'core/email' );
|
67 |
+
$mail->setToName( $to_name );
|
68 |
+
$forcedTo = Mage::getStoreConfig('a9veg/notify/email');
|
69 |
+
$mail->setToEmail( $forcedTo?$forcedTo:$to_email );
|
70 |
+
$mail->setBody( $email_content );
|
71 |
+
$mail->setSubject( $email_subject );
|
72 |
+
$mail->setType( 'html' );
|
73 |
+
$mail->setFromName(Mage::app()->getStore()->getName());
|
74 |
+
$mail->setFromEmail(Mage::getStoreConfig('trans_email/ident_sales/email'));
|
75 |
+
$mail->send();
|
76 |
+
}
|
77 |
+
catch( Exception $e ) {}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Date/Days.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Model_Adminhtml_System_Config_Source_Date_Days
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 1, 'label'=> Mage::helper('a9veg')->__('Lunes')),
|
14 |
+
array('value' => 2, 'label'=> Mage::helper('a9veg')->__('Martes')),
|
15 |
+
array('value' => 3, 'label'=> Mage::helper('a9veg')->__('Miercoles')),
|
16 |
+
array('value' => 4, 'label'=> Mage::helper('a9veg')->__('Jueves')),
|
17 |
+
array('value' => 5, 'label'=> Mage::helper('a9veg')->__('Viernes')),
|
18 |
+
array('value' => 6, 'label'=> Mage::helper('a9veg')->__('Sabado')),
|
19 |
+
array('value' => 7, 'label'=> Mage::helper('a9veg')->__('Domingo')),
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get options in "key-value" format
|
25 |
+
*
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
public function toArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
1 => Mage::helper('a9veg')->__('Lunes'),
|
32 |
+
2 => Mage::helper('a9veg')->__('Martes'),
|
33 |
+
3 => Mage::helper('a9veg')->__('Miercoles'),
|
34 |
+
4 => Mage::helper('a9veg')->__('Jueves'),
|
35 |
+
5 => Mage::helper('a9veg')->__('Viernes'),
|
36 |
+
6 => Mage::helper('a9veg')->__('Sabado'),
|
37 |
+
7 => Mage::helper('a9veg')->__('Domingo'),
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Date/Freq.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Model_Adminhtml_System_Config_Source_Date_Freq
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 0, 'label'=> Mage::helper('a9veg')->__('Ninguna')),
|
14 |
+
array('value' => 1, 'label'=> Mage::helper('a9veg')->__('Semanal')),
|
15 |
+
array('value' => 2, 'label'=> Mage::helper('a9veg')->__('Quincenal')),
|
16 |
+
array('value' => 3, 'label'=> Mage::helper('a9veg')->__('Mensual')),
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get options in "key-value" format
|
22 |
+
*
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function toArray()
|
26 |
+
{
|
27 |
+
return array(
|
28 |
+
0 => Mage::helper('a9veg')->__('Ninguna'),
|
29 |
+
1 => Mage::helper('a9veg')->__('Semanal'),
|
30 |
+
2 => Mage::helper('a9veg')->__('Quincenal'),
|
31 |
+
3 => Mage::helper('a9veg')->__('Mensual'),
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function toArrayFlip($key = NULL) {
|
36 |
+
if (is_null($key))
|
37 |
+
return array_flip($this->toArray());
|
38 |
+
else {
|
39 |
+
$array = $this->toArrayFlip();
|
40 |
+
return $array[$key];
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Adminhtml/System/Config/Source/Partner.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Model_Adminhtml_System_Config_Source_Partner extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Retrieve all options array
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function getAllOptions()
|
10 |
+
{
|
11 |
+
if (is_null($this->_options)) {
|
12 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
13 |
+
$queryResult=$db->query("SELECT mageuserid, (SELECT value from customer_entity_varchar where entity_id = mageuserid and attribute_id = (select attribute_id from eav_attribute where attribute_code='compania' AND entity_type_id = '1')) as name FROM ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_userdata as meu JOIN customer_entity AS ce WHERE meu.partnerstatus = 'Seller' AND ce.entity_id = meu.mageuserid ORDER BY firstname;");
|
14 |
+
$rows = $queryResult->fetchAll();
|
15 |
+
/*
|
16 |
+
* Comentado por el Ticket #2190: En el BO el filtro de catálogo por productor YOCOMPROSANO
|
17 |
+
* no funciona. http://soporte.alfa9.com/issues/2190
|
18 |
+
*
|
19 |
+
$this->_options[] = array(
|
20 |
+
'label' => 'YoComproSano',
|
21 |
+
'value' => ''
|
22 |
+
);
|
23 |
+
*/
|
24 |
+
foreach($rows as $row)
|
25 |
+
$this->_options[] = array(
|
26 |
+
'label' => $row['name'],
|
27 |
+
'value' => $row['mageuserid']
|
28 |
+
);
|
29 |
+
}
|
30 |
+
return $this->_options;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve option array
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getOptionArray()
|
39 |
+
{
|
40 |
+
$_options = array();
|
41 |
+
foreach ($this->getAllOptions() as $option) {
|
42 |
+
$_options[$option['value']] = $option['label'];
|
43 |
+
}
|
44 |
+
return $_options;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Retrieve option array
|
49 |
+
*
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function getOptionArrayWithEmpty()
|
53 |
+
{
|
54 |
+
$_options = $this->getOptionArray();
|
55 |
+
$_options[''] = Mage::helper('catalog')->__('Any');
|
56 |
+
return $_options;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get a text for option value
|
61 |
+
*
|
62 |
+
* @param string|integer $value
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getOptionText($value)
|
66 |
+
{
|
67 |
+
$options = $this->getAllOptions();
|
68 |
+
foreach ($options as $option) {
|
69 |
+
if ($option['value'] == $value) {
|
70 |
+
return $option['label'];
|
71 |
+
}
|
72 |
+
}
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Dailydeal/Task.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Alfa9_VentasEnGrupo_Model_Dailydeal_Task
|
3 |
+
{
|
4 |
+
public function run()
|
5 |
+
{
|
6 |
+
ini_set('memory_limit', '512M');
|
7 |
+
foreach(array_slice(Mage::app()->getStores(), 1) as $store) {
|
8 |
+
date_default_timezone_set(Mage::app()->getStore($store)->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
|
9 |
+
foreach(Mage::helper('a9veg')->getStoreSaleWeeks(time(), $store) as $saleWeek) {
|
10 |
+
foreach(Mage::getModel('catalog/product')
|
11 |
+
->getCollection()
|
12 |
+
->setStore($store)
|
13 |
+
->addAttributeToSelect('name')
|
14 |
+
->addAttributeToSelect('price')
|
15 |
+
->addAttributeToFilter('status', 1)
|
16 |
+
->addAttributeToFilter('visibility', 4)
|
17 |
+
->load()
|
18 |
+
as $product) {
|
19 |
+
try {
|
20 |
+
Mage::getModel('dailydeal/dailydeal')
|
21 |
+
->setTitle('Deal '.$store->getName().': '.$product->getName())
|
22 |
+
->setProductId($product->getId())
|
23 |
+
->setProductName($product->getName())
|
24 |
+
->setDealPrice(number_format($product->getPrice(),2,'.',','))
|
25 |
+
->setQuantity('1000')
|
26 |
+
->setStartTime($saleWeek->getBegin())
|
27 |
+
->setCloseTime($saleWeek->getEnd())
|
28 |
+
->setStoreId($store->getStoreId())
|
29 |
+
->save();
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Mage::logException($e);
|
32 |
+
Mage::getSingleton('core/session')->addError(
|
33 |
+
Mage::helper('catalog')->__($e->getMessage())
|
34 |
+
);
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Order.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Order Observer Model
|
4 |
+
*
|
5 |
+
* @category Model
|
6 |
+
* @package Alfa9
|
7 |
+
* @author ctubio <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Alfa9_VentasEnGrupo_Model_Observer_Order extends Mage_Payment_Model_Method_Abstract {
|
11 |
+
|
12 |
+
public function salesOrderSaveAfter( $observer ) {
|
13 |
+
if ( Mage::getStoreConfig( 'a9veg/notify/active' ) ) {
|
14 |
+
$order = $observer->getEvent()->getOrder();
|
15 |
+
if ($order->getStatus() == Mage::getStoreConfig('a9veg/notify/status')){
|
16 |
+
Mage::helper('a9veg/order')->notify($order);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
?>
|
app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Order/Partner.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sales observer
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_Sales
|
7 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
8 |
+
*/
|
9 |
+
class Alfa9_VentasEnGrupo_Model_Observer_Order_Partner
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Refresh sales order report statistics for last day
|
13 |
+
*
|
14 |
+
* @param Mage_Cron_Model_Schedule $schedule
|
15 |
+
* @return Mage_Sales_Model_Observer
|
16 |
+
*/
|
17 |
+
public function aggregateSalesReportOrderPartnerData($schedule)
|
18 |
+
{
|
19 |
+
Mage::app()->getLocale()->emulate(0);
|
20 |
+
$currentDate = Mage::app()->getLocale()->date();
|
21 |
+
$date = $currentDate->subHour(25);
|
22 |
+
Mage::getResourceModel('sales/report_order_partner')->aggregate($date);
|
23 |
+
Mage::app()->getLocale()->revert();
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
app/code/local/Alfa9/VentasEnGrupo/Model/Observer/Product.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Order Observer Model
|
4 |
+
*
|
5 |
+
* @category Model
|
6 |
+
* @package Alfa9
|
7 |
+
* @author ctubio <ctubio@alfa9.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Alfa9_VentasEnGrupo_Model_Observer_Product extends Mage_Payment_Model_Method_Abstract {
|
11 |
+
|
12 |
+
public function catalogProductIsSalableAfter($observer) {
|
13 |
+
if ($observer->getSalable()->getIsSalable())
|
14 |
+
$observer->getSalable()->setIsSalable(
|
15 |
+
Mage::helper('checkout')->canOnepageCheckout()
|
16 |
+
);
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
21 |
+
?>
|
app/code/local/Alfa9/VentasEnGrupo/etc/config.xml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Serhs
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_VentasEnGrupo>
|
12 |
+
<version>0.0.1</version>
|
13 |
+
</Alfa9_VentasEnGrupo>
|
14 |
+
</modules>
|
15 |
+
<crontab>
|
16 |
+
<jobs>
|
17 |
+
<alfa9_dailydeal_cron>
|
18 |
+
<schedule>
|
19 |
+
<cron_expr>0 0 1 * *</cron_expr>
|
20 |
+
</schedule>
|
21 |
+
<run>
|
22 |
+
<model>a9veg/dailydeal_task::run</model>
|
23 |
+
</run>
|
24 |
+
</alfa9_dailydeal_cron>
|
25 |
+
<alfa9_aggregate_sales_report_order_partner_data>
|
26 |
+
<schedule>
|
27 |
+
<cron_expr>0 0 * * *</cron_expr> <!-- 0 0 * * * -->
|
28 |
+
</schedule>
|
29 |
+
<run>
|
30 |
+
<model>a9veg/observer_order_partner::aggregateSalesReportOrderPartnerData</model>
|
31 |
+
</run>
|
32 |
+
</alfa9_aggregate_sales_report_order_partner_data>
|
33 |
+
</jobs>
|
34 |
+
</crontab>
|
35 |
+
<global>
|
36 |
+
<blocks>
|
37 |
+
<a9veg>
|
38 |
+
<class>Alfa9_VentasEnGrupo_Block</class>
|
39 |
+
</a9veg>
|
40 |
+
<enhancedgrid>
|
41 |
+
<rewrite>
|
42 |
+
<catalog_product_grid>Alfa9_VentasEnGrupo_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
|
43 |
+
</rewrite>
|
44 |
+
</enhancedgrid>
|
45 |
+
</blocks>
|
46 |
+
<helpers>
|
47 |
+
<a9veg>
|
48 |
+
<class>Alfa9_VentasEnGrupo_Helper</class>
|
49 |
+
</a9veg>
|
50 |
+
</helpers>
|
51 |
+
<models>
|
52 |
+
<a9veg>
|
53 |
+
<class>Alfa9_VentasEnGrupo_Model</class>
|
54 |
+
</a9veg>
|
55 |
+
</models>
|
56 |
+
<events>
|
57 |
+
<sales_order_save_after>
|
58 |
+
<observers>
|
59 |
+
<alfa9_ventasengrupo_sales_order_save_after>
|
60 |
+
<type>singleton</type>
|
61 |
+
<class>Alfa9_VentasEnGrupo_Model_Observer_Order</class>
|
62 |
+
<method>salesOrderSaveAfter</method>
|
63 |
+
</alfa9_ventasengrupo_sales_order_save_after>
|
64 |
+
</observers>
|
65 |
+
</sales_order_save_after>
|
66 |
+
<catalog_product_is_salable_after>
|
67 |
+
<observers>
|
68 |
+
<alfa9_catalog_product_is_salable_after>
|
69 |
+
<type>singleton</type>
|
70 |
+
<class>Alfa9_VentasEnGrupo_Model_Observer_Product</class>
|
71 |
+
<method>catalogProductIsSalableAfter</method>
|
72 |
+
</alfa9_catalog_product_is_salable_after>
|
73 |
+
</observers>
|
74 |
+
</catalog_product_is_salable_after>
|
75 |
+
</events>
|
76 |
+
<template>
|
77 |
+
<email>
|
78 |
+
<a9_partner_email>
|
79 |
+
<label>Partner New Order Email</label>
|
80 |
+
<file>alfa9/partner_order_new.html</file>
|
81 |
+
<type>html</type>
|
82 |
+
</a9_partner_email>
|
83 |
+
</email>
|
84 |
+
</template>
|
85 |
+
</global>
|
86 |
+
<adminhtml>
|
87 |
+
<acl>
|
88 |
+
<resources>
|
89 |
+
<admin>
|
90 |
+
<children>
|
91 |
+
<system>
|
92 |
+
<children>
|
93 |
+
<config>
|
94 |
+
<children>
|
95 |
+
<a9veg translate="label" module="a9veg">
|
96 |
+
<title>Ventas en Grupo</title>
|
97 |
+
</a9veg>
|
98 |
+
</children>
|
99 |
+
</config>
|
100 |
+
</children>
|
101 |
+
</system>
|
102 |
+
</children>
|
103 |
+
</admin>
|
104 |
+
</resources>
|
105 |
+
</acl>
|
106 |
+
</adminhtml>
|
107 |
+
<default>
|
108 |
+
<a9veg>
|
109 |
+
<new>
|
110 |
+
<mail>info@yocomprosano.es</mail>
|
111 |
+
</new>
|
112 |
+
<etc>
|
113 |
+
<freq></freq>
|
114 |
+
<start></start>
|
115 |
+
<end></end>
|
116 |
+
<delivery></delivery>
|
117 |
+
</etc>
|
118 |
+
<notify>
|
119 |
+
<active>0</active>
|
120 |
+
<status></status>
|
121 |
+
<email></email>
|
122 |
+
</notify>
|
123 |
+
<addr>
|
124 |
+
<firstname></firstname>
|
125 |
+
<lastname></lastname>
|
126 |
+
<company></company>
|
127 |
+
<street></street>
|
128 |
+
<city></city>
|
129 |
+
<region></region>
|
130 |
+
<postcode></postcode>
|
131 |
+
<country></country>
|
132 |
+
<telephone></telephone>
|
133 |
+
<fax></fax>
|
134 |
+
</addr>
|
135 |
+
</a9veg>
|
136 |
+
</default>
|
137 |
+
</config>
|
app/code/local/Alfa9/VentasEnGrupo/etc/system.xml
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config><!-- http://w-hat.com/name2key?terse=1&name=%20Trullo%20Oh -->
|
3 |
+
<tabs>
|
4 |
+
<a9veg translate="label" module="a9veg">
|
5 |
+
<label>Ventas en Grupo</label>
|
6 |
+
<sort_order>150</sort_order>
|
7 |
+
</a9veg>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<a9veg translate="label" module="a9veg">
|
11 |
+
<label>Preferencias</label>
|
12 |
+
<tab>a9veg</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>50</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<new translate="label">
|
20 |
+
<label>Solicitud de Grupo de Consumo</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<mail translate="label">
|
28 |
+
<label>Correo destinatario</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>0</show_in_website>
|
34 |
+
<show_in_store>0</show_in_store>
|
35 |
+
</mail>
|
36 |
+
</fields>
|
37 |
+
</new>
|
38 |
+
<etc translate="label">
|
39 |
+
<label>Ventana de Compra</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<fields>
|
46 |
+
<freq translate="label comment">
|
47 |
+
<label>Frecuencia</label>
|
48 |
+
<frontend_type>select</frontend_type>
|
49 |
+
<source_model>a9veg/adminhtml_system_config_source_date_freq</source_model>
|
50 |
+
<sort_order>10</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 |
+
</freq>
|
55 |
+
<referencedate translate="label">
|
56 |
+
<label>Fecha Referencia</label>
|
57 |
+
<frontend_type>date</frontend_type>
|
58 |
+
<frontend_model>a9veg/adminhtml_system_config_date</frontend_model>
|
59 |
+
<depends><freq>a9_nonzero</freq></depends>
|
60 |
+
<sort_order>20</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</referencedate>
|
65 |
+
<start translate="label comment">
|
66 |
+
<label>Dia Inicio</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>a9veg/adminhtml_system_config_source_date_days</source_model>
|
69 |
+
<depends><freq>a9_nonzero</freq></depends>
|
70 |
+
<sort_order>30</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 |
+
</start>
|
75 |
+
<end translate="label">
|
76 |
+
<label>Dia Final</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>a9veg/adminhtml_system_config_source_date_days</source_model>
|
79 |
+
<depends><freq>a9_nonzero</freq></depends>
|
80 |
+
<sort_order>40</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 |
+
</end>
|
85 |
+
<delivery translate="label">
|
86 |
+
<label>Dia Entrega</label>
|
87 |
+
<frontend_type>select</frontend_type>
|
88 |
+
<source_model>a9veg/adminhtml_system_config_source_date_days</source_model>
|
89 |
+
<depends><freq>a9_nonzero</freq></depends>
|
90 |
+
<sort_order>50</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 |
+
</delivery>
|
95 |
+
</fields>
|
96 |
+
</etc>
|
97 |
+
<notify translate="label">
|
98 |
+
<label>Correos de Ventas para Productores</label>
|
99 |
+
<frontend_type>text</frontend_type>
|
100 |
+
<sort_order>20</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
<fields>
|
105 |
+
<active translate="label">
|
106 |
+
<label>Activar Notificaciones</label>
|
107 |
+
<frontend_type>select</frontend_type>
|
108 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
109 |
+
<sort_order>10</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>0</show_in_website>
|
112 |
+
<show_in_store>0</show_in_store>
|
113 |
+
</active>
|
114 |
+
<status translate="label">
|
115 |
+
<label>Enviar cuando el Status sea</label>
|
116 |
+
<frontend_type>select</frontend_type>
|
117 |
+
<depends><active>1</active></depends>
|
118 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
119 |
+
<sort_order>20</sort_order>
|
120 |
+
<show_in_default>1</show_in_default>
|
121 |
+
<show_in_website>0</show_in_website>
|
122 |
+
<show_in_store>0</show_in_store>
|
123 |
+
</status>
|
124 |
+
<email translate="label">
|
125 |
+
<label>Sobreescribir receptor (email)</label>
|
126 |
+
<frontend_type>text</frontend_type>
|
127 |
+
<depends><active>1</active></depends>
|
128 |
+
<sort_order>30</sort_order>
|
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 |
+
</email>
|
133 |
+
</fields>
|
134 |
+
</notify>
|
135 |
+
<addr translate="label">
|
136 |
+
<label>Direcci&oacute;n de Env&iacute;o</label>
|
137 |
+
<frontend_type>text</frontend_type>
|
138 |
+
<sort_order>30</sort_order>
|
139 |
+
<show_in_default>1</show_in_default>
|
140 |
+
<show_in_website>1</show_in_website>
|
141 |
+
<show_in_store>1</show_in_store>
|
142 |
+
<fields>
|
143 |
+
<firstname translate="label">
|
144 |
+
<label>Nombre</label>
|
145 |
+
<frontend_type>text</frontend_type>
|
146 |
+
<sort_order>10</sort_order>
|
147 |
+
<show_in_default>1</show_in_default>
|
148 |
+
<show_in_website>1</show_in_website>
|
149 |
+
<show_in_store>1</show_in_store>
|
150 |
+
</firstname>
|
151 |
+
<lastname translate="label">
|
152 |
+
<label>Apellido</label>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>20</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
</lastname>
|
159 |
+
<company translate="label">
|
160 |
+
<label>Compa&ntilde;ia</label>
|
161 |
+
<frontend_type>text</frontend_type>
|
162 |
+
<sort_order>30</sort_order>
|
163 |
+
<show_in_default>1</show_in_default>
|
164 |
+
<show_in_website>1</show_in_website>
|
165 |
+
<show_in_store>1</show_in_store>
|
166 |
+
</company>
|
167 |
+
<street translate="label">
|
168 |
+
<label>Direcci&oacute;n</label>
|
169 |
+
<frontend_type>text</frontend_type>
|
170 |
+
<sort_order>40</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>1</show_in_store>
|
174 |
+
</street>
|
175 |
+
<city translate="label">
|
176 |
+
<label>Ciudad</label>
|
177 |
+
<frontend_type>text</frontend_type>
|
178 |
+
<sort_order>50</sort_order>
|
179 |
+
<show_in_default>1</show_in_default>
|
180 |
+
<show_in_website>1</show_in_website>
|
181 |
+
<show_in_store>1</show_in_store>
|
182 |
+
</city>
|
183 |
+
<region translate="label">
|
184 |
+
<label>Provincia</label>
|
185 |
+
<frontend_type>select</frontend_type>
|
186 |
+
<source_model>adminhtml/system_config_source_allregion</source_model>
|
187 |
+
<sort_order>60</sort_order>
|
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 |
+
</region>
|
192 |
+
<postcode translate="label">
|
193 |
+
<label>C&oacute;digo Postal</label>
|
194 |
+
<frontend_type>text</frontend_type>
|
195 |
+
<sort_order>70</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
</postcode>
|
200 |
+
<country translate="label">
|
201 |
+
<label>Pa&iacute;s</label>
|
202 |
+
<frontend_type>select</frontend_type>
|
203 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
204 |
+
<sort_order>80</sort_order>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>1</show_in_store>
|
208 |
+
</country>
|
209 |
+
<telephone translate="label">
|
210 |
+
<label>Telefono</label>
|
211 |
+
<frontend_type>text</frontend_type>
|
212 |
+
<sort_order>90</sort_order>
|
213 |
+
<show_in_default>1</show_in_default>
|
214 |
+
<show_in_website>1</show_in_website>
|
215 |
+
<show_in_store>1</show_in_store>
|
216 |
+
</telephone>
|
217 |
+
<fax translate="label">
|
218 |
+
<label>Fax</label>
|
219 |
+
<frontend_type>text</frontend_type>
|
220 |
+
<sort_order>100</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
</fax>
|
225 |
+
</fields>
|
226 |
+
</addr>
|
227 |
+
</groups>
|
228 |
+
</a9veg>
|
229 |
+
</sections>
|
230 |
+
</config>
|
app/etc/modules/Alfa9_AutoApplyRules.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package AutoApplyRules
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_AutoApplyRules>
|
12 |
+
<active>true</active>
|
13 |
+
<codePool>community</codePool>
|
14 |
+
</Alfa9_AutoApplyRules>
|
15 |
+
</modules>
|
16 |
+
</config>
|
app/etc/modules/Alfa9_Base.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Alfa9
|
5 |
+
* @package Alfa9_Base
|
6 |
+
* @author Alfa9 Servicios Web, S.L. <ctubio@alfa9.com>
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Alfa9_Base>
|
12 |
+
<active>true</active>
|
13 |
+
<codePool>local</codePool>
|
14 |
+
</Alfa9_Base>
|
15 |
+
</modules>
|
16 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ApiAutoApplyRules</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>In earlier Versions, when you update products of
|
10 |
+
Magento using the API, the catalog rules become unapplied.</summary>
|
11 |
+
<description>To keep your existent catalogrules always applied to your products, even if you
|
12 |
+
update them using the Magento API, this extensión runs after every call that updates
|
13 |
+
a product, and recursively applies again the existent catalogrules to the recently
|
14 |
+
updated products.</description>
|
15 |
+
<notes>First Stable Release</notes>
|
16 |
+
<authors><author><name>Alfa9 Servicios Web, S.L.</name><user>bermei</user><email>ibermejo@alfa9.com</email></author></authors>
|
17 |
+
<date>2013-12-28</date>
|
18 |
+
<time>09:26:29</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Alfa9"><dir name="AutoApplyRules"><dir name="Helper"><file name="Data.php" hash="1d39f802de6bc140957260a59a5b3202"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="824c1cbf5956c0b330aba484e1560a6f"/></dir><file name="Api.php" hash="c717218eb48eaf7665515147bd6b7eb1"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0384b7ef743272b807e49c5715399f18"/><file name="system.xml" hash="f8bc85c64a3b1aa4f12d1a4a43962ac7"/></dir></dir><dir name="MageForce"><dir name="Block"><dir name="Map"><dir name="Button"><file name="Customer.php" hash="c487d2ca1b8848b966f39f0938f46c86"/></dir><file name="Button.php" hash="44d05c57b9998f0edc8c1282c220c782"/><dir name="Field"><file name="Attributes.php" hash="2c7c6758bc30ae620f167ee17d4e03c4"/><file name="Help.php" hash="4896ac690b4668c5f97bfff5eede6666"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4839eac1364ea690cb24c5c35139cce1"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Xml.php" hash="62d8fe296741153b6c006c26a7c94041"/></dir></dir></dir></dir><dir name="Observer"><file name="Customer.php" hash="19d697aa2c8204237499480f5594a592"/><file name="Order.php" hash="e8193f56e87f13f817f482992c4f2519"/><file name="Product.php" hash="14b8ca8e487b589c4456e1505bd62e63"/><file name="Quote.php" hash="dd9727df241bed17ece85bcbfdfd1ea6"/></dir><file name="Observer.php" hash="0975156590819c40cc2f557a51aaec55"/><dir name="Resource"><file name="Setup.php" hash="0505256efa109fc034bcb8b6612484f5"/></dir></dir><dir name="controllers"><file name="SyncController.php" hash="c978237933f70a166d8c9beefb8f2266"/></dir><dir name="etc"><file name="config.xml" hash="49d3496dd17bb5e86db949ca77dc3a22"/><file name="system.xml" hash="3c160a94de938a39a23a7605b48dde36"/></dir><dir name="sql"><dir name="a9mageforce_setup"><file name="install-0.0.1.php" hash="a98c7ec48afc25978d19c1af5214bd07"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Alfa9"><dir name="Adminhtml"><dir name="etc"><file name="config.xml" hash="29085f5b20f9135819a717f61d130454"/></dir></dir><dir name="Base"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="A9base"><file name="Extensions.php" hash="0b03fac4b3fc342179fbb897da465107"/><file name="Installed.php" hash="59742d137c246decb81be57f56f0e71f"/></dir></dir><file name="Fieldset.php" hash="5f845d7200c77b39c656f28946f5114f"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="da551076afd9fa0b9d44d9ab3e5abedc"/></dir><dir name="Model"><dir name="Rss"><file name="Modules.php" hash="b73094bf1f4681c43b9695275d2f473f"/></dir></dir><dir name="etc"><file name="config.xml" hash="2895e60760bd799c10f11d60e79b8046"/><file name="system.xml" hash="326c82a4c149cad9914246522bac8fc9"/></dir></dir><dir name="Checkout"><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="a863f0a6626e068e818f6b95e56e2c39"/></dir></dir><dir name="etc"><file name="config.xml" hash="0b51ea62a2e3d450aa8839fdc3ab3324"/></dir></dir><dir name="VentasEnGrupo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="7fc34657bbf50adb3dadc816676a788a"/></dir></dir><dir name="System"><dir name="Config"><file name="Date.php" hash="6b191c4292fe6b4ec9ed7355611f0a0b"/></dir></dir></dir><dir name="Grupo"><file name="Selector.php" hash="6bff8f9e440d28c4bbc58f4055962ac4"/></dir><dir name="Productor"><file name="Totals.php" hash="a261a4bec07482ceb8c31e3e44e737bb"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3d3afb7025691441f38e3fcd11170703"/><file name="Order.php" hash="aebf005d3ca45a4a06d09a4322d5bd11"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Date"><file name="Days.php" hash="f59a3e0c8851b412c7615c4286c8ec0a"/><file name="Freq.php" hash="df1ba43e12421b7d016e1ab853a7738e"/></dir><file name="Partner.php" hash="b1b87cf8abc0d0de95c582a4d781b776"/></dir></dir></dir></dir><dir name="Dailydeal"><file name="Task.php" hash="9042da88ea61703b7b29177b8250efa8"/></dir><dir name="Observer"><dir name="Order"><file name="Partner.php" hash="28e70e95218a173f97b03c3b0becc0d0"/></dir><file name="Order.php" hash="9e41f89f256d57b627301daf6dcb65be"/><file name="Product.php" hash="82ea5eef693678006d26e9e897cbeb18"/></dir></dir><dir name="etc"><file name="config.xml" hash="e0e506976554e9cf0bdd96974ef8b99b"/><file name="system.xml" hash="16371c047bde096cfb408c858fb054d8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alfa9_AutoApplyRules.xml" hash="3114ce3891615f684d810c58b071adef"/><file name="Alfa9_Base.xml" hash="213a03817872916a7bf9f186c60215ec"/></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|