Version Notes
* Adicionado compatibilidade com prefixo em tabelas.
Para mais informações acesse:
https://github.com/AnyMarket/magento
Download this release
Release Info
Developer | Anymarket |
Extension | d7db67d0d012350a01ce05c31f91754d |
Version | 2.10.1 |
Comparing to | |
See all releases |
Code changes from version 2.5.1 to 2.10.1
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Grid.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php +0 -11
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php +10 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php +17 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php +36 -3
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php +1 -6
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php +1 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Buttoncheckconfig.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Callback.php +0 -0
- app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/buttoncheckconfig.php +0 -52
- app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php +0 -0
- app/code/community/DB1/AnyMarket/Helper/Brand.php +0 -0
- app/code/community/DB1/AnyMarket/Helper/Category.php +39 -10
- app/code/community/DB1/AnyMarket/Helper/Customergenerator.php +0 -0
- app/code/community/DB1/AnyMarket/Helper/Data.php +57 -3
- app/code/community/DB1/AnyMarket/Helper/Image.php +293 -0
- app/code/community/DB1/AnyMarket/Helper/Order.php +258 -58
- app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php +88 -51
- app/code/community/DB1/AnyMarket/Helper/Product.php +774 -541
- app/code/community/DB1/AnyMarket/Helper/Productgenerator.php +52 -44
- app/code/community/DB1/AnyMarket/Helper/Queue.php +81 -75
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketbrands.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php +11 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketbrands.php +11 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php +11 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketlog.php +4 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketorders.php +23 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php +19 -5
- app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php +11 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php +39 -5
- app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php +11 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Cron.php +7 -10
- app/code/community/DB1/AnyMarket/Model/Observer.php +105 -113
- app/code/community/DB1/AnyMarket/Model/PaymentMethod.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php +0 -0
- app/code/community/DB1/AnyMarket/Model/Resource/Setup.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Street/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Booleantp/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Price/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Set/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/General/Values.php +13 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Logs/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Measurementunit/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php +0 -0
- app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketbrandsController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php +2 -1
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/Adminhtml/AnymarketController.php +0 -0
- app/code/community/DB1/AnyMarket/controllers/IndexController.php +45 -16
- app/code/community/DB1/AnyMarket/etc/adminhtml.xml +0 -0
- app/code/community/DB1/AnyMarket/etc/api.xml +0 -0
- app/code/community/DB1/AnyMarket/etc/config.xml +11 -14
- app/code/community/DB1/AnyMarket/etc/system.xml +130 -36
- app/code/community/DB1/AnyMarket/etc/wsdl.xml +0 -0
- app/code/community/DB1/AnyMarket/etc/wsi.xml +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php +626 -586
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php +1 -1
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php +26 -25
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php +1 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php +1 -1
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php +4 -2
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php +1 -1
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php +29 -6
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.1.0-2.2.0.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.2.0-2.3.6.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.6-2.3.9.php +3 -2
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.9-2.4.0.php +1 -1
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.0-2.4.3.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.3-2.4.4.php +0 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.4-2.9.1.php +4 -0
- app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.1-2.9.2.php +28 -0
- app/design/adminhtml/default/default/layout/db1_anymarket.xml +0 -0
- app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml +0 -0
- app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/button_check_configuration.phtml +0 -0
- app/etc/modules/DB1_AnyMarket.xml +0 -0
- app/locale/en_US/DB1_AnyMarket.csv +6 -1
- app/locale/pt_BR/DB1_AnyMarket.csv +17 -2
- package.xml +14 -11
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Grid.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php
CHANGED
@@ -25,10 +25,7 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories extends Mage_Adminhtml_B
|
|
25 |
{
|
26 |
/**
|
27 |
* constructor
|
28 |
-
*
|
29 |
* @access public
|
30 |
-
* @return void
|
31 |
-
|
32 |
*/
|
33 |
public function __construct()
|
34 |
{
|
@@ -43,13 +40,5 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories extends Mage_Adminhtml_B
|
|
43 |
'onclick' => "setLocation('{$this->getUrl('*/*/sincCategs')}')",
|
44 |
'class' => 'add'
|
45 |
));
|
46 |
-
|
47 |
-
$message = Mage::helper('db1_anymarket')->__('Are you sure you want to export the categories?');
|
48 |
-
$this->_addButton('export_categ', array(
|
49 |
-
'label' => Mage::helper('db1_anymarket')->__('Export Categories'),
|
50 |
-
'onclick' => "confirmSetLocation('{$message}', '{$this->getUrl('*/*/exportCategs')}')",
|
51 |
-
'class' => 'scalable go'
|
52 |
-
));
|
53 |
-
|
54 |
}
|
55 |
}
|
25 |
{
|
26 |
/**
|
27 |
* constructor
|
|
|
28 |
* @access public
|
|
|
|
|
29 |
*/
|
30 |
public function __construct()
|
31 |
{
|
40 |
'onclick' => "setLocation('{$this->getUrl('*/*/sincCategs')}')",
|
41 |
'class' => 'add'
|
42 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
}
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php
CHANGED
@@ -69,6 +69,16 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tab_Form extends Ma
|
|
69 |
|
70 |
)
|
71 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$fieldset->addField(
|
73 |
'status',
|
74 |
'select',
|
69 |
|
70 |
)
|
71 |
);
|
72 |
+
$fieldset->addField(
|
73 |
+
'nmc_id_magento',
|
74 |
+
'text',
|
75 |
+
array(
|
76 |
+
'label' => Mage::helper('db1_anymarket')->__('Code in Magento'),
|
77 |
+
'name' => 'nmc_id_magento',
|
78 |
+
'required' => false
|
79 |
+
)
|
80 |
+
);
|
81 |
+
|
82 |
$fieldset->addField(
|
83 |
'status',
|
84 |
'select',
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php
CHANGED
@@ -89,6 +89,14 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid extends Mage_Adminh
|
|
89 |
'type' => 'number'
|
90 |
)
|
91 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
$this->addColumn(
|
93 |
'nmc_cat_desc',
|
94 |
array(
|
@@ -128,6 +136,15 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid extends Mage_Adminh
|
|
128 |
|
129 |
)
|
130 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
|
132 |
$this->addColumn(
|
133 |
'store_id',
|
89 |
'type' => 'number'
|
90 |
)
|
91 |
);
|
92 |
+
$this->addColumn(
|
93 |
+
'nmc_id_magento',
|
94 |
+
array(
|
95 |
+
'header' => Mage::helper('db1_anymarket')->__('Id magento'),
|
96 |
+
'index' => 'nmc_id_magento',
|
97 |
+
'type' => 'text'
|
98 |
+
)
|
99 |
+
);
|
100 |
$this->addColumn(
|
101 |
'nmc_cat_desc',
|
102 |
array(
|
136 |
|
137 |
)
|
138 |
);
|
139 |
+
$this->addColumn(
|
140 |
+
'nmc_id_magento',
|
141 |
+
array(
|
142 |
+
'header' => Mage::helper('db1_anymarket')->__('Code in Magento'),
|
143 |
+
'index' => 'nmc_id_magento',
|
144 |
+
'type'=> 'text',
|
145 |
+
|
146 |
+
)
|
147 |
+
);
|
148 |
if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
|
149 |
$this->addColumn(
|
150 |
'store_id',
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php
CHANGED
@@ -59,11 +59,44 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Form extends Mage_A
|
|
59 |
array(
|
60 |
'label' => Mage::helper('db1_anymarket')->__('Code Order Magento'),
|
61 |
'name' => 'nmo_id_order',
|
62 |
-
'required' =>
|
63 |
-
'class' => 'required-entry',
|
64 |
-
|
65 |
)
|
66 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
$fieldset->addField(
|
68 |
'status',
|
69 |
'select',
|
59 |
array(
|
60 |
'label' => Mage::helper('db1_anymarket')->__('Code Order Magento'),
|
61 |
'name' => 'nmo_id_order',
|
62 |
+
'required' => false
|
|
|
|
|
63 |
)
|
64 |
);
|
65 |
+
|
66 |
+
$fieldset->addField(
|
67 |
+
'nmo_id_seq_anymarket',
|
68 |
+
'text',
|
69 |
+
array(
|
70 |
+
'label' => Mage::helper('db1_anymarket')->__('Code Order Seq Magento'),
|
71 |
+
'name' => 'nmo_id_seq_anymarket',
|
72 |
+
'required' => false
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
$fieldset->addField(
|
77 |
+
'nmo_status_int',
|
78 |
+
'text',
|
79 |
+
array(
|
80 |
+
'label' => Mage::helper('db1_anymarket')->__('Integration Status'),
|
81 |
+
'name' => 'nmo_status_int',
|
82 |
+
'required' => true,
|
83 |
+
'class' => 'required-entry',
|
84 |
+
|
85 |
+
)
|
86 |
+
);
|
87 |
+
|
88 |
+
$fieldset->addField(
|
89 |
+
'nmo_desc_error',
|
90 |
+
'text',
|
91 |
+
array(
|
92 |
+
'label' => Mage::helper('db1_anymarket')->__('Error Message'),
|
93 |
+
'name' => 'nmo_desc_error',
|
94 |
+
'required' => true,
|
95 |
+
'class' => 'required-entry',
|
96 |
+
|
97 |
+
)
|
98 |
+
);
|
99 |
+
|
100 |
$fieldset->addField(
|
101 |
'status',
|
102 |
'select',
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php
CHANGED
@@ -218,12 +218,7 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid extends Mage_Adminhtml_
|
|
218 |
*/
|
219 |
public function getRowUrl($row)
|
220 |
{
|
221 |
-
$
|
222 |
-
if($_pullOrder != null){
|
223 |
-
return Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $_pullOrder->getId()));
|
224 |
-
}else{
|
225 |
-
return null;
|
226 |
-
}
|
227 |
}
|
228 |
|
229 |
/**
|
218 |
*/
|
219 |
public function getRowUrl($row)
|
220 |
{
|
221 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
|
224 |
/**
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php
CHANGED
@@ -101,6 +101,7 @@ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid extends Mage_Adminhtml_B
|
|
101 |
'options' => array(
|
102 |
'ORDER' => Mage::helper('db1_anymarket')->__('Order'),
|
103 |
'PRODUCT' => Mage::helper('db1_anymarket')->__('Product'),
|
|
|
104 |
)
|
105 |
|
106 |
)
|
101 |
'options' => array(
|
102 |
'ORDER' => Mage::helper('db1_anymarket')->__('Order'),
|
103 |
'PRODUCT' => Mage::helper('db1_anymarket')->__('Product'),
|
104 |
+
'STOCK' => Mage::helper('db1_anymarket')->__('Stock')
|
105 |
)
|
106 |
|
107 |
)
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Buttoncheckconfig.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Callback.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/buttoncheckconfig.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class DB1_AnyMarket_Block_Adminhtml_System_Config_Form_Buttoncheckconfig extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
/*
|
5 |
-
* Set template
|
6 |
-
*/
|
7 |
-
protected function _construct()
|
8 |
-
{
|
9 |
-
parent::_construct();
|
10 |
-
$this->setTemplate('db1/anymarket/system/config/form/field/button_check_configuration.phtml');
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Return element html
|
15 |
-
*
|
16 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
-
{
|
21 |
-
return $this->_toHtml();
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Return ajax url for button
|
26 |
-
*
|
27 |
-
* @return string
|
28 |
-
*/
|
29 |
-
public function getAjaxCheckConfigUrl()
|
30 |
-
{
|
31 |
-
return Mage::helper('adminhtml')->getUrl('adminhtml/anymarket/checkconfig');
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Generate button html
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public function getButtonHtml()
|
40 |
-
{
|
41 |
-
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
-
->setData(array(
|
43 |
-
'id' => 'check_anymarket_button',
|
44 |
-
'label' => Mage::helper('db1_anymarket')->__('Check Configuration'),
|
45 |
-
'onclick' => 'javascript:checkconfig(); return false;'
|
46 |
-
));
|
47 |
-
|
48 |
-
return $button->toHtml();
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Helper/Brand.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Helper/Category.php
CHANGED
@@ -34,6 +34,7 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
34 |
}
|
35 |
$fItem = true;
|
36 |
$cCateg = 0;
|
|
|
37 |
foreach ($categories as $category) {
|
38 |
$intAM = $category->getData('categ_integra_anymarket');
|
39 |
|
@@ -43,14 +44,20 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
43 |
$fItem = false;
|
44 |
|
45 |
if($intAM == 1){
|
46 |
-
$
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
|
@@ -58,6 +65,26 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
58 |
return $cCateg;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* Delete Specific Category Recursively
|
63 |
*
|
@@ -174,6 +201,7 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
174 |
"name" => $name,
|
175 |
"partnerId" => $id,
|
176 |
"parent" => array("id" => $IdParent),
|
|
|
177 |
"calculatedPrice" => true
|
178 |
);
|
179 |
|
@@ -213,6 +241,7 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
213 |
$anymarketcategories->setNmcCatRootId( $IdParent != null ? $IdParent : '000' );
|
214 |
$anymarketcategories->setNmcCatDesc( $name );
|
215 |
$anymarketcategories->setNmcIdMagento( $id );
|
|
|
216 |
$anymarketcategories->setStatus('1');
|
217 |
$anymarketcategories->save();
|
218 |
|
@@ -277,7 +306,7 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
277 |
$arrOrderCod = null;
|
278 |
$this->arrNewCateg = array();
|
279 |
while ($startRec <= $countRec) {
|
280 |
-
$returnCat = $this->CallAPICurl("GET", $HOST."/
|
281 |
|
282 |
if($returnCat['error'] == '1'){
|
283 |
$startRec = 1;
|
@@ -344,7 +373,7 @@ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
|
|
344 |
* @return integer
|
345 |
*/
|
346 |
private function getChildCat($HOST, $headers, $catID, $IDCatRoot, $id_store){
|
347 |
-
$returnCatSpecific = $this->CallAPICurl("GET", $HOST."/
|
348 |
$CatSpecifivJSON = $returnCatSpecific['return'];
|
349 |
$retCategCount = 0;
|
350 |
if($returnCatSpecific['error'] == '0'){
|
34 |
}
|
35 |
$fItem = true;
|
36 |
$cCateg = 0;
|
37 |
+
$ctrlCateg = array();
|
38 |
foreach ($categories as $category) {
|
39 |
$intAM = $category->getData('categ_integra_anymarket');
|
40 |
|
44 |
$fItem = false;
|
45 |
|
46 |
if($intAM == 1){
|
47 |
+
$checkCategStr = $category->getPath()."_".$category->getParentId()."_".$category->getName();
|
48 |
+
|
49 |
+
if ( !in_array($checkCategStr, $ctrlCateg) ) {
|
50 |
+
$amCategParent = Mage::getModel('db1_anymarket/anymarketcategories')->load($category->getParentId(), 'nmc_id_magento');
|
51 |
+
if ($amCategParent->getData('nmc_cat_id')) {
|
52 |
+
$retuCateg = $this->exportSpecificCategory($category, $amCategParent->getData('nmc_cat_id'), $storeID);
|
53 |
+
} else {
|
54 |
+
$retuCateg = $this->exportSpecificCategory($category, null, $storeID);
|
55 |
+
}
|
56 |
+
if ($retuCateg) {
|
57 |
+
$cCateg++;
|
58 |
+
|
59 |
+
array_push($ctrlCateg, $checkCategStr);
|
60 |
+
}
|
61 |
}
|
62 |
}
|
63 |
|
65 |
return $cCateg;
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* get Specific Category by name
|
70 |
+
*
|
71 |
+
* @param $arrOfCategs
|
72 |
+
* @param integer
|
73 |
+
*/
|
74 |
+
function getCategoryByPathName( $arrOfCategs ){
|
75 |
+
$categoryMain = Mage::getResourceModel('catalog/category_collection')
|
76 |
+
->addFieldToFilter('name', reset($arrOfCategs))
|
77 |
+
->getFirstItem();
|
78 |
+
|
79 |
+
for ($i=1; $i < count($arrOfCategs); $i++) {
|
80 |
+
$categoryMain = $categoryMain->getChildrenCategories()
|
81 |
+
->addFieldToFilter('name', $arrOfCategs[$i])
|
82 |
+
->getFirstItem();
|
83 |
+
}
|
84 |
+
|
85 |
+
return $categoryMain->getId();
|
86 |
+
}
|
87 |
+
|
88 |
/**
|
89 |
* Delete Specific Category Recursively
|
90 |
*
|
201 |
"name" => $name,
|
202 |
"partnerId" => $id,
|
203 |
"parent" => array("id" => $IdParent),
|
204 |
+
"priceFactor" => 1,
|
205 |
"calculatedPrice" => true
|
206 |
);
|
207 |
|
241 |
$anymarketcategories->setNmcCatRootId( $IdParent != null ? $IdParent : '000' );
|
242 |
$anymarketcategories->setNmcCatDesc( $name );
|
243 |
$anymarketcategories->setNmcIdMagento( $id );
|
244 |
+
$anymarketcategories->setStores(array($storeID));
|
245 |
$anymarketcategories->setStatus('1');
|
246 |
$anymarketcategories->save();
|
247 |
|
306 |
$arrOrderCod = null;
|
307 |
$this->arrNewCateg = array();
|
308 |
while ($startRec <= $countRec) {
|
309 |
+
$returnCat = $this->CallAPICurl("GET", $HOST."/v2/categories/?offset=".$startRec."&limit=30", $headers, null);
|
310 |
|
311 |
if($returnCat['error'] == '1'){
|
312 |
$startRec = 1;
|
373 |
* @return integer
|
374 |
*/
|
375 |
private function getChildCat($HOST, $headers, $catID, $IDCatRoot, $id_store){
|
376 |
+
$returnCatSpecific = $this->CallAPICurl("GET", $HOST."/v2/categories/".$catID, $headers, null);
|
377 |
$CatSpecifivJSON = $returnCatSpecific['return'];
|
378 |
$retCategCount = 0;
|
379 |
if($returnCatSpecific['error'] == '0'){
|
app/code/community/DB1/AnyMarket/Helper/Customergenerator.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Helper/Data.php
CHANGED
@@ -55,6 +55,19 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
|
|
55 |
return $arrStores;
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* check if module is enabled
|
60 |
*/
|
@@ -152,6 +165,22 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
|
|
152 |
return $arrStores;
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
/**
|
156 |
* call curl
|
157 |
*
|
@@ -187,10 +216,12 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
|
|
187 |
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
188 |
|
189 |
if ( $status == 200 || $status == 204 || $status == 201 ) {
|
190 |
-
|
|
|
|
|
191 |
}else{
|
192 |
if($err){
|
193 |
-
$retorno = array("error" => "1", "json" => $data_string,"return" => 'Error Curl: '.$err );
|
194 |
}else{
|
195 |
$retJsonCurlResp = json_decode($curl_response);
|
196 |
|
@@ -213,7 +244,7 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
|
|
213 |
}
|
214 |
|
215 |
if($retString != ''){
|
216 |
-
$retorno = array("error" => "1", "json" => $data_string, "return" => $retString );
|
217 |
}else{
|
218 |
$retorno = array("error" => "1", "json" => $data_string, "return" => utf8_encode($curl_response) );
|
219 |
}
|
@@ -236,6 +267,29 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
|
|
236 |
return $retorno;
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
/**
|
240 |
* add message inbox of magento
|
241 |
*
|
55 |
return $arrStores;
|
56 |
}
|
57 |
|
58 |
+
/**
|
59 |
+
* return text with mask
|
60 |
+
*/
|
61 |
+
public function Mask($mask,$str){
|
62 |
+
$str = str_replace(" ","",$str);
|
63 |
+
|
64 |
+
for($i=0;$i<strlen($str);$i++){
|
65 |
+
$mask[strpos($mask,"#")] = $str[$i];
|
66 |
+
}
|
67 |
+
|
68 |
+
return $mask;
|
69 |
+
}
|
70 |
+
|
71 |
/**
|
72 |
* check if module is enabled
|
73 |
*/
|
165 |
return $arrStores;
|
166 |
}
|
167 |
|
168 |
+
/**
|
169 |
+
* format date time
|
170 |
+
*
|
171 |
+
* @param $date
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function formatDateTimeZone($date){
|
175 |
+
if($date) {
|
176 |
+
$timeZone = new DateTimeZone(Mage::getStoreConfig('general/locale/timezone'));
|
177 |
+
$DateTime = new DateTime($date, $timeZone);
|
178 |
+
return date_format($DateTime, 'Y-m-d\TH:i:sP');
|
179 |
+
}else{
|
180 |
+
return gmdate('Y-m-d\TH:i:s\Z');
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
/**
|
185 |
* call curl
|
186 |
*
|
216 |
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
217 |
|
218 |
if ( $status == 200 || $status == 204 || $status == 201 ) {
|
219 |
+
$retorno = array("error" => "0", "json" => $data_string, "return" => json_decode($curl_response));
|
220 |
+
}elseif ( $status == 404 || $status == 500 || $status == 503 ) {
|
221 |
+
$retorno = array("error" => "1", "json" => $data_string, "return" => json_encode($curl_response));
|
222 |
}else{
|
223 |
if($err){
|
224 |
+
$retorno = array("error" => "1", "json" => $data_string, "return" => 'Error Curl: '.$err );
|
225 |
}else{
|
226 |
$retJsonCurlResp = json_decode($curl_response);
|
227 |
|
244 |
}
|
245 |
|
246 |
if($retString != ''){
|
247 |
+
$retorno = array("error" => "1", "json" => $data_string, "return" => json_encode($retString) );
|
248 |
}else{
|
249 |
$retorno = array("error" => "1", "json" => $data_string, "return" => utf8_encode($curl_response) );
|
250 |
}
|
267 |
return $retorno;
|
268 |
}
|
269 |
|
270 |
+
/**
|
271 |
+
* unique array multidim
|
272 |
+
*
|
273 |
+
* @param $array
|
274 |
+
* @param $key
|
275 |
+
* @return array
|
276 |
+
*/
|
277 |
+
public function unique_multidim_array($array, $key) {
|
278 |
+
$temp_array = array();
|
279 |
+
$i = 0;
|
280 |
+
$key_array = array();
|
281 |
+
|
282 |
+
foreach($array as $val) {
|
283 |
+
if (!in_array($val[$key], $key_array)) {
|
284 |
+
$key_array[$i] = $val[$key];
|
285 |
+
array_push($temp_array, $val);
|
286 |
+
}
|
287 |
+
$i++;
|
288 |
+
}
|
289 |
+
|
290 |
+
return $temp_array;
|
291 |
+
}
|
292 |
+
|
293 |
/**
|
294 |
* add message inbox of magento
|
295 |
*
|
app/code/community/DB1/AnyMarket/Helper/Image.php
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class DB1_AnyMarket_Helper_Image extends DB1_AnyMarket_Helper_Data
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* //obtem as imagens do produto(Config ou Simples)
|
8 |
+
* @param $storeID
|
9 |
+
* @param $product
|
10 |
+
*
|
11 |
+
* @return array
|
12 |
+
*/
|
13 |
+
public function getImagesOfProduct($storeID, $product, $ArrVariationValues){
|
14 |
+
if($product) {
|
15 |
+
$transformToHttp = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_http_image_field', $storeID);
|
16 |
+
$itemsIMG = array();
|
17 |
+
$galleryData = $product->getMediaGalleryImages();
|
18 |
+
$exportImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_export_image_field', $storeID);
|
19 |
+
foreach ($galleryData as $g_image) {
|
20 |
+
$infoImg = getimagesize($g_image['url']);
|
21 |
+
$imgSize = filesize($g_image['path']);
|
22 |
+
$processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
|
23 |
+
if ($processImage == 0) {
|
24 |
+
if (($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
|
25 |
+
if ($exportImage == 0) {
|
26 |
+
array_push($arrProd, 'Image_a (' . $g_image['url'] . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
|
27 |
+
} else {
|
28 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
29 |
+
$anymarketlog->setLogDesc('Error on export image - ' . $g_image['url']);
|
30 |
+
$anymarketlog->setLogId($product->getSku());
|
31 |
+
$anymarketlog->setStatus("1");
|
32 |
+
$anymarketlog->setStores(array($storeID));
|
33 |
+
$anymarketlog->save();
|
34 |
+
}
|
35 |
+
} else {
|
36 |
+
$urlImageImport = $g_image['url'];
|
37 |
+
$defaultImage = $product->getImage();
|
38 |
+
$isMain = strpos($urlImageImport, $defaultImage) === false ? false : true;
|
39 |
+
if ($ArrVariationValues) {
|
40 |
+
foreach ($ArrVariationValues as $value) {
|
41 |
+
if ($transformToHttp != 0) {
|
42 |
+
$urlImageImport = str_replace("https", "http", $urlImageImport);
|
43 |
+
}
|
44 |
+
$itemsIMG[] = array(
|
45 |
+
"main" => $isMain,
|
46 |
+
"url" => $urlImageImport,
|
47 |
+
"variation" => $value,
|
48 |
+
);
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
if ($transformToHttp != 0) {
|
52 |
+
$urlImageImport = str_replace("https", "http", $urlImageImport);
|
53 |
+
}
|
54 |
+
|
55 |
+
$itemsIMG[] = array(
|
56 |
+
"main" => $isMain,
|
57 |
+
"url" => $urlImageImport
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
if (count($product->getMediaGalleryImages()) > 0) {
|
64 |
+
$with = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_width_image_field', $storeID);
|
65 |
+
$height = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_height_image_field', $storeID);
|
66 |
+
foreach ($product->getMediaGalleryImages() as $_image) {
|
67 |
+
if (((int)$with > 0) && ((int)$height > 0)) {
|
68 |
+
$thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $_image->getFile())->resize($with, $height);
|
69 |
+
} else {
|
70 |
+
$thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $_image->getFile());
|
71 |
+
}
|
72 |
+
$thumbnail13 = str_replace('/webApps/migration/productapi/new/', '/', $thumbnail12);
|
73 |
+
$urlImageImport = $thumbnail13;
|
74 |
+
if ($ArrVariationValues) {
|
75 |
+
foreach ($ArrVariationValues as $value) {
|
76 |
+
if ($transformToHttp != 0) {
|
77 |
+
$urlImageImport = str_replace("https", "http", $urlImageImport);
|
78 |
+
}
|
79 |
+
$itemsIMG[] = array(
|
80 |
+
"main" => false,
|
81 |
+
"url" => $urlImageImport,
|
82 |
+
"variation" => $value,
|
83 |
+
);
|
84 |
+
}
|
85 |
+
} else {
|
86 |
+
if ($transformToHttp != 0) {
|
87 |
+
$urlImageImport = str_replace("https", "http", $urlImageImport);
|
88 |
+
}
|
89 |
+
|
90 |
+
$itemsIMG[] = array(
|
91 |
+
"main" => true,
|
92 |
+
"url" => $urlImageImport
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
return $itemsIMG;
|
102 |
+
}else{
|
103 |
+
return null;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
public function processImageToAdd($storeID, $imgProdMagentoURL){
|
108 |
+
|
109 |
+
return $imgProdMagentoURL;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
*
|
114 |
+
* Send Image to Anymarket
|
115 |
+
*
|
116 |
+
* @param $storeID
|
117 |
+
* @param $product
|
118 |
+
* @param $variation
|
119 |
+
*
|
120 |
+
*/
|
121 |
+
public function sendImageToAnyMarket($storeID, $product, $variation){
|
122 |
+
if($product){
|
123 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $product->getId() );
|
124 |
+
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
125 |
+
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
126 |
+
$exportImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_export_image_field', $storeID);
|
127 |
+
$transformToHttp = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_http_image_field', $storeID);
|
128 |
+
|
129 |
+
$headers = array(
|
130 |
+
"Content-type: application/json",
|
131 |
+
"gumgaToken: ".$TOKEN
|
132 |
+
);
|
133 |
+
|
134 |
+
if($product->getData('id_anymarket') != ''){
|
135 |
+
$imgGetRet = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images", $headers, null);
|
136 |
+
if($imgGetRet['error'] == '0'){
|
137 |
+
$imgsProdAnymarket = $imgGetRet['return'];
|
138 |
+
|
139 |
+
$arrAdd = array();
|
140 |
+
$arrImgs = array();
|
141 |
+
|
142 |
+
$processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
|
143 |
+
$imgsProdMagento = $product->getMediaGalleryImages();
|
144 |
+
|
145 |
+
if (count($imgsProdMagento) <= 0) {
|
146 |
+
$productIMG = Mage::getModel('catalog/product')->load( $product->getId() );
|
147 |
+
$imgsProdMagento = $productIMG->getMediaGalleryImages();
|
148 |
+
}
|
149 |
+
|
150 |
+
if (count($imgsProdMagento) > 0) {
|
151 |
+
if( $processImage == 0 ) {
|
152 |
+
foreach ($imgsProdMagento as $imgProdMagento) {
|
153 |
+
$urlImage = $imgProdMagento->getData('url');
|
154 |
+
$infoImg = getimagesize($urlImage);
|
155 |
+
$imgSize = filesize($imgProdMagento->getData('path'));
|
156 |
+
if (($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
|
157 |
+
if ($exportImage == 0) {
|
158 |
+
array_push($arrProd, 'Image_c (' . $urlImage . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
|
159 |
+
} else {
|
160 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
161 |
+
$anymarketlog->setLogDesc('Error on export image - ' . $urlImage);
|
162 |
+
$anymarketlog->setLogId($product->getSku());
|
163 |
+
$anymarketlog->setStatus("1");
|
164 |
+
$anymarketlog->setStores(array($storeID));
|
165 |
+
$anymarketlog->save();
|
166 |
+
}
|
167 |
+
} else {
|
168 |
+
$imgProdMagentoURL = $imgProdMagento->getData('url');
|
169 |
+
if ($transformToHttp != 0) {
|
170 |
+
$imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
|
171 |
+
}
|
172 |
+
array_push($arrAdd, $imgProdMagentoURL);
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}else {
|
176 |
+
$with = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_width_image_field', $storeID);
|
177 |
+
$height = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_height_image_field', $storeID);
|
178 |
+
foreach ($imgsProdMagento as $imgProdMagento) {
|
179 |
+
if( ((int)$with > 0) && ((int)$height > 0) ){
|
180 |
+
$thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile())->resize($with, $height);
|
181 |
+
}else{
|
182 |
+
$thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile());
|
183 |
+
}
|
184 |
+
|
185 |
+
$imgProdMagentoURL = str_replace('/webApps/migration/productapi/new/', '/', $thumbnail12);
|
186 |
+
if ($transformToHttp != 0) {
|
187 |
+
$imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
|
188 |
+
}
|
189 |
+
array_push($arrAdd, $imgProdMagentoURL);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
foreach ($imgsProdAnymarket as $imgProdAnymarket) {
|
195 |
+
$exportImages = true;
|
196 |
+
if ($variation) {
|
197 |
+
if( !isset($imgProdAnymarket->variation) || $imgProdAnymarket->variation != $variation ){
|
198 |
+
$exportImages = false;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
if( $exportImages ) {
|
203 |
+
$imgRemove = $imgProdAnymarket->id;
|
204 |
+
$imgDelRet = $this->CallAPICurl("DELETE", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images/" . $imgRemove, $headers, null);
|
205 |
+
if ($imgDelRet['error'] == '1') {
|
206 |
+
$anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
|
207 |
+
|
208 |
+
if (is_string($imgDelRet['return'])) {
|
209 |
+
$anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . $imgDelRet['return']);
|
210 |
+
} else {
|
211 |
+
$anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . json_encode($imgDelRet['return']));
|
212 |
+
}
|
213 |
+
|
214 |
+
$anymarketlogDel->setLogJson('');
|
215 |
+
$anymarketlogDel->setLogId($product->getSku());
|
216 |
+
$anymarketlogDel->setStatus("1");
|
217 |
+
$anymarketlogDel->setStores(array($storeID));
|
218 |
+
$anymarketlogDel->save();
|
219 |
+
} else {
|
220 |
+
$anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
|
221 |
+
$anymarketlogDel->setLogDesc('Deleted image from Anymarket ');
|
222 |
+
$anymarketlogDel->setLogJson('');
|
223 |
+
$anymarketlogDel->setLogId($product->getSku());
|
224 |
+
$anymarketlogDel->setStatus("1");
|
225 |
+
$anymarketlogDel->setStores(array($storeID));
|
226 |
+
$anymarketlogDel->save();
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
// Add Image
|
233 |
+
if( !empty($arrImgs) ){
|
234 |
+
$returnProd['error'] = '1';
|
235 |
+
$returnProd['json'] = '';
|
236 |
+
|
237 |
+
$emptyFields = ' ';
|
238 |
+
foreach ($arrImgs as $field) {
|
239 |
+
$emptyFields .= $field.', ';
|
240 |
+
}
|
241 |
+
|
242 |
+
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').' '.$emptyFields;
|
243 |
+
$this->saveLogsProds($storeID, "0", $returnProd, $product);
|
244 |
+
}else {
|
245 |
+
$defaultImage = $product->getImage();
|
246 |
+
foreach ($arrAdd as $imgAdd) {
|
247 |
+
$isMain = strpos($imgAdd, $defaultImage) === false ? false : true;
|
248 |
+
if ($variation) {
|
249 |
+
$JSONAdd = array(
|
250 |
+
"url" => $imgAdd,
|
251 |
+
"variation" => $variation,
|
252 |
+
"main" => $isMain
|
253 |
+
);
|
254 |
+
} else {
|
255 |
+
$JSONAdd = array(
|
256 |
+
"url" => $imgAdd,
|
257 |
+
"main" => $isMain
|
258 |
+
);
|
259 |
+
}
|
260 |
+
|
261 |
+
$imgPostRet = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images", $headers, $JSONAdd);
|
262 |
+
if ($imgPostRet['error'] == '1') {
|
263 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
264 |
+
$anymarketlog->setLogDesc('Error on export image (' . $product->getData('id_anymarket') . ') - ' . is_string($imgPostRet['return']) ? $imgPostRet['return'] : json_encode($imgPostRet['return']));
|
265 |
+
$anymarketlog->setLogJson($imgPostRet['json']);
|
266 |
+
$anymarketlog->setLogId($product->getSku());
|
267 |
+
$anymarketlog->setStatus("1");
|
268 |
+
$anymarketlog->setStores(array($storeID));
|
269 |
+
$anymarketlog->save();
|
270 |
+
} else {
|
271 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
272 |
+
$anymarketlog->setLogDesc('Exported image (' . $imgAdd . ')');
|
273 |
+
$anymarketlog->setLogJson($imgPostRet['json']);
|
274 |
+
$anymarketlog->setLogId($product->getSku());
|
275 |
+
$anymarketlog->setStatus("1");
|
276 |
+
$anymarketlog->setStores(array($storeID));
|
277 |
+
$anymarketlog->save();
|
278 |
+
}
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
}else{
|
283 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
284 |
+
$anymarketlog->setLogDesc( 'Error on get images from Anymarket ('.$product->getData('id_anymarket').') ');
|
285 |
+
$anymarketlog->setStatus("1");
|
286 |
+
$anymarketlog->setStores(array($storeID));
|
287 |
+
$anymarketlog->save();
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
app/code/community/DB1/AnyMarket/Helper/Order.php
CHANGED
@@ -57,8 +57,10 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
57 |
$anymarketorders->setStatus("0");
|
58 |
$anymarketorders->setNmoStatusInt($statusInt);
|
59 |
$anymarketorders->setNmoDescError($descError);
|
60 |
-
|
|
|
61 |
$anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
|
|
|
62 |
$anymarketorders->setNmoIdOrder($nmoIdOrder);
|
63 |
$anymarketorders->setStores(array($storeID));
|
64 |
$anymarketorders->save();
|
@@ -152,7 +154,7 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
152 |
* @param $shippValue
|
153 |
* @return integer
|
154 |
*/
|
155 |
-
private function create_order($anymarketordersSpec, $products, $customer, $IDAnyMarket, $IDSeqAnyMarket, $infoMetPag, $Billing, $Shipping, $shippValue, $
|
156 |
{
|
157 |
if( ($anymarketordersSpec->getData('nmo_id_anymarket') == null) ||
|
158 |
($anymarketordersSpec->getData('nmo_status_int') == "Não integrado (AnyMarket)") ||
|
@@ -170,8 +172,11 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
170 |
$orderGenerator->setBillAddress($Billing);
|
171 |
$orderGenerator->setCustomer($customer);
|
172 |
$orderGenerator->setCpfCnpj($customer->getData($AttrToDoc));
|
|
|
|
|
|
|
|
|
173 |
|
174 |
-
$CodOrder = $orderGenerator->createOrder($products);
|
175 |
|
176 |
$this->saveLogOrder('nmo_id_anymarket', $IDAnyMarket, 'Integrado', '', $IDSeqAnyMarket, $IDAnyMarket, $CodOrder, $storeID);
|
177 |
|
@@ -194,28 +199,34 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
194 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
195 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
196 |
|
197 |
-
$
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$returnProd = $this->CallAPICurl("GET", $HOST."/v2/orders/feeds?limit=100", $headers, null);
|
204 |
|
205 |
-
|
206 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
207 |
-
$anymarketlog->setLogDesc( 'Error on get feed orders '. $returnProd['return'] );
|
208 |
-
$anymarketlog->setStatus("1");
|
209 |
-
$anymarketlog->save();
|
210 |
-
}else{
|
211 |
-
$listOrders = $returnProd['return'];
|
212 |
|
213 |
-
|
214 |
-
$
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
}
|
220 |
}
|
221 |
}
|
@@ -259,7 +270,17 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
259 |
if (strpos($statusMage, 'ERROR:') === false) {
|
260 |
//TRATA OS PRODUTOS
|
261 |
$_products = array();
|
|
|
262 |
foreach ($OrderJSON->items as $item) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
$productLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $item->sku->partnerId);
|
264 |
if ($productLoaded) {
|
265 |
$arrayTMP = array(
|
@@ -267,6 +288,21 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
267 |
'price' => $item->unit,
|
268 |
'qty' => $item->amount,
|
269 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
array_push($_products, $arrayTMP);
|
271 |
} else {
|
272 |
if ($anymarketordersSpec->getData('nmo_id_anymarket') == null) {
|
@@ -313,10 +349,32 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
313 |
$groupCustomer = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_customer_group_field', $storeID);
|
314 |
|
315 |
$email = $OrderJSON->buyer->email;
|
|
|
316 |
$customer = Mage::getModel('customer/customer')
|
317 |
->getCollection()
|
318 |
->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
|
319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
$AddressShipBill = null;
|
321 |
|
322 |
$firstName = $OrderJSON->buyer->name;
|
@@ -416,16 +474,42 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
416 |
}
|
417 |
|
418 |
$infoMetPag = 'ANYMARKET';
|
419 |
-
|
420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
}
|
422 |
|
423 |
-
|
|
|
424 |
$OrderCheck = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
|
425 |
|
426 |
$this->changeFeedOrder($HOST, $headers, $idSeqAnyMarket, $tokenFeed);
|
427 |
|
428 |
if ($OrderCheck->getId()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
$this->changeStatusOrder($storeID, $OrderJSON, $OrderIDMage);
|
430 |
}
|
431 |
} catch (Exception $e) {
|
@@ -523,11 +607,31 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
523 |
|
524 |
}
|
525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
/**
|
527 |
* change status order
|
528 |
*
|
|
|
529 |
* @param $JSON
|
530 |
* @param $IDOrderMagento
|
|
|
|
|
531 |
*/
|
532 |
private function changeStatusOrder($storeID, $JSON, $IDOrderMagento){
|
533 |
$StatusPedAnyMarket = $JSON->status;
|
@@ -538,10 +642,31 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
538 |
|
539 |
if (strpos($statusMage, 'ERROR:') === false) {
|
540 |
Mage::getSingleton('core/session')->setImportOrdersVariable('false');
|
541 |
-
|
542 |
$order = Mage::getModel('sales/order')->loadByIncrementId( $IDOrderMagento );
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
$itemsarray = null;
|
544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
if( $order->canInvoice() ){
|
546 |
if(isset($JSON->invoice->accessKey) ) {
|
547 |
$nfe = $JSON->invoice->accessKey;
|
@@ -550,22 +675,43 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
550 |
$DateTime = strtotime($dateNfe);
|
551 |
$fixedDate = date('d/m/Y H:i:s', $DateTime);
|
552 |
|
553 |
-
$
|
554 |
-
|
555 |
-
$
|
556 |
-
|
557 |
-
|
|
|
|
|
558 |
}
|
559 |
|
560 |
if (!$order->hasInvoices()) {
|
561 |
$nfeString = 'nfe:' . $nfe . ', emissao:' . $fixedDate;
|
562 |
Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray, $nfeString, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
}
|
565 |
}
|
566 |
}
|
567 |
|
568 |
-
if(isset($JSON->tracking)){
|
569 |
if( $order->canShip() && !$order->hasShipments() ){
|
570 |
if(isset($JSON->tracking->number)) {
|
571 |
$TrNumber = $JSON->tracking->number;
|
@@ -575,10 +721,10 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
575 |
|
576 |
$TracCodeArr = Mage::getModel('sales/order_shipment_api')->getCarriers($order->getIncrementId());
|
577 |
if (isset($TracCodeArr[$TrCarrier])) {
|
578 |
-
|
579 |
} else {
|
580 |
$arrVar = array_keys($TracCodeArr);
|
581 |
-
|
582 |
}
|
583 |
}
|
584 |
}
|
@@ -591,6 +737,20 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
591 |
}
|
592 |
$order->setData('state', $stateMage);
|
593 |
$order->setStatus($statusMage, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
$order->save();
|
595 |
}
|
596 |
|
@@ -616,12 +776,6 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
616 |
$anymarketlog->setLogId( $IDOrderMagento );
|
617 |
$anymarketlog->setStatus("0");
|
618 |
$anymarketlog->save();
|
619 |
-
/*
|
620 |
-
$this->addMessageInBox(Mage::helper('db1_anymarket')->__('Error on synchronize order.'),
|
621 |
-
Mage::helper('db1_anymarket')->__('Error synchronizing order number: ')."Magento(".$IDOrderMagento.") <br/>".
|
622 |
-
$statusMage,
|
623 |
-
'');
|
624 |
-
*/
|
625 |
}
|
626 |
}
|
627 |
|
@@ -651,7 +805,8 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
651 |
|
652 |
$date = substr( $CommentCurr, $emissaoCount+8, 19);
|
653 |
$dateTmp = str_replace("/", "-", $date );
|
654 |
-
|
|
|
655 |
}
|
656 |
}
|
657 |
}
|
@@ -662,6 +817,7 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
662 |
$CommentCurr = $item->getComment();
|
663 |
|
664 |
$CommentCurr = str_replace(array(" ", "<b>", "</b>"), "", $CommentCurr );
|
|
|
665 |
$chaveAcesso = strpos($CommentCurr, 'ChavedeAcesso:');
|
666 |
if( (strpos($CommentCurr, 'ChavedeAcesso:') !== false) ) {
|
667 |
$chaveAcID = substr( $CommentCurr, $chaveAcesso+14, 44);
|
@@ -670,13 +826,44 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
670 |
if( (strpos($CommentCurr, 'Notafiscal:') !== false) ) {
|
671 |
$endNF = strpos($CommentCurr, '<br/>');
|
672 |
$nfeID = substr( $CommentCurr, $notaFiscal+11, $endNF-11);
|
|
|
|
|
|
|
|
|
673 |
}
|
674 |
-
|
|
|
|
|
675 |
break;
|
676 |
}
|
677 |
}
|
678 |
}
|
679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
$retArr = array("number" => $nfeID, "date" => $date, "accessKey" => $chaveAcID);
|
681 |
return $retArr;
|
682 |
}
|
@@ -684,12 +871,13 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
684 |
/**
|
685 |
* get tracking order
|
686 |
*
|
|
|
687 |
* @param $Order
|
688 |
* @return array
|
689 |
*/
|
690 |
-
public function getTrackingOrder($Order){
|
691 |
$TrackNum = '';
|
692 |
-
$
|
693 |
$TrackCreate = '';
|
694 |
$dateTrack = '';
|
695 |
|
@@ -699,15 +887,24 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
699 |
foreach ($shipmentCollection as $shipment){
|
700 |
foreach($shipment->getAllTracks() as $tracknum){
|
701 |
$TrackNum = $tracknum->getNumber();
|
702 |
-
$
|
703 |
$TrackCreate = $tracknum->getCreatedAt();
|
704 |
|
705 |
-
$dateTmp = str_replace("/", "-", $TrackCreate );
|
706 |
-
$dateTrack =
|
707 |
}
|
708 |
}
|
709 |
|
710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
}
|
712 |
|
713 |
/**
|
@@ -744,7 +941,7 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
744 |
);
|
745 |
|
746 |
$invoiceData = $this->getInvoiceOrder($Order);
|
747 |
-
$trackingData = $this->getTrackingOrder($Order);
|
748 |
|
749 |
if ($invoiceData['number'] != '') {
|
750 |
$params["invoice"] = $invoiceData;
|
@@ -811,7 +1008,7 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
811 |
*/
|
812 |
private function sendOrderToAnyMarket($storeID, $idOrder, $HOST, $TOKEN){
|
813 |
$ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
814 |
-
if($ConfigOrder == 0){
|
815 |
$Order = Mage::getModel('sales/order')->setStoreId($storeID)->loadByIncrementId( $idOrder );
|
816 |
|
817 |
//TRATA OS ITEMS
|
@@ -855,10 +1052,11 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
855 |
$statuAM = $this->getStatusMageToAnyMarketOrderConfig($storeID, $statusOrder);
|
856 |
}
|
857 |
|
|
|
858 |
if( (strpos($statuAM, 'ERROR:') === false) && ($statuAM != '') ) {
|
859 |
$params = array(
|
860 |
'marketPlaceId' => $idOrder,
|
861 |
-
"createdAt" =>
|
862 |
"status" => $statuAM,
|
863 |
"marketPlace" => "ECOMMERCE",
|
864 |
"marketPlaceStatus" => $statuAM,
|
@@ -868,6 +1066,10 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
868 |
"state" => $shipping->getRegion(),
|
869 |
"country" => $shipping->getCountry(),
|
870 |
"address" => $shipping->getStreetFull(),
|
|
|
|
|
|
|
|
|
871 |
"zipCode" => $shipping->getPostcode()
|
872 |
),
|
873 |
"buyer" => array(
|
@@ -886,13 +1088,13 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
886 |
"value" => $Order->getBaseGrandTotal()
|
887 |
),
|
888 |
),
|
889 |
-
"discount" => $Order->getDiscountAmount(),
|
890 |
"freight" => $Order->getShippingAmount(),
|
891 |
-
"gross" => $Order->
|
892 |
"total" => $Order->getBaseGrandTotal()
|
893 |
);
|
894 |
|
895 |
-
$arrTracking = $this->getTrackingOrder($Order);
|
896 |
$arrInvoice = $this->getInvoiceOrder($Order);
|
897 |
|
898 |
if($arrTracking["number"] != ''){
|
@@ -1028,8 +1230,6 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
|
|
1028 |
$anymarketorders->setStatus("0");
|
1029 |
$anymarketorders->setNmoStatusInt('Não integrado (Magento)');
|
1030 |
$anymarketorders->setNmoDescError('');
|
1031 |
-
$anymarketorders->setNmoIdSeqAnymarket('');
|
1032 |
-
$anymarketorders->setNmoIdAnymarket('');
|
1033 |
$anymarketorders->setNmoIdOrder( $orderId );
|
1034 |
$anymarketorders->setStores(array($storeID));
|
1035 |
$anymarketorders->save();
|
57 |
$anymarketorders->setStatus("0");
|
58 |
$anymarketorders->setNmoStatusInt($statusInt);
|
59 |
$anymarketorders->setNmoDescError($descError);
|
60 |
+
|
61 |
+
$anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
|
62 |
$anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
|
63 |
+
|
64 |
$anymarketorders->setNmoIdOrder($nmoIdOrder);
|
65 |
$anymarketorders->setStores(array($storeID));
|
66 |
$anymarketorders->save();
|
154 |
* @param $shippValue
|
155 |
* @return integer
|
156 |
*/
|
157 |
+
private function create_order($storeID, $anymarketordersSpec, $products, $customer, $IDAnyMarket, $IDSeqAnyMarket, $infoMetPag, $Billing, $Shipping, $shippValue, $ShippingDesc)
|
158 |
{
|
159 |
if( ($anymarketordersSpec->getData('nmo_id_anymarket') == null) ||
|
160 |
($anymarketordersSpec->getData('nmo_status_int') == "Não integrado (AnyMarket)") ||
|
172 |
$orderGenerator->setBillAddress($Billing);
|
173 |
$orderGenerator->setCustomer($customer);
|
174 |
$orderGenerator->setCpfCnpj($customer->getData($AttrToDoc));
|
175 |
+
$orderGenerator->setShippingDescription($ShippingDesc);
|
176 |
+
|
177 |
+
$CodOrder = $orderGenerator->createOrder($storeID, $products);
|
178 |
+
|
179 |
|
|
|
180 |
|
181 |
$this->saveLogOrder('nmo_id_anymarket', $IDAnyMarket, 'Integrado', '', $IDSeqAnyMarket, $IDAnyMarket, $CodOrder, $storeID);
|
182 |
|
199 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
200 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
201 |
|
202 |
+
if( $TOKEN != '' && $TOKEN != null ) {
|
203 |
+
$headers = array(
|
204 |
+
"Content-type: application/json",
|
205 |
+
"Accept: */*",
|
206 |
+
"gumgaToken: " . $TOKEN
|
207 |
+
);
|
|
|
208 |
|
209 |
+
$returnProd = $this->CallAPICurl("GET", $HOST . "/v2/orders/feeds?limit=100", $headers, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
+
if ($returnProd['error'] == '1') {
|
212 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
213 |
+
$anymarketlog->setLogDesc('Error on get feed orders ' . $returnProd['return']);
|
214 |
+
$anymarketlog->setStatus("1");
|
215 |
+
$anymarketlog->save();
|
216 |
+
} else {
|
217 |
+
$listOrders = $returnProd['return'];
|
218 |
+
foreach ($listOrders as $order) {
|
219 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
220 |
+
$anymarketlog->setLogDesc('Consumed Order from feed: ' . $order->id . ' with token: ' . $order->token);
|
221 |
+
$anymarketlog->setStatus("1");
|
222 |
+
$anymarketlog->save();
|
223 |
+
|
224 |
+
$this->getSpecificOrderFromAnyMarket($order->id, $order->token, $storeID);
|
225 |
+
|
226 |
+
$paramFeed = array(
|
227 |
+
"token" => $order->token
|
228 |
+
);
|
229 |
+
$this->CallAPICurl("PUT", $HOST . "/rest/api/v2/orders/feeds/" . $order->id, $headers, $paramFeed);
|
230 |
}
|
231 |
}
|
232 |
}
|
270 |
if (strpos($statusMage, 'ERROR:') === false) {
|
271 |
//TRATA OS PRODUTOS
|
272 |
$_products = array();
|
273 |
+
$shippingDesc = array();
|
274 |
foreach ($OrderJSON->items as $item) {
|
275 |
+
|
276 |
+
if( isset($item->shippings) ) {
|
277 |
+
foreach ($item->shippings as $shippItem) {
|
278 |
+
if (!in_array($shippItem->shippingtype, $shippingDesc)) {
|
279 |
+
array_push($shippingDesc, $shippItem->shippingtype);
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
$productLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $item->sku->partnerId);
|
285 |
if ($productLoaded) {
|
286 |
$arrayTMP = array(
|
288 |
'price' => $item->unit,
|
289 |
'qty' => $item->amount,
|
290 |
);
|
291 |
+
|
292 |
+
if($productLoaded->getTypeID() == "bundle") {
|
293 |
+
$optionsBundle = Mage::helper('db1_anymarket/product')->getDetailsOfBundle($productLoaded);
|
294 |
+
|
295 |
+
$boundOpt = array();
|
296 |
+
$boundOptQty = array();
|
297 |
+
foreach ($optionsBundle as $detProd) {
|
298 |
+
$boundOpt[$detProd['option_id']] = $detProd['selection_id'];
|
299 |
+
$boundOptQty[$detProd['option_id']] = $detProd['selection_qty'];
|
300 |
+
}
|
301 |
+
|
302 |
+
$arrayTMP['bundle_option'] = $boundOpt;
|
303 |
+
$arrayTMP['bundle_option_qty'] = $boundOptQty;
|
304 |
+
}
|
305 |
+
|
306 |
array_push($_products, $arrayTMP);
|
307 |
} else {
|
308 |
if ($anymarketordersSpec->getData('nmo_id_anymarket') == null) {
|
349 |
$groupCustomer = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_customer_group_field', $storeID);
|
350 |
|
351 |
$email = $OrderJSON->buyer->email;
|
352 |
+
|
353 |
$customer = Mage::getModel('customer/customer')
|
354 |
->getCollection()
|
355 |
->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
|
356 |
|
357 |
+
//caso nao ache pelo CPF valida se nao tem mascara
|
358 |
+
if(!$customer->getId()) {
|
359 |
+
if (strlen($document) == 11) {
|
360 |
+
$document = $this->Mask('###.###.###-##', $document);
|
361 |
+
} else {
|
362 |
+
$document = $this->Mask('##.###.###/####-##', $document);
|
363 |
+
}
|
364 |
+
|
365 |
+
$customer = Mage::getModel('customer/customer')
|
366 |
+
->getCollection()
|
367 |
+
->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
|
368 |
+
|
369 |
+
//caso ainda nao encontrou valida se existe o email
|
370 |
+
if(!$customer->getId()) {
|
371 |
+
$customer = Mage::getModel('customer/customer')
|
372 |
+
->getCollection()
|
373 |
+
->addFieldToFilter('email', $email)->load()->getFirstItem();
|
374 |
+
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
$AddressShipBill = null;
|
379 |
|
380 |
$firstName = $OrderJSON->buyer->name;
|
474 |
}
|
475 |
|
476 |
$infoMetPag = 'ANYMARKET';
|
477 |
+
$infoMetPagCom = array();
|
478 |
+
if( isset($OrderJSON->payments) ) {
|
479 |
+
foreach ($OrderJSON->payments as $payment) {
|
480 |
+
$infoMetPag = $payment->method;
|
481 |
+
if($payment->paymentMethodNormalized) {
|
482 |
+
array_push($infoMetPagCom, $payment->paymentMethodNormalized." - Parcelas: ".$payment->installments);
|
483 |
+
}
|
484 |
+
}
|
485 |
}
|
486 |
|
487 |
+
//REFACTOR
|
488 |
+
$OrderIDMage = $this->create_order($storeID, $anymarketordersSpec, $_products, $customer, $IDOrderAnyMarket, $idSeqAnyMarket, $infoMetPag, $AddressShipBill, $AddressShipBill, $OrderJSON->freight, implode(",", $shippingDesc) );
|
489 |
$OrderCheck = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
|
490 |
|
491 |
$this->changeFeedOrder($HOST, $headers, $idSeqAnyMarket, $tokenFeed);
|
492 |
|
493 |
if ($OrderCheck->getId()) {
|
494 |
+
$comment = '<b>Código do Pedido no Canal de Vendas: </b>'.$OrderJSON->marketPlaceNumber.'<br>';
|
495 |
+
$comment .= '<b>Canal de Vendas: </b>'.$OrderJSON->marketPlace.'<br>';
|
496 |
+
|
497 |
+
if( count($infoMetPagCom) > 0 ) {
|
498 |
+
foreach ($infoMetPagCom as $iMetPag) {
|
499 |
+
$comment .= '<b>Forma de Pagamento: </b>' . $iMetPag . '<br>';
|
500 |
+
}
|
501 |
+
}else{
|
502 |
+
$comment .= '<b>Forma de Pagamento: </b>Inf. não disponibilizada pelo marketplace.<br>';
|
503 |
+
}
|
504 |
+
|
505 |
+
$addressComp = (isset($OrderJSON->shipping->address)) ? $OrderJSON->shipping->address : 'Não especificado';
|
506 |
+
$comment .= '<b>Endereço Completo: </b>'.$addressComp;
|
507 |
+
|
508 |
+
$OrderCheck->addStatusHistoryComment( $comment );
|
509 |
+
$OrderCheck->setEmailSent(false);
|
510 |
+
$OrderCheck->save();
|
511 |
+
|
512 |
+
|
513 |
$this->changeStatusOrder($storeID, $OrderJSON, $OrderIDMage);
|
514 |
}
|
515 |
} catch (Exception $e) {
|
607 |
|
608 |
}
|
609 |
|
610 |
+
private function checkIfCanCreateInvoice($Order){
|
611 |
+
$continueOrder = true;
|
612 |
+
foreach ($Order->getInvoiceCollection() as $inv) {
|
613 |
+
$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId( $inv->getIncrementId() );
|
614 |
+
foreach ($invoice->getCommentsCollection() as $item) {
|
615 |
+
$CommentCurr = $item->getComment();
|
616 |
+
if ((strpos($CommentCurr, 'Registro de Pagamento criado por Anymarket') !== false)) {
|
617 |
+
$continueOrder = false;
|
618 |
+
break;
|
619 |
+
}
|
620 |
+
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
return $continueOrder;
|
625 |
+
}
|
626 |
+
|
627 |
/**
|
628 |
* change status order
|
629 |
*
|
630 |
+
* @param $storeID
|
631 |
* @param $JSON
|
632 |
* @param $IDOrderMagento
|
633 |
+
*
|
634 |
+
* @return boolean
|
635 |
*/
|
636 |
private function changeStatusOrder($storeID, $JSON, $IDOrderMagento){
|
637 |
$StatusPedAnyMarket = $JSON->status;
|
642 |
|
643 |
if (strpos($statusMage, 'ERROR:') === false) {
|
644 |
Mage::getSingleton('core/session')->setImportOrdersVariable('false');
|
|
|
645 |
$order = Mage::getModel('sales/order')->loadByIncrementId( $IDOrderMagento );
|
646 |
+
|
647 |
+
if( $order->getData('state') == $stateMage ){
|
648 |
+
return false;
|
649 |
+
}
|
650 |
+
|
651 |
+
$createRegPay = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_create_reg_pay_field', $storeID);
|
652 |
$itemsarray = null;
|
653 |
+
|
654 |
+
if( $createRegPay == "1" && $StatusPedAnyMarket == 'PAID_WAITING_SHIP' ){
|
655 |
+
if( $order->canInvoice() ){
|
656 |
+
if( $this->checkIfCanCreateInvoice($order) ) {
|
657 |
+
$orderItems = $order->getAllItems();
|
658 |
+
foreach ($orderItems as $_eachItem) {
|
659 |
+
$opid = $_eachItem->getId();
|
660 |
+
$qty = $_eachItem->getQtyOrdered();
|
661 |
+
$itemsarray[$opid] = $qty;
|
662 |
+
}
|
663 |
+
$nfeString = "Registro de Pagamento criado por Anymarket";
|
664 |
+
Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray, $nfeString, 0, 0);
|
665 |
+
}
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
if( isset($JSON->invoice) && $StatusPedAnyMarket == 'INVOICED' ){
|
670 |
if( $order->canInvoice() ){
|
671 |
if(isset($JSON->invoice->accessKey) ) {
|
672 |
$nfe = $JSON->invoice->accessKey;
|
675 |
$DateTime = strtotime($dateNfe);
|
676 |
$fixedDate = date('d/m/Y H:i:s', $DateTime);
|
677 |
|
678 |
+
if($itemsarray == null) {
|
679 |
+
$orderItems = $order->getAllItems();
|
680 |
+
foreach ($orderItems as $_eachItem) {
|
681 |
+
$opid = $_eachItem->getId();
|
682 |
+
$qty = $_eachItem->getQtyOrdered();
|
683 |
+
$itemsarray[$opid] = $qty;
|
684 |
+
}
|
685 |
}
|
686 |
|
687 |
if (!$order->hasInvoices()) {
|
688 |
$nfeString = 'nfe:' . $nfe . ', emissao:' . $fixedDate;
|
689 |
Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray, $nfeString, 0, 0);
|
690 |
+
}else{
|
691 |
+
$firstInvoiceID = $order->getInvoiceCollection()->getFirstItem()->getIncrementId();
|
692 |
+
$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId( $firstInvoiceID );
|
693 |
+
$addComment = true;
|
694 |
+
foreach ($invoice->getCommentsCollection() as $item) {
|
695 |
+
$CommentCurr = $item->getComment();
|
696 |
+
if ((strpos($CommentCurr, 'Adicionado por Anymarket - nfe:') !== false)) {
|
697 |
+
$addComment = false;
|
698 |
+
break;
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
if( $addComment ){
|
703 |
+
$nfeString = 'Adicionado por Anymarket - nfe:' . $nfe . ', emissao:' . $fixedDate;
|
704 |
+
|
705 |
+
$invoice->addComment($nfeString, "");
|
706 |
+
$invoice->setEmailSent(false);
|
707 |
+
$invoice->save();
|
708 |
+
}
|
709 |
}
|
710 |
}
|
711 |
}
|
712 |
}
|
713 |
|
714 |
+
if( isset($JSON->tracking) && $StatusPedAnyMarket == 'PAID_WAITING_DELIVERY' ){
|
715 |
if( $order->canShip() && !$order->hasShipments() ){
|
716 |
if(isset($JSON->tracking->number)) {
|
717 |
$TrNumber = $JSON->tracking->number;
|
721 |
|
722 |
$TracCodeArr = Mage::getModel('sales/order_shipment_api')->getCarriers($order->getIncrementId());
|
723 |
if (isset($TracCodeArr[$TrCarrier])) {
|
724 |
+
Mage::getModel('sales/order_shipment_api')->addTrack($shipmentId, $TrCarrier, $TrCarrier, $TrNumber);
|
725 |
} else {
|
726 |
$arrVar = array_keys($TracCodeArr);
|
727 |
+
Mage::getModel('sales/order_shipment_api')->addTrack($shipmentId, array_shift($arrVar), 'Não Econtrado(' . $TrCarrier . ')', $TrNumber);
|
728 |
}
|
729 |
}
|
730 |
}
|
737 |
}
|
738 |
$order->setData('state', $stateMage);
|
739 |
$order->setStatus($statusMage, true);
|
740 |
+
|
741 |
+
if($stateMage == Mage_Sales_Model_Order::STATE_CANCELED) {
|
742 |
+
foreach ($order->getAllItems() as $item) {
|
743 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct( $item->getProductId() );
|
744 |
+
if ($stockItem->getManageStock()) {
|
745 |
+
$stockItem->setData('qty', $stockItem->getQty() + $item->getQtyOrdered());
|
746 |
+
}
|
747 |
+
$stockItem->save();
|
748 |
+
|
749 |
+
$item->setQtyCanceled($item->getQtyOrdered());
|
750 |
+
$item->save();
|
751 |
+
}
|
752 |
+
}
|
753 |
+
|
754 |
$order->save();
|
755 |
}
|
756 |
|
776 |
$anymarketlog->setLogId( $IDOrderMagento );
|
777 |
$anymarketlog->setStatus("0");
|
778 |
$anymarketlog->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
779 |
}
|
780 |
}
|
781 |
|
805 |
|
806 |
$date = substr( $CommentCurr, $emissaoCount+8, 19);
|
807 |
$dateTmp = str_replace("/", "-", $date );
|
808 |
+
|
809 |
+
$date = $this->formatDateTimeZone($dateTmp);
|
810 |
}
|
811 |
}
|
812 |
}
|
817 |
$CommentCurr = $item->getComment();
|
818 |
|
819 |
$CommentCurr = str_replace(array(" ", "<b>", "</b>"), "", $CommentCurr );
|
820 |
+
$CommentCurr = str_replace(array("<br>"), "<br/>", $CommentCurr );
|
821 |
$chaveAcesso = strpos($CommentCurr, 'ChavedeAcesso:');
|
822 |
if( (strpos($CommentCurr, 'ChavedeAcesso:') !== false) ) {
|
823 |
$chaveAcID = substr( $CommentCurr, $chaveAcesso+14, 44);
|
826 |
if( (strpos($CommentCurr, 'Notafiscal:') !== false) ) {
|
827 |
$endNF = strpos($CommentCurr, '<br/>');
|
828 |
$nfeID = substr( $CommentCurr, $notaFiscal+11, $endNF-11);
|
829 |
+
|
830 |
+
if( $nfeID == "" ){
|
831 |
+
$nfeID = $chaveAcID;
|
832 |
+
}
|
833 |
}
|
834 |
+
|
835 |
+
$dateTmp = new DateTime(str_replace("/", "-", $item->getData('created_at') ));
|
836 |
+
$date = date_format($dateTmp, 'Y-m-d\TH:i:s\Z');
|
837 |
break;
|
838 |
}
|
839 |
}
|
840 |
}
|
841 |
|
842 |
+
if( $chaveAcID == "" ) {
|
843 |
+
if ($Order->hasShipments()){
|
844 |
+
foreach ($Order->getShipmentsCollection() as $ship) {
|
845 |
+
$shippment = Mage::getModel('sales/order_shipment')->loadByIncrementId( $ship->getIncrementId() );
|
846 |
+
foreach ($shippment->getCommentsCollection() as $item) {
|
847 |
+
$CommentCurr = $item->getComment();
|
848 |
+
|
849 |
+
$nfeCount = strpos($CommentCurr, 'nfe:');
|
850 |
+
$emissaoCount = strpos($CommentCurr, 'emiss');
|
851 |
+
if( (strpos($CommentCurr, 'nfe:') !== false) && (strpos($CommentCurr, 'emiss') !== false) ) {
|
852 |
+
$caracts = array("/", "-", ".");
|
853 |
+
$nfeTmp = str_replace($caracts, "", $CommentCurr );
|
854 |
+
$chaveAcID = substr( $nfeTmp, $nfeCount+4, 44);
|
855 |
+
$nfeID = $chaveAcID;
|
856 |
+
|
857 |
+
$date = substr( $CommentCurr, $emissaoCount+8, 19);
|
858 |
+
$dateTmp = str_replace("/", "-", $date );
|
859 |
+
|
860 |
+
$date = $this->formatDateTimeZone($dateTmp);
|
861 |
+
}
|
862 |
+
}
|
863 |
+
}
|
864 |
+
}
|
865 |
+
}
|
866 |
+
|
867 |
$retArr = array("number" => $nfeID, "date" => $date, "accessKey" => $chaveAcID);
|
868 |
return $retArr;
|
869 |
}
|
871 |
/**
|
872 |
* get tracking order
|
873 |
*
|
874 |
+
* * @param $storeID
|
875 |
* @param $Order
|
876 |
* @return array
|
877 |
*/
|
878 |
+
public function getTrackingOrder($storeID, $Order){
|
879 |
$TrackNum = '';
|
880 |
+
$TrackTitle = '';
|
881 |
$TrackCreate = '';
|
882 |
$dateTrack = '';
|
883 |
|
887 |
foreach ($shipmentCollection as $shipment){
|
888 |
foreach($shipment->getAllTracks() as $tracknum){
|
889 |
$TrackNum = $tracknum->getNumber();
|
890 |
+
$TrackTitle = $tracknum->getTitle();
|
891 |
$TrackCreate = $tracknum->getCreatedAt();
|
892 |
|
893 |
+
$dateTmp = new DateTime(str_replace("/", "-", $TrackCreate ));
|
894 |
+
$dateTrack = date_format($dateTmp, 'Y-m-d\TH:i:s\Z');
|
895 |
}
|
896 |
}
|
897 |
|
898 |
+
$days = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_estimate_date_field', $storeID);
|
899 |
+
|
900 |
+
$days = ($days == "" || $days == null) ? 10 : $days;
|
901 |
+
$stimatedDate = date('Y-m-d\TH:i:s\Z', strtotime("+".$days." days", strtotime($dateTrack)));
|
902 |
+
return array("number" => $TrackNum,
|
903 |
+
"carrier" => $TrackTitle,
|
904 |
+
"date" => $dateTrack,
|
905 |
+
"shippedDate" => $dateTrack,
|
906 |
+
"url" => "",
|
907 |
+
"estimateDate" => $stimatedDate);
|
908 |
}
|
909 |
|
910 |
/**
|
941 |
);
|
942 |
|
943 |
$invoiceData = $this->getInvoiceOrder($Order);
|
944 |
+
$trackingData = $this->getTrackingOrder($storeID, $Order);
|
945 |
|
946 |
if ($invoiceData['number'] != '') {
|
947 |
$params["invoice"] = $invoiceData;
|
1008 |
*/
|
1009 |
private function sendOrderToAnyMarket($storeID, $idOrder, $HOST, $TOKEN){
|
1010 |
$ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
1011 |
+
if($ConfigOrder == 0 && $idOrder){
|
1012 |
$Order = Mage::getModel('sales/order')->setStoreId($storeID)->loadByIncrementId( $idOrder );
|
1013 |
|
1014 |
//TRATA OS ITEMS
|
1052 |
$statuAM = $this->getStatusMageToAnyMarketOrderConfig($storeID, $statusOrder);
|
1053 |
}
|
1054 |
|
1055 |
+
|
1056 |
if( (strpos($statuAM, 'ERROR:') === false) && ($statuAM != '') ) {
|
1057 |
$params = array(
|
1058 |
'marketPlaceId' => $idOrder,
|
1059 |
+
"createdAt" => $this->formatDateTimeZone( $Order->getData('created_at') ),
|
1060 |
"status" => $statuAM,
|
1061 |
"marketPlace" => "ECOMMERCE",
|
1062 |
"marketPlaceStatus" => $statuAM,
|
1066 |
"state" => $shipping->getRegion(),
|
1067 |
"country" => $shipping->getCountry(),
|
1068 |
"address" => $shipping->getStreetFull(),
|
1069 |
+
"street" => $shipping->getStreet(1),
|
1070 |
+
"number" => $shipping->getStreet(2),
|
1071 |
+
"comment" => $shipping->getStreet(3),
|
1072 |
+
"neighborhood" => $shipping->getStreet(4),
|
1073 |
"zipCode" => $shipping->getPostcode()
|
1074 |
),
|
1075 |
"buyer" => array(
|
1088 |
"value" => $Order->getBaseGrandTotal()
|
1089 |
),
|
1090 |
),
|
1091 |
+
"discount" => floatval( $Order->getDiscountAmount() ) < 0 ? floatval( $Order->getDiscountAmount() )*-1 : $Order->getDiscountAmount(),
|
1092 |
"freight" => $Order->getShippingAmount(),
|
1093 |
+
"gross" => $Order->getBaseSubtotal(),
|
1094 |
"total" => $Order->getBaseGrandTotal()
|
1095 |
);
|
1096 |
|
1097 |
+
$arrTracking = $this->getTrackingOrder($storeID, $Order);
|
1098 |
$arrInvoice = $this->getInvoiceOrder($Order);
|
1099 |
|
1100 |
if($arrTracking["number"] != ''){
|
1230 |
$anymarketorders->setStatus("0");
|
1231 |
$anymarketorders->setNmoStatusInt('Não integrado (Magento)');
|
1232 |
$anymarketorders->setNmoDescError('');
|
|
|
|
|
1233 |
$anymarketorders->setNmoIdOrder( $orderId );
|
1234 |
$anymarketorders->setStores(array($storeID));
|
1235 |
$anymarketorders->save();
|
app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php
CHANGED
@@ -104,7 +104,7 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
104 |
* @param $products
|
105 |
* @return int
|
106 |
*/
|
107 |
-
public function createOrder($products)
|
108 |
{
|
109 |
if (!($this->_customer instanceof Mage_Customer_Model_Customer)){
|
110 |
$this->setCustomer(self::CUSTOMER_RANDOM);
|
@@ -208,7 +208,7 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
208 |
|
209 |
$this->_order->setShippingAddress($shippingAddress)
|
210 |
->setShippingMethod($this->_shippingMethod)
|
211 |
-
->setShippingDescription($this->_shippingDescription);
|
212 |
|
213 |
$orderPayment = Mage::getModel('sales/order_payment')
|
214 |
->setStoreId($this->_storeId)
|
@@ -219,7 +219,7 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
219 |
|
220 |
$this->_order->setPayment($orderPayment);
|
221 |
|
222 |
-
$this->_addProducts($products);
|
223 |
|
224 |
$this->_order->setSubtotal($this->_subTotal)
|
225 |
->setBaseSubtotal($this->_subTotal)
|
@@ -234,37 +234,59 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
234 |
return $reservedOrderId;
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
/**
|
238 |
* add products in order
|
239 |
*
|
240 |
* @param $products
|
241 |
*/
|
242 |
-
protected function _addProducts($products)
|
243 |
{
|
244 |
$this->_subTotal = 0;
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
$productsCollection = Mage::getResourceModel('catalog/product_collection');
|
250 |
-
$productsCollection->addFieldToFilter('type_id', 'simple');
|
251 |
-
|
252 |
-
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($productsCollection);
|
253 |
|
254 |
-
|
255 |
-
|
256 |
-
->limit(rand($productRequest['min'], $productRequest['max']));
|
257 |
-
|
258 |
-
foreach ($productsCollection as $product){
|
259 |
-
$this->_addProduct(array(
|
260 |
-
'product' => $product->getId(),
|
261 |
-
'qty' => rand(1, 2)
|
262 |
-
));
|
263 |
-
}
|
264 |
-
}
|
265 |
-
else {
|
266 |
-
$this->_addProduct($productRequest);
|
267 |
-
}
|
268 |
}
|
269 |
}
|
270 |
|
@@ -275,13 +297,12 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
275 |
* @return array
|
276 |
* @throws Exception
|
277 |
*/
|
278 |
-
protected function _addProduct($requestData)
|
279 |
{
|
280 |
$request = new Varien_Object();
|
281 |
$request->setData($requestData);
|
282 |
|
283 |
-
$product = Mage::getModel('catalog/product')->load($request['product']);
|
284 |
-
|
285 |
|
286 |
$cartCandidates = $product->getTypeInstance(true)
|
287 |
->prepareForCartAdvanced($request, $product);
|
@@ -298,23 +319,16 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
298 |
$errors = array();
|
299 |
$items = array();
|
300 |
foreach ($cartCandidates as $candidate) {
|
301 |
-
|
302 |
$item = $this->_productToOrderItem($candidate, $candidate->getCartQty(), $request['price']);
|
303 |
-
|
304 |
$items[] = $item;
|
305 |
|
306 |
-
/**
|
307 |
-
* As parent item we should always use the item of first added product
|
308 |
-
*/
|
309 |
if (!$parentItem) {
|
310 |
$parentItem = $item;
|
311 |
}
|
312 |
if ($parentItem && $candidate->getParentProductId()) {
|
313 |
$item->setParentItem($parentItem);
|
314 |
}
|
315 |
-
|
316 |
-
* We specify qty after we know about parent (for stock)
|
317 |
-
*/
|
318 |
$item->setQty($item->getQty() + $candidate->getCartQty());
|
319 |
|
320 |
// collect errors instead of throwing first one
|
@@ -347,24 +361,18 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
347 |
*/
|
348 |
function _productToOrderItem(Mage_Catalog_Model_Product $product, $qty = 1, $price)
|
349 |
{
|
350 |
-
|
351 |
-
if($price){
|
352 |
-
$finalPrice = $price;
|
353 |
-
}else{
|
354 |
-
$finalPrice = $product->getFinalPrice();
|
355 |
-
}
|
356 |
-
|
357 |
-
$rowTotal = $finalPrice * $qty;
|
358 |
-
|
359 |
$options = $product->getCustomOptions();
|
360 |
|
361 |
$optionsByCode = array();
|
362 |
-
|
363 |
foreach ($options as $option)
|
364 |
{
|
365 |
$quoteOption = Mage::getModel('sales/quote_item_option')->setData($option->getData())
|
366 |
->setProduct($option->getProduct());
|
367 |
|
|
|
|
|
|
|
368 |
$optionsByCode[$quoteOption->getCode()] = $quoteOption;
|
369 |
}
|
370 |
|
@@ -373,11 +381,40 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
373 |
// DECREMENTE O STOCK
|
374 |
$stockItem =Mage::getModel('cataloginventory/stock_item')->loadByProduct( $product->getId() );
|
375 |
if( $stockItem->getManageStock() ){
|
376 |
-
$stockItem->setData('qty', $stockItem->getQty()-$product['
|
377 |
}
|
378 |
$stockItem->save();
|
379 |
|
380 |
$options = $product->getTypeInstance(true)->getOrderOptions($product);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
|
382 |
$orderItem = Mage::getModel('sales/order_item')
|
383 |
->setStoreId($this->_storeId)
|
@@ -387,12 +424,12 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
|
|
387 |
->setProductType($product->getTypeId())
|
388 |
->setQtyBackordered(NULL)
|
389 |
->setTotalQtyOrdered($product['rqty'])
|
390 |
-
->setQtyOrdered($
|
391 |
->setName($product->getName())
|
392 |
->setSku($product->getSku())
|
393 |
-
->setPrice(
|
394 |
-
->setBasePrice(
|
395 |
-
->setOriginalPrice( $
|
396 |
->setRowTotal($rowTotal)
|
397 |
->setBaseRowTotal($rowTotal)
|
398 |
|
104 |
* @param $products
|
105 |
* @return int
|
106 |
*/
|
107 |
+
public function createOrder($storeID, $products)
|
108 |
{
|
109 |
if (!($this->_customer instanceof Mage_Customer_Model_Customer)){
|
110 |
$this->setCustomer(self::CUSTOMER_RANDOM);
|
208 |
|
209 |
$this->_order->setShippingAddress($shippingAddress)
|
210 |
->setShippingMethod($this->_shippingMethod)
|
211 |
+
->setShippingDescription($this->_shippingDescription);
|
212 |
|
213 |
$orderPayment = Mage::getModel('sales/order_payment')
|
214 |
->setStoreId($this->_storeId)
|
219 |
|
220 |
$this->_order->setPayment($orderPayment);
|
221 |
|
222 |
+
$this->_addProducts($storeID, $products);
|
223 |
|
224 |
$this->_order->setSubtotal($this->_subTotal)
|
225 |
->setBaseSubtotal($this->_subTotal)
|
234 |
return $reservedOrderId;
|
235 |
}
|
236 |
|
237 |
+
private function groupProductByID($products){
|
238 |
+
$arryProdAt = array();
|
239 |
+
$ctrlProds = array();
|
240 |
+
foreach ($products as $idxProd => $prod) {
|
241 |
+
if( isset($prod['bundle_option_qty']) ) {
|
242 |
+
foreach ($prod['bundle_option_qty'] as $key => $value) {
|
243 |
+
$prod['bundle_option_qty'][$key] = $prod['bundle_option_qty'][$key] * $prod['qty'];
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
for ($i=$idxProd+1; $i < count($products); $i++) {
|
248 |
+
$prodToGroup = $products[$i];
|
249 |
+
|
250 |
+
$arrToComp1 = $prod;
|
251 |
+
$arrToComp2 = $prodToGroup;
|
252 |
+
|
253 |
+
unset($arrToComp1['qty']);
|
254 |
+
unset($arrToComp2['qty']);
|
255 |
+
if (md5(serialize($arrToComp1)) == md5(serialize($arrToComp2))) {
|
256 |
+
$prod['qty'] += $prodToGroup['qty'];
|
257 |
+
|
258 |
+
if( isset($prod['bundle_option_qty']) ) {
|
259 |
+
foreach ($prod['bundle_option_qty'] as $key => $value) {
|
260 |
+
$prod['bundle_option_qty'][$key] += $prodToGroup['bundle_option_qty'][$key];
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
if( !in_array($prod['product'], $ctrlProds) ) {
|
268 |
+
array_push($arryProdAt, $prod);
|
269 |
+
array_push($ctrlProds, $prod['product']);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
return $arryProdAt;
|
274 |
+
}
|
275 |
+
|
276 |
/**
|
277 |
* add products in order
|
278 |
*
|
279 |
* @param $products
|
280 |
*/
|
281 |
+
protected function _addProducts($storeID, $products)
|
282 |
{
|
283 |
$this->_subTotal = 0;
|
284 |
|
285 |
+
//GROUP ITENS
|
286 |
+
$arryProdAt = $this->groupProductByID($products);
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
+
foreach ($arryProdAt as $productRequest) {
|
289 |
+
$this->_addProduct($storeID, $productRequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
}
|
292 |
|
297 |
* @return array
|
298 |
* @throws Exception
|
299 |
*/
|
300 |
+
protected function _addProduct($storeID, $requestData)
|
301 |
{
|
302 |
$request = new Varien_Object();
|
303 |
$request->setData($requestData);
|
304 |
|
305 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($request['product']);
|
|
|
306 |
|
307 |
$cartCandidates = $product->getTypeInstance(true)
|
308 |
->prepareForCartAdvanced($request, $product);
|
319 |
$errors = array();
|
320 |
$items = array();
|
321 |
foreach ($cartCandidates as $candidate) {
|
|
|
322 |
$item = $this->_productToOrderItem($candidate, $candidate->getCartQty(), $request['price']);
|
|
|
323 |
$items[] = $item;
|
324 |
|
|
|
|
|
|
|
325 |
if (!$parentItem) {
|
326 |
$parentItem = $item;
|
327 |
}
|
328 |
if ($parentItem && $candidate->getParentProductId()) {
|
329 |
$item->setParentItem($parentItem);
|
330 |
}
|
331 |
+
|
|
|
|
|
332 |
$item->setQty($item->getQty() + $candidate->getCartQty());
|
333 |
|
334 |
// collect errors instead of throwing first one
|
361 |
*/
|
362 |
function _productToOrderItem(Mage_Catalog_Model_Product $product, $qty = 1, $price)
|
363 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
$options = $product->getCustomOptions();
|
365 |
|
366 |
$optionsByCode = array();
|
367 |
+
$bundleOptSelAttr = null;
|
368 |
foreach ($options as $option)
|
369 |
{
|
370 |
$quoteOption = Mage::getModel('sales/quote_item_option')->setData($option->getData())
|
371 |
->setProduct($option->getProduct());
|
372 |
|
373 |
+
if($quoteOption->getCode() == 'bundle_selection_attributes' ) {
|
374 |
+
$bundleOptSelAttr = $quoteOption->getValue();
|
375 |
+
}
|
376 |
$optionsByCode[$quoteOption->getCode()] = $quoteOption;
|
377 |
}
|
378 |
|
381 |
// DECREMENTE O STOCK
|
382 |
$stockItem =Mage::getModel('cataloginventory/stock_item')->loadByProduct( $product->getId() );
|
383 |
if( $stockItem->getManageStock() ){
|
384 |
+
$stockItem->setData('qty', $stockItem->getQty()-$product['cart_qty']);
|
385 |
}
|
386 |
$stockItem->save();
|
387 |
|
388 |
$options = $product->getTypeInstance(true)->getOrderOptions($product);
|
389 |
+
|
390 |
+
if($bundleOptSelAttr != null) {
|
391 |
+
$options['bundle_selection_attributes'] = $bundleOptSelAttr;
|
392 |
+
}
|
393 |
+
|
394 |
+
$finalPrice = $price;
|
395 |
+
if( $product['parent_product_id'] ){
|
396 |
+
$productParent = Mage::getModel('catalog/product')->load( $product['parent_product_id'] );
|
397 |
+
|
398 |
+
if( $productParent->getTypeID() == "bundle" && $productParent->getPriceType() == 0 ) {
|
399 |
+
//GET PROC FROM REAL PRICE
|
400 |
+
$priceModel = $productParent->getPriceModel();
|
401 |
+
$PriceBundle = $priceModel->getTotalPrices($productParent, null, true, false);
|
402 |
+
|
403 |
+
$PriceBundle = reset($PriceBundle);
|
404 |
+
$priceProdCur = $product->getFinalPrice();
|
405 |
+
|
406 |
+
$currPorc = (100*$priceProdCur)/$PriceBundle;
|
407 |
+
$finalPrice = ($currPorc*$price)/100;
|
408 |
+
}
|
409 |
+
|
410 |
+
}
|
411 |
+
|
412 |
+
$qtdOrdered = $product['cart_qty'];
|
413 |
+
if( $product->getTypeID() == "bundle" ) {
|
414 |
+
$rowTotal = 0;
|
415 |
+
}else{
|
416 |
+
$rowTotal = $finalPrice * $qty;
|
417 |
+
}
|
418 |
|
419 |
$orderItem = Mage::getModel('sales/order_item')
|
420 |
->setStoreId($this->_storeId)
|
424 |
->setProductType($product->getTypeId())
|
425 |
->setQtyBackordered(NULL)
|
426 |
->setTotalQtyOrdered($product['rqty'])
|
427 |
+
->setQtyOrdered($qtdOrdered)
|
428 |
->setName($product->getName())
|
429 |
->setSku($product->getSku())
|
430 |
+
->setPrice($finalPrice)
|
431 |
+
->setBasePrice($finalPrice)
|
432 |
+
->setOriginalPrice( $product->getFinalPrice() )
|
433 |
->setRowTotal($rowTotal)
|
434 |
->setBaseRowTotal($rowTotal)
|
435 |
|
app/code/community/DB1/AnyMarket/Helper/Product.php
CHANGED
@@ -10,8 +10,10 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
10 |
*/
|
11 |
private function checkArrayAttributes($arrAttr, $key, $value){
|
12 |
foreach ($arrAttr as $arrVal) {
|
13 |
-
if( $arrVal[$key]
|
14 |
-
|
|
|
|
|
15 |
}
|
16 |
}
|
17 |
return false;
|
@@ -105,6 +107,67 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
105 |
return $fieldDesc;
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* get decription by configuration
|
110 |
*
|
@@ -275,13 +338,12 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
275 |
* @param $idProd
|
276 |
* @param $dataProdConfig
|
277 |
* @param $simpleProducts
|
278 |
-
* @param $AttributeIds
|
279 |
* @return Mage_Catalog_Model_Product
|
280 |
*/
|
281 |
-
private function update_configurable_product($storeID, $idProd, $dataProdConfig, $simpleProducts
|
282 |
$productGenerator = Mage::helper('db1_anymarket/productgenerator');
|
283 |
-
$product = $productGenerator->updateConfigurableProduct($storeID, $idProd, $dataProdConfig, $simpleProducts
|
284 |
-
|
285 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Updated').' ('.$product->getSku().')';
|
286 |
$returnProd['error'] = '0';
|
287 |
$returnProd['json'] = '';
|
@@ -367,6 +429,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
367 |
}
|
368 |
}
|
369 |
|
|
|
370 |
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
|
371 |
$items = $mediaApi->items($Prod->getId());
|
372 |
$imagesGalleryMG = array();
|
@@ -376,30 +439,30 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
376 |
$imagesGalleryMG[] = array('ctrl' => $crltImg, 'img' => $item['url'], 'file' => $item['file'] );
|
377 |
}
|
378 |
|
|
|
379 |
$imagesGalleryAM = array();
|
380 |
foreach ($ProdsJSON->photos as $image) {
|
381 |
-
$crltImgAM =
|
382 |
$crltImgAM = str_replace(strrchr($crltImgAM,"."), "", $crltImgAM);
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
|
|
390 |
}
|
391 |
-
}
|
392 |
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
|
|
|
|
|
|
398 |
}
|
399 |
-
|
400 |
-
$dataImgs = array('images' => $imagesGallery, 'sku' => $idClient);
|
401 |
-
$productGenerator = Mage::helper('db1_anymarket/productgenerator');
|
402 |
-
$productGenerator->updateImages($Prod, $dataImgs);
|
403 |
}
|
404 |
|
405 |
//COMPARA IMG AM COM MG SE TIVER DIVERCIA REMOVE DO PRODUTO
|
@@ -407,201 +470,19 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
407 |
if ($diffMG) {
|
408 |
foreach ($diffMG as $diffMG_value) {
|
409 |
$mediaApi->remove($Prod->getId(), $diffMG_value['file']);
|
410 |
-
//remover arquivo fisicamente
|
411 |
}
|
412 |
}
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
*
|
417 |
-
* Send Image to Anymarket
|
418 |
-
*
|
419 |
-
* @param $storeID
|
420 |
-
* @param $product
|
421 |
-
* @param $variation
|
422 |
-
*
|
423 |
-
*/
|
424 |
-
public function sendImageToAnyMarket($storeID, $product, $variation){
|
425 |
-
if($product){
|
426 |
-
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
427 |
-
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
428 |
-
$exportImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_export_image_field', $storeID);
|
429 |
-
|
430 |
-
$headers = array(
|
431 |
-
"Content-type: application/json",
|
432 |
-
"gumgaToken: ".$TOKEN
|
433 |
-
);
|
434 |
-
|
435 |
-
if($product->getData('id_anymarket') != ''){
|
436 |
-
$imgGetRet = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images", $headers, null);
|
437 |
-
if($imgGetRet['error'] == '0'){
|
438 |
-
$imgsProdAnymarket = $imgGetRet['return'];
|
439 |
-
$imgsProdMagento = $product->getMediaGalleryImages();
|
440 |
-
|
441 |
-
$arrAdd = array();
|
442 |
-
$ctrlAdd = false;
|
443 |
-
$arrRemove = array();
|
444 |
-
$ctrlRemove = false;
|
445 |
-
$arrImgs = array();
|
446 |
-
|
447 |
-
//verifica quais irao adicionar
|
448 |
-
foreach ($imgsProdMagento as $imgProdMagento) {
|
449 |
-
$ctrlAdd = false;
|
450 |
-
|
451 |
-
$urlImage = $imgProdMagento->getData('url');
|
452 |
-
$infoImg = getimagesize( $urlImage );
|
453 |
-
$imgSize = filesize( $imgProdMagento->getData('path') );
|
454 |
-
|
455 |
-
if( ($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000 )) {
|
456 |
-
if ($exportImage == 0) {
|
457 |
-
array_push($arrProd, 'Image_c (' . $urlImage . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
|
458 |
-
} else {
|
459 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
460 |
-
$anymarketlog->setLogDesc('Error on export image - ' . $urlImage);
|
461 |
-
$anymarketlog->setLogId($product->getSku());
|
462 |
-
$anymarketlog->setStatus("1");
|
463 |
-
$anymarketlog->setStores(array($storeID));
|
464 |
-
$anymarketlog->save();
|
465 |
-
}
|
466 |
-
}else{
|
467 |
-
foreach ($imgsProdAnymarket as $imgProdAnymarket) {
|
468 |
-
if ($variation) {
|
469 |
-
if( isset($imgProdAnymarket->variation) ) {
|
470 |
-
if (($imgProdMagento->getData('url') == $imgProdAnymarket->url) && ($imgProdAnymarket->variation == $variation)) {
|
471 |
-
$ctrlAdd = true;
|
472 |
-
break;
|
473 |
-
}
|
474 |
-
}
|
475 |
-
} else {
|
476 |
-
if ($imgProdMagento->getData('url') == $imgProdAnymarket->url) {
|
477 |
-
$ctrlAdd = true;
|
478 |
-
break;
|
479 |
-
}
|
480 |
-
}
|
481 |
-
|
482 |
-
}
|
483 |
-
|
484 |
-
if (!$ctrlAdd) {
|
485 |
-
array_push($arrAdd, $imgProdMagento->getData('url'));
|
486 |
-
}
|
487 |
-
}
|
488 |
-
|
489 |
-
}
|
490 |
-
|
491 |
-
//verifica quais irao remover
|
492 |
-
foreach ($imgsProdAnymarket as $imgProdAnymarket) {
|
493 |
-
$ctrlRemove = false;
|
494 |
-
foreach ($imgsProdMagento as $imgProdMagento) {
|
495 |
-
if($variation){
|
496 |
-
if( isset($imgProdAnymarket->variation) ) {
|
497 |
-
if (($imgProdAnymarket->url == $imgProdMagento->getData('url')) && ($imgProdAnymarket->variation == $variation)) {
|
498 |
-
$ctrlRemove = true;
|
499 |
-
break;
|
500 |
-
}
|
501 |
-
}
|
502 |
-
}else{
|
503 |
-
if($imgProdAnymarket->url == $imgProdMagento->getData('url') ){
|
504 |
-
$ctrlRemove = true;
|
505 |
-
break;
|
506 |
-
}
|
507 |
-
}
|
508 |
-
}
|
509 |
-
|
510 |
-
if(!$ctrlRemove){
|
511 |
-
if($variation){
|
512 |
-
if( isset($imgProdAnymarket->variation) ) {
|
513 |
-
if ($imgProdAnymarket->variation == $variation) {
|
514 |
-
array_push($arrRemove, $imgProdAnymarket->id);
|
515 |
-
}
|
516 |
-
}
|
517 |
-
}else{
|
518 |
-
array_push($arrRemove, $imgProdAnymarket->id);
|
519 |
-
}
|
520 |
-
}
|
521 |
-
}
|
522 |
-
|
523 |
-
// Add Image
|
524 |
-
if( !empty($arrImgs) ){
|
525 |
-
$returnProd['error'] = '1';
|
526 |
-
$returnProd['json'] = '';
|
527 |
-
|
528 |
-
$emptyFields = ' ';
|
529 |
-
foreach ($arrImgs as $field) {
|
530 |
-
$emptyFields .= $field.', ';
|
531 |
-
}
|
532 |
-
|
533 |
-
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').' '.$emptyFields;
|
534 |
-
$this->saveLogsProds($storeID, "0", $returnProd, $product);
|
535 |
-
}else {
|
536 |
-
foreach ($arrAdd as $imgAdd) {
|
537 |
-
if ($variation) {
|
538 |
-
$JSONAdd = array(
|
539 |
-
"url" => $imgAdd,
|
540 |
-
"variation" => $variation,
|
541 |
-
);
|
542 |
-
} else {
|
543 |
-
$JSONAdd = array(
|
544 |
-
"url" => $imgAdd
|
545 |
-
);
|
546 |
-
}
|
547 |
-
|
548 |
-
$imgPostRet = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images", $headers, $JSONAdd);
|
549 |
-
if ($imgPostRet['error'] == '1') {
|
550 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
551 |
-
$anymarketlog->setLogDesc('Error on export image (' . $product->getData('id_anymarket') . ') - ' . is_string($imgPostRet['return']) ? $imgPostRet['return'] : json_encode($imgPostRet['return']));
|
552 |
-
$anymarketlog->setLogJson($imgPostRet['json']);
|
553 |
-
$anymarketlog->setLogId($product->getSku());
|
554 |
-
$anymarketlog->setStatus("1");
|
555 |
-
$anymarketlog->setStores(array($storeID));
|
556 |
-
$anymarketlog->save();
|
557 |
-
} else {
|
558 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
559 |
-
$anymarketlog->setLogDesc('Exported image (' . $imgAdd . ')');
|
560 |
-
$anymarketlog->setLogJson($imgPostRet['json']);
|
561 |
-
$anymarketlog->setLogId($product->getSku());
|
562 |
-
$anymarketlog->setStatus("1");
|
563 |
-
$anymarketlog->setStores(array($storeID));
|
564 |
-
$anymarketlog->save();
|
565 |
-
}
|
566 |
-
}
|
567 |
-
}
|
568 |
-
|
569 |
-
// remove image
|
570 |
-
foreach ($arrRemove as $imgRemove) {
|
571 |
-
$imgDelRet = $this->CallAPICurl("DELETE", $HOST."/v2/products/".$product->getData('id_anymarket')."/images/".$imgRemove, $headers, null);
|
572 |
-
if($imgDelRet['error'] == '1'){
|
573 |
-
$anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
|
574 |
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
$anymarketlogDel->setLogJson('');
|
582 |
-
$anymarketlogDel->setLogId($product->getSku());
|
583 |
-
$anymarketlogDel->setStatus("1");
|
584 |
-
$anymarketlogDel->setStores(array($storeID));
|
585 |
-
$anymarketlogDel->save();
|
586 |
-
}else{
|
587 |
-
$anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
|
588 |
-
$anymarketlogDel->setLogDesc( 'Deleted image from Anymarket ');
|
589 |
-
$anymarketlogDel->setLogJson('');
|
590 |
-
$anymarketlogDel->setLogId($product->getSku());
|
591 |
-
$anymarketlogDel->setStatus("1");
|
592 |
-
$anymarketlogDel->setStores(array($storeID));
|
593 |
-
$anymarketlogDel->save();
|
594 |
-
}
|
595 |
-
}
|
596 |
-
|
597 |
-
}else{
|
598 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
599 |
-
$anymarketlog->setLogDesc( 'Error on get images from Anymarket ('.$product->getData('id_anymarket').') - '.$imgGetRet['return'] );
|
600 |
-
$anymarketlog->setStatus("1");
|
601 |
-
$anymarketlog->setStores(array($storeID));
|
602 |
-
$anymarketlog->save();
|
603 |
-
}
|
604 |
}
|
|
|
|
|
|
|
|
|
605 |
}
|
606 |
}
|
607 |
|
@@ -614,72 +495,71 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
614 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
615 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
616 |
|
617 |
-
$headers = array(
|
618 |
-
"Content-type: application/json",
|
619 |
"Cache-Control: no-cache",
|
620 |
"gumgaToken: ".$TOKEN
|
621 |
);
|
622 |
-
|
623 |
// SINCRONIZA AS FOTOS E SKUS
|
624 |
-
$
|
625 |
-
|
626 |
-
|
627 |
-
$
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
|
638 |
-
|
639 |
-
|
640 |
-
|
|
|
|
|
|
|
|
|
641 |
}
|
642 |
-
$paramSku['variations'] = $skuPut['variations'];
|
643 |
-
} else {
|
644 |
-
$this->sendImageToAnyMarket($storeID, $product, null);
|
645 |
-
}
|
646 |
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
|
|
653 |
}
|
654 |
}
|
655 |
-
}
|
656 |
|
657 |
-
|
658 |
-
|
659 |
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
|
666 |
-
|
667 |
-
|
|
|
668 |
}
|
669 |
-
}
|
670 |
|
671 |
-
|
672 |
-
|
673 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
}
|
675 |
-
}else{
|
676 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
677 |
-
$anymarketlog->setLogDesc('Error on get Images Anymarket: '. $skusProd['return']);
|
678 |
-
$anymarketlog->setLogJson($skusProd['json']);
|
679 |
-
$anymarketlog->setLogId($product->getSku());
|
680 |
-
$anymarketlog->setStatus("1");
|
681 |
-
$anymarketlog->setStores(array($storeID));
|
682 |
-
$anymarketlog->save();
|
683 |
}
|
684 |
}
|
685 |
|
@@ -694,7 +574,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
694 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
695 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
696 |
|
697 |
-
$headers = array(
|
698 |
"Content-type: application/json",
|
699 |
"Accept: */*",
|
700 |
"gumgaToken: ".$TOKEN
|
@@ -728,12 +608,102 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
728 |
}else{
|
729 |
return '';
|
730 |
}
|
731 |
-
|
732 |
}else{
|
733 |
return $brand->getData('brd_id');
|
734 |
}
|
735 |
}
|
736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
/**
|
738 |
* send product to AnyMarket
|
739 |
*
|
@@ -773,7 +743,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
773 |
if((string)(float)$varPriceFactor == $varPriceFactor) {
|
774 |
$varPriceFactor = (float)$varPriceFactor;
|
775 |
if($varPriceFactor > 99){
|
776 |
-
|
777 |
}
|
778 |
}else{
|
779 |
array_push($arrProd, Mage::helper('db1_anymarket')->__('AnyMarket Price Factor(Only Number)') );
|
@@ -782,23 +752,26 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
782 |
// verifica Origin null ou em branco
|
783 |
$originData = $this->procAttrConfig($nbm_origin, $product->getData( $nbm_origin ), 1);
|
784 |
if($originData == null || $originData == ''){
|
785 |
-
|
786 |
}
|
787 |
|
788 |
//trata para nao enviar novamente solicitacao quando o erro for o mesmo
|
789 |
if( ($product->getData('id_anymarket') == '') || ($product->getData('id_anymarket') == '0') ){
|
790 |
$prodErrorCtrl = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)
|
791 |
-
|
792 |
if( $prodErrorCtrl->getData('nmp_id') != null ){
|
793 |
$descError = $prodErrorCtrl->getData('nmp_desc_error');
|
794 |
|
795 |
// Trata para nao ficar disparando em cima da Duplicadade de SKU
|
796 |
$mesgDuplSku = strrpos($descError, "Duplicidade de SKU:");
|
797 |
if ($mesgDuplSku !== false) {
|
798 |
-
$
|
|
|
|
|
799 |
|
800 |
-
|
801 |
-
|
|
|
802 |
}
|
803 |
}
|
804 |
}
|
@@ -831,51 +804,43 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
831 |
$Weight = "";
|
832 |
if($product->getTypeID() == "configurable"){
|
833 |
$confID = $product->getId();
|
|
|
|
|
|
|
|
|
834 |
}else{
|
835 |
// verifica se é um simples pertecente a um Configurable
|
836 |
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
837 |
-
$Weight = $product->getWeight();
|
838 |
if (isset($parentIds[0])) {
|
839 |
$confID = $parentIds[0];
|
840 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($confID);
|
841 |
}
|
|
|
|
|
|
|
842 |
}
|
843 |
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
$
|
850 |
-
$
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
array_push($arrProd, 'Image_a (' . $g_image['url'] . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
|
855 |
-
}else{
|
856 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
857 |
-
$anymarketlog->setLogDesc('Error on export image - ' . $g_image['url']);
|
858 |
-
$anymarketlog->setLogId($product->getSku());
|
859 |
-
$anymarketlog->setStatus("1");
|
860 |
-
$anymarketlog->setStores(array($storeID));
|
861 |
-
$anymarketlog->save();
|
862 |
-
}
|
863 |
-
}else{
|
864 |
-
$itemsIMG[] = array(
|
865 |
-
"main" => true,
|
866 |
-
"url" => $g_image['url']
|
867 |
-
);
|
868 |
-
}
|
869 |
}
|
870 |
|
871 |
//obtem os produtos configs - verifica se e configurable
|
872 |
$ArrSimpleConfigProd = array();
|
873 |
if($confID != ""){
|
874 |
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
875 |
-
$attributesConf = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
|
876 |
|
877 |
foreach($childProducts as $child) {
|
878 |
-
$SimpleConfigProd = Mage::getModel('catalog/product')->load($child->getId());
|
879 |
|
880 |
if ($Weight == "") {
|
881 |
$Weight = $SimpleConfigProd->getWeight();
|
@@ -906,31 +871,15 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
906 |
}
|
907 |
|
908 |
//obtem as imagens do produto (Obtem os simples e relaciona as variacoes)
|
909 |
-
$
|
910 |
-
|
911 |
-
$
|
912 |
-
|
913 |
-
|
914 |
-
if (($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
|
915 |
-
if ($exportImage == 0) {
|
916 |
-
array_push($arrProd, 'Image_b (' . $g_imageSimp['url'] . ' - Sku: ' . $SimpleConfigProd->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
|
917 |
-
} else {
|
918 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
919 |
-
$anymarketlog->setLogDesc('Error on export image - ' . $g_imageSimp['url']);
|
920 |
-
$anymarketlog->setLogId($SimpleConfigProd->getSku());
|
921 |
-
$anymarketlog->setStatus("1");
|
922 |
-
$anymarketlog->setStores(array($storeID));
|
923 |
-
$anymarketlog->save();
|
924 |
-
}
|
925 |
-
} else {
|
926 |
-
foreach ($ArrVariationValues as $value) {
|
927 |
-
$itemsIMG[] = array(
|
928 |
-
"main" => false,
|
929 |
-
"url" => $g_imageSimp['url'],
|
930 |
-
"variation" => $value,
|
931 |
-
);
|
932 |
}
|
933 |
}
|
|
|
|
|
934 |
}
|
935 |
|
936 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
@@ -966,7 +915,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
966 |
"idProduct" => $SimpleConfigProd->getData('id_anymarket'),
|
967 |
"internalIdProduct" => $SimpleConfigProd->getId(),
|
968 |
);
|
969 |
-
|
970 |
|
971 |
}
|
972 |
|
@@ -978,12 +927,18 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
978 |
|
979 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
980 |
|
981 |
-
if($filter == 'final_price'){
|
982 |
$stkPrice = $product->getFinalPrice();
|
983 |
-
}else{
|
984 |
$stkPrice = $product->getData($filter);
|
985 |
}
|
986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
$prodSkuJ = $product->getSku();
|
988 |
|
989 |
// verificacao dos dados de price
|
@@ -992,28 +947,26 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
992 |
}
|
993 |
|
994 |
// verificacao dos dados de SKU
|
995 |
-
$cValid = array('.', '-', '_');
|
996 |
-
if(!ctype_alnum(str_replace($cValid, '', $prodSkuJ))) {
|
997 |
array_push($arrProd, 'SKU ('.$prodSkuJ.')');
|
998 |
}
|
999 |
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
);
|
1010 |
-
}
|
1011 |
}
|
1012 |
|
1013 |
-
|
1014 |
//cria os headers
|
1015 |
-
$headers = array(
|
1016 |
-
"Content-type: application/json",
|
1017 |
"Cache-Control: no-cache",
|
1018 |
"gumgaToken: ".$TOKEN
|
1019 |
);
|
@@ -1030,38 +983,38 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1030 |
$attributeSetName = $attributeSetModel->getAttributeSetId();
|
1031 |
|
1032 |
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
1033 |
-
|
1034 |
-
|
1035 |
|
1036 |
$ArrAttributes = array();
|
1037 |
$contIndexAttr = 0;
|
1038 |
foreach ($attributes as $attribute){
|
1039 |
$attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($attribute->getAttributeId(), 'nma_id_attr');
|
1040 |
if($attrCheck->getData('nma_id_attr') != null){
|
1041 |
-
if($attrCheck->getData('status') == 1)
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
}
|
1060 |
}
|
1061 |
}
|
1062 |
}
|
1063 |
}
|
1064 |
}
|
|
|
1065 |
}
|
1066 |
}
|
1067 |
}
|
@@ -1070,6 +1023,15 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1070 |
$vHeight = $this->procAttrConfig($volume_altura, $product->getData( $volume_altura ), 1);
|
1071 |
$vWidth = $this->procAttrConfig($volume_largura, $product->getData( $volume_largura ), 1);
|
1072 |
$vLength = $this->procAttrConfig($volume_comprimento, $product->getData( $volume_comprimento ), 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1073 |
|
1074 |
//Cria os params
|
1075 |
$param = array(
|
@@ -1096,7 +1058,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1096 |
"height" => $this->convertUnitMeasurement($UnitMeasurement, $vHeight, 1),
|
1097 |
"width" => $this->convertUnitMeasurement($UnitMeasurement, $vWidth, 1),
|
1098 |
"length" => $this->convertUnitMeasurement($UnitMeasurement, $vLength, 1),
|
1099 |
-
"images" => $itemsIMG,
|
1100 |
"priceFactor" => $varPriceFactor,
|
1101 |
"calculatedPrice" => $product->getData( $calculated_price ) == 0 ? false : true,
|
1102 |
// OBTER ATRIBUTOS CUSTOM
|
@@ -1161,6 +1123,8 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1161 |
$returnProd['error'] = '0';
|
1162 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Successfully synchronized product.');
|
1163 |
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
|
|
|
|
1164 |
}else{
|
1165 |
$returnProd['error'] = '1';
|
1166 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Error synchronizing, code anymarket invalid.');
|
@@ -1168,13 +1132,85 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1168 |
}
|
1169 |
|
1170 |
}else{
|
1171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1172 |
}
|
1173 |
|
1174 |
}else{
|
1175 |
$returnProd = $this->CallAPICurl("PUT", $HOST."/v2/products/".$product->getData('id_anymarket'), $headers, $param);
|
1176 |
if($returnProd['error'] == '0'){
|
1177 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Product Updated');
|
|
|
|
|
1178 |
}
|
1179 |
|
1180 |
//ADICIONA UM NOVO SKU
|
@@ -1183,22 +1219,19 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1183 |
if($skuProdReturn['error'] == '0'){
|
1184 |
$skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Created').' ('.$skuPut['partnerId'].')';
|
1185 |
$this->saveLogsProds($storeID, "1", $skuProdReturn, $product);
|
|
|
|
|
1186 |
}else{
|
1187 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
1188 |
$productSku = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuPut['partnerId'] );
|
1189 |
-
if( $productSku != null ) {
|
1190 |
-
|
1191 |
-
|
1192 |
-
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productSku);
|
1193 |
-
$this->updatePriceStockAnyMarket($storeID, $productSku->getId(), $stock->getQty(), $productSku->getData($filter));
|
1194 |
-
}
|
1195 |
-
}
|
1196 |
}
|
1197 |
}
|
1198 |
}
|
1199 |
|
1200 |
$this->sendImageSkuToAnyMarket($storeID, $product, $param['skus']);
|
1201 |
-
|
1202 |
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
1203 |
}
|
1204 |
return true;
|
@@ -1250,7 +1283,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1250 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
1251 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
1252 |
|
1253 |
-
$headers = array(
|
1254 |
"Content-type: application/json",
|
1255 |
"Accept: */*",
|
1256 |
"gumgaToken: ".$TOKEN
|
@@ -1299,9 +1332,6 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1299 |
$ProdsJSON = $returnProdSpecific['return'];
|
1300 |
|
1301 |
foreach ($ProdsJSON->skus as $sku) {
|
1302 |
-
$IDSKUProd = $sku->partnerId != null ? $sku->partnerId : $ProdsJSON->idProduct;
|
1303 |
-
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $IDSKUProd);
|
1304 |
-
|
1305 |
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
1306 |
$stockItem->setData('is_in_stock', $sku->amount > 0 ? '1' : '0');
|
1307 |
$stockItem->setData('qty', $sku->amount);
|
@@ -1314,9 +1344,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1314 |
$anymarketlog->setStores(array($storeID));
|
1315 |
$anymarketlog->save();
|
1316 |
|
1317 |
-
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getIdAnymarket(), 'nmp_id');
|
1318 |
if ($anymarketproducts->getNmpId() == null) {
|
1319 |
-
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getId(), 'nmp_id');
|
1320 |
}
|
1321 |
|
1322 |
$anymarketproducts->setNmpId($product->getId());
|
@@ -1358,20 +1388,18 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1358 |
$transmissionToken = $transmissionIDs->token;
|
1359 |
|
1360 |
$transmissionReturn = $this->CallAPICurl("GET", $HOST."/v2/transmissions/".$transmissionID, $headers, null);
|
1361 |
-
|
1362 |
$prodRet = "";
|
1363 |
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
1364 |
if($typeSincProd == 1) {
|
1365 |
if ($transmissionReturn['error'] == '1') {
|
1366 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1367 |
-
$anymarketlog->setLogDesc(Mage::helper('db1_anymarket')->__('Error on get transmissions ')
|
1368 |
$anymarketlog->setStatus("0");
|
1369 |
$anymarketlog->save();
|
1370 |
} else {
|
1371 |
$transmission = $transmissionReturn['return'];
|
1372 |
$statusTransmission = $transmission->publicationStatus;
|
1373 |
$IDProdTrans = $transmission->product->id;
|
1374 |
-
$NameProdTrans = $transmission->product->title;
|
1375 |
if ($statusTransmission == 'ACTIVE') {
|
1376 |
$arrVarSku = array();
|
1377 |
if (isset($transmission->sku->variations)) {
|
@@ -1414,10 +1442,15 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1414 |
$arrAttr = array();
|
1415 |
if (isset($transmission->characteristics)) {
|
1416 |
foreach ($transmission->characteristics as $carac) {
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
))
|
|
|
|
|
|
|
|
|
|
|
1421 |
}
|
1422 |
}
|
1423 |
|
@@ -1426,7 +1459,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1426 |
"title" => $transmission->product->title,
|
1427 |
"idTransmission" => $transmissionIDs->id,
|
1428 |
"description" => isset($transmission->description) ? $transmission->description : null,
|
1429 |
-
"brand" => isset($transmission->brand->
|
1430 |
"model" => isset($transmission->model) ? $transmission->model : null,
|
1431 |
"videoURL" => isset($transmission->videoUrl) ? $transmission->videoUrl : null,
|
1432 |
"warrantyTime" => isset($transmission->warrantyTime) ? $transmission->warrantyTime : null,
|
@@ -1540,7 +1573,6 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1540 |
}
|
1541 |
$stockItem->save();
|
1542 |
}
|
1543 |
-
$prodLoaded->save();
|
1544 |
|
1545 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1546 |
$anymarketlog->setLogDesc( "Stock Updated" );
|
@@ -1561,12 +1593,12 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1561 |
}
|
1562 |
}else{
|
1563 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1564 |
-
$anymarketlog->setLogDesc(
|
1565 |
$anymarketlog->setStatus("0");
|
1566 |
$anymarketlog->setStores(array($storeID));
|
1567 |
$anymarketlog->save();
|
1568 |
|
1569 |
-
$prodRet =
|
1570 |
}
|
1571 |
}
|
1572 |
}
|
@@ -1586,10 +1618,75 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1586 |
$prodRet = 'Product Created or updated.';
|
1587 |
}
|
1588 |
}
|
|
|
|
|
|
|
|
|
|
|
1589 |
|
1590 |
return $prodRet;
|
1591 |
}
|
1592 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1593 |
|
1594 |
/**
|
1595 |
* @param $ProdsJSON
|
@@ -1638,17 +1735,19 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1638 |
if ( !empty( $ProdsJSON->variations ) ) {
|
1639 |
$prodSimpleFromConfig = array();
|
1640 |
$AttributeIds = array();
|
1641 |
-
$AttributeOptions = array();
|
1642 |
|
1643 |
$variationArray = array();
|
1644 |
$sinc = '';
|
1645 |
foreach ($ProdsJSON->variations as $variation) {
|
1646 |
-
$
|
1647 |
-
|
1648 |
-
|
|
|
|
|
1649 |
$sinc = $variation->name;
|
1650 |
break;
|
1651 |
}
|
|
|
1652 |
}
|
1653 |
|
1654 |
if($sinc == ''){
|
@@ -1658,106 +1757,77 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1658 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $IDSKUProd);
|
1659 |
|
1660 |
foreach ($sku->variations as $varValues) {
|
1661 |
-
$descVar = $varValues->description;
|
1662 |
$idVar = $varValues->variationTypeId;
|
1663 |
}
|
1664 |
|
1665 |
//trata as dimensoes
|
1666 |
-
$vHeight = $this->procAttrConfig($volume_altura,
|
1667 |
-
$vWidth
|
1668 |
$vLength = $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0);
|
1669 |
|
1670 |
if(!$product){
|
1671 |
-
$
|
1672 |
-
if
|
1673 |
-
|
1674 |
-
$collectionAttr = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
1675 |
-
->setPositionOrder('asc')
|
1676 |
-
->setAttributeFilter($AttributeId)
|
1677 |
-
->setStoreFilter(0)
|
1678 |
-
->load();
|
1679 |
-
|
1680 |
-
$AttributeOptions[$idVar] = $collectionAttr->toOptionArray();
|
1681 |
-
|
1682 |
}
|
1683 |
|
1684 |
-
$
|
1685 |
-
$
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1693 |
|
1694 |
-
|
1695 |
-
foreach ($
|
1696 |
-
|
1697 |
-
if( $image->variationValue == $descVarAttr ){
|
1698 |
-
$imagesGallery[] = array('img' => $image->standard_resolution, 'main' => $image->main);
|
1699 |
-
}
|
1700 |
-
}
|
1701 |
}
|
1702 |
|
1703 |
-
|
1704 |
-
$dataPrd =
|
1705 |
-
|
1706 |
-
'type_id' => 'simple',
|
1707 |
-
'sku' => $IDSKUProd,
|
1708 |
-
'name' => $sku->title,
|
1709 |
-
'description' => $sku->title,
|
1710 |
-
'short_description' => $sku->title,
|
1711 |
-
$priceField => $sku->price,
|
1712 |
-
'created_at' => strtotime('now'),
|
1713 |
-
'updated_at' => strtotime('now'),
|
1714 |
-
'id_anymarket' => $sku->idProduct,
|
1715 |
-
'weight' => $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight,
|
1716 |
-
'store_id' => $storeID,
|
1717 |
-
'website_ids' => array($websiteID),
|
1718 |
-
$brand => $this->procAttrConfig($brand, $ProdsJSON->brand, 0),
|
1719 |
-
$model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
|
1720 |
-
$video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
|
1721 |
-
|
1722 |
-
$volume_comprimento => $this->convertUnitMeasurement($UnitMeasurement, $vLength, 0),
|
1723 |
-
$volume_altura => $this->convertUnitMeasurement($UnitMeasurement, $vHeight, 0),
|
1724 |
-
$volume_largura => $this->convertUnitMeasurement($UnitMeasurement, $vWidth, 0),
|
1725 |
-
|
1726 |
-
$warranty_time => $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0),
|
1727 |
-
$nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
|
1728 |
-
$nbm_origin => $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0),
|
1729 |
-
$ean => $this->procAttrConfig($ean, $sku->ean, 0),
|
1730 |
-
$warranty_text => $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0),
|
1731 |
-
'msrp_enabled' => '2',
|
1732 |
-
'categoria_anymarket' => $ProdsJSON->category,
|
1733 |
-
$variationArray[ $idVar ] => $varAttr,
|
1734 |
-
);
|
1735 |
-
|
1736 |
-
foreach ($ProdsJSON->attributes as $attrProd) {
|
1737 |
-
$dataPrd[ strtolower($attrProd->name) ] = $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0);
|
1738 |
-
}
|
1739 |
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
|
1749 |
-
|
1750 |
-
|
1751 |
|
1752 |
-
|
1753 |
-
}else{
|
1754 |
-
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1755 |
-
$anymarketlog->setLogDesc( 'Opção de variação sem correspondente no magento ('.$variationArray[ $idVar ].') - '.$descVar );
|
1756 |
-
$anymarketlog->setStatus("0");
|
1757 |
-
$anymarketlog->setStores(array($storeID));
|
1758 |
-
$anymarketlog->save();
|
1759 |
-
}
|
1760 |
}else{
|
|
|
|
|
1761 |
//Atualiza Imagens
|
1762 |
$this->update_image_product($product, $ProdsJSON, $IDSKUProd);
|
1763 |
|
@@ -1774,7 +1844,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1774 |
$product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
|
1775 |
|
1776 |
$product->setData($priceField, $sku->price);
|
1777 |
-
$product->setData(
|
1778 |
$product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
|
1779 |
$product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
|
1780 |
|
@@ -1823,12 +1893,13 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1823 |
}
|
1824 |
|
1825 |
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
|
1826 |
-
|
1827 |
|
1828 |
$prod = null;
|
1829 |
foreach ($collectionConfigurable as $prodConfig) {
|
1830 |
-
$
|
1831 |
-
if( $
|
|
|
1832 |
break;
|
1833 |
}
|
1834 |
|
@@ -1873,7 +1944,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1873 |
$dataProdConfig[$fieldConfig] = $ProdsJSON->description;
|
1874 |
}
|
1875 |
|
1876 |
-
$this->update_configurable_product($storeID, $prod->getId(), $dataProdConfig, $prodSimpleFromConfig
|
1877 |
}
|
1878 |
}else{
|
1879 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
@@ -1882,7 +1953,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1882 |
$anymarketlog->setStores(array($storeID));
|
1883 |
$anymarketlog->save();
|
1884 |
}
|
1885 |
-
|
1886 |
}else{
|
1887 |
foreach ($ProdsJSON->skus as $ProdJSON) {
|
1888 |
$skuProd = $ProdJSON;
|
@@ -1910,14 +1981,14 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1910 |
'type_id' => 'simple',
|
1911 |
'sku' => $IDSkuJsonProd,
|
1912 |
'name' => $skuProd->title,
|
1913 |
-
|
1914 |
'created_at' => strtotime('now'),
|
1915 |
'updated_at' => strtotime('now'),
|
1916 |
'id_anymarket' => $ProdsJSON->id,
|
1917 |
'weight' => $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight,
|
1918 |
'store_id' => $storeID,
|
1919 |
'website_ids' => array($websiteID),
|
1920 |
-
|
1921 |
$nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
|
1922 |
$model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
|
1923 |
$video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
|
@@ -1954,6 +2025,8 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1954 |
|
1955 |
$ProdCrt = $this->create_simple_product($storeID, $data);
|
1956 |
}else{
|
|
|
|
|
1957 |
//Atualiza Imagens
|
1958 |
$this->update_image_product($product, $ProdsJSON, $IDSkuJsonProd);
|
1959 |
|
@@ -1966,16 +2039,13 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
1966 |
$product->setStoreId($storeID);
|
1967 |
$product->setName( $skuProd->title );
|
1968 |
|
1969 |
-
// $product->setDescription( $ProdsJSON->description );
|
1970 |
-
// $product->setShortDescription( $ProdsJSON->description );
|
1971 |
-
|
1972 |
foreach ($configureFieldsConfig as $fieldConfig) {
|
1973 |
$product->setData($fieldConfig, $ProdsJSON->description);
|
1974 |
}
|
1975 |
|
1976 |
$product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
|
1977 |
|
1978 |
-
$product->setData(
|
1979 |
$product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
|
1980 |
$product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
|
1981 |
|
@@ -2016,13 +2086,13 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
2016 |
return $ProdCrt;
|
2017 |
}
|
2018 |
|
2019 |
-
public function
|
2020 |
try {
|
2021 |
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
2022 |
if($typeSincProd == 0){
|
2023 |
$products = $products = Mage::getModel('catalog/product')
|
2024 |
-
|
2025 |
-
|
2026 |
$cont = 0;
|
2027 |
foreach($products as $product) {
|
2028 |
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
@@ -2043,7 +2113,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
2043 |
$sku = $product->getSku();
|
2044 |
$IDProd = $product->getId();
|
2045 |
|
2046 |
-
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($
|
2047 |
$anymarketproducts->setNmpId( $IDProd );
|
2048 |
$anymarketproducts->setNmpSku( $sku );
|
2049 |
$anymarketproducts->setNmpName( $name );
|
@@ -2084,6 +2154,140 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
2084 |
}
|
2085 |
}
|
2086 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2087 |
/**
|
2088 |
* @param $IDProd
|
2089 |
* @param $QtdStock
|
@@ -2092,33 +2296,52 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
2092 |
public function updatePriceStockAnyMarket($storeID, $IDProd, $QtdStock, $Price){
|
2093 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IDProd );
|
2094 |
if($product->getTypeID() != "configurable"){
|
2095 |
-
if(
|
2096 |
-
$anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getId(), 'nmp_id');
|
2097 |
if( ($anymarketproductsUpdt->getData('nmp_status_int') != 'Não integrado (Magento)') ){
|
2098 |
-
$
|
2099 |
-
|
2100 |
-
$
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2105 |
}
|
2106 |
-
}
|
2107 |
|
2108 |
-
|
2109 |
-
|
2110 |
-
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
2111 |
-
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
2112 |
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
|
|
|
|
|
|
2118 |
|
2119 |
-
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
2120 |
if( $typeSincProd == 0 ){
|
2121 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2122 |
if($filter == 'final_price'){
|
2123 |
$Price = $product->getFinalPrice();
|
2124 |
}else{
|
@@ -2128,51 +2351,61 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
|
|
2128 |
$Price = null;
|
2129 |
}
|
2130 |
|
2131 |
-
$typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
2132 |
if( $typeSincOrder == 0 ){
|
2133 |
$QtdStock = null;
|
2134 |
}elseif( !is_numeric ( $QtdStock ) ){
|
2135 |
$QtdStock = null;
|
2136 |
}
|
|
|
2137 |
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
}
|
2163 |
}
|
|
|
2164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2165 |
}
|
2166 |
}
|
2167 |
}
|
2168 |
}
|
2169 |
}else{
|
2170 |
-
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
2171 |
-
|
2172 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
|
|
2173 |
foreach($childProducts as $child) {
|
2174 |
$this->updatePriceStockAnyMarket($storeID, $child->getId(), $child->getStockItem()->getQty(), $child->getData($filter));
|
2175 |
}
|
|
|
2176 |
}
|
2177 |
|
2178 |
|
10 |
*/
|
11 |
private function checkArrayAttributes($arrAttr, $key, $value){
|
12 |
foreach ($arrAttr as $arrVal) {
|
13 |
+
if( isset($arrVal[$key]) ){
|
14 |
+
if( $arrVal[$key] == $value ){
|
15 |
+
return true;
|
16 |
+
}
|
17 |
}
|
18 |
}
|
19 |
return false;
|
107 |
return $fieldDesc;
|
108 |
}
|
109 |
|
110 |
+
public function saveCallbackReceiver($sku){
|
111 |
+
$cache = Mage::app()->getCache();
|
112 |
+
$cache->save("sendToAnymarket", "callback_product_executed_".$sku, array($sku."_cached"), 60);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Validate if callback send by module
|
117 |
+
*
|
118 |
+
* @param $storeID
|
119 |
+
* @param $transmissionID
|
120 |
+
* @return boolean
|
121 |
+
*/
|
122 |
+
public function validateCallbackReceiver($storeID, $transmissionID){
|
123 |
+
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
124 |
+
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
125 |
+
|
126 |
+
$headers = array(
|
127 |
+
"Content-type: application/json",
|
128 |
+
"Cache-Control: no-cache",
|
129 |
+
"gumgaToken: ".$TOKEN
|
130 |
+
);
|
131 |
+
|
132 |
+
$transmissionReturn = $this->CallAPICurl("GET", $HOST."/v2/transmissions/".$transmissionID, $headers, null);
|
133 |
+
if($transmissionReturn['error'] != '1') {
|
134 |
+
$JSONTransmission = $transmissionReturn['return'];
|
135 |
+
$sku = $JSONTransmission->sku->partnerId;
|
136 |
+
|
137 |
+
$cache = Mage::app()->getCache();
|
138 |
+
if ( $cache->load( 'callback_product_executed_'.$sku ) ) {
|
139 |
+
$cache->remove( 'callback_product_executed_'.$sku );
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* get product by sku in anymarket because dont have endpoint for this
|
150 |
+
*
|
151 |
+
* @param $sku
|
152 |
+
* @param $HOST
|
153 |
+
* @param $header
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public function getProductBySKUInAnymarket( $sku, $HOST, $header ){
|
157 |
+
$returnProd = $this->CallAPICurl("GET", $HOST."/v2/products/?sku=".$sku, $header, null);
|
158 |
+
|
159 |
+
if($returnProd['error'] != '1'){
|
160 |
+
$JSON = json_decode(json_encode($returnProd['return']));
|
161 |
+
$skuAM = array_shift($JSON->content)->id;
|
162 |
+
|
163 |
+
if($skuAM != '') {
|
164 |
+
$returnProd = array( "id" => $skuAM );
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
return $returnProd;
|
169 |
+
}
|
170 |
+
|
171 |
/**
|
172 |
* get decription by configuration
|
173 |
*
|
338 |
* @param $idProd
|
339 |
* @param $dataProdConfig
|
340 |
* @param $simpleProducts
|
|
|
341 |
* @return Mage_Catalog_Model_Product
|
342 |
*/
|
343 |
+
private function update_configurable_product($storeID, $idProd, $dataProdConfig, $simpleProducts){
|
344 |
$productGenerator = Mage::helper('db1_anymarket/productgenerator');
|
345 |
+
$product = $productGenerator->updateConfigurableProduct($storeID, $idProd, $dataProdConfig, $simpleProducts);
|
346 |
+
|
347 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Updated').' ('.$product->getSku().')';
|
348 |
$returnProd['error'] = '0';
|
349 |
$returnProd['json'] = '';
|
429 |
}
|
430 |
}
|
431 |
|
432 |
+
//OBTEM IMAGENS DO MAGENTO
|
433 |
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
|
434 |
$items = $mediaApi->items($Prod->getId());
|
435 |
$imagesGalleryMG = array();
|
439 |
$imagesGalleryMG[] = array('ctrl' => $crltImg, 'img' => $item['url'], 'file' => $item['file'] );
|
440 |
}
|
441 |
|
442 |
+
//OBTEM IMAGENS DO ANYMARKET
|
443 |
$imagesGalleryAM = array();
|
444 |
foreach ($ProdsJSON->photos as $image) {
|
445 |
+
$crltImgAM = $image->original;
|
446 |
$crltImgAM = str_replace(strrchr($crltImgAM,"."), "", $crltImgAM);
|
447 |
|
448 |
+
$urlImage = null;
|
449 |
+
if( isset($image->url) ){
|
450 |
+
$urlImage = $image->url;
|
451 |
+
}elseif( isset($image->standardUrl) ){
|
452 |
+
$urlImage = $image->standardUrl;
|
453 |
+
}elseif( isset($image->original) ){
|
454 |
+
$urlImage = $image->original;
|
455 |
}
|
|
|
456 |
|
457 |
+
if( $urlImage != null ){
|
458 |
+
if( !empty($variation) ){
|
459 |
+
if (in_array( $image->variationValue, $variation)) {
|
460 |
+
$imagesGalleryAM[] = array('ctrl' => md5($crltImgAM . $idClient), 'img' => $urlImage, 'main' => $image->main);
|
461 |
+
}
|
462 |
+
}else{
|
463 |
+
$imagesGalleryAM[] = array('ctrl' => md5($crltImgAM . $idClient), 'img' => $urlImage, 'main' => $image->main);
|
464 |
+
}
|
465 |
}
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
|
468 |
//COMPARA IMG AM COM MG SE TIVER DIVERCIA REMOVE DO PRODUTO
|
470 |
if ($diffMG) {
|
471 |
foreach ($diffMG as $diffMG_value) {
|
472 |
$mediaApi->remove($Prod->getId(), $diffMG_value['file']);
|
|
|
473 |
}
|
474 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
+
//COMPARA IMG AM COM MG SE TIVER DIVERGENCIA ADD NO PRODUTO
|
477 |
+
$diffAM = $this->compareArrayImage($imagesGalleryAM, $imagesGalleryMG);
|
478 |
+
if ($diffAM) {
|
479 |
+
foreach ($diffAM as $diffAM_value) {
|
480 |
+
$imagesGallery[] = array('img' => $diffAM_value['img'], 'main' => $diffAM_value['main']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
}
|
482 |
+
|
483 |
+
$dataImgs = array('images' => $imagesGallery, 'sku' => $idClient);
|
484 |
+
$productGenerator = Mage::helper('db1_anymarket/productgenerator');
|
485 |
+
$productGenerator->updateImages($Prod, $dataImgs);
|
486 |
}
|
487 |
}
|
488 |
|
495 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
496 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
497 |
|
498 |
+
$headers = array(
|
499 |
+
"Content-type: application/json",
|
500 |
"Cache-Control: no-cache",
|
501 |
"gumgaToken: ".$TOKEN
|
502 |
);
|
|
|
503 |
// SINCRONIZA AS FOTOS E SKUS
|
504 |
+
if($product->getData('id_anymarket') != "" || $product->getData('id_anymarket') != 0) {
|
505 |
+
$skusProd = $this->CallAPICurl("GET", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, null);
|
506 |
+
if ($skusProd['error'] == '0') {
|
507 |
+
foreach ($skusParam as $skuPut) {
|
508 |
+
$prodSimple = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuPut['partnerId']);
|
509 |
+
if ($prodSimple->getData('id_anymarket') != '') {
|
510 |
+
$paramSku = array(
|
511 |
+
"title" => $skuPut['title'],
|
512 |
+
"partnerId" => $skuPut['partnerId'],
|
513 |
+
"ean" => $skuPut['ean'],
|
514 |
+
"amount" => $skuPut['amount'],
|
515 |
+
"price" => $skuPut['price'],
|
516 |
+
);
|
517 |
|
518 |
+
if (isset($skuPut['variations'])) {
|
519 |
+
foreach ($skuPut['variations'] as $variationPut) {
|
520 |
+
Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $prodSimple, $variationPut);
|
521 |
+
}
|
522 |
+
$paramSku['variations'] = $skuPut['variations'];
|
523 |
+
} else {
|
524 |
+
Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $product, null);
|
525 |
}
|
|
|
|
|
|
|
|
|
526 |
|
527 |
+
$flagHSku = '';
|
528 |
+
if (isset($skusProd['return'])) {
|
529 |
+
foreach ($skusProd['return'] as $skuAM) {
|
530 |
+
if ($skuAM->partnerId == $prodSimple->getSku()) {
|
531 |
+
$flagHSku = $skuAM->id;
|
532 |
+
break;
|
533 |
+
}
|
534 |
}
|
535 |
}
|
|
|
536 |
|
537 |
+
if ($flagHSku != '') {
|
538 |
+
$skuProdReturn = $this->CallAPICurl("PUT", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus/" . $flagHSku, $headers, $paramSku);
|
539 |
|
540 |
+
if ($skuProdReturn['error'] == '0') {
|
541 |
+
$skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Updated') . ' (' . $skuPut['partnerId'] . ')';
|
542 |
+
}
|
543 |
+
} else {
|
544 |
+
$skuProdReturn = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, $paramSku);
|
545 |
|
546 |
+
if ($skuProdReturn['error'] == '0') {
|
547 |
+
$skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Created') . ' (' . $skuPut['partnerId'] . ')';
|
548 |
+
}
|
549 |
}
|
|
|
550 |
|
551 |
+
$this->saveLogsProds($storeID, "1", $skuProdReturn, $prodSimple);
|
552 |
+
}
|
553 |
}
|
554 |
+
} else {
|
555 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
556 |
+
$anymarketlog->setLogDesc('Error on get Images Anymarket from sku.');
|
557 |
+
$anymarketlog->setLogJson($skusProd['json']);
|
558 |
+
$anymarketlog->setLogId($product->getSku());
|
559 |
+
$anymarketlog->setStatus("1");
|
560 |
+
$anymarketlog->setStores(array($storeID));
|
561 |
+
$anymarketlog->save();
|
562 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
}
|
565 |
|
574 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
575 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
576 |
|
577 |
+
$headers = array(
|
578 |
"Content-type: application/json",
|
579 |
"Accept: */*",
|
580 |
"gumgaToken: ".$TOKEN
|
608 |
}else{
|
609 |
return '';
|
610 |
}
|
611 |
+
|
612 |
}else{
|
613 |
return $brand->getData('brd_id');
|
614 |
}
|
615 |
}
|
616 |
|
617 |
+
|
618 |
+
public function prepareForSendProduct($storeID, $product){
|
619 |
+
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
620 |
+
if( $typeSincProd != 0 ) {
|
621 |
+
return false;
|
622 |
+
}
|
623 |
+
|
624 |
+
if( $product->getData('integra_anymarket') != 1 ){
|
625 |
+
return false;
|
626 |
+
}
|
627 |
+
|
628 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
629 |
+
$stockQty = $stock->getQty();
|
630 |
+
if($product->getTypeID() == "configurable"){
|
631 |
+
//PRODUTO CONFIGURAVEL
|
632 |
+
Mage::getModel('catalog/product_type_configurable')->getProduct($product)->unsetData('_cache_instance_products');
|
633 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
634 |
+
if(count($childProducts) > 0){
|
635 |
+
Mage::getSingleton('core/session')->setImportProdsVariable('false');
|
636 |
+
foreach ($childProducts as $prodCh) {
|
637 |
+
$productChild = Mage::getModel('catalog/product')->setStoreId($storeID)->load($prodCh->getId());
|
638 |
+
if( $productChild->getData('integra_anymarket') != 1 ){
|
639 |
+
$productChild->setData('integra_anymarket', $product->getData('integra_anymarket') );
|
640 |
+
$productChild->save();
|
641 |
+
}
|
642 |
+
}
|
643 |
+
Mage::getSingleton('core/session')->setImportProdsVariable('true');
|
644 |
+
|
645 |
+
Mage::helper('db1_anymarket/product')->sendProductToAnyMarket($storeID, $product->getId());
|
646 |
+
}
|
647 |
+
}else{
|
648 |
+
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
649 |
+
|
650 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
651 |
+
$ean = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_ean_field', $storeID);
|
652 |
+
|
653 |
+
if($filter == 'final_price'){
|
654 |
+
$stkPrice = $product->getFinalPrice();
|
655 |
+
}else{
|
656 |
+
$stkPrice = $product->getData($filter);
|
657 |
+
}
|
658 |
+
|
659 |
+
if($parentIds){
|
660 |
+
//PRODUTO SIMPLES FILHO DE UM CONFIG
|
661 |
+
$attributeOptions = array();
|
662 |
+
foreach ($parentIds as $parentId) {
|
663 |
+
$productConfig = Mage::getModel('catalog/product')->load($parentId);
|
664 |
+
|
665 |
+
if( $productConfig->getId() ) {
|
666 |
+
foreach ($productConfig->getTypeInstance()->getConfigurableAttributes() as $attribute) {
|
667 |
+
$value = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
|
668 |
+
$attributeOptions[$attribute->getLabel()] = $value;
|
669 |
+
}
|
670 |
+
|
671 |
+
foreach ($parentIds as $parentId) {
|
672 |
+
$arrSku = array(
|
673 |
+
"variations" => $attributeOptions,
|
674 |
+
"price" => $stkPrice,
|
675 |
+
"amount" => $stockQty,
|
676 |
+
"ean" => $product->getData($ean),
|
677 |
+
"partnerId" => $product->getSku(),
|
678 |
+
"title" => $product->getName(),
|
679 |
+
"idProduct" => $product->getData('id_anymarket'),
|
680 |
+
"internalIdProduct" => $product->getId(),
|
681 |
+
);
|
682 |
+
|
683 |
+
Mage::helper('db1_anymarket/product')->sendImageSkuToAnyMarket($storeID, $product, array($arrSku));
|
684 |
+
}
|
685 |
+
}else{
|
686 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
687 |
+
$anymarketlog->setLogDesc('Produto possui registro de um Parent, porem esse parent não existe no Magento');
|
688 |
+
$anymarketlog->setLogId($product->getSku());
|
689 |
+
$anymarketlog->setStatus("1");
|
690 |
+
$anymarketlog->setStores(array($storeID));
|
691 |
+
$anymarketlog->save();
|
692 |
+
|
693 |
+
//PRODUTO FILHO DE UM PAI QUE AGORA EH SIMPLES
|
694 |
+
Mage::helper('db1_anymarket/product')->sendProductToAnyMarket($storeID, $product->getId());
|
695 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $stockQty, $product->getData($filter));
|
696 |
+
}
|
697 |
+
}
|
698 |
+
}else{
|
699 |
+
//PRODUTO SIMPLES E OUTROS
|
700 |
+
Mage::helper('db1_anymarket/product')->sendProductToAnyMarket($storeID, $product->getId());
|
701 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $stockQty, $product->getData($filter));
|
702 |
+
}
|
703 |
+
|
704 |
+
}
|
705 |
+
}
|
706 |
+
|
707 |
/**
|
708 |
* send product to AnyMarket
|
709 |
*
|
743 |
if((string)(float)$varPriceFactor == $varPriceFactor) {
|
744 |
$varPriceFactor = (float)$varPriceFactor;
|
745 |
if($varPriceFactor > 99){
|
746 |
+
array_push($arrProd, Mage::helper('db1_anymarket')->__('AnyMarket Price Factor(Limit 99)'));
|
747 |
}
|
748 |
}else{
|
749 |
array_push($arrProd, Mage::helper('db1_anymarket')->__('AnyMarket Price Factor(Only Number)') );
|
752 |
// verifica Origin null ou em branco
|
753 |
$originData = $this->procAttrConfig($nbm_origin, $product->getData( $nbm_origin ), 1);
|
754 |
if($originData == null || $originData == ''){
|
755 |
+
array_push($arrProd, Mage::helper('db1_anymarket')->__('AnyMarket Origin') );
|
756 |
}
|
757 |
|
758 |
//trata para nao enviar novamente solicitacao quando o erro for o mesmo
|
759 |
if( ($product->getData('id_anymarket') == '') || ($product->getData('id_anymarket') == '0') ){
|
760 |
$prodErrorCtrl = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)
|
761 |
+
->load($product->getId(), 'nmp_id');
|
762 |
if( $prodErrorCtrl->getData('nmp_id') != null ){
|
763 |
$descError = $prodErrorCtrl->getData('nmp_desc_error');
|
764 |
|
765 |
// Trata para nao ficar disparando em cima da Duplicadade de SKU
|
766 |
$mesgDuplSku = strrpos($descError, "Duplicidade de SKU:");
|
767 |
if ($mesgDuplSku !== false) {
|
768 |
+
$bindProds = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_bind_product_field', $storeID);
|
769 |
+
if( $bindProds == '0' ) {
|
770 |
+
$oldSkuErr = $this->getBetweenCaract($descError, '"', '"');
|
771 |
|
772 |
+
if ($oldSkuErr == $product->getSku()) {
|
773 |
+
array_push($arrProd, 'Duplicidade de SKU: ' . Mage::helper('db1_anymarket')->__('Already existing SKU in anymarket') . ' "' . $oldSkuErr . '".');
|
774 |
+
}
|
775 |
}
|
776 |
}
|
777 |
}
|
804 |
$Weight = "";
|
805 |
if($product->getTypeID() == "configurable"){
|
806 |
$confID = $product->getId();
|
807 |
+
if( $product->getData('integra_images_root_anymarket') == 1 ) {
|
808 |
+
//obtem as imagens do produto(Config)
|
809 |
+
$itemsIMG = Mage::helper('db1_anymarket/image')->getImagesOfProduct($storeID, $product, null);
|
810 |
+
}
|
811 |
}else{
|
812 |
// verifica se é um simples pertecente a um Configurable
|
813 |
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
814 |
+
$Weight = ($product->getTypeID() == "bundle" && $product->getPriceType() == 0 ) ? $this->getWeightOfBundle($storeID, $product) : $product->getWeight();
|
815 |
if (isset($parentIds[0])) {
|
816 |
$confID = $parentIds[0];
|
817 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($confID);
|
818 |
}
|
819 |
+
|
820 |
+
//obtem as imagens do produto(Simples)
|
821 |
+
$itemsIMG = Mage::helper('db1_anymarket/image')->getImagesOfProduct($storeID, $product, null);
|
822 |
}
|
823 |
|
824 |
+
if( !$product->getId() ){
|
825 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
826 |
+
$anymarketlog->setLogDesc('Produto com ID '.$confID.' consta nos produtos relacionado, mas nao existe no Magento.');
|
827 |
+
$anymarketlog->setLogJson('');
|
828 |
+
$anymarketlog->setLogId($confID);
|
829 |
+
$anymarketlog->setStatus("1");
|
830 |
+
$anymarketlog->setStores(array($storeID));
|
831 |
+
$anymarketlog->save();
|
832 |
+
|
833 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
}
|
835 |
|
836 |
//obtem os produtos configs - verifica se e configurable
|
837 |
$ArrSimpleConfigProd = array();
|
838 |
if($confID != ""){
|
839 |
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
840 |
+
$attributesConf = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
|
841 |
|
842 |
foreach($childProducts as $child) {
|
843 |
+
$SimpleConfigProd = Mage::getModel('catalog/product')->setStoreId($storeID)->load($child->getId());
|
844 |
|
845 |
if ($Weight == "") {
|
846 |
$Weight = $SimpleConfigProd->getWeight();
|
871 |
}
|
872 |
|
873 |
//obtem as imagens do produto (Obtem os simples e relaciona as variacoes)
|
874 |
+
$itemsIMGSimple = Mage::helper('db1_anymarket/image')->getImagesOfProduct($storeID, $SimpleConfigProd, $ArrVariationValues);
|
875 |
+
if( isset($itemsIMG) && count($itemsIMG) > 0 ){
|
876 |
+
foreach ($itemsIMGSimple as $itemImg){
|
877 |
+
if( !in_array($itemImg, $itemsIMG) ){
|
878 |
+
array_push($itemsIMG, $itemImg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
}
|
880 |
}
|
881 |
+
}else{
|
882 |
+
$itemsIMG = $itemsIMGSimple;
|
883 |
}
|
884 |
|
885 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
915 |
"idProduct" => $SimpleConfigProd->getData('id_anymarket'),
|
916 |
"internalIdProduct" => $SimpleConfigProd->getId(),
|
917 |
);
|
918 |
+
}
|
919 |
|
920 |
}
|
921 |
|
927 |
|
928 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
929 |
|
930 |
+
if ($filter == 'final_price') {
|
931 |
$stkPrice = $product->getFinalPrice();
|
932 |
+
} else {
|
933 |
$stkPrice = $product->getData($filter);
|
934 |
}
|
935 |
|
936 |
+
if($product->getTypeID() == "bundle" && $product->getPriceType() == 0 && $stkPrice == null) {
|
937 |
+
$priceModel = $product->getPriceModel();
|
938 |
+
$PricesBundle = $priceModel->getTotalPrices($product, null, true, false);
|
939 |
+
$stkPrice = reset($PricesBundle);
|
940 |
+
}
|
941 |
+
|
942 |
$prodSkuJ = $product->getSku();
|
943 |
|
944 |
// verificacao dos dados de price
|
947 |
}
|
948 |
|
949 |
// verificacao dos dados de SKU
|
950 |
+
$cValid = array('.', '-', '_');
|
951 |
+
if(!ctype_alnum(str_replace($cValid, '', $prodSkuJ))) {
|
952 |
array_push($arrProd, 'SKU ('.$prodSkuJ.')');
|
953 |
}
|
954 |
|
955 |
+
$ArrSimpleConfigProd[] = array(
|
956 |
+
"price" => $stkPrice,
|
957 |
+
"amount" => $stock->getQty(),
|
958 |
+
"ean" => $product->getData($ean),
|
959 |
+
"partnerId" => $prodSkuJ,
|
960 |
+
"title" => $product->getName(),
|
961 |
+
"idProduct" => $product->getData('id_anymarket'),
|
962 |
+
"internalIdProduct" => $product->getId(),
|
963 |
+
);
|
|
|
|
|
964 |
}
|
965 |
|
966 |
+
|
967 |
//cria os headers
|
968 |
+
$headers = array(
|
969 |
+
"Content-type: application/json",
|
970 |
"Cache-Control: no-cache",
|
971 |
"gumgaToken: ".$TOKEN
|
972 |
);
|
983 |
$attributeSetName = $attributeSetModel->getAttributeSetId();
|
984 |
|
985 |
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
986 |
+
->setAttributeSetFilter($attributeSetName)
|
987 |
+
->getItems();
|
988 |
|
989 |
$ArrAttributes = array();
|
990 |
$contIndexAttr = 0;
|
991 |
foreach ($attributes as $attribute){
|
992 |
$attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($attribute->getAttributeId(), 'nma_id_attr');
|
993 |
if($attrCheck->getData('nma_id_attr') != null){
|
994 |
+
if( ($attrCheck->getData('status') == 1) &&
|
995 |
+
( $attribute->getAttributeCode() != $model ) &&
|
996 |
+
(!$this->checkArrayAttributes( $ArrAttributes, "description", $attribute->getFrontendLabel() ) )
|
997 |
+
){
|
998 |
+
if($confID == ""){
|
999 |
+
$valAttr = $this->procAttrConfig($attribute->getAttributeCode(), $product->getData( $attribute->getAttributeCode() ), 1);
|
1000 |
+
if( $valAttr != null || $valAttr != '' ){
|
1001 |
+
$ArrAttributes[] = array("index" => $contIndexAttr, "name" => $attribute->getFrontendLabel(), "value" => $valAttr);
|
1002 |
+
$contIndexAttr = $contIndexAttr+1;
|
1003 |
+
}
|
1004 |
+
}else{
|
1005 |
+
foreach ($attributesConf as $attributeConf){
|
1006 |
+
if(!in_array($attribute->getAttributeCode(), $attributeConf)){
|
1007 |
+
if(!$this->checkArrayAttributes($ArrAttributes, "description", $attribute->getFrontendLabel())){
|
1008 |
+
$valAttr = $this->procAttrConfig($attribute->getAttributeCode(), $product->getData( $attribute->getAttributeCode() ), 1);
|
1009 |
+
if( $valAttr != null || $valAttr != '' ){
|
1010 |
+
$ArrAttributes[] = array("index" => $contIndexAttr, "name" => $attribute->getFrontendLabel(), "value" => $valAttr);
|
1011 |
+
$contIndexAttr = $contIndexAttr+1;
|
|
|
1012 |
}
|
1013 |
}
|
1014 |
}
|
1015 |
}
|
1016 |
}
|
1017 |
+
|
1018 |
}
|
1019 |
}
|
1020 |
}
|
1023 |
$vHeight = $this->procAttrConfig($volume_altura, $product->getData( $volume_altura ), 1);
|
1024 |
$vWidth = $this->procAttrConfig($volume_largura, $product->getData( $volume_largura ), 1);
|
1025 |
$vLength = $this->procAttrConfig($volume_comprimento, $product->getData( $volume_comprimento ), 1);
|
1026 |
+
if( $product->getTypeID() == "bundle" ){
|
1027 |
+
if( ($vHeight == "") || ($vWidth == "") || ($vLength == "") ) {
|
1028 |
+
$arrDim = $this->getDimensionsOfBundle($storeID, $product, $volume_altura, $volume_largura, $volume_comprimento);
|
1029 |
+
|
1030 |
+
$vHeight = $arrDim['height'];
|
1031 |
+
$vWidth = $arrDim['width'];
|
1032 |
+
$vLength = $arrDim['length'];
|
1033 |
+
}
|
1034 |
+
}
|
1035 |
|
1036 |
//Cria os params
|
1037 |
$param = array(
|
1058 |
"height" => $this->convertUnitMeasurement($UnitMeasurement, $vHeight, 1),
|
1059 |
"width" => $this->convertUnitMeasurement($UnitMeasurement, $vWidth, 1),
|
1060 |
"length" => $this->convertUnitMeasurement($UnitMeasurement, $vLength, 1),
|
1061 |
+
"images" => $this->unique_multidim_array($itemsIMG, 'url'),
|
1062 |
"priceFactor" => $varPriceFactor,
|
1063 |
"calculatedPrice" => $product->getData( $calculated_price ) == 0 ? false : true,
|
1064 |
// OBTER ATRIBUTOS CUSTOM
|
1123 |
$returnProd['error'] = '0';
|
1124 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Successfully synchronized product.');
|
1125 |
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
1126 |
+
|
1127 |
+
$this->saveCallbackReceiver( $product->getSku() );
|
1128 |
}else{
|
1129 |
$returnProd['error'] = '1';
|
1130 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Error synchronizing, code anymarket invalid.');
|
1132 |
}
|
1133 |
|
1134 |
}else{
|
1135 |
+
if (strpos($returnProd['return'], 'Duplicidade de SKU: O SKU informado') === false) {
|
1136 |
+
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
1137 |
+
}else{
|
1138 |
+
$bindProds = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_bind_product_field', $storeID);
|
1139 |
+
if( $bindProds == '1' ) {
|
1140 |
+
|
1141 |
+
if($product->getTypeID() == "configurable") {
|
1142 |
+
//RELACIONA OS FILHOS
|
1143 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
1144 |
+
|
1145 |
+
$idProdCh = null;
|
1146 |
+
foreach ($childProducts as $child){
|
1147 |
+
$currentProdDup = $this->getProductBySKUInAnymarket($child->getSku(), $HOST, $headers);
|
1148 |
+
|
1149 |
+
if ( isset($currentProdDup['id']) ) {
|
1150 |
+
$currentProdDup['error'] = '0';
|
1151 |
+
$idProdCh = $currentProdDup["id"];
|
1152 |
+
|
1153 |
+
$productC = Mage::getModel('catalog/product')->setStoreId($storeID)->load($child->getId());
|
1154 |
+
|
1155 |
+
if ($productC->getIntegraAnymarket() != '1') {
|
1156 |
+
$productC->setIntegraAnymarket('1');
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
$productC->setIdAnymarket($idProdCh);
|
1160 |
+
$productC->save();
|
1161 |
+
|
1162 |
+
$currentProdDup['return'] = Mage::helper('db1_anymarket')->__('SKU Related :') . $productC->getSku() . " - " . $idProdCh;
|
1163 |
+
$this->saveLogsProds($storeID, "1", $currentProdDup, $product);
|
1164 |
+
}else{
|
1165 |
+
$currentProdDup['error'] = '1';
|
1166 |
+
$currentProdDup['return'] = Mage::helper('db1_anymarket')->__('SKU to bond not found :').$child->getSku();
|
1167 |
+
$this->saveLogsProds($storeID, "1", $currentProdDup, $product);
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
if($idProdCh != null) {
|
1172 |
+
$productForSave = Mage::getModel('catalog/product')->setStoreId($storeID)->load($product->getId());
|
1173 |
+
$productForSave->setIdAnymarket($idProdCh);
|
1174 |
+
$productForSave->save();
|
1175 |
+
|
1176 |
+
$currentProdDup['error'] = '0';
|
1177 |
+
$currentProdDup['return'] = Mage::helper('db1_anymarket')->__('SKU Related :') . $productForSave->getSku() . " - " . $idProdCh;
|
1178 |
+
$this->saveLogsProds($storeID, "1", $currentProdDup, $productForSave);
|
1179 |
+
|
1180 |
+
//$this->sendProductToAnyMarket($storeID, $productForSave->getId());
|
1181 |
+
}
|
1182 |
+
}else{
|
1183 |
+
$currentProdDup = $this->getProductBySKUInAnymarket($product->getSku(), $HOST, $headers);
|
1184 |
+
if ( isset($currentProdDup['id']) ) {
|
1185 |
+
$returnProd['error'] = '0';
|
1186 |
+
|
1187 |
+
$productForSave = Mage::getModel('catalog/product')->setStoreId($storeID)->load($product->getId());
|
1188 |
+
$productForSave->setIdAnymarket( $currentProdDup["id"] );
|
1189 |
+
$productForSave->save();
|
1190 |
+
|
1191 |
+
$returnProd['return'] = Mage::helper('db1_anymarket')->__('SKU Related :') . $productForSave->getSku() . " - " . $currentProdDup["id"];
|
1192 |
+
$this->saveLogsProds($storeID, "1", $returnProd, $productForSave);
|
1193 |
+
|
1194 |
+
//$this->sendProductToAnyMarket($storeID, $productForSave->getId());
|
1195 |
+
} else {
|
1196 |
+
$currentProdDup['error'] = '1';
|
1197 |
+
$currentProdDup['return'] = Mage::helper('db1_anymarket')->__('SKU to bond not found :').$product->getSku();
|
1198 |
+
$this->saveLogsProds($storeID, "1", $currentProdDup, $product);
|
1199 |
+
}
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
}else{
|
1203 |
+
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
}
|
1207 |
|
1208 |
}else{
|
1209 |
$returnProd = $this->CallAPICurl("PUT", $HOST."/v2/products/".$product->getData('id_anymarket'), $headers, $param);
|
1210 |
if($returnProd['error'] == '0'){
|
1211 |
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Product Updated');
|
1212 |
+
|
1213 |
+
$this->saveCallbackReceiver( $product->getSku() );
|
1214 |
}
|
1215 |
|
1216 |
//ADICIONA UM NOVO SKU
|
1219 |
if($skuProdReturn['error'] == '0'){
|
1220 |
$skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Created').' ('.$skuPut['partnerId'].')';
|
1221 |
$this->saveLogsProds($storeID, "1", $skuProdReturn, $product);
|
1222 |
+
|
1223 |
+
$this->saveCallbackReceiver( $product->getSku() );
|
1224 |
}else{
|
1225 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
1226 |
$productSku = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuPut['partnerId'] );
|
1227 |
+
if ($productSku->getData() != null && $productSku->getId() != null && $productSku != null) {
|
1228 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productSku);
|
1229 |
+
$this->updatePriceStockAnyMarket($storeID, $productSku->getId(), $stock->getQty(), $productSku->getData($filter));
|
|
|
|
|
|
|
|
|
1230 |
}
|
1231 |
}
|
1232 |
}
|
1233 |
|
1234 |
$this->sendImageSkuToAnyMarket($storeID, $product, $param['skus']);
|
|
|
1235 |
$this->saveLogsProds($storeID, "1", $returnProd, $product);
|
1236 |
}
|
1237 |
return true;
|
1283 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
1284 |
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
1285 |
|
1286 |
+
$headers = array(
|
1287 |
"Content-type: application/json",
|
1288 |
"Accept: */*",
|
1289 |
"gumgaToken: ".$TOKEN
|
1332 |
$ProdsJSON = $returnProdSpecific['return'];
|
1333 |
|
1334 |
foreach ($ProdsJSON->skus as $sku) {
|
|
|
|
|
|
|
1335 |
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
1336 |
$stockItem->setData('is_in_stock', $sku->amount > 0 ? '1' : '0');
|
1337 |
$stockItem->setData('qty', $sku->amount);
|
1344 |
$anymarketlog->setStores(array($storeID));
|
1345 |
$anymarketlog->save();
|
1346 |
|
1347 |
+
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->getIdAnymarket(), 'nmp_id');
|
1348 |
if ($anymarketproducts->getNmpId() == null) {
|
1349 |
+
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->getId(), 'nmp_id');
|
1350 |
}
|
1351 |
|
1352 |
$anymarketproducts->setNmpId($product->getId());
|
1388 |
$transmissionToken = $transmissionIDs->token;
|
1389 |
|
1390 |
$transmissionReturn = $this->CallAPICurl("GET", $HOST."/v2/transmissions/".$transmissionID, $headers, null);
|
|
|
1391 |
$prodRet = "";
|
1392 |
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
1393 |
if($typeSincProd == 1) {
|
1394 |
if ($transmissionReturn['error'] == '1') {
|
1395 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1396 |
+
$anymarketlog->setLogDesc(Mage::helper('db1_anymarket')->__('Error on get transmissions '));
|
1397 |
$anymarketlog->setStatus("0");
|
1398 |
$anymarketlog->save();
|
1399 |
} else {
|
1400 |
$transmission = $transmissionReturn['return'];
|
1401 |
$statusTransmission = $transmission->publicationStatus;
|
1402 |
$IDProdTrans = $transmission->product->id;
|
|
|
1403 |
if ($statusTransmission == 'ACTIVE') {
|
1404 |
$arrVarSku = array();
|
1405 |
if (isset($transmission->sku->variations)) {
|
1442 |
$arrAttr = array();
|
1443 |
if (isset($transmission->characteristics)) {
|
1444 |
foreach ($transmission->characteristics as $carac) {
|
1445 |
+
$attrMG = Mage::getModel('eav/entity_attribute')->getCollection()
|
1446 |
+
->addFieldToFilter('frontend_label', $carac->name);
|
1447 |
+
|
1448 |
+
if ($attrMG->getSize() > 0) {
|
1449 |
+
array_push($arrAttr, array(
|
1450 |
+
"name" => $attrMG->getFirstItem()->getData('attribute_code'),
|
1451 |
+
"value" => $carac->value
|
1452 |
+
));
|
1453 |
+
}
|
1454 |
}
|
1455 |
}
|
1456 |
|
1459 |
"title" => $transmission->product->title,
|
1460 |
"idTransmission" => $transmissionIDs->id,
|
1461 |
"description" => isset($transmission->description) ? $transmission->description : null,
|
1462 |
+
"brand" => isset($transmission->brand->name) ? $transmission->brand->name : null,
|
1463 |
"model" => isset($transmission->model) ? $transmission->model : null,
|
1464 |
"videoURL" => isset($transmission->videoUrl) ? $transmission->videoUrl : null,
|
1465 |
"warrantyTime" => isset($transmission->warrantyTime) ? $transmission->warrantyTime : null,
|
1573 |
}
|
1574 |
$stockItem->save();
|
1575 |
}
|
|
|
1576 |
|
1577 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1578 |
$anymarketlog->setLogDesc( "Stock Updated" );
|
1593 |
}
|
1594 |
}else{
|
1595 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1596 |
+
$anymarketlog->setLogDesc( "Error on Update Stock from transmission" );
|
1597 |
$anymarketlog->setStatus("0");
|
1598 |
$anymarketlog->setStores(array($storeID));
|
1599 |
$anymarketlog->save();
|
1600 |
|
1601 |
+
$prodRet = "Error on Update Stock";
|
1602 |
}
|
1603 |
}
|
1604 |
}
|
1618 |
$prodRet = 'Product Created or updated.';
|
1619 |
}
|
1620 |
}
|
1621 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1622 |
+
$anymarketlog->setLogDesc($prodRet);
|
1623 |
+
$anymarketlog->setStatus("1");
|
1624 |
+
$anymarketlog->setStores(array($storeID));
|
1625 |
+
$anymarketlog->save();
|
1626 |
|
1627 |
return $prodRet;
|
1628 |
}
|
1629 |
|
1630 |
+
private function prepareToSaveSimpleProductConfigurable($storeID, $ProdsJSON, $sku, $variationArray){
|
1631 |
+
$imagesGallery = array();
|
1632 |
+
$AttributeIds = array();
|
1633 |
+
$objVariations = array();
|
1634 |
+
foreach ($sku->variations as $varValues) {
|
1635 |
+
$descVar = $varValues->description;
|
1636 |
+
$idVar = $varValues->variationTypeId;
|
1637 |
+
|
1638 |
+
$AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $variationArray[ $idVar ] );
|
1639 |
+
if (!in_array($AttributeId, $AttributeIds)) {
|
1640 |
+
$AttributeIds[] = $AttributeId;
|
1641 |
+
$collectionAttr = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
1642 |
+
->setPositionOrder('asc')
|
1643 |
+
->setAttributeFilter($AttributeId)
|
1644 |
+
->setStoreFilter(0)
|
1645 |
+
->load();
|
1646 |
+
|
1647 |
+
$AttributeOptions[$idVar] = $collectionAttr->toOptionArray();
|
1648 |
+
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
$varAttr = '';
|
1652 |
+
$descVarAttr = '';
|
1653 |
+
foreach ( $AttributeOptions[$idVar] as $attrOpt) {
|
1654 |
+
if($attrOpt['label'] == $descVar ){
|
1655 |
+
$varAttr = $attrOpt['value'];
|
1656 |
+
$descVarAttr = $attrOpt['label'];
|
1657 |
+
break;
|
1658 |
+
}
|
1659 |
+
}
|
1660 |
+
|
1661 |
+
if($varAttr != ''){
|
1662 |
+
foreach ($ProdsJSON->photos as $image) {
|
1663 |
+
if( $image->variationValue != null ){
|
1664 |
+
if( $image->variationValue == $descVarAttr ){
|
1665 |
+
$imagesGallery[] = array('img' => $image->standard_resolution, 'main' => $image->main);
|
1666 |
+
}
|
1667 |
+
}
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
$objVariations[ $variationArray[ $idVar ] ] = $varAttr;
|
1671 |
+
}else{
|
1672 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1673 |
+
$anymarketlog->setLogDesc( 'Opção de variação sem correspondente no magento ('.$varValues->variationTypeName.') - '.$descVar );
|
1674 |
+
$anymarketlog->setStatus("0");
|
1675 |
+
$anymarketlog->setStores(array($storeID));
|
1676 |
+
$anymarketlog->save();
|
1677 |
+
|
1678 |
+
return null;
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
return array( "idsVariations" => $AttributeIds,
|
1685 |
+
"variations" => $objVariations,
|
1686 |
+
"images" => $imagesGallery
|
1687 |
+
);
|
1688 |
+
}
|
1689 |
+
|
1690 |
|
1691 |
/**
|
1692 |
* @param $ProdsJSON
|
1735 |
if ( !empty( $ProdsJSON->variations ) ) {
|
1736 |
$prodSimpleFromConfig = array();
|
1737 |
$AttributeIds = array();
|
|
|
1738 |
|
1739 |
$variationArray = array();
|
1740 |
$sinc = '';
|
1741 |
foreach ($ProdsJSON->variations as $variation) {
|
1742 |
+
$AttrCtlr = Mage::getModel('eav/entity_attribute')->getCollection()
|
1743 |
+
->addFieldToFilter('frontend_label', $variation->name);
|
1744 |
+
$attrConfig = $AttrCtlr->getFirstItem();
|
1745 |
+
|
1746 |
+
if(!$attrConfig->getData()){
|
1747 |
$sinc = $variation->name;
|
1748 |
break;
|
1749 |
}
|
1750 |
+
$variationArray[$variation->id] = $attrConfig->getData('attribute_code');
|
1751 |
}
|
1752 |
|
1753 |
if($sinc == ''){
|
1757 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $IDSKUProd);
|
1758 |
|
1759 |
foreach ($sku->variations as $varValues) {
|
|
|
1760 |
$idVar = $varValues->variationTypeId;
|
1761 |
}
|
1762 |
|
1763 |
//trata as dimensoes
|
1764 |
+
$vHeight = $this->procAttrConfig($volume_altura, $ProdsJSON->height, 0);
|
1765 |
+
$vWidth = $this->procAttrConfig($volume_largura, $ProdsJSON->width, 0);
|
1766 |
$vLength = $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0);
|
1767 |
|
1768 |
if(!$product){
|
1769 |
+
$preparedProduct = $this->prepareToSaveSimpleProductConfigurable($storeID, $ProdsJSON, $sku, $variationArray);
|
1770 |
+
if( $preparedProduct == null ) {
|
1771 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1772 |
}
|
1773 |
|
1774 |
+
$AttributeIds = $preparedProduct['idsVariations'];
|
1775 |
+
$dataPrd = array(
|
1776 |
+
'attribute_set_id' => $AttrSet == null ? Mage::getModel('catalog/product')->getDefaultAttributeSetId() : $AttrSet,
|
1777 |
+
'type_id' => 'simple',
|
1778 |
+
'sku' => $IDSKUProd,
|
1779 |
+
'name' => $sku->title,
|
1780 |
+
'description' => $sku->title,
|
1781 |
+
'short_description' => $sku->title,
|
1782 |
+
$priceField => $sku->price,
|
1783 |
+
'created_at' => strtotime('now'),
|
1784 |
+
'updated_at' => strtotime('now'),
|
1785 |
+
'id_anymarket' => $sku->idProduct,
|
1786 |
+
'weight' => $MassUnit == 1 ? $ProdsJSON->weight * 1000 : $ProdsJSON->weight,
|
1787 |
+
'store_id' => $storeID,
|
1788 |
+
'website_ids' => array($websiteID),
|
1789 |
+
$brand => $this->procAttrConfig($brand, $ProdsJSON->brand, 0),
|
1790 |
+
$model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
|
1791 |
+
$video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
|
1792 |
+
|
1793 |
+
$volume_comprimento => $this->convertUnitMeasurement($UnitMeasurement, $vLength, 0),
|
1794 |
+
$volume_altura => $this->convertUnitMeasurement($UnitMeasurement, $vHeight, 0),
|
1795 |
+
$volume_largura => $this->convertUnitMeasurement($UnitMeasurement, $vWidth, 0),
|
1796 |
+
|
1797 |
+
$warranty_time => $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0),
|
1798 |
+
$nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
|
1799 |
+
$nbm_origin => $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0),
|
1800 |
+
$ean => $this->procAttrConfig($ean, $sku->ean, 0),
|
1801 |
+
$warranty_text => $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0),
|
1802 |
+
'msrp_enabled' => '2',
|
1803 |
+
'categoria_anymarket' => $ProdsJSON->category
|
1804 |
+
);
|
1805 |
|
1806 |
+
//adiciona no produto as variacoes
|
1807 |
+
foreach ($preparedProduct['variations'] as $varKey => $varObg) {
|
1808 |
+
$dataPrd[$varKey] = $varObg;
|
|
|
|
|
|
|
|
|
1809 |
}
|
1810 |
|
1811 |
+
foreach ($ProdsJSON->attributes as $attrProd) {
|
1812 |
+
$dataPrd[strtolower($attrProd->name)] = $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0);
|
1813 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
|
1815 |
+
$dataPrdSimple = array(
|
1816 |
+
'product' => $dataPrd,
|
1817 |
+
'stock_item' => array(
|
1818 |
+
'is_in_stock' => $sku->stockAmount > 0 ? '1' : '0',
|
1819 |
+
'qty' => $sku->stockAmount,
|
1820 |
+
),
|
1821 |
+
'images' => $preparedProduct['images'],
|
1822 |
+
);
|
1823 |
|
1824 |
+
$ProdReturn = $this->create_simple_product($storeID, $dataPrdSimple);
|
1825 |
+
$ProdCrt = $ProdReturn->getEntityId();
|
1826 |
|
1827 |
+
$product = Mage::getModel('catalog/product')->load($ProdCrt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1828 |
}else{
|
1829 |
+
$product->setUrlKey(false);
|
1830 |
+
|
1831 |
//Atualiza Imagens
|
1832 |
$this->update_image_product($product, $ProdsJSON, $IDSKUProd);
|
1833 |
|
1844 |
$product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
|
1845 |
|
1846 |
$product->setData($priceField, $sku->price);
|
1847 |
+
$product->setData($brand, $this->procAttrConfig($brand, $ProdsJSON->brand, 0));
|
1848 |
$product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
|
1849 |
$product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
|
1850 |
|
1893 |
}
|
1894 |
|
1895 |
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
|
1896 |
+
->addAttributeToFilter('type_id', array('eq' => 'configurable'));
|
1897 |
|
1898 |
$prod = null;
|
1899 |
foreach ($collectionConfigurable as $prodConfig) {
|
1900 |
+
$prodTmp = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $prodConfig->getId() );
|
1901 |
+
if( $prodTmp->getData('id_anymarket') == $ProdsJSON->id ){
|
1902 |
+
$prod = $prodTmp;
|
1903 |
break;
|
1904 |
}
|
1905 |
|
1944 |
$dataProdConfig[$fieldConfig] = $ProdsJSON->description;
|
1945 |
}
|
1946 |
|
1947 |
+
$this->update_configurable_product($storeID, $prod->getId(), $dataProdConfig, $prodSimpleFromConfig);
|
1948 |
}
|
1949 |
}else{
|
1950 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
1953 |
$anymarketlog->setStores(array($storeID));
|
1954 |
$anymarketlog->save();
|
1955 |
}
|
1956 |
+
// PROD SIMPLES
|
1957 |
}else{
|
1958 |
foreach ($ProdsJSON->skus as $ProdJSON) {
|
1959 |
$skuProd = $ProdJSON;
|
1981 |
'type_id' => 'simple',
|
1982 |
'sku' => $IDSkuJsonProd,
|
1983 |
'name' => $skuProd->title,
|
1984 |
+
$priceField => $skuProd->price,
|
1985 |
'created_at' => strtotime('now'),
|
1986 |
'updated_at' => strtotime('now'),
|
1987 |
'id_anymarket' => $ProdsJSON->id,
|
1988 |
'weight' => $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight,
|
1989 |
'store_id' => $storeID,
|
1990 |
'website_ids' => array($websiteID),
|
1991 |
+
$brand => $this->procAttrConfig($brand, $ProdsJSON->brand, 0),
|
1992 |
$nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
|
1993 |
$model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
|
1994 |
$video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
|
2025 |
|
2026 |
$ProdCrt = $this->create_simple_product($storeID, $data);
|
2027 |
}else{
|
2028 |
+
$product->setUrlKey(false);
|
2029 |
+
|
2030 |
//Atualiza Imagens
|
2031 |
$this->update_image_product($product, $ProdsJSON, $IDSkuJsonProd);
|
2032 |
|
2039 |
$product->setStoreId($storeID);
|
2040 |
$product->setName( $skuProd->title );
|
2041 |
|
|
|
|
|
|
|
2042 |
foreach ($configureFieldsConfig as $fieldConfig) {
|
2043 |
$product->setData($fieldConfig, $ProdsJSON->description);
|
2044 |
}
|
2045 |
|
2046 |
$product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
|
2047 |
|
2048 |
+
$product->setData($brand, $this->procAttrConfig($brand, $ProdsJSON->brand, 0));
|
2049 |
$product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
|
2050 |
$product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
|
2051 |
|
2086 |
return $ProdCrt;
|
2087 |
}
|
2088 |
|
2089 |
+
public function listAllProds($storeID){
|
2090 |
try {
|
2091 |
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
2092 |
if($typeSincProd == 0){
|
2093 |
$products = $products = Mage::getModel('catalog/product')
|
2094 |
+
->getCollection()
|
2095 |
+
->addAttributeToSelect('name');
|
2096 |
$cont = 0;
|
2097 |
foreach($products as $product) {
|
2098 |
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
2113 |
$sku = $product->getSku();
|
2114 |
$IDProd = $product->getId();
|
2115 |
|
2116 |
+
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($IDProd ,'nmp_id');
|
2117 |
$anymarketproducts->setNmpId( $IDProd );
|
2118 |
$anymarketproducts->setNmpSku( $sku );
|
2119 |
$anymarketproducts->setNmpName( $name );
|
2154 |
}
|
2155 |
}
|
2156 |
|
2157 |
+
public function getDetailsOfBundle($product){
|
2158 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
2159 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
2160 |
+
);
|
2161 |
+
|
2162 |
+
$bundled_items = array();
|
2163 |
+
foreach($selectionCollection as $option)
|
2164 |
+
{
|
2165 |
+
$bundled_items[] = $option->getData();
|
2166 |
+
}
|
2167 |
+
|
2168 |
+
return $bundled_items;
|
2169 |
+
}
|
2170 |
+
|
2171 |
+
public function getWeightOfBundle($storeID, $product){
|
2172 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
2173 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
2174 |
+
);
|
2175 |
+
|
2176 |
+
$WeightTotal = 0;
|
2177 |
+
foreach($selectionCollection as $option)
|
2178 |
+
{
|
2179 |
+
$prodOfBundle = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $option->getId() );
|
2180 |
+
$WeightTotal += $option->getData('selection_qty')*$prodOfBundle->getWeight();
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
return $WeightTotal;
|
2184 |
+
}
|
2185 |
+
|
2186 |
+
public function getDimensionsOfBundle($storeID, $product, $volume_altura, $volume_largura, $volume_comprimento){
|
2187 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
2188 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
2189 |
+
);
|
2190 |
+
|
2191 |
+
$height = 0;
|
2192 |
+
$width = 0;
|
2193 |
+
$length = 0;
|
2194 |
+
foreach($selectionCollection as $option)
|
2195 |
+
{
|
2196 |
+
$prodOfBundle = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $option->getId() );
|
2197 |
+
if( $prodOfBundle->getData( $volume_comprimento ) > $length ){
|
2198 |
+
$length = $prodOfBundle->getData( $volume_comprimento );
|
2199 |
+
}
|
2200 |
+
|
2201 |
+
if( $prodOfBundle->getData( $volume_largura ) > $width ){
|
2202 |
+
$width = $prodOfBundle->getData( $volume_largura );
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
$height += $prodOfBundle->getData( $volume_altura );
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
return array( "length" => $length, "width" => $width, "height" => $height );
|
2209 |
+
}
|
2210 |
+
|
2211 |
+
public function getStockPriceOfBundle($product){
|
2212 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
2213 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
2214 |
+
);
|
2215 |
+
|
2216 |
+
$stockAt = null;
|
2217 |
+
$priceBundleProd = $product->getData('price');
|
2218 |
+
$priceTot = 0;
|
2219 |
+
$outStock = false;
|
2220 |
+
foreach($selectionCollection as $child){
|
2221 |
+
//GET STOCK
|
2222 |
+
$requiredStock = $child->getData('selection_qty');
|
2223 |
+
$realStock = $child->getStockItem()->getData('qty');
|
2224 |
+
|
2225 |
+
if( $realStock > $requiredStock) {
|
2226 |
+
$tmpStock = (int)($realStock / $requiredStock);
|
2227 |
+
if ($stockAt != null) {
|
2228 |
+
if ($tmpStock < $stockAt) {
|
2229 |
+
$stockAt = $tmpStock;
|
2230 |
+
}
|
2231 |
+
} else {
|
2232 |
+
$stockAt = $tmpStock;
|
2233 |
+
}
|
2234 |
+
}else{
|
2235 |
+
$outStock = true;
|
2236 |
+
}
|
2237 |
+
|
2238 |
+
//GET PRICE
|
2239 |
+
$priceType = $child->getData('selection_price_type');
|
2240 |
+
$priceValue = $child->getData('selection_price_value');
|
2241 |
+
|
2242 |
+
if($priceValue > 0) {
|
2243 |
+
//fixed
|
2244 |
+
if ($priceType == '0') {
|
2245 |
+
$priceItem = ($requiredStock * $priceValue);
|
2246 |
+
} else {
|
2247 |
+
$priceValue = ($priceValue / 100) * $priceBundleProd;
|
2248 |
+
$priceItem = ($requiredStock * $priceValue);
|
2249 |
+
}
|
2250 |
+
$priceTot += $priceItem;
|
2251 |
+
}
|
2252 |
+
|
2253 |
+
}
|
2254 |
+
$retArray = array(
|
2255 |
+
"price" => $priceTot + $priceBundleProd,
|
2256 |
+
"stock" => $stockAt == null || $outStock ? 0 : $stockAt
|
2257 |
+
);
|
2258 |
+
|
2259 |
+
return $retArray;
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
/**
|
2263 |
+
* @param $idProd
|
2264 |
+
* @return array
|
2265 |
+
*/
|
2266 |
+
private function findBundledProductsWithThisChildProduct($idProd)
|
2267 |
+
{
|
2268 |
+
$bundles = array();
|
2269 |
+
$products = Mage::getModel('catalog/product')
|
2270 |
+
->getCollection()
|
2271 |
+
->addFieldToFilter('type_id','bundle');
|
2272 |
+
|
2273 |
+
foreach($products as $product){
|
2274 |
+
$children_ids_by_option = $product
|
2275 |
+
->getTypeInstance($product)
|
2276 |
+
->getChildrenIds($product->getId(),false);
|
2277 |
+
|
2278 |
+
$ids = array();
|
2279 |
+
foreach($children_ids_by_option as $array){
|
2280 |
+
$ids = array_merge($ids, $array);
|
2281 |
+
}
|
2282 |
+
|
2283 |
+
if(in_array($idProd, $ids)){
|
2284 |
+
$bundles[] = $product;
|
2285 |
+
}
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
return $bundles;
|
2289 |
+
}
|
2290 |
+
|
2291 |
/**
|
2292 |
* @param $IDProd
|
2293 |
* @param $QtdStock
|
2296 |
public function updatePriceStockAnyMarket($storeID, $IDProd, $QtdStock, $Price){
|
2297 |
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IDProd );
|
2298 |
if($product->getTypeID() != "configurable"){
|
2299 |
+
if( $product->getData('integra_anymarket') == 1 ){
|
2300 |
+
$anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->getId(), 'nmp_id');
|
2301 |
if( ($anymarketproductsUpdt->getData('nmp_status_int') != 'Não integrado (Magento)') ){
|
2302 |
+
if($product->getData('id_anymarket') != ""){
|
2303 |
+
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
2304 |
+
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
2305 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
2306 |
+
|
2307 |
+
$headers = array(
|
2308 |
+
"Content-type: application/json",
|
2309 |
+
"Accept: */*",
|
2310 |
+
"gumgaToken: ".$TOKEN
|
2311 |
+
);
|
2312 |
+
|
2313 |
+
//TRATAMENTO PARA BUNDLE
|
2314 |
+
$bundles = $this->findBundledProductsWithThisChildProduct($IDProd);
|
2315 |
+
foreach($bundles as $prodBund) {
|
2316 |
+
$this->updatePriceStockAnyMarket($storeID, $prodBund->getId(), null, null);
|
2317 |
}
|
|
|
2318 |
|
2319 |
+
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
2320 |
+
$typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
|
|
|
|
2321 |
|
2322 |
+
if($product->getTypeID() == "bundle") {
|
2323 |
+
$stockPriceBundle = $this->getStockPriceOfBundle($product);
|
2324 |
+
//OBTEM O STOCK DO ITEM BUNDLE
|
2325 |
+
if( $typeSincOrder == 0 ){
|
2326 |
+
$QtdStock = null;
|
2327 |
+
}else{
|
2328 |
+
$QtdStock = $stockPriceBundle["stock"];
|
2329 |
+
}
|
2330 |
|
|
|
2331 |
if( $typeSincProd == 0 ){
|
2332 |
+
$Price = $stockPriceBundle["price"];
|
2333 |
+
}else{
|
2334 |
+
$Price = null;
|
2335 |
+
}
|
2336 |
+
|
2337 |
+
if($product->getPriceType() == 0 && $Price == null ) {
|
2338 |
+
$priceModel = $product->getPriceModel();
|
2339 |
+
$PricesBundle = $priceModel->getTotalPrices($product, null, true, false);
|
2340 |
+
$Price = reset($PricesBundle);
|
2341 |
+
}
|
2342 |
+
|
2343 |
+
}else{
|
2344 |
+
if( $typeSincProd == 0 ){
|
2345 |
if($filter == 'final_price'){
|
2346 |
$Price = $product->getFinalPrice();
|
2347 |
}else{
|
2351 |
$Price = null;
|
2352 |
}
|
2353 |
|
|
|
2354 |
if( $typeSincOrder == 0 ){
|
2355 |
$QtdStock = null;
|
2356 |
}elseif( !is_numeric ( $QtdStock ) ){
|
2357 |
$QtdStock = null;
|
2358 |
}
|
2359 |
+
}
|
2360 |
|
2361 |
+
if( ($QtdStock != null) || ($Price != null) ){
|
2362 |
+
$params = array(
|
2363 |
+
"partnerId" => $product->getSku(),
|
2364 |
+
"quantity" => $QtdStock,
|
2365 |
+
"cost" => $Price
|
2366 |
+
);
|
2367 |
|
2368 |
+
$returnProd = $this->CallAPICurl("PUT", $HOST."/v2/stocks", $headers, array($params));
|
2369 |
+
if($returnProd['return'] == ''){
|
2370 |
+
$returnProd['return'] = Mage::helper('db1_anymarket')->__('Update Stock and Price');
|
2371 |
+
$returnProd['error'] = '0';
|
2372 |
+
$returnProd['json'] = json_encode($params);
|
2373 |
+
}
|
2374 |
|
2375 |
+
if( $returnProd['error'] == '1' ){
|
2376 |
+
$this->saveLogsProds($storeID, "0", $returnProd, $product);
|
2377 |
+
}else{
|
2378 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
2379 |
+
$anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('Update stock and price.') );
|
2380 |
+
$anymarketlog->setStatus("0");
|
2381 |
+
$anymarketlog->setLogId( $product->getId() );
|
2382 |
+
$anymarketlog->setLogJson( json_encode($params) );
|
2383 |
+
$anymarketlog->setStores(array($storeID));
|
2384 |
+
$anymarketlog->save();
|
|
|
2385 |
}
|
2386 |
+
}
|
2387 |
|
2388 |
+
}
|
2389 |
+
}
|
2390 |
+
}else{
|
2391 |
+
$bundleModel = Mage::getResourceSingleton('bundle/selection');
|
2392 |
+
if($bundleModel) {
|
2393 |
+
$bundleIds = $bundleModel->getParentIdsByChild($IDProd);
|
2394 |
+
if ($bundleIds) {
|
2395 |
+
foreach ($bundleIds as $bundle) {
|
2396 |
+
$ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($bundle);
|
2397 |
+
$this->updatePriceStockAnyMarket($storeID, $bundle, $ProdStock->getQty(), null);
|
2398 |
}
|
2399 |
}
|
2400 |
}
|
2401 |
}
|
2402 |
}else{
|
|
|
|
|
2403 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
2404 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
2405 |
foreach($childProducts as $child) {
|
2406 |
$this->updatePriceStockAnyMarket($storeID, $child->getId(), $child->getStockItem()->getQty(), $child->getData($filter));
|
2407 |
}
|
2408 |
+
|
2409 |
}
|
2410 |
|
2411 |
|
app/code/community/DB1/AnyMarket/Helper/Productgenerator.php
CHANGED
@@ -7,7 +7,7 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
7 |
'attribute_set_id' => '4',
|
8 |
'type_id' => 'simple',
|
9 |
'sku' => '0124ASF3',
|
10 |
-
'has_options' => '0',
|
11 |
'required_options' => '0',
|
12 |
'created_at' => '',
|
13 |
'updated_at' => '',
|
@@ -18,8 +18,8 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
18 |
'volume_largura' => null,
|
19 |
'warranty_time' => null,
|
20 |
'id_anymarket' => null,
|
21 |
-
'tax_class_id' => '0',
|
22 |
-
'is_recurring' => '0',
|
23 |
'weight' => '1.0000',
|
24 |
'price' => '0',
|
25 |
'cost' => '0',
|
@@ -134,7 +134,7 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
134 |
$imgName = str_replace('.'.$image_type, "", $imgName);
|
135 |
$filename = md5($imgName . $sku).'.'.$image_type;
|
136 |
|
137 |
-
$dirPath = Mage::getBaseDir('media') . DS . 'import';
|
138 |
if (!file_exists($dirPath)) {
|
139 |
mkdir($dirPath, 0777, true);
|
140 |
}
|
@@ -169,6 +169,27 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
169 |
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
/**
|
173 |
* create configurable product in MG
|
174 |
*
|
@@ -180,17 +201,16 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
180 |
public function createConfigurableProduct($storeID, $dataProdConfig = array() , $simpleProducts = array(), $AttributeIds = array()){
|
181 |
$confProduct = Mage::getModel('catalog/product')->setSku($dataProdConfig['sku']);
|
182 |
$confProduct->setTypeId('configurable');
|
183 |
-
|
184 |
$confProduct->getTypeInstance()->setUsedProductAttributeIds($AttributeIds);
|
185 |
|
186 |
$configurableProductsData = array();
|
187 |
-
$configurableAttributesData = $
|
188 |
-
|
189 |
foreach ($simpleProducts as $simpleProduct) {
|
190 |
$sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
|
191 |
|
192 |
$AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $simpleProduct['AttributeText'] );
|
193 |
-
|
194 |
$simpleProductsData = array(
|
195 |
'label' => $sProd->getAttributeText( $simpleProduct['AttributeText'] ),
|
196 |
'attribute_id' => $AttributeId,
|
@@ -202,24 +222,22 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
202 |
$configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
|
203 |
$configurableAttributesData[0]['values'][] = $simpleProductsData;
|
204 |
}
|
|
|
205 |
|
206 |
$confProduct->setConfigurableProductsData($configurableProductsData);
|
207 |
$confProduct->setConfigurableAttributesData($configurableAttributesData);
|
208 |
|
209 |
-
$confProduct->setCanSaveConfigurableAttributes(true);
|
210 |
-
|
211 |
$confProduct->setStoreId($storeID)
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
|
218 |
foreach ($dataProdConfig as $key => $value) {
|
219 |
$confProduct->setData($key, $value);
|
220 |
}
|
221 |
$confProduct->save();
|
222 |
-
|
223 |
$sku = $dataProdConfig['sku'];
|
224 |
foreach ($dataProdConfig['images'] as $image) {
|
225 |
$this->importImages($confProduct, $image, $sku);
|
@@ -231,48 +249,38 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
|
|
231 |
/**
|
232 |
* update configurable product in MG
|
233 |
*
|
|
|
234 |
* @param $idProd
|
235 |
* @param array $dataProdConfig
|
236 |
* @param array $simpleProducts
|
237 |
-
* @param array $AttributeIds
|
238 |
* @return Mage_Catalog_Model_Product
|
239 |
*/
|
240 |
-
public function updateConfigurableProduct($storeID, $idProd, $dataProdConfig = array() , $simpleProducts = array()
|
241 |
-
$confProduct = Mage::getModel('catalog/product')->
|
242 |
-
$
|
243 |
-
|
244 |
-
$confProduct->getTypeInstance()->setUsedProductAttributeIds($AttributeIds);
|
245 |
-
|
246 |
-
$configurableProductsData = array();
|
247 |
-
|
248 |
foreach ($simpleProducts as $simpleProduct) {
|
249 |
-
|
|
|
250 |
|
251 |
-
|
|
|
|
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
'attribute_id' => $AttributeId,
|
256 |
-
'value_index' => (int) $sProd->getData( $simpleProduct['AttributeText'] ),
|
257 |
-
'is_percent' => 0,
|
258 |
-
'pricing_value' => $sProd->getPrice(),
|
259 |
-
);
|
260 |
-
|
261 |
-
$configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
|
262 |
}
|
263 |
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
->setCategoryIds(array(2,3,4))
|
269 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
270 |
-
->setStatus(1)
|
271 |
-
->setTaxClassId(0);
|
272 |
|
|
|
|
|
273 |
foreach ($dataProdConfig as $key => $value) {
|
274 |
$confProduct->setData($key, $value);
|
275 |
}
|
|
|
276 |
$confProduct->save();
|
277 |
|
278 |
return $confProduct;
|
7 |
'attribute_set_id' => '4',
|
8 |
'type_id' => 'simple',
|
9 |
'sku' => '0124ASF3',
|
10 |
+
'has_options' => '0',
|
11 |
'required_options' => '0',
|
12 |
'created_at' => '',
|
13 |
'updated_at' => '',
|
18 |
'volume_largura' => null,
|
19 |
'warranty_time' => null,
|
20 |
'id_anymarket' => null,
|
21 |
+
'tax_class_id' => '0',
|
22 |
+
'is_recurring' => '0',
|
23 |
'weight' => '1.0000',
|
24 |
'price' => '0',
|
25 |
'cost' => '0',
|
134 |
$imgName = str_replace('.'.$image_type, "", $imgName);
|
135 |
$filename = md5($imgName . $sku).'.'.$image_type;
|
136 |
|
137 |
+
$dirPath = Mage::getBaseDir('media') . DS . 'import';
|
138 |
if (!file_exists($dirPath)) {
|
139 |
mkdir($dirPath, 0777, true);
|
140 |
}
|
169 |
|
170 |
}
|
171 |
|
172 |
+
private function getConfigurableAttributes($AttributeIds){
|
173 |
+
$attrArray = array();
|
174 |
+
foreach ($AttributeIds as $attr) {
|
175 |
+
$attribute = Mage::getModel('eav/entity_attribute')->load($attr);
|
176 |
+
|
177 |
+
$attrArray[] = array(
|
178 |
+
'id' => null,
|
179 |
+
'label' => $attribute->getData('frontend_label'),
|
180 |
+
'use_default' => $attribute->getData('default_value'),
|
181 |
+
'position' => $attribute->getData('position'),
|
182 |
+
'values' => array(),
|
183 |
+
'attribute_id' => $attribute->getData('attribute_id'),
|
184 |
+
'attribute_code' => $attribute->getData('attribute_code'),
|
185 |
+
'frontend_label' => $attribute->getData('frontend_label'),
|
186 |
+
'store_label' => $attribute->getData('frontend_label'),
|
187 |
+
);
|
188 |
+
}
|
189 |
+
|
190 |
+
return $attrArray;
|
191 |
+
}
|
192 |
+
|
193 |
/**
|
194 |
* create configurable product in MG
|
195 |
*
|
201 |
public function createConfigurableProduct($storeID, $dataProdConfig = array() , $simpleProducts = array(), $AttributeIds = array()){
|
202 |
$confProduct = Mage::getModel('catalog/product')->setSku($dataProdConfig['sku']);
|
203 |
$confProduct->setTypeId('configurable');
|
204 |
+
$confProduct->setWebsiteIds(array(1));
|
205 |
$confProduct->getTypeInstance()->setUsedProductAttributeIds($AttributeIds);
|
206 |
|
207 |
$configurableProductsData = array();
|
208 |
+
$configurableAttributesData = $this->getConfigurableAttributes($AttributeIds);
|
209 |
+
//$configurableAttributesData = $confProduct->getTypeInstance()->getConfigurableAttributesAsArray($confProduct);
|
210 |
foreach ($simpleProducts as $simpleProduct) {
|
211 |
$sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
|
212 |
|
213 |
$AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $simpleProduct['AttributeText'] );
|
|
|
214 |
$simpleProductsData = array(
|
215 |
'label' => $sProd->getAttributeText( $simpleProduct['AttributeText'] ),
|
216 |
'attribute_id' => $AttributeId,
|
222 |
$configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
|
223 |
$configurableAttributesData[0]['values'][] = $simpleProductsData;
|
224 |
}
|
225 |
+
$confProduct->setCanSaveConfigurableAttributes(true);
|
226 |
|
227 |
$confProduct->setConfigurableProductsData($configurableProductsData);
|
228 |
$confProduct->setConfigurableAttributesData($configurableAttributesData);
|
229 |
|
|
|
|
|
230 |
$confProduct->setStoreId($storeID)
|
231 |
+
->setAttributeSetId( Mage::getModel('catalog/product')->getDefaultAttributeSetId() )
|
232 |
+
->setCategoryIds(array(2,3,4))
|
233 |
+
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
234 |
+
->setStatus(1)
|
235 |
+
->setTaxClassId(0);
|
236 |
|
237 |
foreach ($dataProdConfig as $key => $value) {
|
238 |
$confProduct->setData($key, $value);
|
239 |
}
|
240 |
$confProduct->save();
|
|
|
241 |
$sku = $dataProdConfig['sku'];
|
242 |
foreach ($dataProdConfig['images'] as $image) {
|
243 |
$this->importImages($confProduct, $image, $sku);
|
249 |
/**
|
250 |
* update configurable product in MG
|
251 |
*
|
252 |
+
* @param $storeID
|
253 |
* @param $idProd
|
254 |
* @param array $dataProdConfig
|
255 |
* @param array $simpleProducts
|
|
|
256 |
* @return Mage_Catalog_Model_Product
|
257 |
*/
|
258 |
+
public function updateConfigurableProduct($storeID, $idProd, $dataProdConfig = array() , $simpleProducts = array()){
|
259 |
+
$confProduct = Mage::getModel('catalog/product')->load( $idProd );
|
260 |
+
$simplesToAddConfig = array();
|
|
|
|
|
|
|
|
|
|
|
261 |
foreach ($simpleProducts as $simpleProduct) {
|
262 |
+
array_push( $simplesToAddConfig, $simpleProduct['Id'] );
|
263 |
+
}
|
264 |
|
265 |
+
//ADICIONA OS JA EXISTENTES NO PRODUTO
|
266 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')
|
267 |
+
->getUsedProducts(null, $confProduct);
|
268 |
|
269 |
+
foreach($childProducts as $child) {
|
270 |
+
array_push( $simplesToAddConfig, $child->getId() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
|
273 |
+
$simplesToAddConfig = array_unique($simplesToAddConfig);
|
274 |
+
|
275 |
+
Mage::getResourceSingleton('catalog/product_type_configurable')
|
276 |
+
->saveProducts($confProduct, $simplesToAddConfig);
|
|
|
|
|
|
|
|
|
277 |
|
278 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
279 |
+
$confProduct = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $idProd );
|
280 |
foreach ($dataProdConfig as $key => $value) {
|
281 |
$confProduct->setData($key, $value);
|
282 |
}
|
283 |
+
|
284 |
$confProduct->save();
|
285 |
|
286 |
return $confProduct;
|
app/code/community/DB1/AnyMarket/Helper/Queue.php
CHANGED
@@ -11,12 +11,16 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
|
|
11 |
* @param $tableItem
|
12 |
*/
|
13 |
public function addQueue($storeID, $IdItem, $typeItem, $tableItem){
|
14 |
-
$
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
/**
|
@@ -46,7 +50,7 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
|
|
46 |
$arrValueStore = array_values($anymarketQueue->getStoreId());
|
47 |
$storeID = array_shift($arrValueStore);
|
48 |
|
49 |
-
$storeID = ($storeID != null && $storeID != "0") ? $storeID :
|
50 |
|
51 |
$cronEnabled = Mage::getStoreConfig('anymarket_section/anymarket_cron_group/anymarket_queue_field', $storeID);
|
52 |
if($cronEnabled == '1' || $typeExec == "FORCE") {
|
@@ -71,7 +75,8 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
|
|
71 |
$anymarketorders->load($IdItemQueue, 'nmo_id_order');
|
72 |
//Export
|
73 |
if ($anymarketorders->getNmoStatusInt() != "Não integrado (AnyMarket)") {
|
74 |
-
$
|
|
|
75 |
Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $Order);
|
76 |
}
|
77 |
}
|
@@ -79,34 +84,63 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
|
|
79 |
} catch (Exception $e) {
|
80 |
Mage::logException($e);
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
} else if ($item['nmq_table'] == 'PRODUCT') {
|
83 |
// EXPORT PRODUCT
|
84 |
$typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
85 |
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID);
|
86 |
$anymarketproducts->load($IdItemQueue, 'nmp_id');
|
87 |
|
88 |
-
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $anymarketproducts->getNmpSku());
|
89 |
if (($typImp == 'EXP') && ($typeSincProd == 0)) {
|
90 |
try {
|
|
|
91 |
$anymarketproducts->setStatus('1')->setIsMassupdate(true)->save();
|
92 |
if ($product != null) {
|
93 |
-
Mage::helper('db1_anymarket/product')->
|
94 |
}
|
95 |
|
96 |
} catch (Exception $e) {
|
97 |
Mage::logException($e);
|
98 |
}
|
99 |
-
}
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
if ($
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
|
112 |
}
|
@@ -117,79 +151,51 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
|
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
-
* process Orders
|
121 |
*/
|
122 |
public function processOrders(){
|
123 |
-
Mage::getSingleton('core/session')->setImportOrdersVariable('false');
|
124 |
-
|
125 |
$allStores = Mage::helper('db1_anymarket')->getAllStores();
|
126 |
foreach ($allStores as $store) {
|
127 |
$storeID = $store['store_id'];
|
128 |
-
|
129 |
$cronEnabled = Mage::getStoreConfig('anymarket_section/anymarket_cron_group/anymarket_order_field', $storeID);
|
130 |
if( $cronEnabled == '1' ) {
|
131 |
-
|
132 |
-
if ($ConfigOrder == 1) {
|
133 |
-
Mage::helper('db1_anymarket/order')->getFeedOrdersFromAnyMarket($storeID);
|
134 |
-
}
|
135 |
-
|
136 |
-
$colAnyOrders = Mage::getResourceModel('db1_anymarket/anymarketorders_collection')
|
137 |
-
->addFieldToFilter('nmo_status_int', array('like' => 'ERROR%'))
|
138 |
-
->load();
|
139 |
-
|
140 |
-
foreach ($colAnyOrders->getItems() as $anymarketorders) {
|
141 |
-
$anymarketorder = Mage::getModel('db1_anymarket/anymarketorders')->load($anymarketorders->getId());
|
142 |
-
if (is_array($anymarketorder->getData('store_id')) && in_array($storeID, $anymarketorder->getData('store_id'))) {
|
143 |
-
if ($anymarketorders->getData('nmo_status_int') == 'ERROR 01') {
|
144 |
-
$this->addQueue($storeID, $anymarketorder->getNmoIdAnymarket(), 'IMP', 'ORDER');
|
145 |
-
} else if ($anymarketorders->getData('nmo_status_int') == 'ERROR 02') {
|
146 |
-
$this->addQueue($storeID, $anymarketorder->getNmoIdOrder(), 'EXP', 'ORDER');
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
}
|
151 |
-
|
152 |
}
|
153 |
-
Mage::getSingleton('core/session')->setImportOrdersVariable('true');
|
154 |
|
155 |
}
|
156 |
|
157 |
/**
|
158 |
-
* process
|
159 |
*/
|
160 |
-
public function
|
161 |
-
$
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
167 |
-
if ($typeSincProd == 1) {
|
168 |
-
Mage::helper('db1_anymarket/product')->getFeedProdsFromAnyMarket($storeID);
|
169 |
-
} else {
|
170 |
-
$colAnyProds = Mage::getResourceModel('db1_anymarket/anymarketproducts_collection')
|
171 |
-
->addFieldToFilter('nmp_status_int', array('neq' => 'Integrado'))
|
172 |
-
->load();
|
173 |
-
|
174 |
-
foreach ($colAnyProds->getItems() as $anymarketproducts) {
|
175 |
-
if ($anymarketproducts->getData('nmp_sku') != null) {
|
176 |
-
$anymarketprod = Mage::getModel('db1_anymarket/anymarketproducts')->load($anymarketproducts->getData('nmp_id'), 'nmp_id');
|
177 |
-
if (is_array($anymarketprod->getData('store_id')) && in_array($storeID, $anymarketprod->getData('store_id'))) {
|
178 |
-
|
179 |
-
if($anymarketprod->getData('nmp_status_int') == "Erro" ) {
|
180 |
-
$ProdLoaded = Mage::getModel('catalog/product')->loadByAttribute('sku', $anymarketproducts->getData('nmp_sku'));
|
181 |
-
if ($ProdLoaded) {
|
182 |
-
if (($ProdLoaded->getStatus() == 1) && ($ProdLoaded->getData('integra_anymarket') == 1)) {
|
183 |
-
$this->addQueue($storeID, $anymarketproducts->getData('nmp_id'), 'EXP', 'PRODUCT');
|
184 |
-
}
|
185 |
-
}
|
186 |
-
}
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
|
|
193 |
}
|
194 |
}
|
195 |
}
|
11 |
* @param $tableItem
|
12 |
*/
|
13 |
public function addQueue($storeID, $IdItem, $typeItem, $tableItem){
|
14 |
+
$queueItemCheck = Mage::getModel('db1_anymarket/anymarketqueue')->setStoreId($storeID)
|
15 |
+
->load($IdItem, 'nmq_id');
|
16 |
+
if( !$queueItemCheck->getNmqId() ){
|
17 |
+
$queueItem = Mage::getModel('db1_anymarket/anymarketqueue');
|
18 |
+
$queueItem->setNmqId($IdItem);
|
19 |
+
$queueItem->setNmqType($typeItem);
|
20 |
+
$queueItem->setNmqTable($tableItem);
|
21 |
+
$queueItem->setStores(array($storeID));
|
22 |
+
$queueItem->save();
|
23 |
+
}
|
24 |
}
|
25 |
|
26 |
/**
|
50 |
$arrValueStore = array_values($anymarketQueue->getStoreId());
|
51 |
$storeID = array_shift($arrValueStore);
|
52 |
|
53 |
+
$storeID = ($storeID != null && $storeID != "0") ? $storeID : Mage::app()->getDefaultStoreView()->getId();
|
54 |
|
55 |
$cronEnabled = Mage::getStoreConfig('anymarket_section/anymarket_cron_group/anymarket_queue_field', $storeID);
|
56 |
if($cronEnabled == '1' || $typeExec == "FORCE") {
|
75 |
$anymarketorders->load($IdItemQueue, 'nmo_id_order');
|
76 |
//Export
|
77 |
if ($anymarketorders->getNmoStatusInt() != "Não integrado (AnyMarket)") {
|
78 |
+
$idOrderToLoad = ($anymarketorders->getNmoIdOrder() == null) ? $IdItemQueue : $anymarketorders->getNmoIdOrder();
|
79 |
+
$Order = Mage::getModel('sales/order')->loadByIncrementId( $idOrderToLoad );
|
80 |
Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $Order);
|
81 |
}
|
82 |
}
|
84 |
} catch (Exception $e) {
|
85 |
Mage::logException($e);
|
86 |
}
|
87 |
+
} else if ($item['nmq_table'] == 'STOCK') {
|
88 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IdItemQueue );
|
89 |
+
|
90 |
+
// TRATA STOCK
|
91 |
+
if ($product) {
|
92 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
93 |
+
$ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
94 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $ProdStock->getQty(), $product->getData($filter));
|
95 |
+
}
|
96 |
} else if ($item['nmq_table'] == 'PRODUCT') {
|
97 |
// EXPORT PRODUCT
|
98 |
$typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
99 |
$anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID);
|
100 |
$anymarketproducts->load($IdItemQueue, 'nmp_id');
|
101 |
|
|
|
102 |
if (($typImp == 'EXP') && ($typeSincProd == 0)) {
|
103 |
try {
|
104 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IdItemQueue );
|
105 |
$anymarketproducts->setStatus('1')->setIsMassupdate(true)->save();
|
106 |
if ($product != null) {
|
107 |
+
Mage::helper('db1_anymarket/product')->prepareForSendProduct($storeID, $product);
|
108 |
}
|
109 |
|
110 |
} catch (Exception $e) {
|
111 |
Mage::logException($e);
|
112 |
}
|
|
|
113 |
|
114 |
+
|
115 |
+
// TRATA STOCK
|
116 |
+
if ($product) {
|
117 |
+
if ($typeSincOrder == 1) {
|
118 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
119 |
+
$ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
120 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $ProdStock->getQty(), $product->getData($filter));
|
121 |
+
} else {
|
122 |
+
Mage::helper('db1_anymarket/product')->getStockProductAnyMarket($storeID, $product->getId());
|
123 |
+
}
|
124 |
}
|
125 |
+
}else if ($typImp == 'IMP'){
|
126 |
+
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
127 |
+
$TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
|
128 |
+
|
129 |
+
$headers = array(
|
130 |
+
"Content-type: application/json",
|
131 |
+
"Accept: */*",
|
132 |
+
"gumgaToken: " . $TOKEN
|
133 |
+
);
|
134 |
+
|
135 |
+
$listTransmissions = array();
|
136 |
+
array_push($listTransmissions, array(
|
137 |
+
"id" => $IdItemQueue,
|
138 |
+
"token" => "notoken"
|
139 |
+
)
|
140 |
+
);
|
141 |
+
|
142 |
+
$JSON = json_encode($listTransmissions);
|
143 |
+
Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
|
144 |
}
|
145 |
|
146 |
}
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
+
* process Orders By CRON
|
155 |
*/
|
156 |
public function processOrders(){
|
|
|
|
|
157 |
$allStores = Mage::helper('db1_anymarket')->getAllStores();
|
158 |
foreach ($allStores as $store) {
|
159 |
$storeID = $store['store_id'];
|
|
|
160 |
$cronEnabled = Mage::getStoreConfig('anymarket_section/anymarket_cron_group/anymarket_order_field', $storeID);
|
161 |
if( $cronEnabled == '1' ) {
|
162 |
+
Mage::helper('db1_anymarket/order')->getFeedOrdersFromAnyMarket($storeID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
|
166 |
}
|
167 |
|
168 |
/**
|
169 |
+
* process Stocks By CRON
|
170 |
*/
|
171 |
+
public function processStocks(){
|
172 |
+
$qtyItensImport = (int)Mage::getConfig()->getNode('default/queue_qty/qty');
|
173 |
+
$itens = Mage::getModel('db1_anymarket/anymarketqueue')
|
174 |
+
->getCollection()
|
175 |
+
->setPageSize($qtyItensImport)
|
176 |
+
->setCurPage(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
foreach($itens->getData() as $item) {
|
179 |
+
$IdItemQueue = $item['nmq_id'];
|
180 |
+
|
181 |
+
$anymarketQueue = Mage::getModel('db1_anymarket/anymarketqueue')->load($item['entity_id']);
|
182 |
+
$arrValueStore = array_values($anymarketQueue->getStoreId());
|
183 |
+
$storeID = array_shift($arrValueStore);
|
184 |
+
|
185 |
+
$storeID = ($storeID != null && $storeID != "0") ? $storeID : Mage::app()->getDefaultStoreView()->getId();
|
186 |
+
if ($item['nmq_table'] == 'STOCK') {
|
187 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IdItemQueue );
|
188 |
|
189 |
+
// TRATA STOCK
|
190 |
+
if ($product) {
|
191 |
+
$typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
|
192 |
+
if ($typeSincOrder == 1) {
|
193 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
194 |
+
$ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
195 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $ProdStock->getQty(), $product->getData($filter));
|
196 |
+
}
|
197 |
}
|
198 |
+
$this->removeQueue($item['entity_id']);
|
199 |
}
|
200 |
}
|
201 |
}
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketbrands.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php
CHANGED
@@ -72,6 +72,17 @@ class DB1_AnyMarket_Model_Anymarketattributes extends Mage_Core_Model_Abstract
|
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return $this;
|
76 |
}
|
77 |
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
75 |
+
|
76 |
+
$stores = $this->getStores();
|
77 |
+
if( $stores != null) {
|
78 |
+
if (is_array($stores)) {
|
79 |
+
$storeID = reset($stores);
|
80 |
+
}
|
81 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
82 |
+
$this->setStores(array());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
return $this;
|
87 |
}
|
88 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketbrands.php
CHANGED
@@ -72,6 +72,17 @@ class DB1_AnyMarket_Model_Anymarketbrands extends Mage_Core_Model_Abstract
|
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return $this;
|
76 |
}
|
77 |
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
75 |
+
|
76 |
+
$stores = $this->getStores();
|
77 |
+
if( $stores != null) {
|
78 |
+
if (is_array($stores)) {
|
79 |
+
$storeID = reset($stores);
|
80 |
+
}
|
81 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
82 |
+
$this->setStores(array());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
return $this;
|
87 |
}
|
88 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php
CHANGED
@@ -72,6 +72,17 @@ class DB1_AnyMarket_Model_Anymarketcategories extends Mage_Core_Model_Abstract
|
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return $this;
|
76 |
}
|
77 |
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
75 |
+
|
76 |
+
$stores = $this->getStores();
|
77 |
+
if( $stores != null) {
|
78 |
+
if (is_array($stores)) {
|
79 |
+
$storeID = reset($stores);
|
80 |
+
}
|
81 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
82 |
+
$this->setStores(array());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
return $this;
|
87 |
}
|
88 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketlog.php
CHANGED
@@ -75,6 +75,10 @@ class DB1_AnyMarket_Model_Anymarketlog extends Mage_Core_Model_Abstract
|
|
75 |
if (is_array($stores)) {
|
76 |
$storeID = reset($stores);
|
77 |
}
|
|
|
|
|
|
|
|
|
78 |
|
79 |
$nivelLogs = Mage::getStoreConfig('anymarket_section/anymarket_logs_group/anymarket_log_nivel_field', $storeID);
|
80 |
if ((int)$nivelLogs == 0) {
|
75 |
if (is_array($stores)) {
|
76 |
$storeID = reset($stores);
|
77 |
}
|
78 |
+
if( !is_string($storeID) && !is_integer($storeID) ) {
|
79 |
+
$this->setStores(array());
|
80 |
+
$storeID = 0;
|
81 |
+
}
|
82 |
|
83 |
$nivelLogs = Mage::getStoreConfig('anymarket_section/anymarket_logs_group/anymarket_log_nivel_field', $storeID);
|
84 |
if ((int)$nivelLogs == 0) {
|
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketorders.php
CHANGED
@@ -67,11 +67,34 @@ class DB1_AnyMarket_Model_Anymarketorders extends Mage_Core_Model_Abstract
|
|
67 |
protected function _beforeSave()
|
68 |
{
|
69 |
parent::_beforeSave();
|
|
|
70 |
$now = Mage::getSingleton('core/date')->gmtDate();
|
71 |
if ($this->isObjectNew()) {
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return $this;
|
76 |
}
|
77 |
|
67 |
protected function _beforeSave()
|
68 |
{
|
69 |
parent::_beforeSave();
|
70 |
+
|
71 |
$now = Mage::getSingleton('core/date')->gmtDate();
|
72 |
if ($this->isObjectNew()) {
|
73 |
$this->setCreatedAt($now);
|
74 |
}
|
75 |
$this->setUpdatedAt($now);
|
76 |
+
|
77 |
+
$stores = $this->getStores();
|
78 |
+
if( $stores != null) {
|
79 |
+
if (is_array($stores)) {
|
80 |
+
$storeID = reset($stores);
|
81 |
+
}
|
82 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
83 |
+
$this->setStores(array());
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
if( $this->getNmoStatusInt() == 'ERROR 02' ) {
|
88 |
+
$anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load( $this->getId() );
|
89 |
+
|
90 |
+
if ($this->getNmoIdSeqAnymarket() == "" || $this->getNmoIdSeqAnymarket() == null ) {
|
91 |
+
$this->setNmoIdSeqAnymarket( $anymarketorders->getNmoIdSeqAnymarket() );
|
92 |
+
}
|
93 |
+
if ($this->getNmoIdAnymarket() == "" || $this->getNmoIdAnymarket() == null ) {
|
94 |
+
$this->setNmoIdAnymarket( $anymarketorders->getNmoIdAnymarket() );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
return $this;
|
99 |
}
|
100 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php
CHANGED
@@ -76,16 +76,30 @@ class DB1_AnyMarket_Model_Anymarketorders_Api extends Mage_Api_Model_Resource_Ab
|
|
76 |
if (is_null($data)) {
|
77 |
throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
|
78 |
}
|
79 |
-
$
|
80 |
-
$
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
} catch (Mage_Core_Exception $e) {
|
84 |
$this->_fault('data_invalid', $e->getMessage());
|
85 |
} catch (Exception $e) {
|
86 |
$this->_fault('data_invalid', $e->getMessage());
|
87 |
}
|
88 |
-
return $
|
89 |
}
|
90 |
|
91 |
/**
|
76 |
if (is_null($data)) {
|
77 |
throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
|
78 |
}
|
79 |
+
$ret = "";
|
80 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
81 |
+
$anymarketlog->setLogDesc( 'Callback received - Order (API)');
|
82 |
+
$anymarketlog->setLogJson( json_encode($data) );
|
83 |
+
$anymarketlog->setStatus("0");
|
84 |
+
$anymarketlog->save();
|
85 |
+
|
86 |
+
$allStores = Mage::helper('db1_anymarket')->getTokenByOi( $data['oi'] );
|
87 |
+
if( !empty($allStores) ) {
|
88 |
+
foreach ($allStores as $store) {
|
89 |
+
$storeID = $store['storeID'];
|
90 |
+
$TOKEN = $store['token'];
|
91 |
+
|
92 |
+
if ($TOKEN != '') {
|
93 |
+
$ret = Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($data['id'], "notoken", $storeID);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
} catch (Mage_Core_Exception $e) {
|
98 |
$this->_fault('data_invalid', $e->getMessage());
|
99 |
} catch (Exception $e) {
|
100 |
$this->_fault('data_invalid', $e->getMessage());
|
101 |
}
|
102 |
+
return $ret;
|
103 |
}
|
104 |
|
105 |
/**
|
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php
CHANGED
@@ -72,6 +72,17 @@ class DB1_AnyMarket_Model_Anymarketproducts extends Mage_Core_Model_Abstract
|
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return $this;
|
76 |
}
|
77 |
|
72 |
$this->setCreatedAt($now);
|
73 |
}
|
74 |
$this->setUpdatedAt($now);
|
75 |
+
|
76 |
+
$stores = $this->getStores();
|
77 |
+
if( $stores != null) {
|
78 |
+
if (is_array($stores)) {
|
79 |
+
$storeID = reset($stores);
|
80 |
+
}
|
81 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
82 |
+
$this->setStores(array());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
return $this;
|
87 |
}
|
88 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php
CHANGED
@@ -76,16 +76,50 @@ class DB1_AnyMarket_Model_Anymarketproducts_Api extends Mage_Api_Model_Resource_
|
|
76 |
if (is_null($data)) {
|
77 |
throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
|
78 |
}
|
79 |
-
|
80 |
-
$
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
} catch (Mage_Core_Exception $e) {
|
84 |
$this->_fault('data_invalid', $e->getMessage());
|
85 |
} catch (Exception $e) {
|
86 |
$this->_fault('data_invalid', $e->getMessage());
|
87 |
}
|
88 |
-
return $
|
89 |
}
|
90 |
|
91 |
/**
|
76 |
if (is_null($data)) {
|
77 |
throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
|
78 |
}
|
79 |
+
|
80 |
+
$ret = "";
|
81 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
82 |
+
$anymarketlog->setLogDesc( 'Callback received - Transmission (API)');
|
83 |
+
$anymarketlog->setLogJson( json_encode($data) );
|
84 |
+
$anymarketlog->setStatus("0");
|
85 |
+
$anymarketlog->save();
|
86 |
+
|
87 |
+
$allStores = Mage::helper('db1_anymarket')->getTokenByOi( $data['oi'] );
|
88 |
+
if( !empty($allStores) ) {
|
89 |
+
foreach ($allStores as $store) {
|
90 |
+
$storeID = $store['storeID'];
|
91 |
+
$TOKEN = $store['token'];
|
92 |
+
|
93 |
+
if ($TOKEN != '') {
|
94 |
+
|
95 |
+
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
96 |
+
|
97 |
+
$headers = array(
|
98 |
+
"Content-type: application/json",
|
99 |
+
"Accept: */*",
|
100 |
+
"gumgaToken: " . $TOKEN
|
101 |
+
);
|
102 |
+
|
103 |
+
$listTransmissions = array();
|
104 |
+
array_push($listTransmissions, array(
|
105 |
+
"id" => $data['id'],
|
106 |
+
"token" => "notoken"
|
107 |
+
)
|
108 |
+
);
|
109 |
+
|
110 |
+
$JSON = json_encode($listTransmissions);
|
111 |
+
$ret = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
} catch (Mage_Core_Exception $e) {
|
118 |
$this->_fault('data_invalid', $e->getMessage());
|
119 |
} catch (Exception $e) {
|
120 |
$this->_fault('data_invalid', $e->getMessage());
|
121 |
}
|
122 |
+
return $ret;
|
123 |
}
|
124 |
|
125 |
/**
|
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php
CHANGED
@@ -71,6 +71,17 @@ class DB1_AnyMarket_Model_Anymarketqueue extends Mage_Core_Model_Abstract
|
|
71 |
$this->setCreatedAt($now);
|
72 |
}
|
73 |
$this->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
return $this;
|
75 |
}
|
76 |
|
71 |
$this->setCreatedAt($now);
|
72 |
}
|
73 |
$this->setUpdatedAt($now);
|
74 |
+
|
75 |
+
$stores = $this->getStores();
|
76 |
+
if( $stores != null) {
|
77 |
+
if (is_array($stores)) {
|
78 |
+
$storeID = reset($stores);
|
79 |
+
}
|
80 |
+
if (!is_string($storeID) && !is_integer($storeID)) {
|
81 |
+
$this->setStores(array());
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
return $this;
|
86 |
}
|
87 |
|
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Cron.php
CHANGED
@@ -2,17 +2,10 @@
|
|
2 |
class DB1_AnyMarket_Model_Cron{
|
3 |
|
4 |
/**
|
5 |
-
* sinc all
|
6 |
*/
|
7 |
-
public function
|
8 |
-
Mage::helper('db1_anymarket/queue')->
|
9 |
-
}
|
10 |
-
|
11 |
-
/**
|
12 |
-
* sinc all products in feed and products with errors
|
13 |
-
*/
|
14 |
-
public function sincProducts(){
|
15 |
-
Mage::helper('db1_anymarket/queue')->processProducts();
|
16 |
}
|
17 |
|
18 |
/**
|
@@ -29,6 +22,10 @@ class DB1_AnyMarket_Model_Cron{
|
|
29 |
Mage::helper('db1_anymarket/queue')->processQueue("CRON");
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* execute the clean logs
|
34 |
*/
|
2 |
class DB1_AnyMarket_Model_Cron{
|
3 |
|
4 |
/**
|
5 |
+
* sinc all stocks in feed and products with errors
|
6 |
*/
|
7 |
+
public function sincStocks(){
|
8 |
+
Mage::helper('db1_anymarket/queue')->processStocks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
|
11 |
/**
|
22 |
Mage::helper('db1_anymarket/queue')->processQueue("CRON");
|
23 |
}
|
24 |
|
25 |
+
public function sincOrders(){
|
26 |
+
Mage::helper('db1_anymarket/queue')->processOrders();
|
27 |
+
}
|
28 |
+
|
29 |
/**
|
30 |
* execute the clean logs
|
31 |
*/
|
app/code/community/DB1/AnyMarket/Model/Observer.php
CHANGED
@@ -2,6 +2,10 @@
|
|
2 |
|
3 |
class DB1_AnyMarket_Model_Observer {
|
4 |
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
* @param $observer
|
7 |
*/
|
@@ -35,92 +39,40 @@ class DB1_AnyMarket_Model_Observer {
|
|
35 |
|
36 |
/**
|
37 |
* @param $observer
|
|
|
38 |
*/
|
39 |
public function sendProdAnyMarket($observer) {
|
40 |
-
$
|
41 |
-
|
42 |
-
|
43 |
-
$
|
44 |
-
if(
|
45 |
-
|
46 |
-
|
47 |
-
$typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
|
48 |
-
if($typeSincProd == 0){
|
49 |
-
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($productOld->getId());
|
50 |
-
if( $product->getData('integra_anymarket') == 1 && $product->getStatus() == 1 ){
|
51 |
-
|
52 |
-
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
53 |
-
$stockQty = $stock->getQty();
|
54 |
-
if($product->getTypeID() == "configurable"){
|
55 |
-
//PRODUTO CONFIGURAVEL
|
56 |
-
Mage::getModel('catalog/product_type_configurable')->getProduct($product)->unsetData('_cache_instance_products');
|
57 |
-
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
58 |
-
if(count($childProducts) > 0){
|
59 |
-
Mage::getSingleton('core/session')->setImportProdsVariable('false');
|
60 |
-
foreach ($childProducts as $prodCh) {
|
61 |
-
$productChild = Mage::getModel('catalog/product')->setStoreId($storeID)->load($prodCh->getId());
|
62 |
-
$productChild->setData('integra_anymarket', $product->getData('integra_anymarket') );
|
63 |
-
$productChild->save();
|
64 |
-
}
|
65 |
-
Mage::getSingleton('core/session')->setImportProdsVariable('true');
|
66 |
-
|
67 |
-
Mage::helper('db1_anymarket/product')->sendProductToAnyMarket($storeID, $product->getId());
|
68 |
-
}
|
69 |
-
}else{
|
70 |
-
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
|
71 |
-
if($parentIds){
|
72 |
-
//PRODUTO SIMPLES FILHO DE UM CONFIG
|
73 |
-
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
74 |
-
$ean = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_ean_field', $storeID);
|
75 |
-
|
76 |
-
if($filter == 'final_price'){
|
77 |
-
$stkPrice = $product->getFinalPrice();
|
78 |
-
}else{
|
79 |
-
$stkPrice = $product->getData($filter);
|
80 |
-
}
|
81 |
-
|
82 |
-
$attributeOptions = array();
|
83 |
-
foreach ($parentIds as $parentId) {
|
84 |
-
$productConfig = Mage::getModel('catalog/product')->load($parentId);
|
85 |
-
|
86 |
-
if( $productConfig->getId() ) {
|
87 |
-
foreach ($productConfig->getTypeInstance()->getConfigurableAttributes() as $attribute) {
|
88 |
-
$value = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
|
89 |
-
$attributeOptions[$attribute->getLabel()] = $value;
|
90 |
-
}
|
91 |
-
|
92 |
-
foreach ($parentIds as $parentId) {
|
93 |
-
$arrSku = array(
|
94 |
-
"variations" => $attributeOptions,
|
95 |
-
"price" => $stkPrice,
|
96 |
-
"amount" => $stockQty,
|
97 |
-
"ean" => $product->getData($ean),
|
98 |
-
"partnerId" => $product->getSku(),
|
99 |
-
"title" => $product->getName(),
|
100 |
-
"idProduct" => $product->getData('id_anymarket'),
|
101 |
-
"internalIdProduct" => $product->getId(),
|
102 |
-
);
|
103 |
-
|
104 |
-
Mage::helper('db1_anymarket/product')->sendImageSkuToAnyMarket($storeID, $product, array($arrSku));
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}else{
|
109 |
-
//PRODUTO SIMPLES E OUTROS
|
110 |
-
Mage::helper('db1_anymarket/product')->sendProductToAnyMarket($storeID, $product->getId());
|
111 |
-
|
112 |
-
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
113 |
-
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $stockQty, $product->getData($filter));
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
}else{
|
121 |
Mage::getSingleton('core/session')->setQuickCreateProdVariable('');
|
|
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
}
|
126 |
|
@@ -132,7 +84,8 @@ class DB1_AnyMarket_Model_Observer {
|
|
132 |
if( !$category->getName() ) {
|
133 |
$category = Mage::getModel('catalog/category')->load($category->getId());
|
134 |
}
|
135 |
-
|
|
|
136 |
if( $category->getData('categ_integra_anymarket') == 1 ){
|
137 |
$amCategParent = Mage::getModel('db1_anymarket/anymarketcategories')->load($category->getParentId(), 'nmc_id_magento');
|
138 |
if( $amCategParent->getData('nmc_cat_id') ){
|
@@ -170,23 +123,39 @@ class DB1_AnyMarket_Model_Observer {
|
|
170 |
public function updateOrderAnyMarketObs($observer){
|
171 |
$storeID = $observer->getEvent()->getOrder()->getStoreId();
|
172 |
$OrderID = $observer->getEvent()->getOrder()->getIncrementId();
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $order );
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
$_product = Mage::getModel('catalog/product')->load($product_id);
|
187 |
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
}
|
@@ -214,7 +183,12 @@ class DB1_AnyMarket_Model_Observer {
|
|
214 |
$event = $observer->getEvent();
|
215 |
$_item = $event->getItem();
|
216 |
|
217 |
-
$storeID = ($_item->getData('store_id') != null && $_item->getData('store_id') != "0") ? $_item->getData('store_id') :
|
|
|
|
|
|
|
|
|
|
|
218 |
$product = Mage::getModel('catalog/product')->load( $_item->getProductId() );
|
219 |
if ( $product->getId() ) {
|
220 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
@@ -231,12 +205,17 @@ class DB1_AnyMarket_Model_Observer {
|
|
231 |
foreach ($quote->getAllItems() as $item) {
|
232 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
233 |
if ( $product->getId() ) {
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
|
242 |
}
|
@@ -249,11 +228,16 @@ class DB1_AnyMarket_Model_Observer {
|
|
249 |
foreach ($quote->getAllItems() as $item) {
|
250 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
251 |
if ( $product->getId() ) {
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
}
|
259 |
}
|
@@ -265,8 +249,12 @@ class DB1_AnyMarket_Model_Observer {
|
|
265 |
$item = $observer->getEvent()->getItem();
|
266 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
267 |
if ( $product->getId() ) {
|
268 |
-
$storeID = ($item->getStoreId() != null && $item->getStoreId() != "0") ? $item->getStoreId() :
|
269 |
-
|
|
|
|
|
|
|
|
|
270 |
}
|
271 |
}
|
272 |
|
@@ -275,16 +263,20 @@ class DB1_AnyMarket_Model_Observer {
|
|
275 |
*/
|
276 |
public function refundOrderInventory($observer){
|
277 |
$creditmemo = $observer->getEvent()->getCreditmemo();
|
278 |
-
$storeID = ($creditmemo->getStoreId() != null && $creditmemo->getStoreId() != "0") ? $creditmemo->getStoreId() :
|
279 |
|
280 |
foreach ($creditmemo->getAllItems() as $item) {
|
281 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
282 |
if ( $product->getId() ) {
|
283 |
if ($item->getData('back_to_stock') == 1){
|
284 |
-
$
|
285 |
-
|
|
|
|
|
|
|
286 |
|
287 |
-
|
|
|
288 |
}
|
289 |
}
|
290 |
}
|
2 |
|
3 |
class DB1_AnyMarket_Model_Observer {
|
4 |
|
5 |
+
private function asyncMode($storeID){
|
6 |
+
return Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_field', $storeID);
|
7 |
+
}
|
8 |
+
|
9 |
/**
|
10 |
* @param $observer
|
11 |
*/
|
39 |
|
40 |
/**
|
41 |
* @param $observer
|
42 |
+
* @return array
|
43 |
*/
|
44 |
public function sendProdAnyMarket($observer) {
|
45 |
+
$productOld = $observer->getEvent()->getProduct();
|
46 |
+
$storeID = ($productOld->getStoreId() != null && $productOld->getStoreId() != "0") ? $productOld->getStoreId() : Mage::app()->getDefaultStoreView()->getId();
|
47 |
+
try{
|
48 |
+
$ExportProdSession = Mage::getSingleton('core/session')->getImportProdsVariable();
|
49 |
+
if( $ExportProdSession == 'false' ) {
|
50 |
+
return false;
|
51 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
$QuickCreate = Mage::getSingleton('core/session')->getQuickCreateProdVariable();
|
54 |
+
if($QuickCreate != null || $QuickCreate != "" || $QuickCreate == $productOld->getSku() ) {
|
|
|
55 |
Mage::getSingleton('core/session')->setQuickCreateProdVariable('');
|
56 |
+
return false;
|
57 |
}
|
58 |
|
59 |
+
if( Mage::registry('prod_save_observer_executed_'.$productOld->getId()) ){
|
60 |
+
Mage::unregister( 'prod_save_observer_executed_'.$productOld->getId() );
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
Mage::register('prod_save_observer_executed_'.$productOld->getId(), true);
|
64 |
+
|
65 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($productOld->getId());
|
66 |
+
if( $this->asyncMode($storeID) && $product->getData('integra_anymarket') == 1 ) {
|
67 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $product->getId(), 'EXP', 'PRODUCT');
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
|
71 |
+
Mage::helper('db1_anymarket/product')->prepareForSendProduct($storeID, $product);
|
72 |
+
|
73 |
+
} catch (Exception $e) {
|
74 |
+
Mage::unregister( 'prod_save_observer_executed_'.$productOld->getId() );
|
75 |
+
Mage::logException($e);
|
76 |
}
|
77 |
}
|
78 |
|
84 |
if( !$category->getName() ) {
|
85 |
$category = Mage::getModel('catalog/category')->load($category->getId());
|
86 |
}
|
87 |
+
|
88 |
+
$storeID = Mage::app()->getRequest()->getParam('store') == 0 ? Mage::helper('db1_anymarket')->getCurrentStoreView() : Mage::app()->getRequest()->getParam('store');
|
89 |
if( $category->getData('categ_integra_anymarket') == 1 ){
|
90 |
$amCategParent = Mage::getModel('db1_anymarket/anymarketcategories')->load($category->getParentId(), 'nmc_id_magento');
|
91 |
if( $amCategParent->getData('nmc_cat_id') ){
|
123 |
public function updateOrderAnyMarketObs($observer){
|
124 |
$storeID = $observer->getEvent()->getOrder()->getStoreId();
|
125 |
$OrderID = $observer->getEvent()->getOrder()->getIncrementId();
|
126 |
+
try {
|
127 |
+
if(Mage::registry('order_save_observer_executed_'.$OrderID )){
|
128 |
+
Mage::unregister( 'order_save_observer_executed_'.$OrderID );
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
|
132 |
+
Mage::register('order_save_observer_executed_'.$OrderID, true);
|
133 |
+
$order = $observer->getEvent()->getOrder();
|
|
|
134 |
|
135 |
+
if( $this->asyncMode($storeID) ){
|
136 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $OrderID, 'EXP', 'ORDER');
|
137 |
+
}else{
|
138 |
+
Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $order );
|
139 |
+
}
|
|
|
140 |
|
141 |
+
//DECREMENTA STOCK ANYMARKET
|
142 |
+
$orderItems = $order->getItemsCollection();
|
143 |
+
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
144 |
+
foreach ($orderItems as $item){
|
145 |
+
$product_id = $item->product_id;
|
146 |
+
if( $this->asyncMode($storeID) ) {
|
147 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $product_id, 'EXP', 'STOCK');
|
148 |
+
}else {
|
149 |
+
$_product = Mage::getModel('catalog/product')->load($product_id);
|
150 |
+
|
151 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
|
152 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product_id, $stock->getQty(), $_product->getData($filter));
|
153 |
+
}
|
154 |
+
}
|
155 |
+
Mage::unregister( 'order_save_observer_executed_'.$OrderID );
|
156 |
+
} catch (Exception $e) {
|
157 |
+
Mage::unregister( 'order_save_observer_executed_'.$OrderID );
|
158 |
+
Mage::logException($e);
|
159 |
}
|
160 |
|
161 |
}
|
183 |
$event = $observer->getEvent();
|
184 |
$_item = $event->getItem();
|
185 |
|
186 |
+
$storeID = ($_item->getData('store_id') != null && $_item->getData('store_id') != "0") ? $_item->getData('store_id') : Mage::app()->getDefaultStoreView()->getId();
|
187 |
+
if( $this->asyncMode($storeID) ){
|
188 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $_item->getProductId(), 'EXP', 'STOCK');
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
|
192 |
$product = Mage::getModel('catalog/product')->load( $_item->getProductId() );
|
193 |
if ( $product->getId() ) {
|
194 |
$filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
|
205 |
foreach ($quote->getAllItems() as $item) {
|
206 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
207 |
if ( $product->getId() ) {
|
208 |
+
$storeID = ($item->getStoreId() != null && $item->getStoreId() != "0") ? $item->getStoreId() : Mage::app()->getDefaultStoreView()->getId();
|
209 |
+
if( $this->asyncMode($storeID) ){
|
210 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $item->getProductId(), 'EXP', 'STOCK');
|
211 |
+
}else {
|
212 |
+
$itemSold = $item->getTotalQty();
|
213 |
+
$qty = $item->getProduct()->getStockItem()->getQty();
|
214 |
+
$qtyNow = $qty - $itemSold;
|
215 |
+
|
216 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $item->getProductId(), $qtyNow, null);
|
217 |
+
}
|
218 |
+
}
|
219 |
}
|
220 |
|
221 |
}
|
228 |
foreach ($quote->getAllItems() as $item) {
|
229 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
230 |
if ( $product->getId() ) {
|
231 |
+
$storeID = ($item->getStoreId() != null && $item->getStoreId() != "0") ? $item->getStoreId() : Mage::app()->getDefaultStoreView()->getId();
|
232 |
+
if( $this->asyncMode($storeID) ){
|
233 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $item->getProductId(), 'EXP', 'STOCK');
|
234 |
+
}else{
|
235 |
+
$qty = $item->getProduct()->getStockItem()->getQty();
|
236 |
+
$itemRevert = ($item->getTotalQty());
|
237 |
+
$qtyNow = $qty + $itemRevert;
|
238 |
+
|
239 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $item->getProductId(), $qtyNow, null);
|
240 |
+
}
|
241 |
}
|
242 |
}
|
243 |
}
|
249 |
$item = $observer->getEvent()->getItem();
|
250 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
251 |
if ( $product->getId() ) {
|
252 |
+
$storeID = ($item->getStoreId() != null && $item->getStoreId() != "0") ? $item->getStoreId() : Mage::app()->getDefaultStoreView()->getId();
|
253 |
+
if( $this->asyncMode($storeID) ){
|
254 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $product->getId(), 'EXP', 'STOCK');
|
255 |
+
}else{
|
256 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $product->getStockItem()->getQty(), null);
|
257 |
+
}
|
258 |
}
|
259 |
}
|
260 |
|
263 |
*/
|
264 |
public function refundOrderInventory($observer){
|
265 |
$creditmemo = $observer->getEvent()->getCreditmemo();
|
266 |
+
$storeID = ($creditmemo->getStoreId() != null && $creditmemo->getStoreId() != "0") ? $creditmemo->getStoreId() : Mage::app()->getDefaultStoreView()->getId();
|
267 |
|
268 |
foreach ($creditmemo->getAllItems() as $item) {
|
269 |
$product = Mage::getModel('catalog/product')->load( $item->getProductId() );
|
270 |
if ( $product->getId() ) {
|
271 |
if ($item->getData('back_to_stock') == 1){
|
272 |
+
if( $this->asyncMode($storeID) ){
|
273 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $item->getProductId(), 'EXP', 'STOCK');
|
274 |
+
}else {
|
275 |
+
$ProdLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->load($item->getProductId());
|
276 |
+
$stockQty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($ProdLoaded)->getQty();
|
277 |
|
278 |
+
Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $item->getProductId(), $stockQty + (int)$item->getQty(), null);
|
279 |
+
}
|
280 |
}
|
281 |
}
|
282 |
}
|
app/code/community/DB1/AnyMarket/Model/PaymentMethod.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/Resource/Setup.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Street/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Booleantp/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Price/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Set/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/General/Values.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class DB1_AnyMarket_Model_System_Config_Source_General_Values
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$retornArray = array();
|
8 |
+
$retornArray[] = array( 'label' => 'Imediato', 'value' => '0' );
|
9 |
+
$retornArray[] = array( 'label' => 'Fila Integração', 'value' => '1' );
|
10 |
+
|
11 |
+
return $retornArray;
|
12 |
+
}
|
13 |
+
}
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Logs/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Measurementunit/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketbrandsController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php
CHANGED
@@ -63,7 +63,8 @@ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketproductsController extends DB1_
|
|
63 |
public function listProdsAction()
|
64 |
{
|
65 |
$storeID = Mage::getSingleton('core/session')->getStoreListProdVariable();
|
66 |
-
Mage::
|
|
|
67 |
$this->_redirect('*/*/');
|
68 |
|
69 |
}
|
63 |
public function listProdsAction()
|
64 |
{
|
65 |
$storeID = Mage::getSingleton('core/session')->getStoreListProdVariable();
|
66 |
+
$storeID = ($storeID != null && $storeID != "0") ? $storeID : Mage::app()->getDefaultStoreView()->getId();
|
67 |
+
Mage::helper('db1_anymarket/product')->listAllProds($storeID);
|
68 |
$this->_redirect('*/*/');
|
69 |
|
70 |
}
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/Adminhtml/AnymarketController.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/controllers/IndexController.php
CHANGED
@@ -21,28 +21,52 @@ class DB1_AnyMarket_IndexController extends Mage_Core_Controller_Front_Action {
|
|
21 |
|
22 |
if ($TOKEN != '') {
|
23 |
if ($value->type == 'ORDER') {
|
24 |
-
$cache = Mage::app()->getCache();
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
31 |
|
32 |
-
$
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
-
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
} elseif ($value->type == 'TRANSMISSION') {
|
44 |
$listTransmissions = array();
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
47 |
|
48 |
$headers = array(
|
@@ -58,9 +82,14 @@ class DB1_AnyMarket_IndexController extends Mage_Core_Controller_Front_Action {
|
|
58 |
);
|
59 |
|
60 |
$JSON = json_encode($listTransmissions);
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
} else {
|
66 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
21 |
|
22 |
if ($TOKEN != '') {
|
23 |
if ($value->type == 'ORDER') {
|
|
|
24 |
|
25 |
+
if( Mage::registry('callback_order_executed_'.$value->content->id ) ){
|
26 |
+
Mage::unregister( 'callback_order_executed_'.$value->content->id );
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
Mage::register('callback_order_executed_'.$value->content->id, true);
|
30 |
+
|
31 |
+
try{
|
32 |
+
$cache = Mage::app()->getCache();
|
33 |
|
34 |
+
$lastProcOrder = $cache->load('order_' . $value->content->id);
|
35 |
+
$lastProc = true;
|
36 |
+
if ($lastProcOrder != null) {
|
37 |
+
$dateOld = new DateTime(date('y-m-d H:i:s', strtotime($lastProcOrder)));
|
38 |
+
$dateNew = new DateTime(date('y-m-d H:i:s'));
|
39 |
+
|
40 |
+
$difDate = $dateOld->diff($dateNew);
|
41 |
+
if ($difDate->h <= 0 && $difDate->i <= 0 && $difDate->s <= 20) {
|
42 |
+
$lastProc = false;
|
43 |
+
}
|
44 |
}
|
|
|
45 |
|
46 |
+
if ($lastProc) {
|
47 |
+
$cache->save(date('y-m-d H:i:s'), 'order_' . $value->content->id, array($value->content->id), 60 * 60);
|
48 |
|
49 |
+
Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($value->content->id, "notoken", $storeID);
|
50 |
+
}
|
51 |
+
Mage::unregister( 'callback_order_executed_'.$value->content->id );
|
52 |
+
} catch (Exception $e) {
|
53 |
+
echo "Erro ao inserir Pedido, verificar os logs do Magento";
|
54 |
+
Mage::unregister( 'callback_order_executed_'.$value->content->id );
|
55 |
+
Mage::logException($e);
|
56 |
}
|
57 |
} elseif ($value->type == 'TRANSMISSION') {
|
58 |
$listTransmissions = array();
|
59 |
|
60 |
+
if( !Mage::helper('db1_anymarket/product')->validateCallbackReceiver($storeID, $value->content->id) ){
|
61 |
+
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
62 |
+
$anymarketlog->setLogDesc('Callback Rejected');
|
63 |
+
$anymarketlog->setLogJson(file_get_contents('php://input'));
|
64 |
+
$anymarketlog->setStatus("0");
|
65 |
+
$anymarketlog->save();
|
66 |
+
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
$HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
|
71 |
|
72 |
$headers = array(
|
82 |
);
|
83 |
|
84 |
$JSON = json_encode($listTransmissions);
|
85 |
+
$sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_field', $storeID);
|
86 |
+
if( $sincMode ) {
|
87 |
+
Mage::helper('db1_anymarket/queue')->addQueue($storeID, $value->content->id, 'IMP', 'PRODUCT');
|
88 |
+
echo "Adicionado na fila Magento.";
|
89 |
+
}else{
|
90 |
+
$transRet = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
|
91 |
+
echo $transRet;
|
92 |
+
}
|
93 |
}
|
94 |
} else {
|
95 |
$anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
|
app/code/community/DB1/AnyMarket/etc/adminhtml.xml
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/etc/api.xml
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<DB1_AnyMarket>
|
5 |
-
<version>2.
|
6 |
</DB1_AnyMarket>
|
7 |
</modules>
|
8 |
<global>
|
@@ -263,6 +263,8 @@
|
|
263 |
<anymarket_integration_prod_group>
|
264 |
<anymarket_type_prod_sync_field>0</anymarket_type_prod_sync_field>
|
265 |
<anymarket_type_weight_field>0</anymarket_type_weight_field>
|
|
|
|
|
266 |
</anymarket_integration_prod_group>
|
267 |
|
268 |
<anymarket_integration_order_group>
|
@@ -287,13 +289,12 @@
|
|
287 |
<anymarket_price_factor_field>markup</anymarket_price_factor_field>
|
288 |
<anymarket_add1_field>street</anymarket_add1_field>
|
289 |
<anymarket_add2_field>number</anymarket_add2_field>
|
290 |
-
<anymarket_add3_field>comment</anymarket_add3_field
|
291 |
-
<anymarket_add4_field>neighborhood</anymarket_add4_field
|
292 |
</anymarket_attribute_group>
|
293 |
|
294 |
<anymarket_cron_group>
|
295 |
-
<anymarket_order_field>
|
296 |
-
<anymarket_product_field>1</anymarket_product_field>
|
297 |
</anymarket_cron_group>
|
298 |
|
299 |
<anymarket_logs_group>
|
@@ -305,20 +306,16 @@
|
|
305 |
<!-- CRON -->
|
306 |
<crontab>
|
307 |
<jobs>
|
308 |
-
<
|
309 |
-
<schedule><cron_expr
|
310 |
-
<run><model>db1_anymarket/cron::
|
311 |
-
</
|
312 |
-
<db1_anymarket_getprods>
|
313 |
-
<schedule><cron_expr>0 * * * *</cron_expr></schedule> <!-- 1 hora -->
|
314 |
-
<run><model>db1_anymarket/cron::sincProducts</model></run>
|
315 |
-
</db1_anymarket_getprods>
|
316 |
<db1_anymarket_cleanlogs>
|
317 |
<schedule><cron_expr>5 5 * * 6</cron_expr></schedule> <!-- 1 vez por semana -->
|
318 |
<run><model>db1_anymarket/cron::executeCleanLogs</model></run>
|
319 |
</db1_anymarket_cleanlogs>
|
320 |
<db1_anymarket_executereindex>
|
321 |
-
<schedule><cron_expr>59 0 * * * </cron_expr></schedule> <!--
|
322 |
<run><model>db1_anymarket/cron::executeReindex</model></run>
|
323 |
</db1_anymarket_executereindex>
|
324 |
<db1_anymarket_execqueue>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<DB1_AnyMarket>
|
5 |
+
<version>2.10.1</version>
|
6 |
</DB1_AnyMarket>
|
7 |
</modules>
|
8 |
<global>
|
263 |
<anymarket_integration_prod_group>
|
264 |
<anymarket_type_prod_sync_field>0</anymarket_type_prod_sync_field>
|
265 |
<anymarket_type_weight_field>0</anymarket_type_weight_field>
|
266 |
+
<anymarket_transform_http_image_field>0</anymarket_transform_http_image_field>
|
267 |
+
<anymarket_transform_process_image_field>0</anymarket_transform_process_image_field>
|
268 |
</anymarket_integration_prod_group>
|
269 |
|
270 |
<anymarket_integration_order_group>
|
289 |
<anymarket_price_factor_field>markup</anymarket_price_factor_field>
|
290 |
<anymarket_add1_field>street</anymarket_add1_field>
|
291 |
<anymarket_add2_field>number</anymarket_add2_field>
|
292 |
+
<anymarket_add3_field>comment</anymarket_add3_field>
|
293 |
+
<anymarket_add4_field>neighborhood</anymarket_add4_field>
|
294 |
</anymarket_attribute_group>
|
295 |
|
296 |
<anymarket_cron_group>
|
297 |
+
<anymarket_order_field>0</anymarket_order_field>
|
|
|
298 |
</anymarket_cron_group>
|
299 |
|
300 |
<anymarket_logs_group>
|
306 |
<!-- CRON -->
|
307 |
<crontab>
|
308 |
<jobs>
|
309 |
+
<db1_anymarket_getstocks>
|
310 |
+
<schedule><cron_expr>*/2 * * * *</cron_expr></schedule> <!-- 2 minutos -->
|
311 |
+
<run><model>db1_anymarket/cron::sincStocks</model></run>
|
312 |
+
</db1_anymarket_getstocks>
|
|
|
|
|
|
|
|
|
313 |
<db1_anymarket_cleanlogs>
|
314 |
<schedule><cron_expr>5 5 * * 6</cron_expr></schedule> <!-- 1 vez por semana -->
|
315 |
<run><model>db1_anymarket/cron::executeCleanLogs</model></run>
|
316 |
</db1_anymarket_cleanlogs>
|
317 |
<db1_anymarket_executereindex>
|
318 |
+
<schedule><cron_expr>59 0 * * * </cron_expr></schedule> <!-- toda madrugada -->
|
319 |
<run><model>db1_anymarket/cron::executeReindex</model></run>
|
320 |
</db1_anymarket_executereindex>
|
321 |
<db1_anymarket_execqueue>
|
app/code/community/DB1/AnyMarket/etc/system.xml
CHANGED
@@ -2,13 +2,13 @@
|
|
2 |
<config>
|
3 |
<tabs>
|
4 |
<anymarket_tab module="db1_anymarket" translate="label">
|
5 |
-
<label>
|
6 |
<sort_order>100</sort_order>
|
7 |
</anymarket_tab>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<anymarket_section module="db1_anymarket" translate="label">
|
11 |
-
<label>
|
12 |
<sort_order>200</sort_order>
|
13 |
<show_in_default>0</show_in_default>
|
14 |
<show_in_website>0</show_in_website>
|
@@ -93,10 +93,20 @@
|
|
93 |
<show_in_store>1</show_in_store>
|
94 |
<fields>
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
<anymarket_header_validation_field>
|
97 |
<label>Validações</label>
|
98 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
99 |
-
<sort_order>
|
100 |
<show_in_default>0</show_in_default>
|
101 |
<show_in_website>0</show_in_website>
|
102 |
<show_in_store>1</show_in_store>
|
@@ -106,7 +116,7 @@
|
|
106 |
<label>Check the configurations</label>
|
107 |
<frontend_type>Button</frontend_type>
|
108 |
<frontend_model>db1_anymarket/adminhtml_system_config_form_buttoncheckconfig</frontend_model>
|
109 |
-
<sort_order>
|
110 |
<show_in_default>0</show_in_default>
|
111 |
<show_in_website>0</show_in_website>
|
112 |
<show_in_store>1</show_in_store>
|
@@ -230,11 +240,10 @@
|
|
230 |
<show_in_store>1</show_in_store>
|
231 |
</anymarket_header_access_field>
|
232 |
|
233 |
-
<anymarket_order_field translate="label
|
234 |
<label>Enable CRON of Order</label>
|
235 |
<sort_order>1</sort_order>
|
236 |
<comment>Cron responsible for synchronizing orders if there are any errors.</comment>
|
237 |
-
<tooltip>Disable only if you are sure, you can generate not synchronized orders.</tooltip>
|
238 |
<show_in_default>0</show_in_default>
|
239 |
<show_in_website>0</show_in_website>
|
240 |
<show_in_store>1</show_in_store>
|
@@ -242,18 +251,6 @@
|
|
242 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
243 |
</anymarket_order_field>
|
244 |
|
245 |
-
<anymarket_product_field translate="label tooltip comment">
|
246 |
-
<label>Enable CRON of Product</label>
|
247 |
-
<sort_order>2</sort_order>
|
248 |
-
<comment>Cron responsible for synchronizing products if there are any errors.</comment>
|
249 |
-
<tooltip>Disable only if you are sure, you can generate not synchronized products.</tooltip>
|
250 |
-
<show_in_default>0</show_in_default>
|
251 |
-
<show_in_website>0</show_in_website>
|
252 |
-
<show_in_store>1</show_in_store>
|
253 |
-
<frontend_type>select</frontend_type>
|
254 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
255 |
-
</anymarket_product_field>
|
256 |
-
|
257 |
<anymarket_reindex_field translate="label tooltip comment">
|
258 |
<label>Enable CRON of Reindex</label>
|
259 |
<sort_order>3</sort_order>
|
@@ -415,6 +412,7 @@
|
|
415 |
<frontend_type>select</frontend_type>
|
416 |
<source_model>db1_anymarket/system_config_source_massunit_values</source_model>
|
417 |
</anymarket_type_weight_field>
|
|
|
418 |
<anymarket_type_size_field translate="label comment">
|
419 |
<label>Unit of measurement</label>
|
420 |
<comment>Select how you will be treated to their size AnyMarket.</comment>
|
@@ -425,27 +423,95 @@
|
|
425 |
<frontend_type>select</frontend_type>
|
426 |
<source_model>db1_anymarket/system_config_source_measurementunit_values</source_model>
|
427 |
</anymarket_type_size_field>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
<anymarket_export_image_field translate="label comment tooltip">
|
429 |
<label>Ignore invalid resolution</label>
|
430 |
<comment>Import products even when it has invalid resolution.</comment>
|
431 |
<tooltip>In Anymarket there is a restriction on the image, it is required to have 350px by 350px and less than 4mb, if this option is checked, this validation is for Anymarket account.</tooltip>
|
432 |
-
<sort_order>
|
433 |
<show_in_default>0</show_in_default>
|
434 |
<show_in_website>0</show_in_website>
|
435 |
<show_in_store>1</show_in_store>
|
436 |
<frontend_type>select</frontend_type>
|
437 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
438 |
</anymarket_export_image_field>
|
439 |
-
|
440 |
-
|
441 |
-
<
|
442 |
-
<
|
|
|
|
|
443 |
<show_in_default>0</show_in_default>
|
444 |
<show_in_website>0</show_in_website>
|
445 |
<show_in_store>1</show_in_store>
|
446 |
<frontend_type>select</frontend_type>
|
447 |
-
<source_model>
|
448 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
</fields>
|
451 |
</anymarket_integration_prod_group>
|
@@ -765,10 +831,21 @@
|
|
765 |
<show_in_store>1</show_in_store>
|
766 |
<fields>
|
767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
<anymarket_header_order_field>
|
769 |
<label>Fluxo de Integração</label>
|
770 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
771 |
-
<sort_order>
|
772 |
<show_in_default>0</show_in_default>
|
773 |
<show_in_website>0</show_in_website>
|
774 |
<show_in_store>1</show_in_store>
|
@@ -777,7 +854,7 @@
|
|
777 |
<anymarket_type_order_sync_field translate="label tooltip comment">
|
778 |
<label>Type Synchronization</label>
|
779 |
<comment>If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento.</comment>
|
780 |
-
<sort_order>
|
781 |
<show_in_default>0</show_in_default>
|
782 |
<show_in_website>0</show_in_website>
|
783 |
<show_in_store>1</show_in_store>
|
@@ -788,18 +865,29 @@
|
|
788 |
<anymarket_header_order_imp_field>
|
789 |
<label>Status a serem importados do Anymarket</label>
|
790 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
791 |
-
<sort_order>
|
792 |
<show_in_default>0</show_in_default>
|
793 |
<show_in_website>0</show_in_website>
|
794 |
<show_in_store>2</show_in_store>
|
795 |
</anymarket_header_order_imp_field>
|
796 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
797 |
<anymarket_stauts_order_field translate="label tooltip comment">
|
798 |
<label>Status Order</label>
|
799 |
<comment>Status of orders that must be imported.</comment>
|
800 |
<frontend_type>multiselect</frontend_type>
|
801 |
<source_model>db1_anymarket/system_config_source_orders_values</source_model>
|
802 |
-
<sort_order>
|
803 |
<show_in_default>0</show_in_default>
|
804 |
<show_in_website>0</show_in_website>
|
805 |
<show_in_store>1</show_in_store>
|
@@ -808,7 +896,7 @@
|
|
808 |
<anymarket_header_am_mg_field>
|
809 |
<label>Anymarket para Magento</label>
|
810 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
811 |
-
<sort_order>
|
812 |
<show_in_default>0</show_in_default>
|
813 |
<show_in_website>0</show_in_website>
|
814 |
<show_in_store>2</show_in_store>
|
@@ -818,7 +906,7 @@
|
|
818 |
<label>Status Order (Anymarket to Magento)</label>
|
819 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
820 |
<frontend_model>db1_anymarket/system_config_source_orders_statusammg_values</frontend_model>
|
821 |
-
<sort_order>
|
822 |
<show_in_default>0</show_in_default>
|
823 |
<show_in_website>0</show_in_website>
|
824 |
<show_in_store>1</show_in_store>
|
@@ -828,7 +916,7 @@
|
|
828 |
<anymarket_header_mg_am_field>
|
829 |
<label>Magento para Anymarket</label>
|
830 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
831 |
-
<sort_order>
|
832 |
<show_in_default>0</show_in_default>
|
833 |
<show_in_website>0</show_in_website>
|
834 |
<show_in_store>2</show_in_store>
|
@@ -838,7 +926,7 @@
|
|
838 |
<label>Status Order (Magento to Anymarket)</label>
|
839 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
840 |
<frontend_model>db1_anymarket/system_config_source_orders_statusmgam_values</frontend_model>
|
841 |
-
<sort_order>
|
842 |
<show_in_default>0</show_in_default>
|
843 |
<show_in_website>0</show_in_website>
|
844 |
<show_in_store>1</show_in_store>
|
@@ -849,7 +937,7 @@
|
|
849 |
</anymarket_integration_order_group>
|
850 |
|
851 |
<anymarket_information_group translate="label" module="db1_anymarket">
|
852 |
-
<label>
|
853 |
<sort_order>6</sort_order>
|
854 |
<show_in_default>0</show_in_default>
|
855 |
<show_in_website>0</show_in_website>
|
@@ -857,8 +945,10 @@
|
|
857 |
<comment>
|
858 |
<![CDATA[
|
859 |
<div>
|
860 |
-
<
|
861 |
-
<
|
|
|
|
|
862 |
<br>
|
863 |
<br>
|
864 |
Site: <a href="http://www.novapc.com.br/" target="_blank">www.novapc.com.br/</a>
|
@@ -867,6 +957,10 @@
|
|
867 |
<br>
|
868 |
Telefone: 14-2104-5600
|
869 |
<br>
|
|
|
|
|
|
|
|
|
870 |
<b>Acesse o github do projeto: <a target="_blank" href="https://github.com/AnyMarket/magento">https://github.com/AnyMarket/magento</a></b>
|
871 |
</div>
|
872 |
]]>
|
2 |
<config>
|
3 |
<tabs>
|
4 |
<anymarket_tab module="db1_anymarket" translate="label">
|
5 |
+
<label>AnyMarket</label>
|
6 |
<sort_order>100</sort_order>
|
7 |
</anymarket_tab>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<anymarket_section module="db1_anymarket" translate="label">
|
11 |
+
<label>Configurações</label>
|
12 |
<sort_order>200</sort_order>
|
13 |
<show_in_default>0</show_in_default>
|
14 |
<show_in_website>0</show_in_website>
|
93 |
<show_in_store>1</show_in_store>
|
94 |
<fields>
|
95 |
|
96 |
+
<anymarket_operation_type_field>
|
97 |
+
<label>Tipo de Operação</label>
|
98 |
+
<frontend_type>select</frontend_type>
|
99 |
+
<source_model>db1_anymarket/system_config_source_general_values</source_model>
|
100 |
+
<sort_order>0</sort_order>
|
101 |
+
<show_in_default>0</show_in_default>
|
102 |
+
<show_in_website>0</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</anymarket_operation_type_field>
|
105 |
+
|
106 |
<anymarket_header_validation_field>
|
107 |
<label>Validações</label>
|
108 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
109 |
+
<sort_order>1</sort_order>
|
110 |
<show_in_default>0</show_in_default>
|
111 |
<show_in_website>0</show_in_website>
|
112 |
<show_in_store>1</show_in_store>
|
116 |
<label>Check the configurations</label>
|
117 |
<frontend_type>Button</frontend_type>
|
118 |
<frontend_model>db1_anymarket/adminhtml_system_config_form_buttoncheckconfig</frontend_model>
|
119 |
+
<sort_order>2</sort_order>
|
120 |
<show_in_default>0</show_in_default>
|
121 |
<show_in_website>0</show_in_website>
|
122 |
<show_in_store>1</show_in_store>
|
240 |
<show_in_store>1</show_in_store>
|
241 |
</anymarket_header_access_field>
|
242 |
|
243 |
+
<anymarket_order_field translate="label comment">
|
244 |
<label>Enable CRON of Order</label>
|
245 |
<sort_order>1</sort_order>
|
246 |
<comment>Cron responsible for synchronizing orders if there are any errors.</comment>
|
|
|
247 |
<show_in_default>0</show_in_default>
|
248 |
<show_in_website>0</show_in_website>
|
249 |
<show_in_store>1</show_in_store>
|
251 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
252 |
</anymarket_order_field>
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
<anymarket_reindex_field translate="label tooltip comment">
|
255 |
<label>Enable CRON of Reindex</label>
|
256 |
<sort_order>3</sort_order>
|
412 |
<frontend_type>select</frontend_type>
|
413 |
<source_model>db1_anymarket/system_config_source_massunit_values</source_model>
|
414 |
</anymarket_type_weight_field>
|
415 |
+
|
416 |
<anymarket_type_size_field translate="label comment">
|
417 |
<label>Unit of measurement</label>
|
418 |
<comment>Select how you will be treated to their size AnyMarket.</comment>
|
423 |
<frontend_type>select</frontend_type>
|
424 |
<source_model>db1_anymarket/system_config_source_measurementunit_values</source_model>
|
425 |
</anymarket_type_size_field>
|
426 |
+
|
427 |
+
<anymarket_atribute_set_field translate="label comment">
|
428 |
+
<label>Atribute set</label>
|
429 |
+
<comment>Set of attributes that should be registered the Anymarket products.</comment>
|
430 |
+
<sort_order>5</sort_order>
|
431 |
+
<show_in_default>0</show_in_default>
|
432 |
+
<show_in_website>0</show_in_website>
|
433 |
+
<show_in_store>1</show_in_store>
|
434 |
+
<frontend_type>select</frontend_type>
|
435 |
+
<source_model>db1_anymarket/system_config_source_attributes_set_values</source_model>
|
436 |
+
</anymarket_atribute_set_field>
|
437 |
+
|
438 |
+
<anymarket_bind_product_field translate="label comment">
|
439 |
+
<label>Associate duplicate products</label>
|
440 |
+
<comment>With this marked parameter, when a product with a sku in Anymarket, it will be automatically connected.</comment>
|
441 |
+
<sort_order>6</sort_order>
|
442 |
+
<show_in_default>0</show_in_default>
|
443 |
+
<show_in_website>0</show_in_website>
|
444 |
+
<show_in_store>1</show_in_store>
|
445 |
+
<frontend_type>select</frontend_type>
|
446 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
447 |
+
</anymarket_bind_product_field>
|
448 |
+
|
449 |
+
<anymarket_header_images_field>
|
450 |
+
<label>Imagens</label>
|
451 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
452 |
+
<sort_order>7</sort_order>
|
453 |
+
<show_in_default>0</show_in_default>
|
454 |
+
<show_in_website>0</show_in_website>
|
455 |
+
<show_in_store>1</show_in_store>
|
456 |
+
</anymarket_header_images_field>
|
457 |
+
|
458 |
<anymarket_export_image_field translate="label comment tooltip">
|
459 |
<label>Ignore invalid resolution</label>
|
460 |
<comment>Import products even when it has invalid resolution.</comment>
|
461 |
<tooltip>In Anymarket there is a restriction on the image, it is required to have 350px by 350px and less than 4mb, if this option is checked, this validation is for Anymarket account.</tooltip>
|
462 |
+
<sort_order>8</sort_order>
|
463 |
<show_in_default>0</show_in_default>
|
464 |
<show_in_website>0</show_in_website>
|
465 |
<show_in_store>1</show_in_store>
|
466 |
<frontend_type>select</frontend_type>
|
467 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
468 |
</anymarket_export_image_field>
|
469 |
+
|
470 |
+
<anymarket_transform_http_image_field translate="label comment tooltip">
|
471 |
+
<label>Send image as HTTP</label>
|
472 |
+
<comment>If set to yes, will transform HTTPS to HTTP images for sending.</comment>
|
473 |
+
<tooltip>This feature will not work if your magento not allow access images as HTTP.</tooltip>
|
474 |
+
<sort_order>9</sort_order>
|
475 |
<show_in_default>0</show_in_default>
|
476 |
<show_in_website>0</show_in_website>
|
477 |
<show_in_store>1</show_in_store>
|
478 |
<frontend_type>select</frontend_type>
|
479 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
480 |
+
</anymarket_transform_http_image_field>
|
481 |
+
|
482 |
+
<anymarket_transform_process_image_field translate="label comment tooltip">
|
483 |
+
<label>Enable Image Processing</label>
|
484 |
+
<sort_order>10</sort_order>
|
485 |
+
<comment>Enabling this parameter images are processed before being sent to Anymarket.</comment>
|
486 |
+
<tooltip>Product images are reduced to the Anymarket accepted.</tooltip>
|
487 |
+
<show_in_default>0</show_in_default>
|
488 |
+
<show_in_website>0</show_in_website>
|
489 |
+
<show_in_store>1</show_in_store>
|
490 |
+
<frontend_type>select</frontend_type>
|
491 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
492 |
+
</anymarket_transform_process_image_field>
|
493 |
+
|
494 |
+
<anymarket_width_image_field translate="label tooltip comment">
|
495 |
+
<label>Width</label>
|
496 |
+
<sort_order>11</sort_order>
|
497 |
+
<comment>Width of the image.</comment>
|
498 |
+
<tooltip>Width that the image will be resized.</tooltip>
|
499 |
+
<show_in_default>0</show_in_default>
|
500 |
+
<show_in_website>0</show_in_website>
|
501 |
+
<show_in_store>1</show_in_store>
|
502 |
+
<frontend_type>text</frontend_type>
|
503 |
+
</anymarket_width_image_field>
|
504 |
+
|
505 |
+
<anymarket_height_image_field translate="label tooltip comment">
|
506 |
+
<label>Height</label>
|
507 |
+
<sort_order>12</sort_order>
|
508 |
+
<comment>Height of the image.</comment>
|
509 |
+
<tooltip>Height that the image will be resized.</tooltip>
|
510 |
+
<show_in_default>0</show_in_default>
|
511 |
+
<show_in_website>0</show_in_website>
|
512 |
+
<show_in_store>1</show_in_store>
|
513 |
+
<frontend_type>text</frontend_type>
|
514 |
+
</anymarket_height_image_field>
|
515 |
|
516 |
</fields>
|
517 |
</anymarket_integration_prod_group>
|
831 |
<show_in_store>1</show_in_store>
|
832 |
<fields>
|
833 |
|
834 |
+
<anymarket_estimate_date_field translate="label tooltip comment">
|
835 |
+
<label>Dias adicionais Data Estimada de Entrega</label>
|
836 |
+
<sort_order>0</sort_order>
|
837 |
+
<comment>Caso não seja informado, enviará 10 dias adicionais.</comment>
|
838 |
+
<tooltip>Quantidade de dias que será adicionada a data de envio para o campo Data Estimada.</tooltip>
|
839 |
+
<show_in_default>0</show_in_default>
|
840 |
+
<show_in_website>0</show_in_website>
|
841 |
+
<show_in_store>1</show_in_store>
|
842 |
+
<frontend_type>text</frontend_type>
|
843 |
+
</anymarket_estimate_date_field>
|
844 |
+
|
845 |
<anymarket_header_order_field>
|
846 |
<label>Fluxo de Integração</label>
|
847 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
848 |
+
<sort_order>1</sort_order>
|
849 |
<show_in_default>0</show_in_default>
|
850 |
<show_in_website>0</show_in_website>
|
851 |
<show_in_store>1</show_in_store>
|
854 |
<anymarket_type_order_sync_field translate="label tooltip comment">
|
855 |
<label>Type Synchronization</label>
|
856 |
<comment>If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento.</comment>
|
857 |
+
<sort_order>2</sort_order>
|
858 |
<show_in_default>0</show_in_default>
|
859 |
<show_in_website>0</show_in_website>
|
860 |
<show_in_store>1</show_in_store>
|
865 |
<anymarket_header_order_imp_field>
|
866 |
<label>Status a serem importados do Anymarket</label>
|
867 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
868 |
+
<sort_order>3</sort_order>
|
869 |
<show_in_default>0</show_in_default>
|
870 |
<show_in_website>0</show_in_website>
|
871 |
<show_in_store>2</show_in_store>
|
872 |
</anymarket_header_order_imp_field>
|
873 |
|
874 |
+
<anymarket_create_reg_pay_field translate="label comment">
|
875 |
+
<label>Create payment record when importing paid</label>
|
876 |
+
<comment>By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO.</comment>
|
877 |
+
<sort_order>4</sort_order>
|
878 |
+
<show_in_default>0</show_in_default>
|
879 |
+
<show_in_website>0</show_in_website>
|
880 |
+
<show_in_store>1</show_in_store>
|
881 |
+
<frontend_type>select</frontend_type>
|
882 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
883 |
+
</anymarket_create_reg_pay_field>
|
884 |
+
|
885 |
<anymarket_stauts_order_field translate="label tooltip comment">
|
886 |
<label>Status Order</label>
|
887 |
<comment>Status of orders that must be imported.</comment>
|
888 |
<frontend_type>multiselect</frontend_type>
|
889 |
<source_model>db1_anymarket/system_config_source_orders_values</source_model>
|
890 |
+
<sort_order>5</sort_order>
|
891 |
<show_in_default>0</show_in_default>
|
892 |
<show_in_website>0</show_in_website>
|
893 |
<show_in_store>1</show_in_store>
|
896 |
<anymarket_header_am_mg_field>
|
897 |
<label>Anymarket para Magento</label>
|
898 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
899 |
+
<sort_order>6</sort_order>
|
900 |
<show_in_default>0</show_in_default>
|
901 |
<show_in_website>0</show_in_website>
|
902 |
<show_in_store>2</show_in_store>
|
906 |
<label>Status Order (Anymarket to Magento)</label>
|
907 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
908 |
<frontend_model>db1_anymarket/system_config_source_orders_statusammg_values</frontend_model>
|
909 |
+
<sort_order>7</sort_order>
|
910 |
<show_in_default>0</show_in_default>
|
911 |
<show_in_website>0</show_in_website>
|
912 |
<show_in_store>1</show_in_store>
|
916 |
<anymarket_header_mg_am_field>
|
917 |
<label>Magento para Anymarket</label>
|
918 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
919 |
+
<sort_order>8</sort_order>
|
920 |
<show_in_default>0</show_in_default>
|
921 |
<show_in_website>0</show_in_website>
|
922 |
<show_in_store>2</show_in_store>
|
926 |
<label>Status Order (Magento to Anymarket)</label>
|
927 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
928 |
<frontend_model>db1_anymarket/system_config_source_orders_statusmgam_values</frontend_model>
|
929 |
+
<sort_order>9</sort_order>
|
930 |
<show_in_default>0</show_in_default>
|
931 |
<show_in_website>0</show_in_website>
|
932 |
<show_in_store>1</show_in_store>
|
937 |
</anymarket_integration_order_group>
|
938 |
|
939 |
<anymarket_information_group translate="label" module="db1_anymarket">
|
940 |
+
<label>About</label>
|
941 |
<sort_order>6</sort_order>
|
942 |
<show_in_default>0</show_in_default>
|
943 |
<show_in_website>0</show_in_website>
|
945 |
<comment>
|
946 |
<![CDATA[
|
947 |
<div>
|
948 |
+
<h2>v. 2.10.1</h2>
|
949 |
+
<hr>
|
950 |
+
<h3>Desenvolvido por<br> NovaPC - Tecnologia da Informação.</h3>
|
951 |
+
<img src="http://novapc.com.br/images/logo.png" alt="NovaPC" height="100" width="150">
|
952 |
<br>
|
953 |
<br>
|
954 |
Site: <a href="http://www.novapc.com.br/" target="_blank">www.novapc.com.br/</a>
|
957 |
<br>
|
958 |
Telefone: 14-2104-5600
|
959 |
<br>
|
960 |
+
<br>
|
961 |
+
<h3>Mantido por Anymarket.</h3>
|
962 |
+
<img src="http://anymarket.com.br/assets/img/logo.png" alt="Anymarket">
|
963 |
+
<br>
|
964 |
<b>Acesse o github do projeto: <a target="_blank" href="https://github.com/AnyMarket/magento">https://github.com/AnyMarket/magento</a></b>
|
965 |
</div>
|
966 |
]]>
|
app/code/community/DB1/AnyMarket/etc/wsdl.xml
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/etc/wsi.xml
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php
CHANGED
@@ -1,605 +1,645 @@
|
|
1 |
<?php
|
2 |
$this->startSetup();
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
'
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
'
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
->
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
'
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
'
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
'
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
'
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
'
|
323 |
-
)
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
->
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
array('store_id')
|
341 |
-
)
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
|
|
|
|
347 |
'anymarketlog_id',
|
348 |
-
'db1_anymarket/anymarketlog',
|
349 |
-
'entity_id'
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
'store_id',
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
$this->
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
'anymarketproducts_id',
|
376 |
-
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
377 |
-
null,
|
378 |
-
array(
|
379 |
-
'nullable' => false,
|
380 |
-
'primary' => true,
|
381 |
-
),
|
382 |
-
'Anymarket Products ID'
|
383 |
-
)
|
384 |
-
->addColumn(
|
385 |
-
'store_id',
|
386 |
-
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
387 |
-
null,
|
388 |
-
array(
|
389 |
-
'unsigned' => true,
|
390 |
-
'nullable' => false,
|
391 |
-
'primary' => true,
|
392 |
-
),
|
393 |
-
'Store ID'
|
394 |
-
)
|
395 |
-
->addIndex(
|
396 |
-
$this->getIdxName(
|
397 |
-
'db1_anymarket/anymarketproducts_store',
|
398 |
array('store_id')
|
399 |
-
)
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
|
|
|
|
405 |
'anymarketproducts_id',
|
406 |
-
'db1_anymarket/anymarketproducts',
|
407 |
-
'entity_id'
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
'store_id',
|
419 |
-
'core/store',
|
420 |
-
'store_id'
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
'
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
$this->getConnection()->
|
430 |
-
$table = $this->getConnection()
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
|
|
|
|
456 |
array('store_id')
|
457 |
-
)
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
|
|
|
|
463 |
'anymarketattributes_id',
|
464 |
-
'db1_anymarket/anymarketattributes',
|
465 |
-
'entity_id'
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
'store_id',
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
$this->
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
'anymarketorders_id',
|
492 |
-
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
493 |
-
null,
|
494 |
-
array(
|
495 |
-
'nullable' => false,
|
496 |
-
'primary' => true,
|
497 |
-
),
|
498 |
-
'Anymarket Orders ID'
|
499 |
-
)
|
500 |
-
->addColumn(
|
501 |
-
'store_id',
|
502 |
-
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
503 |
-
null,
|
504 |
-
array(
|
505 |
-
'unsigned' => true,
|
506 |
-
'nullable' => false,
|
507 |
-
'primary' => true,
|
508 |
-
),
|
509 |
-
'Store ID'
|
510 |
-
)
|
511 |
-
->addIndex(
|
512 |
-
$this->getIdxName(
|
513 |
-
'db1_anymarket/anymarketorders_store',
|
514 |
array('store_id')
|
515 |
-
)
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
|
|
|
|
521 |
'anymarketorders_id',
|
522 |
-
'db1_anymarket/anymarketorders',
|
523 |
-
'entity_id'
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
|
|
|
|
534 |
'store_id',
|
535 |
-
|
536 |
-
|
537 |
-
)
|
538 |
-
'
|
539 |
-
|
540 |
-
|
541 |
-
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
542 |
-
Varien_Db_Ddl_Table::ACTION_CASCADE
|
543 |
-
)
|
544 |
-
->setComment('Anymarket Orders To Store Linkage Table');
|
545 |
-
$this->getConnection()->createTable($table);
|
546 |
|
547 |
-
$
|
548 |
-
|
549 |
-
->
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
|
|
|
|
|
|
|
|
573 |
array('store_id')
|
574 |
-
)
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
|
|
|
|
580 |
'anymarketcategories_id',
|
581 |
-
'db1_anymarket/anymarketcategories',
|
582 |
-
'entity_id'
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
|
|
|
|
593 |
'store_id',
|
594 |
-
|
595 |
-
|
596 |
-
)
|
597 |
-
'
|
598 |
-
|
599 |
-
|
600 |
-
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
601 |
-
Varien_Db_Ddl_Table::ACTION_CASCADE
|
602 |
-
)
|
603 |
-
->setComment('Anymarket Categories To Store Linkage Table');
|
604 |
-
$this->getConnection()->createTable($table);
|
605 |
$this->endSetup();
|
1 |
<?php
|
2 |
$this->startSetup();
|
3 |
+
|
4 |
+
$tableName = $this->getTable('db1_anymarket/anymarketlog');
|
5 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
6 |
+
$table = $this->getConnection()
|
7 |
+
->newTable($tableName)
|
8 |
+
->addColumn(
|
9 |
+
'entity_id',
|
10 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
11 |
+
null,
|
12 |
+
array(
|
13 |
+
'identity' => true,
|
14 |
+
'nullable' => false,
|
15 |
+
'primary' => true,
|
16 |
+
),
|
17 |
+
'AnyMarket Log ID'
|
18 |
+
)
|
19 |
+
->addColumn(
|
20 |
+
'log_id',
|
21 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
22 |
+
array(
|
23 |
+
'nullable' => false,
|
24 |
+
),
|
25 |
+
'Identificação do produto ou pedido'
|
26 |
+
)
|
27 |
+
->addColumn(
|
28 |
+
'log_desc',
|
29 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 500,
|
30 |
+
array(
|
31 |
+
'nullable' => false,
|
32 |
+
),
|
33 |
+
'Descrição Log'
|
34 |
+
)
|
35 |
+
->addColumn(
|
36 |
+
'status',
|
37 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
38 |
+
array(),
|
39 |
+
'Enabled'
|
40 |
+
)
|
41 |
+
->addColumn(
|
42 |
+
'updated_at',
|
43 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
44 |
+
null,
|
45 |
+
array(),
|
46 |
+
'AnyMarket Log Modification Time'
|
47 |
+
)
|
48 |
+
->addColumn(
|
49 |
+
'created_at',
|
50 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
51 |
+
null,
|
52 |
+
array(),
|
53 |
+
'AnyMarket Log Creation Time'
|
54 |
+
)
|
55 |
+
->setComment('AnyMarket Log Table');
|
56 |
+
$this->getConnection()->createTable($table);
|
57 |
+
}
|
58 |
+
|
59 |
+
$tableName = $this->getTable('db1_anymarket/anymarketproducts');
|
60 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
61 |
+
$table = $this->getConnection()
|
62 |
+
->newTable($tableName)
|
63 |
+
->addColumn(
|
64 |
+
'entity_id',
|
65 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
66 |
+
null,
|
67 |
+
array(
|
68 |
+
'identity' => true,
|
69 |
+
'nullable' => false,
|
70 |
+
'primary' => true,
|
71 |
+
),
|
72 |
+
'Anymarket Products ID'
|
73 |
+
)
|
74 |
+
->addColumn(
|
75 |
+
'nmp_id',
|
76 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
77 |
+
array(
|
78 |
+
'nullable' => false,
|
79 |
+
),
|
80 |
+
'ID do produto'
|
81 |
+
)
|
82 |
+
->addColumn(
|
83 |
+
'nmp_sku',
|
84 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
85 |
+
array(
|
86 |
+
'nullable' => false,
|
87 |
+
),
|
88 |
+
'SKU do produto'
|
89 |
+
)
|
90 |
+
->addColumn(
|
91 |
+
'nmp_name',
|
92 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
93 |
+
array(
|
94 |
+
'nullable' => false,
|
95 |
+
),
|
96 |
+
'Nome do Produto'
|
97 |
+
)
|
98 |
+
->addColumn(
|
99 |
+
'nmp_desc_error',
|
100 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 500,
|
101 |
+
array(
|
102 |
+
'nullable' => false,
|
103 |
+
),
|
104 |
+
'Descrição do Erro'
|
105 |
+
)
|
106 |
+
->addColumn(
|
107 |
+
'nmp_status_int',
|
108 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
109 |
+
array(
|
110 |
+
'nullable' => false,
|
111 |
+
),
|
112 |
+
'Status Integração'
|
113 |
+
)
|
114 |
+
->addColumn(
|
115 |
+
'status',
|
116 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
117 |
+
array(),
|
118 |
+
'Enabled'
|
119 |
+
)
|
120 |
+
->addColumn(
|
121 |
+
'updated_at',
|
122 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
123 |
+
null,
|
124 |
+
array(),
|
125 |
+
'Anymarket Products Modification Time'
|
126 |
+
)
|
127 |
+
->addColumn(
|
128 |
+
'created_at',
|
129 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
130 |
+
null,
|
131 |
+
array(),
|
132 |
+
'Anymarket Products Creation Time'
|
133 |
+
)
|
134 |
+
->setComment('Anymarket Products Table');
|
135 |
+
$this->getConnection()->createTable($table);
|
136 |
+
}
|
137 |
+
|
138 |
+
$tableName = $this->getTable('db1_anymarket/anymarketattributes');
|
139 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
140 |
+
$table = $this->getConnection()
|
141 |
+
->newTable($tableName)
|
142 |
+
->addColumn(
|
143 |
+
'entity_id',
|
144 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
145 |
+
null,
|
146 |
+
array(
|
147 |
+
'identity' => true,
|
148 |
+
'nullable' => false,
|
149 |
+
'primary' => true,
|
150 |
+
),
|
151 |
+
'Anymarket Attributes ID'
|
152 |
+
)
|
153 |
+
->addColumn(
|
154 |
+
'nma_id_attr',
|
155 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
156 |
+
array(
|
157 |
+
'nullable' => false,
|
158 |
+
),
|
159 |
+
'Código do Atributo'
|
160 |
+
)
|
161 |
+
->addColumn(
|
162 |
+
'nma_desc',
|
163 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
164 |
+
array(
|
165 |
+
'nullable' => false,
|
166 |
+
),
|
167 |
+
'Descrição do Atributo'
|
168 |
+
)
|
169 |
+
->addColumn(
|
170 |
+
'status',
|
171 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
172 |
+
array(),
|
173 |
+
'Enabled'
|
174 |
+
)
|
175 |
+
->addColumn(
|
176 |
+
'updated_at',
|
177 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
178 |
+
null,
|
179 |
+
array(),
|
180 |
+
'Anymarket Attributes Modification Time'
|
181 |
+
)
|
182 |
+
->addColumn(
|
183 |
+
'created_at',
|
184 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
185 |
+
null,
|
186 |
+
array(),
|
187 |
+
'Anymarket Attributes Creation Time'
|
188 |
+
)
|
189 |
+
->setComment('Anymarket Attributes Table');
|
190 |
+
$this->getConnection()->createTable($table);
|
191 |
+
}
|
192 |
+
|
193 |
+
$tableName = $this->getTable('db1_anymarket/anymarketorders');
|
194 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
195 |
+
$table = $this->getConnection()
|
196 |
+
->newTable($tableName)
|
197 |
+
->addColumn(
|
198 |
+
'entity_id',
|
199 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
200 |
+
null,
|
201 |
+
array(
|
202 |
+
'identity' => true,
|
203 |
+
'nullable' => false,
|
204 |
+
'primary' => true,
|
205 |
+
),
|
206 |
+
'Anymarket Orders ID'
|
207 |
+
)
|
208 |
+
->addColumn(
|
209 |
+
'nmo_id_anymarket',
|
210 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
211 |
+
array(
|
212 |
+
'nullable' => false,
|
213 |
+
),
|
214 |
+
'Código no AnyMarket'
|
215 |
+
)
|
216 |
+
->addColumn(
|
217 |
+
'nmo_id_seq_anymarket',
|
218 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
219 |
+
array(
|
220 |
+
'nullable' => false,
|
221 |
+
),
|
222 |
+
'Código sequencial no AnyMarket'
|
223 |
+
)
|
224 |
+
->addColumn(
|
225 |
+
'nmo_id_order',
|
226 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
227 |
+
array(
|
228 |
+
'nullable' => false,
|
229 |
+
),
|
230 |
+
'Código Venda Magento'
|
231 |
+
)
|
232 |
+
->addColumn(
|
233 |
+
'nmo_status_int',
|
234 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
235 |
+
array(
|
236 |
+
'nullable' => false,
|
237 |
+
),
|
238 |
+
'Status Integração'
|
239 |
+
)
|
240 |
+
->addColumn(
|
241 |
+
'nmo_desc_error',
|
242 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
243 |
+
array(
|
244 |
+
'nullable' => false,
|
245 |
+
),
|
246 |
+
'Descrição do Erro'
|
247 |
+
)
|
248 |
+
->addColumn(
|
249 |
+
'updated_at',
|
250 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
251 |
+
null,
|
252 |
+
array(),
|
253 |
+
'Anymarket Orders Modification Time'
|
254 |
+
)
|
255 |
+
->addColumn(
|
256 |
+
'created_at',
|
257 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
258 |
+
null,
|
259 |
+
array(),
|
260 |
+
'Anymarket Orders Creation Time'
|
261 |
+
)
|
262 |
+
->setComment('Anymarket Orders Table');
|
263 |
+
$this->getConnection()->createTable($table);
|
264 |
+
}
|
265 |
+
|
266 |
+
$tableName = $this->getTable('db1_anymarket/anymarketcategories');
|
267 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
268 |
+
$table = $this->getConnection()
|
269 |
+
->newTable($tableName)
|
270 |
+
->addColumn(
|
271 |
+
'entity_id',
|
272 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
273 |
+
null,
|
274 |
+
array(
|
275 |
+
'identity' => true,
|
276 |
+
'nullable' => false,
|
277 |
+
'primary' => true,
|
278 |
+
),
|
279 |
+
'Anymarket Categories ID'
|
280 |
+
)
|
281 |
+
->addColumn(
|
282 |
+
'nmc_cat_id',
|
283 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
284 |
+
array(
|
285 |
+
'nullable' => false,
|
286 |
+
),
|
287 |
+
'Código completo da Categoria'
|
288 |
+
)
|
289 |
+
->addColumn(
|
290 |
+
'nmc_cat_root_id',
|
291 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
292 |
+
array(
|
293 |
+
'nullable' => false,
|
294 |
+
),
|
295 |
+
'Código da categoria antecessora'
|
296 |
+
)
|
297 |
+
->addColumn(
|
298 |
+
'nmc_cat_desc',
|
299 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
300 |
+
array(
|
301 |
+
'nullable' => false,
|
302 |
+
),
|
303 |
+
'Decrição da Categoria'
|
304 |
+
)
|
305 |
+
->addColumn(
|
306 |
+
'nmc_id_magento',
|
307 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
308 |
+
array(),
|
309 |
+
'ID Category in Magento'
|
310 |
+
)
|
311 |
+
->addColumn(
|
312 |
+
'status',
|
313 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
314 |
+
array(),
|
315 |
+
'Enabled'
|
316 |
+
)
|
317 |
+
->addColumn(
|
318 |
+
'updated_at',
|
319 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
320 |
+
null,
|
321 |
+
array(),
|
322 |
+
'Anymarket Categories Modification Time'
|
323 |
+
)
|
324 |
+
->addColumn(
|
325 |
+
'created_at',
|
326 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
327 |
+
null,
|
328 |
+
array(),
|
329 |
+
'Anymarket Categories Creation Time'
|
330 |
+
)
|
331 |
+
->setComment('Anymarket Categories Table');
|
332 |
+
$this->getConnection()->createTable($table);
|
333 |
+
}
|
334 |
+
|
335 |
+
$tableName = $this->getTable('db1_anymarket/anymarketlog_store');
|
336 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
337 |
+
$table = $this->getConnection()
|
338 |
+
->newTable($tableName)
|
339 |
+
->addColumn(
|
340 |
+
'anymarketlog_id',
|
341 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
342 |
+
null,
|
343 |
+
array(
|
344 |
+
'nullable' => false,
|
345 |
+
'primary' => true,
|
346 |
+
),
|
347 |
+
'AnyMarket Log ID'
|
348 |
+
)
|
349 |
+
->addColumn(
|
350 |
+
'store_id',
|
351 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
352 |
+
null,
|
353 |
+
array(
|
354 |
+
'unsigned' => true,
|
355 |
+
'nullable' => false,
|
356 |
+
'primary' => true,
|
357 |
+
),
|
358 |
+
'Store ID'
|
359 |
+
)
|
360 |
+
->addIndex(
|
361 |
+
$this->getIdxName(
|
362 |
+
'db1_anymarket/anymarketlog_store',
|
363 |
+
array('store_id')
|
364 |
+
),
|
365 |
array('store_id')
|
366 |
+
)
|
367 |
+
->addForeignKey(
|
368 |
+
$this->getFkName(
|
369 |
+
'db1_anymarket/anymarketlog_store',
|
370 |
+
'anymarketlog_id',
|
371 |
+
'db1_anymarket/anymarketlog',
|
372 |
+
'entity_id'
|
373 |
+
),
|
374 |
'anymarketlog_id',
|
375 |
+
$this->getTable('db1_anymarket/anymarketlog'),
|
376 |
+
'entity_id',
|
377 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
378 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
379 |
+
)
|
380 |
+
->addForeignKey(
|
381 |
+
$this->getFkName(
|
382 |
+
'db1_anymarket/anymarketlog_store',
|
383 |
+
'store_id',
|
384 |
+
'core/store',
|
385 |
+
'store_id'
|
386 |
+
),
|
387 |
+
'store_id',
|
388 |
+
$this->getTable('core/store'),
|
389 |
+
'store_id',
|
390 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
391 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
392 |
+
)
|
393 |
+
->setComment('AnyMarket Log To Store Linkage Table');
|
394 |
+
$this->getConnection()->createTable($table);
|
395 |
+
}
|
396 |
+
|
397 |
+
|
398 |
+
$tableName = $this->getTable('db1_anymarket/anymarketproducts_store');
|
399 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
400 |
+
$table = $this->getConnection()
|
401 |
+
->newTable($tableName)
|
402 |
+
->addColumn(
|
403 |
+
'anymarketproducts_id',
|
404 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
405 |
+
null,
|
406 |
+
array(
|
407 |
+
'nullable' => false,
|
408 |
+
'primary' => true,
|
409 |
+
),
|
410 |
+
'Anymarket Products ID'
|
411 |
+
)
|
412 |
+
->addColumn(
|
413 |
'store_id',
|
414 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
415 |
+
null,
|
416 |
+
array(
|
417 |
+
'unsigned' => true,
|
418 |
+
'nullable' => false,
|
419 |
+
'primary' => true,
|
420 |
+
),
|
421 |
+
'Store ID'
|
422 |
+
)
|
423 |
+
->addIndex(
|
424 |
+
$this->getIdxName(
|
425 |
+
'db1_anymarket/anymarketproducts_store',
|
426 |
+
array('store_id')
|
427 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
array('store_id')
|
429 |
+
)
|
430 |
+
->addForeignKey(
|
431 |
+
$this->getFkName(
|
432 |
+
'db1_anymarket/anymarketproducts_store',
|
433 |
+
'anymarketproducts_id',
|
434 |
+
'db1_anymarket/anymarketproducts',
|
435 |
+
'entity_id'
|
436 |
+
),
|
437 |
'anymarketproducts_id',
|
438 |
+
$this->getTable('db1_anymarket/anymarketproducts'),
|
439 |
+
'entity_id',
|
440 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
441 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
442 |
+
)
|
443 |
+
->addForeignKey(
|
444 |
+
$this->getFkName(
|
445 |
+
'db1_anymarket/anymarketproducts_store',
|
446 |
+
'store_id',
|
447 |
+
'core/store',
|
448 |
+
'store_id'
|
449 |
+
),
|
450 |
'store_id',
|
451 |
+
$this->getTable('core/store'),
|
452 |
+
'store_id',
|
453 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
454 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
455 |
+
)
|
456 |
+
->setComment('Anymarket Products To Store Linkage Table');
|
457 |
+
$this->getConnection()->createTable($table);
|
458 |
+
}
|
459 |
+
|
460 |
+
$tableName = $this->getTable('db1_anymarket/anymarketattributes_store');
|
461 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
462 |
+
$table = $this->getConnection()
|
463 |
+
->newTable($tableName)
|
464 |
+
->addColumn(
|
465 |
+
'anymarketattributes_id',
|
466 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
467 |
+
null,
|
468 |
+
array(
|
469 |
+
'nullable' => false,
|
470 |
+
'primary' => true,
|
471 |
+
),
|
472 |
+
'Anymarket Attributes ID'
|
473 |
+
)
|
474 |
+
->addColumn(
|
475 |
+
'store_id',
|
476 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
477 |
+
null,
|
478 |
+
array(
|
479 |
+
'unsigned' => true,
|
480 |
+
'nullable' => false,
|
481 |
+
'primary' => true,
|
482 |
+
),
|
483 |
+
'Store ID'
|
484 |
+
)
|
485 |
+
->addIndex(
|
486 |
+
$this->getIdxName(
|
487 |
+
'db1_anymarket/anymarketattributes_store',
|
488 |
+
array('store_id')
|
489 |
+
),
|
490 |
array('store_id')
|
491 |
+
)
|
492 |
+
->addForeignKey(
|
493 |
+
$this->getFkName(
|
494 |
+
'db1_anymarket/anymarketattributes_store',
|
495 |
+
'anymarketattributes_id',
|
496 |
+
'db1_anymarket/anymarketattributes',
|
497 |
+
'entity_id'
|
498 |
+
),
|
499 |
'anymarketattributes_id',
|
500 |
+
$this->getTable('db1_anymarket/anymarketattributes'),
|
501 |
+
'entity_id',
|
502 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
503 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
504 |
+
)
|
505 |
+
->addForeignKey(
|
506 |
+
$this->getFkName(
|
507 |
+
'db1_anymarket/anymarketattributes_store',
|
508 |
+
'store_id',
|
509 |
+
'core/store',
|
510 |
+
'store_id'
|
511 |
+
),
|
512 |
+
'store_id',
|
513 |
+
$this->getTable('core/store'),
|
514 |
+
'store_id',
|
515 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
516 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
517 |
+
)
|
518 |
+
->setComment('Anymarket Attributes To Store Linkage Table');
|
519 |
+
$this->getConnection()->createTable($table);
|
520 |
+
}
|
521 |
+
|
522 |
+
$tableName = $this->getTable('db1_anymarket/anymarketorders_store');
|
523 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
524 |
+
$table = $this->getConnection()
|
525 |
+
->newTable($tableName)
|
526 |
+
->addColumn(
|
527 |
+
'anymarketorders_id',
|
528 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
529 |
+
null,
|
530 |
+
array(
|
531 |
+
'nullable' => false,
|
532 |
+
'primary' => true,
|
533 |
+
),
|
534 |
+
'Anymarket Orders ID'
|
535 |
+
)
|
536 |
+
->addColumn(
|
537 |
'store_id',
|
538 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
539 |
+
null,
|
540 |
+
array(
|
541 |
+
'unsigned' => true,
|
542 |
+
'nullable' => false,
|
543 |
+
'primary' => true,
|
544 |
+
),
|
545 |
+
'Store ID'
|
546 |
+
)
|
547 |
+
->addIndex(
|
548 |
+
$this->getIdxName(
|
549 |
+
'db1_anymarket/anymarketorders_store',
|
550 |
+
array('store_id')
|
551 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
array('store_id')
|
553 |
+
)
|
554 |
+
->addForeignKey(
|
555 |
+
$this->getFkName(
|
556 |
+
'db1_anymarket/anymarketorders_store',
|
557 |
+
'anymarketorders_id',
|
558 |
+
'db1_anymarket/anymarketorders',
|
559 |
+
'entity_id'
|
560 |
+
),
|
561 |
'anymarketorders_id',
|
562 |
+
$this->getTable('db1_anymarket/anymarketorders'),
|
563 |
+
'entity_id',
|
564 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
565 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
566 |
+
)
|
567 |
+
->addForeignKey(
|
568 |
+
$this->getFkName(
|
569 |
+
'db1_anymarket/anymarketorders_store',
|
570 |
+
'store_id',
|
571 |
+
'core/store',
|
572 |
+
'store_id'
|
573 |
+
),
|
574 |
+
'store_id',
|
575 |
+
$this->getTable('core/store'),
|
576 |
'store_id',
|
577 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
578 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
579 |
+
)
|
580 |
+
->setComment('Anymarket Orders To Store Linkage Table');
|
581 |
+
$this->getConnection()->createTable($table);
|
582 |
+
}
|
|
|
|
|
|
|
|
|
|
|
583 |
|
584 |
+
$tableName = $this->getTable('db1_anymarket/anymarketcategories_store');
|
585 |
+
if( $this->getConnection()->isTableExists( $tableName ) != true ) {
|
586 |
+
$table = $this->getConnection()
|
587 |
+
->newTable($tableName)
|
588 |
+
->addColumn(
|
589 |
+
'anymarketcategories_id',
|
590 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
591 |
+
null,
|
592 |
+
array(
|
593 |
+
'nullable' => false,
|
594 |
+
'primary' => true,
|
595 |
+
),
|
596 |
+
'Anymarket Categories ID'
|
597 |
+
)
|
598 |
+
->addColumn(
|
599 |
+
'store_id',
|
600 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
601 |
+
null,
|
602 |
+
array(
|
603 |
+
'unsigned' => true,
|
604 |
+
'nullable' => false,
|
605 |
+
'primary' => true,
|
606 |
+
),
|
607 |
+
'Store ID'
|
608 |
+
)
|
609 |
+
->addIndex(
|
610 |
+
$this->getIdxName(
|
611 |
+
'db1_anymarket/anymarketcategories_store',
|
612 |
+
array('store_id')
|
613 |
+
),
|
614 |
array('store_id')
|
615 |
+
)
|
616 |
+
->addForeignKey(
|
617 |
+
$this->getFkName(
|
618 |
+
'db1_anymarket/anymarketcategories_store',
|
619 |
+
'anymarketcategories_id',
|
620 |
+
'db1_anymarket/anymarketcategories',
|
621 |
+
'entity_id'
|
622 |
+
),
|
623 |
'anymarketcategories_id',
|
624 |
+
$this->getTable('db1_anymarket/anymarketcategories'),
|
625 |
+
'entity_id',
|
626 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
627 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
628 |
+
)
|
629 |
+
->addForeignKey(
|
630 |
+
$this->getFkName(
|
631 |
+
'db1_anymarket/anymarketcategories_store',
|
632 |
+
'store_id',
|
633 |
+
'core/store',
|
634 |
+
'store_id'
|
635 |
+
),
|
636 |
+
'store_id',
|
637 |
+
$this->getTable('core/store'),
|
638 |
'store_id',
|
639 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
640 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
641 |
+
)
|
642 |
+
->setComment('Anymarket Categories To Store Linkage Table');
|
643 |
+
$this->getConnection()->createTable($table);
|
644 |
+
}
|
|
|
|
|
|
|
|
|
|
|
645 |
$this->endSetup();
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php
CHANGED
@@ -59,7 +59,7 @@ $config = array(
|
|
59 |
'input' => 'text',
|
60 |
'apply_to' => 'simple,bundle,grouped,configurable',
|
61 |
'user_defined' => 1,
|
62 |
-
'note' => '<a style="cursor:pointer" onclick="showDialogCategory();">Selecione uma categoria para
|
63 |
);
|
64 |
|
65 |
$setup->addAttribute('catalog_product', $codigo, $config);
|
59 |
'input' => 'text',
|
60 |
'apply_to' => 'simple,bundle,grouped,configurable',
|
61 |
'user_defined' => 1,
|
62 |
+
'note' => '<a style="cursor:pointer" onclick="showDialogCategory();">Selecione uma categoria para enviar ao Anymarket</a>'
|
63 |
);
|
64 |
|
65 |
$setup->addAttribute('catalog_product', $codigo, $config);
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php
CHANGED
@@ -3,6 +3,7 @@ $installer = $this;
|
|
3 |
$installer->startSetup();
|
4 |
|
5 |
$resource = Mage::getSingleton('core/resource');
|
|
|
6 |
|
7 |
function getMagentoVersion()
|
8 |
{
|
@@ -17,49 +18,49 @@ function _tableExists($table, $resource)
|
|
17 |
}
|
18 |
|
19 |
$sql = '';
|
20 |
-
$table = 'db1_anymarket_anymarketattributes01';
|
21 |
if (_tableExists($table, $resource)) {
|
22 |
-
$sql = "ALTER TABLE db1_anymarket_anymarketattributes01 RENAME db1_anymarket_anymarketattributes;";
|
23 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketattributes01_store RENAME db1_anymarket_anymarketattributes_store;";
|
24 |
$sql .= "SET foreign_key_checks = 0;";
|
25 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketattributes_store` CHANGE `anymarketattributes01_id` `anymarketattributes_id` int(11) NOT NULL;";
|
26 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketattributes_store` ADD CONSTRAINT `fk13_anymarketattributes_id` FOREIGN KEY ( `anymarketattributes_id` ) REFERENCES `db1_anymarket_anymarketattributes` ( `entity_id` );";
|
27 |
}
|
28 |
|
29 |
-
$table = 'db1_anymarket_anymarketcategories01';
|
30 |
if (_tableExists($table, $resource)) {
|
31 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketcategories01 RENAME db1_anymarket_anymarketcategories;";
|
32 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketcategories01_store RENAME db1_anymarket_anymarketcategories_store;";
|
33 |
$sql .= "SET foreign_key_checks = 0;";
|
34 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketcategories_store` CHANGE `anymarketcategories01_id` `anymarketcategories_id` int(11) NOT NULL;";
|
35 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketcategories_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
36 |
}
|
37 |
|
38 |
-
$table = 'db1_anymarket_anymarketlog01';
|
39 |
if (_tableExists($table, $resource)) {
|
40 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketlog01 RENAME db1_anymarket_anymarketlog;";
|
41 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketlog01_store RENAME db1_anymarket_anymarketlog_store;";
|
42 |
$sql .= "SET foreign_key_checks = 0;";
|
43 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketlog_store` CHANGE `anymarketlog01_id` `anymarketlog_id` int(11) NOT NULL;";
|
44 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketlog_store` ADD CONSTRAINT `fk13_anymarketlog_id` FOREIGN KEY ( `anymarketlog_id` ) REFERENCES `db1_anymarket_anymarketlog` ( `entity_id` );";
|
45 |
}
|
46 |
|
47 |
-
$table = 'db1_anymarket_anymarketorders01';
|
48 |
if (_tableExists($table, $resource)) {
|
49 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketorders01 RENAME db1_anymarket_anymarketorders;";
|
50 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketorders01_store RENAME db1_anymarket_anymarketorders_store;";
|
51 |
$sql .= "SET foreign_key_checks = 0;";
|
52 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketorders_store` CHANGE `anymarketorders01_id` `anymarketorders_id` int(11) NOT NULL;";
|
53 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketorders_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
54 |
}
|
55 |
|
56 |
-
$table = 'db1_anymarket_anymarketproducts01';
|
57 |
if (_tableExists($table, $resource)) {
|
58 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketproducts01 RENAME db1_anymarket_anymarketproducts;";
|
59 |
-
$sql .= "ALTER TABLE db1_anymarket_anymarketproducts01_store RENAME db1_anymarket_anymarketproducts_store;";
|
60 |
$sql .= "SET foreign_key_checks = 0;";
|
61 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketproducts_store` CHANGE `anymarketproducts01_id` `anymarketproducts_id` int(11) NOT NULL;";
|
62 |
-
$sql .= "ALTER TABLE `db1_anymarket_anymarketproducts_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
63 |
}
|
64 |
|
65 |
if ($sql != '') {
|
3 |
$installer->startSetup();
|
4 |
|
5 |
$resource = Mage::getSingleton('core/resource');
|
6 |
+
$tp = (string)Mage::getConfig()->getTablePrefix();
|
7 |
|
8 |
function getMagentoVersion()
|
9 |
{
|
18 |
}
|
19 |
|
20 |
$sql = '';
|
21 |
+
$table = $tp.'db1_anymarket_anymarketattributes01';
|
22 |
if (_tableExists($table, $resource)) {
|
23 |
+
$sql = "ALTER TABLE ".$tp."db1_anymarket_anymarketattributes01 RENAME db1_anymarket_anymarketattributes;";
|
24 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketattributes01_store RENAME db1_anymarket_anymarketattributes_store;";
|
25 |
$sql .= "SET foreign_key_checks = 0;";
|
26 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketattributes_store` CHANGE `anymarketattributes01_id` `anymarketattributes_id` int(11) NOT NULL;";
|
27 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketattributes_store` ADD CONSTRAINT `fk13_anymarketattributes_id` FOREIGN KEY ( `anymarketattributes_id` ) REFERENCES `db1_anymarket_anymarketattributes` ( `entity_id` );";
|
28 |
}
|
29 |
|
30 |
+
$table = $tp.'db1_anymarket_anymarketcategories01';
|
31 |
if (_tableExists($table, $resource)) {
|
32 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketcategories01 RENAME db1_anymarket_anymarketcategories;";
|
33 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketcategories01_store RENAME db1_anymarket_anymarketcategories_store;";
|
34 |
$sql .= "SET foreign_key_checks = 0;";
|
35 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketcategories_store` CHANGE `anymarketcategories01_id` `anymarketcategories_id` int(11) NOT NULL;";
|
36 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketcategories_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
37 |
}
|
38 |
|
39 |
+
$table = $tp.'db1_anymarket_anymarketlog01';
|
40 |
if (_tableExists($table, $resource)) {
|
41 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketlog01 RENAME db1_anymarket_anymarketlog;";
|
42 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketlog01_store RENAME db1_anymarket_anymarketlog_store;";
|
43 |
$sql .= "SET foreign_key_checks = 0;";
|
44 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketlog_store` CHANGE `anymarketlog01_id` `anymarketlog_id` int(11) NOT NULL;";
|
45 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketlog_store` ADD CONSTRAINT `fk13_anymarketlog_id` FOREIGN KEY ( `anymarketlog_id` ) REFERENCES `db1_anymarket_anymarketlog` ( `entity_id` );";
|
46 |
}
|
47 |
|
48 |
+
$table = $tp.'db1_anymarket_anymarketorders01';
|
49 |
if (_tableExists($table, $resource)) {
|
50 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketorders01 RENAME db1_anymarket_anymarketorders;";
|
51 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketorders01_store RENAME db1_anymarket_anymarketorders_store;";
|
52 |
$sql .= "SET foreign_key_checks = 0;";
|
53 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketorders_store` CHANGE `anymarketorders01_id` `anymarketorders_id` int(11) NOT NULL;";
|
54 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketorders_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
55 |
}
|
56 |
|
57 |
+
$table = $tp.'db1_anymarket_anymarketproducts01';
|
58 |
if (_tableExists($table, $resource)) {
|
59 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketproducts01 RENAME db1_anymarket_anymarketproducts;";
|
60 |
+
$sql .= "ALTER TABLE ".$tp."db1_anymarket_anymarketproducts01_store RENAME db1_anymarket_anymarketproducts_store;";
|
61 |
$sql .= "SET foreign_key_checks = 0;";
|
62 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketproducts_store` CHANGE `anymarketproducts01_id` `anymarketproducts_id` int(11) NOT NULL;";
|
63 |
+
$sql .= "ALTER TABLE `".$tp."db1_anymarket_anymarketproducts_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
|
64 |
}
|
65 |
|
66 |
if ($sql != '') {
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php
CHANGED
@@ -3,6 +3,7 @@ $installer = $this;
|
|
3 |
$connection = $installer->getConnection();
|
4 |
|
5 |
$installer->startSetup();
|
|
|
6 |
$installer->getConnection()
|
7 |
->addColumn($installer->getTable('db1_anymarket/anymarketlog'),'log_json', array(
|
8 |
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
3 |
$connection = $installer->getConnection();
|
4 |
|
5 |
$installer->startSetup();
|
6 |
+
|
7 |
$installer->getConnection()
|
8 |
->addColumn($installer->getTable('db1_anymarket/anymarketlog'),'log_json', array(
|
9 |
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php
CHANGED
@@ -9,5 +9,5 @@ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'backend_type'
|
|
9 |
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'backend_model','eav/entity_attribute_backend_array');
|
10 |
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'source_model','db1_anymarket/system_config_source_categories_values');
|
11 |
|
12 |
-
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'note','Selecione uma categoria para
|
13 |
$installer->endSetup();
|
9 |
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'backend_model','eav/entity_attribute_backend_array');
|
10 |
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'source_model','db1_anymarket/system_config_source_categories_values');
|
11 |
|
12 |
+
$installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'note','Selecione uma categoria para enviar ao Anymarket');
|
13 |
$installer->endSetup();
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php
CHANGED
@@ -2,8 +2,10 @@
|
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
|
5 |
-
$
|
6 |
-
|
|
|
|
|
7 |
|
8 |
$installer->run($sql);
|
9 |
$installer->endSetup();
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
|
5 |
+
$tp = (string)Mage::getConfig()->getTablePrefix();
|
6 |
+
|
7 |
+
$sql = "INSERT IGNORE INTO `".$tp."catalog_product_entity_varchar` (entity_type_id, attribute_id, store_id, entity_id, value) SELECT pei.entity_type_id, pei.attribute_id, pei.store_id, pei.entity_id, pei.value FROM `".$tp."catalog_product_entity_int` pei JOIN `".$tp."eav_attribute` ea ON pei.attribute_id = ea .attribute_id WHERE ea.attribute_code = 'categoria_anymarket';";
|
8 |
+
$sql .= "DELETE pei.* FROM `".$tp."catalog_product_entity_int` pei JOIN `".$tp."eav_attribute` ea ON pei.attribute_id = ea .attribute_id WHERE ea.attribute_code = 'categoria_anymarket';";
|
9 |
|
10 |
$installer->run($sql);
|
11 |
$installer->endSetup();
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php
CHANGED
@@ -3,7 +3,7 @@ $installer = $this;
|
|
3 |
$installer->startSetup();
|
4 |
|
5 |
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
6 |
-
$setup->updateAttribute('catalog_product', 'categoria_anymarket', 'note', 'Selecione uma categoria para
|
7 |
$setup->updateAttribute('catalog_product', 'categoria_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
|
8 |
$setup->updateAttribute('catalog_product', 'id_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
|
9 |
|
3 |
$installer->startSetup();
|
4 |
|
5 |
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
6 |
+
$setup->updateAttribute('catalog_product', 'categoria_anymarket', 'note', 'Selecione uma categoria para enviar ao Anymarket');
|
7 |
$setup->updateAttribute('catalog_product', 'categoria_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
|
8 |
$setup->updateAttribute('catalog_product', 'id_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
|
9 |
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php
CHANGED
@@ -1,12 +1,35 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
|
|
4 |
|
5 |
-
$sql
|
6 |
-
$
|
7 |
-
$
|
8 |
-
$sql .= "INSERT IGNORE INTO `
|
9 |
-
|
10 |
|
11 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$installer->endSetup();
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
$tp = (string)Mage::getConfig()->getTablePrefix();
|
5 |
|
6 |
+
$sql .= "";
|
7 |
+
$tableName = $tp."db1_anymarket_anymarketcategories_store";
|
8 |
+
if( $this->getConnection()->isTableExists($tableName) ) {
|
9 |
+
$sql .= "INSERT IGNORE INTO `" . $tp . "db1_anymarket_anymarketcategories_store` (`anymarketcategories_id`, `store_id`) SELECT entity_id, 0 FROM `" . $tp . "db1_anymarket_anymarketcategories`;";
|
10 |
+
}
|
11 |
|
12 |
+
$tableName = $tp."db1_anymarket_anymarketattributes_store";
|
13 |
+
if( $this->getConnection()->isTableExists($tableName) ) {
|
14 |
+
$sql .= "INSERT IGNORE INTO `".$tp."db1_anymarket_anymarketattributes_store` (`anymarketattributes_id`, `store_id`) SELECT entity_id, 0 FROM `".$tp."db1_anymarket_anymarketattributes`;";
|
15 |
+
}
|
16 |
+
|
17 |
+
$tableName = $tp."db1_anymarket_anymarketqueue_store";
|
18 |
+
if( $this->getConnection()->isTableExists($tableName) ) {
|
19 |
+
$sql .= "INSERT IGNORE INTO `".$tp."db1_anymarket_anymarketqueue_store` (`anymarketqueue_id`, `store_id`) SELECT entity_id, 0 FROM `".$tp."db1_anymarket_anymarketqueue`;";
|
20 |
+
}
|
21 |
+
|
22 |
+
$tableName = $tp."db1_anymarket_anymarketproducts_store";
|
23 |
+
if( $this->getConnection()->isTableExists($tableName) ) {
|
24 |
+
$sql .= "INSERT IGNORE INTO `".$tp."db1_anymarket_anymarketproducts_store` (`anymarketproducts_id`, `store_id`) SELECT entity_id, 0 FROM `".$tp."db1_anymarket_anymarketproducts`;";
|
25 |
+
}
|
26 |
+
|
27 |
+
$tableName = $tp."db1_anymarket_anymarketorders_store";
|
28 |
+
if( $this->getConnection()->isTableExists($tableName) ) {
|
29 |
+
$sql .= "INSERT IGNORE INTO `".$tp."db1_anymarket_anymarketorders_store` (`anymarketorders_id`, `store_id`) SELECT entity_id, 0 FROM `".$tp."db1_anymarket_anymarketorders`;";
|
30 |
+
}
|
31 |
+
|
32 |
+
if($sql != "") {
|
33 |
+
$installer->run($sql);
|
34 |
+
}
|
35 |
$installer->endSetup();
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.1.0-2.2.0.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.2.0-2.3.6.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.6-2.3.9.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
$this->startSetup();
|
|
|
3 |
|
4 |
-
$tableName = $this->getTable('db1_anymarket/anymarketbrands');
|
5 |
if( $this->getConnection()->isTableExists($tableName) != true ) {
|
6 |
$table = $this->getConnection()
|
7 |
->newTable($this->getTable('db1_anymarket/anymarketbrands'))
|
@@ -56,7 +57,7 @@ if( $this->getConnection()->isTableExists($tableName) != true ) {
|
|
56 |
$this->getConnection()->createTable($table);
|
57 |
}
|
58 |
|
59 |
-
$tableName = $this->getTable('db1_anymarket/anymarketbrands_store');
|
60 |
if( $this->getConnection()->isTableExists($tableName) != true ) {
|
61 |
$table = $this->getConnection()
|
62 |
->newTable($this->getTable('db1_anymarket/anymarketbrands_store'))
|
1 |
<?php
|
2 |
$this->startSetup();
|
3 |
+
$tp = (string)Mage::getConfig()->getTablePrefix();
|
4 |
|
5 |
+
$tableName = $tp.$this->getTable('db1_anymarket/anymarketbrands');
|
6 |
if( $this->getConnection()->isTableExists($tableName) != true ) {
|
7 |
$table = $this->getConnection()
|
8 |
->newTable($this->getTable('db1_anymarket/anymarketbrands'))
|
57 |
$this->getConnection()->createTable($table);
|
58 |
}
|
59 |
|
60 |
+
$tableName = $tp.$this->getTable('db1_anymarket/anymarketbrands_store');
|
61 |
if( $this->getConnection()->isTableExists($tableName) != true ) {
|
62 |
$table = $this->getConnection()
|
63 |
->newTable($this->getTable('db1_anymarket/anymarketbrands_store'))
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.9-2.4.0.php
CHANGED
@@ -31,7 +31,7 @@ INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_int')}`
|
|
31 |
FROM `{$installer->getTable('catalog_category_entity')}`;
|
32 |
");
|
33 |
|
34 |
-
$setup->run("DELETE FROM `core_config_data` WHERE `path` LIKE 'anymarket_section%'");
|
35 |
|
36 |
$installer->endSetup();
|
37 |
?>
|
31 |
FROM `{$installer->getTable('catalog_category_entity')}`;
|
32 |
");
|
33 |
|
34 |
+
$setup->run("DELETE FROM `".$tp."core_config_data` WHERE `path` LIKE 'anymarket_section%'");
|
35 |
|
36 |
$installer->endSetup();
|
37 |
?>
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.0-2.4.3.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.3-2.4.4.php
CHANGED
File without changes
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.4-2.9.1.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->endSetup();
|
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.1-2.9.2.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
|
7 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
8 |
+
|
9 |
+
// Add Integra Anymarket to prduct attribute set
|
10 |
+
$codigo = 'integra_images_root_anymarket';
|
11 |
+
$config = array(
|
12 |
+
'group' => 'AnyMarket',
|
13 |
+
'position' => 0,
|
14 |
+
'required' => 0,
|
15 |
+
'label' => 'Integrar fotos',
|
16 |
+
'type' => 'int',
|
17 |
+
'input' => 'boolean',
|
18 |
+
'visible' => true,
|
19 |
+
'used_in_product_listing' => true,
|
20 |
+
'apply_to' => 'bundle,grouped,configurable',
|
21 |
+
'note' => 'Integrar as fotos do produto pai.',
|
22 |
+
'user_defined' => 1,
|
23 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
|
24 |
+
);
|
25 |
+
|
26 |
+
$setup->addAttribute('catalog_product', $codigo, $config);
|
27 |
+
|
28 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/db1_anymarket.xml
CHANGED
File without changes
|
app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml
CHANGED
File without changes
|
app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/button_check_configuration.phtml
CHANGED
File without changes
|
app/etc/modules/DB1_AnyMarket.xml
CHANGED
File without changes
|
app/locale/en_US/DB1_AnyMarket.csv
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
"Error on get brands.","Error on get brands."
|
11 |
"Integration status","Integration status"
|
12 |
"Integration message","Integration message"
|
|
|
13 |
"An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
|
14 |
"Import products even when it has invalid resolution.","Import products even when it has invalid resolution."
|
15 |
"Ignore invalid resolution","Ignore invalid resolution"
|
@@ -17,6 +18,8 @@
|
|
17 |
"Select how you will be treated to their size AnyMarket.","Select how you will be treated to their size AnyMarket."
|
18 |
"Unit of measurement","Unit of measurement"
|
19 |
"Atribute set","Atribute set"
|
|
|
|
|
20 |
"Successfully exported ","Successfully exported "
|
21 |
" categories."," categories."
|
22 |
"Check Configuration","Check Configuration"
|
@@ -35,8 +38,8 @@
|
|
35 |
"AnyMarket Log was successfully saved","AnyMarket Log was successfully saved"
|
36 |
"AnyMarket Log","AnyMarket Log"
|
37 |
"Anymarket Brands","Anymarket Brands"
|
|
|
38 |
"Cron responsible for synchronizing orders if there are any errors.","Cron responsible for synchronizing orders if there are any errors."
|
39 |
-
"Disable only if you are sure, you can generate not synchronized orders.","Disable only if you are sure, you can generate not synchronized orders."
|
40 |
"Enable CRON of Order","Enable CRON of Order"
|
41 |
"Enable CRON of Product","Enable CRON of Product"
|
42 |
"Enable CRON of Reindex","Enable CRON of Reindex"
|
@@ -61,6 +64,8 @@
|
|
61 |
"There was some error getting data Invoice or Tracking.","There was some error getting data Invoice or Tracking."
|
62 |
"Anymarket Products was successfully saved","Anymarket Products was successfully saved"
|
63 |
"successfully saved","successfully saved"
|
|
|
|
|
64 |
"Error synchronizing order number: ","Error synchronizing order number: "
|
65 |
"Are you sure you want to export the categories?","Are you sure you want to export the categories?"
|
66 |
"A queue is already in process.","A process is already in process."
|
10 |
"Error on get brands.","Error on get brands."
|
11 |
"Integration status","Integration status"
|
12 |
"Integration message","Integration message"
|
13 |
+
"About","About"
|
14 |
"An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
|
15 |
"Import products even when it has invalid resolution.","Import products even when it has invalid resolution."
|
16 |
"Ignore invalid resolution","Ignore invalid resolution"
|
18 |
"Select how you will be treated to their size AnyMarket.","Select how you will be treated to their size AnyMarket."
|
19 |
"Unit of measurement","Unit of measurement"
|
20 |
"Atribute set","Atribute set"
|
21 |
+
"Associate duplicate products","Relate duplicate products"
|
22 |
+
"With this marked parameter, when a product with a sku in Anymarket, it will be automatically connected.","With this marked parameter, when a product with a sku in Anymarket, it will be automatically connected."
|
23 |
"Successfully exported ","Successfully exported "
|
24 |
" categories."," categories."
|
25 |
"Check Configuration","Check Configuration"
|
38 |
"AnyMarket Log was successfully saved","AnyMarket Log was successfully saved"
|
39 |
"AnyMarket Log","AnyMarket Log"
|
40 |
"Anymarket Brands","Anymarket Brands"
|
41 |
+
"Code in Magento","Code in Magento"
|
42 |
"Cron responsible for synchronizing orders if there are any errors.","Cron responsible for synchronizing orders if there are any errors."
|
|
|
43 |
"Enable CRON of Order","Enable CRON of Order"
|
44 |
"Enable CRON of Product","Enable CRON of Product"
|
45 |
"Enable CRON of Reindex","Enable CRON of Reindex"
|
64 |
"There was some error getting data Invoice or Tracking.","There was some error getting data Invoice or Tracking."
|
65 |
"Anymarket Products was successfully saved","Anymarket Products was successfully saved"
|
66 |
"successfully saved","successfully saved"
|
67 |
+
"By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO.","By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO."
|
68 |
+
"Create payment record when importing paid","Create payment record when importing paid"
|
69 |
"Error synchronizing order number: ","Error synchronizing order number: "
|
70 |
"Are you sure you want to export the categories?","Are you sure you want to export the categories?"
|
71 |
"A queue is already in process.","A process is already in process."
|
app/locale/pt_BR/DB1_AnyMarket.csv
CHANGED
@@ -8,6 +8,16 @@
|
|
8 |
"Brand Code","Codigo da Marca"
|
9 |
"Brand Description","Descrição da Marca"
|
10 |
"Integration status","Status Integração"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
"Error on get brands.","Error ao obter Marcas."
|
12 |
"Integration message","Mensagem de Integração"
|
13 |
"An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
|
@@ -19,7 +29,8 @@
|
|
19 |
"AnyMarket Log","AnyMarket Log"
|
20 |
"Check the configurations","Valide as Configurações"
|
21 |
"Check Configuration","Verificar Configurações"
|
22 |
-
|
|
|
23 |
"Contact the Anymarket for this information.","Entre em contato com o Anymarket para obter essa informação."
|
24 |
"URL for access to AnyMarket.","URL da API para acesso ao AnyMarket."
|
25 |
"Token necessary access to AnyMarket.","Token necessario acesso ao AnyMarket."
|
@@ -67,6 +78,8 @@
|
|
67 |
"There was some error getting data Invoice or Tracking.","Houve algum erro ao obter os dados de Tracking ou Invoice."
|
68 |
"Export Categories","Exportar Categorias"
|
69 |
"Gram","Grama"
|
|
|
|
|
70 |
"Clean Logs by User.","Logs limpo pelo Usuario."
|
71 |
"Are you sure you want to export the categories?","Tem certeza de que deseja exportar as categorias?"
|
72 |
"Already existing SKU in anymarket","SKU ja existente no Anymarket"
|
@@ -91,8 +104,8 @@
|
|
91 |
"Update Stock and Price","Estoque e Preço Atualizados"
|
92 |
"Mass unit","Unidade de Massa"
|
93 |
"Successfully exported ","Exportado com sucesso "
|
|
|
94 |
"Cron responsible for synchronizing orders if there are any errors.","Cron responsavel por sincronizar pedidos caso haja algum erro."
|
95 |
-
"Disable only if you are sure, you can generate not synchronized orders.","Desabilite somente se tiver certeza, pois pode gerar pedidos não sincronizados."
|
96 |
"Enable CRON of Order","Habilitar CRON de Pedidos"
|
97 |
"Enable CRON of Product","Habilitar CRON de Produtos"
|
98 |
"Enable CRON of Reindex","Habilitar CRON de Reindex"
|
@@ -237,6 +250,8 @@
|
|
237 |
"Sync Products","Sincronizar Produtos"
|
238 |
"Products list","Listar Produtos"
|
239 |
"Sync Orders","Sincronizar Pedidos"
|
|
|
|
|
240 |
"Orders list","Listar Pedidos"
|
241 |
"There was an error updating the products.","Ocorreu um erro ao atualizar os produtos."
|
242 |
"Total %d products successfully listed.","Total de %d produtos listados com sucesso."
|
8 |
"Brand Code","Codigo da Marca"
|
9 |
"Brand Description","Descrição da Marca"
|
10 |
"Integration status","Status Integração"
|
11 |
+
"Send image as HTTP","Enviar imagem como HTTP"
|
12 |
+
"Enable Image Processing", "Habilitar Processamento de imagens"
|
13 |
+
"Width of the image.", "Largura da Imagem."
|
14 |
+
"Image Height.", "Altura da imagem."
|
15 |
+
"Width that the image will be resized.", "Largura que a imagem sera redimensionada."
|
16 |
+
"Height that the image will be resized.", "Altura que a imagem sera redimensionada."
|
17 |
+
"Enabling this parameter images are processed before being sent to Anymarket.", "Habilitando esse parametro as imagens serão processadas antes de serem enviadas ao Anymarket."
|
18 |
+
"Product images are reduced to the Anymarket accepted.", "As imagens dos produtos serão reduzidas para que o Anymarket aceite."
|
19 |
+
"This feature will not work if your magento not allow access images as HTTP.","Esse recurso não ira funcionar se seu magento não permitir acessar as imagens como HTTP."
|
20 |
+
"If set to yes, will transform HTTPS to HTTP images for sending.","Se marcado como sim, ira transformar as imagens HTTPS para HTTP para o envio."
|
21 |
"Error on get brands.","Error ao obter Marcas."
|
22 |
"Integration message","Mensagem de Integração"
|
23 |
"An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
|
29 |
"AnyMarket Log","AnyMarket Log"
|
30 |
"Check the configurations","Valide as Configurações"
|
31 |
"Check Configuration","Verificar Configurações"
|
32 |
+
"About","Sobre"
|
33 |
+
"SKU to bond not found :","SKU para vinculo não encontrado: "
|
34 |
"Contact the Anymarket for this information.","Entre em contato com o Anymarket para obter essa informação."
|
35 |
"URL for access to AnyMarket.","URL da API para acesso ao AnyMarket."
|
36 |
"Token necessary access to AnyMarket.","Token necessario acesso ao AnyMarket."
|
78 |
"There was some error getting data Invoice or Tracking.","Houve algum erro ao obter os dados de Tracking ou Invoice."
|
79 |
"Export Categories","Exportar Categorias"
|
80 |
"Gram","Grama"
|
81 |
+
"By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO.","Ao marcar como sim, no momento que for importado um pedido do status pago no Anymarket, sera criado um registro em Fatura, lembre-se de vincular um status que permite faturamento com o PAGO."
|
82 |
+
"Create payment record when importing paid","Criar registro de pagamento ao importar pago"
|
83 |
"Clean Logs by User.","Logs limpo pelo Usuario."
|
84 |
"Are you sure you want to export the categories?","Tem certeza de que deseja exportar as categorias?"
|
85 |
"Already existing SKU in anymarket","SKU ja existente no Anymarket"
|
104 |
"Update Stock and Price","Estoque e Preço Atualizados"
|
105 |
"Mass unit","Unidade de Massa"
|
106 |
"Successfully exported ","Exportado com sucesso "
|
107 |
+
"Code in Magento","Codigo no Magento"
|
108 |
"Cron responsible for synchronizing orders if there are any errors.","Cron responsavel por sincronizar pedidos caso haja algum erro."
|
|
|
109 |
"Enable CRON of Order","Habilitar CRON de Pedidos"
|
110 |
"Enable CRON of Product","Habilitar CRON de Produtos"
|
111 |
"Enable CRON of Reindex","Habilitar CRON de Reindex"
|
250 |
"Sync Products","Sincronizar Produtos"
|
251 |
"Products list","Listar Produtos"
|
252 |
"Sync Orders","Sincronizar Pedidos"
|
253 |
+
"Associate duplicate products","Relacionar produtos duplicados"
|
254 |
+
"With this marked parameter, when a product with a sku in Anymarket, it will be automatically connected.","Com esse parametro marcado, quando houver um produto com um sku no Anymarket, ele sera relacionado automaticamente."
|
255 |
"Orders list","Listar Pedidos"
|
256 |
"There was an error updating the products.","Ocorreu um erro ao atualizar os produtos."
|
257 |
"Total %d products successfully listed.","Total de %d produtos listados com sucesso."
|
package.xml
CHANGED
@@ -1,19 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
-
<name>
|
4 |
-
<version>2.
|
5 |
-
<stability>
|
6 |
-
<license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integrador entre Magento e Anymarket.</summary>
|
10 |
<description>Mantem um fluxo continuo de integração de Produtos e Pedidos entre Magento e Anymarket.</description>
|
11 |
-
<notes>*
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<contents><target name="magecommunity"><dir name="DB1"><dir name="AnyMarket"><dir name="Block"><dir name="Adminhtml"><dir name="Anymarketattributes"><dir name="Edit"><file name="Form.php" hash="2f7fc99eb1e822aec20e00ac2f09e9b6"/><dir name="Tab"><file name="Form.php" hash="b993f886f391902526c13ed921e67f64"/><file name="Stores.php" hash="e2f9a83dcc1c5643584607a9788ce991"/></dir><file name="Tabs.php" hash="c7ea19d365aa6dd186bb5586748c8a36"/></dir><file name="Edit.php" hash="adf55bcb491bb6c4d839ba54228f38bb"/><file name="Grid.php" hash="318ced337407c824b4ed93a6f30b7fb3"/></dir><file name="Anymarketattributes.php" hash="3dec5da837e1bcb3813a55a21cf70452"/><dir name="Anymarketbrands"><dir name="Edit"><file name="Form.php" hash="70295f473585677c25ccb69c729ad264"/><dir name="Tab"><file name="Form.php" hash="5baa22a93472a4552619554aa2f5b74d"/><file name="Stores.php" hash="989e32b60c014c3feb15b394ac75e495"/></dir><file name="Tabs.php" hash="3f38d3849c9c5191f05b6de6e48e1244"/></dir><file name="Edit.php" hash="bb5ee750685a202d059adf7c62207f8d"/><file name="Grid.php" hash="cbc4ea24f205fc5892d5c462a6702550"/></dir><file name="Anymarketbrands.php" hash="efa9ef9b3666136f2a2158bd69860d60"/><dir name="Anymarketcategories"><dir name="Edit"><file name="Form.php" hash="738927ef6cc0cb36d9a318a3fc0494a4"/><dir name="Tab"><file name="Form.php" hash="2646c16051d76fc6a149a8426e3b81c9"/><file name="Stores.php" hash="2065ee5d47b8c7e7632b6311e4dc65eb"/></dir><file name="Tabs.php" hash="4097937c822b540a533390a60a33a0ad"/></dir><file name="Edit.php" hash="ad21c818418accadb19c9e73c964f503"/><file name="Grid.php" hash="ecbf7477825c1be974172dc3504ee3f3"/></dir><file name="Anymarketcategories.php" hash="5284ecd428e4865653d87769bdaabe08"/><dir name="Anymarketlog"><dir name="Edit"><file name="Form.php" hash="475dcc08db1d6e73d0d3fa56916d1c7b"/><dir name="Tab"><file name="Form.php" hash="20949829f756ecbe695308a9ba3dc246"/><file name="Stores.php" hash="6c33618d5556292dd07b037a3ef0b9a4"/></dir><file name="Tabs.php" hash="778a968aa9ed006577ca1b06821ee8d7"/></dir><file name="Edit.php" hash="14bc221c3b69fd79d6c09eaaba2792bb"/><file name="Grid.php" hash="bde6093b89b3db92a25abf3124cd1714"/></dir><file name="Anymarketlog.php" hash="7da774661bfe410cb6df3a1d4bd33f5a"/><dir name="Anymarketorders"><dir name="Edit"><file name="Form.php" hash="40cdd96c786c522f15c0c0df583cd861"/><dir name="Tab"><file name="Form.php" hash="b98ab50051a0a32dc26f342ad34bd81b"/><file name="Stores.php" hash="eae8bbfa5ce5d2d1c3aa76cf09895b62"/></dir><file name="Tabs.php" hash="fd93f19227b2e46c74cadbcf642b936e"/></dir><file name="Edit.php" hash="b887ae08790c7babbc3b386208e57901"/><file name="Grid.php" hash="08194a3c7e6fee59b1e2acf22f2844ca"/></dir><file name="Anymarketorders.php" hash="59e93a88b8c82e1a8cfb2bd246cff259"/><dir name="Anymarketproducts"><dir name="Edit"><file name="Form.php" hash="980603f48914a1287c2e7c15e4c86d83"/><dir name="Tab"><file name="Form.php" hash="245eab4f574907f0db6bffcd651b6b8c"/><file name="Stores.php" hash="2cec2058ef922bc7cc89511d06d1cf72"/></dir><file name="Tabs.php" hash="1ff12beae435c878edb912960ae17a47"/></dir><file name="Edit.php" hash="efee68f9e82522aeb3908a29cb65d388"/><file name="Grid.php" hash="28abacf7c5294e6d991f363bb4c11afc"/></dir><file name="Anymarketproducts.php" hash="3bac9100d555bd07ab9d0b368994bea2"/><dir name="Anymarketqueue"><dir name="Edit"><file name="Form.php" hash="fd9c0ce4afcf1c12657b180666224e97"/><dir name="Tab"><file name="Form.php" hash="aa603b428632caaf0a51c4d9021f3f08"/><file name="Stores.php" hash="08bdd73cf10ea1fe2bc4a963f0737cc6"/></dir><file name="Tabs.php" hash="381579dc284c6f27acea660886fdbc5f"/></dir><file name="Edit.php" hash="7decfc10b577b4d99c342d23b4a75c01"/><file name="Grid.php" hash="b22574ae4c546d78926c5b671145ef27"/></dir><file name="Anymarketqueue.php" hash="ae3c146ea8a2b0999a762917d8645dff"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Buttoncheckconfig.php" hash="344078aec3e91f5f8915272935d0a391"/><file name="Callback.php" hash="0e721a318ec6d95e7671f2bdfd0e7c11"/><file name="buttoncheckconfig.php" hash="344078aec3e91f5f8915272935d0a391"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Orders"><dir name="Statusammg"><file name="Values.php" hash="931376d93d7ad770aae1755aa05d880f"/></dir><dir name="Statusmgam"><file name="Values.php" hash="3e39fcc15a9400f09b525ff130aaf775"/></dir></dir><dir name="Products"><file name="Values.php" hash="87e7e2ecaa08fc0c21d7ee93799a6f91"/></dir></dir></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AnyMarket.php" hash="6d1473008f995a33e619b4d00465ccc0"/></dir></dir><dir name="Helper"><file name="Brand.php" hash="48c1fe421cd14cfe2fa29768d2e06916"/><file name="Category.php" hash="2302bd93d84457d40d426b91d567da50"/><file name="Customergenerator.php" hash="2e9ea1ede85d01637c21d8f59894709d"/><file name="Data.php" hash="f97ec67421192a6bb5b67c0e85e3ed3c"/><file name="Order.php" hash="1dc6f30ed2ed1715beebc5deaccd77d8"/><file name="Ordergenerator.php" hash="8cf01dff14525dea41fb6aaefe22206f"/><file name="Product.php" hash="fc52bff47667553ec8dd8dc07698f81f"/><file name="Productgenerator.php" hash="d96649853ee705451375f6203b5d5a96"/><file name="Queue.php" hash="aa4083effc3b755f473ebb3c75793bcc"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Anymarketattributes.php" hash="9c70e239108635285a267800c92a5497"/><file name="Anymarketbrands.php" hash="e6ab4761f6162f7eaa0ed9c54ffa0f67"/><file name="Anymarketlog.php" hash="587fd8a1b7579d03a221531e04b16e72"/><file name="Anymarketorders.php" hash="e80623045edfecd2b31469d0ddaae65e"/><file name="Anymarketproducts.php" hash="98721db042c261f99ed4dac40af60b5d"/><file name="Anymarketqueue.php" hash="fe750b1048ed725c715084002eea3bd7"/></dir></dir><dir name="Anymarketattributes"><dir name="Api"><file name="V2.php" hash="2968c2cbc85867bf9689b3925d8661aa"/></dir><file name="Api.php" hash="c08643eee1e8a850a77e1da60b1934f5"/></dir><file name="Anymarketattributes.php" hash="8153076dd11965f0caf91a618afa0ac9"/><dir name="Anymarketbrands"><dir name="Api"><file name="V2.php" hash="d3e2e0763c146aa4c4260455decfa811"/></dir><file name="Api.php" hash="a197ecaab03dbbb136de2cd6eee4b6a6"/></dir><file name="Anymarketbrands.php" hash="52f607ceb5684d944c31d0920bbd161d"/><dir name="Anymarketcategories"><dir name="Api"><file name="V2.php" hash="9be73fc1875d16263554fb9d6220cfce"/></dir><file name="Api.php" hash="54b1068a7c5939e16382311691279664"/></dir><file name="Anymarketcategories.php" hash="200d5ec4a7fc29fa01d559c3b586cc7e"/><dir name="Anymarketlog"><dir name="Api"><file name="V2.php" hash="f252eafdd842b105c8952567a5b0ece7"/></dir><file name="Api.php" hash="3424e96e46745bcc76fb3aca2073490e"/></dir><file name="Anymarketlog.php" hash="fd353955d73d83167ea3ce735f83a7e7"/><dir name="Anymarketorders"><dir name="Api"><file name="V2.php" hash="0b11c1be24355033a571d2e56f508d19"/></dir><file name="Api.php" hash="789106be86e48dd7de760f2debc83e26"/></dir><file name="Anymarketorders.php" hash="8697f792291a0603887be8acf734d4d4"/><dir name="Anymarketproducts"><dir name="Api"><file name="V2.php" hash="d1b289e2fdd26b80c4d921bec5dfa339"/></dir><file name="Api.php" hash="7f8a8f3668a181ce93e0b50ad0f60aae"/></dir><file name="Anymarketproducts.php" hash="b4071fbf8190b01f5bb21f35dd77d1fc"/><dir name="Anymarketqueue"><dir name="Api"><file name="V2.php" hash="e9c8a4c3612249d39d984c29d1ef548a"/></dir><file name="Api.php" hash="eb142eb9f3f92cb950596d47044f3050"/></dir><file name="Anymarketqueue.php" hash="7c9373fa2dba0cab020370f2a4d58e84"/><file name="Cron.php" hash="4c85b7ef3772cfc014cf0ef497b4c96b"/><file name="Observer.php" hash="38b1f2a96dc5903db9c642ee8b0e41d0"/><file name="PaymentMethod.php" hash="7c10a39a005e03d0d0530041bee95a9e"/><dir name="Resource"><dir name="Anymarketattributes"><file name="Collection.php" hash="36566dd648113fbd096ae4c9f2574058"/></dir><file name="Anymarketattributes.php" hash="07099d8acd0244dd22ef3aa591c4d4be"/><dir name="Anymarketbrands"><file name="Collection.php" hash="f542cb47a58e77017a90d4b9733e354b"/></dir><file name="Anymarketbrands.php" hash="aad2b54e04e58df24f9f518e67237d27"/><dir name="Anymarketcategories"><file name="Collection.php" hash="f58ef5b5397c8fdfd68dd860d2998dd6"/></dir><file name="Anymarketcategories.php" hash="80c0ea6b443d2beadc3e0d8fb3329e49"/><dir name="Anymarketlog"><file name="Collection.php" hash="e1b37efe779188ded01622a383c39f7e"/></dir><file name="Anymarketlog.php" hash="69ce526695527d4469f7cae4604d24f9"/><dir name="Anymarketorders"><file name="Collection.php" hash="45ec7c3ccf2de78cf5d0c95e1ea1f3f4"/></dir><file name="Anymarketorders.php" hash="1879ab46e3f47772db8b23710cc3c2ac"/><dir name="Anymarketproducts"><file name="Collection.php" hash="fc88402b7281c58a79b8fb4b8ab5645e"/></dir><file name="Anymarketproducts.php" hash="51ab548790054880bccce85b12e111ea"/><dir name="Anymarketqueue"><file name="Collection.php" hash="c7ce0a9ce11f376cc05d3afefe6ad8ba"/></dir><file name="Anymarketqueue.php" hash="be077e58f0eb8d8e5bbf660c70ff0c8a"/><file name="Setup.php" hash="0df420432c06cee997f9a43e9ca42fd2"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Attributes"><dir name="Customer"><dir name="Group"><file name="Values.php" hash="b3da25e6f5bbd22f88951a40f21c0062"/></dir><dir name="Street"><file name="Values.php" hash="c219bd519b968f614c92aa564272d1b3"/></dir><file name="Values.php" hash="74b98a8dbf05e3089bd9885d610b9203"/></dir><dir name="Product"><dir name="Booleantp"><file name="Values.php" hash="9b80052d0ed97cbbf4ba9f72c0a3e0a9"/></dir><dir name="Price"><file name="Values.php" hash="a9f6f4a2bef252b0731c7d82ebf36ddb"/></dir><file name="Values.php" hash="1000fd8c2cb40456c7ee3671bd06b1b9"/></dir><dir name="Set"><file name="Values.php" hash="c0c0ba6a8f7fcd48896ab4916ca8d515"/></dir></dir><dir name="Categories"><file name="Values.php" hash="f59129783eb797e1c088ef5ac332dc92"/></dir><dir name="Logs"><file name="Values.php" hash="714f462254b42d1ba36546dbd55e06f9"/></dir><dir name="Massunit"><file name="Values.php" hash="475bc7d4556c5f42728b774d7b6749f2"/></dir><dir name="Measurementunit"><file name="Values.php" hash="0831cd50cddff66d9c97339d1a4d61ad"/></dir><dir name="Orders"><file name="Values.php" hash="6df0f33ada91098ba026bd006bd7b9d0"/></dir><dir name="Typesync"><dir name="Order"><file name="Values.php" hash="f2fe8cde6e3ae10cac6a26500fc0984b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Anymarket"><file name="AnymarketattributesController.php" hash="29db5f472baef6f064861a90577b3d39"/><file name="AnymarketbrandsController.php" hash="8e527c5c0e140e78815c9fb385023112"/><file name="AnymarketcategoriesController.php" hash="74468898d76dece1d5e14dcb9f815fc0"/><file name="AnymarketlogController.php" hash="8dbbbc42b687ad8056e98e61bff72a91"/><file name="AnymarketordersController.php" hash="d385cf6aabb0d46d1b77cedb2f408fe7"/><file name="AnymarketproductsController.php" hash="aed3045308d53abe8d22bc024d3fe9e1"/><file name="AnymarketqueueController.php" hash="8fc629165bfeb675d5c7230faca69e63"/></dir><file name="AnymarketController.php" hash="c84286b666ed0bcd988346b2fc46467d"/></dir><file name="IndexController.php" hash="04f940ebc3e82196001e415d99d32efd"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59c70a74d5d791a85a6783dc6c2d954a"/><file name="api.xml" hash="3546bfaef38893f387c70879f8f62bd5"/><file name="config.xml" hash="8c614cfacfad87b477c8e6a8abe4e32e"/><file name="system.xml" hash="3cf184cd2babd7efcac1e7d89fd35dba"/><file name="wsdl.xml" hash="92472d43f8c69fea0b2ca67c102225c6"/><file name="wsi.xml" hash="e7e1d615fdad47f1454edcb4cea6b6df"/></dir><dir name="sql"><dir name="db1_anymarket_setup"><file name="mysql4-install-1.0.0.php" hash="e321615a6c00d6bf0d7624c0b05b6639"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="aaccf01a4ba1a5452b1a4bc0565e5733"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="e7af419b7793c1047e5d943f5b790ffb"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="f034e3e6f71a01ee3b80924bfe495cb4"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="e9eccf082d6ecb09f75df2b5a7afec9c"/><file name="mysql4-upgrade-1.4.0-1.5.0.php" hash="4a21c4dff0151d55d62c5023f7b29930"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="1662d2e0322db100b762bd012eca5131"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="b633fcb878851c947c1d0b9c116cd8fe"/><file name="mysql4-upgrade-1.7.0-1.8.0.php" hash="45335413517a3a74320c3de9aaec1eaf"/><file name="mysql4-upgrade-1.8.0-2.0.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="7f8dcb7bc69d58061709f66bbecceea6"/><file name="mysql4-upgrade-2.1.0-2.2.0.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.2.0-2.3.6.php" hash="e5e770b4ab8ba48e177efbc1d613fb3c"/><file name="mysql4-upgrade-2.3.6-2.3.9.php" hash="058f6ad275eedb0fedde895f9e0a3933"/><file name="mysql4-upgrade-2.3.9-2.4.0.php" hash="b41bf0ee29b85b1dcb5437767bd32a77"/><file name="mysql4-upgrade-2.4.0-2.4.3.php" hash="3b0e01bd5ba4afef89cfbe40305f9087"/><file name="mysql4-upgrade-2.4.3-2.4.4.php" hash="8540010143d20286287e9b3abfee11f9"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="DB1_AnyMarket.xml" hash="98dd8e192a0a2ad509ce5a50c6c40f98"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="DB1_AnyMarket.csv" hash="93c1b0a4b8fc337958c4e4499d769bf2"/></dir><dir name="pt_BR"><file name="DB1_AnyMarket.csv" hash="2f1fe5366aee8825e5c8dc81dfb5b577"/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="db1_anymarket.xml" hash="47bb7ca814c58a2985f198c3703f1d58"/></dir><dir name="template"><dir name="db1"><dir name="anymarket"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="6a0ec3bf507fe6211ca0ad4825325c57"/><file name="button_check_configuration.phtml" hash="252673865f738851cacc1337948b8f86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
17 |
<compatible/>
|
18 |
-
<dependencies><required><php><min>5.4.0</min><max>5.
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
+
<name>d7db67d0d012350a01ce05c31f91754d</name>
|
4 |
+
<version>2.10.1</version>
|
5 |
+
<stability>Stable</stability>
|
6 |
+
<license>Mozilla Public License</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integrador entre Magento e Anymarket.</summary>
|
10 |
<description>Mantem um fluxo continuo de integração de Produtos e Pedidos entre Magento e Anymarket.</description>
|
11 |
+
<notes>* Adicionado compatibilidade com prefixo em tabelas.
|
12 |
+

|
13 |
+

|
14 |
+
Para mais informações acesse: 
|
15 |
+
https://github.com/AnyMarket/magento</notes>
|
16 |
+
<authors><author><name>Anymarket</name><user>anymarket</user><email>dev@anymarket.com.br</email></author></authors>
|
17 |
+
<date>2016-11-08</date>
|
18 |
+
<time>14:04:16</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="DB1"><dir name="AnyMarket"><dir name="Block"><dir name="Adminhtml"><dir name="Anymarketattributes"><dir name="Edit"><file name="Form.php" hash="2f7fc99eb1e822aec20e00ac2f09e9b6"/><dir name="Tab"><file name="Form.php" hash="b993f886f391902526c13ed921e67f64"/><file name="Stores.php" hash="e2f9a83dcc1c5643584607a9788ce991"/></dir><file name="Tabs.php" hash="c7ea19d365aa6dd186bb5586748c8a36"/></dir><file name="Edit.php" hash="adf55bcb491bb6c4d839ba54228f38bb"/><file name="Grid.php" hash="318ced337407c824b4ed93a6f30b7fb3"/></dir><file name="Anymarketattributes.php" hash="3dec5da837e1bcb3813a55a21cf70452"/><dir name="Anymarketbrands"><dir name="Edit"><file name="Form.php" hash="70295f473585677c25ccb69c729ad264"/><dir name="Tab"><file name="Form.php" hash="5baa22a93472a4552619554aa2f5b74d"/><file name="Stores.php" hash="989e32b60c014c3feb15b394ac75e495"/></dir><file name="Tabs.php" hash="3f38d3849c9c5191f05b6de6e48e1244"/></dir><file name="Edit.php" hash="bb5ee750685a202d059adf7c62207f8d"/><file name="Grid.php" hash="cbc4ea24f205fc5892d5c462a6702550"/></dir><file name="Anymarketbrands.php" hash="efa9ef9b3666136f2a2158bd69860d60"/><dir name="Anymarketcategories"><dir name="Edit"><file name="Form.php" hash="738927ef6cc0cb36d9a318a3fc0494a4"/><dir name="Tab"><file name="Form.php" hash="6b724bea8807e42a5e58607643d10623"/><file name="Stores.php" hash="2065ee5d47b8c7e7632b6311e4dc65eb"/></dir><file name="Tabs.php" hash="4097937c822b540a533390a60a33a0ad"/></dir><file name="Edit.php" hash="ad21c818418accadb19c9e73c964f503"/><file name="Grid.php" hash="b280d8f866c21c1a66373005d7a904d5"/></dir><file name="Anymarketcategories.php" hash="66b271b3c3cdc31153d4a9e4d258bf20"/><dir name="Anymarketlog"><dir name="Edit"><file name="Form.php" hash="475dcc08db1d6e73d0d3fa56916d1c7b"/><dir name="Tab"><file name="Form.php" hash="20949829f756ecbe695308a9ba3dc246"/><file name="Stores.php" hash="6c33618d5556292dd07b037a3ef0b9a4"/></dir><file name="Tabs.php" hash="778a968aa9ed006577ca1b06821ee8d7"/></dir><file name="Edit.php" hash="14bc221c3b69fd79d6c09eaaba2792bb"/><file name="Grid.php" hash="bde6093b89b3db92a25abf3124cd1714"/></dir><file name="Anymarketlog.php" hash="7da774661bfe410cb6df3a1d4bd33f5a"/><dir name="Anymarketorders"><dir name="Edit"><file name="Form.php" hash="40cdd96c786c522f15c0c0df583cd861"/><dir name="Tab"><file name="Form.php" hash="7e6185c620c6ce784055c436609a29c2"/><file name="Stores.php" hash="eae8bbfa5ce5d2d1c3aa76cf09895b62"/></dir><file name="Tabs.php" hash="fd93f19227b2e46c74cadbcf642b936e"/></dir><file name="Edit.php" hash="b887ae08790c7babbc3b386208e57901"/><file name="Grid.php" hash="940a0ca57208c8fe37660a3c567f2f59"/></dir><file name="Anymarketorders.php" hash="59e93a88b8c82e1a8cfb2bd246cff259"/><dir name="Anymarketproducts"><dir name="Edit"><file name="Form.php" hash="980603f48914a1287c2e7c15e4c86d83"/><dir name="Tab"><file name="Form.php" hash="245eab4f574907f0db6bffcd651b6b8c"/><file name="Stores.php" hash="2cec2058ef922bc7cc89511d06d1cf72"/></dir><file name="Tabs.php" hash="1ff12beae435c878edb912960ae17a47"/></dir><file name="Edit.php" hash="efee68f9e82522aeb3908a29cb65d388"/><file name="Grid.php" hash="28abacf7c5294e6d991f363bb4c11afc"/></dir><file name="Anymarketproducts.php" hash="3bac9100d555bd07ab9d0b368994bea2"/><dir name="Anymarketqueue"><dir name="Edit"><file name="Form.php" hash="fd9c0ce4afcf1c12657b180666224e97"/><dir name="Tab"><file name="Form.php" hash="aa603b428632caaf0a51c4d9021f3f08"/><file name="Stores.php" hash="08bdd73cf10ea1fe2bc4a963f0737cc6"/></dir><file name="Tabs.php" hash="381579dc284c6f27acea660886fdbc5f"/></dir><file name="Edit.php" hash="7decfc10b577b4d99c342d23b4a75c01"/><file name="Grid.php" hash="5fb19f0ee6387b4f500191ed4f596e3c"/></dir><file name="Anymarketqueue.php" hash="ae3c146ea8a2b0999a762917d8645dff"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Buttoncheckconfig.php" hash="344078aec3e91f5f8915272935d0a391"/><file name="Callback.php" hash="0e721a318ec6d95e7671f2bdfd0e7c11"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Orders"><dir name="Statusammg"><file name="Values.php" hash="931376d93d7ad770aae1755aa05d880f"/></dir><dir name="Statusmgam"><file name="Values.php" hash="3e39fcc15a9400f09b525ff130aaf775"/></dir></dir><dir name="Products"><file name="Values.php" hash="87e7e2ecaa08fc0c21d7ee93799a6f91"/></dir></dir></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AnyMarket.php" hash="6d1473008f995a33e619b4d00465ccc0"/></dir></dir><dir name="Helper"><file name="Brand.php" hash="48c1fe421cd14cfe2fa29768d2e06916"/><file name="Category.php" hash="01169a1aa216b248456ec328d4654c72"/><file name="Customergenerator.php" hash="2e9ea1ede85d01637c21d8f59894709d"/><file name="Data.php" hash="83bafbea3cae011507c8aaf7cc34f574"/><file name="Image.php" hash="ad90702a2750c40c10e3edc687a7b578"/><file name="Order.php" hash="e60ac36a673b33e855b9a29a3b474bb1"/><file name="Ordergenerator.php" hash="16f9518a25d32d2057e4c5c8e752a230"/><file name="Product.php" hash="187f390e35aaadb855ec102bb2d6e029"/><file name="Productgenerator.php" hash="225911af1e47d516c317f3271d165b9e"/><file name="Queue.php" hash="3ae5c7901c867e334084869da5c69ea9"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Anymarketattributes.php" hash="9c70e239108635285a267800c92a5497"/><file name="Anymarketbrands.php" hash="e6ab4761f6162f7eaa0ed9c54ffa0f67"/><file name="Anymarketlog.php" hash="587fd8a1b7579d03a221531e04b16e72"/><file name="Anymarketorders.php" hash="e80623045edfecd2b31469d0ddaae65e"/><file name="Anymarketproducts.php" hash="98721db042c261f99ed4dac40af60b5d"/><file name="Anymarketqueue.php" hash="fe750b1048ed725c715084002eea3bd7"/></dir></dir><dir name="Anymarketattributes"><dir name="Api"><file name="V2.php" hash="2968c2cbc85867bf9689b3925d8661aa"/></dir><file name="Api.php" hash="c08643eee1e8a850a77e1da60b1934f5"/></dir><file name="Anymarketattributes.php" hash="fdb23d6c461452efacdbd3e3fdf7da6e"/><dir name="Anymarketbrands"><dir name="Api"><file name="V2.php" hash="d3e2e0763c146aa4c4260455decfa811"/></dir><file name="Api.php" hash="a197ecaab03dbbb136de2cd6eee4b6a6"/></dir><file name="Anymarketbrands.php" hash="8ae2eacd73d8e72ee69861e0dd763995"/><dir name="Anymarketcategories"><dir name="Api"><file name="V2.php" hash="9be73fc1875d16263554fb9d6220cfce"/></dir><file name="Api.php" hash="54b1068a7c5939e16382311691279664"/></dir><file name="Anymarketcategories.php" hash="56fb7c4397c3058124765c291c666727"/><dir name="Anymarketlog"><dir name="Api"><file name="V2.php" hash="f252eafdd842b105c8952567a5b0ece7"/></dir><file name="Api.php" hash="3424e96e46745bcc76fb3aca2073490e"/></dir><file name="Anymarketlog.php" hash="b2eee6d6ceb878147125ed59570d84bd"/><dir name="Anymarketorders"><dir name="Api"><file name="V2.php" hash="0b11c1be24355033a571d2e56f508d19"/></dir><file name="Api.php" hash="a8d2625d6b56d5596cc9af41151c019e"/></dir><file name="Anymarketorders.php" hash="6d4b8b112af994e6cd2e67eeadb56871"/><dir name="Anymarketproducts"><dir name="Api"><file name="V2.php" hash="d1b289e2fdd26b80c4d921bec5dfa339"/></dir><file name="Api.php" hash="bf63b0e5c0a56fb036807ddfbfb50feb"/></dir><file name="Anymarketproducts.php" hash="cb1fa1d36033d52d09bd485f164bb279"/><dir name="Anymarketqueue"><dir name="Api"><file name="V2.php" hash="e9c8a4c3612249d39d984c29d1ef548a"/></dir><file name="Api.php" hash="eb142eb9f3f92cb950596d47044f3050"/></dir><file name="Anymarketqueue.php" hash="7d2c450d809f530e31c1b6e27374e17d"/><file name="Cron.php" hash="f82e198f7675c4e1a06371024e2a0eba"/><file name="Observer.php" hash="d9038ad0f80a0df06353cb05a5deb06a"/><file name="PaymentMethod.php" hash="7c10a39a005e03d0d0530041bee95a9e"/><dir name="Resource"><dir name="Anymarketattributes"><file name="Collection.php" hash="36566dd648113fbd096ae4c9f2574058"/></dir><file name="Anymarketattributes.php" hash="07099d8acd0244dd22ef3aa591c4d4be"/><dir name="Anymarketbrands"><file name="Collection.php" hash="f542cb47a58e77017a90d4b9733e354b"/></dir><file name="Anymarketbrands.php" hash="aad2b54e04e58df24f9f518e67237d27"/><dir name="Anymarketcategories"><file name="Collection.php" hash="f58ef5b5397c8fdfd68dd860d2998dd6"/></dir><file name="Anymarketcategories.php" hash="80c0ea6b443d2beadc3e0d8fb3329e49"/><dir name="Anymarketlog"><file name="Collection.php" hash="e1b37efe779188ded01622a383c39f7e"/></dir><file name="Anymarketlog.php" hash="69ce526695527d4469f7cae4604d24f9"/><dir name="Anymarketorders"><file name="Collection.php" hash="45ec7c3ccf2de78cf5d0c95e1ea1f3f4"/></dir><file name="Anymarketorders.php" hash="1879ab46e3f47772db8b23710cc3c2ac"/><dir name="Anymarketproducts"><file name="Collection.php" hash="fc88402b7281c58a79b8fb4b8ab5645e"/></dir><file name="Anymarketproducts.php" hash="51ab548790054880bccce85b12e111ea"/><dir name="Anymarketqueue"><file name="Collection.php" hash="c7ce0a9ce11f376cc05d3afefe6ad8ba"/></dir><file name="Anymarketqueue.php" hash="be077e58f0eb8d8e5bbf660c70ff0c8a"/><file name="Setup.php" hash="0df420432c06cee997f9a43e9ca42fd2"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Attributes"><dir name="Customer"><dir name="Group"><file name="Values.php" hash="b3da25e6f5bbd22f88951a40f21c0062"/></dir><dir name="Street"><file name="Values.php" hash="c219bd519b968f614c92aa564272d1b3"/></dir><file name="Values.php" hash="74b98a8dbf05e3089bd9885d610b9203"/></dir><dir name="Product"><dir name="Booleantp"><file name="Values.php" hash="9b80052d0ed97cbbf4ba9f72c0a3e0a9"/></dir><dir name="Price"><file name="Values.php" hash="a9f6f4a2bef252b0731c7d82ebf36ddb"/></dir><file name="Values.php" hash="1000fd8c2cb40456c7ee3671bd06b1b9"/></dir><dir name="Set"><file name="Values.php" hash="c0c0ba6a8f7fcd48896ab4916ca8d515"/></dir></dir><dir name="Categories"><file name="Values.php" hash="f59129783eb797e1c088ef5ac332dc92"/></dir><dir name="General"><file name="Values.php" hash="75e19820d0a8b049e683a68cee20c2b2"/></dir><dir name="Logs"><file name="Values.php" hash="714f462254b42d1ba36546dbd55e06f9"/></dir><dir name="Massunit"><file name="Values.php" hash="475bc7d4556c5f42728b774d7b6749f2"/></dir><dir name="Measurementunit"><file name="Values.php" hash="0831cd50cddff66d9c97339d1a4d61ad"/></dir><dir name="Orders"><file name="Values.php" hash="6df0f33ada91098ba026bd006bd7b9d0"/></dir><dir name="Typesync"><dir name="Order"><file name="Values.php" hash="f2fe8cde6e3ae10cac6a26500fc0984b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Anymarket"><file name="AnymarketattributesController.php" hash="29db5f472baef6f064861a90577b3d39"/><file name="AnymarketbrandsController.php" hash="8e527c5c0e140e78815c9fb385023112"/><file name="AnymarketcategoriesController.php" hash="74468898d76dece1d5e14dcb9f815fc0"/><file name="AnymarketlogController.php" hash="8dbbbc42b687ad8056e98e61bff72a91"/><file name="AnymarketordersController.php" hash="d385cf6aabb0d46d1b77cedb2f408fe7"/><file name="AnymarketproductsController.php" hash="1548e718073f181fab1faac29dc698ec"/><file name="AnymarketqueueController.php" hash="8fc629165bfeb675d5c7230faca69e63"/></dir><file name="AnymarketController.php" hash="c84286b666ed0bcd988346b2fc46467d"/></dir><file name="IndexController.php" hash="377c4bed65fdf284f793d249cb59650c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59c70a74d5d791a85a6783dc6c2d954a"/><file name="api.xml" hash="3546bfaef38893f387c70879f8f62bd5"/><file name="config.xml" hash="71bbe2dae5b27f90e47e0f2a053fedb2"/><file name="system.xml" hash="e1f756b9d72ce52d3df13d254e2ee617"/><file name="wsdl.xml" hash="92472d43f8c69fea0b2ca67c102225c6"/><file name="wsi.xml" hash="e7e1d615fdad47f1454edcb4cea6b6df"/></dir><dir name="sql"><dir name="db1_anymarket_setup"><file name="mysql4-install-1.0.0.php" hash="78272b736dd84175c2a929f56e195854"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="08975052bef31e56c8fad046b599b4a8"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="e7af419b7793c1047e5d943f5b790ffb"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="850f538334af173a2918078c87cbfb16"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="1e4a102ab2de2f4af4250c6d7b31b4e3"/><file name="mysql4-upgrade-1.4.0-1.5.0.php" hash="4a21c4dff0151d55d62c5023f7b29930"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="c9ebd2ab6bdd29f0b7eb7e92a66887b0"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="f822917939bf63eb1b51e517a300baf8"/><file name="mysql4-upgrade-1.7.0-1.8.0.php" hash="59ff14275617b4d828eaf8dcc36bc080"/><file name="mysql4-upgrade-1.8.0-2.0.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="f27d52b9e03093827edf2da66df9af95"/><file name="mysql4-upgrade-2.1.0-2.2.0.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.2.0-2.3.6.php" hash="e5e770b4ab8ba48e177efbc1d613fb3c"/><file name="mysql4-upgrade-2.3.6-2.3.9.php" hash="8482a0d785e4abdfb0e060014c2849f2"/><file name="mysql4-upgrade-2.3.9-2.4.0.php" hash="0c70f1b41ed5bc1c5009c3be94aabc85"/><file name="mysql4-upgrade-2.4.0-2.4.3.php" hash="3b0e01bd5ba4afef89cfbe40305f9087"/><file name="mysql4-upgrade-2.4.3-2.4.4.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.4.4-2.9.1.php" hash="1227a2f27f4144df4d1bbfc928f97d83"/><file name="mysql4-upgrade-2.9.1-2.9.2.php" hash="cbf2ebc39de43a793b54460631eb6668"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="DB1_AnyMarket.xml" hash="98dd8e192a0a2ad509ce5a50c6c40f98"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="DB1_AnyMarket.csv" hash="3c464aa9a9643570436eb7afe5dcb28d"/></dir><dir name="pt_BR"><file name="DB1_AnyMarket.csv" hash="e690e6802f73adfeff24e716f5b47d86"/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="db1_anymarket.xml" hash="47bb7ca814c58a2985f198c3703f1d58"/></dir><dir name="template"><dir name="db1"><dir name="anymarket"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="6a0ec3bf507fe6211ca0ad4825325c57"/><file name="button_check_configuration.phtml" hash="252673865f738851cacc1337948b8f86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.4.0</min><max>5.7.0</max></php></required></dependencies>
|
22 |
</package>
|