Version Notes
* New tracking script
Download this release
Release Info
Developer | Christiaan de Ridder |
Extension | Tritac_ChannelEngine |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.7.1 to 3.0.0
- app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Feed.php +53 -53
- app/code/community/Tritac/ChannelEngine/Block/Head.php +15 -10
- app/code/community/Tritac/ChannelEngine/Block/Sales/Order/Grid.php +0 -204
- app/code/community/Tritac/ChannelEngine/Helper/Data.php +105 -93
- app/code/community/Tritac/ChannelEngine/Model/Carrier/Channelengine.php +67 -67
- app/code/community/Tritac/ChannelEngine/Model/Observer.php +905 -905
- app/code/community/Tritac/ChannelEngine/Model/Order.php +31 -31
- app/code/community/Tritac/ChannelEngine/Model/Payment/Method/Channelengine.php +21 -21
- app/code/community/Tritac/ChannelEngine/Model/Resource/Order.php +59 -59
- app/code/community/Tritac/ChannelEngine/Model/Resource/Order/Collection.php +6 -6
- app/code/community/Tritac/ChannelEngine/Model/Resource/Setup.php +3 -3
- app/code/community/Tritac/ChannelEngine/Model/Resource/Shipment.php +33 -33
- app/code/community/Tritac/ChannelEngine/Model/Resource/Shipment/Collection.php +6 -6
- app/code/community/Tritac/ChannelEngine/Model/Shipment.php +19 -19
- app/code/community/Tritac/ChannelEngine/Model/System/Config/Source/Gtin.php +31 -31
- app/code/community/Tritac/ChannelEngine/Model/System/Config/Source/Shipping.php +39 -39
- app/code/community/Tritac/ChannelEngine/controllers/Adminhtml/GenerateController.php +11 -11
- app/code/community/Tritac/ChannelEngine/controllers/TestController.php +0 -372
- app/code/community/Tritac/ChannelEngine/etc/adminhtml.xml +24 -24
- app/code/community/Tritac/ChannelEngine/etc/config.xml +194 -194
- app/code/community/Tritac/ChannelEngine/etc/system.xml +144 -144
- app/code/community/Tritac/ChannelEngine/sql/channelengine_setup/mysql4-install-1.0.0.php +55 -55
- app/code/community/Tritac/ChannelEngine/sql/channelengine_setup/mysql4-upgrade-2.6.0-2.7.0.php +24 -24
- app/design/adminhtml/default/default/template/channelengine/system/config/feed/generate_button.phtml +40 -40
- app/design/frontend/base/default/layout/channelengine.xml +17 -17
- app/design/frontend/base/default/template/channelengine/checkout/success.phtml +42 -30
- app/design/frontend/base/default/template/channelengine/head.phtml +13 -2
- app/etc/modules/Tritac_ChannelEngine.xml +9 -9
- lib/Tritac/ChannelEngineApiClient/Client.php +281 -281
- lib/Tritac/ChannelEngineApiClient/Enums/CancellationLineStatus.php +8 -8
- lib/Tritac/ChannelEngineApiClient/Enums/CancellationStatus.php +8 -8
- lib/Tritac/ChannelEngineApiClient/Enums/Gender.php +7 -7
- lib/Tritac/ChannelEngineApiClient/Enums/MancoReason.php +7 -7
- lib/Tritac/ChannelEngineApiClient/Enums/OrderStatus.php +12 -12
- lib/Tritac/ChannelEngineApiClient/Enums/ReturnAcceptStatus.php +5 -5
- lib/Tritac/ChannelEngineApiClient/Enums/ReturnReason.php +9 -9
- lib/Tritac/ChannelEngineApiClient/Enums/ReturnStatus.php +5 -5
- lib/Tritac/ChannelEngineApiClient/Enums/ShipmentLineStatus.php +7 -7
- lib/Tritac/ChannelEngineApiClient/Enums/ShipmentStatus.php +4 -4
- lib/Tritac/ChannelEngineApiClient/Helpers/Collection.php +48 -48
- lib/Tritac/ChannelEngineApiClient/Helpers/HttpMethod.php +8 -8
- lib/Tritac/ChannelEngineApiClient/Helpers/JsonMapper.php +90 -90
- lib/Tritac/ChannelEngineApiClient/Models/Address.php +96 -96
- lib/Tritac/ChannelEngineApiClient/Models/BaseModel.php +23 -23
- lib/Tritac/ChannelEngineApiClient/Models/Cancellation.php +39 -39
- lib/Tritac/ChannelEngineApiClient/Models/CancellationLine.php +33 -33
- lib/Tritac/ChannelEngineApiClient/Models/Message.php +11 -11
- lib/Tritac/ChannelEngineApiClient/Models/Order.php +153 -153
- lib/Tritac/ChannelEngineApiClient/Models/OrderExtraDataItem.php +18 -18
- lib/Tritac/ChannelEngineApiClient/Models/OrderLine.php +145 -145
- lib/Tritac/ChannelEngineApiClient/Models/ReturnLine.php +46 -46
- lib/Tritac/ChannelEngineApiClient/Models/ReturnObject.php +64 -64
- lib/Tritac/ChannelEngineApiClient/Models/Shipment.php +73 -73
- lib/Tritac/ChannelEngineApiClient/Models/ShipmentLine.php +47 -47
- lib/Tritac/ChannelEngineApiClient/loader.php +13 -13
- package.xml +5 -5
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Feed.php
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Adminhtml system "generate feed" button
|
4 |
-
*
|
5 |
-
* @category Tritac
|
6 |
-
* @package Tritac_ChannelEngine
|
7 |
-
*/
|
8 |
-
class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Set template block template
|
12 |
-
*
|
13 |
-
* @return Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed
|
14 |
-
*/
|
15 |
-
protected function _prepareLayout()
|
16 |
-
{
|
17 |
-
parent::_prepareLayout();
|
18 |
-
if (!$this->getTemplate()) {
|
19 |
-
$this->setTemplate('channelengine/system/config/feed/generate_button.phtml');
|
20 |
-
}
|
21 |
-
return $this;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Disable website scope
|
26 |
-
*
|
27 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
28 |
-
* @return string
|
29 |
-
*/
|
30 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
31 |
-
{
|
32 |
-
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
33 |
-
return parent::render($element);
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Get the button and scripts contents
|
38 |
-
*
|
39 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
40 |
-
* @return string
|
41 |
-
*/
|
42 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
43 |
-
{
|
44 |
-
$originalData = $element->getOriginalData();
|
45 |
-
$this->addData(array(
|
46 |
-
'button_label' => Mage::helper('channelengine')->__($originalData['button_label']),
|
47 |
-
'html_id' => $element->getHtmlId(),
|
48 |
-
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('channelengine/adminhtml_generate/ajax')
|
49 |
-
));
|
50 |
-
|
51 |
-
return $this->_toHtml();
|
52 |
-
}
|
53 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adminhtml system "generate feed" button
|
4 |
+
*
|
5 |
+
* @category Tritac
|
6 |
+
* @package Tritac_ChannelEngine
|
7 |
+
*/
|
8 |
+
class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Set template block template
|
12 |
+
*
|
13 |
+
* @return Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed
|
14 |
+
*/
|
15 |
+
protected function _prepareLayout()
|
16 |
+
{
|
17 |
+
parent::_prepareLayout();
|
18 |
+
if (!$this->getTemplate()) {
|
19 |
+
$this->setTemplate('channelengine/system/config/feed/generate_button.phtml');
|
20 |
+
}
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Disable website scope
|
26 |
+
*
|
27 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
33 |
+
return parent::render($element);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get the button and scripts contents
|
38 |
+
*
|
39 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
43 |
+
{
|
44 |
+
$originalData = $element->getOriginalData();
|
45 |
+
$this->addData(array(
|
46 |
+
'button_label' => Mage::helper('channelengine')->__($originalData['button_label']),
|
47 |
+
'html_id' => $element->getHtmlId(),
|
48 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('channelengine/adminhtml_generate/ajax')
|
49 |
+
));
|
50 |
+
|
51 |
+
return $this->_toHtml();
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Tritac/ChannelEngine/Block/Head.php
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Block_Head extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
public function getAccountName() {
|
5 |
-
|
6 |
-
$storeId = Mage::app()->getStore()->getId();
|
7 |
-
$config = Mage::helper('channelengine')->getGeneralConfig();
|
8 |
-
|
9 |
-
return $config[$storeId]['tenant'];
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Block_Head extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function getAccountName() {
|
5 |
+
|
6 |
+
$storeId = Mage::app()->getStore()->getId();
|
7 |
+
$config = Mage::helper('channelengine')->getGeneralConfig();
|
8 |
+
|
9 |
+
return $config[$storeId]['tenant'];
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getEnvironment()
|
13 |
+
{
|
14 |
+
return Mage::helper('channelengine')->isDevelopment() ? 'development' : 'production';
|
15 |
+
}
|
16 |
}
|
app/code/community/Tritac/ChannelEngine/Block/Sales/Order/Grid.php
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
3 |
-
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
parent::__construct();
|
7 |
-
$this->setId('sales_order_grid');
|
8 |
-
$this->setUseAjax(true);
|
9 |
-
$this->setDefaultSort('created_at');
|
10 |
-
$this->setDefaultDir('DESC');
|
11 |
-
$this->setSaveParametersInSession(true);
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Retrieve collection class
|
16 |
-
*
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
protected function _getCollectionClass()
|
20 |
-
{
|
21 |
-
return 'sales/order_grid_collection';
|
22 |
-
}
|
23 |
-
|
24 |
-
protected function _prepareCollection()
|
25 |
-
{
|
26 |
-
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
27 |
-
$joinTableName = Mage::getSingleton('core/resource')->getTableName('channelengine/order');
|
28 |
-
$collection->getSelect()->joinLeft(
|
29 |
-
array('channel_order_table' => $joinTableName),
|
30 |
-
'channel_order_table.order_id=main_table.entity_id',
|
31 |
-
array('channel_name', 'channel_order_id')
|
32 |
-
);
|
33 |
-
$this->setCollection($collection);
|
34 |
-
return parent::_prepareCollection();
|
35 |
-
}
|
36 |
-
|
37 |
-
protected function _prepareColumns()
|
38 |
-
{
|
39 |
-
$this->addColumn('real_order_id', array(
|
40 |
-
'header'=> Mage::helper('sales')->__('Order #'),
|
41 |
-
'width' => '80px',
|
42 |
-
'type' => 'text',
|
43 |
-
'index' => 'increment_id',
|
44 |
-
));
|
45 |
-
|
46 |
-
$this->addColumn('channel_order_id', array(
|
47 |
-
'header'=> Mage::helper('sales')->__('ChannelEngine Order ID'),
|
48 |
-
'width' => '80px',
|
49 |
-
'type' => 'text',
|
50 |
-
'index' => 'channel_order_id',
|
51 |
-
));
|
52 |
-
|
53 |
-
$this->addColumn('channel_name', array(
|
54 |
-
'header'=> Mage::helper('sales')->__('Channel Name'),
|
55 |
-
'width' => '80px',
|
56 |
-
'type' => 'text',
|
57 |
-
'index' => 'channel_name',
|
58 |
-
));
|
59 |
-
|
60 |
-
if (!Mage::app()->isSingleStoreMode()) {
|
61 |
-
$this->addColumn('store_id', array(
|
62 |
-
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
63 |
-
'index' => 'store_id',
|
64 |
-
'type' => 'store',
|
65 |
-
'store_view'=> true,
|
66 |
-
'display_deleted' => true,
|
67 |
-
));
|
68 |
-
}
|
69 |
-
|
70 |
-
$this->addColumn('created_at', array(
|
71 |
-
'header' => Mage::helper('sales')->__('Purchased On'),
|
72 |
-
'index' => 'created_at',
|
73 |
-
'type' => 'datetime',
|
74 |
-
'width' => '100px',
|
75 |
-
));
|
76 |
-
|
77 |
-
$this->addColumn('billing_name', array(
|
78 |
-
'header' => Mage::helper('sales')->__('Bill to Name'),
|
79 |
-
'index' => 'billing_name',
|
80 |
-
));
|
81 |
-
|
82 |
-
$this->addColumn('shipping_name', array(
|
83 |
-
'header' => Mage::helper('sales')->__('Ship to Name'),
|
84 |
-
'index' => 'shipping_name',
|
85 |
-
));
|
86 |
-
|
87 |
-
$this->addColumn('base_grand_total', array(
|
88 |
-
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
89 |
-
'index' => 'base_grand_total',
|
90 |
-
'type' => 'currency',
|
91 |
-
'currency' => 'base_currency_code',
|
92 |
-
));
|
93 |
-
|
94 |
-
$this->addColumn('grand_total', array(
|
95 |
-
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
96 |
-
'index' => 'grand_total',
|
97 |
-
'type' => 'currency',
|
98 |
-
'currency' => 'order_currency_code',
|
99 |
-
));
|
100 |
-
|
101 |
-
$this->addColumn('status', array(
|
102 |
-
'header' => Mage::helper('sales')->__('Status'),
|
103 |
-
'index' => 'status',
|
104 |
-
'type' => 'options',
|
105 |
-
'width' => '70px',
|
106 |
-
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
107 |
-
));
|
108 |
-
|
109 |
-
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
110 |
-
$this->addColumn('action',
|
111 |
-
array(
|
112 |
-
'header' => Mage::helper('sales')->__('Action'),
|
113 |
-
'width' => '50px',
|
114 |
-
'type' => 'action',
|
115 |
-
'getter' => 'getId',
|
116 |
-
'actions' => array(
|
117 |
-
array(
|
118 |
-
'caption' => Mage::helper('sales')->__('View'),
|
119 |
-
'url' => array('base'=>'*/sales_order/view'),
|
120 |
-
'field' => 'order_id'
|
121 |
-
)
|
122 |
-
),
|
123 |
-
'filter' => false,
|
124 |
-
'sortable' => false,
|
125 |
-
'index' => 'stores',
|
126 |
-
'is_system' => true,
|
127 |
-
));
|
128 |
-
}
|
129 |
-
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
130 |
-
|
131 |
-
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
132 |
-
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
133 |
-
|
134 |
-
return parent::_prepareColumns();
|
135 |
-
}
|
136 |
-
|
137 |
-
protected function _prepareMassaction()
|
138 |
-
{
|
139 |
-
$this->setMassactionIdField('entity_id');
|
140 |
-
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
141 |
-
$this->getMassactionBlock()->setUseSelectAll(false);
|
142 |
-
|
143 |
-
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
144 |
-
$this->getMassactionBlock()->addItem('cancel_order', array(
|
145 |
-
'label'=> Mage::helper('sales')->__('Cancel'),
|
146 |
-
'url' => $this->getUrl('*/sales_order/massCancel'),
|
147 |
-
));
|
148 |
-
}
|
149 |
-
|
150 |
-
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
151 |
-
$this->getMassactionBlock()->addItem('hold_order', array(
|
152 |
-
'label'=> Mage::helper('sales')->__('Hold'),
|
153 |
-
'url' => $this->getUrl('*/sales_order/massHold'),
|
154 |
-
));
|
155 |
-
}
|
156 |
-
|
157 |
-
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
158 |
-
$this->getMassactionBlock()->addItem('unhold_order', array(
|
159 |
-
'label'=> Mage::helper('sales')->__('Unhold'),
|
160 |
-
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
161 |
-
));
|
162 |
-
}
|
163 |
-
|
164 |
-
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
165 |
-
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
166 |
-
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
167 |
-
));
|
168 |
-
|
169 |
-
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
170 |
-
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
171 |
-
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
172 |
-
));
|
173 |
-
|
174 |
-
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
175 |
-
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
176 |
-
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
177 |
-
));
|
178 |
-
|
179 |
-
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
180 |
-
'label'=> Mage::helper('sales')->__('Print All'),
|
181 |
-
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
182 |
-
));
|
183 |
-
|
184 |
-
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
185 |
-
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
186 |
-
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
187 |
-
));
|
188 |
-
|
189 |
-
return $this;
|
190 |
-
}
|
191 |
-
|
192 |
-
public function getRowUrl($row)
|
193 |
-
{
|
194 |
-
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
195 |
-
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
196 |
-
}
|
197 |
-
return false;
|
198 |
-
}
|
199 |
-
|
200 |
-
public function getGridUrl()
|
201 |
-
{
|
202 |
-
return $this->getUrl('*/*/grid', array('_current'=>true));
|
203 |
-
}
|
204 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Tritac/ChannelEngine/Helper/Data.php
CHANGED
@@ -1,94 +1,106 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
-
|
4 |
-
protected $_config = null;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Default expected shipment time (in weekdays)
|
8 |
-
*
|
9 |
-
* @var int
|
10 |
-
*/
|
11 |
-
protected $_defaultTimeToShip = 5;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Get extension general config
|
15 |
-
*
|
16 |
-
* @param null $storeId
|
17 |
-
* @return array
|
18 |
-
*/
|
19 |
-
public function getConfig($storeId = null)
|
20 |
-
{
|
21 |
-
if(empty($this->_config)) {
|
22 |
-
foreach(Mage::app()->getStores() as $_store) {
|
23 |
-
$this->_config[$_store->getId()] = Mage::getStoreConfig('channelengine', $_store->getId());
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
if($storeId) {
|
28 |
-
if(!isset($this->_config[$storeId])) {
|
29 |
-
return false;
|
30 |
-
}else{
|
31 |
-
return $this->_config[$storeId];
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
return $this->_config;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Get extension general config
|
40 |
-
*
|
41 |
-
* @return
|
42 |
-
*/
|
43 |
-
public function
|
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 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
protected $_config = null;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Default expected shipment time (in weekdays)
|
8 |
+
*
|
9 |
+
* @var int
|
10 |
+
*/
|
11 |
+
protected $_defaultTimeToShip = 5;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Get extension general config
|
15 |
+
*
|
16 |
+
* @param null $storeId
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function getConfig($storeId = null)
|
20 |
+
{
|
21 |
+
if(empty($this->_config)) {
|
22 |
+
foreach(Mage::app()->getStores() as $_store) {
|
23 |
+
$this->_config[$_store->getId()] = Mage::getStoreConfig('channelengine', $_store->getId());
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
if($storeId) {
|
28 |
+
if(!isset($this->_config[$storeId])) {
|
29 |
+
return false;
|
30 |
+
}else{
|
31 |
+
return $this->_config[$storeId];
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
return $this->_config;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get extension general config
|
40 |
+
*
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
public function isDevelopment()
|
44 |
+
{
|
45 |
+
$machines = array('tritac-ssd16');
|
46 |
+
$machine = gethostname();
|
47 |
+
return in_array($machine, $machines);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get extension general config
|
52 |
+
*
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function getGeneralConfig()
|
56 |
+
{
|
57 |
+
$result = array();
|
58 |
+
|
59 |
+
foreach($this->getConfig() as $storeId => $storeConfig) {
|
60 |
+
$result[$storeId] = $storeConfig['general'];
|
61 |
+
}
|
62 |
+
|
63 |
+
return $result;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check required general config data
|
68 |
+
*
|
69 |
+
* @param null $storeId
|
70 |
+
* @return bool
|
71 |
+
*/
|
72 |
+
public function checkGeneralConfig($storeId = null)
|
73 |
+
{
|
74 |
+
$config = Mage::getStoreConfig('channelengine/general', $storeId);
|
75 |
+
|
76 |
+
if(empty($config['api_key']) || empty($config['api_secret']) || empty($config['tenant'])) {
|
77 |
+
$storeMsg = ($storeId) ? 'for store '.$storeId : '';
|
78 |
+
Mage::log(
|
79 |
+
"Couldn't connect to ChannelEngine.
|
80 |
+
Please specify account keys {$storeMsg}
|
81 |
+
(System/Configuration/Tritac ChannelEngine/Settings/General)"
|
82 |
+
);
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
return true;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get store expected shipment text
|
91 |
+
*
|
92 |
+
* @param $store_id
|
93 |
+
* @return DateTime
|
94 |
+
*/
|
95 |
+
public function getExpectedShipmentDate($store_id)
|
96 |
+
{
|
97 |
+
$config = $this->getConfig($store_id);
|
98 |
+
|
99 |
+
$weekdays = (int) $config['shipping']['expected_date'];
|
100 |
+
if($weekdays <= 0)
|
101 |
+
$weekdays = $this->_defaultTimeToShip;
|
102 |
+
|
103 |
+
$expectedDate = date("Y-m-d", strtotime("{$weekdays} weekdays"));
|
104 |
+
return new DateTime($expectedDate);
|
105 |
+
}
|
106 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Carrier/Channelengine.php
CHANGED
@@ -1,67 +1,67 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Carrier_Channelengine
|
3 |
-
extends Mage_Shipping_Model_Carrier_Abstract
|
4 |
-
implements Mage_Shipping_Model_Carrier_Interface
|
5 |
-
{
|
6 |
-
|
7 |
-
/** @var string Shipping method system code*/
|
8 |
-
protected $_code = 'channelengine';
|
9 |
-
|
10 |
-
protected $_isFixed = true;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Collect and get shipping rates
|
14 |
-
*
|
15 |
-
* @param Mage_Shipping_Model_Rate_Request $request
|
16 |
-
* @return bool|false|Mage_Core_Model_Abstract|Mage_Shipping_Model_Rate_Result|null
|
17 |
-
*/
|
18 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
-
{
|
20 |
-
if (!$this->getConfigFlag('active')) {
|
21 |
-
return false;
|
22 |
-
}
|
23 |
-
|
24 |
-
// Check if the rates were requested by ChannelEngine and not by the frontend
|
25 |
-
if(!Mage::registry('channelengine_shipping')){
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
Mage::unregister('channelengine_shipping');
|
29 |
-
|
30 |
-
$result = Mage::getModel('shipping/rate_result');
|
31 |
-
|
32 |
-
$shippingPrice = 0;
|
33 |
-
|
34 |
-
if(Mage::registry('channelengine_shipping_amount')) {
|
35 |
-
$shippingPrice = Mage::registry('channelengine_shipping_amount');
|
36 |
-
}
|
37 |
-
Mage::unregister('channelengine_shipping_amount');
|
38 |
-
|
39 |
-
|
40 |
-
$method = Mage::getModel('shipping/rate_result_method');
|
41 |
-
|
42 |
-
$method->setCarrier($this->_code);
|
43 |
-
$method->setCarrierTitle($this->getConfigData('title'));
|
44 |
-
|
45 |
-
$method->setMethod($this->_code);
|
46 |
-
$method->setMethodTitle($this->getConfigData('name'));
|
47 |
-
|
48 |
-
$method->setPrice($shippingPrice);
|
49 |
-
$method->setCost($shippingPrice);
|
50 |
-
|
51 |
-
$result->append($method);
|
52 |
-
|
53 |
-
|
54 |
-
return $result;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function isActive()
|
58 |
-
{
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
public function getAllowedMethods()
|
63 |
-
{
|
64 |
-
return array('channelengine'=>'ChannelEngine');
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Carrier_Channelengine
|
3 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
4 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
/** @var string Shipping method system code*/
|
8 |
+
protected $_code = 'channelengine';
|
9 |
+
|
10 |
+
protected $_isFixed = true;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Collect and get shipping rates
|
14 |
+
*
|
15 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
16 |
+
* @return bool|false|Mage_Core_Model_Abstract|Mage_Shipping_Model_Rate_Result|null
|
17 |
+
*/
|
18 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
+
{
|
20 |
+
if (!$this->getConfigFlag('active')) {
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
|
24 |
+
// Check if the rates were requested by ChannelEngine and not by the frontend
|
25 |
+
if(!Mage::registry('channelengine_shipping')){
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
Mage::unregister('channelengine_shipping');
|
29 |
+
|
30 |
+
$result = Mage::getModel('shipping/rate_result');
|
31 |
+
|
32 |
+
$shippingPrice = 0;
|
33 |
+
|
34 |
+
if(Mage::registry('channelengine_shipping_amount')) {
|
35 |
+
$shippingPrice = Mage::registry('channelengine_shipping_amount');
|
36 |
+
}
|
37 |
+
Mage::unregister('channelengine_shipping_amount');
|
38 |
+
|
39 |
+
|
40 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
41 |
+
|
42 |
+
$method->setCarrier($this->_code);
|
43 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
44 |
+
|
45 |
+
$method->setMethod($this->_code);
|
46 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
47 |
+
|
48 |
+
$method->setPrice($shippingPrice);
|
49 |
+
$method->setCost($shippingPrice);
|
50 |
+
|
51 |
+
$result->append($method);
|
52 |
+
|
53 |
+
|
54 |
+
return $result;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function isActive()
|
58 |
+
{
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getAllowedMethods()
|
63 |
+
{
|
64 |
+
return array('channelengine'=>'ChannelEngine');
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
app/code/community/Tritac/ChannelEngine/Model/Observer.php
CHANGED
@@ -1,905 +1,905 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Observer model
|
4 |
-
*/
|
5 |
-
class Tritac_ChannelEngine_Model_Observer
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* API client
|
9 |
-
*
|
10 |
-
* @var Tritac_ChannelEngineApiClient_Client
|
11 |
-
*/
|
12 |
-
protected $_client = null;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* API config. API key, API secret, API tenant
|
16 |
-
*
|
17 |
-
* @var array
|
18 |
-
*/
|
19 |
-
protected $_config = null;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* ChannelEngine helper
|
23 |
-
*
|
24 |
-
* @var Tritac_ChannelEngine_Helper_Data
|
25 |
-
*/
|
26 |
-
protected $_helper = null;
|
27 |
-
|
28 |
-
const ATTRIBUTES_LIMIT = 30;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Retrieve and validate API config
|
32 |
-
* Initialize API client
|
33 |
-
*/
|
34 |
-
public function __construct()
|
35 |
-
{
|
36 |
-
$this->_helper = Mage::helper('channelengine');
|
37 |
-
$this->_config = $this->_helper->getConfig();
|
38 |
-
/**
|
39 |
-
* Check required config parameters. Initialize API client.
|
40 |
-
*/
|
41 |
-
foreach($this->_config as $storeId => $storeConfig) {
|
42 |
-
if($this->_helper->checkGeneralConfig($storeId)) {
|
43 |
-
$this->_client[$storeId] = new Tritac_ChannelEngineApiClient_Client(
|
44 |
-
$storeConfig['general']['api_key'],
|
45 |
-
$storeConfig['general']['api_secret'],
|
46 |
-
$storeConfig['general']['tenant']
|
47 |
-
);
|
48 |
-
}
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Fetch new orders from ChannelEngine.
|
54 |
-
* Ran by cron. The cronjob is set in extension config file.
|
55 |
-
*
|
56 |
-
* @return bool
|
57 |
-
*/
|
58 |
-
public function fetchNewOrders()
|
59 |
-
{
|
60 |
-
/**
|
61 |
-
* Check if client is initialized
|
62 |
-
*/
|
63 |
-
if(is_null($this->_client))
|
64 |
-
return false;
|
65 |
-
|
66 |
-
foreach($this->_client as $storeId => $_client) {
|
67 |
-
/**
|
68 |
-
* Retrieve new orders
|
69 |
-
*/
|
70 |
-
$orders = $_client->getOrders(array(
|
71 |
-
Tritac_ChannelEngineApiClient_Enums_OrderStatus::NEW_ORDER
|
72 |
-
));
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Check new orders existing
|
76 |
-
*/
|
77 |
-
if(is_null($orders) || $orders->count() == 0)
|
78 |
-
continue;
|
79 |
-
|
80 |
-
Mage::log("Received {$orders->count()} orders from ChannelEngine.");
|
81 |
-
|
82 |
-
foreach($orders as $order) {
|
83 |
-
|
84 |
-
$billingAddress = $order->getBillingAddress();
|
85 |
-
$shippingAddress = $order->getShippingAddress();
|
86 |
-
if(empty($billingAddress)) continue;
|
87 |
-
|
88 |
-
$lines = $order->getLines();
|
89 |
-
|
90 |
-
if(!empty($lines)) {
|
91 |
-
|
92 |
-
// Initialize new quote
|
93 |
-
$quote = Mage::getModel('sales/quote')->setStoreId($storeId);
|
94 |
-
|
95 |
-
foreach($lines as $item) {
|
96 |
-
|
97 |
-
$productNo = $item->getMerchantProductNo();
|
98 |
-
$ids = explode('_', $productNo);
|
99 |
-
$productId = $ids[0];
|
100 |
-
// Load magento product
|
101 |
-
$_product = Mage::getModel('catalog/product')
|
102 |
-
->setStoreId($storeId);
|
103 |
-
$productOptions = array();
|
104 |
-
$_product->load($productId);
|
105 |
-
if(count($ids) == 3) {
|
106 |
-
$productOptions = array($ids[1] => intval($ids[2]));
|
107 |
-
}
|
108 |
-
|
109 |
-
// Prepare product parameters for quote
|
110 |
-
$params = new Varien_Object();
|
111 |
-
$params->setQty($item->getQuantity());
|
112 |
-
$params->setOptions($productOptions);
|
113 |
-
|
114 |
-
// Add product to quote
|
115 |
-
try {
|
116 |
-
$_quoteItem = $quote->addProduct($_product, $params);
|
117 |
-
|
118 |
-
if(is_string($_quoteItem)) {
|
119 |
-
// Magento sometimes returns a string when the method fails. -_-"
|
120 |
-
Mage::throwException('Failed to create quote item: ' . $_quoteItem);
|
121 |
-
}
|
122 |
-
|
123 |
-
$_quoteItem->setChannelengineOrderLineId($item->getId());
|
124 |
-
|
125 |
-
} catch (Exception $e) {
|
126 |
-
|
127 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
128 |
-
"An order (#{$order->getId()}) could not be imported",
|
129 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
130 |
-
);
|
131 |
-
Mage::logException($e);
|
132 |
-
continue 2;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
$phone = $order->getPhone();
|
138 |
-
if(empty($phone))
|
139 |
-
$phone = '-';
|
140 |
-
// Prepare billing and shipping addresses
|
141 |
-
$billingData = array(
|
142 |
-
'firstname' => $billingAddress->getFirstName(),
|
143 |
-
'lastname' => $billingAddress->getLastName(),
|
144 |
-
'email' => $order->getEmail(),
|
145 |
-
'telephone' => $phone,
|
146 |
-
'country_id' => $billingAddress->getCountryIso(),
|
147 |
-
'postcode' => $billingAddress->getZipCode(),
|
148 |
-
'city' => $billingAddress->getCity(),
|
149 |
-
'street' =>
|
150 |
-
$billingAddress->getStreetName().' '.
|
151 |
-
$billingAddress->getHouseNr().
|
152 |
-
$billingAddress->getHouseNrAddition()
|
153 |
-
);
|
154 |
-
$shippingData = array(
|
155 |
-
'firstname' => $shippingAddress->getFirstName(),
|
156 |
-
'lastname' => $shippingAddress->getLastName(),
|
157 |
-
'email' => $order->getEmail(),
|
158 |
-
'telephone' => $phone,
|
159 |
-
'country_id' => $shippingAddress->getCountryIso(),
|
160 |
-
'postcode' => $shippingAddress->getZipCode(),
|
161 |
-
'city' => $shippingAddress->getCity(),
|
162 |
-
'street' =>
|
163 |
-
$shippingAddress->getStreetName().' '.
|
164 |
-
$shippingAddress->getHouseNr().
|
165 |
-
$shippingAddress->getHouseNrAddition()
|
166 |
-
);
|
167 |
-
|
168 |
-
// Register shipping cost. See Tritac_ChannelEngine_Model_Carrier_Channelengine::collectrates();
|
169 |
-
Mage::register('channelengine_shipping_amount', floatval($order->getShippingCostsInclVat()));
|
170 |
-
// Set this value to make sure ChannelEngine requested the rates and not the frontend
|
171 |
-
// because the shipping method has a fallback on 0,- and this will make it show up on the frontend
|
172 |
-
Mage::register('channelengine_shipping', true);
|
173 |
-
|
174 |
-
$quote->getBillingAddress()
|
175 |
-
->addData($billingData);
|
176 |
-
$quote->getShippingAddress()
|
177 |
-
->addData($shippingData)
|
178 |
-
->setSaveInAddressBook(0)
|
179 |
-
->setCollectShippingRates(true)
|
180 |
-
->setShippingMethod('channelengine_channelengine');
|
181 |
-
|
182 |
-
$quote->collectTotals();
|
183 |
-
|
184 |
-
// Set guest customer
|
185 |
-
$quote->setCustomerId(null)
|
186 |
-
->setCustomerEmail($quote->getBillingAddress()->getEmail())
|
187 |
-
->setCustomerIsGuest(true)
|
188 |
-
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
189 |
-
|
190 |
-
// Set custom payment method
|
191 |
-
$quote->setIsSystem(true);
|
192 |
-
$quote->getPayment()->importData(array('method' => 'channelengine'));
|
193 |
-
|
194 |
-
// Save quote and convert it to new order
|
195 |
-
try {
|
196 |
-
|
197 |
-
$quote->save();
|
198 |
-
|
199 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
200 |
-
|
201 |
-
$service->submitAll();
|
202 |
-
|
203 |
-
} catch (Exception $e) {
|
204 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
205 |
-
"An order (#{$order->getId()}) could not be imported",
|
206 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
207 |
-
);
|
208 |
-
Mage::logException($e);
|
209 |
-
continue;
|
210 |
-
}
|
211 |
-
|
212 |
-
$_order = $service->getOrder();
|
213 |
-
|
214 |
-
|
215 |
-
if($_order->getIncrementId()) {
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Create new invoice and save channel order
|
219 |
-
*/
|
220 |
-
try {
|
221 |
-
// Initialize new invoice model
|
222 |
-
$invoice = Mage::getModel('sales/service_order', $_order)->prepareInvoice();
|
223 |
-
// Add comment to invoice
|
224 |
-
$invoice->addComment(
|
225 |
-
"Order paid on the marketplace.",
|
226 |
-
false,
|
227 |
-
true
|
228 |
-
);
|
229 |
-
|
230 |
-
// Register invoice. Register invoice items. Collect invoice totals.
|
231 |
-
$invoice->register();
|
232 |
-
$invoice->getOrder()->setIsInProcess(true);
|
233 |
-
|
234 |
-
// Initialize new channel order
|
235 |
-
$_channelOrder = Mage::getModel('channelengine/order');
|
236 |
-
$_channelOrder->setOrderId($_order->getId())
|
237 |
-
->setChannelOrderId($order->getId())
|
238 |
-
->setChannelName($order->getChannelName())
|
239 |
-
->setDoSendMails($order->getDoSendMails())
|
240 |
-
->setCanShipPartial($order->getCanShipPartialOrderLines());
|
241 |
-
|
242 |
-
$invoice->getOrder()
|
243 |
-
->setCanShipPartiallyItem($order->getCanShipPartialOrderLines())
|
244 |
-
->setCanShipPartially($order->getCanShipPartialOrderLines());
|
245 |
-
|
246 |
-
// Start new transaction
|
247 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
248 |
-
->addObject($invoice)
|
249 |
-
->addObject($invoice->getOrder())
|
250 |
-
->addObject($_channelOrder);
|
251 |
-
$transactionSave->save();
|
252 |
-
|
253 |
-
} catch (Exception $e) {
|
254 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
255 |
-
"An invoice could not be created (order #{$_order->getIncrementId()}, channel order #{$order->getId()})",
|
256 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
257 |
-
);
|
258 |
-
Mage::logException($e);
|
259 |
-
continue;
|
260 |
-
}
|
261 |
-
Mage::log("Order #{$_order->getIncrementId()} was imported successfully.");
|
262 |
-
} else {
|
263 |
-
Mage::log("An order (#{$order->getId()}) could not be imported");
|
264 |
-
}
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
return true;
|
269 |
-
}
|
270 |
-
|
271 |
-
/**
|
272 |
-
* Post new shipment to ChannelEngine. This function is set in extension config file.
|
273 |
-
*
|
274 |
-
* @param Varien_Event_Observer $observer
|
275 |
-
* @return bool
|
276 |
-
* @throws Exception
|
277 |
-
*/
|
278 |
-
public function saveShipment(Varien_Event_Observer $observer)
|
279 |
-
{
|
280 |
-
Mage::log('--------------------------------------');
|
281 |
-
$event = $observer->getEvent();
|
282 |
-
/** @var $_shipment Mage_Sales_Model_Order_Shipment */
|
283 |
-
$_shipment = $event->getShipment();
|
284 |
-
|
285 |
-
/** @var $_order Mage_Sales_Model_Order */
|
286 |
-
$_order = $_shipment->getOrder();
|
287 |
-
|
288 |
-
$storeId = $_order->getStoreId();
|
289 |
-
|
290 |
-
$ceOrder = Mage::getModel('channelengine/order')->loadByOrderId($_order->getId());
|
291 |
-
$ceOrderId = $ceOrder->getChannelOrderId();
|
292 |
-
|
293 |
-
if(!$ceOrderId) return false;
|
294 |
-
|
295 |
-
// Check if the API client was initialized for this order
|
296 |
-
if(!isset($this->_client[$storeId])) return false;
|
297 |
-
|
298 |
-
// Initialize new ChannelEngine shipment object
|
299 |
-
$ceShipment = new Tritac_ChannelEngineApiClient_Models_Shipment();
|
300 |
-
$ceShipment->setOrderId($ceOrderId);
|
301 |
-
$ceShipment->setMerchantShipmentNo($_shipment->getId());
|
302 |
-
|
303 |
-
// Set tracking info if available
|
304 |
-
$trackingCode = null;
|
305 |
-
$trackingCodes = $_shipment->getAllTracks();
|
306 |
-
if(count($trackingCodes) > 0) {
|
307 |
-
|
308 |
-
$trackingCode = $trackingCodes[0];
|
309 |
-
$ceShipment->setTrackTraceNo($trackingCode->getNumber());
|
310 |
-
$ceShipment->setMethod($trackingCode->getTitle());
|
311 |
-
}
|
312 |
-
|
313 |
-
// If the shipment is already known to ChannelEngine we will just update it
|
314 |
-
$_channelShipment = Mage::getModel('channelengine/shipment')->loadByShipmentId($_shipment->getId());
|
315 |
-
|
316 |
-
if($_channelShipment->getId() != null) {
|
317 |
-
|
318 |
-
if($trackingCode != null) {
|
319 |
-
Mage::Log("TrackTrace: {$trackingCode->getNumber()}");
|
320 |
-
}
|
321 |
-
|
322 |
-
Mage::log("CE Shipment Id: #{$_channelShipment->getChannelengineShipmentId()}");
|
323 |
-
$ceShipment->setId($_channelShipment->getChannelengineShipmentId());
|
324 |
-
$this->_client[$storeId]->putShipment($ceShipment);
|
325 |
-
return true;
|
326 |
-
}
|
327 |
-
|
328 |
-
Mage::log('New shipment, continue');
|
329 |
-
|
330 |
-
// Add the shipment lines
|
331 |
-
$ceShipmentLines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ShipmentLine');
|
332 |
-
foreach($_shipment->getAllItems() as $_shipmentItem) {
|
333 |
-
|
334 |
-
// Get the quantity for this shipment
|
335 |
-
$shippedQty = (int)$_shipmentItem->getQty();
|
336 |
-
if($shippedQty == 0) continue;
|
337 |
-
|
338 |
-
// Get the original order item
|
339 |
-
$_orderItem = Mage::getModel('sales/order_item')->load($_shipmentItem->getOrderItemId());
|
340 |
-
if($_orderItem == null) continue;
|
341 |
-
|
342 |
-
$ceShipmentLine = new Tritac_ChannelEngineApiClient_Models_ShipmentLine();
|
343 |
-
$ceShipmentLine->setOrderLineId($_orderItem->getChannelengineOrderLineId());
|
344 |
-
$ceShipmentLine->setQuantity($shippedQty);
|
345 |
-
$ceShipmentLine->setStatus(Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus::SHIPPED);
|
346 |
-
|
347 |
-
$ceShipmentLines->append($ceShipmentLine);
|
348 |
-
}
|
349 |
-
|
350 |
-
// Check if there are any shipment lines
|
351 |
-
if(count($ceShipmentLines) == 0) return false;
|
352 |
-
|
353 |
-
$ceShipment->setLines($ceShipmentLines);
|
354 |
-
|
355 |
-
// Post shipment to ChannelEngine
|
356 |
-
try{
|
357 |
-
|
358 |
-
$result = $this->_client[$storeId]->postShipment($ceShipment);
|
359 |
-
if($result == null) return false;
|
360 |
-
|
361 |
-
$_channelShipment = Mage::getModel('channelengine/shipment')
|
362 |
-
->setShipmentId($_shipment->getId())
|
363 |
-
->setChannelengineShipmentId($result->getId());
|
364 |
-
$_channelShipment->save();
|
365 |
-
|
366 |
-
Mage::log("Shipment #{$_shipment->getId()} (CE #{$result->getId()}) was placed successfully.");
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
} catch(Exception $e) {
|
371 |
-
|
372 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
373 |
-
"A shipment (#{$_shipment->getId()}) could not be exported",
|
374 |
-
"Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
375 |
-
);
|
376 |
-
|
377 |
-
Mage::logException($e);
|
378 |
-
|
379 |
-
}
|
380 |
-
|
381 |
-
|
382 |
-
return true;
|
383 |
-
}
|
384 |
-
|
385 |
-
/**
|
386 |
-
* Fetch new returns from channelengine
|
387 |
-
*
|
388 |
-
* @return bool
|
389 |
-
*/
|
390 |
-
public function fetchReturns()
|
391 |
-
{
|
392 |
-
/**
|
393 |
-
* Check if client is initialized
|
394 |
-
*/
|
395 |
-
if(is_null($this->_client))
|
396 |
-
return false;
|
397 |
-
|
398 |
-
foreach($this->_client as $storeId => $_client) {
|
399 |
-
/**
|
400 |
-
* Retrieve returns
|
401 |
-
*/
|
402 |
-
$returns = $_client->getReturns(array(
|
403 |
-
Tritac_ChannelEngineApiClient_Enums_ReturnStatus::DECLARED
|
404 |
-
));
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Check declared returns
|
408 |
-
*/
|
409 |
-
if(is_null($returns) || $returns->count() == 0)
|
410 |
-
return false;
|
411 |
-
|
412 |
-
foreach($returns as $return) {
|
413 |
-
$_channelOrder = Mage::getModel('channelengine/order')->loadByChannelOrderId($return->getOrderId());
|
414 |
-
$_order = Mage::getModel('sales/order')->load($_channelOrder->getOrderId());
|
415 |
-
|
416 |
-
if(!$_order->getIncrementId()) {
|
417 |
-
continue;
|
418 |
-
}
|
419 |
-
|
420 |
-
|
421 |
-
$link = "https://". $this->_config[$storeId]['general']['tenant'] .".channelengine.net/orders/view/". $return->getOrderId();
|
422 |
-
$status = $return->getStatus(); // Get return status
|
423 |
-
$reason = $return->getReason(); // Get return reason
|
424 |
-
$title = "A new return was declared in ChannelEngine (ChannelEngine Order #{$return->getOrderId()})";
|
425 |
-
$message = "Magento Order #: <a href='".
|
426 |
-
Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id'=>$_order->getOrderId())).
|
427 |
-
"'>".
|
428 |
-
$_order->getIncrementId().
|
429 |
-
"</a><br />";
|
430 |
-
$message .= "Status: {$status}<br />";
|
431 |
-
$message .= "Reason: {$reason}<br />";
|
432 |
-
$message .= "For more details visit ChannelEngine your <a href='".$link."' target='_blank'>account</a>";
|
433 |
-
|
434 |
-
// Check if notification is already exist
|
435 |
-
$_resource = Mage::getSingleton('core/resource');
|
436 |
-
$_connectionRead = $_resource->getConnection('core_read');
|
437 |
-
$select = $_connectionRead->select()
|
438 |
-
->from($_resource->getTableName('adminnotification/inbox'))
|
439 |
-
->where('title = ?', $title)
|
440 |
-
->where('is_remove != 1')
|
441 |
-
->limit(1);
|
442 |
-
$data = $_connectionRead->fetchRow($select);
|
443 |
-
|
444 |
-
if ($data) {
|
445 |
-
continue;
|
446 |
-
}
|
447 |
-
|
448 |
-
// Add new notification
|
449 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
450 |
-
$title,
|
451 |
-
$message,
|
452 |
-
$link
|
453 |
-
);
|
454 |
-
}
|
455 |
-
}
|
456 |
-
}
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Generate products feed for ChannelEngine
|
460 |
-
*/
|
461 |
-
public function generateFeed()
|
462 |
-
{
|
463 |
-
$start_memory = memory_get_usage();
|
464 |
-
|
465 |
-
/**
|
466 |
-
* Prepare categories array
|
467 |
-
*/
|
468 |
-
$categoryArray = array();
|
469 |
-
$parent = Mage::app()->getWebsite(true)->getDefaultStore()->getRootCategoryId();
|
470 |
-
$category = Mage::getModel('catalog/category');
|
471 |
-
if ($category->checkId($parent)) {
|
472 |
-
$storeCategories = $category->getCategories($parent, 0, true, true, true);
|
473 |
-
foreach($storeCategories as $_category) {
|
474 |
-
$categoryArray[$_category->getId()] = $_category->getData();
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Prepare products relation
|
480 |
-
*/
|
481 |
-
// $productsRelation = array();
|
482 |
-
// $_resource = Mage::getSingleton('core/resource');
|
483 |
-
// $_connection = $_resource->getConnection('core_read');
|
484 |
-
// $relations = $_connection->fetchAll("SELECT * FROM " . $_resource->getTableName('catalog/product_relation'));
|
485 |
-
// foreach($relations as $relation) {
|
486 |
-
// $productsRelation[$relation['child_id']] = $relation['parent_id'];
|
487 |
-
// }
|
488 |
-
|
489 |
-
/**
|
490 |
-
* Export products from each store.
|
491 |
-
* Note: products with undefined website id will not be export.
|
492 |
-
*/
|
493 |
-
foreach(Mage::app()->getStores() as $_store) {
|
494 |
-
Mage::app()->setCurrentStore($_store);
|
495 |
-
$path = Mage::getBaseDir('media') . DS . 'channelengine' . DS;
|
496 |
-
$storeConfig = $this->_helper->getConfig($_store->getId());
|
497 |
-
$name = $storeConfig['general']['tenant'].'_products.xml';
|
498 |
-
$file = $path . DS . $name;
|
499 |
-
|
500 |
-
$io = new Varien_Io_File();
|
501 |
-
$io->setAllowCreateFolders(true);
|
502 |
-
$io->open(array('path' => $path));
|
503 |
-
$io->streamOpen($file, 'w+');
|
504 |
-
$io->streamLock(true);
|
505 |
-
$io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
|
506 |
-
$io->streamWrite('<Products xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . "\n");
|
507 |
-
|
508 |
-
/**
|
509 |
-
* Prepare custom options array
|
510 |
-
*/
|
511 |
-
$storeId = $_store->getId();
|
512 |
-
$optionsArray = array();
|
513 |
-
$_options = Mage::getModel('catalog/product_option')
|
514 |
-
->getCollection()
|
515 |
-
->addTitleToResult($storeId)
|
516 |
-
->addPriceToResult($storeId)
|
517 |
-
->addValuesToResult($storeId)
|
518 |
-
->setOrder('sort_order', 'asc');
|
519 |
-
foreach($_options as $_option) {
|
520 |
-
$productId = $_option->getProductId();
|
521 |
-
$optionId = $_option->getOptionId();
|
522 |
-
$optionsArray[$productId][$optionId] = $_option->getData();
|
523 |
-
if($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
|
524 |
-
$optionsArray[$productId][$optionId]['values'] = $_option->getValues();
|
525 |
-
}
|
526 |
-
}
|
527 |
-
|
528 |
-
/**
|
529 |
-
* Retrieve product collection with all visible attributes
|
530 |
-
*/
|
531 |
-
if(Mage::helper('catalog/product_flat')->isEnabled($storeId)) {
|
532 |
-
Mage::getResourceSingleton('catalog/product_flat')->setStoreId($storeId);
|
533 |
-
}
|
534 |
-
$collection = Mage::getModel('catalog/product')->getCollection();
|
535 |
-
|
536 |
-
if(Mage::helper('catalog/product_flat')->isEnabled($storeId)) {
|
537 |
-
$collection->getEntity()->setStoreId($storeId);
|
538 |
-
}
|
539 |
-
|
540 |
-
$systemAttributes = $attributesToSelect = array(
|
541 |
-
'name',
|
542 |
-
'description',
|
543 |
-
'image',
|
544 |
-
'url_key',
|
545 |
-
'price',
|
546 |
-
'cost',
|
547 |
-
'special_price',
|
548 |
-
'special_from_date',
|
549 |
-
'special_to_date',
|
550 |
-
'visibility',
|
551 |
-
'msrp'
|
552 |
-
);
|
553 |
-
|
554 |
-
$visibleAttributes = array();
|
555 |
-
$attributes = Mage::getSingleton('eav/config')
|
556 |
-
->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
|
557 |
-
|
558 |
-
foreach($attributes as $attribute) {
|
559 |
-
if( ($attribute->getIsVisible() && $attribute->getIsVisibleOnFront())
|
560 |
-
|| in_array($attribute->getAttributeCode(), $systemAttributes))
|
561 |
-
{
|
562 |
-
$code = $attribute->getAttributeCode();
|
563 |
-
$visibleAttributes[$code]['label'] = $attribute->getFrontendLabel();
|
564 |
-
|
565 |
-
foreach( $attribute->getSource()->getAllOptions(false) as $option ) {
|
566 |
-
$visibleAttributes[$code]['values'][$option['value']] = $option['label'];
|
567 |
-
}
|
568 |
-
if(!in_array($code, $attributesToSelect)) {
|
569 |
-
$attributesToSelect[] = $code;
|
570 |
-
}
|
571 |
-
}
|
572 |
-
}
|
573 |
-
|
574 |
-
if(!empty($this->_config[$storeId]['feed']['gtin'])) {
|
575 |
-
$attributesToSelect[] = $this->_config[$storeId]['feed']['gtin'];
|
576 |
-
}
|
577 |
-
|
578 |
-
if( (count($attributesToSelect) > self::ATTRIBUTES_LIMIT) && !$collection->isEnabledFlat()) {
|
579 |
-
$error = $this->_helper->__('Too many visible attributes. Please enable catalog product flat mode.');
|
580 |
-
Mage::getSingleton('adminhtml/session')->addError($error);
|
581 |
-
echo 'redirect';
|
582 |
-
return false;
|
583 |
-
}
|
584 |
-
|
585 |
-
$collection->addAttributeToSelect($attributesToSelect, 'left')
|
586 |
-
->addFieldToFilter('type_id', array('in' => array('simple')))
|
587 |
-
->addStoreFilter($_store)
|
588 |
-
->addAttributeToFilter('status', 1)
|
589 |
-
->addAttributeToFilter('visibility', array('in' => array('2', '3', '4')))
|
590 |
-
->addAttributeToSort('entity_id', 'DESC');
|
591 |
-
|
592 |
-
// Add qty and category fields to select
|
593 |
-
$collection->getSelect()
|
594 |
-
->joinLeft(
|
595 |
-
array('csi' => Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_item')),
|
596 |
-
'`e`.`entity_id` = `csi`.`product_id`',
|
597 |
-
array('qty' => 'COALESCE(`qty`, 0)')
|
598 |
-
)
|
599 |
-
->joinLeft(
|
600 |
-
array('ccp' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product')),
|
601 |
-
'`e`.`entity_id` = `ccp`.`product_id`',
|
602 |
-
array('category_id' => 'MAX(`ccp`.`category_id`)')
|
603 |
-
)
|
604 |
-
->group('e.entity_id');
|
605 |
-
|
606 |
-
Mage::getSingleton('core/resource_iterator')->walk(
|
607 |
-
$collection->getSelect(),
|
608 |
-
array(array($this, 'callbackGenerateFeed')),
|
609 |
-
array(
|
610 |
-
'io' => $io,
|
611 |
-
'categories' => $categoryArray,
|
612 |
-
'attributes' => $visibleAttributes,
|
613 |
-
'systemAttributes' => $systemAttributes,
|
614 |
-
'options' => $optionsArray,
|
615 |
-
'store' => $_store,
|
616 |
-
'startMemory' => $start_memory,
|
617 |
-
)
|
618 |
-
);
|
619 |
-
|
620 |
-
$collection->clear()->getSelect()->reset('where');
|
621 |
-
$collection->addFieldToFilter('type_id', array('in' => array('configurable')))
|
622 |
-
->addStoreFilter($_store)
|
623 |
-
->addAttributeToFilter('status', 1)
|
624 |
-
->addAttributeToSort('entity_id', 'DESC');
|
625 |
-
|
626 |
-
foreach($collection as $_product) {
|
627 |
-
$productAttributeOptions = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
|
628 |
-
$superAttributes = array();
|
629 |
-
|
630 |
-
foreach($productAttributeOptions as $superAttribute) {
|
631 |
-
foreach($superAttribute['values'] as $value) {
|
632 |
-
$superAttributes[$superAttribute['attribute_code']][$value['value_index']] = $value;
|
633 |
-
}
|
634 |
-
}
|
635 |
-
|
636 |
-
$parentData = $_product->getData();
|
637 |
-
$parentData['id'] = $parentData['entity_id'];
|
638 |
-
|
639 |
-
$productModel = Mage::getModel('catalog/product');
|
640 |
-
$productModel->setData('entity_id', $parentData['entity_id']);
|
641 |
-
$productModel->setData('url_key', $parentData['url_key']);
|
642 |
-
$productModel->setData('store_id', $parentData['store_id']);
|
643 |
-
$parentData['url'] = $productModel->getProductUrl();
|
644 |
-
|
645 |
-
$specialPrice = $parentData['special_price'];
|
646 |
-
$specialFrom = $parentData['special_from_date'];
|
647 |
-
$specialTo = $parentData['special_to_date'];
|
648 |
-
$parentData['price'] = Mage::getModel('catalog/product_type_price')
|
649 |
-
->calculateSpecialPrice($parentData['price'], $specialPrice, $specialFrom, $specialTo, $storeId);
|
650 |
-
|
651 |
-
$xml = $this->_getProductXml($parentData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
|
652 |
-
$_childProducts = Mage::getModel('catalog/product_type_configurable')
|
653 |
-
->getUsedProducts(null, $_product);
|
654 |
-
|
655 |
-
foreach($_childProducts as $_child) {
|
656 |
-
$childData = $_child->getData();
|
657 |
-
$childData['id'] = $childData['entity_id'];
|
658 |
-
$childData['parent_id'] = $parentData['id'];
|
659 |
-
$childData['price'] = $parentData['price'];
|
660 |
-
$childData['url'] = $parentData['url'];
|
661 |
-
$childData['description'] = $parentData['description'];
|
662 |
-
|
663 |
-
if(!isset($childData['image']) || $childData['image'] == 'no_slection') {
|
664 |
-
$childData['image'] = $parentData['image'];
|
665 |
-
}
|
666 |
-
|
667 |
-
foreach($superAttributes as $code => $superAttribute) {
|
668 |
-
if(isset($childData[$code])) {
|
669 |
-
$priceValue = $superAttribute[$childData[$code]]['pricing_value'];
|
670 |
-
if($superAttribute[$childData[$code]]['is_percent']) {
|
671 |
-
$newPrice = $childData['price'] + $childData['price'] * $priceValue / 100;
|
672 |
-
} else {
|
673 |
-
$newPrice = $childData['price'] + $priceValue;
|
674 |
-
}
|
675 |
-
$childData['price'] = $newPrice;
|
676 |
-
}
|
677 |
-
}
|
678 |
-
$xml .= $this->_getProductXml($childData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
|
679 |
-
}
|
680 |
-
$io->streamWrite($xml);
|
681 |
-
}
|
682 |
-
|
683 |
-
|
684 |
-
$io->streamWrite('</Products>');
|
685 |
-
$io->streamUnlock();
|
686 |
-
$io->streamClose();
|
687 |
-
|
688 |
-
Mage::log("Product feed {$name} was generated successfully");
|
689 |
-
}
|
690 |
-
|
691 |
-
return true;
|
692 |
-
}
|
693 |
-
|
694 |
-
public function callbackGenerateFeed($args)
|
695 |
-
{
|
696 |
-
$io = $args['io'];
|
697 |
-
$product = $args['row'];
|
698 |
-
$attributes = $args['attributes'];
|
699 |
-
$systemAttributes = $args['systemAttributes'];
|
700 |
-
$categories = $args['categories'];
|
701 |
-
$options = $args['options'];
|
702 |
-
$_store = $args['store'];
|
703 |
-
$storeId = $_store->getId();
|
704 |
-
|
705 |
-
$xml = '';
|
706 |
-
|
707 |
-
$product['store_id'] = $storeId;
|
708 |
-
if(!empty($this->_config[$storeId]['feed']['gtin'])) {
|
709 |
-
$product['gtin'] = $product[$this->_config[$storeId]['feed']['gtin']];
|
710 |
-
}
|
711 |
-
|
712 |
-
$specialPrice = $product['special_price'];
|
713 |
-
$specialFrom = $product['special_from_date'];
|
714 |
-
$specialTo = $product['special_to_date'];
|
715 |
-
$product['price'] = Mage::getModel('catalog/product_type_price')
|
716 |
-
->calculateSpecialPrice($product['price'], $specialPrice, $specialFrom, $specialTo, $storeId);
|
717 |
-
|
718 |
-
$productModel = Mage::getModel('catalog/product');
|
719 |
-
$productModel->setData('entity_id', $product['entity_id']);
|
720 |
-
$productModel->setData('url_key', $product['url_key']);
|
721 |
-
$productModel->setData('store_id', $product['store_id']);
|
722 |
-
$product['url'] = $productModel->getProductUrl();
|
723 |
-
|
724 |
-
/**
|
725 |
-
* Add product custom options to feed.
|
726 |
-
* Each option value will generate new product row
|
727 |
-
*/
|
728 |
-
$additional['systemAttributes'] = $systemAttributes;
|
729 |
-
$additional['attributes'] = $attributes;
|
730 |
-
if(isset($options[$product['entity_id']])) {
|
731 |
-
$product['group_code'] = $product['entity_id'];
|
732 |
-
foreach($options[$product['entity_id']] as $option) {
|
733 |
-
if(isset($option['values'])) {
|
734 |
-
foreach($option['values'] as $_value) {
|
735 |
-
$product['id'] = $product['entity_id'].'_'.$option['option_id'].'_'.$_value->getId();
|
736 |
-
$additional['title'] = str_replace(' ', '_', $option['default_title']);
|
737 |
-
$additional['value'] = $_value->getDefaultTitle();
|
738 |
-
$xml .= $this->_getProductXml($product, $categories, $additional);
|
739 |
-
}
|
740 |
-
} else {
|
741 |
-
$product['id'] = $product['entity_id'].'_'.$option['option_id'];
|
742 |
-
$additional['title'] = str_replace(' ', '_', $option['default_title']);
|
743 |
-
$additional['value'] = '';
|
744 |
-
$xml .= $this->_getProductXml($product, $categories, $additional);
|
745 |
-
}
|
746 |
-
}
|
747 |
-
}else {
|
748 |
-
$product['id'] = $product['entity_id'];
|
749 |
-
$xml .= $this->_getProductXml($product, $categories, $additional);
|
750 |
-
}
|
751 |
-
|
752 |
-
$io->streamWrite($xml);
|
753 |
-
}
|
754 |
-
|
755 |
-
protected function _getProductXml($product, $categories, $additional = null)
|
756 |
-
{
|
757 |
-
$xml = "<Product>";
|
758 |
-
$xml .= "<Id>".$product['id']."</Id>";
|
759 |
-
|
760 |
-
// Add group code with product id if product have custom options
|
761 |
-
if(isset($product['group_code'])) {
|
762 |
-
$xml .= "<GroupCode><![CDATA[".$product['group_code']."]]></GroupCode>";
|
763 |
-
}
|
764 |
-
if(isset($product['parent_id'])) {
|
765 |
-
$xml .= "<ParentId><![CDATA[".$product['parent_id']."]]></ParentId>";
|
766 |
-
}
|
767 |
-
$xml .= "<Type><![CDATA[".$product['type_id']."]]></Type>";
|
768 |
-
$xml .= "<Name><![CDATA[".$product['name']."]]></Name>";
|
769 |
-
$xml .= "<Description><![CDATA[".$product['description']."]]></Description>";
|
770 |
-
$xml .= "<Price><![CDATA[".$product['price']."]]></Price>";
|
771 |
-
$xml .= "<ListPrice><![CDATA[".$product['msrp']."]]></ListPrice>";
|
772 |
-
$xml .= "<PurchasePrice><![CDATA[".$product['cost']."]]></PurchasePrice>";
|
773 |
-
|
774 |
-
// Add product stock qty
|
775 |
-
$xml .= "<Stock><![CDATA[".$product['qty']."]]></Stock>";
|
776 |
-
// Add product SKU and GTIN
|
777 |
-
$xml .= "<SKU><![CDATA[".$product['sku']."]]></SKU>";
|
778 |
-
if(!empty($product['gtin'])) {
|
779 |
-
$xml .= "<GTIN><![CDATA[".$product['gtin']."]]></GTIN>";
|
780 |
-
}
|
781 |
-
|
782 |
-
// VAT and Shipping Time are pre configured in extension settings
|
783 |
-
if(!empty($this->_config[$product['store_id']]['feed']['vat_rate'])) {
|
784 |
-
$vat = $this->_config[$product['store_id']]['feed']['vat_rate'];
|
785 |
-
$xml .= "<VAT><![CDATA[".$vat."]]></VAT>";
|
786 |
-
}
|
787 |
-
|
788 |
-
$shippingTime = ($product['qty'] > 0) ? $this->_config[$product['store_id']]['feed']['shipping_time'] : $this->_config[$product['store_id']]['feed']['shipping_time_oos'];
|
789 |
-
|
790 |
-
if($shippingTime) {
|
791 |
-
$xml .= "<ShippingTime><![CDATA[".$shippingTime."]]></ShippingTime>";
|
792 |
-
}
|
793 |
-
|
794 |
-
$xml .= "<Url><![CDATA[".$product['url']."]]></Url>";
|
795 |
-
|
796 |
-
if(isset($product['image']) && $product['image'] != 'no_selection') {
|
797 |
-
$imgUrl = Mage::getSingleton('catalog/product_media_config')->getMediaUrl($product['image']);
|
798 |
-
$xml .= "<ImageUrl><![CDATA[".$imgUrl."]]></ImageUrl>";
|
799 |
-
}
|
800 |
-
|
801 |
-
// Prepare category path
|
802 |
-
if(!empty($product['category_id']) && !empty($categories)) {
|
803 |
-
$categoryId = $product['category_id'];
|
804 |
-
$categoryPathIds = explode('/', $categories[$categoryId]['path']);
|
805 |
-
$categoryPath = null;
|
806 |
-
foreach($categoryPathIds as $id) {
|
807 |
-
if($id > 2) {
|
808 |
-
$categoryPath .= ($categoryPath) ? ' > ':'';
|
809 |
-
$categoryPath .= $categories[$id]['name'];
|
810 |
-
}
|
811 |
-
}
|
812 |
-
if($categoryPath) {
|
813 |
-
$xml .= "<Category><![CDATA[".$categoryPath."]]></Category>";
|
814 |
-
}
|
815 |
-
}
|
816 |
-
|
817 |
-
if(isset($additional['title']) && isset($additional['value'])) {
|
818 |
-
$title = preg_replace("/[^a-zA-Z0-9]/", "", $additional['title']);
|
819 |
-
$xml .= sprintf("<%1\$s><![CDATA[%2\$s]]></%1\$s>",
|
820 |
-
$title,
|
821 |
-
$additional['value']
|
822 |
-
);
|
823 |
-
}
|
824 |
-
|
825 |
-
/*
|
826 |
-
* Prepare product visible attributes
|
827 |
-
*/
|
828 |
-
if(isset($additional['attributes'])) {
|
829 |
-
$xml .= '<Attributes>';
|
830 |
-
foreach($additional['attributes'] as $code => $attribute) {
|
831 |
-
if(isset($product[$code]) && !in_array($code, $additional['systemAttributes'])) {
|
832 |
-
$xml .= "<".$code.">";
|
833 |
-
/*$xml .= "<label><![CDATA[".$attribute['label']."]]></label>";
|
834 |
-
if(!empty($attribute['values'])) {
|
835 |
-
$xml .= "<value><![CDATA[".$attribute['values'][$product[$code]]."]]></value>";
|
836 |
-
} else {
|
837 |
-
$xml .= "<value><![CDATA[".$product[$code]."]]></value>";
|
838 |
-
}*/
|
839 |
-
if(!empty($attribute['values'])) {
|
840 |
-
$xml .= "<![CDATA[".$attribute['values'][$product[$code]]."]]>";
|
841 |
-
} else {
|
842 |
-
$xml .= "<![CDATA[".$product[$code]."]]>";
|
843 |
-
}
|
844 |
-
$xml .= "</".$code.">";
|
845 |
-
}
|
846 |
-
}
|
847 |
-
$xml .= '</Attributes>';
|
848 |
-
}
|
849 |
-
|
850 |
-
$xml .= "</Product>\n";
|
851 |
-
|
852 |
-
return $xml;
|
853 |
-
}
|
854 |
-
|
855 |
-
public function addConfigurableProducts($collection)
|
856 |
-
{
|
857 |
-
|
858 |
-
}
|
859 |
-
|
860 |
-
/**
|
861 |
-
* Join channelengine order fields to adminhtml order grid
|
862 |
-
*
|
863 |
-
* @param $observer
|
864 |
-
*/
|
865 |
-
/*public function prepareOrderGridCollection($observer)
|
866 |
-
{
|
867 |
-
$collection = $observer->getOrderGridCollection();
|
868 |
-
$joinTableName = Mage::getSingleton('core/resource')->getTableName('channelengine/order');
|
869 |
-
$collection->getSelect()->joinLeft(
|
870 |
-
array('channel_order_table' => $joinTableName),
|
871 |
-
'channel_order_table.order_id=main_table.entity_id',
|
872 |
-
array('channel_name', 'channel_order_id')
|
873 |
-
);
|
874 |
-
}*/
|
875 |
-
|
876 |
-
/**
|
877 |
-
* Add channelengine order fields to adminhtml order grid
|
878 |
-
*
|
879 |
-
* @param $observer
|
880 |
-
* @return $this
|
881 |
-
*/
|
882 |
-
/*public function appendCustomColumnToOrderGrid($observer)
|
883 |
-
{
|
884 |
-
$block = $observer->getBlock();
|
885 |
-
if (!isset($block)) {
|
886 |
-
return $this;
|
887 |
-
}
|
888 |
-
|
889 |
-
if ($block->getType() == 'adminhtml/sales_order_grid') {
|
890 |
-
$block->addColumnAfter('channel_order_id', array(
|
891 |
-
'header'=> Mage::helper('sales')->__('ChannelEngine Order ID'),
|
892 |
-
'width' => '80px',
|
893 |
-
'type' => 'text',
|
894 |
-
'index' => 'channel_order_id',
|
895 |
-
), 'real_order_id');
|
896 |
-
|
897 |
-
$block->addColumnAfter('channel_name', array(
|
898 |
-
'header'=> Mage::helper('sales')->__('Channel Name'),
|
899 |
-
'width' => '80px',
|
900 |
-
'type' => 'text',
|
901 |
-
'index' => 'channel_name',
|
902 |
-
), 'real_order_id');
|
903 |
-
}
|
904 |
-
}*/
|
905 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Observer model
|
4 |
+
*/
|
5 |
+
class Tritac_ChannelEngine_Model_Observer
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* API client
|
9 |
+
*
|
10 |
+
* @var Tritac_ChannelEngineApiClient_Client
|
11 |
+
*/
|
12 |
+
protected $_client = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* API config. API key, API secret, API tenant
|
16 |
+
*
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
protected $_config = null;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* ChannelEngine helper
|
23 |
+
*
|
24 |
+
* @var Tritac_ChannelEngine_Helper_Data
|
25 |
+
*/
|
26 |
+
protected $_helper = null;
|
27 |
+
|
28 |
+
const ATTRIBUTES_LIMIT = 30;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Retrieve and validate API config
|
32 |
+
* Initialize API client
|
33 |
+
*/
|
34 |
+
public function __construct()
|
35 |
+
{
|
36 |
+
$this->_helper = Mage::helper('channelengine');
|
37 |
+
$this->_config = $this->_helper->getConfig();
|
38 |
+
/**
|
39 |
+
* Check required config parameters. Initialize API client.
|
40 |
+
*/
|
41 |
+
foreach($this->_config as $storeId => $storeConfig) {
|
42 |
+
if($this->_helper->checkGeneralConfig($storeId)) {
|
43 |
+
$this->_client[$storeId] = new Tritac_ChannelEngineApiClient_Client(
|
44 |
+
$storeConfig['general']['api_key'],
|
45 |
+
$storeConfig['general']['api_secret'],
|
46 |
+
$storeConfig['general']['tenant']
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Fetch new orders from ChannelEngine.
|
54 |
+
* Ran by cron. The cronjob is set in extension config file.
|
55 |
+
*
|
56 |
+
* @return bool
|
57 |
+
*/
|
58 |
+
public function fetchNewOrders()
|
59 |
+
{
|
60 |
+
/**
|
61 |
+
* Check if client is initialized
|
62 |
+
*/
|
63 |
+
if(is_null($this->_client))
|
64 |
+
return false;
|
65 |
+
|
66 |
+
foreach($this->_client as $storeId => $_client) {
|
67 |
+
/**
|
68 |
+
* Retrieve new orders
|
69 |
+
*/
|
70 |
+
$orders = $_client->getOrders(array(
|
71 |
+
Tritac_ChannelEngineApiClient_Enums_OrderStatus::NEW_ORDER
|
72 |
+
));
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Check new orders existing
|
76 |
+
*/
|
77 |
+
if(is_null($orders) || $orders->count() == 0)
|
78 |
+
continue;
|
79 |
+
|
80 |
+
Mage::log("Received {$orders->count()} orders from ChannelEngine.");
|
81 |
+
|
82 |
+
foreach($orders as $order) {
|
83 |
+
|
84 |
+
$billingAddress = $order->getBillingAddress();
|
85 |
+
$shippingAddress = $order->getShippingAddress();
|
86 |
+
if(empty($billingAddress)) continue;
|
87 |
+
|
88 |
+
$lines = $order->getLines();
|
89 |
+
|
90 |
+
if(!empty($lines)) {
|
91 |
+
|
92 |
+
// Initialize new quote
|
93 |
+
$quote = Mage::getModel('sales/quote')->setStoreId($storeId);
|
94 |
+
|
95 |
+
foreach($lines as $item) {
|
96 |
+
|
97 |
+
$productNo = $item->getMerchantProductNo();
|
98 |
+
$ids = explode('_', $productNo);
|
99 |
+
$productId = $ids[0];
|
100 |
+
// Load magento product
|
101 |
+
$_product = Mage::getModel('catalog/product')
|
102 |
+
->setStoreId($storeId);
|
103 |
+
$productOptions = array();
|
104 |
+
$_product->load($productId);
|
105 |
+
if(count($ids) == 3) {
|
106 |
+
$productOptions = array($ids[1] => intval($ids[2]));
|
107 |
+
}
|
108 |
+
|
109 |
+
// Prepare product parameters for quote
|
110 |
+
$params = new Varien_Object();
|
111 |
+
$params->setQty($item->getQuantity());
|
112 |
+
$params->setOptions($productOptions);
|
113 |
+
|
114 |
+
// Add product to quote
|
115 |
+
try {
|
116 |
+
$_quoteItem = $quote->addProduct($_product, $params);
|
117 |
+
|
118 |
+
if(is_string($_quoteItem)) {
|
119 |
+
// Magento sometimes returns a string when the method fails. -_-"
|
120 |
+
Mage::throwException('Failed to create quote item: ' . $_quoteItem);
|
121 |
+
}
|
122 |
+
|
123 |
+
$_quoteItem->setChannelengineOrderLineId($item->getId());
|
124 |
+
|
125 |
+
} catch (Exception $e) {
|
126 |
+
|
127 |
+
Mage::getModel('adminnotification/inbox')->addCritical(
|
128 |
+
"An order (#{$order->getId()}) could not be imported",
|
129 |
+
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
130 |
+
);
|
131 |
+
Mage::logException($e);
|
132 |
+
continue 2;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
$phone = $order->getPhone();
|
138 |
+
if(empty($phone))
|
139 |
+
$phone = '-';
|
140 |
+
// Prepare billing and shipping addresses
|
141 |
+
$billingData = array(
|
142 |
+
'firstname' => $billingAddress->getFirstName(),
|
143 |
+
'lastname' => $billingAddress->getLastName(),
|
144 |
+
'email' => $order->getEmail(),
|
145 |
+
'telephone' => $phone,
|
146 |
+
'country_id' => $billingAddress->getCountryIso(),
|
147 |
+
'postcode' => $billingAddress->getZipCode(),
|
148 |
+
'city' => $billingAddress->getCity(),
|
149 |
+
'street' =>
|
150 |
+
$billingAddress->getStreetName().' '.
|
151 |
+
$billingAddress->getHouseNr().
|
152 |
+
$billingAddress->getHouseNrAddition()
|
153 |
+
);
|
154 |
+
$shippingData = array(
|
155 |
+
'firstname' => $shippingAddress->getFirstName(),
|
156 |
+
'lastname' => $shippingAddress->getLastName(),
|
157 |
+
'email' => $order->getEmail(),
|
158 |
+
'telephone' => $phone,
|
159 |
+
'country_id' => $shippingAddress->getCountryIso(),
|
160 |
+
'postcode' => $shippingAddress->getZipCode(),
|
161 |
+
'city' => $shippingAddress->getCity(),
|
162 |
+
'street' =>
|
163 |
+
$shippingAddress->getStreetName().' '.
|
164 |
+
$shippingAddress->getHouseNr().
|
165 |
+
$shippingAddress->getHouseNrAddition()
|
166 |
+
);
|
167 |
+
|
168 |
+
// Register shipping cost. See Tritac_ChannelEngine_Model_Carrier_Channelengine::collectrates();
|
169 |
+
Mage::register('channelengine_shipping_amount', floatval($order->getShippingCostsInclVat()));
|
170 |
+
// Set this value to make sure ChannelEngine requested the rates and not the frontend
|
171 |
+
// because the shipping method has a fallback on 0,- and this will make it show up on the frontend
|
172 |
+
Mage::register('channelengine_shipping', true);
|
173 |
+
|
174 |
+
$quote->getBillingAddress()
|
175 |
+
->addData($billingData);
|
176 |
+
$quote->getShippingAddress()
|
177 |
+
->addData($shippingData)
|
178 |
+
->setSaveInAddressBook(0)
|
179 |
+
->setCollectShippingRates(true)
|
180 |
+
->setShippingMethod('channelengine_channelengine');
|
181 |
+
|
182 |
+
$quote->collectTotals();
|
183 |
+
|
184 |
+
// Set guest customer
|
185 |
+
$quote->setCustomerId(null)
|
186 |
+
->setCustomerEmail($quote->getBillingAddress()->getEmail())
|
187 |
+
->setCustomerIsGuest(true)
|
188 |
+
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
189 |
+
|
190 |
+
// Set custom payment method
|
191 |
+
$quote->setIsSystem(true);
|
192 |
+
$quote->getPayment()->importData(array('method' => 'channelengine'));
|
193 |
+
|
194 |
+
// Save quote and convert it to new order
|
195 |
+
try {
|
196 |
+
|
197 |
+
$quote->save();
|
198 |
+
|
199 |
+
$service = Mage::getModel('sales/service_quote', $quote);
|
200 |
+
|
201 |
+
$service->submitAll();
|
202 |
+
|
203 |
+
} catch (Exception $e) {
|
204 |
+
Mage::getModel('adminnotification/inbox')->addCritical(
|
205 |
+
"An order (#{$order->getId()}) could not be imported",
|
206 |
+
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
207 |
+
);
|
208 |
+
Mage::logException($e);
|
209 |
+
continue;
|
210 |
+
}
|
211 |
+
|
212 |
+
$_order = $service->getOrder();
|
213 |
+
|
214 |
+
|
215 |
+
if($_order->getIncrementId()) {
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Create new invoice and save channel order
|
219 |
+
*/
|
220 |
+
try {
|
221 |
+
// Initialize new invoice model
|
222 |
+
$invoice = Mage::getModel('sales/service_order', $_order)->prepareInvoice();
|
223 |
+
// Add comment to invoice
|
224 |
+
$invoice->addComment(
|
225 |
+
"Order paid on the marketplace.",
|
226 |
+
false,
|
227 |
+
true
|
228 |
+
);
|
229 |
+
|
230 |
+
// Register invoice. Register invoice items. Collect invoice totals.
|
231 |
+
$invoice->register();
|
232 |
+
$invoice->getOrder()->setIsInProcess(true);
|
233 |
+
|
234 |
+
// Initialize new channel order
|
235 |
+
$_channelOrder = Mage::getModel('channelengine/order');
|
236 |
+
$_channelOrder->setOrderId($_order->getId())
|
237 |
+
->setChannelOrderId($order->getId())
|
238 |
+
->setChannelName($order->getChannelName())
|
239 |
+
->setDoSendMails($order->getDoSendMails())
|
240 |
+
->setCanShipPartial($order->getCanShipPartialOrderLines());
|
241 |
+
|
242 |
+
$invoice->getOrder()
|
243 |
+
->setCanShipPartiallyItem($order->getCanShipPartialOrderLines())
|
244 |
+
->setCanShipPartially($order->getCanShipPartialOrderLines());
|
245 |
+
|
246 |
+
// Start new transaction
|
247 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
248 |
+
->addObject($invoice)
|
249 |
+
->addObject($invoice->getOrder())
|
250 |
+
->addObject($_channelOrder);
|
251 |
+
$transactionSave->save();
|
252 |
+
|
253 |
+
} catch (Exception $e) {
|
254 |
+
Mage::getModel('adminnotification/inbox')->addCritical(
|
255 |
+
"An invoice could not be created (order #{$_order->getIncrementId()}, channel order #{$order->getId()})",
|
256 |
+
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
257 |
+
);
|
258 |
+
Mage::logException($e);
|
259 |
+
continue;
|
260 |
+
}
|
261 |
+
Mage::log("Order #{$_order->getIncrementId()} was imported successfully.");
|
262 |
+
} else {
|
263 |
+
Mage::log("An order (#{$order->getId()}) could not be imported");
|
264 |
+
}
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
return true;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Post new shipment to ChannelEngine. This function is set in extension config file.
|
273 |
+
*
|
274 |
+
* @param Varien_Event_Observer $observer
|
275 |
+
* @return bool
|
276 |
+
* @throws Exception
|
277 |
+
*/
|
278 |
+
public function saveShipment(Varien_Event_Observer $observer)
|
279 |
+
{
|
280 |
+
Mage::log('--------------------------------------');
|
281 |
+
$event = $observer->getEvent();
|
282 |
+
/** @var $_shipment Mage_Sales_Model_Order_Shipment */
|
283 |
+
$_shipment = $event->getShipment();
|
284 |
+
|
285 |
+
/** @var $_order Mage_Sales_Model_Order */
|
286 |
+
$_order = $_shipment->getOrder();
|
287 |
+
|
288 |
+
$storeId = $_order->getStoreId();
|
289 |
+
|
290 |
+
$ceOrder = Mage::getModel('channelengine/order')->loadByOrderId($_order->getId());
|
291 |
+
$ceOrderId = $ceOrder->getChannelOrderId();
|
292 |
+
|
293 |
+
if(!$ceOrderId) return false;
|
294 |
+
|
295 |
+
// Check if the API client was initialized for this order
|
296 |
+
if(!isset($this->_client[$storeId])) return false;
|
297 |
+
|
298 |
+
// Initialize new ChannelEngine shipment object
|
299 |
+
$ceShipment = new Tritac_ChannelEngineApiClient_Models_Shipment();
|
300 |
+
$ceShipment->setOrderId($ceOrderId);
|
301 |
+
$ceShipment->setMerchantShipmentNo($_shipment->getId());
|
302 |
+
|
303 |
+
// Set tracking info if available
|
304 |
+
$trackingCode = null;
|
305 |
+
$trackingCodes = $_shipment->getAllTracks();
|
306 |
+
if(count($trackingCodes) > 0) {
|
307 |
+
|
308 |
+
$trackingCode = $trackingCodes[0];
|
309 |
+
$ceShipment->setTrackTraceNo($trackingCode->getNumber());
|
310 |
+
$ceShipment->setMethod($trackingCode->getTitle());
|
311 |
+
}
|
312 |
+
|
313 |
+
// If the shipment is already known to ChannelEngine we will just update it
|
314 |
+
$_channelShipment = Mage::getModel('channelengine/shipment')->loadByShipmentId($_shipment->getId());
|
315 |
+
|
316 |
+
if($_channelShipment->getId() != null) {
|
317 |
+
|
318 |
+
if($trackingCode != null) {
|
319 |
+
Mage::Log("TrackTrace: {$trackingCode->getNumber()}");
|
320 |
+
}
|
321 |
+
|
322 |
+
Mage::log("CE Shipment Id: #{$_channelShipment->getChannelengineShipmentId()}");
|
323 |
+
$ceShipment->setId($_channelShipment->getChannelengineShipmentId());
|
324 |
+
$this->_client[$storeId]->putShipment($ceShipment);
|
325 |
+
return true;
|
326 |
+
}
|
327 |
+
|
328 |
+
Mage::log('New shipment, continue');
|
329 |
+
|
330 |
+
// Add the shipment lines
|
331 |
+
$ceShipmentLines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ShipmentLine');
|
332 |
+
foreach($_shipment->getAllItems() as $_shipmentItem) {
|
333 |
+
|
334 |
+
// Get the quantity for this shipment
|
335 |
+
$shippedQty = (int)$_shipmentItem->getQty();
|
336 |
+
if($shippedQty == 0) continue;
|
337 |
+
|
338 |
+
// Get the original order item
|
339 |
+
$_orderItem = Mage::getModel('sales/order_item')->load($_shipmentItem->getOrderItemId());
|
340 |
+
if($_orderItem == null) continue;
|
341 |
+
|
342 |
+
$ceShipmentLine = new Tritac_ChannelEngineApiClient_Models_ShipmentLine();
|
343 |
+
$ceShipmentLine->setOrderLineId($_orderItem->getChannelengineOrderLineId());
|
344 |
+
$ceShipmentLine->setQuantity($shippedQty);
|
345 |
+
$ceShipmentLine->setStatus(Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus::SHIPPED);
|
346 |
+
|
347 |
+
$ceShipmentLines->append($ceShipmentLine);
|
348 |
+
}
|
349 |
+
|
350 |
+
// Check if there are any shipment lines
|
351 |
+
if(count($ceShipmentLines) == 0) return false;
|
352 |
+
|
353 |
+
$ceShipment->setLines($ceShipmentLines);
|
354 |
+
|
355 |
+
// Post shipment to ChannelEngine
|
356 |
+
try{
|
357 |
+
|
358 |
+
$result = $this->_client[$storeId]->postShipment($ceShipment);
|
359 |
+
if($result == null) return false;
|
360 |
+
|
361 |
+
$_channelShipment = Mage::getModel('channelengine/shipment')
|
362 |
+
->setShipmentId($_shipment->getId())
|
363 |
+
->setChannelengineShipmentId($result->getId());
|
364 |
+
$_channelShipment->save();
|
365 |
+
|
366 |
+
Mage::log("Shipment #{$_shipment->getId()} (CE #{$result->getId()}) was placed successfully.");
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
} catch(Exception $e) {
|
371 |
+
|
372 |
+
Mage::getModel('adminnotification/inbox')->addCritical(
|
373 |
+
"A shipment (#{$_shipment->getId()}) could not be exported",
|
374 |
+
"Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
375 |
+
);
|
376 |
+
|
377 |
+
Mage::logException($e);
|
378 |
+
|
379 |
+
}
|
380 |
+
|
381 |
+
|
382 |
+
return true;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Fetch new returns from channelengine
|
387 |
+
*
|
388 |
+
* @return bool
|
389 |
+
*/
|
390 |
+
public function fetchReturns()
|
391 |
+
{
|
392 |
+
/**
|
393 |
+
* Check if client is initialized
|
394 |
+
*/
|
395 |
+
if(is_null($this->_client))
|
396 |
+
return false;
|
397 |
+
|
398 |
+
foreach($this->_client as $storeId => $_client) {
|
399 |
+
/**
|
400 |
+
* Retrieve returns
|
401 |
+
*/
|
402 |
+
$returns = $_client->getReturns(array(
|
403 |
+
Tritac_ChannelEngineApiClient_Enums_ReturnStatus::DECLARED
|
404 |
+
));
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Check declared returns
|
408 |
+
*/
|
409 |
+
if(is_null($returns) || $returns->count() == 0)
|
410 |
+
return false;
|
411 |
+
|
412 |
+
foreach($returns as $return) {
|
413 |
+
$_channelOrder = Mage::getModel('channelengine/order')->loadByChannelOrderId($return->getOrderId());
|
414 |
+
$_order = Mage::getModel('sales/order')->load($_channelOrder->getOrderId());
|
415 |
+
|
416 |
+
if(!$_order->getIncrementId()) {
|
417 |
+
continue;
|
418 |
+
}
|
419 |
+
|
420 |
+
|
421 |
+
$link = "https://". $this->_config[$storeId]['general']['tenant'] .".channelengine.net/orders/view/". $return->getOrderId();
|
422 |
+
$status = $return->getStatus(); // Get return status
|
423 |
+
$reason = $return->getReason(); // Get return reason
|
424 |
+
$title = "A new return was declared in ChannelEngine (ChannelEngine Order #{$return->getOrderId()})";
|
425 |
+
$message = "Magento Order #: <a href='".
|
426 |
+
Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id'=>$_order->getOrderId())).
|
427 |
+
"'>".
|
428 |
+
$_order->getIncrementId().
|
429 |
+
"</a><br />";
|
430 |
+
$message .= "Status: {$status}<br />";
|
431 |
+
$message .= "Reason: {$reason}<br />";
|
432 |
+
$message .= "For more details visit ChannelEngine your <a href='".$link."' target='_blank'>account</a>";
|
433 |
+
|
434 |
+
// Check if notification is already exist
|
435 |
+
$_resource = Mage::getSingleton('core/resource');
|
436 |
+
$_connectionRead = $_resource->getConnection('core_read');
|
437 |
+
$select = $_connectionRead->select()
|
438 |
+
->from($_resource->getTableName('adminnotification/inbox'))
|
439 |
+
->where('title = ?', $title)
|
440 |
+
->where('is_remove != 1')
|
441 |
+
->limit(1);
|
442 |
+
$data = $_connectionRead->fetchRow($select);
|
443 |
+
|
444 |
+
if ($data) {
|
445 |
+
continue;
|
446 |
+
}
|
447 |
+
|
448 |
+
// Add new notification
|
449 |
+
Mage::getModel('adminnotification/inbox')->addCritical(
|
450 |
+
$title,
|
451 |
+
$message,
|
452 |
+
$link
|
453 |
+
);
|
454 |
+
}
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Generate products feed for ChannelEngine
|
460 |
+
*/
|
461 |
+
public function generateFeed()
|
462 |
+
{
|
463 |
+
$start_memory = memory_get_usage();
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Prepare categories array
|
467 |
+
*/
|
468 |
+
$categoryArray = array();
|
469 |
+
$parent = Mage::app()->getWebsite(true)->getDefaultStore()->getRootCategoryId();
|
470 |
+
$category = Mage::getModel('catalog/category');
|
471 |
+
if ($category->checkId($parent)) {
|
472 |
+
$storeCategories = $category->getCategories($parent, 0, true, true, true);
|
473 |
+
foreach($storeCategories as $_category) {
|
474 |
+
$categoryArray[$_category->getId()] = $_category->getData();
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Prepare products relation
|
480 |
+
*/
|
481 |
+
// $productsRelation = array();
|
482 |
+
// $_resource = Mage::getSingleton('core/resource');
|
483 |
+
// $_connection = $_resource->getConnection('core_read');
|
484 |
+
// $relations = $_connection->fetchAll("SELECT * FROM " . $_resource->getTableName('catalog/product_relation'));
|
485 |
+
// foreach($relations as $relation) {
|
486 |
+
// $productsRelation[$relation['child_id']] = $relation['parent_id'];
|
487 |
+
// }
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Export products from each store.
|
491 |
+
* Note: products with undefined website id will not be export.
|
492 |
+
*/
|
493 |
+
foreach(Mage::app()->getStores() as $_store) {
|
494 |
+
Mage::app()->setCurrentStore($_store);
|
495 |
+
$path = Mage::getBaseDir('media') . DS . 'channelengine' . DS;
|
496 |
+
$storeConfig = $this->_helper->getConfig($_store->getId());
|
497 |
+
$name = $storeConfig['general']['tenant'].'_products.xml';
|
498 |
+
$file = $path . DS . $name;
|
499 |
+
|
500 |
+
$io = new Varien_Io_File();
|
501 |
+
$io->setAllowCreateFolders(true);
|
502 |
+
$io->open(array('path' => $path));
|
503 |
+
$io->streamOpen($file, 'w+');
|
504 |
+
$io->streamLock(true);
|
505 |
+
$io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
|
506 |
+
$io->streamWrite('<Products xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . "\n");
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Prepare custom options array
|
510 |
+
*/
|
511 |
+
$storeId = $_store->getId();
|
512 |
+
$optionsArray = array();
|
513 |
+
$_options = Mage::getModel('catalog/product_option')
|
514 |
+
->getCollection()
|
515 |
+
->addTitleToResult($storeId)
|
516 |
+
->addPriceToResult($storeId)
|
517 |
+
->addValuesToResult($storeId)
|
518 |
+
->setOrder('sort_order', 'asc');
|
519 |
+
foreach($_options as $_option) {
|
520 |
+
$productId = $_option->getProductId();
|
521 |
+
$optionId = $_option->getOptionId();
|
522 |
+
$optionsArray[$productId][$optionId] = $_option->getData();
|
523 |
+
if($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
|
524 |
+
$optionsArray[$productId][$optionId]['values'] = $_option->getValues();
|
525 |
+
}
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Retrieve product collection with all visible attributes
|
530 |
+
*/
|
531 |
+
if(Mage::helper('catalog/product_flat')->isEnabled($storeId)) {
|
532 |
+
Mage::getResourceSingleton('catalog/product_flat')->setStoreId($storeId);
|
533 |
+
}
|
534 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
535 |
+
|
536 |
+
if(Mage::helper('catalog/product_flat')->isEnabled($storeId)) {
|
537 |
+
$collection->getEntity()->setStoreId($storeId);
|
538 |
+
}
|
539 |
+
|
540 |
+
$systemAttributes = $attributesToSelect = array(
|
541 |
+
'name',
|
542 |
+
'description',
|
543 |
+
'image',
|
544 |
+
'url_key',
|
545 |
+
'price',
|
546 |
+
'cost',
|
547 |
+
'special_price',
|
548 |
+
'special_from_date',
|
549 |
+
'special_to_date',
|
550 |
+
'visibility',
|
551 |
+
'msrp'
|
552 |
+
);
|
553 |
+
|
554 |
+
$visibleAttributes = array();
|
555 |
+
$attributes = Mage::getSingleton('eav/config')
|
556 |
+
->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
|
557 |
+
|
558 |
+
foreach($attributes as $attribute) {
|
559 |
+
if( ($attribute->getIsVisible() && $attribute->getIsVisibleOnFront())
|
560 |
+
|| in_array($attribute->getAttributeCode(), $systemAttributes))
|
561 |
+
{
|
562 |
+
$code = $attribute->getAttributeCode();
|
563 |
+
$visibleAttributes[$code]['label'] = $attribute->getFrontendLabel();
|
564 |
+
|
565 |
+
foreach( $attribute->getSource()->getAllOptions(false) as $option ) {
|
566 |
+
$visibleAttributes[$code]['values'][$option['value']] = $option['label'];
|
567 |
+
}
|
568 |
+
if(!in_array($code, $attributesToSelect)) {
|
569 |
+
$attributesToSelect[] = $code;
|
570 |
+
}
|
571 |
+
}
|
572 |
+
}
|
573 |
+
|
574 |
+
if(!empty($this->_config[$storeId]['feed']['gtin'])) {
|
575 |
+
$attributesToSelect[] = $this->_config[$storeId]['feed']['gtin'];
|
576 |
+
}
|
577 |
+
|
578 |
+
if( (count($attributesToSelect) > self::ATTRIBUTES_LIMIT) && !$collection->isEnabledFlat()) {
|
579 |
+
$error = $this->_helper->__('Too many visible attributes. Please enable catalog product flat mode.');
|
580 |
+
Mage::getSingleton('adminhtml/session')->addError($error);
|
581 |
+
echo 'redirect';
|
582 |
+
return false;
|
583 |
+
}
|
584 |
+
|
585 |
+
$collection->addAttributeToSelect($attributesToSelect, 'left')
|
586 |
+
->addFieldToFilter('type_id', array('in' => array('simple')))
|
587 |
+
->addStoreFilter($_store)
|
588 |
+
->addAttributeToFilter('status', 1)
|
589 |
+
->addAttributeToFilter('visibility', array('in' => array('2', '3', '4')))
|
590 |
+
->addAttributeToSort('entity_id', 'DESC');
|
591 |
+
|
592 |
+
// Add qty and category fields to select
|
593 |
+
$collection->getSelect()
|
594 |
+
->joinLeft(
|
595 |
+
array('csi' => Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_item')),
|
596 |
+
'`e`.`entity_id` = `csi`.`product_id`',
|
597 |
+
array('qty' => 'COALESCE(`qty`, 0)')
|
598 |
+
)
|
599 |
+
->joinLeft(
|
600 |
+
array('ccp' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product')),
|
601 |
+
'`e`.`entity_id` = `ccp`.`product_id`',
|
602 |
+
array('category_id' => 'MAX(`ccp`.`category_id`)')
|
603 |
+
)
|
604 |
+
->group('e.entity_id');
|
605 |
+
|
606 |
+
Mage::getSingleton('core/resource_iterator')->walk(
|
607 |
+
$collection->getSelect(),
|
608 |
+
array(array($this, 'callbackGenerateFeed')),
|
609 |
+
array(
|
610 |
+
'io' => $io,
|
611 |
+
'categories' => $categoryArray,
|
612 |
+
'attributes' => $visibleAttributes,
|
613 |
+
'systemAttributes' => $systemAttributes,
|
614 |
+
'options' => $optionsArray,
|
615 |
+
'store' => $_store,
|
616 |
+
'startMemory' => $start_memory,
|
617 |
+
)
|
618 |
+
);
|
619 |
+
|
620 |
+
$collection->clear()->getSelect()->reset('where');
|
621 |
+
$collection->addFieldToFilter('type_id', array('in' => array('configurable')))
|
622 |
+
->addStoreFilter($_store)
|
623 |
+
->addAttributeToFilter('status', 1)
|
624 |
+
->addAttributeToSort('entity_id', 'DESC');
|
625 |
+
|
626 |
+
foreach($collection as $_product) {
|
627 |
+
$productAttributeOptions = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
|
628 |
+
$superAttributes = array();
|
629 |
+
|
630 |
+
foreach($productAttributeOptions as $superAttribute) {
|
631 |
+
foreach($superAttribute['values'] as $value) {
|
632 |
+
$superAttributes[$superAttribute['attribute_code']][$value['value_index']] = $value;
|
633 |
+
}
|
634 |
+
}
|
635 |
+
|
636 |
+
$parentData = $_product->getData();
|
637 |
+
$parentData['id'] = $parentData['entity_id'];
|
638 |
+
|
639 |
+
$productModel = Mage::getModel('catalog/product');
|
640 |
+
$productModel->setData('entity_id', $parentData['entity_id']);
|
641 |
+
$productModel->setData('url_key', $parentData['url_key']);
|
642 |
+
$productModel->setData('store_id', $parentData['store_id']);
|
643 |
+
$parentData['url'] = $productModel->getProductUrl();
|
644 |
+
|
645 |
+
$specialPrice = $parentData['special_price'];
|
646 |
+
$specialFrom = $parentData['special_from_date'];
|
647 |
+
$specialTo = $parentData['special_to_date'];
|
648 |
+
$parentData['price'] = Mage::getModel('catalog/product_type_price')
|
649 |
+
->calculateSpecialPrice($parentData['price'], $specialPrice, $specialFrom, $specialTo, $storeId);
|
650 |
+
|
651 |
+
$xml = $this->_getProductXml($parentData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
|
652 |
+
$_childProducts = Mage::getModel('catalog/product_type_configurable')
|
653 |
+
->getUsedProducts(null, $_product);
|
654 |
+
|
655 |
+
foreach($_childProducts as $_child) {
|
656 |
+
$childData = $_child->getData();
|
657 |
+
$childData['id'] = $childData['entity_id'];
|
658 |
+
$childData['parent_id'] = $parentData['id'];
|
659 |
+
$childData['price'] = $parentData['price'];
|
660 |
+
$childData['url'] = $parentData['url'];
|
661 |
+
$childData['description'] = $parentData['description'];
|
662 |
+
|
663 |
+
if(!isset($childData['image']) || $childData['image'] == 'no_slection') {
|
664 |
+
$childData['image'] = $parentData['image'];
|
665 |
+
}
|
666 |
+
|
667 |
+
foreach($superAttributes as $code => $superAttribute) {
|
668 |
+
if(isset($childData[$code])) {
|
669 |
+
$priceValue = $superAttribute[$childData[$code]]['pricing_value'];
|
670 |
+
if($superAttribute[$childData[$code]]['is_percent']) {
|
671 |
+
$newPrice = $childData['price'] + $childData['price'] * $priceValue / 100;
|
672 |
+
} else {
|
673 |
+
$newPrice = $childData['price'] + $priceValue;
|
674 |
+
}
|
675 |
+
$childData['price'] = $newPrice;
|
676 |
+
}
|
677 |
+
}
|
678 |
+
$xml .= $this->_getProductXml($childData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
|
679 |
+
}
|
680 |
+
$io->streamWrite($xml);
|
681 |
+
}
|
682 |
+
|
683 |
+
|
684 |
+
$io->streamWrite('</Products>');
|
685 |
+
$io->streamUnlock();
|
686 |
+
$io->streamClose();
|
687 |
+
|
688 |
+
Mage::log("Product feed {$name} was generated successfully");
|
689 |
+
}
|
690 |
+
|
691 |
+
return true;
|
692 |
+
}
|
693 |
+
|
694 |
+
public function callbackGenerateFeed($args)
|
695 |
+
{
|
696 |
+
$io = $args['io'];
|
697 |
+
$product = $args['row'];
|
698 |
+
$attributes = $args['attributes'];
|
699 |
+
$systemAttributes = $args['systemAttributes'];
|
700 |
+
$categories = $args['categories'];
|
701 |
+
$options = $args['options'];
|
702 |
+
$_store = $args['store'];
|
703 |
+
$storeId = $_store->getId();
|
704 |
+
|
705 |
+
$xml = '';
|
706 |
+
|
707 |
+
$product['store_id'] = $storeId;
|
708 |
+
if(!empty($this->_config[$storeId]['feed']['gtin'])) {
|
709 |
+
$product['gtin'] = $product[$this->_config[$storeId]['feed']['gtin']];
|
710 |
+
}
|
711 |
+
|
712 |
+
$specialPrice = $product['special_price'];
|
713 |
+
$specialFrom = $product['special_from_date'];
|
714 |
+
$specialTo = $product['special_to_date'];
|
715 |
+
$product['price'] = Mage::getModel('catalog/product_type_price')
|
716 |
+
->calculateSpecialPrice($product['price'], $specialPrice, $specialFrom, $specialTo, $storeId);
|
717 |
+
|
718 |
+
$productModel = Mage::getModel('catalog/product');
|
719 |
+
$productModel->setData('entity_id', $product['entity_id']);
|
720 |
+
$productModel->setData('url_key', $product['url_key']);
|
721 |
+
$productModel->setData('store_id', $product['store_id']);
|
722 |
+
$product['url'] = $productModel->getProductUrl();
|
723 |
+
|
724 |
+
/**
|
725 |
+
* Add product custom options to feed.
|
726 |
+
* Each option value will generate new product row
|
727 |
+
*/
|
728 |
+
$additional['systemAttributes'] = $systemAttributes;
|
729 |
+
$additional['attributes'] = $attributes;
|
730 |
+
if(isset($options[$product['entity_id']])) {
|
731 |
+
$product['group_code'] = $product['entity_id'];
|
732 |
+
foreach($options[$product['entity_id']] as $option) {
|
733 |
+
if(isset($option['values'])) {
|
734 |
+
foreach($option['values'] as $_value) {
|
735 |
+
$product['id'] = $product['entity_id'].'_'.$option['option_id'].'_'.$_value->getId();
|
736 |
+
$additional['title'] = str_replace(' ', '_', $option['default_title']);
|
737 |
+
$additional['value'] = $_value->getDefaultTitle();
|
738 |
+
$xml .= $this->_getProductXml($product, $categories, $additional);
|
739 |
+
}
|
740 |
+
} else {
|
741 |
+
$product['id'] = $product['entity_id'].'_'.$option['option_id'];
|
742 |
+
$additional['title'] = str_replace(' ', '_', $option['default_title']);
|
743 |
+
$additional['value'] = '';
|
744 |
+
$xml .= $this->_getProductXml($product, $categories, $additional);
|
745 |
+
}
|
746 |
+
}
|
747 |
+
}else {
|
748 |
+
$product['id'] = $product['entity_id'];
|
749 |
+
$xml .= $this->_getProductXml($product, $categories, $additional);
|
750 |
+
}
|
751 |
+
|
752 |
+
$io->streamWrite($xml);
|
753 |
+
}
|
754 |
+
|
755 |
+
protected function _getProductXml($product, $categories, $additional = null)
|
756 |
+
{
|
757 |
+
$xml = "<Product>";
|
758 |
+
$xml .= "<Id>".$product['id']."</Id>";
|
759 |
+
|
760 |
+
// Add group code with product id if product have custom options
|
761 |
+
if(isset($product['group_code'])) {
|
762 |
+
$xml .= "<GroupCode><![CDATA[".$product['group_code']."]]></GroupCode>";
|
763 |
+
}
|
764 |
+
if(isset($product['parent_id'])) {
|
765 |
+
$xml .= "<ParentId><![CDATA[".$product['parent_id']."]]></ParentId>";
|
766 |
+
}
|
767 |
+
$xml .= "<Type><![CDATA[".$product['type_id']."]]></Type>";
|
768 |
+
$xml .= "<Name><![CDATA[".$product['name']."]]></Name>";
|
769 |
+
$xml .= "<Description><![CDATA[".$product['description']."]]></Description>";
|
770 |
+
$xml .= "<Price><![CDATA[".$product['price']."]]></Price>";
|
771 |
+
$xml .= "<ListPrice><![CDATA[".$product['msrp']."]]></ListPrice>";
|
772 |
+
$xml .= "<PurchasePrice><![CDATA[".$product['cost']."]]></PurchasePrice>";
|
773 |
+
|
774 |
+
// Add product stock qty
|
775 |
+
$xml .= "<Stock><![CDATA[".$product['qty']."]]></Stock>";
|
776 |
+
// Add product SKU and GTIN
|
777 |
+
$xml .= "<SKU><![CDATA[".$product['sku']."]]></SKU>";
|
778 |
+
if(!empty($product['gtin'])) {
|
779 |
+
$xml .= "<GTIN><![CDATA[".$product['gtin']."]]></GTIN>";
|
780 |
+
}
|
781 |
+
|
782 |
+
// VAT and Shipping Time are pre configured in extension settings
|
783 |
+
if(!empty($this->_config[$product['store_id']]['feed']['vat_rate'])) {
|
784 |
+
$vat = $this->_config[$product['store_id']]['feed']['vat_rate'];
|
785 |
+
$xml .= "<VAT><![CDATA[".$vat."]]></VAT>";
|
786 |
+
}
|
787 |
+
|
788 |
+
$shippingTime = ($product['qty'] > 0) ? $this->_config[$product['store_id']]['feed']['shipping_time'] : $this->_config[$product['store_id']]['feed']['shipping_time_oos'];
|
789 |
+
|
790 |
+
if($shippingTime) {
|
791 |
+
$xml .= "<ShippingTime><![CDATA[".$shippingTime."]]></ShippingTime>";
|
792 |
+
}
|
793 |
+
|
794 |
+
$xml .= "<Url><![CDATA[".$product['url']."]]></Url>";
|
795 |
+
|
796 |
+
if(isset($product['image']) && $product['image'] != 'no_selection') {
|
797 |
+
$imgUrl = Mage::getSingleton('catalog/product_media_config')->getMediaUrl($product['image']);
|
798 |
+
$xml .= "<ImageUrl><![CDATA[".$imgUrl."]]></ImageUrl>";
|
799 |
+
}
|
800 |
+
|
801 |
+
// Prepare category path
|
802 |
+
if(!empty($product['category_id']) && !empty($categories)) {
|
803 |
+
$categoryId = $product['category_id'];
|
804 |
+
$categoryPathIds = explode('/', $categories[$categoryId]['path']);
|
805 |
+
$categoryPath = null;
|
806 |
+
foreach($categoryPathIds as $id) {
|
807 |
+
if($id > 2) {
|
808 |
+
$categoryPath .= ($categoryPath) ? ' > ':'';
|
809 |
+
$categoryPath .= $categories[$id]['name'];
|
810 |
+
}
|
811 |
+
}
|
812 |
+
if($categoryPath) {
|
813 |
+
$xml .= "<Category><![CDATA[".$categoryPath."]]></Category>";
|
814 |
+
}
|
815 |
+
}
|
816 |
+
|
817 |
+
if(isset($additional['title']) && isset($additional['value'])) {
|
818 |
+
$title = preg_replace("/[^a-zA-Z0-9]/", "", $additional['title']);
|
819 |
+
$xml .= sprintf("<%1\$s><![CDATA[%2\$s]]></%1\$s>",
|
820 |
+
$title,
|
821 |
+
$additional['value']
|
822 |
+
);
|
823 |
+
}
|
824 |
+
|
825 |
+
/*
|
826 |
+
* Prepare product visible attributes
|
827 |
+
*/
|
828 |
+
if(isset($additional['attributes'])) {
|
829 |
+
$xml .= '<Attributes>';
|
830 |
+
foreach($additional['attributes'] as $code => $attribute) {
|
831 |
+
if(isset($product[$code]) && !in_array($code, $additional['systemAttributes'])) {
|
832 |
+
$xml .= "<".$code.">";
|
833 |
+
/*$xml .= "<label><![CDATA[".$attribute['label']."]]></label>";
|
834 |
+
if(!empty($attribute['values'])) {
|
835 |
+
$xml .= "<value><![CDATA[".$attribute['values'][$product[$code]]."]]></value>";
|
836 |
+
} else {
|
837 |
+
$xml .= "<value><![CDATA[".$product[$code]."]]></value>";
|
838 |
+
}*/
|
839 |
+
if(!empty($attribute['values'])) {
|
840 |
+
$xml .= "<![CDATA[".$attribute['values'][$product[$code]]."]]>";
|
841 |
+
} else {
|
842 |
+
$xml .= "<![CDATA[".$product[$code]."]]>";
|
843 |
+
}
|
844 |
+
$xml .= "</".$code.">";
|
845 |
+
}
|
846 |
+
}
|
847 |
+
$xml .= '</Attributes>';
|
848 |
+
}
|
849 |
+
|
850 |
+
$xml .= "</Product>\n";
|
851 |
+
|
852 |
+
return $xml;
|
853 |
+
}
|
854 |
+
|
855 |
+
public function addConfigurableProducts($collection)
|
856 |
+
{
|
857 |
+
|
858 |
+
}
|
859 |
+
|
860 |
+
/**
|
861 |
+
* Join channelengine order fields to adminhtml order grid
|
862 |
+
*
|
863 |
+
* @param $observer
|
864 |
+
*/
|
865 |
+
/*public function prepareOrderGridCollection($observer)
|
866 |
+
{
|
867 |
+
$collection = $observer->getOrderGridCollection();
|
868 |
+
$joinTableName = Mage::getSingleton('core/resource')->getTableName('channelengine/order');
|
869 |
+
$collection->getSelect()->joinLeft(
|
870 |
+
array('channel_order_table' => $joinTableName),
|
871 |
+
'channel_order_table.order_id=main_table.entity_id',
|
872 |
+
array('channel_name', 'channel_order_id')
|
873 |
+
);
|
874 |
+
}*/
|
875 |
+
|
876 |
+
/**
|
877 |
+
* Add channelengine order fields to adminhtml order grid
|
878 |
+
*
|
879 |
+
* @param $observer
|
880 |
+
* @return $this
|
881 |
+
*/
|
882 |
+
/*public function appendCustomColumnToOrderGrid($observer)
|
883 |
+
{
|
884 |
+
$block = $observer->getBlock();
|
885 |
+
if (!isset($block)) {
|
886 |
+
return $this;
|
887 |
+
}
|
888 |
+
|
889 |
+
if ($block->getType() == 'adminhtml/sales_order_grid') {
|
890 |
+
$block->addColumnAfter('channel_order_id', array(
|
891 |
+
'header'=> Mage::helper('sales')->__('ChannelEngine Order ID'),
|
892 |
+
'width' => '80px',
|
893 |
+
'type' => 'text',
|
894 |
+
'index' => 'channel_order_id',
|
895 |
+
), 'real_order_id');
|
896 |
+
|
897 |
+
$block->addColumnAfter('channel_name', array(
|
898 |
+
'header'=> Mage::helper('sales')->__('Channel Name'),
|
899 |
+
'width' => '80px',
|
900 |
+
'type' => 'text',
|
901 |
+
'index' => 'channel_name',
|
902 |
+
), 'real_order_id');
|
903 |
+
}
|
904 |
+
}*/
|
905 |
+
}
|
app/code/community/Tritac/ChannelEngine/Model/Order.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Order extends Mage_Core_Model_Abstract {
|
3 |
-
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('channelengine/order');
|
7 |
-
}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Load channel order by magento order ID
|
11 |
-
*
|
12 |
-
* @param $orderId
|
13 |
-
* @return Tritac_ChannelEngine_Model_Order
|
14 |
-
*/
|
15 |
-
public function loadByOrderId($orderId)
|
16 |
-
{
|
17 |
-
$this->_getResource()->loadByOrderId($this, $orderId);
|
18 |
-
return $this;
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Load channel order by channel order ID
|
23 |
-
*
|
24 |
-
* @param $orderId
|
25 |
-
* @return Tritac_ChannelEngine_Model_Order
|
26 |
-
*/
|
27 |
-
public function loadByChannelOrderId($orderId)
|
28 |
-
{
|
29 |
-
$this->_getResource()->loadByChannelOrderId($this, $orderId);
|
30 |
-
return $this;
|
31 |
-
}
|
32 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Order extends Mage_Core_Model_Abstract {
|
3 |
+
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('channelengine/order');
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Load channel order by magento order ID
|
11 |
+
*
|
12 |
+
* @param $orderId
|
13 |
+
* @return Tritac_ChannelEngine_Model_Order
|
14 |
+
*/
|
15 |
+
public function loadByOrderId($orderId)
|
16 |
+
{
|
17 |
+
$this->_getResource()->loadByOrderId($this, $orderId);
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Load channel order by channel order ID
|
23 |
+
*
|
24 |
+
* @param $orderId
|
25 |
+
* @return Tritac_ChannelEngine_Model_Order
|
26 |
+
*/
|
27 |
+
public function loadByChannelOrderId($orderId)
|
28 |
+
{
|
29 |
+
$this->_getResource()->loadByChannelOrderId($this, $orderId);
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Payment/Method/Channelengine.php
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* ChannelEngine Payment Method
|
4 |
-
*/
|
5 |
-
class Tritac_ChannelEngine_Model_Payment_Method_Channelengine extends Mage_Payment_Model_Method_Abstract {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* System payment method code
|
9 |
-
*
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
protected $_code = 'channelengine';
|
13 |
-
|
14 |
-
public function isAvailable($quote = null)
|
15 |
-
{
|
16 |
-
if($quote->getIsSystem() && $quote->getPayment()->getMethod() == $this->_code) {
|
17 |
-
return true;
|
18 |
-
}
|
19 |
-
|
20 |
-
return false;
|
21 |
-
}
|
22 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ChannelEngine Payment Method
|
4 |
+
*/
|
5 |
+
class Tritac_ChannelEngine_Model_Payment_Method_Channelengine extends Mage_Payment_Model_Method_Abstract {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* System payment method code
|
9 |
+
*
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
protected $_code = 'channelengine';
|
13 |
+
|
14 |
+
public function isAvailable($quote = null)
|
15 |
+
{
|
16 |
+
if($quote->getIsSystem() && $quote->getPayment()->getMethod() == $this->_code) {
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
|
20 |
+
return false;
|
21 |
+
}
|
22 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Resource/Order.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract {
|
3 |
-
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('channelengine/order', 'entity_id');
|
7 |
-
}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Load channel order by magento order ID
|
11 |
-
*
|
12 |
-
* @param Tritac_ChannelEngine_Model_Order $order
|
13 |
-
* @param int $orderId
|
14 |
-
* @return Tritac_ChannelEngine_Model_Resource_Order
|
15 |
-
*/
|
16 |
-
public function loadByOrderId(Tritac_ChannelEngine_Model_Order $order, $orderId)
|
17 |
-
{
|
18 |
-
|
19 |
-
$adapter = $this->_getReadAdapter();
|
20 |
-
$bind = array('order_id' => $orderId);
|
21 |
-
$select = $adapter->select()
|
22 |
-
->from($this->getMainTable(), array($this->getIdFieldName()))
|
23 |
-
->where('order_id = :order_id');
|
24 |
-
|
25 |
-
$entityId = $adapter->fetchOne($select, $bind);
|
26 |
-
if ($entityId) {
|
27 |
-
$this->load($order, $entityId );
|
28 |
-
} else {
|
29 |
-
$order->setData(array());
|
30 |
-
}
|
31 |
-
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Load channel order by channel order ID
|
37 |
-
*
|
38 |
-
* @param Tritac_ChannelEngine_Model_Order $order
|
39 |
-
* @param int $orderId
|
40 |
-
* @return Tritac_ChannelEngine_Model_Resource_Order
|
41 |
-
*/
|
42 |
-
public function loadByChannelOrderId(Tritac_ChannelEngine_Model_Order $order, $orderId)
|
43 |
-
{
|
44 |
-
|
45 |
-
$adapter = $this->_getReadAdapter();
|
46 |
-
$bind = array('channel_order_id' => $orderId);
|
47 |
-
$select = $adapter->select()
|
48 |
-
->from($this->getMainTable(), array($this->getIdFieldName()))
|
49 |
-
->where('channel_order_id = :channel_order_id');
|
50 |
-
|
51 |
-
$entityId = $adapter->fetchOne($select, $bind);
|
52 |
-
if ($entityId) {
|
53 |
-
$this->load($order, $entityId );
|
54 |
-
} else {
|
55 |
-
$order->setData(array());
|
56 |
-
}
|
57 |
-
|
58 |
-
return $this;
|
59 |
-
}
|
60 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract {
|
3 |
+
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('channelengine/order', 'entity_id');
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Load channel order by magento order ID
|
11 |
+
*
|
12 |
+
* @param Tritac_ChannelEngine_Model_Order $order
|
13 |
+
* @param int $orderId
|
14 |
+
* @return Tritac_ChannelEngine_Model_Resource_Order
|
15 |
+
*/
|
16 |
+
public function loadByOrderId(Tritac_ChannelEngine_Model_Order $order, $orderId)
|
17 |
+
{
|
18 |
+
|
19 |
+
$adapter = $this->_getReadAdapter();
|
20 |
+
$bind = array('order_id' => $orderId);
|
21 |
+
$select = $adapter->select()
|
22 |
+
->from($this->getMainTable(), array($this->getIdFieldName()))
|
23 |
+
->where('order_id = :order_id');
|
24 |
+
|
25 |
+
$entityId = $adapter->fetchOne($select, $bind);
|
26 |
+
if ($entityId) {
|
27 |
+
$this->load($order, $entityId );
|
28 |
+
} else {
|
29 |
+
$order->setData(array());
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Load channel order by channel order ID
|
37 |
+
*
|
38 |
+
* @param Tritac_ChannelEngine_Model_Order $order
|
39 |
+
* @param int $orderId
|
40 |
+
* @return Tritac_ChannelEngine_Model_Resource_Order
|
41 |
+
*/
|
42 |
+
public function loadByChannelOrderId(Tritac_ChannelEngine_Model_Order $order, $orderId)
|
43 |
+
{
|
44 |
+
|
45 |
+
$adapter = $this->_getReadAdapter();
|
46 |
+
$bind = array('channel_order_id' => $orderId);
|
47 |
+
$select = $adapter->select()
|
48 |
+
->from($this->getMainTable(), array($this->getIdFieldName()))
|
49 |
+
->where('channel_order_id = :channel_order_id');
|
50 |
+
|
51 |
+
$entityId = $adapter->fetchOne($select, $bind);
|
52 |
+
if ($entityId) {
|
53 |
+
$this->load($order, $entityId );
|
54 |
+
} else {
|
55 |
+
$order->setData(array());
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Resource/Order/Collection.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
-
|
4 |
-
protected function _construct() {
|
5 |
-
$this->_init('channelengine/order');
|
6 |
-
}
|
7 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('channelengine/order');
|
6 |
+
}
|
7 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Resource/Setup.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngine_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup {
|
4 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngine_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup {
|
4 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Resource/Shipment.php
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Resource_Shipment extends Mage_Core_Model_Resource_Db_Abstract {
|
3 |
-
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('channelengine/shipment', 'entity_id');
|
7 |
-
}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Load channel shipment by magento shipment ID
|
11 |
-
*
|
12 |
-
* @param Tritac_ChannelEngine_Model_Shipment $shipment
|
13 |
-
* @param int $shipmentId
|
14 |
-
* @return Tritac_ChannelEngine_Model_Resource_Shipment
|
15 |
-
*/
|
16 |
-
public function loadByShipmentId(Tritac_ChannelEngine_Model_Shipment $shipment, $shipmentId)
|
17 |
-
{
|
18 |
-
|
19 |
-
$adapter = $this->_getReadAdapter();
|
20 |
-
$bind = array('shipment_id' => $shipmentId);
|
21 |
-
$select = $adapter->select()
|
22 |
-
->from($this->getMainTable(), array($this->getIdFieldName()))
|
23 |
-
->where('shipment_id = :shipment_id');
|
24 |
-
|
25 |
-
$entityId = $adapter->fetchOne($select, $bind);
|
26 |
-
if ($entityId) {
|
27 |
-
$this->load($shipment, $entityId );
|
28 |
-
} else {
|
29 |
-
$shipment->setData(array());
|
30 |
-
}
|
31 |
-
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Resource_Shipment extends Mage_Core_Model_Resource_Db_Abstract {
|
3 |
+
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('channelengine/shipment', 'entity_id');
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Load channel shipment by magento shipment ID
|
11 |
+
*
|
12 |
+
* @param Tritac_ChannelEngine_Model_Shipment $shipment
|
13 |
+
* @param int $shipmentId
|
14 |
+
* @return Tritac_ChannelEngine_Model_Resource_Shipment
|
15 |
+
*/
|
16 |
+
public function loadByShipmentId(Tritac_ChannelEngine_Model_Shipment $shipment, $shipmentId)
|
17 |
+
{
|
18 |
+
|
19 |
+
$adapter = $this->_getReadAdapter();
|
20 |
+
$bind = array('shipment_id' => $shipmentId);
|
21 |
+
$select = $adapter->select()
|
22 |
+
->from($this->getMainTable(), array($this->getIdFieldName()))
|
23 |
+
->where('shipment_id = :shipment_id');
|
24 |
+
|
25 |
+
$entityId = $adapter->fetchOne($select, $bind);
|
26 |
+
if ($entityId) {
|
27 |
+
$this->load($shipment, $entityId );
|
28 |
+
} else {
|
29 |
+
$shipment->setData(array());
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Resource/Shipment/Collection.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Resource_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
-
|
4 |
-
protected function _construct() {
|
5 |
-
$this->_init('channelengine/shipment');
|
6 |
-
}
|
7 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Resource_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('channelengine/shipment');
|
6 |
+
}
|
7 |
}
|
app/code/community/Tritac/ChannelEngine/Model/Shipment.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_Shipment extends Mage_Core_Model_Abstract {
|
3 |
-
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('channelengine/shipment');
|
7 |
-
}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Load channel shipment by magento shipment ID
|
11 |
-
*
|
12 |
-
* @param $shipmentId
|
13 |
-
* @return Tritac_ChannelEngine_Model_Shipment
|
14 |
-
*/
|
15 |
-
public function loadByShipmentId($shipmentId)
|
16 |
-
{
|
17 |
-
$this->_getResource()->loadByShipmentId($this, $shipmentId);
|
18 |
-
return $this;
|
19 |
-
}
|
20 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_Shipment extends Mage_Core_Model_Abstract {
|
3 |
+
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('channelengine/shipment');
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Load channel shipment by magento shipment ID
|
11 |
+
*
|
12 |
+
* @param $shipmentId
|
13 |
+
* @return Tritac_ChannelEngine_Model_Shipment
|
14 |
+
*/
|
15 |
+
public function loadByShipmentId($shipmentId)
|
16 |
+
{
|
17 |
+
$this->_getResource()->loadByShipmentId($this, $shipmentId);
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
}
|
app/code/community/Tritac/ChannelEngine/Model/System/Config/Source/Gtin.php
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category Tritac
|
4 |
-
* @package Tritac_ChannelEngine
|
5 |
-
* @copyright Copyright (c) 2014 ChannelEngine. (http://www.channelengine.com)
|
6 |
-
*/
|
7 |
-
|
8 |
-
class Tritac_ChannelEngine_Model_System_Config_Source_Gtin
|
9 |
-
{
|
10 |
-
protected $_options;
|
11 |
-
|
12 |
-
public function toOptionArray()
|
13 |
-
{
|
14 |
-
if (!$this->_options) {
|
15 |
-
$this->_options[] = array('value'=> '', 'label'=> Mage::helper('adminhtml')->__('-- Please Select --'));
|
16 |
-
$attributes = Mage::getSingleton('eav/config')
|
17 |
-
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
|
18 |
-
->getAttributeCollection()
|
19 |
-
->addFieldToFilter('backend_type', array('in' => array('static', 'varchar', 'text')))
|
20 |
-
->addFieldToFilter('frontend_input', array('in' => array('text', 'textarea')))
|
21 |
-
->setOrder('frontend_label', 'ASC');
|
22 |
-
|
23 |
-
foreach($attributes as $attribute) {
|
24 |
-
$value = $attribute->getAttributeCode();
|
25 |
-
$label = ($attribute->getFrontendLabel()) ? $attribute->getFrontendLabel() : $value;
|
26 |
-
$this->_options[] = array('value'=> $value, 'label'=> $label);
|
27 |
-
}
|
28 |
-
}
|
29 |
-
return $this->_options;
|
30 |
-
}
|
31 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Tritac
|
4 |
+
* @package Tritac_ChannelEngine
|
5 |
+
* @copyright Copyright (c) 2014 ChannelEngine. (http://www.channelengine.com)
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Tritac_ChannelEngine_Model_System_Config_Source_Gtin
|
9 |
+
{
|
10 |
+
protected $_options;
|
11 |
+
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
if (!$this->_options) {
|
15 |
+
$this->_options[] = array('value'=> '', 'label'=> Mage::helper('adminhtml')->__('-- Please Select --'));
|
16 |
+
$attributes = Mage::getSingleton('eav/config')
|
17 |
+
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
|
18 |
+
->getAttributeCollection()
|
19 |
+
->addFieldToFilter('backend_type', array('in' => array('static', 'varchar', 'text')))
|
20 |
+
->addFieldToFilter('frontend_input', array('in' => array('text', 'textarea')))
|
21 |
+
->setOrder('frontend_label', 'ASC');
|
22 |
+
|
23 |
+
foreach($attributes as $attribute) {
|
24 |
+
$value = $attribute->getAttributeCode();
|
25 |
+
$label = ($attribute->getFrontendLabel()) ? $attribute->getFrontendLabel() : $value;
|
26 |
+
$this->_options[] = array('value'=> $value, 'label'=> $label);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $this->_options;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Tritac/ChannelEngine/Model/System/Config/Source/Shipping.php
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Model_System_Config_Source_Shipping {
|
3 |
-
|
4 |
-
protected $_options = null;
|
5 |
-
|
6 |
-
public function toOptionArray() {
|
7 |
-
|
8 |
-
if(is_null($this->_options)) {
|
9 |
-
$_activeCarriers = Mage::getModel('shipping/config')->getActiveCarriers();
|
10 |
-
|
11 |
-
foreach($_activeCarriers as $carrierCode => $_carrier) {
|
12 |
-
|
13 |
-
if($_methods = $_carrier->getAllowedMethods()) {
|
14 |
-
|
15 |
-
if(!$title = Mage::getStoreConfig("carriers/{$_carrier->getId()}/title")) {
|
16 |
-
$title = $carrierCode;
|
17 |
-
}
|
18 |
-
|
19 |
-
$methods = array();
|
20 |
-
|
21 |
-
foreach($_methods as $methodCode => $method) {
|
22 |
-
|
23 |
-
$methods[] = array(
|
24 |
-
'label' => $title.' – '.$method,
|
25 |
-
'value' => $carrierCode.'_'.$methodCode
|
26 |
-
);
|
27 |
-
}
|
28 |
-
|
29 |
-
$this->_options[] = array(
|
30 |
-
'label' => $title,
|
31 |
-
'value' => $methods
|
32 |
-
);
|
33 |
-
}
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
return $this->_options;
|
38 |
-
|
39 |
-
}
|
40 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Model_System_Config_Source_Shipping {
|
3 |
+
|
4 |
+
protected $_options = null;
|
5 |
+
|
6 |
+
public function toOptionArray() {
|
7 |
+
|
8 |
+
if(is_null($this->_options)) {
|
9 |
+
$_activeCarriers = Mage::getModel('shipping/config')->getActiveCarriers();
|
10 |
+
|
11 |
+
foreach($_activeCarriers as $carrierCode => $_carrier) {
|
12 |
+
|
13 |
+
if($_methods = $_carrier->getAllowedMethods()) {
|
14 |
+
|
15 |
+
if(!$title = Mage::getStoreConfig("carriers/{$_carrier->getId()}/title")) {
|
16 |
+
$title = $carrierCode;
|
17 |
+
}
|
18 |
+
|
19 |
+
$methods = array();
|
20 |
+
|
21 |
+
foreach($_methods as $methodCode => $method) {
|
22 |
+
|
23 |
+
$methods[] = array(
|
24 |
+
'label' => $title.' – '.$method,
|
25 |
+
'value' => $carrierCode.'_'.$methodCode
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
$this->_options[] = array(
|
30 |
+
'label' => $title,
|
31 |
+
'value' => $methods
|
32 |
+
);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return $this->_options;
|
38 |
+
|
39 |
+
}
|
40 |
}
|
app/code/community/Tritac/ChannelEngine/controllers/Adminhtml/GenerateController.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngine_Adminhtml_GenerateController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
public function ajaxAction() {
|
5 |
-
|
6 |
-
$observer = Mage::getModel('channelengine/observer');
|
7 |
-
|
8 |
-
if($observer->generateFeed()) {
|
9 |
-
$this->getResponse()->setBody(1);
|
10 |
-
}
|
11 |
-
}
|
12 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngine_Adminhtml_GenerateController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function ajaxAction() {
|
5 |
+
|
6 |
+
$observer = Mage::getModel('channelengine/observer');
|
7 |
+
|
8 |
+
if($observer->generateFeed()) {
|
9 |
+
$this->getResponse()->setBody(1);
|
10 |
+
}
|
11 |
+
}
|
12 |
}
|
app/code/community/Tritac/ChannelEngine/controllers/TestController.php
DELETED
@@ -1,372 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Test Controller
|
4 |
-
*/
|
5 |
-
class Tritac_ChannelEngine_TestController extends Mage_Core_Controller_Front_Action {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Index action
|
9 |
-
*/
|
10 |
-
public function indexAction(){
|
11 |
-
|
12 |
-
$apiKey = Mage::getStoreConfig('channelengine/general/api_key');
|
13 |
-
$apiSecret = Mage::getStoreConfig('channelengine/general/api_secret');
|
14 |
-
|
15 |
-
$this->client = new Tritac_ChannelEngineApiClient_Client($apiKey, $apiSecret, 'plugindev');
|
16 |
-
|
17 |
-
$orders = $this->client->getOrders(array(Tritac_ChannelEngineApiClient_Enums_OrderStatus::IN_PROGRESS));
|
18 |
-
|
19 |
-
if(!is_null($orders))
|
20 |
-
{
|
21 |
-
foreach($orders as $order)
|
22 |
-
{
|
23 |
-
$billingAddress = $order->getBillingAddress();
|
24 |
-
if(empty($billingAddress)) continue;
|
25 |
-
|
26 |
-
$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore()->getId());
|
27 |
-
|
28 |
-
$lines = $order->getLines();
|
29 |
-
if(!empty($lines)){
|
30 |
-
foreach($lines as $item){
|
31 |
-
// Load magento product
|
32 |
-
$_product = Mage::getModel('catalog/product')
|
33 |
-
->setStoreId(Mage::app()->getStore()->getId());
|
34 |
-
$productNo = $item->getMerchantProductNo();
|
35 |
-
$ids = explode('_', $productNo);
|
36 |
-
$productOptions = array();
|
37 |
-
if(count($ids) == 3) {
|
38 |
-
$productOptions = array($ids[1] => $ids[2]);
|
39 |
-
}
|
40 |
-
//$productId = $_product->getIdBySku();
|
41 |
-
$_product->load($ids[0]);
|
42 |
-
|
43 |
-
// Prepare product parameters for quote
|
44 |
-
$params = new Varien_Object();
|
45 |
-
$params->setQty($item->getQuantity());
|
46 |
-
$params->setOptions($productOptions);
|
47 |
-
try {
|
48 |
-
$quote->addProduct($_product, $params);
|
49 |
-
} catch (Mage_Core_Exception $e) {
|
50 |
-
echo $e->getMessage();
|
51 |
-
} catch (Exception $e) {
|
52 |
-
echo $e->getMessage();
|
53 |
-
Mage::logException($e);
|
54 |
-
}
|
55 |
-
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
$billingData = array(
|
60 |
-
'firstname' => $billingAddress->getFirstName(),
|
61 |
-
'lastname' => $billingAddress->getLastName(),
|
62 |
-
'email' => $order->getEmail(),
|
63 |
-
'telephone' => '1234567890',
|
64 |
-
'country_id' => $billingAddress->getCountryIso(),
|
65 |
-
'postcode' => $billingAddress->getZipCode(),
|
66 |
-
'city' => $billingAddress->getCity(),
|
67 |
-
'street' => array(
|
68 |
-
$billingAddress->getStreetName().' '.
|
69 |
-
$billingAddress->getHouseNr().
|
70 |
-
$billingAddress->getHouseNrAddition()
|
71 |
-
),
|
72 |
-
'save_in_address_book' => 0,
|
73 |
-
'use_for_shipping' => 1
|
74 |
-
);
|
75 |
-
|
76 |
-
$quote->getBillingAddress()
|
77 |
-
->addData($billingData);
|
78 |
-
$quote->getShippingAddress()
|
79 |
-
->addData($billingData);
|
80 |
-
|
81 |
-
$quote->setCustomerId(null)
|
82 |
-
->setCustomerEmail($quote->getBillingAddress()->getEmail())
|
83 |
-
->setCustomerIsGuest(true)
|
84 |
-
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
85 |
-
|
86 |
-
$quote->getPayment()->importData(array('method' => 'checkmo'));
|
87 |
-
$quote->getShippingAddress()
|
88 |
-
->setShippingMethod('freeshipping_freeshipping')
|
89 |
-
->setCollectShippingRates(true)
|
90 |
-
->collectTotals();
|
91 |
-
|
92 |
-
|
93 |
-
try {
|
94 |
-
|
95 |
-
$quote->save();
|
96 |
-
|
97 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
98 |
-
$service->submitAll();
|
99 |
-
|
100 |
-
} catch (Mage_Core_Exception $e) {
|
101 |
-
echo $e->getMessage();
|
102 |
-
} catch (Exception $e) {
|
103 |
-
echo $e->getMessage();
|
104 |
-
Mage::logException($e);
|
105 |
-
}
|
106 |
-
|
107 |
-
$_order = $service->getOrder();
|
108 |
-
var_export($_order->getIncrementId());
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
public function fetchAction()
|
114 |
-
{
|
115 |
-
$apiKey = Mage::getStoreConfig('channelengine/general/api_key');
|
116 |
-
$apiSecret = Mage::getStoreConfig('channelengine/general/api_secret');
|
117 |
-
|
118 |
-
$this->client = new Tritac_ChannelEngineApiClient_Client($apiKey, $apiSecret, 'plugindev');
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Retrieve new orders
|
122 |
-
*/
|
123 |
-
$orders = $this->client->getOrders(array(
|
124 |
-
Tritac_ChannelEngineApiClient_Enums_OrderStatus::NEW_ORDER
|
125 |
-
));
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Check new orders existing
|
129 |
-
*/
|
130 |
-
if(is_null($orders) || $orders->count() == 0)
|
131 |
-
return false;
|
132 |
-
|
133 |
-
foreach($orders as $order) {
|
134 |
-
|
135 |
-
$billingAddress = $order->getBillingAddress();
|
136 |
-
$shippingAddress = $order->getShippingAddress();
|
137 |
-
if(empty($billingAddress)) continue;
|
138 |
-
|
139 |
-
// Initialize new quote
|
140 |
-
$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getDefaultStoreView()->getStoreId());
|
141 |
-
$lines = $order->getLines();
|
142 |
-
|
143 |
-
if(!empty($lines)) {
|
144 |
-
|
145 |
-
foreach($lines as $item) {
|
146 |
-
|
147 |
-
// Load magento product
|
148 |
-
$_product = Mage::getModel('catalog/product')
|
149 |
-
->setStoreId(Mage::app()->getStore()->getId());
|
150 |
-
$productNo = $item->getMerchantProductNo();
|
151 |
-
$ids = explode('_', $productNo);
|
152 |
-
$productOptions = array();
|
153 |
-
if(count($ids) == 3) {
|
154 |
-
$productOptions = array($ids[1] => $ids[2]);
|
155 |
-
}
|
156 |
-
//$productId = $_product->getIdBySku();
|
157 |
-
$_product->load($ids[0]);
|
158 |
-
|
159 |
-
// Prepare product parameters for quote
|
160 |
-
$params = new Varien_Object();
|
161 |
-
$params->setQty($item->getQuantity());
|
162 |
-
$params->setOptions($productOptions);
|
163 |
-
|
164 |
-
// Add product to quote
|
165 |
-
try {
|
166 |
-
$_quoteItem = $quote->addProduct($_product, $params);
|
167 |
-
$_quoteItem->setChannelengineOrderLineId($item->getId());
|
168 |
-
|
169 |
-
} catch (Exception $e) {
|
170 |
-
|
171 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
172 |
-
"An order (#{$order->getId()}) could not be imported",
|
173 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
174 |
-
);
|
175 |
-
Mage::logException($e);
|
176 |
-
continue 2;
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
180 |
-
$phone = $order->getPhone();
|
181 |
-
if(empty($phone))
|
182 |
-
$phone = '-';
|
183 |
-
// Prepare billing and shipping addresses
|
184 |
-
$billingData = array(
|
185 |
-
'firstname' => $billingAddress->getFirstName(),
|
186 |
-
'lastname' => $billingAddress->getLastName(),
|
187 |
-
'email' => $order->getEmail(),
|
188 |
-
'telephone' => $phone,
|
189 |
-
'country_id' => $billingAddress->getCountryIso(),
|
190 |
-
'postcode' => $billingAddress->getZipCode(),
|
191 |
-
'city' => $billingAddress->getCity(),
|
192 |
-
'street' =>
|
193 |
-
$billingAddress->getStreetName().' '.
|
194 |
-
$billingAddress->getHouseNr().
|
195 |
-
$billingAddress->getHouseNrAddition()
|
196 |
-
);
|
197 |
-
$shippingData = array(
|
198 |
-
'firstname' => $shippingAddress->getFirstName(),
|
199 |
-
'lastname' => $shippingAddress->getLastName(),
|
200 |
-
'email' => $order->getEmail(),
|
201 |
-
'telephone' => $phone,
|
202 |
-
'country_id' => $shippingAddress->getCountryIso(),
|
203 |
-
'postcode' => $shippingAddress->getZipCode(),
|
204 |
-
'city' => $shippingAddress->getCity(),
|
205 |
-
'street' =>
|
206 |
-
$shippingAddress->getStreetName().' '.
|
207 |
-
$shippingAddress->getHouseNr().
|
208 |
-
$shippingAddress->getHouseNrAddition()
|
209 |
-
);
|
210 |
-
|
211 |
-
// Register shipping cost. See Tritac_ChannelEngine_Model_Carrier_Channelengine::collectrates();
|
212 |
-
if($order->getShippingCostsInclVat() && floatval($order->getShippingCostsInclVat()) > 0) {
|
213 |
-
Mage::register('channelengine_shipping_amount', floatval($order->getShippingCostsInclVat()));
|
214 |
-
}
|
215 |
-
|
216 |
-
$quote->getBillingAddress()
|
217 |
-
->addData($billingData);
|
218 |
-
$quote->getShippingAddress()
|
219 |
-
->addData($shippingData)
|
220 |
-
->setSaveInAddressBook(0)
|
221 |
-
->setCollectShippingRates(true)
|
222 |
-
->setShippingMethod('channelengine_channelengine');
|
223 |
-
|
224 |
-
$quote->collectTotals();
|
225 |
-
|
226 |
-
// Set guest customer
|
227 |
-
$quote->setCustomerId(null)
|
228 |
-
->setCustomerEmail($quote->getBillingAddress()->getEmail())
|
229 |
-
->setCustomerIsGuest(true)
|
230 |
-
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
231 |
-
|
232 |
-
// Set custom payment method
|
233 |
-
$quote->getPayment()->importData(array('method' => 'channelengine'));
|
234 |
-
|
235 |
-
// Save quote and convert it to new order
|
236 |
-
try {
|
237 |
-
|
238 |
-
$quote->save();
|
239 |
-
|
240 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
241 |
-
|
242 |
-
$service->submitAll();
|
243 |
-
|
244 |
-
} catch (Exception $e) {
|
245 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
246 |
-
"An order (#{$order->getId()}) could not be imported",
|
247 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
248 |
-
);
|
249 |
-
Mage::logException($e);
|
250 |
-
continue;
|
251 |
-
}
|
252 |
-
|
253 |
-
$_order = $service->getOrder();
|
254 |
-
|
255 |
-
if($_order->getIncrementId()) {
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Create new invoice and save channel order
|
259 |
-
*/
|
260 |
-
try {
|
261 |
-
// Initialize new invoice model
|
262 |
-
$invoice = Mage::getModel('sales/service_order', $_order)->prepareInvoice();
|
263 |
-
// Add comment to invoice
|
264 |
-
$invoice->addComment(
|
265 |
-
"Order paid on the marketplace.",
|
266 |
-
false,
|
267 |
-
true
|
268 |
-
);
|
269 |
-
|
270 |
-
// Register invoice. Register invoice items. Collect invoice totals.
|
271 |
-
$invoice->register();
|
272 |
-
$invoice->getOrder()->setIsInProcess(true);
|
273 |
-
|
274 |
-
// Initialize new channel order
|
275 |
-
$_channelOrder = Mage::getModel('channelengine/order');
|
276 |
-
$_channelOrder->setOrderId($_order->getId())
|
277 |
-
->setChannelOrderId($order->getId())
|
278 |
-
->setChannelName($order->getChannelName())
|
279 |
-
->setDoSendMails($order->getDoSendMails())
|
280 |
-
->setCanShipPartial($order->getCanShipPartialOrderLines());
|
281 |
-
|
282 |
-
$invoice->getOrder()
|
283 |
-
->setCanShipPartiallyItem($order->getCanShipPartialOrderLines())
|
284 |
-
->setCanShipPartially($order->getCanShipPartialOrderLines());
|
285 |
-
|
286 |
-
// Start new transaction
|
287 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
288 |
-
->addObject($invoice)
|
289 |
-
->addObject($invoice->getOrder())
|
290 |
-
->addObject($_channelOrder);
|
291 |
-
$transactionSave->save();
|
292 |
-
|
293 |
-
} catch (Exception $e) {
|
294 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
295 |
-
"An invoice could not be created (order #{$_order->getIncrementId()}, channel order #{$order->getId()})",
|
296 |
-
"Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
|
297 |
-
);
|
298 |
-
Mage::logException($e);
|
299 |
-
continue;
|
300 |
-
}
|
301 |
-
Mage::log("Order #{$_order->getIncrementId()} was imported successfully.");
|
302 |
-
} else {
|
303 |
-
Mage::log("An order (#{$order->getId()}) could not be imported");
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
return true;
|
308 |
-
}
|
309 |
-
|
310 |
-
public function returnAction() {
|
311 |
-
|
312 |
-
$apiKey = Mage::getStoreConfig('channelengine/general/api_key');
|
313 |
-
$apiSecret = Mage::getStoreConfig('channelengine/general/api_secret');
|
314 |
-
|
315 |
-
$this->client = new Tritac_ChannelEngineApiClient_Client($apiKey, $apiSecret, 'plugindev');
|
316 |
-
|
317 |
-
/**
|
318 |
-
* Retrieve returns
|
319 |
-
*/
|
320 |
-
$returns = $this->client->getReturns(array(
|
321 |
-
Tritac_ChannelEngineApiClient_Enums_ReturnStatus::DECLARED
|
322 |
-
));
|
323 |
-
|
324 |
-
/**
|
325 |
-
* Check declared returns
|
326 |
-
*/
|
327 |
-
if(is_null($returns) || $returns->count() == 0)
|
328 |
-
return false;
|
329 |
-
|
330 |
-
foreach($returns as $return) {
|
331 |
-
$_channelOrder = Mage::getModel('channelengine/order')->loadByChannelOrderId($return->getOrderId());
|
332 |
-
$_order = Mage::getModel('sales/order')->load($_channelOrder->getOrderId());
|
333 |
-
|
334 |
-
if(!$_order->getIncrementId()) {
|
335 |
-
continue;
|
336 |
-
}
|
337 |
-
|
338 |
-
$status = $return->getStatus(); // Get return status
|
339 |
-
$reason = $return->getReason(); // Get return reason
|
340 |
-
$title = "You have new return from ChannelEngine (ChannelEngine Order #{$return->getOrderId()})";
|
341 |
-
$message = "Magento Order #: <a href='".
|
342 |
-
Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id'=>$_order->getOrderId())).
|
343 |
-
"'>".
|
344 |
-
$_order->getIncrementId().
|
345 |
-
"</a><br />";
|
346 |
-
$message .= "Status: {$status}<br />";
|
347 |
-
$message .= "Reason: {$reason}<br />";
|
348 |
-
$message .= "For more details visit your ChannelEngine <a href='http://www.channelengine.com' target='_blank'>account</a>";
|
349 |
-
|
350 |
-
// Check if notification is already exist
|
351 |
-
$_resource = Mage::getSingleton('core/resource');
|
352 |
-
$_connectionRead = $_resource->getConnection('core_read');
|
353 |
-
$select = $_connectionRead->select()
|
354 |
-
->from($_resource->getTableName('adminnotification/inbox'))
|
355 |
-
->where('title = ?', $title)
|
356 |
-
->where('is_remove != 1')
|
357 |
-
->limit(1);
|
358 |
-
$data = $_connectionRead->fetchRow($select);
|
359 |
-
|
360 |
-
if ($data) {
|
361 |
-
continue;
|
362 |
-
}
|
363 |
-
|
364 |
-
// Add new notification
|
365 |
-
Mage::getModel('adminnotification/inbox')->addCritical(
|
366 |
-
$title,
|
367 |
-
$message,
|
368 |
-
'http://www.channelengine.com'
|
369 |
-
);
|
370 |
-
}
|
371 |
-
}
|
372 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Tritac/ChannelEngine/etc/adminhtml.xml
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<acl>
|
4 |
-
<resources>
|
5 |
-
<all>
|
6 |
-
<title>Allow Everything</title>
|
7 |
-
</all>
|
8 |
-
<admin>
|
9 |
-
<children>
|
10 |
-
<system>
|
11 |
-
<children>
|
12 |
-
<config>
|
13 |
-
<children>
|
14 |
-
<channelengine translate="title" module="channelengine">
|
15 |
-
<title>ChannelEngine.com</title>
|
16 |
-
</channelengine>
|
17 |
-
</children>
|
18 |
-
</config>
|
19 |
-
</children>
|
20 |
-
</system>
|
21 |
-
</children>
|
22 |
-
</admin>
|
23 |
-
</resources>
|
24 |
-
</acl>
|
25 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<channelengine translate="title" module="channelengine">
|
15 |
+
<title>ChannelEngine.com</title>
|
16 |
+
</channelengine>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
</config>
|
app/code/community/Tritac/ChannelEngine/etc/config.xml
CHANGED
@@ -1,194 +1,194 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Tritac_ChannelEngine>
|
5 |
-
<version>
|
6 |
-
</Tritac_ChannelEngine>
|
7 |
-
</modules>
|
8 |
-
|
9 |
-
<global>
|
10 |
-
<blocks>
|
11 |
-
<channelengine>
|
12 |
-
<class>Tritac_ChannelEngine_Block</class>
|
13 |
-
</channelengine>
|
14 |
-
</blocks>
|
15 |
-
<helpers>
|
16 |
-
<channelengine>
|
17 |
-
<class>Tritac_ChannelEngine_Helper</class>
|
18 |
-
</channelengine>
|
19 |
-
</helpers>
|
20 |
-
<models>
|
21 |
-
<channelengine>
|
22 |
-
<class>Tritac_ChannelEngine_Model</class>
|
23 |
-
<resourceModel>channelengine_resource</resourceModel>
|
24 |
-
</channelengine>
|
25 |
-
<channelengine_resource>
|
26 |
-
<class>Tritac_ChannelEngine_Model_Resource</class>
|
27 |
-
<entities>
|
28 |
-
<order>
|
29 |
-
<table>channelengine_order</table>
|
30 |
-
</order>
|
31 |
-
<shipment>
|
32 |
-
<table>channelengine_shipment</table>
|
33 |
-
</shipment>
|
34 |
-
</entities>
|
35 |
-
</channelengine_resource>
|
36 |
-
</models>
|
37 |
-
<resources>
|
38 |
-
<channelengine_setup>
|
39 |
-
<setup>
|
40 |
-
<module>Tritac_ChannelEngine</module>
|
41 |
-
<class>Tritac_ChannelEngine_Model_Resource_Setup</class>
|
42 |
-
</setup>
|
43 |
-
<connection>
|
44 |
-
<use>core_setup</use>
|
45 |
-
</connection>
|
46 |
-
</channelengine_setup>
|
47 |
-
<channelengine_read>
|
48 |
-
<connection>
|
49 |
-
<use>core_read</use>
|
50 |
-
</connection>
|
51 |
-
</channelengine_read>
|
52 |
-
<channelengine_write>
|
53 |
-
<connection>
|
54 |
-
<use>core_write</use>
|
55 |
-
</connection>
|
56 |
-
</channelengine_write>
|
57 |
-
</resources>
|
58 |
-
<fieldsets>
|
59 |
-
<sales_convert_quote_item>
|
60 |
-
<channelengine_order_line_id>
|
61 |
-
<to_order_item>*</to_order_item>
|
62 |
-
</channelengine_order_line_id>
|
63 |
-
</sales_convert_quote_item>
|
64 |
-
<sales_convert_order_item>
|
65 |
-
<channelengine_order_line_id>
|
66 |
-
<to_quote_item>*</to_quote_item>
|
67 |
-
</channelengine_order_line_id>
|
68 |
-
</sales_convert_order_item>
|
69 |
-
</fieldsets>
|
70 |
-
</global>
|
71 |
-
|
72 |
-
<default>
|
73 |
-
<payment>
|
74 |
-
<channelengine>
|
75 |
-
<active>1</active>
|
76 |
-
<model>channelengine/payment_method_channelengine</model>
|
77 |
-
<name>ChannelEngine</name>
|
78 |
-
<title>Order paid on Marketplace Channel - ChannelEngine</title>
|
79 |
-
<allowspecific>0</allowspecific>
|
80 |
-
<order_status>pending</order_status>
|
81 |
-
</channelengine>
|
82 |
-
</payment>
|
83 |
-
<carriers>
|
84 |
-
<channelengine>
|
85 |
-
<active>1</active>
|
86 |
-
<sallowspecific>0</sallowspecific>
|
87 |
-
<model>channelengine/carrier_channelengine</model>
|
88 |
-
<title>Shipping paid on Marketplace Channel - ChannelEngine</title>
|
89 |
-
<price>0</price>
|
90 |
-
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
91 |
-
</channelengine>
|
92 |
-
</carriers>
|
93 |
-
</default>
|
94 |
-
|
95 |
-
<frontend>
|
96 |
-
<routers>
|
97 |
-
<channelengine>
|
98 |
-
<use>standard</use>
|
99 |
-
<args>
|
100 |
-
<module>Tritac_ChannelEngine</module>
|
101 |
-
<frontName>channelengine</frontName>
|
102 |
-
</args>
|
103 |
-
</channelengine>
|
104 |
-
</routers>
|
105 |
-
<layout>
|
106 |
-
<updates>
|
107 |
-
<channelengine>
|
108 |
-
<file>channelengine.xml</file>
|
109 |
-
</channelengine>
|
110 |
-
</updates>
|
111 |
-
</layout>
|
112 |
-
<product>
|
113 |
-
<collection>
|
114 |
-
<attributes>
|
115 |
-
<description />
|
116 |
-
<image />
|
117 |
-
</attributes>
|
118 |
-
</collection>
|
119 |
-
</product>
|
120 |
-
</frontend>
|
121 |
-
|
122 |
-
<adminhtml>
|
123 |
-
<events>
|
124 |
-
<sales_order_shipment_save_after>
|
125 |
-
<observers>
|
126 |
-
<shipmentsave>
|
127 |
-
<type>singleton</type>
|
128 |
-
<class>channelengine/observer</class>
|
129 |
-
<method>saveShipment</method>
|
130 |
-
</shipmentsave>
|
131 |
-
</observers>
|
132 |
-
</sales_order_shipment_save_after>
|
133 |
-
<!--<core_block_abstract_prepare_layout_before>
|
134 |
-
<observers>
|
135 |
-
<ordergrid_column_append>
|
136 |
-
<type>singleton</type>
|
137 |
-
<class>channelengine/observer</class>
|
138 |
-
<method>appendCustomColumnToOrderGrid</method>
|
139 |
-
</ordergrid_column_append>
|
140 |
-
</observers>
|
141 |
-
</core_block_abstract_prepare_layout_before>
|
142 |
-
<sales_order_grid_collection_load_before>
|
143 |
-
<observers>
|
144 |
-
<prepare_order_grid_collection>
|
145 |
-
<type>singleton</type>
|
146 |
-
<class>channelengine/observer</class>
|
147 |
-
<method>prepareOrderGridCollection</method>
|
148 |
-
</prepare_order_grid_collection>
|
149 |
-
</observers>
|
150 |
-
</sales_order_grid_collection_load_before>-->
|
151 |
-
</events>
|
152 |
-
</adminhtml>
|
153 |
-
|
154 |
-
<admin>
|
155 |
-
<routers>
|
156 |
-
<channelengine>
|
157 |
-
<use>admin</use>
|
158 |
-
<args>
|
159 |
-
<module>Tritac_ChannelEngine</module>
|
160 |
-
<frontName>channelengine</frontName>
|
161 |
-
</args>
|
162 |
-
</channelengine>
|
163 |
-
</routers>
|
164 |
-
</admin>
|
165 |
-
|
166 |
-
<crontab>
|
167 |
-
<jobs>
|
168 |
-
<fetch_channelengine_orders>
|
169 |
-
<schedule>
|
170 |
-
<cron_expr>*/15 * * * *</cron_expr>
|
171 |
-
</schedule>
|
172 |
-
<run>
|
173 |
-
<model>channelengine/observer::fetchNewOrders</model>
|
174 |
-
</run>
|
175 |
-
</fetch_channelengine_orders>
|
176 |
-
<fetch_channelengine_returns>
|
177 |
-
<schedule>
|
178 |
-
<cron_expr>*/15 * * * *</cron_expr>
|
179 |
-
</schedule>
|
180 |
-
<run>
|
181 |
-
<model>channelengine/observer::fetchReturns</model>
|
182 |
-
</run>
|
183 |
-
</fetch_channelengine_returns>
|
184 |
-
<generate_channelengine_feed>
|
185 |
-
<schedule>
|
186 |
-
<cron_expr>30 * * * *</cron_expr>
|
187 |
-
</schedule>
|
188 |
-
<run>
|
189 |
-
<model>channelengine/observer::generateFeed</model>
|
190 |
-
</run>
|
191 |
-
</generate_channelengine_feed>
|
192 |
-
</jobs>
|
193 |
-
</crontab>
|
194 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tritac_ChannelEngine>
|
5 |
+
<version>3.0.0</version>
|
6 |
+
</Tritac_ChannelEngine>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<blocks>
|
11 |
+
<channelengine>
|
12 |
+
<class>Tritac_ChannelEngine_Block</class>
|
13 |
+
</channelengine>
|
14 |
+
</blocks>
|
15 |
+
<helpers>
|
16 |
+
<channelengine>
|
17 |
+
<class>Tritac_ChannelEngine_Helper</class>
|
18 |
+
</channelengine>
|
19 |
+
</helpers>
|
20 |
+
<models>
|
21 |
+
<channelengine>
|
22 |
+
<class>Tritac_ChannelEngine_Model</class>
|
23 |
+
<resourceModel>channelengine_resource</resourceModel>
|
24 |
+
</channelengine>
|
25 |
+
<channelengine_resource>
|
26 |
+
<class>Tritac_ChannelEngine_Model_Resource</class>
|
27 |
+
<entities>
|
28 |
+
<order>
|
29 |
+
<table>channelengine_order</table>
|
30 |
+
</order>
|
31 |
+
<shipment>
|
32 |
+
<table>channelengine_shipment</table>
|
33 |
+
</shipment>
|
34 |
+
</entities>
|
35 |
+
</channelengine_resource>
|
36 |
+
</models>
|
37 |
+
<resources>
|
38 |
+
<channelengine_setup>
|
39 |
+
<setup>
|
40 |
+
<module>Tritac_ChannelEngine</module>
|
41 |
+
<class>Tritac_ChannelEngine_Model_Resource_Setup</class>
|
42 |
+
</setup>
|
43 |
+
<connection>
|
44 |
+
<use>core_setup</use>
|
45 |
+
</connection>
|
46 |
+
</channelengine_setup>
|
47 |
+
<channelengine_read>
|
48 |
+
<connection>
|
49 |
+
<use>core_read</use>
|
50 |
+
</connection>
|
51 |
+
</channelengine_read>
|
52 |
+
<channelengine_write>
|
53 |
+
<connection>
|
54 |
+
<use>core_write</use>
|
55 |
+
</connection>
|
56 |
+
</channelengine_write>
|
57 |
+
</resources>
|
58 |
+
<fieldsets>
|
59 |
+
<sales_convert_quote_item>
|
60 |
+
<channelengine_order_line_id>
|
61 |
+
<to_order_item>*</to_order_item>
|
62 |
+
</channelengine_order_line_id>
|
63 |
+
</sales_convert_quote_item>
|
64 |
+
<sales_convert_order_item>
|
65 |
+
<channelengine_order_line_id>
|
66 |
+
<to_quote_item>*</to_quote_item>
|
67 |
+
</channelengine_order_line_id>
|
68 |
+
</sales_convert_order_item>
|
69 |
+
</fieldsets>
|
70 |
+
</global>
|
71 |
+
|
72 |
+
<default>
|
73 |
+
<payment>
|
74 |
+
<channelengine>
|
75 |
+
<active>1</active>
|
76 |
+
<model>channelengine/payment_method_channelengine</model>
|
77 |
+
<name>ChannelEngine</name>
|
78 |
+
<title>Order paid on Marketplace Channel - ChannelEngine</title>
|
79 |
+
<allowspecific>0</allowspecific>
|
80 |
+
<order_status>pending</order_status>
|
81 |
+
</channelengine>
|
82 |
+
</payment>
|
83 |
+
<carriers>
|
84 |
+
<channelengine>
|
85 |
+
<active>1</active>
|
86 |
+
<sallowspecific>0</sallowspecific>
|
87 |
+
<model>channelengine/carrier_channelengine</model>
|
88 |
+
<title>Shipping paid on Marketplace Channel - ChannelEngine</title>
|
89 |
+
<price>0</price>
|
90 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
91 |
+
</channelengine>
|
92 |
+
</carriers>
|
93 |
+
</default>
|
94 |
+
|
95 |
+
<frontend>
|
96 |
+
<routers>
|
97 |
+
<channelengine>
|
98 |
+
<use>standard</use>
|
99 |
+
<args>
|
100 |
+
<module>Tritac_ChannelEngine</module>
|
101 |
+
<frontName>channelengine</frontName>
|
102 |
+
</args>
|
103 |
+
</channelengine>
|
104 |
+
</routers>
|
105 |
+
<layout>
|
106 |
+
<updates>
|
107 |
+
<channelengine>
|
108 |
+
<file>channelengine.xml</file>
|
109 |
+
</channelengine>
|
110 |
+
</updates>
|
111 |
+
</layout>
|
112 |
+
<product>
|
113 |
+
<collection>
|
114 |
+
<attributes>
|
115 |
+
<description />
|
116 |
+
<image />
|
117 |
+
</attributes>
|
118 |
+
</collection>
|
119 |
+
</product>
|
120 |
+
</frontend>
|
121 |
+
|
122 |
+
<adminhtml>
|
123 |
+
<events>
|
124 |
+
<sales_order_shipment_save_after>
|
125 |
+
<observers>
|
126 |
+
<shipmentsave>
|
127 |
+
<type>singleton</type>
|
128 |
+
<class>channelengine/observer</class>
|
129 |
+
<method>saveShipment</method>
|
130 |
+
</shipmentsave>
|
131 |
+
</observers>
|
132 |
+
</sales_order_shipment_save_after>
|
133 |
+
<!--<core_block_abstract_prepare_layout_before>
|
134 |
+
<observers>
|
135 |
+
<ordergrid_column_append>
|
136 |
+
<type>singleton</type>
|
137 |
+
<class>channelengine/observer</class>
|
138 |
+
<method>appendCustomColumnToOrderGrid</method>
|
139 |
+
</ordergrid_column_append>
|
140 |
+
</observers>
|
141 |
+
</core_block_abstract_prepare_layout_before>
|
142 |
+
<sales_order_grid_collection_load_before>
|
143 |
+
<observers>
|
144 |
+
<prepare_order_grid_collection>
|
145 |
+
<type>singleton</type>
|
146 |
+
<class>channelengine/observer</class>
|
147 |
+
<method>prepareOrderGridCollection</method>
|
148 |
+
</prepare_order_grid_collection>
|
149 |
+
</observers>
|
150 |
+
</sales_order_grid_collection_load_before>-->
|
151 |
+
</events>
|
152 |
+
</adminhtml>
|
153 |
+
|
154 |
+
<admin>
|
155 |
+
<routers>
|
156 |
+
<channelengine>
|
157 |
+
<use>admin</use>
|
158 |
+
<args>
|
159 |
+
<module>Tritac_ChannelEngine</module>
|
160 |
+
<frontName>channelengine</frontName>
|
161 |
+
</args>
|
162 |
+
</channelengine>
|
163 |
+
</routers>
|
164 |
+
</admin>
|
165 |
+
|
166 |
+
<crontab>
|
167 |
+
<jobs>
|
168 |
+
<fetch_channelengine_orders>
|
169 |
+
<schedule>
|
170 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
171 |
+
</schedule>
|
172 |
+
<run>
|
173 |
+
<model>channelengine/observer::fetchNewOrders</model>
|
174 |
+
</run>
|
175 |
+
</fetch_channelengine_orders>
|
176 |
+
<fetch_channelengine_returns>
|
177 |
+
<schedule>
|
178 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
179 |
+
</schedule>
|
180 |
+
<run>
|
181 |
+
<model>channelengine/observer::fetchReturns</model>
|
182 |
+
</run>
|
183 |
+
</fetch_channelengine_returns>
|
184 |
+
<generate_channelengine_feed>
|
185 |
+
<schedule>
|
186 |
+
<cron_expr>30 * * * *</cron_expr>
|
187 |
+
</schedule>
|
188 |
+
<run>
|
189 |
+
<model>channelengine/observer::generateFeed</model>
|
190 |
+
</run>
|
191 |
+
</generate_channelengine_feed>
|
192 |
+
</jobs>
|
193 |
+
</crontab>
|
194 |
+
</config>
|
app/code/community/Tritac/ChannelEngine/etc/system.xml
CHANGED
@@ -1,145 +1,145 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<tabs>
|
5 |
-
<channelengine_com translate="label">
|
6 |
-
<label>ChannelEngine.com</label>
|
7 |
-
<sort_order>220</sort_order>
|
8 |
-
</channelengine_com>
|
9 |
-
</tabs>
|
10 |
-
|
11 |
-
<sections>
|
12 |
-
<channelengine translate="label" module="channelengine">
|
13 |
-
<label>Settings</label>
|
14 |
-
<tab>channelengine_com</tab>
|
15 |
-
<show_in_default>1</show_in_default>
|
16 |
-
<show_in_website>1</show_in_website>
|
17 |
-
<show_in_store>1</show_in_store>
|
18 |
-
<sort_order>1000</sort_order>
|
19 |
-
<groups>
|
20 |
-
<general translate="label">
|
21 |
-
<label>General</label>
|
22 |
-
<frontend_type>text</frontend_type>
|
23 |
-
<show_in_default>0</show_in_default>
|
24 |
-
<show_in_website>0</show_in_website>
|
25 |
-
<show_in_store>1</show_in_store>
|
26 |
-
<sort_order>1</sort_order>
|
27 |
-
<fields>
|
28 |
-
<api_key translate="label">
|
29 |
-
<label>Api Key</label>
|
30 |
-
<frontend_type>text</frontend_type>
|
31 |
-
<sort_order>1</sort_order>
|
32 |
-
<show_in_default>0</show_in_default>
|
33 |
-
<show_in_website>0</show_in_website>
|
34 |
-
<show_in_store>1</show_in_store>
|
35 |
-
</api_key>
|
36 |
-
<api_secret translate="label">
|
37 |
-
<label>Api Secret</label>
|
38 |
-
<frontend_type>text</frontend_type>
|
39 |
-
<sort_order>2</sort_order>
|
40 |
-
<show_in_default>0</show_in_default>
|
41 |
-
<show_in_website>0</show_in_website>
|
42 |
-
<show_in_store>1</show_in_store>
|
43 |
-
</api_secret>
|
44 |
-
<tenant translate="label">
|
45 |
-
<label>Account Name</label>
|
46 |
-
<frontend_type>text</frontend_type>
|
47 |
-
<comment>
|
48 |
-
<![CDATA[<span class="notice">Your account name can be found in the ChannelEngine address: <strong>your-account-name</strong>.channelengine.net</span>]]>
|
49 |
-
</comment>
|
50 |
-
<sort_order>3</sort_order>
|
51 |
-
<show_in_default>0</show_in_default>
|
52 |
-
<show_in_website>0</show_in_website>
|
53 |
-
<show_in_store>1</show_in_store>
|
54 |
-
</tenant>
|
55 |
-
</fields>
|
56 |
-
</general>
|
57 |
-
<shipping translate="label">
|
58 |
-
<label>Shipping</label>
|
59 |
-
<frontend_type>text</frontend_type>
|
60 |
-
<show_in_default>1</show_in_default>
|
61 |
-
<show_in_website>1</show_in_website>
|
62 |
-
<show_in_store>1</show_in_store>
|
63 |
-
<sort_order>2</sort_order>
|
64 |
-
<fields>
|
65 |
-
<expected_date translate="label">
|
66 |
-
<label>Expected Shipping Period (For backorders)</label>
|
67 |
-
<frontend_type>text</frontend_type>
|
68 |
-
<comment>
|
69 |
-
<![CDATA[<span class="notice">Please set the number of working days. Applies to order items with status "In Backorder"</span>]]>
|
70 |
-
</comment>
|
71 |
-
<sort_order>2</sort_order>
|
72 |
-
<show_in_default>1</show_in_default>
|
73 |
-
<show_in_website>1</show_in_website>
|
74 |
-
<show_in_store>1</show_in_store>
|
75 |
-
</expected_date>
|
76 |
-
</fields>
|
77 |
-
</shipping>
|
78 |
-
<feed translate="label">
|
79 |
-
<label>Product Feed</label>
|
80 |
-
<frontend_type>text</frontend_type>
|
81 |
-
<show_in_default>1</show_in_default>
|
82 |
-
<show_in_website>1</show_in_website>
|
83 |
-
<show_in_store>1</show_in_store>
|
84 |
-
<sort_order>3</sort_order>
|
85 |
-
<fields>
|
86 |
-
<vat_rate translate="label">
|
87 |
-
<label>Default Vat Rate (%)</label>
|
88 |
-
<frontend_type>text</frontend_type>
|
89 |
-
<sort_order>1</sort_order>
|
90 |
-
<show_in_default>1</show_in_default>
|
91 |
-
<show_in_website>1</show_in_website>
|
92 |
-
<show_in_store>1</show_in_store>
|
93 |
-
</vat_rate>
|
94 |
-
<shipping_time translate="label">
|
95 |
-
<label>Shipping Time (In Stock products)</label>
|
96 |
-
<frontend_type>text</frontend_type>
|
97 |
-
<comment>
|
98 |
-
<![CDATA[<span class="notice">For example: "Ordered before 9:00PM, Delivered tomorrow"</span>]]>
|
99 |
-
</comment>
|
100 |
-
<sort_order>2</sort_order>
|
101 |
-
<show_in_default>1</show_in_default>
|
102 |
-
<show_in_website>1</show_in_website>
|
103 |
-
<show_in_store>1</show_in_store>
|
104 |
-
</shipping_time>
|
105 |
-
<shipping_time_oos translate="label">
|
106 |
-
<label>Shipping Time (Out Of Stock products)</label>
|
107 |
-
<frontend_type>text</frontend_type>
|
108 |
-
<comment>
|
109 |
-
<![CDATA[<span class="notice">For example: "Delivered within 5 working days"</span>]]>
|
110 |
-
</comment>
|
111 |
-
<sort_order>3</sort_order>
|
112 |
-
<show_in_default>1</show_in_default>
|
113 |
-
<show_in_website>1</show_in_website>
|
114 |
-
<show_in_store>1</show_in_store>
|
115 |
-
</shipping_time_oos>
|
116 |
-
<gtin translate="label">
|
117 |
-
<label>Product GTIN</label>
|
118 |
-
<frontend_type>select</frontend_type>
|
119 |
-
<source_model>channelengine/system_config_source_gtin</source_model>
|
120 |
-
<comment>
|
121 |
-
<![CDATA[<span class="notice">The attribute that contains the product GTIN (i.e. EAN, ISBN, UPC)</span>]]>
|
122 |
-
</comment>
|
123 |
-
<sort_order>4</sort_order>
|
124 |
-
<show_in_default>1</show_in_default>
|
125 |
-
<show_in_website>1</show_in_website>
|
126 |
-
<show_in_store>1</show_in_store>
|
127 |
-
</gtin>
|
128 |
-
<generate_product_feed translate="button_label">
|
129 |
-
<label>Generate product feed</label>
|
130 |
-
<button_label>Generate Product Feed</button_label>
|
131 |
-
<comment>
|
132 |
-
<![CDATA[<span class="notice">You need to configure cronjobs on your server to generate feeds automatically</span>]]>
|
133 |
-
</comment>
|
134 |
-
<frontend_model>channelengine/adminhtml_system_config_feed</frontend_model>
|
135 |
-
<sort_order>5</sort_order>
|
136 |
-
<show_in_default>1</show_in_default>
|
137 |
-
<show_in_website>1</show_in_website>
|
138 |
-
<show_in_store>1</show_in_store>
|
139 |
-
</generate_product_feed>
|
140 |
-
</fields>
|
141 |
-
</feed>
|
142 |
-
</groups>
|
143 |
-
</channelengine>
|
144 |
-
</sections>
|
145 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<tabs>
|
5 |
+
<channelengine_com translate="label">
|
6 |
+
<label>ChannelEngine.com</label>
|
7 |
+
<sort_order>220</sort_order>
|
8 |
+
</channelengine_com>
|
9 |
+
</tabs>
|
10 |
+
|
11 |
+
<sections>
|
12 |
+
<channelengine translate="label" module="channelengine">
|
13 |
+
<label>Settings</label>
|
14 |
+
<tab>channelengine_com</tab>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<sort_order>1000</sort_order>
|
19 |
+
<groups>
|
20 |
+
<general translate="label">
|
21 |
+
<label>General</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<show_in_default>0</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<sort_order>1</sort_order>
|
27 |
+
<fields>
|
28 |
+
<api_key translate="label">
|
29 |
+
<label>Api Key</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>0</show_in_default>
|
33 |
+
<show_in_website>0</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</api_key>
|
36 |
+
<api_secret translate="label">
|
37 |
+
<label>Api Secret</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>2</sort_order>
|
40 |
+
<show_in_default>0</show_in_default>
|
41 |
+
<show_in_website>0</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</api_secret>
|
44 |
+
<tenant translate="label">
|
45 |
+
<label>Account Name</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<comment>
|
48 |
+
<![CDATA[<span class="notice">Your account name can be found in the ChannelEngine address: <strong>your-account-name</strong>.channelengine.net</span>]]>
|
49 |
+
</comment>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
+
<show_in_default>0</show_in_default>
|
52 |
+
<show_in_website>0</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</tenant>
|
55 |
+
</fields>
|
56 |
+
</general>
|
57 |
+
<shipping translate="label">
|
58 |
+
<label>Shipping</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
<sort_order>2</sort_order>
|
64 |
+
<fields>
|
65 |
+
<expected_date translate="label">
|
66 |
+
<label>Expected Shipping Period (For backorders)</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<comment>
|
69 |
+
<![CDATA[<span class="notice">Please set the number of working days. Applies to order items with status "In Backorder"</span>]]>
|
70 |
+
</comment>
|
71 |
+
<sort_order>2</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</expected_date>
|
76 |
+
</fields>
|
77 |
+
</shipping>
|
78 |
+
<feed translate="label">
|
79 |
+
<label>Product Feed</label>
|
80 |
+
<frontend_type>text</frontend_type>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<sort_order>3</sort_order>
|
85 |
+
<fields>
|
86 |
+
<vat_rate translate="label">
|
87 |
+
<label>Default Vat Rate (%)</label>
|
88 |
+
<frontend_type>text</frontend_type>
|
89 |
+
<sort_order>1</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</vat_rate>
|
94 |
+
<shipping_time translate="label">
|
95 |
+
<label>Shipping Time (In Stock products)</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<comment>
|
98 |
+
<![CDATA[<span class="notice">For example: "Ordered before 9:00PM, Delivered tomorrow"</span>]]>
|
99 |
+
</comment>
|
100 |
+
<sort_order>2</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</shipping_time>
|
105 |
+
<shipping_time_oos translate="label">
|
106 |
+
<label>Shipping Time (Out Of Stock products)</label>
|
107 |
+
<frontend_type>text</frontend_type>
|
108 |
+
<comment>
|
109 |
+
<![CDATA[<span class="notice">For example: "Delivered within 5 working days"</span>]]>
|
110 |
+
</comment>
|
111 |
+
<sort_order>3</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
</shipping_time_oos>
|
116 |
+
<gtin translate="label">
|
117 |
+
<label>Product GTIN</label>
|
118 |
+
<frontend_type>select</frontend_type>
|
119 |
+
<source_model>channelengine/system_config_source_gtin</source_model>
|
120 |
+
<comment>
|
121 |
+
<![CDATA[<span class="notice">The attribute that contains the product GTIN (i.e. EAN, ISBN, UPC)</span>]]>
|
122 |
+
</comment>
|
123 |
+
<sort_order>4</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>1</show_in_store>
|
127 |
+
</gtin>
|
128 |
+
<generate_product_feed translate="button_label">
|
129 |
+
<label>Generate product feed</label>
|
130 |
+
<button_label>Generate Product Feed</button_label>
|
131 |
+
<comment>
|
132 |
+
<![CDATA[<span class="notice">You need to configure cronjobs on your server to generate feeds automatically</span>]]>
|
133 |
+
</comment>
|
134 |
+
<frontend_model>channelengine/adminhtml_system_config_feed</frontend_model>
|
135 |
+
<sort_order>5</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
</generate_product_feed>
|
140 |
+
</fields>
|
141 |
+
</feed>
|
142 |
+
</groups>
|
143 |
+
</channelengine>
|
144 |
+
</sections>
|
145 |
</config>
|
app/code/community/Tritac/ChannelEngine/sql/channelengine_setup/mysql4-install-1.0.0.php
CHANGED
@@ -1,56 +1,56 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Create table 'channelengine/order'
|
8 |
-
*/
|
9 |
-
$table = $installer->getConnection()
|
10 |
-
->newTable($installer->getTable('channelengine/order'))
|
11 |
-
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
12 |
-
'identity' => true,
|
13 |
-
'nullable' => false,
|
14 |
-
'primary' => true,
|
15 |
-
), 'Entity ID')
|
16 |
-
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
17 |
-
'nullable' => false,
|
18 |
-
'unsigned' => true,
|
19 |
-
), 'Order ID')
|
20 |
-
->addColumn('channel_order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
21 |
-
'nullable' => false,
|
22 |
-
'unsigned' => true,
|
23 |
-
), 'Channel Order ID')
|
24 |
-
->addColumn('channel_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Channel Name')
|
25 |
-
->addColumn('do_send_mails', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
26 |
-
'nullable' => false,
|
27 |
-
'default' => '0'
|
28 |
-
), 'Do Send Mails')
|
29 |
-
->addColumn('can_ship_partial', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
30 |
-
'nullable' => false,
|
31 |
-
'default' => '1'
|
32 |
-
), 'Can Ship Partial Order Lines')
|
33 |
-
->setComment('ChannelEngine Order Table');
|
34 |
-
$installer->getConnection()->createTable($table);
|
35 |
-
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Create new columns that storage "ChannelEngine Order Line Id"
|
39 |
-
*/
|
40 |
-
$tables = array(
|
41 |
-
'sales/quote_item',
|
42 |
-
'sales/order_item'
|
43 |
-
);
|
44 |
-
$args = array(
|
45 |
-
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
46 |
-
'comment' => 'ChannelEngine Order Line Id'
|
47 |
-
);
|
48 |
-
foreach($tables as $tableName) {
|
49 |
-
$installer->getConnection()->addColumn(
|
50 |
-
$installer->getTable($tableName),
|
51 |
-
'channelengine_order_line_id',
|
52 |
-
$args
|
53 |
-
);
|
54 |
-
}
|
55 |
-
|
56 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Create table 'channelengine/order'
|
8 |
+
*/
|
9 |
+
$table = $installer->getConnection()
|
10 |
+
->newTable($installer->getTable('channelengine/order'))
|
11 |
+
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
12 |
+
'identity' => true,
|
13 |
+
'nullable' => false,
|
14 |
+
'primary' => true,
|
15 |
+
), 'Entity ID')
|
16 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
17 |
+
'nullable' => false,
|
18 |
+
'unsigned' => true,
|
19 |
+
), 'Order ID')
|
20 |
+
->addColumn('channel_order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
21 |
+
'nullable' => false,
|
22 |
+
'unsigned' => true,
|
23 |
+
), 'Channel Order ID')
|
24 |
+
->addColumn('channel_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Channel Name')
|
25 |
+
->addColumn('do_send_mails', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
26 |
+
'nullable' => false,
|
27 |
+
'default' => '0'
|
28 |
+
), 'Do Send Mails')
|
29 |
+
->addColumn('can_ship_partial', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
30 |
+
'nullable' => false,
|
31 |
+
'default' => '1'
|
32 |
+
), 'Can Ship Partial Order Lines')
|
33 |
+
->setComment('ChannelEngine Order Table');
|
34 |
+
$installer->getConnection()->createTable($table);
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Create new columns that storage "ChannelEngine Order Line Id"
|
39 |
+
*/
|
40 |
+
$tables = array(
|
41 |
+
'sales/quote_item',
|
42 |
+
'sales/order_item'
|
43 |
+
);
|
44 |
+
$args = array(
|
45 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
46 |
+
'comment' => 'ChannelEngine Order Line Id'
|
47 |
+
);
|
48 |
+
foreach($tables as $tableName) {
|
49 |
+
$installer->getConnection()->addColumn(
|
50 |
+
$installer->getTable($tableName),
|
51 |
+
'channelengine_order_line_id',
|
52 |
+
$args
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
$installer->endSetup();
|
app/code/community/Tritac/ChannelEngine/sql/channelengine_setup/mysql4-upgrade-2.6.0-2.7.0.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$table = $installer->getConnection()
|
7 |
-
->newTable($installer->getTable('channelengine/shipment'))
|
8 |
-
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
9 |
-
'identity' => true,
|
10 |
-
'nullable' => false,
|
11 |
-
'primary' => true,
|
12 |
-
), 'Entity ID')
|
13 |
-
->addColumn('shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
-
'nullable' => false,
|
15 |
-
'unsigned' => true,
|
16 |
-
), 'Magento Shipment ID')
|
17 |
-
->addColumn('channelengine_shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
18 |
-
'nullable' => false,
|
19 |
-
'unsigned' => true,
|
20 |
-
), 'ChannelEngine Shipment ID')
|
21 |
-
->setComment('ChannelEngine Shipment ID');
|
22 |
-
|
23 |
-
$installer->getConnection()->createTable($table);
|
24 |
-
|
25 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$table = $installer->getConnection()
|
7 |
+
->newTable($installer->getTable('channelengine/shipment'))
|
8 |
+
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
9 |
+
'identity' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true,
|
12 |
+
), 'Entity ID')
|
13 |
+
->addColumn('shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'nullable' => false,
|
15 |
+
'unsigned' => true,
|
16 |
+
), 'Magento Shipment ID')
|
17 |
+
->addColumn('channelengine_shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
18 |
+
'nullable' => false,
|
19 |
+
'unsigned' => true,
|
20 |
+
), 'ChannelEngine Shipment ID')
|
21 |
+
->setComment('ChannelEngine Shipment ID');
|
22 |
+
|
23 |
+
$installer->getConnection()->createTable($table);
|
24 |
+
|
25 |
$installer->endSetup();
|
app/design/adminhtml/default/default/template/channelengine/system/config/feed/generate_button.phtml
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @see Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed
|
4 |
-
*/
|
5 |
-
?>
|
6 |
-
<script type="text/javascript">
|
7 |
-
//<![CDATA[
|
8 |
-
function generateFeed() {
|
9 |
-
var elem = $('<?php echo $this->getHtmlId() ?>');
|
10 |
-
|
11 |
-
new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
|
12 |
-
onSuccess: function(response) {
|
13 |
-
result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
|
14 |
-
try {
|
15 |
-
response = response.responseText;
|
16 |
-
if (response == 1) {
|
17 |
-
result = '<?php echo $this->__("Product Feed was generated successfully") ?>';
|
18 |
-
elem.removeClassName('fail').addClassName('success')
|
19 |
-
} else if(response == 'redirect') {
|
20 |
-
result = "<?php echo $this->__("Too many visible attributes.") ?>";
|
21 |
-
window.location.reload();
|
22 |
-
} else {
|
23 |
-
elem.removeClassName('success').addClassName('fail')
|
24 |
-
}
|
25 |
-
} catch (e) {
|
26 |
-
elem.removeClassName('success').addClassName('fail')
|
27 |
-
}
|
28 |
-
$('generate_result').update(result);
|
29 |
-
},
|
30 |
-
onFailure: function(response) {
|
31 |
-
result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
|
32 |
-
elem.removeClassName('success').addClassName('fail');
|
33 |
-
}
|
34 |
-
});
|
35 |
-
}
|
36 |
-
//]]>
|
37 |
-
</script>
|
38 |
-
<button onclick="javascript:generateFeed(); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
|
39 |
-
<span id="generate_result"><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
|
40 |
-
</button>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @see Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<script type="text/javascript">
|
7 |
+
//<![CDATA[
|
8 |
+
function generateFeed() {
|
9 |
+
var elem = $('<?php echo $this->getHtmlId() ?>');
|
10 |
+
|
11 |
+
new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
|
12 |
+
onSuccess: function(response) {
|
13 |
+
result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
|
14 |
+
try {
|
15 |
+
response = response.responseText;
|
16 |
+
if (response == 1) {
|
17 |
+
result = '<?php echo $this->__("Product Feed was generated successfully") ?>';
|
18 |
+
elem.removeClassName('fail').addClassName('success')
|
19 |
+
} else if(response == 'redirect') {
|
20 |
+
result = "<?php echo $this->__("Too many visible attributes.") ?>";
|
21 |
+
window.location.reload();
|
22 |
+
} else {
|
23 |
+
elem.removeClassName('success').addClassName('fail')
|
24 |
+
}
|
25 |
+
} catch (e) {
|
26 |
+
elem.removeClassName('success').addClassName('fail')
|
27 |
+
}
|
28 |
+
$('generate_result').update(result);
|
29 |
+
},
|
30 |
+
onFailure: function(response) {
|
31 |
+
result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
|
32 |
+
elem.removeClassName('success').addClassName('fail');
|
33 |
+
}
|
34 |
+
});
|
35 |
+
}
|
36 |
+
//]]>
|
37 |
+
</script>
|
38 |
+
<button onclick="javascript:generateFeed(); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
|
39 |
+
<span id="generate_result"><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
|
40 |
+
</button>
|
app/design/frontend/base/default/layout/channelengine.xml
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<default>
|
4 |
-
<reference name="head">
|
5 |
-
<block type="channelengine/head" name="channelengine.tracking" template="channelengine/head.phtml" />
|
6 |
-
</reference>
|
7 |
-
</default>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
<checkout_onepage_success translate="label">
|
12 |
-
<reference name="content">
|
13 |
-
<block type="checkout/onepage_success" name="channelengine.checkout.success" template="channelengine/checkout/success.phtml"/>
|
14 |
-
</reference>
|
15 |
-
</checkout_onepage_success>
|
16 |
-
|
17 |
-
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="channelengine/head" name="channelengine.tracking" template="channelengine/head.phtml" />
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
<checkout_onepage_success translate="label">
|
12 |
+
<reference name="content">
|
13 |
+
<block type="checkout/onepage_success" name="channelengine.checkout.success" template="channelengine/checkout/success.phtml"/>
|
14 |
+
</reference>
|
15 |
+
</checkout_onepage_success>
|
16 |
+
|
17 |
+
</layout>
|
app/design/frontend/base/default/template/channelengine/checkout/success.phtml
CHANGED
@@ -1,31 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
3 |
-
?>
|
4 |
-
<script>
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
<?php
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</script>
|
1 |
+
<?php
|
2 |
+
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
3 |
+
?>
|
4 |
+
<script>
|
5 |
+
ce('track:order', {
|
6 |
+
merchantOrderNo: '<?php echo($order->getId()); ?>',
|
7 |
+
total: <?php echo($order->getGrandTotal()); ?>,
|
8 |
+
vat: <?php echo($order->getTaxRefunded() ? $order->getTaxRefunded() : 0); ?>,
|
9 |
+
shippingCost: <?php echo($order->getShippingAmount() ? $order->getShippingAmount() : 0); ?>,
|
10 |
+
city: '<?php echo($order->getBillingAddress()->getCity()); ?>',
|
11 |
+
country: '<?php echo($order->getBillingAddress()->getCountry()); ?>',
|
12 |
+
orderLines: [
|
13 |
+
<?php foreach($order->getAllItems() as $item): ?>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
$categoryIds = Mage::getModel('catalog/product')->load($item->getProductId())->getCategoryIds();
|
17 |
+
$categoryId = end($categoryIds);
|
18 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
19 |
+
$path = explode('/', $category->getPath());
|
20 |
+
$categoryPath = '';
|
21 |
+
|
22 |
+
foreach($path as $catId) {
|
23 |
+
if($catId > 2) {
|
24 |
+
$cat = Mage::getModel('catalog/category')->load($catId);
|
25 |
+
if($categoryPath != '') {
|
26 |
+
$categoryPath .= ' > ';
|
27 |
+
}
|
28 |
+
$categoryPath .= $cat->getName();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
?>
|
32 |
+
{
|
33 |
+
merchantProductNo: '<?php echo($item->getProductId()); ?>',
|
34 |
+
name: '<?php echo($item->getProduct()->getName()); ?>',
|
35 |
+
category: '<?php echo($categoryPath); ?>',
|
36 |
+
price: <?php echo($item->getProduct()->getPrice()); ?>,
|
37 |
+
quantity: <?php echo(intval($item->getQtyOrdered())); ?>
|
38 |
+
},
|
39 |
+
<?php endforeach ?>
|
40 |
+
|
41 |
+
]
|
42 |
+
});
|
43 |
</script>
|
app/design/frontend/base/default/template/channelengine/head.phtml
CHANGED
@@ -1,3 +1,14 @@
|
|
1 |
-
<?php if($this->getAccountName()): ?>
|
2 |
-
<script
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<?php endif ?>
|
1 |
+
<?php if($this->getAccountName()): ?>
|
2 |
+
<script>
|
3 |
+
(function (T, r, i, t, a, c) {
|
4 |
+
T.ce = T.ce || function () { T.ce.eq = T.ce.eq || []; T.ce.eq.push(arguments); }, T.ce.url = t;
|
5 |
+
a = r.createElement(i); a.async = 1; a.src = t + '/content/scripts/ce.js';
|
6 |
+
c = r.getElementsByTagName(i)[0]; c.parentNode.insertBefore(a, c);
|
7 |
+
})(window, document, 'script', '//www.channelengine.net');
|
8 |
+
|
9 |
+
ce('set:account', '<?php echo($this->getAccountName()); ?>');
|
10 |
+
ce('set:environment', '<?php echo($this->getEnvironment()); ?>');
|
11 |
+
ce('track:click');
|
12 |
+
|
13 |
+
</script>
|
14 |
<?php endif ?>
|
app/etc/modules/Tritac_ChannelEngine.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Tritac_ChannelEngine>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Tritac_ChannelEngine>
|
8 |
-
</modules>
|
9 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tritac_ChannelEngine>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Tritac_ChannelEngine>
|
8 |
+
</modules>
|
9 |
+
</config>
|
lib/Tritac/ChannelEngineApiClient/Client.php
CHANGED
@@ -1,282 +1,282 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Client {
|
4 |
-
|
5 |
-
private $environment;
|
6 |
-
private $tenant;
|
7 |
-
private $certificate;
|
8 |
-
|
9 |
-
private $apiUrl;
|
10 |
-
private $apiKey;
|
11 |
-
private $apiSecret;
|
12 |
-
|
13 |
-
private $lastRepresentation;
|
14 |
-
|
15 |
-
const FIDDLER_PROXY = '127.0.0.1:8888';
|
16 |
-
const USE_FIDDLER = false;
|
17 |
-
const FIDDLER_CERTIFICATE_PATH = 'fiddler.crt';
|
18 |
-
|
19 |
-
const ENV_DEVELOPMENT = 'dev';
|
20 |
-
const ENV_ACCEPTATION = 'acc';
|
21 |
-
const ENV_PRODUCTION = 'prod';
|
22 |
-
|
23 |
-
const DEV_URL = 'http://%s.channelengine.local';
|
24 |
-
const ACC_URL = 'http://%s.channelengine-acc.nl';
|
25 |
-
const PROD_URL = 'https://%s.channelengine.net';
|
26 |
-
|
27 |
-
const BASE_PATH = '/api/v1/';
|
28 |
-
const CERTIFICATE_PATH = 'AddTrustExternalCARoot.crt';
|
29 |
-
|
30 |
-
const ORDERS_PATH = 'orders/';
|
31 |
-
const SHIPMENTS_PATH = 'shipments/';
|
32 |
-
const RETURNS_PATH = 'returns/';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Create a new instance of the Kieskeurig Api client.
|
36 |
-
* @param string $apiKey Your personal Api key
|
37 |
-
* @param string $apiSecret Your personal Api secret
|
38 |
-
* @param string $tenant Your personal ChannelEngine name. If your ChannelEngine Url is https://yourshop.channelengine.net your personal name is "yourshop"
|
39 |
-
*/
|
40 |
-
public function __construct($apiKey, $apiSecret, $tenant, $environment = null)
|
41 |
-
{
|
42 |
-
if($environment == null || $environment == self::ENV_PRODUCTION){
|
43 |
-
$this->apiUrl = sprintf(self::PROD_URL, $tenant);
|
44 |
-
}elseif($environment == self::ENV_ACCEPTATION){
|
45 |
-
$this->apiUrl = sprintf(self::ACC_URL, $tenant);
|
46 |
-
}elseif($environment == self::ENV_DEVELOPMENT){
|
47 |
-
$this->apiUrl = sprintf(self::DEV_URL, $tenant);
|
48 |
-
}
|
49 |
-
|
50 |
-
$this->environment = $environment;
|
51 |
-
$this->tenant = $tenant;
|
52 |
-
$this->apiKey = $apiKey;
|
53 |
-
$this->apiSecret = $apiSecret;
|
54 |
-
$this->certificate = __DIR__ . DIRECTORY_SEPARATOR . (self::USE_FIDDLER ? self::FIDDLER_CERTIFICATE_PATH : self::CERTIFICATE_PATH);
|
55 |
-
|
56 |
-
$this->lastRepresentation = '';
|
57 |
-
}
|
58 |
-
|
59 |
-
/* Public API methods */
|
60 |
-
|
61 |
-
/* ORDERS */
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Gets all orders with selected parameters
|
65 |
-
* @param array $statuses An array of ChannelEngineApiClient\Enums\OrderStatus or NULL for all new orders.
|
66 |
-
* @param DateTime $dateFrom Filter orders from the given date
|
67 |
-
* @param DateTime $dateTo Filter orders until the given date
|
68 |
-
* @return ChannelEngineApiClient\Helpers\MerchantOrderCollection The retrieved orders
|
69 |
-
*/
|
70 |
-
public function getOrders(array $statuses = array(Tritac_ChannelEngineApiClient_Enums_OrderStatus::NEW_ORDER), DateTime $dateFrom = null, DateTime $dateTo = null)
|
71 |
-
{
|
72 |
-
$args = array();
|
73 |
-
$args['OrderStatus'] = $statuses;
|
74 |
-
$args = $this->addDateArgs($dateFrom, $dateTo, $args);
|
75 |
-
|
76 |
-
$url = self::BASE_PATH . self::ORDERS_PATH;
|
77 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::GET, $url, $this->createQueryString($args));
|
78 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Order)');
|
79 |
-
}
|
80 |
-
|
81 |
-
/* SHIPMENTS */
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Create a new shipment for the given order with the given lines
|
85 |
-
* @param ChannelEngineApiClient\Models\Shipment $shipment The shipment to send
|
86 |
-
*/
|
87 |
-
public function postShipment(Tritac_ChannelEngineApiClient_Models_Shipment $shipment)
|
88 |
-
{
|
89 |
-
$url = self::BASE_PATH . self::SHIPMENTS_PATH;
|
90 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::POST, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($shipment));
|
91 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_Shipment');
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Update an existing Shipment
|
96 |
-
* @param ChannelEngineApiClient\Models\Shipment $shipment The shipment to send
|
97 |
-
*/
|
98 |
-
public function putShipment(Tritac_ChannelEngineApiClient_Models_Shipment $shipment)
|
99 |
-
{
|
100 |
-
$url = self::BASE_PATH . self::SHIPMENTS_PATH;
|
101 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::PUT, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($shipment));
|
102 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_Shipment');
|
103 |
-
}
|
104 |
-
|
105 |
-
/* RETURNS */
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Gets all orders with selected parameters
|
109 |
-
* @param array $statuses An array of ChannelEngineApiClient\Enums\ReturnStatus or NULL for all declared returns
|
110 |
-
* @param DateTime $dateFrom Filter returns from the given date
|
111 |
-
* @param DateTime $dateTo Filter returns until the given date
|
112 |
-
* @return ChannelEngineApiClient\Helpers\ReturnCollection The retrieved returns
|
113 |
-
*/
|
114 |
-
public function getReturns(array $statuses = array(Tritac_ChannelEngineApiClient_Enums_ReturnStatus::DECLARED), DateTime $dateFrom = null, DateTime $dateTo = null)
|
115 |
-
{
|
116 |
-
$args = array();
|
117 |
-
$args['Status'] = $statuses;
|
118 |
-
$args = $this->addDateArgs($dateFrom, $dateTo, $args);
|
119 |
-
|
120 |
-
$url = self::BASE_PATH . self::RETURNS_PATH;
|
121 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::GET, $url, $this->createQueryString($args));
|
122 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ReturnObject)');
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Create a new return for the given shipment with the given lines
|
127 |
-
* @param ChannelEngineApiClient\Models\ReturnObject $return The shipment to send
|
128 |
-
*/
|
129 |
-
public function postReturn(Tritac_ChannelEngineApiClient_Models_ReturnObject $return)
|
130 |
-
{
|
131 |
-
$url = self::BASE_PATH . self::RETURNS_PATH;
|
132 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::POST, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($return));
|
133 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_ReturnObject');
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Updates the status of the given return
|
138 |
-
* @param ChannelEngineApiClient\Models\ReturnObject $return The return to update
|
139 |
-
*/
|
140 |
-
public function putReturn(Tritac_ChannelEngineApiClient_Models_ReturnObject $return)
|
141 |
-
{
|
142 |
-
$url = self::BASE_PATH . self::RETURNS_PATH;
|
143 |
-
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::PUT, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($return));
|
144 |
-
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_ReturnObject');
|
145 |
-
}
|
146 |
-
|
147 |
-
/* Private methods */
|
148 |
-
|
149 |
-
private function makeRequest($method, $url, $queryString = '', $content = null)
|
150 |
-
{
|
151 |
-
$request = curl_init();
|
152 |
-
|
153 |
-
// Create the required Http headers and Hmac signature
|
154 |
-
$headers = $this->buildHeaders($method, $url, $content);
|
155 |
-
|
156 |
-
if($this->environment == self::ENV_DEVELOPMENT && self::USE_FIDDLER)
|
157 |
-
{
|
158 |
-
// We use this to redirect the request through a local proxy and trace it with fiddler
|
159 |
-
curl_setopt($request, CURLOPT_PROXY, self::FIDDLER_PROXY);
|
160 |
-
}
|
161 |
-
|
162 |
-
// Set the Url
|
163 |
-
curl_setopt($request, CURLOPT_URL, $this->apiUrl . $url . $queryString);
|
164 |
-
|
165 |
-
// Add the headers and hmac auth.
|
166 |
-
curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
|
167 |
-
|
168 |
-
// Return the response as a string
|
169 |
-
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
170 |
-
|
171 |
-
// Set custom request method because curl has no setting for PUT and DELETE
|
172 |
-
curl_setopt($request, CURLOPT_CUSTOMREQUEST, $method);
|
173 |
-
|
174 |
-
// Make the headers accessible for debugging purposes
|
175 |
-
curl_setopt($request, CURLINFO_HEADER_OUT, true);
|
176 |
-
|
177 |
-
// Point curl to the correct certificate.
|
178 |
-
// See: http://stackoverflow.com/questions/6400300/php-curl-https-causing-exception-ssl-certificate-problem-verify-that-the-ca-cer
|
179 |
-
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, true);
|
180 |
-
curl_setopt($request, CURLOPT_CAINFO, $this->certificate);
|
181 |
-
|
182 |
-
// If we have a request body send it too
|
183 |
-
if(strlen($content) > 0)
|
184 |
-
curl_setopt($request, CURLOPT_POSTFIELDS, $content);
|
185 |
-
|
186 |
-
// Make the request
|
187 |
-
$response = curl_exec($request);
|
188 |
-
|
189 |
-
// Get the status code
|
190 |
-
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
|
191 |
-
|
192 |
-
// Check for errors
|
193 |
-
// First we check if the response is missing which will probably be caused by a cURL error
|
194 |
-
// After this the check if there are not HTTP errors (status codes other than 200-206)
|
195 |
-
if ($response === false)
|
196 |
-
{
|
197 |
-
$error = curl_error($request);
|
198 |
-
curl_close($request);
|
199 |
-
throw new Exception('cURL error: ' . $error);
|
200 |
-
}
|
201 |
-
else if($status < 200 || $status > 206)
|
202 |
-
{
|
203 |
-
$headers = curl_getinfo($request, CURLINFO_HEADER_OUT);
|
204 |
-
$message = Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($response, 'Tritac_ChannelEngineApiClient_Models_Message');
|
205 |
-
curl_close($request);
|
206 |
-
|
207 |
-
throw new Exception("\r\n".
|
208 |
-
'------Sent Headers-------------' . "\r\n" . $headers . "\r\n" .
|
209 |
-
'------Sent Content-------------' . "\r\n" . $content . "\r\n" .
|
210 |
-
'------Used Representation------' . "\r\n" . $this->lastRepresentation . "\r\n" .
|
211 |
-
'------Response Status----------' . "\r\n" . $status . "\r\n" .
|
212 |
-
'------Response Content---------' . "\r\n" . $message->getMessage() . "\r\n"
|
213 |
-
);
|
214 |
-
}
|
215 |
-
else
|
216 |
-
{
|
217 |
-
curl_close($request);
|
218 |
-
|
219 |
-
return $response;
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
private function buildHeaders($method, $url, $content = null)
|
224 |
-
{
|
225 |
-
$date = time();
|
226 |
-
$headers = array(
|
227 |
-
'Accept: application/json',
|
228 |
-
'Authorization: HMAC ' . $this->apiKey . ':' . $this->calculateHmac($method, $url, $date, $content),
|
229 |
-
'Content-Type: application/json; charset=utf-8',
|
230 |
-
'Content-Length: ' . strlen($content),
|
231 |
-
'Content-MD5: ' . ((strlen($content) > 0) ? base64_encode(md5($content, true)) : ''),
|
232 |
-
'Date: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT',
|
233 |
-
);
|
234 |
-
|
235 |
-
return $headers;
|
236 |
-
}
|
237 |
-
|
238 |
-
/*
|
239 |
-
Builds message representation as follows:
|
240 |
-
|
241 |
-
Timestamp\n +
|
242 |
-
HTTP METHOD\n +
|
243 |
-
Request URI
|
244 |
-
Content-MD5 (base64)\n +
|
245 |
-
apikey\n +
|
246 |
-
|
247 |
-
*/
|
248 |
-
private function calculateHmac($method, $url, $date, $content = null)
|
249 |
-
{
|
250 |
-
$representation = array(
|
251 |
-
gmdate('m/d/Y H:i:s', $date),
|
252 |
-
$method,
|
253 |
-
$url,
|
254 |
-
(strlen($content) > 0) ? base64_encode(md5($content, true)) : '',
|
255 |
-
$this->apiKey
|
256 |
-
);
|
257 |
-
$representationString = implode("\n", $representation);
|
258 |
-
|
259 |
-
$this->lastRepresentation = $representationString;
|
260 |
-
|
261 |
-
$hash = hash_hmac('sha256', utf8_encode($representationString), utf8_encode($this->apiSecret), true);
|
262 |
-
$signature = base64_encode($hash);
|
263 |
-
|
264 |
-
return $signature;
|
265 |
-
}
|
266 |
-
|
267 |
-
private function createQueryString(array $args)
|
268 |
-
{
|
269 |
-
$queryString = (count($args) > 0) ? '?' . http_build_query($args) : '';
|
270 |
-
|
271 |
-
// .Net does not seem to like the /?foo[0]=bar&foo[1]=baz notation so we
|
272 |
-
// convert it to /?foo=bar&foo=baz
|
273 |
-
return preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $queryString);
|
274 |
-
}
|
275 |
-
|
276 |
-
private function addDateArgs(DateTime $dateFrom = null, DateTime $dateTo = null, array $args)
|
277 |
-
{
|
278 |
-
if(!is_null($dateFrom)) $args['FromDate'] = $dateFrom->format('Y-m-d H:i:s');
|
279 |
-
if(!is_null($dateTo)) $args['ToDate'] = $dateTo->format('Y-m-d H:i:s');
|
280 |
-
return $args;
|
281 |
-
}
|
282 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Client {
|
4 |
+
|
5 |
+
private $environment;
|
6 |
+
private $tenant;
|
7 |
+
private $certificate;
|
8 |
+
|
9 |
+
private $apiUrl;
|
10 |
+
private $apiKey;
|
11 |
+
private $apiSecret;
|
12 |
+
|
13 |
+
private $lastRepresentation;
|
14 |
+
|
15 |
+
const FIDDLER_PROXY = '127.0.0.1:8888';
|
16 |
+
const USE_FIDDLER = false;
|
17 |
+
const FIDDLER_CERTIFICATE_PATH = 'fiddler.crt';
|
18 |
+
|
19 |
+
const ENV_DEVELOPMENT = 'dev';
|
20 |
+
const ENV_ACCEPTATION = 'acc';
|
21 |
+
const ENV_PRODUCTION = 'prod';
|
22 |
+
|
23 |
+
const DEV_URL = 'http://%s.channelengine.local';
|
24 |
+
const ACC_URL = 'http://%s.channelengine-acc.nl';
|
25 |
+
const PROD_URL = 'https://%s.channelengine.net';
|
26 |
+
|
27 |
+
const BASE_PATH = '/api/v1/';
|
28 |
+
const CERTIFICATE_PATH = 'AddTrustExternalCARoot.crt';
|
29 |
+
|
30 |
+
const ORDERS_PATH = 'orders/';
|
31 |
+
const SHIPMENTS_PATH = 'shipments/';
|
32 |
+
const RETURNS_PATH = 'returns/';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Create a new instance of the Kieskeurig Api client.
|
36 |
+
* @param string $apiKey Your personal Api key
|
37 |
+
* @param string $apiSecret Your personal Api secret
|
38 |
+
* @param string $tenant Your personal ChannelEngine name. If your ChannelEngine Url is https://yourshop.channelengine.net your personal name is "yourshop"
|
39 |
+
*/
|
40 |
+
public function __construct($apiKey, $apiSecret, $tenant, $environment = null)
|
41 |
+
{
|
42 |
+
if($environment == null || $environment == self::ENV_PRODUCTION){
|
43 |
+
$this->apiUrl = sprintf(self::PROD_URL, $tenant);
|
44 |
+
}elseif($environment == self::ENV_ACCEPTATION){
|
45 |
+
$this->apiUrl = sprintf(self::ACC_URL, $tenant);
|
46 |
+
}elseif($environment == self::ENV_DEVELOPMENT){
|
47 |
+
$this->apiUrl = sprintf(self::DEV_URL, $tenant);
|
48 |
+
}
|
49 |
+
|
50 |
+
$this->environment = $environment;
|
51 |
+
$this->tenant = $tenant;
|
52 |
+
$this->apiKey = $apiKey;
|
53 |
+
$this->apiSecret = $apiSecret;
|
54 |
+
$this->certificate = __DIR__ . DIRECTORY_SEPARATOR . (self::USE_FIDDLER ? self::FIDDLER_CERTIFICATE_PATH : self::CERTIFICATE_PATH);
|
55 |
+
|
56 |
+
$this->lastRepresentation = '';
|
57 |
+
}
|
58 |
+
|
59 |
+
/* Public API methods */
|
60 |
+
|
61 |
+
/* ORDERS */
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Gets all orders with selected parameters
|
65 |
+
* @param array $statuses An array of ChannelEngineApiClient\Enums\OrderStatus or NULL for all new orders.
|
66 |
+
* @param DateTime $dateFrom Filter orders from the given date
|
67 |
+
* @param DateTime $dateTo Filter orders until the given date
|
68 |
+
* @return ChannelEngineApiClient\Helpers\MerchantOrderCollection The retrieved orders
|
69 |
+
*/
|
70 |
+
public function getOrders(array $statuses = array(Tritac_ChannelEngineApiClient_Enums_OrderStatus::NEW_ORDER), DateTime $dateFrom = null, DateTime $dateTo = null)
|
71 |
+
{
|
72 |
+
$args = array();
|
73 |
+
$args['OrderStatus'] = $statuses;
|
74 |
+
$args = $this->addDateArgs($dateFrom, $dateTo, $args);
|
75 |
+
|
76 |
+
$url = self::BASE_PATH . self::ORDERS_PATH;
|
77 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::GET, $url, $this->createQueryString($args));
|
78 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Order)');
|
79 |
+
}
|
80 |
+
|
81 |
+
/* SHIPMENTS */
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Create a new shipment for the given order with the given lines
|
85 |
+
* @param ChannelEngineApiClient\Models\Shipment $shipment The shipment to send
|
86 |
+
*/
|
87 |
+
public function postShipment(Tritac_ChannelEngineApiClient_Models_Shipment $shipment)
|
88 |
+
{
|
89 |
+
$url = self::BASE_PATH . self::SHIPMENTS_PATH;
|
90 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::POST, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($shipment));
|
91 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_Shipment');
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Update an existing Shipment
|
96 |
+
* @param ChannelEngineApiClient\Models\Shipment $shipment The shipment to send
|
97 |
+
*/
|
98 |
+
public function putShipment(Tritac_ChannelEngineApiClient_Models_Shipment $shipment)
|
99 |
+
{
|
100 |
+
$url = self::BASE_PATH . self::SHIPMENTS_PATH;
|
101 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::PUT, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($shipment));
|
102 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_Shipment');
|
103 |
+
}
|
104 |
+
|
105 |
+
/* RETURNS */
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Gets all orders with selected parameters
|
109 |
+
* @param array $statuses An array of ChannelEngineApiClient\Enums\ReturnStatus or NULL for all declared returns
|
110 |
+
* @param DateTime $dateFrom Filter returns from the given date
|
111 |
+
* @param DateTime $dateTo Filter returns until the given date
|
112 |
+
* @return ChannelEngineApiClient\Helpers\ReturnCollection The retrieved returns
|
113 |
+
*/
|
114 |
+
public function getReturns(array $statuses = array(Tritac_ChannelEngineApiClient_Enums_ReturnStatus::DECLARED), DateTime $dateFrom = null, DateTime $dateTo = null)
|
115 |
+
{
|
116 |
+
$args = array();
|
117 |
+
$args['Status'] = $statuses;
|
118 |
+
$args = $this->addDateArgs($dateFrom, $dateTo, $args);
|
119 |
+
|
120 |
+
$url = self::BASE_PATH . self::RETURNS_PATH;
|
121 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::GET, $url, $this->createQueryString($args));
|
122 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ReturnObject)');
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Create a new return for the given shipment with the given lines
|
127 |
+
* @param ChannelEngineApiClient\Models\ReturnObject $return The shipment to send
|
128 |
+
*/
|
129 |
+
public function postReturn(Tritac_ChannelEngineApiClient_Models_ReturnObject $return)
|
130 |
+
{
|
131 |
+
$url = self::BASE_PATH . self::RETURNS_PATH;
|
132 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::POST, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($return));
|
133 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_ReturnObject');
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Updates the status of the given return
|
138 |
+
* @param ChannelEngineApiClient\Models\ReturnObject $return The return to update
|
139 |
+
*/
|
140 |
+
public function putReturn(Tritac_ChannelEngineApiClient_Models_ReturnObject $return)
|
141 |
+
{
|
142 |
+
$url = self::BASE_PATH . self::RETURNS_PATH;
|
143 |
+
$result = $this->makeRequest(Tritac_ChannelEngineApiClient_Helpers_HttpMethod::PUT, $url, '', Tritac_ChannelEngineApiClient_Helpers_JsonMapper::toJson($return));
|
144 |
+
return Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($result, 'Tritac_ChannelEngineApiClient_Models_ReturnObject');
|
145 |
+
}
|
146 |
+
|
147 |
+
/* Private methods */
|
148 |
+
|
149 |
+
private function makeRequest($method, $url, $queryString = '', $content = null)
|
150 |
+
{
|
151 |
+
$request = curl_init();
|
152 |
+
|
153 |
+
// Create the required Http headers and Hmac signature
|
154 |
+
$headers = $this->buildHeaders($method, $url, $content);
|
155 |
+
|
156 |
+
if($this->environment == self::ENV_DEVELOPMENT && self::USE_FIDDLER)
|
157 |
+
{
|
158 |
+
// We use this to redirect the request through a local proxy and trace it with fiddler
|
159 |
+
curl_setopt($request, CURLOPT_PROXY, self::FIDDLER_PROXY);
|
160 |
+
}
|
161 |
+
|
162 |
+
// Set the Url
|
163 |
+
curl_setopt($request, CURLOPT_URL, $this->apiUrl . $url . $queryString);
|
164 |
+
|
165 |
+
// Add the headers and hmac auth.
|
166 |
+
curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
|
167 |
+
|
168 |
+
// Return the response as a string
|
169 |
+
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
170 |
+
|
171 |
+
// Set custom request method because curl has no setting for PUT and DELETE
|
172 |
+
curl_setopt($request, CURLOPT_CUSTOMREQUEST, $method);
|
173 |
+
|
174 |
+
// Make the headers accessible for debugging purposes
|
175 |
+
curl_setopt($request, CURLINFO_HEADER_OUT, true);
|
176 |
+
|
177 |
+
// Point curl to the correct certificate.
|
178 |
+
// See: http://stackoverflow.com/questions/6400300/php-curl-https-causing-exception-ssl-certificate-problem-verify-that-the-ca-cer
|
179 |
+
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, true);
|
180 |
+
curl_setopt($request, CURLOPT_CAINFO, $this->certificate);
|
181 |
+
|
182 |
+
// If we have a request body send it too
|
183 |
+
if(strlen($content) > 0)
|
184 |
+
curl_setopt($request, CURLOPT_POSTFIELDS, $content);
|
185 |
+
|
186 |
+
// Make the request
|
187 |
+
$response = curl_exec($request);
|
188 |
+
|
189 |
+
// Get the status code
|
190 |
+
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
|
191 |
+
|
192 |
+
// Check for errors
|
193 |
+
// First we check if the response is missing which will probably be caused by a cURL error
|
194 |
+
// After this the check if there are not HTTP errors (status codes other than 200-206)
|
195 |
+
if ($response === false)
|
196 |
+
{
|
197 |
+
$error = curl_error($request);
|
198 |
+
curl_close($request);
|
199 |
+
throw new Exception('cURL error: ' . $error);
|
200 |
+
}
|
201 |
+
else if($status < 200 || $status > 206)
|
202 |
+
{
|
203 |
+
$headers = curl_getinfo($request, CURLINFO_HEADER_OUT);
|
204 |
+
$message = Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($response, 'Tritac_ChannelEngineApiClient_Models_Message');
|
205 |
+
curl_close($request);
|
206 |
+
|
207 |
+
throw new Exception("\r\n".
|
208 |
+
'------Sent Headers-------------' . "\r\n" . $headers . "\r\n" .
|
209 |
+
'------Sent Content-------------' . "\r\n" . $content . "\r\n" .
|
210 |
+
'------Used Representation------' . "\r\n" . $this->lastRepresentation . "\r\n" .
|
211 |
+
'------Response Status----------' . "\r\n" . $status . "\r\n" .
|
212 |
+
'------Response Content---------' . "\r\n" . $message->getMessage() . "\r\n"
|
213 |
+
);
|
214 |
+
}
|
215 |
+
else
|
216 |
+
{
|
217 |
+
curl_close($request);
|
218 |
+
|
219 |
+
return $response;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
private function buildHeaders($method, $url, $content = null)
|
224 |
+
{
|
225 |
+
$date = time();
|
226 |
+
$headers = array(
|
227 |
+
'Accept: application/json',
|
228 |
+
'Authorization: HMAC ' . $this->apiKey . ':' . $this->calculateHmac($method, $url, $date, $content),
|
229 |
+
'Content-Type: application/json; charset=utf-8',
|
230 |
+
'Content-Length: ' . strlen($content),
|
231 |
+
'Content-MD5: ' . ((strlen($content) > 0) ? base64_encode(md5($content, true)) : ''),
|
232 |
+
'Date: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT',
|
233 |
+
);
|
234 |
+
|
235 |
+
return $headers;
|
236 |
+
}
|
237 |
+
|
238 |
+
/*
|
239 |
+
Builds message representation as follows:
|
240 |
+
|
241 |
+
Timestamp\n +
|
242 |
+
HTTP METHOD\n +
|
243 |
+
Request URI
|
244 |
+
Content-MD5 (base64)\n +
|
245 |
+
apikey\n +
|
246 |
+
|
247 |
+
*/
|
248 |
+
private function calculateHmac($method, $url, $date, $content = null)
|
249 |
+
{
|
250 |
+
$representation = array(
|
251 |
+
gmdate('m/d/Y H:i:s', $date),
|
252 |
+
$method,
|
253 |
+
$url,
|
254 |
+
(strlen($content) > 0) ? base64_encode(md5($content, true)) : '',
|
255 |
+
$this->apiKey
|
256 |
+
);
|
257 |
+
$representationString = implode("\n", $representation);
|
258 |
+
|
259 |
+
$this->lastRepresentation = $representationString;
|
260 |
+
|
261 |
+
$hash = hash_hmac('sha256', utf8_encode($representationString), utf8_encode($this->apiSecret), true);
|
262 |
+
$signature = base64_encode($hash);
|
263 |
+
|
264 |
+
return $signature;
|
265 |
+
}
|
266 |
+
|
267 |
+
private function createQueryString(array $args)
|
268 |
+
{
|
269 |
+
$queryString = (count($args) > 0) ? '?' . http_build_query($args) : '';
|
270 |
+
|
271 |
+
// .Net does not seem to like the /?foo[0]=bar&foo[1]=baz notation so we
|
272 |
+
// convert it to /?foo=bar&foo=baz
|
273 |
+
return preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $queryString);
|
274 |
+
}
|
275 |
+
|
276 |
+
private function addDateArgs(DateTime $dateFrom = null, DateTime $dateTo = null, array $args)
|
277 |
+
{
|
278 |
+
if(!is_null($dateFrom)) $args['FromDate'] = $dateFrom->format('Y-m-d H:i:s');
|
279 |
+
if(!is_null($dateTo)) $args['ToDate'] = $dateTo->format('Y-m-d H:i:s');
|
280 |
+
return $args;
|
281 |
+
}
|
282 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/CancellationLineStatus.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_CancellationLineStatus {
|
3 |
-
|
4 |
-
const PENDING = 0;
|
5 |
-
const ACCEPTED = 1;
|
6 |
-
const REJECTED = 2;
|
7 |
-
|
8 |
-
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_CancellationLineStatus {
|
3 |
+
|
4 |
+
const PENDING = 0;
|
5 |
+
const ACCEPTED = 1;
|
6 |
+
const REJECTED = 2;
|
7 |
+
|
8 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Enums/CancellationStatus.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_CancellationStatus {
|
3 |
-
|
4 |
-
const PENDING = 0;
|
5 |
-
const CLOSED = 2; // refunded or maybe not
|
6 |
-
const REFUND_STARTED = 3;
|
7 |
-
const REFUND_FAILED = 4;
|
8 |
-
|
9 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_CancellationStatus {
|
3 |
+
|
4 |
+
const PENDING = 0;
|
5 |
+
const CLOSED = 2; // refunded or maybe not
|
6 |
+
const REFUND_STARTED = 3;
|
7 |
+
const REFUND_FAILED = 4;
|
8 |
+
|
9 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/Gender.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_Gender {
|
3 |
-
|
4 |
-
const MALE = 1;
|
5 |
-
const FEMALE = 2;
|
6 |
-
const NOT_APPLICABLE = 3;
|
7 |
-
|
8 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_Gender {
|
3 |
+
|
4 |
+
const MALE = 1;
|
5 |
+
const FEMALE = 2;
|
6 |
+
const NOT_APPLICABLE = 3;
|
7 |
+
|
8 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/MancoReason.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_MancoReason {
|
3 |
-
const NOT_IN_STOCK = 0;
|
4 |
-
const DAMAGED = 1;
|
5 |
-
const INCOMPLETE = 2;
|
6 |
-
const CLIENT_CANCELLED = 3;
|
7 |
-
const OTHER = 99;
|
8 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_MancoReason {
|
3 |
+
const NOT_IN_STOCK = 0;
|
4 |
+
const DAMAGED = 1;
|
5 |
+
const INCOMPLETE = 2;
|
6 |
+
const CLIENT_CANCELLED = 3;
|
7 |
+
const OTHER = 99;
|
8 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/OrderStatus.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_OrderStatus {
|
3 |
-
|
4 |
-
const IN_PROGRESS = 0;
|
5 |
-
const SHIPPED = 1;
|
6 |
-
const IN_BACKORDER = 2;
|
7 |
-
const CANCELED = 3;
|
8 |
-
const MANCO = 4;
|
9 |
-
const IN_COMBI = 5; // combi: one or more not closed
|
10 |
-
const CLOSED = 6; // combi:closed
|
11 |
-
const NEW_ORDER = 7; // renamed NEW to NEW_ORDER because new is a protected keyword in php
|
12 |
-
|
13 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_OrderStatus {
|
3 |
+
|
4 |
+
const IN_PROGRESS = 0;
|
5 |
+
const SHIPPED = 1;
|
6 |
+
const IN_BACKORDER = 2;
|
7 |
+
const CANCELED = 3;
|
8 |
+
const MANCO = 4;
|
9 |
+
const IN_COMBI = 5; // combi: one or more not closed
|
10 |
+
const CLOSED = 6; // combi:closed
|
11 |
+
const NEW_ORDER = 7; // renamed NEW to NEW_ORDER because new is a protected keyword in php
|
12 |
+
|
13 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/ReturnAcceptStatus.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_ReturnAcceptStatus {
|
3 |
-
const PENDING = 0;
|
4 |
-
const ACCEPTED = 1;
|
5 |
-
const REJECTED = 2; // refunded
|
6 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_ReturnAcceptStatus {
|
3 |
+
const PENDING = 0;
|
4 |
+
const ACCEPTED = 1;
|
5 |
+
const REJECTED = 2; // refunded
|
6 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/ReturnReason.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_ReturnReason {
|
3 |
-
const PRODUCT_DEFECT = 0;
|
4 |
-
const PRODUCT_UNSATISFACTORY = 1;
|
5 |
-
const REFUSED = 4;
|
6 |
-
const REFUSED_DAMAGED = 5;
|
7 |
-
const WRONG_ADDRESS = 6;
|
8 |
-
const NOT_COLLECTED = 7;
|
9 |
-
const OTHER = 99;
|
10 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_ReturnReason {
|
3 |
+
const PRODUCT_DEFECT = 0;
|
4 |
+
const PRODUCT_UNSATISFACTORY = 1;
|
5 |
+
const REFUSED = 4;
|
6 |
+
const REFUSED_DAMAGED = 5;
|
7 |
+
const WRONG_ADDRESS = 6;
|
8 |
+
const NOT_COLLECTED = 7;
|
9 |
+
const OTHER = 99;
|
10 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/ReturnStatus.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_ReturnStatus {
|
3 |
-
const DECLARED = 0;
|
4 |
-
const RECEIVED = 1;
|
5 |
-
const CLOSED = 2;
|
6 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_ReturnStatus {
|
3 |
+
const DECLARED = 0;
|
4 |
+
const RECEIVED = 1;
|
5 |
+
const CLOSED = 2;
|
6 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/ShipmentLineStatus.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus {
|
3 |
-
|
4 |
-
const SHIPPED = 1;
|
5 |
-
const IN_BACKORDER = 2;
|
6 |
-
const MANCO = 4;
|
7 |
-
|
8 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus {
|
3 |
+
|
4 |
+
const SHIPPED = 1;
|
5 |
+
const IN_BACKORDER = 2;
|
6 |
+
const MANCO = 4;
|
7 |
+
|
8 |
}
|
lib/Tritac/ChannelEngineApiClient/Enums/ShipmentStatus.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Enums_ShipmentStatus {
|
3 |
-
const PENDING = 0;
|
4 |
-
const CLOSED = 2;
|
5 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Enums_ShipmentStatus {
|
3 |
+
const PENDING = 0;
|
4 |
+
const CLOSED = 2;
|
5 |
}
|
lib/Tritac/ChannelEngineApiClient/Helpers/Collection.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Helpers_Collection extends ArrayObject{
|
3 |
-
|
4 |
-
private $type;
|
5 |
-
private $test;
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
public function __construct($type = 'stdObject')
|
10 |
-
{
|
11 |
-
$matches = array();
|
12 |
-
if(preg_match('/Collection\(([\\\\\w]+)\)$/', $type, $matches))
|
13 |
-
{
|
14 |
-
$this->type = $matches[1];
|
15 |
-
}
|
16 |
-
else
|
17 |
-
{
|
18 |
-
$this->type = $type;
|
19 |
-
}
|
20 |
-
|
21 |
-
$this->test = new $this->type();
|
22 |
-
}
|
23 |
-
|
24 |
-
public function append($item)
|
25 |
-
{
|
26 |
-
$this->checkType($item);
|
27 |
-
parent::append($item);
|
28 |
-
}
|
29 |
-
|
30 |
-
public function offsetSet($idx, $item)
|
31 |
-
{
|
32 |
-
$this->checkType($item);
|
33 |
-
parent::offsetSet($idx, $item);
|
34 |
-
}
|
35 |
-
|
36 |
-
private function checkType($item)
|
37 |
-
{
|
38 |
-
if(!($item instanceof $this->test))
|
39 |
-
{
|
40 |
-
throw new Exception('Invalid type inserted in list with type ' . $this->type);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
public function getTypeName()
|
45 |
-
{
|
46 |
-
return $this->type;
|
47 |
-
}
|
48 |
-
|
49 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Helpers_Collection extends ArrayObject{
|
3 |
+
|
4 |
+
private $type;
|
5 |
+
private $test;
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
public function __construct($type = 'stdObject')
|
10 |
+
{
|
11 |
+
$matches = array();
|
12 |
+
if(preg_match('/Collection\(([\\\\\w]+)\)$/', $type, $matches))
|
13 |
+
{
|
14 |
+
$this->type = $matches[1];
|
15 |
+
}
|
16 |
+
else
|
17 |
+
{
|
18 |
+
$this->type = $type;
|
19 |
+
}
|
20 |
+
|
21 |
+
$this->test = new $this->type();
|
22 |
+
}
|
23 |
+
|
24 |
+
public function append($item)
|
25 |
+
{
|
26 |
+
$this->checkType($item);
|
27 |
+
parent::append($item);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function offsetSet($idx, $item)
|
31 |
+
{
|
32 |
+
$this->checkType($item);
|
33 |
+
parent::offsetSet($idx, $item);
|
34 |
+
}
|
35 |
+
|
36 |
+
private function checkType($item)
|
37 |
+
{
|
38 |
+
if(!($item instanceof $this->test))
|
39 |
+
{
|
40 |
+
throw new Exception('Invalid type inserted in list with type ' . $this->type);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getTypeName()
|
45 |
+
{
|
46 |
+
return $this->type;
|
47 |
+
}
|
48 |
+
|
49 |
}
|
lib/Tritac/ChannelEngineApiClient/Helpers/HttpMethod.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Helpers_HttpMethod {
|
3 |
-
|
4 |
-
const GET = 'GET';
|
5 |
-
const POST = 'POST';
|
6 |
-
const PUT = 'PUT';
|
7 |
-
const DELETE = 'DELETE';
|
8 |
-
|
9 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Helpers_HttpMethod {
|
3 |
+
|
4 |
+
const GET = 'GET';
|
5 |
+
const POST = 'POST';
|
6 |
+
const PUT = 'PUT';
|
7 |
+
const DELETE = 'DELETE';
|
8 |
+
|
9 |
}
|
lib/Tritac/ChannelEngineApiClient/Helpers/JsonMapper.php
CHANGED
@@ -1,91 +1,91 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Helpers_JsonMapper {
|
3 |
-
|
4 |
-
public static function fromJson($jsonString, $rootType)
|
5 |
-
{
|
6 |
-
$jsonRoot = json_decode($jsonString);
|
7 |
-
return self::convertToObject($jsonRoot, $rootType);
|
8 |
-
}
|
9 |
-
|
10 |
-
private static function convertToObject($jsonObject, $jsonType)
|
11 |
-
{
|
12 |
-
$rootObject = null;
|
13 |
-
if(preg_match('/Collection\(([\\\\\w]+)\)$/', $jsonType))
|
14 |
-
{
|
15 |
-
$rootObject = new Tritac_ChannelEngineApiClient_Helpers_Collection($jsonType);
|
16 |
-
if(is_array($jsonObject))
|
17 |
-
{
|
18 |
-
foreach ($jsonObject as $jsonChildObject)
|
19 |
-
{
|
20 |
-
$rootObject[] = self::convertToObject($jsonChildObject, $rootObject->getTypeName());
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
24 |
-
else
|
25 |
-
{
|
26 |
-
$rootObject = new $jsonType();
|
27 |
-
if($jsonObject != null){
|
28 |
-
foreach (get_object_vars($jsonObject) as $key => $value)
|
29 |
-
{
|
30 |
-
if(array_key_exists(lcfirst($key), $rootObject::$typeMap))
|
31 |
-
{
|
32 |
-
$value = self::convertToObject($value, $rootObject::$typeMap[lcfirst($key)]);
|
33 |
-
}
|
34 |
-
$action = 'set' . $key;
|
35 |
-
if(method_exists($rootObject, $action))
|
36 |
-
{
|
37 |
-
$rootObject->{$action}($value);
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
return $rootObject;
|
43 |
-
}
|
44 |
-
|
45 |
-
private static function isIterable($var)
|
46 |
-
{
|
47 |
-
return ($var !== null && (is_array($var) || $var instanceof Iterator || $var instanceof IteratorAggregate));
|
48 |
-
}
|
49 |
-
|
50 |
-
public static function toJson($object)
|
51 |
-
{
|
52 |
-
return json_encode(self::convertFromObject($object));
|
53 |
-
}
|
54 |
-
|
55 |
-
public static function convertFromObject($root, $d = 0, $mustexist = false)
|
56 |
-
{
|
57 |
-
if($root instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
58 |
-
{
|
59 |
-
$root = $root->getArrayCopy();
|
60 |
-
foreach($root as $key => $value)
|
61 |
-
{
|
62 |
-
if($value instanceof Tritac_ChannelEngineApiClient_Models_BaseModel || $value instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
63 |
-
$root[ucfirst($key)] = self::convertFromObject($value, $d+1, true);
|
64 |
-
}
|
65 |
-
return $root;
|
66 |
-
}
|
67 |
-
elseif($root instanceof Tritac_ChannelEngineApiClient_Models_BaseModel)
|
68 |
-
{
|
69 |
-
$newRoot = new stdClass();
|
70 |
-
foreach($root->getProperties() as $key => $value)
|
71 |
-
{
|
72 |
-
if($value instanceof Tritac_ChannelEngineApiClient_Models_BaseModel || $value instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
73 |
-
{
|
74 |
-
$newRoot->{ucfirst($key)} = self::convertFromObject($value, $d+1, true);
|
75 |
-
}
|
76 |
-
else
|
77 |
-
{
|
78 |
-
$newRoot->{ucfirst($key)} = $value;
|
79 |
-
}
|
80 |
-
|
81 |
-
}
|
82 |
-
return $newRoot;
|
83 |
-
}
|
84 |
-
elseif($mustexist)
|
85 |
-
{
|
86 |
-
throw new Exception('No or invalid object given to the function.');
|
87 |
-
}
|
88 |
-
|
89 |
-
return new stdClass();
|
90 |
-
}
|
91 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Helpers_JsonMapper {
|
3 |
+
|
4 |
+
public static function fromJson($jsonString, $rootType)
|
5 |
+
{
|
6 |
+
$jsonRoot = json_decode($jsonString);
|
7 |
+
return self::convertToObject($jsonRoot, $rootType);
|
8 |
+
}
|
9 |
+
|
10 |
+
private static function convertToObject($jsonObject, $jsonType)
|
11 |
+
{
|
12 |
+
$rootObject = null;
|
13 |
+
if(preg_match('/Collection\(([\\\\\w]+)\)$/', $jsonType))
|
14 |
+
{
|
15 |
+
$rootObject = new Tritac_ChannelEngineApiClient_Helpers_Collection($jsonType);
|
16 |
+
if(is_array($jsonObject))
|
17 |
+
{
|
18 |
+
foreach ($jsonObject as $jsonChildObject)
|
19 |
+
{
|
20 |
+
$rootObject[] = self::convertToObject($jsonChildObject, $rootObject->getTypeName());
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
else
|
25 |
+
{
|
26 |
+
$rootObject = new $jsonType();
|
27 |
+
if($jsonObject != null){
|
28 |
+
foreach (get_object_vars($jsonObject) as $key => $value)
|
29 |
+
{
|
30 |
+
if(array_key_exists(lcfirst($key), $rootObject::$typeMap))
|
31 |
+
{
|
32 |
+
$value = self::convertToObject($value, $rootObject::$typeMap[lcfirst($key)]);
|
33 |
+
}
|
34 |
+
$action = 'set' . $key;
|
35 |
+
if(method_exists($rootObject, $action))
|
36 |
+
{
|
37 |
+
$rootObject->{$action}($value);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
return $rootObject;
|
43 |
+
}
|
44 |
+
|
45 |
+
private static function isIterable($var)
|
46 |
+
{
|
47 |
+
return ($var !== null && (is_array($var) || $var instanceof Iterator || $var instanceof IteratorAggregate));
|
48 |
+
}
|
49 |
+
|
50 |
+
public static function toJson($object)
|
51 |
+
{
|
52 |
+
return json_encode(self::convertFromObject($object));
|
53 |
+
}
|
54 |
+
|
55 |
+
public static function convertFromObject($root, $d = 0, $mustexist = false)
|
56 |
+
{
|
57 |
+
if($root instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
58 |
+
{
|
59 |
+
$root = $root->getArrayCopy();
|
60 |
+
foreach($root as $key => $value)
|
61 |
+
{
|
62 |
+
if($value instanceof Tritac_ChannelEngineApiClient_Models_BaseModel || $value instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
63 |
+
$root[ucfirst($key)] = self::convertFromObject($value, $d+1, true);
|
64 |
+
}
|
65 |
+
return $root;
|
66 |
+
}
|
67 |
+
elseif($root instanceof Tritac_ChannelEngineApiClient_Models_BaseModel)
|
68 |
+
{
|
69 |
+
$newRoot = new stdClass();
|
70 |
+
foreach($root->getProperties() as $key => $value)
|
71 |
+
{
|
72 |
+
if($value instanceof Tritac_ChannelEngineApiClient_Models_BaseModel || $value instanceof Tritac_ChannelEngineApiClient_Helpers_Collection)
|
73 |
+
{
|
74 |
+
$newRoot->{ucfirst($key)} = self::convertFromObject($value, $d+1, true);
|
75 |
+
}
|
76 |
+
else
|
77 |
+
{
|
78 |
+
$newRoot->{ucfirst($key)} = $value;
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
return $newRoot;
|
83 |
+
}
|
84 |
+
elseif($mustexist)
|
85 |
+
{
|
86 |
+
throw new Exception('No or invalid object given to the function.');
|
87 |
+
}
|
88 |
+
|
89 |
+
return new stdClass();
|
90 |
+
}
|
91 |
}
|
lib/Tritac/ChannelEngineApiClient/Models/Address.php
CHANGED
@@ -1,97 +1,97 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Models_Address extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
public static $typeMap = array(
|
5 |
-
|
6 |
-
);
|
7 |
-
|
8 |
-
// For non-vital fields, no string length errors, but they are silently truncated.
|
9 |
-
// salutation, companyName, firstName, lastName, streetName, city: 50 characters
|
10 |
-
|
11 |
-
protected $gender; // https://en.wikipedia.org/wiki/ISO/IEC_5218
|
12 |
-
protected $salutation;
|
13 |
-
protected $companyName;
|
14 |
-
protected $firstName;
|
15 |
-
protected $lastName;
|
16 |
-
protected $streetName;
|
17 |
-
protected $houseNr;
|
18 |
-
protected $houseNrAddition;
|
19 |
-
protected $zipCode;
|
20 |
-
protected $city;
|
21 |
-
protected $countryIso;
|
22 |
-
|
23 |
-
public function __construct()
|
24 |
-
{
|
25 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
26 |
-
|
27 |
-
$this->gender = Tritac_ChannelEngineApiClient_Enums_Gender::NOT_APPLICABLE;
|
28 |
-
$this->salutation = '';
|
29 |
-
$this->companyName = '';
|
30 |
-
$this->firstName = '';
|
31 |
-
$this->lastName = '';
|
32 |
-
$this->streetName = '';
|
33 |
-
$this->houseNr = '';
|
34 |
-
$this->houseNrAddition = '';
|
35 |
-
$this->zipCode = '';
|
36 |
-
$this->city = '';
|
37 |
-
$this->countryIso = '';
|
38 |
-
}
|
39 |
-
|
40 |
-
function setGender($gender) { $this->gender = $gender; }
|
41 |
-
function getGender() { return $this->gender; }
|
42 |
-
|
43 |
-
function setSalutation($salutation) { $this->salutation = $salutation; }
|
44 |
-
function getSalutation() { return $this->salutation; }
|
45 |
-
|
46 |
-
function setCompanyName($companyName) { $this->companyName = $companyName; }
|
47 |
-
function getCompanyName() { return $this->companyName; }
|
48 |
-
|
49 |
-
function setFirstName($firstName) { $this->firstName = $firstName; }
|
50 |
-
function getFirstName() { return $this->firstName; }
|
51 |
-
|
52 |
-
function setLastName($lastName) { $this->lastName = $lastName; }
|
53 |
-
function getLastName() { return $this->lastName; }
|
54 |
-
|
55 |
-
function setStreetName($streetName) { $this->streetName = $streetName; }
|
56 |
-
function getStreetName() { return $this->streetName; }
|
57 |
-
|
58 |
-
function setHouseNr($houseNr) {
|
59 |
-
|
60 |
-
if(strlen($houseNr) > 50) {
|
61 |
-
throw new Exception('HouseNr may not exceed 50 characters');
|
62 |
-
}
|
63 |
-
|
64 |
-
$this->houseNr = $houseNr;
|
65 |
-
}
|
66 |
-
function getHouseNr() { return $this->houseNr; }
|
67 |
-
|
68 |
-
function setHouseNrAddition($houseNrAddition) {
|
69 |
-
|
70 |
-
if(strlen($houseNrAddition) > 50) {
|
71 |
-
throw new Exception('HouseNrAddition may not exceed 50 characters');
|
72 |
-
}
|
73 |
-
|
74 |
-
$this->houseNrAddition = $houseNrAddition;
|
75 |
-
|
76 |
-
}
|
77 |
-
function getHouseNrAddition() { return $this->houseNrAddition; }
|
78 |
-
|
79 |
-
function setZipCode($zipCode) { $this->zipCode = $zipCode; }
|
80 |
-
function getZipCode() { return $this->zipCode; }
|
81 |
-
|
82 |
-
function setCity($city) { $this->city = $city; }
|
83 |
-
function getCity() { return $this->city; }
|
84 |
-
|
85 |
-
function setCountryIso($countryIso) {
|
86 |
-
|
87 |
-
if(strlen($countryIso) > 2) {
|
88 |
-
throw new Exception('CountryIso may not exceed 2 characters');
|
89 |
-
}
|
90 |
-
|
91 |
-
$this->countryIso = $countryIso;
|
92 |
-
|
93 |
-
}
|
94 |
-
function getCountryIso() { return $this->countryIso; }
|
95 |
-
|
96 |
-
}
|
97 |
?>
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Models_Address extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
public static $typeMap = array(
|
5 |
+
|
6 |
+
);
|
7 |
+
|
8 |
+
// For non-vital fields, no string length errors, but they are silently truncated.
|
9 |
+
// salutation, companyName, firstName, lastName, streetName, city: 50 characters
|
10 |
+
|
11 |
+
protected $gender; // https://en.wikipedia.org/wiki/ISO/IEC_5218
|
12 |
+
protected $salutation;
|
13 |
+
protected $companyName;
|
14 |
+
protected $firstName;
|
15 |
+
protected $lastName;
|
16 |
+
protected $streetName;
|
17 |
+
protected $houseNr;
|
18 |
+
protected $houseNrAddition;
|
19 |
+
protected $zipCode;
|
20 |
+
protected $city;
|
21 |
+
protected $countryIso;
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
26 |
+
|
27 |
+
$this->gender = Tritac_ChannelEngineApiClient_Enums_Gender::NOT_APPLICABLE;
|
28 |
+
$this->salutation = '';
|
29 |
+
$this->companyName = '';
|
30 |
+
$this->firstName = '';
|
31 |
+
$this->lastName = '';
|
32 |
+
$this->streetName = '';
|
33 |
+
$this->houseNr = '';
|
34 |
+
$this->houseNrAddition = '';
|
35 |
+
$this->zipCode = '';
|
36 |
+
$this->city = '';
|
37 |
+
$this->countryIso = '';
|
38 |
+
}
|
39 |
+
|
40 |
+
function setGender($gender) { $this->gender = $gender; }
|
41 |
+
function getGender() { return $this->gender; }
|
42 |
+
|
43 |
+
function setSalutation($salutation) { $this->salutation = $salutation; }
|
44 |
+
function getSalutation() { return $this->salutation; }
|
45 |
+
|
46 |
+
function setCompanyName($companyName) { $this->companyName = $companyName; }
|
47 |
+
function getCompanyName() { return $this->companyName; }
|
48 |
+
|
49 |
+
function setFirstName($firstName) { $this->firstName = $firstName; }
|
50 |
+
function getFirstName() { return $this->firstName; }
|
51 |
+
|
52 |
+
function setLastName($lastName) { $this->lastName = $lastName; }
|
53 |
+
function getLastName() { return $this->lastName; }
|
54 |
+
|
55 |
+
function setStreetName($streetName) { $this->streetName = $streetName; }
|
56 |
+
function getStreetName() { return $this->streetName; }
|
57 |
+
|
58 |
+
function setHouseNr($houseNr) {
|
59 |
+
|
60 |
+
if(strlen($houseNr) > 50) {
|
61 |
+
throw new Exception('HouseNr may not exceed 50 characters');
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->houseNr = $houseNr;
|
65 |
+
}
|
66 |
+
function getHouseNr() { return $this->houseNr; }
|
67 |
+
|
68 |
+
function setHouseNrAddition($houseNrAddition) {
|
69 |
+
|
70 |
+
if(strlen($houseNrAddition) > 50) {
|
71 |
+
throw new Exception('HouseNrAddition may not exceed 50 characters');
|
72 |
+
}
|
73 |
+
|
74 |
+
$this->houseNrAddition = $houseNrAddition;
|
75 |
+
|
76 |
+
}
|
77 |
+
function getHouseNrAddition() { return $this->houseNrAddition; }
|
78 |
+
|
79 |
+
function setZipCode($zipCode) { $this->zipCode = $zipCode; }
|
80 |
+
function getZipCode() { return $this->zipCode; }
|
81 |
+
|
82 |
+
function setCity($city) { $this->city = $city; }
|
83 |
+
function getCity() { return $this->city; }
|
84 |
+
|
85 |
+
function setCountryIso($countryIso) {
|
86 |
+
|
87 |
+
if(strlen($countryIso) > 2) {
|
88 |
+
throw new Exception('CountryIso may not exceed 2 characters');
|
89 |
+
}
|
90 |
+
|
91 |
+
$this->countryIso = $countryIso;
|
92 |
+
|
93 |
+
}
|
94 |
+
function getCountryIso() { return $this->countryIso; }
|
95 |
+
|
96 |
+
}
|
97 |
?>
|
lib/Tritac/ChannelEngineApiClient/Models/BaseModel.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
abstract class Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
protected $id;
|
5 |
-
|
6 |
-
public static $typeMap = array(
|
7 |
-
|
8 |
-
);
|
9 |
-
|
10 |
-
public function getTypeName()
|
11 |
-
{
|
12 |
-
return get_called_class();
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getProperties()
|
16 |
-
{
|
17 |
-
return get_object_vars($this);
|
18 |
-
}
|
19 |
-
|
20 |
-
function setId($id) { $this->id = $id; }
|
21 |
-
function getId() { return $this->id; }
|
22 |
-
|
23 |
-
}
|
1 |
+
<?php
|
2 |
+
abstract class Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
protected $id;
|
5 |
+
|
6 |
+
public static $typeMap = array(
|
7 |
+
|
8 |
+
);
|
9 |
+
|
10 |
+
public function getTypeName()
|
11 |
+
{
|
12 |
+
return get_called_class();
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getProperties()
|
16 |
+
{
|
17 |
+
return get_object_vars($this);
|
18 |
+
}
|
19 |
+
|
20 |
+
function setId($id) { $this->id = $id; }
|
21 |
+
function getId() { return $this->id; }
|
22 |
+
|
23 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/Cancellation.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Models_Cancellation extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
public static $typeMap = array(
|
5 |
-
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_CancellationLine)',
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $orderId;
|
9 |
-
protected $channelOrderNo;
|
10 |
-
protected $lines;
|
11 |
-
protected $cancellationStatus;
|
12 |
-
protected $refundInclVat;
|
13 |
-
protected $refundExclVat;
|
14 |
-
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
18 |
-
|
19 |
-
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_CancellationLine');
|
20 |
-
}
|
21 |
-
|
22 |
-
function setOrderId($orderId) { $this->orderId = $orderId; }
|
23 |
-
function getOrderId() { return $this->orderId; }
|
24 |
-
|
25 |
-
function setChannelOrderNo($channelOrderNo) { $this->channelOrderNo = $channelOrderNo; }
|
26 |
-
function getChannelOrderNo() { return $this->channelOrderNo; }
|
27 |
-
|
28 |
-
function setLines($lines) { $this->lines = $lines; }
|
29 |
-
function getLines() { return $this->lines; }
|
30 |
-
|
31 |
-
function setCancellationStatus($cancellationStatus) { $this->cancellationStatus = $cancellationStatus; }
|
32 |
-
function getCancellationStatus() { return $this->cancellationStatus; }
|
33 |
-
|
34 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
35 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
36 |
-
|
37 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
38 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
39 |
-
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Models_Cancellation extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
public static $typeMap = array(
|
5 |
+
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_CancellationLine)',
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $orderId;
|
9 |
+
protected $channelOrderNo;
|
10 |
+
protected $lines;
|
11 |
+
protected $cancellationStatus;
|
12 |
+
protected $refundInclVat;
|
13 |
+
protected $refundExclVat;
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
18 |
+
|
19 |
+
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_CancellationLine');
|
20 |
+
}
|
21 |
+
|
22 |
+
function setOrderId($orderId) { $this->orderId = $orderId; }
|
23 |
+
function getOrderId() { return $this->orderId; }
|
24 |
+
|
25 |
+
function setChannelOrderNo($channelOrderNo) { $this->channelOrderNo = $channelOrderNo; }
|
26 |
+
function getChannelOrderNo() { return $this->channelOrderNo; }
|
27 |
+
|
28 |
+
function setLines($lines) { $this->lines = $lines; }
|
29 |
+
function getLines() { return $this->lines; }
|
30 |
+
|
31 |
+
function setCancellationStatus($cancellationStatus) { $this->cancellationStatus = $cancellationStatus; }
|
32 |
+
function getCancellationStatus() { return $this->cancellationStatus; }
|
33 |
+
|
34 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
35 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
36 |
+
|
37 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
38 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
39 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/CancellationLine.php
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Models_CancellationLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
public static $typeMap = array(
|
5 |
-
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $cancellationId;
|
9 |
-
protected $orderLineId;
|
10 |
-
protected $quantity;
|
11 |
-
protected $status;
|
12 |
-
protected $refundInclVat;
|
13 |
-
protected $refundExclVat;
|
14 |
-
|
15 |
-
function setCancellationId($cancellationId) { $this->cancellationId = $cancellationId; }
|
16 |
-
function getCancellationId() { return $this->cancellationId; }
|
17 |
-
|
18 |
-
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
19 |
-
function getOrderLineId() { return $this->orderLineId; }
|
20 |
-
|
21 |
-
function setQuantity($quantity) { $this->quantity = $quantity; }
|
22 |
-
function getQuantity() { return $this->quantity; }
|
23 |
-
|
24 |
-
function setStatus($status) { $this->status = $status; }
|
25 |
-
function getStatus() { return $this->status; }
|
26 |
-
|
27 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
28 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
29 |
-
|
30 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
31 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
32 |
-
|
33 |
-
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Models_CancellationLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
public static $typeMap = array(
|
5 |
+
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $cancellationId;
|
9 |
+
protected $orderLineId;
|
10 |
+
protected $quantity;
|
11 |
+
protected $status;
|
12 |
+
protected $refundInclVat;
|
13 |
+
protected $refundExclVat;
|
14 |
+
|
15 |
+
function setCancellationId($cancellationId) { $this->cancellationId = $cancellationId; }
|
16 |
+
function getCancellationId() { return $this->cancellationId; }
|
17 |
+
|
18 |
+
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
19 |
+
function getOrderLineId() { return $this->orderLineId; }
|
20 |
+
|
21 |
+
function setQuantity($quantity) { $this->quantity = $quantity; }
|
22 |
+
function getQuantity() { return $this->quantity; }
|
23 |
+
|
24 |
+
function setStatus($status) { $this->status = $status; }
|
25 |
+
function getStatus() { return $this->status; }
|
26 |
+
|
27 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
28 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
29 |
+
|
30 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
31 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
32 |
+
|
33 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/Message.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Models_Message extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
public static $typeMap = array(
|
5 |
-
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $message;
|
9 |
-
|
10 |
-
function setMessage($message) { $this->message = $message; }
|
11 |
-
function getMessage() { return $this->message; }
|
12 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Models_Message extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
public static $typeMap = array(
|
5 |
+
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $message;
|
9 |
+
|
10 |
+
function setMessage($message) { $this->message = $message; }
|
11 |
+
function getMessage() { return $this->message; }
|
12 |
}
|
lib/Tritac/ChannelEngineApiClient/Models/Order.php
CHANGED
@@ -1,154 +1,154 @@
|
|
1 |
-
<?php
|
2 |
-
class Tritac_ChannelEngineApiClient_Models_Order extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
-
|
4 |
-
public static $typeMap = array(
|
5 |
-
'billingAddress' => 'Tritac_ChannelEngineApiClient_Models_Address',
|
6 |
-
'cancellations' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Cancellation)',
|
7 |
-
'extraData' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_OrderExtraDataItem)',
|
8 |
-
'shippingAddress' => 'Tritac_ChannelEngineApiClient_Models_Address',
|
9 |
-
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_OrderLine)',
|
10 |
-
'shipments' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Shipment)',
|
11 |
-
);
|
12 |
-
|
13 |
-
protected $phone;
|
14 |
-
protected $email;
|
15 |
-
protected $cocNo;
|
16 |
-
protected $vatNo;
|
17 |
-
protected $paymentMethod;
|
18 |
-
protected $orderDate;
|
19 |
-
protected $createdAt;
|
20 |
-
protected $updatedAt;
|
21 |
-
protected $channelId;
|
22 |
-
protected $channelOrderNo;
|
23 |
-
protected $channelCustomerNo;
|
24 |
-
protected $billingAddress;
|
25 |
-
protected $cancellations;
|
26 |
-
protected $channelName;
|
27 |
-
protected $doSendMails;
|
28 |
-
protected $canShipPartialOrderLines;
|
29 |
-
|
30 |
-
protected $merchantId;
|
31 |
-
protected $merchantOrderNo;
|
32 |
-
protected $shippingCostsInclVat;
|
33 |
-
protected $shippingCostsVat;
|
34 |
-
protected $subTotalInclVat;
|
35 |
-
protected $subTotalVat;
|
36 |
-
protected $totalInclVat;
|
37 |
-
protected $totalVat;
|
38 |
-
protected $refundInclVat;
|
39 |
-
protected $refundExclVat;
|
40 |
-
protected $extraData;
|
41 |
-
protected $shippingAddress;
|
42 |
-
protected $status;
|
43 |
-
protected $closedDate;
|
44 |
-
protected $lines;
|
45 |
-
protected $shipments;
|
46 |
-
protected $maxVatRate;
|
47 |
-
|
48 |
-
public function __construct()
|
49 |
-
{
|
50 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
51 |
-
|
52 |
-
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_OrderLine');
|
53 |
-
}
|
54 |
-
|
55 |
-
function setPhone($phone) { $this->phone = $phone; }
|
56 |
-
function getPhone() { return $this->phone; }
|
57 |
-
|
58 |
-
function setEmail($email) { $this->email = $email; }
|
59 |
-
function getEmail() { return $this->email; }
|
60 |
-
|
61 |
-
function setCocNo($cocNo) { $this->cocNo = $cocNo; }
|
62 |
-
function getCocNo() { return $this->cocNo; }
|
63 |
-
|
64 |
-
function setVatNo($vatNo) { $this->vatNo = $vatNo; }
|
65 |
-
function getVatNo() { return $this->vatNo; }
|
66 |
-
|
67 |
-
function setPaymentMethod($paymentMethod) { $this->paymentMethod = $paymentMethod; }
|
68 |
-
function getPaymentMethod() { return $this->paymentMethod; }
|
69 |
-
|
70 |
-
function setOrderDate($orderDate) { $this->orderDate = $orderDate; }
|
71 |
-
function getOrderDate() { return $this->orderDate; }
|
72 |
-
|
73 |
-
function setCreatedAt( $createdAt) { $this->createdAt = $createdAt; }
|
74 |
-
function getCreatedAt() { return $this->createdAt; }
|
75 |
-
|
76 |
-
function setUpdatedAt( $updatedAt) { $this->updatedAt = $updatedAt; }
|
77 |
-
function getUpdatedAt() { return $this->updatedAt; }
|
78 |
-
|
79 |
-
function setChannelId($channelId) { $this->channelId = $channelId; }
|
80 |
-
function getChannelId() { return $this->channelId; }
|
81 |
-
|
82 |
-
function setChannelOrderNo($channelOrderNo) { $this->channelOrderNo = $channelOrderNo; }
|
83 |
-
function getChannelOrderNo() { return $this->channelOrderNo; }
|
84 |
-
|
85 |
-
function setChannelCustomerNo($channelCustomerNo) { $this->channelCustomerNo = $channelCustomerNo; }
|
86 |
-
function getChannelCustomerNo() { return $this->channelCustomerNo; }
|
87 |
-
|
88 |
-
function setBillingAddress(Tritac_ChannelEngineApiClient_Models_Address $billingAddress) { $this->billingAddress = $billingAddress; }
|
89 |
-
function getBillingAddress() { return $this->billingAddress; }
|
90 |
-
|
91 |
-
function setCancellations($cancellations) { $this->cancellations = $cancellations; }
|
92 |
-
function getCancellations() { return $this->cancellations; }
|
93 |
-
|
94 |
-
function setChannelName($channelName) { $this->channelName = $channelName; }
|
95 |
-
function getChannelName() { return $this->channelName; }
|
96 |
-
|
97 |
-
function setDoSendMails($doSendMails) { $this->doSendMails = $doSendMails; }
|
98 |
-
function getDoSendMails() { return $this->doSendMails; }
|
99 |
-
|
100 |
-
function setCanShipPartialOrderLines($canShipPartialOrderLines) { $this->canShipPartialOrderLines = $canShipPartialOrderLines; }
|
101 |
-
function getCanShipPartialOrderLines() { return $this->canShipPartialOrderLines; }
|
102 |
-
|
103 |
-
function setMerchantId($merchantId) { $this->merchantId = $merchantId; }
|
104 |
-
function getMerchantId() { return $this->merchantId; }
|
105 |
-
|
106 |
-
function setMerchantOrderNo($merchantOrderNo) { $this->merchantOrderNo = $merchantOrderNo; }
|
107 |
-
function getMerchantOrderNo() { return $this->merchantOrderNo; }
|
108 |
-
|
109 |
-
function setShippingCostsInclVat($shippingCostsInclVat) { $this->shippingCostsInclVat = $shippingCostsInclVat; }
|
110 |
-
function getShippingCostsInclVat() { return $this->shippingCostsInclVat; }
|
111 |
-
|
112 |
-
function setShippingCostsVat($shippingCostsVat) { $this->shippingCostsVat = $shippingCostsVat; }
|
113 |
-
function getShippingCostsVat() { return $this->shippingCostsVat; }
|
114 |
-
|
115 |
-
function setSubTotalInclVat($subTotalInclVat) { $this->subTotalInclVat = $subTotalInclVat; }
|
116 |
-
function getSubTotalInclVat() { return $this->subTotalInclVat; }
|
117 |
-
|
118 |
-
function setSubTotalVat($subTotalVat) { $this->subTotalVat = $subTotalVat; }
|
119 |
-
function getSubTotalVat() { return $this->subTotalVat; }
|
120 |
-
|
121 |
-
function setTotalInclVat($totalInclVat) { $this->totalInclVat = $totalInclVat; }
|
122 |
-
function getTotalInclVat() { return $this->totalInclVat; }
|
123 |
-
|
124 |
-
function setTotalVat($totalVat) { $this->totalVat = $totalVat; }
|
125 |
-
function getTotalVat() { return $this->totalVat; }
|
126 |
-
|
127 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
128 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
129 |
-
|
130 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
131 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
132 |
-
|
133 |
-
function setExtraData($extraData) { $this->extraData = $extraData; }
|
134 |
-
function getExtraData() { return $this->extraData; }
|
135 |
-
|
136 |
-
function setShippingAddress($shippingAddress) { $this->shippingAddress = $shippingAddress; }
|
137 |
-
function getShippingAddress() { return $this->shippingAddress; }
|
138 |
-
|
139 |
-
function setStatus($status) { $this->status = $status; }
|
140 |
-
function getStatus() { return $this->status; }
|
141 |
-
|
142 |
-
function setClosedDate( $closedDate) { $this->closedDate = $closedDate; }
|
143 |
-
function getClosedDate() { return $this->closedDate; }
|
144 |
-
|
145 |
-
function setLines($lines) { $this->lines = $lines; }
|
146 |
-
function getLines() { return $this->lines; }
|
147 |
-
|
148 |
-
function setShipments($shipments) { $this->shipments = $shipments; }
|
149 |
-
function getShipments() { return $this->shipments; }
|
150 |
-
|
151 |
-
function setMaxVatRate($maxVatRate) { $this->maxVatRate = $maxVatRate; }
|
152 |
-
function getMaxVatRate() { return $this->maxVatRate; }
|
153 |
-
|
154 |
}
|
1 |
+
<?php
|
2 |
+
class Tritac_ChannelEngineApiClient_Models_Order extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
3 |
+
|
4 |
+
public static $typeMap = array(
|
5 |
+
'billingAddress' => 'Tritac_ChannelEngineApiClient_Models_Address',
|
6 |
+
'cancellations' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Cancellation)',
|
7 |
+
'extraData' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_OrderExtraDataItem)',
|
8 |
+
'shippingAddress' => 'Tritac_ChannelEngineApiClient_Models_Address',
|
9 |
+
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_OrderLine)',
|
10 |
+
'shipments' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_Shipment)',
|
11 |
+
);
|
12 |
+
|
13 |
+
protected $phone;
|
14 |
+
protected $email;
|
15 |
+
protected $cocNo;
|
16 |
+
protected $vatNo;
|
17 |
+
protected $paymentMethod;
|
18 |
+
protected $orderDate;
|
19 |
+
protected $createdAt;
|
20 |
+
protected $updatedAt;
|
21 |
+
protected $channelId;
|
22 |
+
protected $channelOrderNo;
|
23 |
+
protected $channelCustomerNo;
|
24 |
+
protected $billingAddress;
|
25 |
+
protected $cancellations;
|
26 |
+
protected $channelName;
|
27 |
+
protected $doSendMails;
|
28 |
+
protected $canShipPartialOrderLines;
|
29 |
+
|
30 |
+
protected $merchantId;
|
31 |
+
protected $merchantOrderNo;
|
32 |
+
protected $shippingCostsInclVat;
|
33 |
+
protected $shippingCostsVat;
|
34 |
+
protected $subTotalInclVat;
|
35 |
+
protected $subTotalVat;
|
36 |
+
protected $totalInclVat;
|
37 |
+
protected $totalVat;
|
38 |
+
protected $refundInclVat;
|
39 |
+
protected $refundExclVat;
|
40 |
+
protected $extraData;
|
41 |
+
protected $shippingAddress;
|
42 |
+
protected $status;
|
43 |
+
protected $closedDate;
|
44 |
+
protected $lines;
|
45 |
+
protected $shipments;
|
46 |
+
protected $maxVatRate;
|
47 |
+
|
48 |
+
public function __construct()
|
49 |
+
{
|
50 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
51 |
+
|
52 |
+
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_OrderLine');
|
53 |
+
}
|
54 |
+
|
55 |
+
function setPhone($phone) { $this->phone = $phone; }
|
56 |
+
function getPhone() { return $this->phone; }
|
57 |
+
|
58 |
+
function setEmail($email) { $this->email = $email; }
|
59 |
+
function getEmail() { return $this->email; }
|
60 |
+
|
61 |
+
function setCocNo($cocNo) { $this->cocNo = $cocNo; }
|
62 |
+
function getCocNo() { return $this->cocNo; }
|
63 |
+
|
64 |
+
function setVatNo($vatNo) { $this->vatNo = $vatNo; }
|
65 |
+
function getVatNo() { return $this->vatNo; }
|
66 |
+
|
67 |
+
function setPaymentMethod($paymentMethod) { $this->paymentMethod = $paymentMethod; }
|
68 |
+
function getPaymentMethod() { return $this->paymentMethod; }
|
69 |
+
|
70 |
+
function setOrderDate($orderDate) { $this->orderDate = $orderDate; }
|
71 |
+
function getOrderDate() { return $this->orderDate; }
|
72 |
+
|
73 |
+
function setCreatedAt( $createdAt) { $this->createdAt = $createdAt; }
|
74 |
+
function getCreatedAt() { return $this->createdAt; }
|
75 |
+
|
76 |
+
function setUpdatedAt( $updatedAt) { $this->updatedAt = $updatedAt; }
|
77 |
+
function getUpdatedAt() { return $this->updatedAt; }
|
78 |
+
|
79 |
+
function setChannelId($channelId) { $this->channelId = $channelId; }
|
80 |
+
function getChannelId() { return $this->channelId; }
|
81 |
+
|
82 |
+
function setChannelOrderNo($channelOrderNo) { $this->channelOrderNo = $channelOrderNo; }
|
83 |
+
function getChannelOrderNo() { return $this->channelOrderNo; }
|
84 |
+
|
85 |
+
function setChannelCustomerNo($channelCustomerNo) { $this->channelCustomerNo = $channelCustomerNo; }
|
86 |
+
function getChannelCustomerNo() { return $this->channelCustomerNo; }
|
87 |
+
|
88 |
+
function setBillingAddress(Tritac_ChannelEngineApiClient_Models_Address $billingAddress) { $this->billingAddress = $billingAddress; }
|
89 |
+
function getBillingAddress() { return $this->billingAddress; }
|
90 |
+
|
91 |
+
function setCancellations($cancellations) { $this->cancellations = $cancellations; }
|
92 |
+
function getCancellations() { return $this->cancellations; }
|
93 |
+
|
94 |
+
function setChannelName($channelName) { $this->channelName = $channelName; }
|
95 |
+
function getChannelName() { return $this->channelName; }
|
96 |
+
|
97 |
+
function setDoSendMails($doSendMails) { $this->doSendMails = $doSendMails; }
|
98 |
+
function getDoSendMails() { return $this->doSendMails; }
|
99 |
+
|
100 |
+
function setCanShipPartialOrderLines($canShipPartialOrderLines) { $this->canShipPartialOrderLines = $canShipPartialOrderLines; }
|
101 |
+
function getCanShipPartialOrderLines() { return $this->canShipPartialOrderLines; }
|
102 |
+
|
103 |
+
function setMerchantId($merchantId) { $this->merchantId = $merchantId; }
|
104 |
+
function getMerchantId() { return $this->merchantId; }
|
105 |
+
|
106 |
+
function setMerchantOrderNo($merchantOrderNo) { $this->merchantOrderNo = $merchantOrderNo; }
|
107 |
+
function getMerchantOrderNo() { return $this->merchantOrderNo; }
|
108 |
+
|
109 |
+
function setShippingCostsInclVat($shippingCostsInclVat) { $this->shippingCostsInclVat = $shippingCostsInclVat; }
|
110 |
+
function getShippingCostsInclVat() { return $this->shippingCostsInclVat; }
|
111 |
+
|
112 |
+
function setShippingCostsVat($shippingCostsVat) { $this->shippingCostsVat = $shippingCostsVat; }
|
113 |
+
function getShippingCostsVat() { return $this->shippingCostsVat; }
|
114 |
+
|
115 |
+
function setSubTotalInclVat($subTotalInclVat) { $this->subTotalInclVat = $subTotalInclVat; }
|
116 |
+
function getSubTotalInclVat() { return $this->subTotalInclVat; }
|
117 |
+
|
118 |
+
function setSubTotalVat($subTotalVat) { $this->subTotalVat = $subTotalVat; }
|
119 |
+
function getSubTotalVat() { return $this->subTotalVat; }
|
120 |
+
|
121 |
+
function setTotalInclVat($totalInclVat) { $this->totalInclVat = $totalInclVat; }
|
122 |
+
function getTotalInclVat() { return $this->totalInclVat; }
|
123 |
+
|
124 |
+
function setTotalVat($totalVat) { $this->totalVat = $totalVat; }
|
125 |
+
function getTotalVat() { return $this->totalVat; }
|
126 |
+
|
127 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
128 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
129 |
+
|
130 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
131 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
132 |
+
|
133 |
+
function setExtraData($extraData) { $this->extraData = $extraData; }
|
134 |
+
function getExtraData() { return $this->extraData; }
|
135 |
+
|
136 |
+
function setShippingAddress($shippingAddress) { $this->shippingAddress = $shippingAddress; }
|
137 |
+
function getShippingAddress() { return $this->shippingAddress; }
|
138 |
+
|
139 |
+
function setStatus($status) { $this->status = $status; }
|
140 |
+
function getStatus() { return $this->status; }
|
141 |
+
|
142 |
+
function setClosedDate( $closedDate) { $this->closedDate = $closedDate; }
|
143 |
+
function getClosedDate() { return $this->closedDate; }
|
144 |
+
|
145 |
+
function setLines($lines) { $this->lines = $lines; }
|
146 |
+
function getLines() { return $this->lines; }
|
147 |
+
|
148 |
+
function setShipments($shipments) { $this->shipments = $shipments; }
|
149 |
+
function getShipments() { return $this->shipments; }
|
150 |
+
|
151 |
+
function setMaxVatRate($maxVatRate) { $this->maxVatRate = $maxVatRate; }
|
152 |
+
function getMaxVatRate() { return $this->maxVatRate; }
|
153 |
+
|
154 |
}
|
lib/Tritac/ChannelEngineApiClient/Models/OrderExtraDataItem.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_OrderExtraDataItem extends Tritac_ChannelEngineApiClient_Models_BaseModel{
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
|
7 |
-
);
|
8 |
-
|
9 |
-
protected $key;
|
10 |
-
protected $value;
|
11 |
-
|
12 |
-
|
13 |
-
function setKey($key) { $this->key = $key; }
|
14 |
-
function getKey() { return $this->key; }
|
15 |
-
|
16 |
-
function setValue($value) { $this->value = $value; }
|
17 |
-
function getValue() { return $this->value; }
|
18 |
-
|
19 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_OrderExtraDataItem extends Tritac_ChannelEngineApiClient_Models_BaseModel{
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
|
7 |
+
);
|
8 |
+
|
9 |
+
protected $key;
|
10 |
+
protected $value;
|
11 |
+
|
12 |
+
|
13 |
+
function setKey($key) { $this->key = $key; }
|
14 |
+
function getKey() { return $this->key; }
|
15 |
+
|
16 |
+
function setValue($value) { $this->value = $value; }
|
17 |
+
function getValue() { return $this->value; }
|
18 |
+
|
19 |
}
|
lib/Tritac/ChannelEngineApiClient/Models/OrderLine.php
CHANGED
@@ -1,146 +1,146 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_OrderLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $channelProductNo;
|
9 |
-
protected $merchantProductNo;
|
10 |
-
protected $productEan;
|
11 |
-
protected $productName;
|
12 |
-
protected $productBrand;
|
13 |
-
protected $productVariantColor;
|
14 |
-
protected $productVariantSize;
|
15 |
-
protected $quantity;
|
16 |
-
protected $unitPriceInclVat;
|
17 |
-
protected $lineTotalInclVat;
|
18 |
-
protected $vatRate;
|
19 |
-
protected $unitVat;
|
20 |
-
protected $lineVat;
|
21 |
-
protected $feeFixed;
|
22 |
-
protected $feeRate;
|
23 |
-
protected $deliveryTimeIndication;
|
24 |
-
protected $expectedDeliveryDate;
|
25 |
-
protected $status;
|
26 |
-
protected $closedDate;
|
27 |
-
protected $closedQuantity;
|
28 |
-
protected $cancelledQuantity;
|
29 |
-
protected $shippedQuantity;
|
30 |
-
protected $mancoQuantity;
|
31 |
-
|
32 |
-
public function __construct()
|
33 |
-
{
|
34 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
35 |
-
}
|
36 |
-
|
37 |
-
function setChannelProductNo($channelProductNo) { $this->channelProductNo = $channelProductNo; }
|
38 |
-
function getChannelProductNo() { return $this->channelProductNo; }
|
39 |
-
|
40 |
-
function setMerchantProductNo($merchantProductNo) { $this->merchantProductNo = $merchantProductNo; }
|
41 |
-
function getMerchantProductNo() { return $this->merchantProductNo; }
|
42 |
-
|
43 |
-
function setProductEan($productEan) { $this->productEan = $productEan; }
|
44 |
-
function getProductEan() { return $this->productEan; }
|
45 |
-
|
46 |
-
function setProductName($productName) { $this->productName = $productName; }
|
47 |
-
function getProductName() { return $this->productName; }
|
48 |
-
|
49 |
-
function setProductBrand($productBrand) { $this->productBrand = $productBrand; }
|
50 |
-
function getProductBrand() { return $this->productBrand; }
|
51 |
-
|
52 |
-
function setProductVariantColor($productVariantColor) { $this->productVariantColor = $productVariantColor; }
|
53 |
-
function getProductVariantColor() { return $this->productVariantColor; }
|
54 |
-
|
55 |
-
function setProductVariantSize($productVariantSize) { $this->productVariantSize = $productVariantSize; }
|
56 |
-
function getProductVariantSize() { return $this->productVariantSize; }
|
57 |
-
|
58 |
-
function setQuantity($quantity) { $this->quantity = $quantity; }
|
59 |
-
function getQuantity() { return $this->quantity; }
|
60 |
-
|
61 |
-
function setUnitPriceInclVat($unitPriceInclVat) { $this->unitPriceInclVat = $unitPriceInclVat; }
|
62 |
-
function getUnitPriceInclVat() { return $this->unitPriceInclVat; }
|
63 |
-
|
64 |
-
function setLineTotalInclVat($lineTotalInclVat) { $this->lineTotalInclVat = $lineTotalInclVat; }
|
65 |
-
function getLineTotalInclVat() { return $this->lineTotalInclVat; }
|
66 |
-
|
67 |
-
function setVatRate($vatRate) { $this->vatRate = $vatRate; }
|
68 |
-
function getVatRate() { return $this->vatRate; }
|
69 |
-
|
70 |
-
function setUnitVat($unitVat) { $this->unitVat = $unitVat; }
|
71 |
-
function getUnitVat() { return $this->unitVat; }
|
72 |
-
|
73 |
-
function setLineVat($lineVat) { $this->lineVat = $lineVat; }
|
74 |
-
function getLineVat() { return $this->lineVat; }
|
75 |
-
|
76 |
-
function setFeeFixed($feeFixed) { $this->feeFixed = $feeFixed; }
|
77 |
-
function getFeeFixed() { return $this->feeFixed; }
|
78 |
-
|
79 |
-
function setFeeRate($feeRate) { $this->feeRate = $feeRate; }
|
80 |
-
function getFeeRate() { return $this->feeRate; }
|
81 |
-
|
82 |
-
function setExpectedDeliveryDate( $expectedDeliveryDate) { $this->expectedDeliveryDate = $expectedDeliveryDate; }
|
83 |
-
function getExpectedDeliveryDate() { return $this->expectedDeliveryDate; }
|
84 |
-
|
85 |
-
function setDeliveryTimeIndication($deliveryTimeIndication) { $this->deliveryTimeIndication = $deliveryTimeIndication; }
|
86 |
-
function getDeliveryTimeIndication() { return $this->deliveryTimeIndication; }
|
87 |
-
|
88 |
-
function setStatus($status) { $this->status = $status; }
|
89 |
-
function getStatus() { return $this->status; }
|
90 |
-
|
91 |
-
function setClosedDate( $closedDate) { $this->closedDate = $closedDate; }
|
92 |
-
function getClosedDate() { return $this->closedDate; }
|
93 |
-
|
94 |
-
function setClosedQuantity($closedQuantity) { $this->closedQuantity = $closedQuantity; }
|
95 |
-
function getClosedQuantity() { return $this->closedQuantity; }
|
96 |
-
|
97 |
-
function setCancelledQuantity($cancelledQuantity) { $this->cancelledQuantity = $cancelledQuantity; }
|
98 |
-
function getCancelledQuantity() { return $this->cancelledQuantity; }
|
99 |
-
|
100 |
-
function setShippedQuantity($shippedQuantity) { $this->shippedQuantity = $shippedQuantity; }
|
101 |
-
function getShippedQuantity() { return $this->shippedQuantity; }
|
102 |
-
|
103 |
-
function setMancoQuantity($mancoQuantity) { $this->mancoQuantity = $mancoQuantity; }
|
104 |
-
function getMancoQuantity() { return $this->mancoQuantity; }
|
105 |
-
/*
|
106 |
-
[Required]
|
107 |
-
[StringLength(50)]
|
108 |
-
public string ChannelProductNo { get; set; }
|
109 |
-
// This one or ProductEan is required:
|
110 |
-
[StringLength(50)]
|
111 |
-
public string MerchantProductNo { get; set; }
|
112 |
-
[StringLength(20)]
|
113 |
-
public string ProductEan { get; set; }
|
114 |
-
|
115 |
-
// For non-vital fields, no string length errors, but they are silently truncated.
|
116 |
-
// productName, (100)
|
117 |
-
// productGroup, (50)
|
118 |
-
// productBrand,productVariantColor,productVariantSize (20)
|
119 |
-
|
120 |
-
[Required]
|
121 |
-
public string ProductName { get; set; }
|
122 |
-
public string ProductGroup { get; set; }
|
123 |
-
public string ProductBrand { get; set; }
|
124 |
-
public string ProductVariantColor { get; set; }
|
125 |
-
public string ProductVariantSize { get; set; }
|
126 |
-
|
127 |
-
public int Quantity { get; set; }
|
128 |
-
public decimal UnitPriceInclVat { get; set; }
|
129 |
-
public decimal? LineTotalInclVat { get; set; }
|
130 |
-
public decimal VatRate { get; set; }
|
131 |
-
public decimal? UnitVat { get; set; }
|
132 |
-
public decimal? LineVat { get; set; }
|
133 |
-
public decimal FeeFixed { get; set; }
|
134 |
-
public decimal FeeRate { get; set; }
|
135 |
-
|
136 |
-
public DateTime ExpectedDeliveryDate { get; set; }
|
137 |
-
|
138 |
-
public OrderStatus Status { get; set; }
|
139 |
-
|
140 |
-
public DateTime? ClosedDate { get; set; }
|
141 |
-
public int ClosedQuantity { get; set; }
|
142 |
-
public int CancelledQuantity { get; set; }
|
143 |
-
public int ShippedQuantity { get; set; }
|
144 |
-
public int MancoQuantity { get; set; }
|
145 |
-
*/
|
146 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_OrderLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $channelProductNo;
|
9 |
+
protected $merchantProductNo;
|
10 |
+
protected $productEan;
|
11 |
+
protected $productName;
|
12 |
+
protected $productBrand;
|
13 |
+
protected $productVariantColor;
|
14 |
+
protected $productVariantSize;
|
15 |
+
protected $quantity;
|
16 |
+
protected $unitPriceInclVat;
|
17 |
+
protected $lineTotalInclVat;
|
18 |
+
protected $vatRate;
|
19 |
+
protected $unitVat;
|
20 |
+
protected $lineVat;
|
21 |
+
protected $feeFixed;
|
22 |
+
protected $feeRate;
|
23 |
+
protected $deliveryTimeIndication;
|
24 |
+
protected $expectedDeliveryDate;
|
25 |
+
protected $status;
|
26 |
+
protected $closedDate;
|
27 |
+
protected $closedQuantity;
|
28 |
+
protected $cancelledQuantity;
|
29 |
+
protected $shippedQuantity;
|
30 |
+
protected $mancoQuantity;
|
31 |
+
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
35 |
+
}
|
36 |
+
|
37 |
+
function setChannelProductNo($channelProductNo) { $this->channelProductNo = $channelProductNo; }
|
38 |
+
function getChannelProductNo() { return $this->channelProductNo; }
|
39 |
+
|
40 |
+
function setMerchantProductNo($merchantProductNo) { $this->merchantProductNo = $merchantProductNo; }
|
41 |
+
function getMerchantProductNo() { return $this->merchantProductNo; }
|
42 |
+
|
43 |
+
function setProductEan($productEan) { $this->productEan = $productEan; }
|
44 |
+
function getProductEan() { return $this->productEan; }
|
45 |
+
|
46 |
+
function setProductName($productName) { $this->productName = $productName; }
|
47 |
+
function getProductName() { return $this->productName; }
|
48 |
+
|
49 |
+
function setProductBrand($productBrand) { $this->productBrand = $productBrand; }
|
50 |
+
function getProductBrand() { return $this->productBrand; }
|
51 |
+
|
52 |
+
function setProductVariantColor($productVariantColor) { $this->productVariantColor = $productVariantColor; }
|
53 |
+
function getProductVariantColor() { return $this->productVariantColor; }
|
54 |
+
|
55 |
+
function setProductVariantSize($productVariantSize) { $this->productVariantSize = $productVariantSize; }
|
56 |
+
function getProductVariantSize() { return $this->productVariantSize; }
|
57 |
+
|
58 |
+
function setQuantity($quantity) { $this->quantity = $quantity; }
|
59 |
+
function getQuantity() { return $this->quantity; }
|
60 |
+
|
61 |
+
function setUnitPriceInclVat($unitPriceInclVat) { $this->unitPriceInclVat = $unitPriceInclVat; }
|
62 |
+
function getUnitPriceInclVat() { return $this->unitPriceInclVat; }
|
63 |
+
|
64 |
+
function setLineTotalInclVat($lineTotalInclVat) { $this->lineTotalInclVat = $lineTotalInclVat; }
|
65 |
+
function getLineTotalInclVat() { return $this->lineTotalInclVat; }
|
66 |
+
|
67 |
+
function setVatRate($vatRate) { $this->vatRate = $vatRate; }
|
68 |
+
function getVatRate() { return $this->vatRate; }
|
69 |
+
|
70 |
+
function setUnitVat($unitVat) { $this->unitVat = $unitVat; }
|
71 |
+
function getUnitVat() { return $this->unitVat; }
|
72 |
+
|
73 |
+
function setLineVat($lineVat) { $this->lineVat = $lineVat; }
|
74 |
+
function getLineVat() { return $this->lineVat; }
|
75 |
+
|
76 |
+
function setFeeFixed($feeFixed) { $this->feeFixed = $feeFixed; }
|
77 |
+
function getFeeFixed() { return $this->feeFixed; }
|
78 |
+
|
79 |
+
function setFeeRate($feeRate) { $this->feeRate = $feeRate; }
|
80 |
+
function getFeeRate() { return $this->feeRate; }
|
81 |
+
|
82 |
+
function setExpectedDeliveryDate( $expectedDeliveryDate) { $this->expectedDeliveryDate = $expectedDeliveryDate; }
|
83 |
+
function getExpectedDeliveryDate() { return $this->expectedDeliveryDate; }
|
84 |
+
|
85 |
+
function setDeliveryTimeIndication($deliveryTimeIndication) { $this->deliveryTimeIndication = $deliveryTimeIndication; }
|
86 |
+
function getDeliveryTimeIndication() { return $this->deliveryTimeIndication; }
|
87 |
+
|
88 |
+
function setStatus($status) { $this->status = $status; }
|
89 |
+
function getStatus() { return $this->status; }
|
90 |
+
|
91 |
+
function setClosedDate( $closedDate) { $this->closedDate = $closedDate; }
|
92 |
+
function getClosedDate() { return $this->closedDate; }
|
93 |
+
|
94 |
+
function setClosedQuantity($closedQuantity) { $this->closedQuantity = $closedQuantity; }
|
95 |
+
function getClosedQuantity() { return $this->closedQuantity; }
|
96 |
+
|
97 |
+
function setCancelledQuantity($cancelledQuantity) { $this->cancelledQuantity = $cancelledQuantity; }
|
98 |
+
function getCancelledQuantity() { return $this->cancelledQuantity; }
|
99 |
+
|
100 |
+
function setShippedQuantity($shippedQuantity) { $this->shippedQuantity = $shippedQuantity; }
|
101 |
+
function getShippedQuantity() { return $this->shippedQuantity; }
|
102 |
+
|
103 |
+
function setMancoQuantity($mancoQuantity) { $this->mancoQuantity = $mancoQuantity; }
|
104 |
+
function getMancoQuantity() { return $this->mancoQuantity; }
|
105 |
+
/*
|
106 |
+
[Required]
|
107 |
+
[StringLength(50)]
|
108 |
+
public string ChannelProductNo { get; set; }
|
109 |
+
// This one or ProductEan is required:
|
110 |
+
[StringLength(50)]
|
111 |
+
public string MerchantProductNo { get; set; }
|
112 |
+
[StringLength(20)]
|
113 |
+
public string ProductEan { get; set; }
|
114 |
+
|
115 |
+
// For non-vital fields, no string length errors, but they are silently truncated.
|
116 |
+
// productName, (100)
|
117 |
+
// productGroup, (50)
|
118 |
+
// productBrand,productVariantColor,productVariantSize (20)
|
119 |
+
|
120 |
+
[Required]
|
121 |
+
public string ProductName { get; set; }
|
122 |
+
public string ProductGroup { get; set; }
|
123 |
+
public string ProductBrand { get; set; }
|
124 |
+
public string ProductVariantColor { get; set; }
|
125 |
+
public string ProductVariantSize { get; set; }
|
126 |
+
|
127 |
+
public int Quantity { get; set; }
|
128 |
+
public decimal UnitPriceInclVat { get; set; }
|
129 |
+
public decimal? LineTotalInclVat { get; set; }
|
130 |
+
public decimal VatRate { get; set; }
|
131 |
+
public decimal? UnitVat { get; set; }
|
132 |
+
public decimal? LineVat { get; set; }
|
133 |
+
public decimal FeeFixed { get; set; }
|
134 |
+
public decimal FeeRate { get; set; }
|
135 |
+
|
136 |
+
public DateTime ExpectedDeliveryDate { get; set; }
|
137 |
+
|
138 |
+
public OrderStatus Status { get; set; }
|
139 |
+
|
140 |
+
public DateTime? ClosedDate { get; set; }
|
141 |
+
public int ClosedQuantity { get; set; }
|
142 |
+
public int CancelledQuantity { get; set; }
|
143 |
+
public int ShippedQuantity { get; set; }
|
144 |
+
public int MancoQuantity { get; set; }
|
145 |
+
*/
|
146 |
}
|
lib/Tritac/ChannelEngineApiClient/Models/ReturnLine.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_ReturnLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $returnId;
|
9 |
-
protected $orderLineId;
|
10 |
-
protected $shipmentLineId;
|
11 |
-
protected $quantity;
|
12 |
-
protected $acceptedQuantity;
|
13 |
-
protected $rejectedQuantity;
|
14 |
-
protected $refundInclVat;
|
15 |
-
protected $refundExclVat;
|
16 |
-
|
17 |
-
public function __construct()
|
18 |
-
{
|
19 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
20 |
-
}
|
21 |
-
|
22 |
-
function setReturnId($returnId) { $this->returnId = $returnId; }
|
23 |
-
function getReturnId() { return $this->returnId; }
|
24 |
-
|
25 |
-
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
26 |
-
function getOrderLineId() { return $this->orderLineId; }
|
27 |
-
|
28 |
-
function setShipmentLineId($shipmentLineId) { $this->shipmentLineId = $shipmentLineId; }
|
29 |
-
function getShipmentLineId() { return $this->shipmentLineId; }
|
30 |
-
|
31 |
-
function setQuantity($quantity) { $this->quantity = $quantity; }
|
32 |
-
function getQuantity() { return $this->quantity; }
|
33 |
-
|
34 |
-
function setAcceptedQuantity($acceptedQuantity) { $this->acceptedQuantity = $acceptedQuantity; }
|
35 |
-
function getAcceptedQuantity() { return $this->acceptedQuantity; }
|
36 |
-
|
37 |
-
function setRejectedQuantity($rejectedQuantity) { $this->rejectedQuantity = $rejectedQuantity; }
|
38 |
-
function getRejectedQuantity() { return $this->rejectedQuantity; }
|
39 |
-
|
40 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
41 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
42 |
-
|
43 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
44 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
45 |
-
|
46 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_ReturnLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $returnId;
|
9 |
+
protected $orderLineId;
|
10 |
+
protected $shipmentLineId;
|
11 |
+
protected $quantity;
|
12 |
+
protected $acceptedQuantity;
|
13 |
+
protected $rejectedQuantity;
|
14 |
+
protected $refundInclVat;
|
15 |
+
protected $refundExclVat;
|
16 |
+
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
20 |
+
}
|
21 |
+
|
22 |
+
function setReturnId($returnId) { $this->returnId = $returnId; }
|
23 |
+
function getReturnId() { return $this->returnId; }
|
24 |
+
|
25 |
+
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
26 |
+
function getOrderLineId() { return $this->orderLineId; }
|
27 |
+
|
28 |
+
function setShipmentLineId($shipmentLineId) { $this->shipmentLineId = $shipmentLineId; }
|
29 |
+
function getShipmentLineId() { return $this->shipmentLineId; }
|
30 |
+
|
31 |
+
function setQuantity($quantity) { $this->quantity = $quantity; }
|
32 |
+
function getQuantity() { return $this->quantity; }
|
33 |
+
|
34 |
+
function setAcceptedQuantity($acceptedQuantity) { $this->acceptedQuantity = $acceptedQuantity; }
|
35 |
+
function getAcceptedQuantity() { return $this->acceptedQuantity; }
|
36 |
+
|
37 |
+
function setRejectedQuantity($rejectedQuantity) { $this->rejectedQuantity = $rejectedQuantity; }
|
38 |
+
function getRejectedQuantity() { return $this->rejectedQuantity; }
|
39 |
+
|
40 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
41 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
42 |
+
|
43 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
44 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
45 |
+
|
46 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/ReturnObject.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_ReturnObject extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ReturnLine)'
|
7 |
-
);
|
8 |
-
|
9 |
-
protected $orderId;
|
10 |
-
protected $shipmentId;
|
11 |
-
protected $merchantReturnNo;
|
12 |
-
protected $createdAt;
|
13 |
-
protected $updatedAt;
|
14 |
-
protected $status;
|
15 |
-
protected $reason;
|
16 |
-
protected $comment;
|
17 |
-
protected $merchantComment;
|
18 |
-
protected $refundInclVat;
|
19 |
-
protected $refundExclVat;
|
20 |
-
protected $lines;
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
25 |
-
|
26 |
-
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ReturnLine');
|
27 |
-
}
|
28 |
-
|
29 |
-
function setOrderId($orderId) { $this->orderId = $orderId; }
|
30 |
-
function getOrderId() { return $this->orderId; }
|
31 |
-
|
32 |
-
function setShipmentId($shipmentId) { $this->shipmentId = $shipmentId; }
|
33 |
-
function getShipmentId() { return $this->shipmentId; }
|
34 |
-
|
35 |
-
function setMerchantReturnNo($merchantReturnNo) { $this->merchantReturnNo = $merchantReturnNo; }
|
36 |
-
function getMerchantReturnNo() { return $this->merchantReturnNo; }
|
37 |
-
|
38 |
-
function setCreatedAt( $createdAt) { $this->createdAt = $createdAt; }
|
39 |
-
function getCreatedAt() { return $this->createdAt; }
|
40 |
-
|
41 |
-
function setUpdatedAt( $updatedAt) { $this->updatedAt = $updatedAt; }
|
42 |
-
function getUpdatedAt() { return $this->updatedAt; }
|
43 |
-
|
44 |
-
function setStatus($status) { $this->status = $status; }
|
45 |
-
function getStatus() { return $this->status; }
|
46 |
-
|
47 |
-
function setReason($reason) { $this->reason = $reason; }
|
48 |
-
function getReason() { return $this->reason; }
|
49 |
-
|
50 |
-
function setComment($comment) { $this->comment = $comment; }
|
51 |
-
function getComment() { return $this->comment; }
|
52 |
-
|
53 |
-
function setMerchantComment($merchantComment) { $this->merchantComment = $merchantComment; }
|
54 |
-
function getMerchantComment() { return $this->merchantComment; }
|
55 |
-
|
56 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
57 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
58 |
-
|
59 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
60 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
61 |
-
|
62 |
-
function setLines($lines) { $this->lines = $lines; }
|
63 |
-
function getLines() { return $this->lines; }
|
64 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_ReturnObject extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ReturnLine)'
|
7 |
+
);
|
8 |
+
|
9 |
+
protected $orderId;
|
10 |
+
protected $shipmentId;
|
11 |
+
protected $merchantReturnNo;
|
12 |
+
protected $createdAt;
|
13 |
+
protected $updatedAt;
|
14 |
+
protected $status;
|
15 |
+
protected $reason;
|
16 |
+
protected $comment;
|
17 |
+
protected $merchantComment;
|
18 |
+
protected $refundInclVat;
|
19 |
+
protected $refundExclVat;
|
20 |
+
protected $lines;
|
21 |
+
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
25 |
+
|
26 |
+
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ReturnLine');
|
27 |
+
}
|
28 |
+
|
29 |
+
function setOrderId($orderId) { $this->orderId = $orderId; }
|
30 |
+
function getOrderId() { return $this->orderId; }
|
31 |
+
|
32 |
+
function setShipmentId($shipmentId) { $this->shipmentId = $shipmentId; }
|
33 |
+
function getShipmentId() { return $this->shipmentId; }
|
34 |
+
|
35 |
+
function setMerchantReturnNo($merchantReturnNo) { $this->merchantReturnNo = $merchantReturnNo; }
|
36 |
+
function getMerchantReturnNo() { return $this->merchantReturnNo; }
|
37 |
+
|
38 |
+
function setCreatedAt( $createdAt) { $this->createdAt = $createdAt; }
|
39 |
+
function getCreatedAt() { return $this->createdAt; }
|
40 |
+
|
41 |
+
function setUpdatedAt( $updatedAt) { $this->updatedAt = $updatedAt; }
|
42 |
+
function getUpdatedAt() { return $this->updatedAt; }
|
43 |
+
|
44 |
+
function setStatus($status) { $this->status = $status; }
|
45 |
+
function getStatus() { return $this->status; }
|
46 |
+
|
47 |
+
function setReason($reason) { $this->reason = $reason; }
|
48 |
+
function getReason() { return $this->reason; }
|
49 |
+
|
50 |
+
function setComment($comment) { $this->comment = $comment; }
|
51 |
+
function getComment() { return $this->comment; }
|
52 |
+
|
53 |
+
function setMerchantComment($merchantComment) { $this->merchantComment = $merchantComment; }
|
54 |
+
function getMerchantComment() { return $this->merchantComment; }
|
55 |
+
|
56 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
57 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
58 |
+
|
59 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
60 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
61 |
+
|
62 |
+
function setLines($lines) { $this->lines = $lines; }
|
63 |
+
function getLines() { return $this->lines; }
|
64 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/Shipment.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_Shipment extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ShipmentLine)',
|
7 |
-
);
|
8 |
-
|
9 |
-
protected $orderId;
|
10 |
-
protected $createdAt;
|
11 |
-
protected $updatedAt;
|
12 |
-
protected $trackTraceNo;
|
13 |
-
protected $trackTraceUrl;
|
14 |
-
protected $method;
|
15 |
-
protected $merchantShipmentNo;
|
16 |
-
protected $lines;
|
17 |
-
protected $refundInclVat;
|
18 |
-
protected $refundExclVat;
|
19 |
-
protected $status;
|
20 |
-
protected $mancoReason;
|
21 |
-
protected $mancoComment;
|
22 |
-
|
23 |
-
public function __construct()
|
24 |
-
{
|
25 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
26 |
-
$date = new DateTime();
|
27 |
-
$this->orderId = null;
|
28 |
-
$this->trackTraceNo = '';
|
29 |
-
$this->trackTraceUrl = '';
|
30 |
-
$this->method = '';
|
31 |
-
$this->merchantShipmentNo = '';
|
32 |
-
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ShipmentLine');
|
33 |
-
$this->refundInclVat = null;
|
34 |
-
$this->refundExclVat = null;
|
35 |
-
$this->status = Tritac_ChannelEngineApiClient_Enums_ShipmentStatus::PENDING;
|
36 |
-
$this->mancoReason = Tritac_ChannelEngineApiClient_Enums_MancoReason::NOT_IN_STOCK;
|
37 |
-
$this->mancoComment = '';
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
function setOrderId($orderId) { $this->orderId = $orderId; }
|
42 |
-
function getOrderId() { return $this->orderId; }
|
43 |
-
|
44 |
-
function setTrackTraceNo($trackTraceNo) { $this->trackTraceNo = $trackTraceNo; }
|
45 |
-
function getTrackTraceNo() { return $this->trackTraceNo; }
|
46 |
-
|
47 |
-
function setTrackTraceUrl($trackTraceUrl) { $this->trackTraceUrl = $trackTraceUrl; }
|
48 |
-
function getTrackTraceUrl() { return $this->trackTraceUrl; }
|
49 |
-
|
50 |
-
function setMethod($method) { $this->method = $method; }
|
51 |
-
function getMethod() { return $this->method; }
|
52 |
-
|
53 |
-
function setMerchantShipmentNo($merchantShipmentNo) { $this->merchantShipmentNo = $merchantShipmentNo; }
|
54 |
-
function getMerchantShipmentNo() { return $this->merchantShipmentNo; }
|
55 |
-
|
56 |
-
function setLines($lines) { $this->lines = $lines; }
|
57 |
-
function getLines() { return $this->lines; }
|
58 |
-
|
59 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
60 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
61 |
-
|
62 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
63 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
64 |
-
|
65 |
-
function setStatus($status) { $this->status = $status; }
|
66 |
-
function getStatus() { return $this->status; }
|
67 |
-
|
68 |
-
function setMancoReason($mancoReason) { $this->mancoReason = $mancoReason; }
|
69 |
-
function getMancoReason() { return $this->mancoReason; }
|
70 |
-
|
71 |
-
function setMancoComment($mancoComment) { $this->mancoComment = $mancoComment; }
|
72 |
-
function getMancoComment() { return $this->mancoComment; }
|
73 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_Shipment extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
'lines' => 'Tritac_ChannelEngineApiClient_Helpers_Collection(Tritac_ChannelEngineApiClient_Models_ShipmentLine)',
|
7 |
+
);
|
8 |
+
|
9 |
+
protected $orderId;
|
10 |
+
protected $createdAt;
|
11 |
+
protected $updatedAt;
|
12 |
+
protected $trackTraceNo;
|
13 |
+
protected $trackTraceUrl;
|
14 |
+
protected $method;
|
15 |
+
protected $merchantShipmentNo;
|
16 |
+
protected $lines;
|
17 |
+
protected $refundInclVat;
|
18 |
+
protected $refundExclVat;
|
19 |
+
protected $status;
|
20 |
+
protected $mancoReason;
|
21 |
+
protected $mancoComment;
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
26 |
+
$date = new DateTime();
|
27 |
+
$this->orderId = null;
|
28 |
+
$this->trackTraceNo = '';
|
29 |
+
$this->trackTraceUrl = '';
|
30 |
+
$this->method = '';
|
31 |
+
$this->merchantShipmentNo = '';
|
32 |
+
$this->lines = new Tritac_ChannelEngineApiClient_Helpers_Collection('Tritac_ChannelEngineApiClient_Models_ShipmentLine');
|
33 |
+
$this->refundInclVat = null;
|
34 |
+
$this->refundExclVat = null;
|
35 |
+
$this->status = Tritac_ChannelEngineApiClient_Enums_ShipmentStatus::PENDING;
|
36 |
+
$this->mancoReason = Tritac_ChannelEngineApiClient_Enums_MancoReason::NOT_IN_STOCK;
|
37 |
+
$this->mancoComment = '';
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
function setOrderId($orderId) { $this->orderId = $orderId; }
|
42 |
+
function getOrderId() { return $this->orderId; }
|
43 |
+
|
44 |
+
function setTrackTraceNo($trackTraceNo) { $this->trackTraceNo = $trackTraceNo; }
|
45 |
+
function getTrackTraceNo() { return $this->trackTraceNo; }
|
46 |
+
|
47 |
+
function setTrackTraceUrl($trackTraceUrl) { $this->trackTraceUrl = $trackTraceUrl; }
|
48 |
+
function getTrackTraceUrl() { return $this->trackTraceUrl; }
|
49 |
+
|
50 |
+
function setMethod($method) { $this->method = $method; }
|
51 |
+
function getMethod() { return $this->method; }
|
52 |
+
|
53 |
+
function setMerchantShipmentNo($merchantShipmentNo) { $this->merchantShipmentNo = $merchantShipmentNo; }
|
54 |
+
function getMerchantShipmentNo() { return $this->merchantShipmentNo; }
|
55 |
+
|
56 |
+
function setLines($lines) { $this->lines = $lines; }
|
57 |
+
function getLines() { return $this->lines; }
|
58 |
+
|
59 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
60 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
61 |
+
|
62 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
63 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
64 |
+
|
65 |
+
function setStatus($status) { $this->status = $status; }
|
66 |
+
function getStatus() { return $this->status; }
|
67 |
+
|
68 |
+
function setMancoReason($mancoReason) { $this->mancoReason = $mancoReason; }
|
69 |
+
function getMancoReason() { return $this->mancoReason; }
|
70 |
+
|
71 |
+
function setMancoComment($mancoComment) { $this->mancoComment = $mancoComment; }
|
72 |
+
function getMancoComment() { return $this->mancoComment; }
|
73 |
+
}
|
lib/Tritac/ChannelEngineApiClient/Models/ShipmentLine.php
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Tritac_ChannelEngineApiClient_Models_ShipmentLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
-
|
5 |
-
public static $typeMap = array(
|
6 |
-
);
|
7 |
-
|
8 |
-
protected $shipmentId;
|
9 |
-
protected $orderLineId;
|
10 |
-
protected $status;
|
11 |
-
protected $quantity;
|
12 |
-
protected $expectedDate;
|
13 |
-
protected $refundInclVat;
|
14 |
-
protected $refundExclVat;
|
15 |
-
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
19 |
-
$this->shipmentId = null;
|
20 |
-
$this->orderLineId = 0;
|
21 |
-
$this->status = Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus::SHIPPED;
|
22 |
-
$this->quantity = 0;
|
23 |
-
$this->expectedDate = null;
|
24 |
-
$this->refundInclVat = 0;
|
25 |
-
$this->refundExclVat = 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
function setShipmentId($shipmentId) { $this->shipmentId = $shipmentId; }
|
29 |
-
function getShipmentId() { return $this->shipmentId; }
|
30 |
-
|
31 |
-
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
32 |
-
function getOrderLineId() { return $this->orderLineId; }
|
33 |
-
|
34 |
-
function setStatus($status) { $this->status = $status; }
|
35 |
-
function getStatus() { return $this->status; }
|
36 |
-
|
37 |
-
function setQuantity($quantity) { $this->quantity = $quantity; }
|
38 |
-
function getQuantity() { return $this->quantity; }
|
39 |
-
|
40 |
-
function setExpectedDate( $expectedDate) { $this->expectedDate = $expectedDate; }
|
41 |
-
function getExpectedDate() { return $this->expectedDate; }
|
42 |
-
|
43 |
-
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
44 |
-
function getRefundInclVat() { return $this->refundInclVat; }
|
45 |
-
|
46 |
-
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
47 |
-
function getRefundExclVat() { return $this->refundExclVat; }
|
48 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tritac_ChannelEngineApiClient_Models_ShipmentLine extends Tritac_ChannelEngineApiClient_Models_BaseModel {
|
4 |
+
|
5 |
+
public static $typeMap = array(
|
6 |
+
);
|
7 |
+
|
8 |
+
protected $shipmentId;
|
9 |
+
protected $orderLineId;
|
10 |
+
protected $status;
|
11 |
+
protected $quantity;
|
12 |
+
protected $expectedDate;
|
13 |
+
protected $refundInclVat;
|
14 |
+
protected $refundExclVat;
|
15 |
+
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
self::$typeMap = array_merge(parent::$typeMap, self::$typeMap);
|
19 |
+
$this->shipmentId = null;
|
20 |
+
$this->orderLineId = 0;
|
21 |
+
$this->status = Tritac_ChannelEngineApiClient_Enums_ShipmentLineStatus::SHIPPED;
|
22 |
+
$this->quantity = 0;
|
23 |
+
$this->expectedDate = null;
|
24 |
+
$this->refundInclVat = 0;
|
25 |
+
$this->refundExclVat = 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
function setShipmentId($shipmentId) { $this->shipmentId = $shipmentId; }
|
29 |
+
function getShipmentId() { return $this->shipmentId; }
|
30 |
+
|
31 |
+
function setOrderLineId($orderLineId) { $this->orderLineId = $orderLineId; }
|
32 |
+
function getOrderLineId() { return $this->orderLineId; }
|
33 |
+
|
34 |
+
function setStatus($status) { $this->status = $status; }
|
35 |
+
function getStatus() { return $this->status; }
|
36 |
+
|
37 |
+
function setQuantity($quantity) { $this->quantity = $quantity; }
|
38 |
+
function getQuantity() { return $this->quantity; }
|
39 |
+
|
40 |
+
function setExpectedDate( $expectedDate) { $this->expectedDate = $expectedDate; }
|
41 |
+
function getExpectedDate() { return $this->expectedDate; }
|
42 |
+
|
43 |
+
function setRefundInclVat($refundInclVat) { $this->refundInclVat = $refundInclVat; }
|
44 |
+
function getRefundInclVat() { return $this->refundInclVat; }
|
45 |
+
|
46 |
+
function setRefundExclVat($refundExclVat) { $this->refundExclVat = $refundExclVat; }
|
47 |
+
function getRefundExclVat() { return $this->refundExclVat; }
|
48 |
}
|
lib/Tritac/ChannelEngineApiClient/loader.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// This loader is required to make use of the php __autoload functionality.
|
4 |
-
|
5 |
-
/*function __autoload($class) {
|
6 |
-
$class = str_replace('\\', '/', $class) . '.php';
|
7 |
-
require_once($class);
|
8 |
-
}*/
|
9 |
-
|
10 |
-
// Add your class dir to include path
|
11 |
-
set_include_path(get_include_path() . PATH_SEPARATOR);
|
12 |
-
|
13 |
-
// Use default autoload implementation
|
14 |
spl_autoload_register();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// This loader is required to make use of the php __autoload functionality.
|
4 |
+
|
5 |
+
/*function __autoload($class) {
|
6 |
+
$class = str_replace('\\', '/', $class) . '.php';
|
7 |
+
require_once($class);
|
8 |
+
}*/
|
9 |
+
|
10 |
+
// Add your class dir to include path
|
11 |
+
set_include_path(get_include_path() . PATH_SEPARATOR);
|
12 |
+
|
13 |
+
// Use default autoload implementation
|
14 |
spl_autoload_register();
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Tritac_ChannelEngine</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Connect your Magento shop to the ChannelEngine platform.</summary>
|
10 |
<description>Easily offer your products on comparison websites and marketplaces using the ChannelEngine platform.</description>
|
11 |
-
<notes>*
|
12 |
<authors><author><name>ChannelEngine</name><user>christiaander</user><email>christiaan@tritac.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Tritac_ChannelEngine.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Tritac_ChannelEngine</name>
|
4 |
+
<version>3.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Connect your Magento shop to the ChannelEngine platform.</summary>
|
10 |
<description>Easily offer your products on comparison websites and marketplaces using the ChannelEngine platform.</description>
|
11 |
+
<notes>* New tracking script</notes>
|
12 |
<authors><author><name>ChannelEngine</name><user>christiaander</user><email>christiaan@tritac.com</email></author></authors>
|
13 |
+
<date>2015-07-31</date>
|
14 |
+
<time>12:07:24</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Tritac_ChannelEngine.xml" hash="f6b4a6d9af9aa3bcd3019fd566d6a67c"/></dir></target><target name="magecommunity"><dir name="Tritac"><dir name="ChannelEngine"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Feed.php" hash="c98a17a36a351640e353ebcd5005cb32"/></dir></dir></dir><file name="Head.php" hash="5bfa5f2ee155ae1a87b171b8fa54eff8"/></dir><dir name="Helper"><file name="Data.php" hash="cb00f2eaabb8e12c7158f3f9be3a85e0"/></dir><dir name="Model"><dir name="Carrier"><file name="Channelengine.php" hash="b6e04e43096e934d57e8e8745dd67c75"/></dir><file name="Observer.php" hash="90e2d64bb4cfeae4603342612000bbd0"/><file name="Order.php" hash="7b5d59152a0341cf5bff5b7adf6c76b7"/><dir name="Payment"><dir name="Method"><file name="Channelengine.php" hash="b938300284d504de42dd04777c45c75b"/></dir></dir><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="fedd812bdf0090a36ce7bdd23e7876f5"/></dir><file name="Order.php" hash="cab73cceec877cda4daadc5c66f356fe"/><file name="Setup.php" hash="ed5ca35f61e6158a8b617630ae84c5b8"/><dir name="Shipment"><file name="Collection.php" hash="56e7c3bee221edefdcb587801bd36cc2"/></dir><file name="Shipment.php" hash="e09302f0ff110b94fc34031ee9255caa"/></dir><file name="Shipment.php" hash="5aa413e4e1ca441456d0d28ed541d2fc"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Gtin.php" hash="d2c18169dfaf87a01d9d7357329f1c78"/><file name="Shipping.php" hash="00d71eaebba3014fe9d17ee75f7cf0a9"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GenerateController.php" hash="b69ead94a34e01bdf093ee6282b66c18"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2a9dc6ac1738bebb470c1aa699478467"/><file name="config.xml" hash="99181e4f73b881aac5616399e6098cf8"/><file name="system.xml" hash="b03c2dc362cc7cbf7334670afdf170ac"/></dir><dir name="sql"><dir name="channelengine_setup"><file name="mysql4-install-1.0.0.php" hash="6d04678d7750ff3de5a9eb697c13d52f"/><file name="mysql4-upgrade-2.6.0-2.7.0.php" hash="1f8c2f9d0239c9fbf31d3bfdd1c6cc46"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Tritac"><dir name="ChannelEngineApiClient"><file name="AddTrustExternalCARoot.crt" hash="f85d1ff17b0079709f131f3ce3f288d2"/><file name="Client.php" hash="9e0065d5902495dcf12c6526a6309998"/><dir name="Enums"><file name="CancellationLineStatus.php" hash="b48713c95dea7855255eca6d9af68ba4"/><file name="CancellationStatus.php" hash="ea61f9cdf047d615c63d49e943ef7776"/><file name="Gender.php" hash="ec9d3e083df38a188c57b1015e011bce"/><file name="MancoReason.php" hash="b5a7ecf30975a494223df3135e111760"/><file name="OrderStatus.php" hash="451569e1788da5f08b01527ee86463cd"/><file name="ReturnAcceptStatus.php" hash="760598e7176288210d349686899e76aa"/><file name="ReturnReason.php" hash="9d8aea80edbb7d012e7abcbb0f54d5e4"/><file name="ReturnStatus.php" hash="7827e8d3b27faf6073835ecbcde1db6b"/><file name="ShipmentLineStatus.php" hash="ccdddd9f80610cbf284154db5930247a"/><file name="ShipmentStatus.php" hash="0b0351af3409590614ff249e1bac688e"/></dir><dir name="Helpers"><file name="Collection.php" hash="4dcae246e9de6e847818dc3be49ddad0"/><file name="HttpMethod.php" hash="79b753f221780fbf75773669cf3d1f86"/><file name="JsonMapper.php" hash="c8742a0636d3f866c8a1c2c97365cfb8"/></dir><dir name="Models"><file name="Address.php" hash="49a1cd2a405ba2832f638979a14c7187"/><file name="BaseModel.php" hash="9604e198f22fef25d60992c2cb9f506c"/><file name="Cancellation.php" hash="edddc28fc842661311da1d79f9b6b634"/><file name="CancellationLine.php" hash="f2eb604ccc7ea5678941394cb5861c48"/><file name="Message.php" hash="658c867e131588eb2520c349d6ebc5a7"/><file name="Order.php" hash="11df07d8acb3fc985b3eec812955ef42"/><file name="OrderExtraDataItem.php" hash="965abccf11c8157b7fd85e05a8ef4e28"/><file name="OrderLine.php" hash="78252a465c5f1b9b1c5e23c8ce09552d"/><file name="ReturnLine.php" hash="c011dfcf44f25b255e529fd26755fbd9"/><file name="ReturnObject.php" hash="28378a651ad7e41b127bfd1839f25dad"/><file name="Shipment.php" hash="c8903a23b59a1cada56b8518db56ce2d"/><file name="ShipmentLine.php" hash="0ca0e5441553f722ade5ad5924c9f801"/></dir><file name="loader.php" hash="5bba6033b0bdc5cb87afdbdde2deadf9"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="channelengine"><dir name="system"><dir name="config"><dir name="feed"><file name="generate_button.phtml" hash="92318b94c3e6a971e9840ad26adb52c9"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="channelengine.xml" hash="ae6a00b46a84a610964743034eb72081"/></dir><dir name="template"><dir name="channelengine"><dir name="checkout"><file name="success.phtml" hash="dbcb8298cd52a3c44560ae911349a3c7"/></dir><file name="head.phtml" hash="b84ea0b3d84edd1e740ce9768c53f8ae"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|