Version Notes
First Magento Connect version of the module.
Download this release
Release Info
Developer | Ferry Koster |
Extension | Notive_Astral |
Version | 1.1.3 |
Comparing to | |
See all releases |
Version 1.1.3
- app/code/local/Notive/Astral/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Block/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/.AppleDouble/Astralbackend.php +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/Astralbackend.php +10 -0
- app/code/local/Notive/Astral/Block/Adminhtml/Sales/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/.AppleDouble/View.php +0 -0
- app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/View.php +21 -0
- app/code/local/Notive/Astral/Helper/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Helper/.AppleDouble/Data.php +0 -0
- app/code/local/Notive/Astral/Helper/.AppleDouble/Webservice.php +0 -0
- app/code/local/Notive/Astral/Helper/Data.php +37 -0
- app/code/local/Notive/Astral/Helper/Webservice.php +218 -0
- app/code/local/Notive/Astral/Model/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Model/.AppleDouble/Attribute.php +0 -0
- app/code/local/Notive/Astral/Model/.AppleDouble/Cron.php +0 -0
- app/code/local/Notive/Astral/Model/.AppleDouble/Status.php +0 -0
- app/code/local/Notive/Astral/Model/Attribute.php +44 -0
- app/code/local/Notive/Astral/Model/Cron.php +133 -0
- app/code/local/Notive/Astral/Model/Observers/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Model/Observers/.AppleDouble/Order.php +0 -0
- app/code/local/Notive/Astral/Model/Observers/Order.php +145 -0
- app/code/local/Notive/Astral/Model/Observers/Order/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Model/Observers/Order/.AppleDouble/Abstract.php +0 -0
- app/code/local/Notive/Astral/Model/Observers/Order/Abstract.php +5 -0
- app/code/local/Notive/Astral/Model/Resource/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/Model/Resource/.AppleDouble/Setup.php +0 -0
- app/code/local/Notive/Astral/Model/Resource/Setup.php +5 -0
- app/code/local/Notive/Astral/Model/Status.php +59 -0
- app/code/local/Notive/Astral/controllers/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/controllers/.AppleDouble/IndexController.php +0 -0
- app/code/local/Notive/Astral/controllers/Adminhtml/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/controllers/Adminhtml/.AppleDouble/AstralbackendController.php +0 -0
- app/code/local/Notive/Astral/controllers/Adminhtml/AstralbackendController.php +447 -0
- app/code/local/Notive/Astral/controllers/IndexController.php +8 -0
- app/code/local/Notive/Astral/controllers/Sales/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/controllers/Sales/.AppleDouble/OrderController.php +0 -0
- app/code/local/Notive/Astral/controllers/Sales/OrderController.php +42 -0
- app/code/local/Notive/Astral/etc/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/etc/.AppleDouble/config.xml +0 -0
- app/code/local/Notive/Astral/etc/.AppleDouble/system.xml +0 -0
- app/code/local/Notive/Astral/etc/config.xml +159 -0
- app/code/local/Notive/Astral/etc/system.xml +152 -0
- app/code/local/Notive/Astral/sql/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/sql/notive_astral_setup/.AppleDouble/.Parent +0 -0
- app/code/local/Notive/Astral/sql/notive_astral_setup/.AppleDouble/mysql4-install-1.0.0.php +0 -0
- app/code/local/Notive/Astral/sql/notive_astral_setup/mysql4-install-1.0.0.php +26 -0
- app/etc/modules/Notive_Astral.xml +10 -0
- package.xml +18 -0
app/code/local/Notive/Astral/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/.AppleDouble/Astralbackend.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/Astralbackend.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Block_Adminhtml_Astralbackend extends Mage_Adminhtml_Block_Template {
|
4 |
+
|
5 |
+
public function getConfigValue($name)
|
6 |
+
{
|
7 |
+
return Mage::getStoreConfig('notive/astral/'.$name, Mage::app()->getStore());
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Notive/Astral/Block/Adminhtml/Sales/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/.AppleDouble/View.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$order = $this->getOrder();
|
9 |
+
$send_statusses =
|
10 |
+
explode(',', Mage::getStoreConfig('Notive_Astral/order/status_send', Mage::app()->getStore()));
|
11 |
+
|
12 |
+
if (in_array($order->getStatus(), $send_statusses)) {
|
13 |
+
$message = Mage::helper('sales')->__('Are you sure?');
|
14 |
+
$this->_addButton('send_to_astral', array(
|
15 |
+
'label' => Mage::helper('Sales')->__('Send to Astral'),
|
16 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getUrl('astral/sales_order', array('order_id'=>1))}')",
|
17 |
+
'class' => 'go'
|
18 |
+
), 0, 100, 'header', 'header');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
app/code/local/Notive/Astral/Helper/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Helper/.AppleDouble/Data.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Helper/.AppleDouble/Webservice.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Helper/Data.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Notive_Astral_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
/**
|
4 |
+
* Get the orders that were sent to Astral
|
5 |
+
*
|
6 |
+
* @return Mage_Sales_Model_Resource_Order_Collection
|
7 |
+
*/
|
8 |
+
public function getSentOrders()
|
9 |
+
{
|
10 |
+
// Get all orders that are processing
|
11 |
+
$all_orders = Mage::getModel('sales/order')
|
12 |
+
->getCollection()
|
13 |
+
->addFieldToFilter('state', 'processing')
|
14 |
+
;
|
15 |
+
|
16 |
+
$sent_order_ids = array();
|
17 |
+
foreach ($all_orders as &$order) {
|
18 |
+
$status_histories = Mage::getResourceModel('sales/order_status_history_collection')
|
19 |
+
->setOrderFilter($order)
|
20 |
+
->setOrder('created_at', 'desc')
|
21 |
+
->setOrder('entity_id', 'desc')
|
22 |
+
->addFieldToFilter('status', Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_OK)
|
23 |
+
; // $status_histories
|
24 |
+
|
25 |
+
// The order was sent to Astral
|
26 |
+
if (count($status_histories) > 0) {
|
27 |
+
$sent_order_ids[] = $order->getId();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
$orders = Mage::getModel('sales/order')
|
31 |
+
->getCollection()
|
32 |
+
->addFieldToFilter('entity_id', array('in'=>$sent_order_ids))
|
33 |
+
; // $orders
|
34 |
+
|
35 |
+
return $orders;
|
36 |
+
}
|
37 |
+
}
|
app/code/local/Notive/Astral/Helper/Webservice.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Notive_Astral_Helper_Webservice {
|
5 |
+
protected static $instance;
|
6 |
+
|
7 |
+
// Dev
|
8 |
+
// private $webservice_url = 'http://develop.ws-astral.webservices.b/app_dev.php/';
|
9 |
+
|
10 |
+
// Test
|
11 |
+
// private $webservice_url = 'http://ws-astral.notive-beta.nl/';
|
12 |
+
|
13 |
+
// Live
|
14 |
+
private $webservice_url = 'http://ws.astral.org/';
|
15 |
+
|
16 |
+
public static function getInstance()
|
17 |
+
{
|
18 |
+
if (!isset(self::$instance)) {
|
19 |
+
self::$instance = new Webservice;
|
20 |
+
}
|
21 |
+
return self::$instance;
|
22 |
+
}
|
23 |
+
|
24 |
+
private function _call($endpoint, $data = array())
|
25 |
+
{
|
26 |
+
$curl_call = curl_init();
|
27 |
+
curl_setopt($curl_call, CURLOPT_URL, $this->webservice_url.'ws/'.$endpoint);
|
28 |
+
curl_setopt($curl_call, CURLOPT_RETURNTRANSFER, true);
|
29 |
+
curl_setopt($curl_call, CURLOPT_SSL_VERIFYPEER, false);
|
30 |
+
curl_setopt($curl_call, CURLOPT_SSL_VERIFYHOST, false);
|
31 |
+
curl_setopt($curl_call, CURLOPT_POST, true);
|
32 |
+
|
33 |
+
|
34 |
+
$data['site_id'] = Mage::getStoreConfig('Notive_Astral/general/username', Mage::app()->getStore());
|
35 |
+
$data['customer_number'] = Mage::getStoreConfig('Notive_Astral/general/customer_number', Mage::app()->getStore());
|
36 |
+
$data['password'] = sha1(Mage::getStoreConfig('Notive_Astral/general/password', Mage::app()->getStore()));
|
37 |
+
|
38 |
+
curl_setopt($curl_call, CURLOPT_POSTFIELDS, http_build_query($data));
|
39 |
+
|
40 |
+
$returned = curl_exec($curl_call);
|
41 |
+
if ($returned == false) {
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
return json_decode($returned, true);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function auth()
|
48 |
+
{
|
49 |
+
$authResult = $this->_call('auth/login');
|
50 |
+
|
51 |
+
if ($authResult['success'] == true) {
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function saveOrder(Mage_Sales_Model_Order $mage_order)
|
58 |
+
{
|
59 |
+
$order = $this->_processOrder($mage_order);
|
60 |
+
|
61 |
+
return $this->_call('orders/create', $order);
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getTnT($order_id)
|
65 |
+
{
|
66 |
+
if ($this->auth()) {
|
67 |
+
return $this->_call('orders/tracking', array(
|
68 |
+
'references'=>$order_id
|
69 |
+
));
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getStock($last_update)
|
74 |
+
{
|
75 |
+
return $this->_call('stock/get', array('updated_after'=>$last_update));
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getOrderTracking(Mage_Sales_Model_Resource_Order_Collection $orders)
|
79 |
+
{
|
80 |
+
$result = array();
|
81 |
+
$order_ids = array();
|
82 |
+
foreach ($orders as $order) {
|
83 |
+
$order_ids[] = $order->getRealOrderId();
|
84 |
+
}
|
85 |
+
return $this->_call('orders/tracking', array(
|
86 |
+
'references'=>$order_ids
|
87 |
+
));
|
88 |
+
}
|
89 |
+
|
90 |
+
public function _processOrder(Mage_Sales_Model_Order $order)
|
91 |
+
{
|
92 |
+
$addr_billing = $order->getBillingAddress();
|
93 |
+
$addr_shipping = $order->getShippingAddress();
|
94 |
+
list($street_billing, $street_number_billing) = $this->splitAddress($addr_billing);
|
95 |
+
list($street_shipping, $street_number_shipping) = $this->splitAddress($addr_shipping);
|
96 |
+
|
97 |
+
$address = $addr_shipping ? $addr_shipping : $addr_billing;
|
98 |
+
list($street, $street_number) = $this->splitAddress($address);
|
99 |
+
|
100 |
+
$date = date('Y-m-d');
|
101 |
+
if ($order->getData('preferred_delivery_date')) {
|
102 |
+
$date = $order->getData('preferred_delivery_date');
|
103 |
+
}
|
104 |
+
|
105 |
+
$data = array(
|
106 |
+
'date'=>$date,
|
107 |
+
'reference'=>$order->getRealOrderId(),
|
108 |
+
'shipping_address' => array(
|
109 |
+
'company' => $addr_shipping->getCompany(),
|
110 |
+
'first_name' => $addr_shipping->getFirstname(),
|
111 |
+
'last_name' => $addr_shipping->getLastname(),
|
112 |
+
'addressed_to' => $addr_shipping->getName(),
|
113 |
+
'street' => $street_shipping,
|
114 |
+
'street_number' => $street_number_shipping,
|
115 |
+
'zipcode' => $addr_shipping->getPostcode(),
|
116 |
+
'city' => $addr_shipping->getCity(),
|
117 |
+
'country_code' => $addr_shipping->getCountry(),
|
118 |
+
'phone_number' => $addr_shipping->getTelephone(),
|
119 |
+
'email' => $order->getCustomerEmail()
|
120 |
+
),
|
121 |
+
'invoice_address' => array(
|
122 |
+
'company' => $addr_billing->getCompany(),
|
123 |
+
'first_name' => $addr_billing->getFirstname(),
|
124 |
+
'last_name' => $addr_billing->getLastname(),
|
125 |
+
'addressed_to' => $addr_billing->getName(),
|
126 |
+
'street' => $street_billing,
|
127 |
+
'street_number' => $street_number_billing,
|
128 |
+
'zipcode' => $addr_billing->getPostcode(),
|
129 |
+
'city' => $addr_billing->getCity(),
|
130 |
+
'country_code' => $addr_billing->getCountry(),
|
131 |
+
'phone_number' => $addr_billing->getTelephone(),
|
132 |
+
'email' => $order->getCustomerEmail()
|
133 |
+
),
|
134 |
+
'order_lines' => array()
|
135 |
+
);
|
136 |
+
|
137 |
+
$articleCodeField = Mage::getStoreConfig('Notive_Astral/order/article_code_field', Mage::app()->getStore());
|
138 |
+
foreach ($order->getItemsCollection() as $ol) {
|
139 |
+
if ($ol->isDeleted() || $ol->getProductType() !== 'simple') {
|
140 |
+
continue;
|
141 |
+
}
|
142 |
+
|
143 |
+
$product = $this->getProduct($ol);
|
144 |
+
|
145 |
+
$articleCode = $product->getData($articleCodeField);
|
146 |
+
if (strlen($articleCode) == 0) {
|
147 |
+
$articleCode = $ol->getSku();
|
148 |
+
}
|
149 |
+
|
150 |
+
$data["order_lines"][] = array(
|
151 |
+
'article_code' => $articleCode,
|
152 |
+
'article_description' => $product ? $product->getName() : '',
|
153 |
+
'quantity' => (int)$ol->getData('qty_ordered')
|
154 |
+
);
|
155 |
+
}
|
156 |
+
|
157 |
+
return $data;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Tries get related product from order line
|
162 |
+
* @param Mage_Sales_Model_Order_Item $order_line
|
163 |
+
* @return Mage_Catalog_Model_Product|NULL
|
164 |
+
*/
|
165 |
+
private function getProduct(Mage_Sales_Model_Order_Item $order_line)
|
166 |
+
{
|
167 |
+
// get product
|
168 |
+
$product = Mage::getModel('catalog/product')->load($order_line->getProductId());
|
169 |
+
if (empty($product) || ($order_line->getProductType() == 'configurable')) {
|
170 |
+
$options = $order_line->getProductOptions();
|
171 |
+
if (count($options)) {
|
172 |
+
$product = false;
|
173 |
+
if (isset($options['simple_sku']) && !empty($options['simple_sku'])) {
|
174 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $options['simple_sku']);
|
175 |
+
} elseif (isset($options['info_buyRequest']) && isset($options['info_buyRequest']['product'])) {
|
176 |
+
$product = Mage::getModel('catalog/product')->load($options['info_buyRequest']['product']);
|
177 |
+
} elseif (isset($options['super_product_config']) && isset($options['super_product_config']['product_id'])) {
|
178 |
+
$product = Mage::getModel('catalog/product')->load($options['super_product_config']['product_id']);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
if ($product && $product->getId()) {
|
183 |
+
return $product;
|
184 |
+
}
|
185 |
+
$sku = $order_line->getSku();
|
186 |
+
$pid = Mage::getModel('catalog/product')->getIdBySku($sku);
|
187 |
+
return $pid ? Mage::getModel('catalog/product')->load($pid) : null;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Split multiline magento address to address and house number
|
192 |
+
* @var Mage_Sales_Model_Order_Address $address
|
193 |
+
* @return array [0] address [1] house no
|
194 |
+
*/
|
195 |
+
private function splitAddress(Mage_Sales_Model_Order_Address $address)
|
196 |
+
{
|
197 |
+
$adr = $address->getStreetFull();
|
198 |
+
$lines = preg_split("/[\n|\r]/", $adr);
|
199 |
+
if (!count($lines)) {
|
200 |
+
$lines = array($adr);
|
201 |
+
}
|
202 |
+
|
203 |
+
$no = '';
|
204 |
+
$parts = explode(' ', $lines[0]);
|
205 |
+
if (count($parts) > 1) {
|
206 |
+
$no = end($parts);
|
207 |
+
unset($parts[count($parts) - 1]); // remove last
|
208 |
+
}
|
209 |
+
|
210 |
+
$street = implode(' ', $parts);
|
211 |
+
|
212 |
+
if (count($lines) > 1) {
|
213 |
+
$street .= "\n{$lines[1]}";
|
214 |
+
}
|
215 |
+
|
216 |
+
return array($street, $no);
|
217 |
+
}
|
218 |
+
}
|
app/code/local/Notive/Astral/Model/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/.AppleDouble/Attribute.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/.AppleDouble/Cron.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/.AppleDouble/Status.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Attribute.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Notive_Astral_Model_Attribute extends Varien_Object {
|
3 |
+
|
4 |
+
public function toOptionHash()
|
5 |
+
{
|
6 |
+
switch ($this->getPath()) {
|
7 |
+
case 'Notive_Astral/order/article_code_field':
|
8 |
+
return $this->getAttributes();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function getAttributes()
|
13 |
+
{
|
14 |
+
$ret = array();
|
15 |
+
$productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
|
16 |
+
foreach ($productAttrs as $productAttr) {
|
17 |
+
$label = $productAttr->getFrontendLabel();
|
18 |
+
if (strlen($label) == 0) {
|
19 |
+
$label = '-';
|
20 |
+
}
|
21 |
+
|
22 |
+
$ret[$productAttr->getAttributeCode()] = $label . ' (' . $productAttr->getAttributeCode() . ')';
|
23 |
+
}
|
24 |
+
natsort($ret);
|
25 |
+
return $ret;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$arr = array();
|
31 |
+
foreach ($this->toOptionHash() as $v => $l) {
|
32 |
+
if (!is_array($l)) {
|
33 |
+
$arr[] = array('label' => $l, 'value' => $v);
|
34 |
+
} else {
|
35 |
+
$options = array();
|
36 |
+
foreach ($l as $v1 => $l1) {
|
37 |
+
$options[] = array('value' => $v1, 'label' => $l1);
|
38 |
+
}
|
39 |
+
$arr[] = array('label' => $v, 'value' => $options);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
return $arr;
|
43 |
+
}
|
44 |
+
}
|
app/code/local/Notive/Astral/Model/Cron.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Model_Cron {
|
4 |
+
|
5 |
+
public function runOrders()
|
6 |
+
{
|
7 |
+
if (Mage::getStoreConfig('Notive_Astral/order_status/enabled', Mage::app()->getStore()) === '1' || isset($_GET['notive_check'])) {
|
8 |
+
$this->_checkOrderStatus();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
public function runStock()
|
13 |
+
{
|
14 |
+
if (Mage::getStoreConfig('Notive_Astral/stock_sync/enabled', Mage::app()->getStore()) === '1' || isset($_GET['notive_check'])) {
|
15 |
+
$this->_checkStock();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
private function _checkOrderStatus()
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
23 |
+
* @var Notive_Astral_Helper_Data $helper_data
|
24 |
+
*/
|
25 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
26 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
27 |
+
|
28 |
+
// Load the orders
|
29 |
+
$orders = $helper_data->getSentOrders();
|
30 |
+
if ($orders) {
|
31 |
+
$tracking_orders = $helper_webservice->getOrderTracking($orders);
|
32 |
+
} else {
|
33 |
+
exit;
|
34 |
+
}
|
35 |
+
|
36 |
+
foreach ($orders as $order) {
|
37 |
+
$tracking_order = $tracking_orders[$order->getRealOrderId()];
|
38 |
+
if (!is_null($tracking_order) && $tracking_order['success'] == true) {
|
39 |
+
$itemQty = $order->getItemsCollection()->count();
|
40 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
41 |
+
|
42 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
43 |
+
$shipmentId = $shipment->create($order->getRealOrderId());
|
44 |
+
$shipment_model = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentId);
|
45 |
+
|
46 |
+
$carrier_code = 'custom';
|
47 |
+
|
48 |
+
// Currently no support for carriers
|
49 |
+
// $carriers = $this->_getCarriers();
|
50 |
+
// if (isset($carriers[$tracking_order['shipper']])) {
|
51 |
+
// $carrier_code = $carriers[$tracking_order['shipper']];
|
52 |
+
// }
|
53 |
+
|
54 |
+
$track_model = Mage::getModel('sales/order_shipment_track')
|
55 |
+
->setShipment($shipment_model)
|
56 |
+
->setData('title', 'Track & trace')
|
57 |
+
->setData('number', $tracking_order['tracking_code'])
|
58 |
+
->setData('carrier_code', $carrier_code)
|
59 |
+
->setData('order_id', $shipment_model->getData('order_id'))
|
60 |
+
->save();
|
61 |
+
|
62 |
+
$shipment_model->sendEmail();
|
63 |
+
$shipment_model->setEmailSent(true);
|
64 |
+
$shipment_model->save();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
private function _checkStock()
|
70 |
+
{
|
71 |
+
// Get the helpers
|
72 |
+
/**
|
73 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
74 |
+
*/
|
75 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
76 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
77 |
+
|
78 |
+
$last_sync_date = Mage::getStoreConfig('Notive_Astral/stock_sync/last_sync_date', Mage::app()->getStore());
|
79 |
+
// If it's the first time we want to sync all products
|
80 |
+
if ($last_sync_date == false || $last_sync_date == '') {
|
81 |
+
$last_sync_date = '1970-01-01 00:00:00';
|
82 |
+
}
|
83 |
+
|
84 |
+
$thirteenDaysAgo = date('Y-m-d H:i:s', strtotime('-13 days'));
|
85 |
+
if ($last_sync_date < $thirteenDaysAgo) {
|
86 |
+
$last_sync_date = $thirteenDaysAgo;
|
87 |
+
}
|
88 |
+
|
89 |
+
$_stock = $helper_webservice->getStock($last_sync_date);
|
90 |
+
|
91 |
+
$articleCodeField = Mage::getStoreConfig('Notive_Astral/order/article_code_field', Mage::app()->getStore());
|
92 |
+
if (isset($_stock['success']) && $_stock['success'] == true) {
|
93 |
+
foreach ($_stock['returned'] as $sku => $qty) {
|
94 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute($articleCodeField, $sku);
|
95 |
+
|
96 |
+
if ($product != false) {
|
97 |
+
$productId = $product->getId();
|
98 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
|
99 |
+
$stockItem->setData('qty', $qty);
|
100 |
+
try {
|
101 |
+
$stockItem->save();
|
102 |
+
} catch (Exception $e) {
|
103 |
+
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
$configModel = Mage::getModel('core/config');
|
110 |
+
$configModel->saveConfig('Notive_Astral/stock_sync/last_sync_date', date('Y-m-d H:i:s'));
|
111 |
+
}
|
112 |
+
|
113 |
+
public function _getCarriers()
|
114 |
+
{
|
115 |
+
$carriers_config = Mage::getModel('shipping/config');
|
116 |
+
$return = array();
|
117 |
+
|
118 |
+
if ($carriers_config !== false) {
|
119 |
+
$active_carriers = $carriers_config->getActiveCarriers();
|
120 |
+
foreach ($active_carriers as $carrier) {
|
121 |
+
$carrierCode = $carrier->getCarrierCode();
|
122 |
+
$carrierName = Mage::getStoreConfig('carriers/' . $carrierCode . '/title');
|
123 |
+
if (empty($carrierName)) {
|
124 |
+
$carrierName = Mage::getStoreConfig('customtrackers/' . $carrierCode . '/title');
|
125 |
+
}
|
126 |
+
|
127 |
+
$return[$carrierName] = $carrierCode;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
return $return;
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
app/code/local/Notive/Astral/Model/Observers/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Observers/.AppleDouble/Order.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Observers/Order.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Model_Observers_Order extends Notive_Astral_Model_Observers_Order_Abstract {
|
4 |
+
const ASTRAL_ORDER_STATUS_CODE_ERROR = 'notive_astral_error';
|
5 |
+
const ASTRAL_ORDER_STATUS_CODE_OK = 'notive_astral_sent';
|
6 |
+
|
7 |
+
const ASTRAL_SAVED_MARK = 'notive_astral_order_saved';
|
8 |
+
|
9 |
+
private $_enabled,
|
10 |
+
$_status_send;
|
11 |
+
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
// On unhold
|
15 |
+
parent::_construct();
|
16 |
+
$this->_enabled =
|
17 |
+
Mage::getStoreConfig('Notive_Astral/order/enabled', Mage::app()->getStore()) === '1';
|
18 |
+
$this->_status_send =
|
19 |
+
explode(',', Mage::getStoreConfig('Notive_Astral/order/status_send', Mage::app()->getStore()));
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Process order
|
24 |
+
* @param Varien_Event_Observer|Mage_Sales_Model_Order $event
|
25 |
+
* @param bool $manual this is manual call, not from event handler
|
26 |
+
*/
|
27 |
+
public function sales_order_save_after($event, $manual = false)
|
28 |
+
{
|
29 |
+
// SHIPPED
|
30 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
31 |
+
|
32 |
+
if (!$manual && !$this->_enabled) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
if (!$manual) {
|
37 |
+
$get_order = version_compare(Mage::getVersion(), '1.4', '<') === true ? 'getOrder' : 'getDataObject';
|
38 |
+
|
39 |
+
if (!$event || !$event->$get_order()) {
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
$order = $event->$get_order();
|
44 |
+
} else {
|
45 |
+
$order = $event;
|
46 |
+
}
|
47 |
+
|
48 |
+
if ($order->getData(self::ASTRAL_SAVED_MARK)) {
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
+
if ($this->shouldSendOrder($order)) {
|
53 |
+
$order->setData(self::ASTRAL_SAVED_MARK, true);
|
54 |
+
|
55 |
+
$result = $helper_webservice->saveOrder($order);
|
56 |
+
|
57 |
+
if ($result !== false && !is_null($result) && isset($result['success']) && $result['success']) {
|
58 |
+
$this->setStateSent($order);
|
59 |
+
} else {
|
60 |
+
$msg = '';
|
61 |
+
if ($result !== false && !is_null($result) && isset($result['error'])) {
|
62 |
+
$msg = $result['error'];
|
63 |
+
}
|
64 |
+
$this->setStateNotSent($order, $msg);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Should we send the order to ASTRAL
|
71 |
+
* @param Mage_Sales_Model_Order $order
|
72 |
+
* @return bool
|
73 |
+
*/
|
74 |
+
protected function shouldSendOrder(Mage_Sales_Model_Order $order)
|
75 |
+
{
|
76 |
+
if (in_array($order->getStatus(), $this->_status_send)) {
|
77 |
+
$comments = $order->getStatusHistoryCollection(true);
|
78 |
+
$should_send = true;
|
79 |
+
foreach ($comments as $comment) {
|
80 |
+
if (preg_match('/^notive_astral_sent/Usi', $comment->getStatus())) {
|
81 |
+
$should_send = false;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
if ($should_send !== false) {
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Mark order as not sent
|
93 |
+
*
|
94 |
+
* @param Mage_Sales_Model_Order $order
|
95 |
+
* @throws Mage_Core_Exception
|
96 |
+
*/
|
97 |
+
public function setStateNotSent(Mage_Sales_Model_Order $order, $msg = '')
|
98 |
+
{
|
99 |
+
if (!$order->canHold()) {
|
100 |
+
Mage::throwException($this->__('Error setting hold status.'));
|
101 |
+
}
|
102 |
+
$order->setHoldBeforeState($order->getState());
|
103 |
+
$order->setHoldBeforeStatus($order->getStatus());
|
104 |
+
$order->setState(
|
105 |
+
Mage_Sales_Model_Order::STATE_HOLDED,
|
106 |
+
self::ASTRAL_ORDER_STATUS_CODE_ERROR,
|
107 |
+
'Order can\'t be sent to ASTRAL' . ($msg ? ".<br/>Error: {$msg}" : '.')
|
108 |
+
)->save();
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Mark order as sent
|
113 |
+
*
|
114 |
+
* @param Mage_Sales_Model_Order $order
|
115 |
+
* @throws Mage_Core_Exception
|
116 |
+
*/
|
117 |
+
public function setStateSent(Mage_Sales_Model_Order $order)
|
118 |
+
{
|
119 |
+
if ($order->getHoldBeforeState() && !$order->canUnhold()) {
|
120 |
+
Mage::throwException($this->__('Error removing hold status.'));
|
121 |
+
}
|
122 |
+
$state = $order->getHoldBeforeState() ? $order->getHoldBeforeState() : $order->getState();
|
123 |
+
$order->setState($state, self::ASTRAL_ORDER_STATUS_CODE_OK, 'Order was sent to Astral.')->save();
|
124 |
+
$order->setHoldBeforeState(null);
|
125 |
+
$order->setHoldBeforeStatus(null);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Mark order as pending
|
130 |
+
*
|
131 |
+
* @param Mage_Sales_Model_Order $order
|
132 |
+
* @throws Mage_Core_Exception
|
133 |
+
*/
|
134 |
+
public function setStatePending(Mage_Sales_Model_Order $order)
|
135 |
+
{
|
136 |
+
if ($order->getHoldBeforeState() && !$order->canUnhold()) {
|
137 |
+
Mage::throwException($this->__('Error removing hold status.'));
|
138 |
+
}
|
139 |
+
$state = $order->getHoldBeforeState() ? $order->getHoldBeforeState() : $order->getState();
|
140 |
+
$order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
|
141 |
+
$order->setHoldBeforeState(null);
|
142 |
+
$order->setHoldBeforeStatus(null);
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
app/code/local/Notive/Astral/Model/Observers/Order/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Observers/Order/.AppleDouble/Abstract.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Observers/Order/Abstract.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Notive_Astral_Model_Observers_Order_Abstract extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/local/Notive/Astral/Model/Resource/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Resource/.AppleDouble/Setup.php
ADDED
Binary file
|
app/code/local/Notive/Astral/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
4 |
+
|
5 |
+
}
|
app/code/local/Notive/Astral/Model/Status.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Notive_Astral_Model_Status extends Varien_Object {
|
3 |
+
protected static $IGNORE_STATUSES = array(
|
4 |
+
Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_ERROR,
|
5 |
+
Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_OK
|
6 |
+
);
|
7 |
+
|
8 |
+
public function toOptionHash()
|
9 |
+
{
|
10 |
+
switch ($this->getPath()) {
|
11 |
+
case 'Notive_Astral/order/status_send':
|
12 |
+
return $this->getStatuses();
|
13 |
+
}
|
14 |
+
return array('' => 'BUG: ' . $this->getPath() . ' NOT IMPLEMENTED'); // default
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function getStatuses()
|
18 |
+
{
|
19 |
+
$ret = array();
|
20 |
+
if (version_compare(Mage::getVersion(), '1.5', '<') === true) {
|
21 |
+
// Magento < 1.5
|
22 |
+
$cfg = Mage::app()->getConfig();
|
23 |
+
foreach ($cfg->getNode('global/sales/order/statuses')->asArray() as $status => $l) {
|
24 |
+
$this->add_status($ret, $status, $l['label']);
|
25 |
+
}
|
26 |
+
} else {
|
27 |
+
$col = Mage::getModel('sales/order_status')->getCollection();
|
28 |
+
foreach ($col as $st) {
|
29 |
+
$this->add_status($ret, $st['status'], $st['label']);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
natsort($ret);
|
33 |
+
return $ret;
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function add_status(&$arr, $st, $label)
|
37 |
+
{
|
38 |
+
if (!in_array($st, self::$IGNORE_STATUSES)) {
|
39 |
+
$arr[$st] = $label;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
public function toOptionArray()
|
44 |
+
{
|
45 |
+
$arr = array();
|
46 |
+
foreach ($this->toOptionHash() as $v => $l) {
|
47 |
+
if (!is_array($l)) {
|
48 |
+
$arr[] = array('label' => $l, 'value' => $v);
|
49 |
+
} else {
|
50 |
+
$options = array();
|
51 |
+
foreach ($l as $v1 => $l1) {
|
52 |
+
$options[] = array('value' => $v1, 'label' => $l1);
|
53 |
+
}
|
54 |
+
$arr[] = array('label' => $v, 'value' => $options);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
return $arr;
|
58 |
+
}
|
59 |
+
}
|
app/code/local/Notive/Astral/controllers/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/.AppleDouble/IndexController.php
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/Adminhtml/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/Adminhtml/.AppleDouble/AstralbackendController.php
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/Adminhtml/AstralbackendController.php
ADDED
@@ -0,0 +1,447 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Used for testing purposes
|
4 |
+
class Notive_Astral_Adminhtml_AstralbackendController extends Mage_Adminhtml_Controller_Action {
|
5 |
+
|
6 |
+
/**
|
7 |
+
* http://1.magento.b/index.php/astral/adminhtml_astralbackend/index/key/23f32ca093956e94d708367024363344/
|
8 |
+
*/
|
9 |
+
public function indexAction()
|
10 |
+
{
|
11 |
+
header('Content-type: text/plain');
|
12 |
+
$webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
13 |
+
$order = Mage::getModel('sales/order')->load(7);
|
14 |
+
var_dump($webservice->_processOrder($order));
|
15 |
+
exit;
|
16 |
+
// ini_set("display_errors", 1);
|
17 |
+
// $cronModel = Mage::getModel('notive_astral/cron');
|
18 |
+
// echo '<pre>';
|
19 |
+
// var_dump($cronModel->runStock());
|
20 |
+
// die('</pre>');
|
21 |
+
// exit;
|
22 |
+
}
|
23 |
+
private function _randomTests()
|
24 |
+
{
|
25 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', '146_e');
|
26 |
+
$productStockedValue = $this->getStockedByProductId($product->getId());
|
27 |
+
|
28 |
+
echo '<pre>';
|
29 |
+
var_dump($productStockedValue);
|
30 |
+
echo '<pre>';
|
31 |
+
die('done');
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
public function getStockedByProductId($product_id)
|
36 |
+
{
|
37 |
+
$websiteId = Mage::app()->getWebsite()->getId();
|
38 |
+
$optionId = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product_id, 'stocked_or_cross_docked', $websiteId);
|
39 |
+
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'stocked_or_cross_docked');
|
40 |
+
$collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
41 |
+
->setPositionOrder('asc')
|
42 |
+
->setAttributeFilter($attributeId)
|
43 |
+
->setStoreFilter(0)
|
44 |
+
->load();
|
45 |
+
|
46 |
+
$collection = $collection->toOptionArray();
|
47 |
+
$return = '';
|
48 |
+
foreach ($collection as $option) {
|
49 |
+
if ($option['value'] == $optionId) {
|
50 |
+
$return = $option["label"];
|
51 |
+
break;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $return;
|
55 |
+
}
|
56 |
+
|
57 |
+
private function _sendOrder()
|
58 |
+
{
|
59 |
+
$order = Mage::getModel('sales/order')
|
60 |
+
->loadByIncrementId('100000030');
|
61 |
+
|
62 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
63 |
+
echo '<pre>';
|
64 |
+
var_dump($helper_webservice->saveOrder($order));
|
65 |
+
echo '<pre>';
|
66 |
+
die('done');
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
private function _checkOrder()
|
71 |
+
{
|
72 |
+
$order = Mage::getModel('sales/order')
|
73 |
+
->loadByIncrementId('100000024');
|
74 |
+
|
75 |
+
$addr_billing = $order->getBillingAddress();
|
76 |
+
$addr_shipping = $order->getShippingAddress();
|
77 |
+
$address = $addr_shipping ? $addr_shipping : $addr_billing;
|
78 |
+
list($street, $street_number) = $this->splitAddress($address);
|
79 |
+
|
80 |
+
$date = date('Y-m-d');
|
81 |
+
if ($order->getData('preferred_delivery_date')) {
|
82 |
+
$date = $order->getData('preferred_delivery_date');
|
83 |
+
}
|
84 |
+
|
85 |
+
$data = array(
|
86 |
+
'date'=>$date,
|
87 |
+
'reference'=>$order->getRealOrderId(),
|
88 |
+
'address' => array(
|
89 |
+
'addressed_to'=>$address->getName(),
|
90 |
+
'street'=>$street,
|
91 |
+
'street_number'=>$street_number,
|
92 |
+
'number_extention'=>null,
|
93 |
+
'zipcode'=>$address->getPostcode(),
|
94 |
+
'city'=>$address->getCity(),
|
95 |
+
'country_code'=>$address->getCountry(),
|
96 |
+
'phone_number'=>$address->getTelephone(),
|
97 |
+
'email'=>$order->getCustomerEmail()
|
98 |
+
),
|
99 |
+
'order_lines' => array()
|
100 |
+
);
|
101 |
+
|
102 |
+
if ($address->getCompany() != '') {
|
103 |
+
$data['address']['addressed_to'] = $address->getCompany();
|
104 |
+
$data['address']['contactperson'] = $address->getName();
|
105 |
+
}
|
106 |
+
|
107 |
+
foreach ($order->getItemsCollection() as $ol) {
|
108 |
+
if ($ol->isDeleted() || $ol->getProductType() !== 'simple') {
|
109 |
+
continue;
|
110 |
+
}
|
111 |
+
|
112 |
+
$product = $this->getProduct($ol);
|
113 |
+
|
114 |
+
$data["order_lines"][] = array(
|
115 |
+
'article_code' => $ol->getSku(),
|
116 |
+
'article_description' => $product ? $product->getName() : '',
|
117 |
+
'quantity' => (int)$ol->getData('qty_ordered')
|
118 |
+
);
|
119 |
+
}
|
120 |
+
|
121 |
+
echo '<pre>';
|
122 |
+
var_dump($data);
|
123 |
+
echo '</pre>';
|
124 |
+
die('done');
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
private function _checkStock()
|
129 |
+
{
|
130 |
+
// Get the helpers
|
131 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
132 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
133 |
+
|
134 |
+
$_stock = $helper_webservice->getStock();
|
135 |
+
|
136 |
+
if (isset($_stock['success']) && $_stock['success'] == true) {
|
137 |
+
foreach ($_stock['returned'] as $sku => $qty) {
|
138 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
139 |
+
|
140 |
+
if ($product != false) {
|
141 |
+
$productId = $product->getId();
|
142 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
|
143 |
+
$stockItem->setData('qty', $qty);
|
144 |
+
|
145 |
+
try {
|
146 |
+
$stockItem->save();
|
147 |
+
} catch (Exception $e) {
|
148 |
+
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
private function _checkOrderStatus()
|
156 |
+
{
|
157 |
+
// Get the helpers
|
158 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
159 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
160 |
+
|
161 |
+
// Load the orders
|
162 |
+
$orders = $helper_data->getSentOrders();
|
163 |
+
if ($orders) {
|
164 |
+
$tracking_orders = $helper_webservice->getOrderTracking($orders);
|
165 |
+
} else {
|
166 |
+
exit;
|
167 |
+
}
|
168 |
+
|
169 |
+
foreach ($orders as $order) {
|
170 |
+
$tracking_order = $tracking_orders[$order->getRealOrderId()];
|
171 |
+
if (!is_null($tracking_order) /* && $tracking_order['success'] == true */) {
|
172 |
+
$itemQty = $order->getItemsCollection()->count();
|
173 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
174 |
+
|
175 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
176 |
+
$shipmentId = $shipment->create($order->getRealOrderId());
|
177 |
+
$shipment_model = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentId);
|
178 |
+
|
179 |
+
$carrier_code = 'custom';
|
180 |
+
$carriers = $this->_getCarriers();
|
181 |
+
if (isset($carriers[$tracking_order['shipper']])) {
|
182 |
+
$carrier_code = $carriers[$tracking_order['shipper']];
|
183 |
+
}
|
184 |
+
|
185 |
+
$track_model = Mage::getModel('sales/order_shipment_track')
|
186 |
+
->setShipment($shipment_model)
|
187 |
+
->setData('title', $tracking_order['shipper'])
|
188 |
+
->setData('number', $tracking_order['tracking_code'])
|
189 |
+
->setData('carrier_code', $carrier_code)
|
190 |
+
->setData('order_id', $shipment_model->getData('order_id'))
|
191 |
+
->save();
|
192 |
+
|
193 |
+
$shipment_model->sendEmail();
|
194 |
+
$shipment_model->setEmailSent(true);
|
195 |
+
$shipment_model->save();
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
public function _getCarriers()
|
201 |
+
{
|
202 |
+
$carriers_config = Mage::getModel('shipping/config');
|
203 |
+
$return = array();
|
204 |
+
|
205 |
+
if ($carriers_config !== false) {
|
206 |
+
$active_carriers = $carriers_config->getActiveCarriers();
|
207 |
+
foreach ($active_carriers as $carrier) {
|
208 |
+
$carrierCode = $carrier->getCarrierCode();
|
209 |
+
$carrierName = Mage::getStoreConfig('carriers/' . $carrierCode . '/title');
|
210 |
+
if (empty($carrierName)) {
|
211 |
+
$carrierName = Mage::getStoreConfig('customtrackers/' . $carrierCode . '/title');
|
212 |
+
}
|
213 |
+
|
214 |
+
$return[$carrierName] = $carrierCode;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return $return;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Tries get related product from order line
|
222 |
+
* @param Mage_Sales_Model_Order_Item $order_line
|
223 |
+
* @return Mage_Catalog_Model_Product|NULL
|
224 |
+
*/
|
225 |
+
private function getProduct(Mage_Sales_Model_Order_Item $order_line)
|
226 |
+
{
|
227 |
+
// get product
|
228 |
+
$product = Mage::getModel('catalog/product')->load($order_line->getProductId());
|
229 |
+
if (empty($product) || ($order_line->getProductType() == 'configurable')) {
|
230 |
+
$options = $order_line->getProductOptions();
|
231 |
+
if (count($options)) {
|
232 |
+
$product = false;
|
233 |
+
if (isset($options['simple_sku']) && !empty($options['simple_sku'])) {
|
234 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $options['simple_sku']);
|
235 |
+
} elseif (isset($options['info_buyRequest']) && isset($options['info_buyRequest']['product'])) {
|
236 |
+
$product = Mage::getModel('catalog/product')->load($options['info_buyRequest']['product']);
|
237 |
+
} elseif (isset($options['super_product_config']) && isset($options['super_product_config']['product_id'])) {
|
238 |
+
$product = Mage::getModel('catalog/product')->load($options['super_product_config']['product_id']);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
if ($product && $product->getId()) {
|
243 |
+
return $product;
|
244 |
+
}
|
245 |
+
$sku = $order_line->getSku();
|
246 |
+
$pid = Mage::getModel('catalog/product')->getIdBySku($sku);
|
247 |
+
return $pid ? Mage::getModel('catalog/product')->load($pid) : null;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Split multiline magento address to address and house number
|
252 |
+
* @var Mage_Sales_Model_Order_Address $address
|
253 |
+
* @return array [0] address [1] house no
|
254 |
+
*/
|
255 |
+
private function splitAddress(Mage_Sales_Model_Order_Address $address)
|
256 |
+
{
|
257 |
+
$adr = $address->getStreetFull();
|
258 |
+
$lines = preg_split("/[\n|\r]/", $adr);
|
259 |
+
if (!count($lines)) {
|
260 |
+
$lines = array($adr);
|
261 |
+
}
|
262 |
+
|
263 |
+
$no = '';
|
264 |
+
$parts = explode(' ', $lines[0]);
|
265 |
+
if (count($parts) > 1) {
|
266 |
+
$no = end($parts);
|
267 |
+
unset($parts[count($parts) - 1]); // remove last
|
268 |
+
}
|
269 |
+
|
270 |
+
$street = implode(' ', $parts);
|
271 |
+
|
272 |
+
if (count($lines) > 1) {
|
273 |
+
$street .= "\n{$lines[1]}";
|
274 |
+
}
|
275 |
+
|
276 |
+
return array($street, $no);
|
277 |
+
}
|
278 |
+
|
279 |
+
// Temp code, delete
|
280 |
+
private function oldCodeBlock(){
|
281 |
+
|
282 |
+
// Get the helpers
|
283 |
+
/**
|
284 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
285 |
+
* @var Notive_Astral_Helper_Data $helper_data
|
286 |
+
*/
|
287 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
288 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
289 |
+
|
290 |
+
// Load the orders
|
291 |
+
$orders = $helper_data->getSentOrders();
|
292 |
+
if ($orders) {
|
293 |
+
$tracking_orders = $helper_webservice->getOrderTracking($orders);
|
294 |
+
} else {
|
295 |
+
exit;
|
296 |
+
}
|
297 |
+
|
298 |
+
foreach ($orders as $order) {
|
299 |
+
$tracking_order = $tracking_orders[$order->getRealOrderId()];
|
300 |
+
if (!is_null($tracking_order) && $tracking_order['success'] == true) {
|
301 |
+
$itemQty = $order->getItemsCollection()->count();
|
302 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
303 |
+
|
304 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
305 |
+
$shipmentId = $shipment->create($order->getRealOrderId());
|
306 |
+
$shipment_model = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentId);
|
307 |
+
|
308 |
+
$carrier_code = 'custom';
|
309 |
+
$carriers = $this->_getCarriers();
|
310 |
+
if (isset($carriers[$tracking_order['shipper']])) {
|
311 |
+
$carrier_code = $carriers[$tracking_order['shipper']];
|
312 |
+
}
|
313 |
+
|
314 |
+
$track_model = Mage::getModel('sales/order_shipment_track')
|
315 |
+
->setShipment($shipment_model)
|
316 |
+
->setData('title', $tracking_order['shipper'])
|
317 |
+
->setData('number', $tracking_order['tracking_code'])
|
318 |
+
->setData('carrier_code', $carrier_code)
|
319 |
+
->setData('order_id', $shipment_model->getData('order_id'))
|
320 |
+
->save();
|
321 |
+
|
322 |
+
$shipment_model->sendEmail();
|
323 |
+
$shipment_model->setEmailSent(true);
|
324 |
+
$shipment_model->save();
|
325 |
+
}
|
326 |
+
}
|
327 |
+
/**
|
328 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
329 |
+
*/
|
330 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
331 |
+
$tracking = $helper_webservice->getTnT('100000048');
|
332 |
+
$stock = $helper_webservice->getStock();
|
333 |
+
|
334 |
+
var_dump($order);exit;
|
335 |
+
|
336 |
+
// $this->_checkOrderStatus();
|
337 |
+
// $this->_checkStock();
|
338 |
+
// $this->_sendOrder();
|
339 |
+
// $this->_randomTests();
|
340 |
+
}
|
341 |
+
|
342 |
+
private function checkOrderStatus()
|
343 |
+
{
|
344 |
+
/**
|
345 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
346 |
+
* @var Notive_Astral_Helper_Data $helper_data
|
347 |
+
*/
|
348 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
349 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
350 |
+
|
351 |
+
// Load the orders
|
352 |
+
$orders = $helper_data->getSentOrders();
|
353 |
+
print_r($helper_webservice->getOrderTracking($orders));exit;
|
354 |
+
if ($orders) {
|
355 |
+
$tracking_orders = $helper_webservice->getOrderTracking($orders);
|
356 |
+
} else {
|
357 |
+
exit;
|
358 |
+
}
|
359 |
+
|
360 |
+
foreach ($orders as $order) {
|
361 |
+
$tracking_order = $tracking_orders[$order->getRealOrderId()];
|
362 |
+
print_r($tracking_order);exit;
|
363 |
+
if (!is_null($tracking_order) && $tracking_order['success'] == true) {
|
364 |
+
$itemQty = $order->getItemsCollection()->count();
|
365 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
366 |
+
|
367 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
368 |
+
$shipmentId = $shipment->create($order->getRealOrderId());
|
369 |
+
$shipment_model = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentId);
|
370 |
+
|
371 |
+
$carrier_code = 'custom';
|
372 |
+
$carriers = $this->_getCarriers();
|
373 |
+
if (isset($carriers[$tracking_order['shipper']])) {
|
374 |
+
$carrier_code = $carriers[$tracking_order['shipper']];
|
375 |
+
}
|
376 |
+
|
377 |
+
$track_model = Mage::getModel('sales/order_shipment_track')
|
378 |
+
->setShipment($shipment_model)
|
379 |
+
->setData('title', $tracking_order['shipper'])
|
380 |
+
->setData('number', $tracking_order['tracking_code'])
|
381 |
+
->setData('carrier_code', $carrier_code)
|
382 |
+
->setData('order_id', $shipment_model->getData('order_id'))
|
383 |
+
->save();
|
384 |
+
|
385 |
+
$shipment_model->sendEmail();
|
386 |
+
$shipment_model->setEmailSent(true);
|
387 |
+
$shipment_model->save();
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
public function sts() {
|
393 |
+
/**
|
394 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
395 |
+
* @var Notive_Astral_Helper_Data $helper_data
|
396 |
+
*/
|
397 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
398 |
+
$helper_data = Mage::getSingleton('Notive_Astral_Helper_Data');
|
399 |
+
|
400 |
+
// Load the orders
|
401 |
+
$orders = $helper_data->getSentOrders();
|
402 |
+
if ($orders) {
|
403 |
+
$tracking_orders = $helper_webservice->getOrderTracking($orders);
|
404 |
+
} else {
|
405 |
+
exit;
|
406 |
+
}
|
407 |
+
|
408 |
+
foreach ($orders as $order) {
|
409 |
+
$tracking_order = $tracking_orders[$order->getRealOrderId()];
|
410 |
+
if( is_empty_date($tracking_order['success']) ){
|
411 |
+
continue;
|
412 |
+
}
|
413 |
+
|
414 |
+
if (!is_null($tracking_order) && $tracking_order['success'] == true) {
|
415 |
+
|
416 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($tracking_order['order_reference']);
|
417 |
+
|
418 |
+
$itemQty = $order->getItemsCollection()->count();
|
419 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
420 |
+
$t = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
421 |
+
$shipmentId = $shipment->create($order->getRealOrderId());
|
422 |
+
$shipment_model = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentId);
|
423 |
+
|
424 |
+
$carrier_code = 'custom';
|
425 |
+
$carriers = $this->_getCarriers();
|
426 |
+
if (isset($carriers[$tracking_order['shipper']])) {
|
427 |
+
$carrier_code = $carriers[$tracking_order['shipper']];
|
428 |
+
}
|
429 |
+
|
430 |
+
$track_model = Mage::getModel('sales/order_shipment_track')
|
431 |
+
->setShipment($shipment_model)
|
432 |
+
->setData('title', 'water')
|
433 |
+
->setData('number', $tracking_order['tracking_code'])
|
434 |
+
->setData('carrier_code', $carrier_code)
|
435 |
+
->setData('order_id', $shipment_model->getData('order_id'))
|
436 |
+
->save();
|
437 |
+
|
438 |
+
$shipment_model->sendEmail();
|
439 |
+
$shipment_model->setEmailSent(true);
|
440 |
+
$shipment_model->save();
|
441 |
+
die('saved');
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
}
|
446 |
+
}
|
447 |
+
}
|
app/code/local/Notive/Astral/controllers/IndexController.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_IndexController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Notive/Astral/controllers/Sales/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/Sales/.AppleDouble/OrderController.php
ADDED
Binary file
|
app/code/local/Notive/Astral/controllers/Sales/OrderController.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Notive_Astral_Sales_OrderController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$id = $this->getRequest()->getParam('order_id');
|
8 |
+
$order = Mage::getModel('sales/order')->load($id);
|
9 |
+
$helper_webservice = Mage::getSingleton('Notive_Astral_Helper_Webservice');
|
10 |
+
$observer = Mage::getModel('Notive_Astral_Model_Observers_Order');
|
11 |
+
|
12 |
+
if (!$order->getId()) {
|
13 |
+
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
14 |
+
$this->_redirect('adminhtml/sales_order/index');
|
15 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
16 |
+
return false;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var Notive_Astral_Helper_Webservice $helper_webservice
|
21 |
+
*/
|
22 |
+
$result = $helper_webservice->saveOrder($order);
|
23 |
+
|
24 |
+
//Als order opgeslagen wordt, stuur door naar order model
|
25 |
+
if ($result !== false && !is_null($result) && isset($result['success']) && $result['success']) {
|
26 |
+
$this->_getSession()->addSuccess($this->__('The order was sent to ASTRAL.'));
|
27 |
+
$observer->setStateSent($order);
|
28 |
+
} else {
|
29 |
+
$msg = '';
|
30 |
+
if ($result !== false && !is_null($result) && isset($result['error'])) {
|
31 |
+
$msg = $result['error'];
|
32 |
+
}
|
33 |
+
$this->_getSession()->addError($this->__('The order was not sent to ASTRAL and has been put on hold.'));
|
34 |
+
$observer->setStateNotSent($order, $msg);
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id'=>$id));
|
38 |
+
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
app/code/local/Notive/Astral/etc/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/etc/.AppleDouble/config.xml
ADDED
Binary file
|
app/code/local/Notive/Astral/etc/.AppleDouble/system.xml
ADDED
Binary file
|
app/code/local/Notive/Astral/etc/config.xml
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Notive_Astral>
|
5 |
+
<version>1.1.3</version>
|
6 |
+
</Notive_Astral>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<astral>
|
11 |
+
<class>Notive_Astral_Helper</class>
|
12 |
+
</astral>
|
13 |
+
</helpers>
|
14 |
+
<models>
|
15 |
+
<notive_astral>
|
16 |
+
<class>Notive_Astral_Model</class>
|
17 |
+
</notive_astral>
|
18 |
+
</models>
|
19 |
+
<blocks>
|
20 |
+
<adminhtml>
|
21 |
+
<rewrite>
|
22 |
+
<sales_order_view>Notive_Astral_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
23 |
+
</rewrite>
|
24 |
+
</adminhtml>
|
25 |
+
<astral>
|
26 |
+
<class>Notive_Astral_Block</class>
|
27 |
+
</astral>
|
28 |
+
</blocks>
|
29 |
+
<events>
|
30 |
+
<sales_order_save_after>
|
31 |
+
<observers>
|
32 |
+
<Notive_Astral>
|
33 |
+
<type>singleton</type>
|
34 |
+
<class>Notive_Astral_Model_Observers_Order</class>
|
35 |
+
<method>sales_order_save_after</method>
|
36 |
+
</Notive_Astral>
|
37 |
+
</observers>
|
38 |
+
</sales_order_save_after>
|
39 |
+
</events>
|
40 |
+
<resources>
|
41 |
+
<notive_astral_setup>
|
42 |
+
<setup>
|
43 |
+
<module>Notive_Astral</module>
|
44 |
+
<class>Notive_Astral_Model_Resource_Setup</class>
|
45 |
+
</setup>
|
46 |
+
<connection>
|
47 |
+
<use>core_setup</use>
|
48 |
+
</connection>
|
49 |
+
</notive_astral_setup>
|
50 |
+
</resources>
|
51 |
+
<sales>
|
52 |
+
<order>
|
53 |
+
<statuses>
|
54 |
+
<notive_astral_sent translate="label">
|
55 |
+
<label>Sent To Astral</label>
|
56 |
+
</notive_astral_sent>
|
57 |
+
<notive_astral_error translate="label">
|
58 |
+
<label>Not Sent To Astral</label>
|
59 |
+
</notive_astral_error>
|
60 |
+
</statuses>
|
61 |
+
<states>
|
62 |
+
<holded translate="label">
|
63 |
+
<statuses>
|
64 |
+
<notive_astral_error />
|
65 |
+
</statuses>
|
66 |
+
</holded>
|
67 |
+
<processing translate="label">
|
68 |
+
<statuses>
|
69 |
+
<notive_astral_sent />
|
70 |
+
</statuses>
|
71 |
+
</processing>
|
72 |
+
</states>
|
73 |
+
</order>
|
74 |
+
</sales>
|
75 |
+
</global>
|
76 |
+
|
77 |
+
<default>
|
78 |
+
<Notive_Astral>
|
79 |
+
<order>
|
80 |
+
<status_send>processing</status_send>
|
81 |
+
<article_code_field>sku</article_code_field>
|
82 |
+
</order>
|
83 |
+
</Notive_Astral>
|
84 |
+
</default>
|
85 |
+
|
86 |
+
<admin>
|
87 |
+
<routers>
|
88 |
+
<astral>
|
89 |
+
<use>admin</use>
|
90 |
+
<args>
|
91 |
+
<module>Notive_Astral</module>
|
92 |
+
<frontName>astral</frontName>
|
93 |
+
</args>
|
94 |
+
</astral>
|
95 |
+
</routers>
|
96 |
+
</admin>
|
97 |
+
<adminhtml>
|
98 |
+
<!-- Used for testing:
|
99 |
+
<menu>
|
100 |
+
<system>
|
101 |
+
<children>
|
102 |
+
<astral_test translate="title" module="astral">
|
103 |
+
<title>Astral Test</title>
|
104 |
+
<action>astral/adminhtml_astralbackend</action>
|
105 |
+
</astral_test>
|
106 |
+
<astral_order translate="title" module="astral">
|
107 |
+
<title>Astral Order</title>
|
108 |
+
<action>astral/sales_order</action>
|
109 |
+
</astral_order>
|
110 |
+
</children>
|
111 |
+
</system>
|
112 |
+
</menu>
|
113 |
+
-->
|
114 |
+
<acl>
|
115 |
+
<resources>
|
116 |
+
<all>
|
117 |
+
<title>Allow Everything</title>
|
118 |
+
</all>
|
119 |
+
<admin>
|
120 |
+
<children>
|
121 |
+
<system>
|
122 |
+
<children>
|
123 |
+
<config>
|
124 |
+
<children>
|
125 |
+
<Notive_Astral translate="title">
|
126 |
+
<title>Astral Settings</title>
|
127 |
+
</Notive_Astral>
|
128 |
+
</children>
|
129 |
+
</config>
|
130 |
+
</children>
|
131 |
+
</system>
|
132 |
+
</children>
|
133 |
+
</admin>
|
134 |
+
</resources>
|
135 |
+
</acl>
|
136 |
+
</adminhtml>
|
137 |
+
|
138 |
+
|
139 |
+
<crontab>
|
140 |
+
<jobs>
|
141 |
+
<notive_order_cron>
|
142 |
+
<schedule>
|
143 |
+
<cron_expr>0 * * * *</cron_expr>
|
144 |
+
</schedule>
|
145 |
+
<run>
|
146 |
+
<model>notive_astral/cron::runOrders</model>
|
147 |
+
</run>
|
148 |
+
</notive_order_cron>
|
149 |
+
<notive_stock_cron>
|
150 |
+
<schedule>
|
151 |
+
<cron_expr>15 * * * *</cron_expr>
|
152 |
+
</schedule>
|
153 |
+
<run>
|
154 |
+
<model>notive_astral/cron::runStock</model>
|
155 |
+
</run>
|
156 |
+
</notive_stock_cron>
|
157 |
+
</jobs>
|
158 |
+
</crontab>
|
159 |
+
</config>
|
app/code/local/Notive/Astral/etc/system.xml
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<Notive_Astral translate="label" module="astral">
|
5 |
+
<label>ASTRAL</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</Notive_Astral>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<Notive_Astral>
|
11 |
+
<label>Settings</label>
|
12 |
+
<tab>Notive_Astral</tab>
|
13 |
+
<sort_order>99</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>0</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<general translate="label comment">
|
19 |
+
<label>General</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1</sort_order>3
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>0</show_in_store>
|
25 |
+
<expanded>1</expanded>
|
26 |
+
<comment><![CDATA[Current version <u><strong>1.1.2</strong></u><br/><br/>]]></comment>
|
27 |
+
<fields>
|
28 |
+
<username translate="label comment">
|
29 |
+
<label>Shop name</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<comment><![CDATA[Your shop name.]]></comment>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>0</show_in_website>
|
35 |
+
<show_in_store>0</show_in_store>
|
36 |
+
</username>
|
37 |
+
<customer_number translate="label comment">
|
38 |
+
<label>Customer Number</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<comment><![CDATA[Your Astral customer number.]]></comment>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>0</show_in_website>
|
44 |
+
<show_in_store>0</show_in_store>
|
45 |
+
</customer_number>
|
46 |
+
<password translate="label comment">
|
47 |
+
<label>Password</label>
|
48 |
+
<frontend_type>password</frontend_type>
|
49 |
+
<comment><![CDATA[Your Astral password.]]></comment>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>0</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
</password>
|
55 |
+
</fields>
|
56 |
+
</general>
|
57 |
+
<order translate="label comment">
|
58 |
+
<label>Orders</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>1</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
<expanded>1</expanded>
|
65 |
+
<fields>
|
66 |
+
<enabled translate="label comment">
|
67 |
+
<label>Enabled</label>
|
68 |
+
<comment><![CDATA[Orders will be sent to Astral.]]></comment>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
71 |
+
<sort_order>0</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>0</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</enabled>
|
76 |
+
<status_send translate="label comment">
|
77 |
+
<label>Order status(es) to send</label>
|
78 |
+
<frontend_type>multiselect</frontend_type>
|
79 |
+
<comment><![CDATA[When an order gets this status, it will be sent to Astral.]]></comment>
|
80 |
+
<source_model>Notive_Astral_Model_Status</source_model>
|
81 |
+
<sort_order>4</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>0</show_in_store>
|
85 |
+
</status_send>
|
86 |
+
<article_code_field translate="label comment">
|
87 |
+
<label>Article code field</label>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<comment><![CDATA[Choose the field to use as the article code.]]></comment>
|
90 |
+
<source_model>Notive_Astral_Model_Attribute</source_model>
|
91 |
+
<sort_order>8</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>0</show_in_store>
|
95 |
+
</article_code_field>
|
96 |
+
</fields>
|
97 |
+
</order>
|
98 |
+
<order_status translate="label comment">
|
99 |
+
<label>Order status</label>
|
100 |
+
<frontend_type>text</frontend_type>
|
101 |
+
<sort_order>2</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>1</show_in_website>
|
104 |
+
<show_in_store>0</show_in_store>
|
105 |
+
<expanded>1</expanded>
|
106 |
+
<fields>
|
107 |
+
<enabled translate="label comment">
|
108 |
+
<label>Enabled</label>
|
109 |
+
<comment><![CDATA[The order status will be updated using the Astral services.]]></comment>
|
110 |
+
<frontend_type>select</frontend_type>
|
111 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
112 |
+
<sort_order>0</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>0</show_in_website>
|
115 |
+
<show_in_store>0</show_in_store>
|
116 |
+
</enabled>
|
117 |
+
</fields>
|
118 |
+
</order_status>
|
119 |
+
<stock_sync translate="label comment">
|
120 |
+
<label>Stock sync</label>
|
121 |
+
<frontend_type>text</frontend_type>
|
122 |
+
<sort_order>3</sort_order>
|
123 |
+
<show_in_default>1</show_in_default>
|
124 |
+
<show_in_website>1</show_in_website>
|
125 |
+
<show_in_store>0</show_in_store>
|
126 |
+
<expanded>1</expanded>
|
127 |
+
<fields>
|
128 |
+
<enabled translate="label comment">
|
129 |
+
<label>Enabled</label>
|
130 |
+
<comment><![CDATA[The stock levels will be updated using the Astral services.]]></comment>
|
131 |
+
<frontend_type>select</frontend_type>
|
132 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
133 |
+
<sort_order>0</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>0</show_in_website>
|
136 |
+
<show_in_store>0</show_in_store>
|
137 |
+
</enabled>
|
138 |
+
<last_sync_date translate="label comment">
|
139 |
+
<label>Last sync date</label>
|
140 |
+
<frontend_type>text</frontend_type>
|
141 |
+
<comment><![CDATA[Last sync date.]]></comment>
|
142 |
+
<sort_order>1</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>0</show_in_website>
|
145 |
+
<show_in_store>0</show_in_store>
|
146 |
+
</last_sync_date>
|
147 |
+
</fields>
|
148 |
+
</stock_sync>
|
149 |
+
</groups>
|
150 |
+
</Notive_Astral>
|
151 |
+
</sections>
|
152 |
+
</config>
|
app/code/local/Notive/Astral/sql/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/sql/notive_astral_setup/.AppleDouble/.Parent
ADDED
Binary file
|
app/code/local/Notive/Astral/sql/notive_astral_setup/.AppleDouble/mysql4-install-1.0.0.php
ADDED
Binary file
|
app/code/local/Notive/Astral/sql/notive_astral_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$setup = Mage::getResourceModel('sales/setup', 'default_write');
|
4 |
+
|
5 |
+
$setup->startSetup();
|
6 |
+
|
7 |
+
// Add statusses for magento version 1.5 up
|
8 |
+
if (version_compare(Mage::getVersion(), '1.5', '>=') === true) {
|
9 |
+
$model = Mage::getModel('sales/order_status')->load(Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_ERROR);
|
10 |
+
$model->setStatus(Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_ERROR);
|
11 |
+
$model->setLabel('Not Sent To Astral');
|
12 |
+
$model->save();
|
13 |
+
$model->assignState(Mage_Sales_Model_Order::STATE_HOLDED, false);
|
14 |
+
|
15 |
+
$model = Mage::getModel('sales/order_status')->load(Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_OK);
|
16 |
+
$model->setStatus(Notive_Astral_Model_Observers_Order::ASTRAL_ORDER_STATUS_CODE_OK);
|
17 |
+
$model->setLabel('Sent To Astral');
|
18 |
+
$model->save();
|
19 |
+
$model->assignState(Mage_Sales_Model_Order::STATE_PROCESSING, false);
|
20 |
+
}
|
21 |
+
// Cache refresh
|
22 |
+
if (method_exists($setup->_conn, 'resetDdlCache')) {
|
23 |
+
$setup->_conn->resetDdlCache();
|
24 |
+
}
|
25 |
+
|
26 |
+
$setup->endSetup();
|
app/etc/modules/Notive_Astral.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Notive_Astral>
|
5 |
+
<version>1.1.3</version>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>local</codePool>
|
8 |
+
</Notive_Astral>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Notive_Astral</name>
|
4 |
+
<version>1.1.3</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Connect your Magento store to the Astral Music backoffice.</summary>
|
10 |
+
<description>Connect your Magento store to the Astral Music backoffice.</description>
|
11 |
+
<notes>First Magento Connect version of the module.</notes>
|
12 |
+
<authors><author><name>Ferry Koster</name><user>notivemagento</user><email>info@notive.nl</email></author></authors>
|
13 |
+
<date>2015-06-19</date>
|
14 |
+
<time>12:46:12</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Notive"><dir name="Astral"><dir name="Block"><dir name="Adminhtml"><file name="Astralbackend.php" hash="724df9454ff626fe23233e7712c175c1"/><dir name="Sales"><dir name="Order"><file name="View.php" hash="9cd2c2aadf6794edc604697db451a8a3"/><dir name=".AppleDouble"><file name="View.php" hash="973da4fa0ce95e48dcca94f0d87b6560"/><file name=".Parent" hash="dea7c0241d2aefd63156274faa34ce15"/></dir></dir><dir name=".AppleDouble"><file name=".Parent" hash="2cc1fbe04dded63905fe0bc8c921aa25"/></dir></dir><dir name=".AppleDouble"><file name="Astralbackend.php" hash="835f115d0a1a34424e9a3fef4d7095e2"/><file name=".Parent" hash="c968c5f57f3c74481a7894483742a783"/></dir></dir><dir name=".AppleDouble"><file name=".Parent" hash="12d0091d59d5c824bb7d9248046688e4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="059a8c938b022143b8a9e9d2cbc6cace"/><file name="Webservice.php" hash="97e6ca9cf63986ce85d40d73e636f0d5"/><dir name=".AppleDouble"><file name="Data.php" hash="f2e5786c42bab9d44220f004b0356ca5"/><file name="Webservice.php" hash="485eb1918ad3e6f64744fc1621878fb7"/><file name=".Parent" hash="7b0cd81ec7726856fa34ea0f9adb33f5"/></dir></dir><dir name="Model"><file name="Attribute.php" hash="c3c3d55c8d4a81df4bb28d29f448a6e2"/><file name="Cron.php" hash="33efc08667e551fe5c83f8c8a755d34e"/><dir name="Observers"><dir name="Order"><file name="Abstract.php" hash="2488e10499e1a982ba3d64318036ba94"/><dir name=".AppleDouble"><file name="Abstract.php" hash="eaa63ca8b56d553f69b07dfc16945c19"/><file name=".Parent" hash="0df568b94460e231f6edc6857282506a"/></dir></dir><file name="Order.php" hash="2d39c285483e69883f96b46ca9df8991"/><dir name=".AppleDouble"><file name="Order.php" hash="1a9e466898376674025246cfdf4b50fe"/><file name=".Parent" hash="96fa0501fe997aacb27c8a3529bbfd52"/></dir></dir><dir name="Resource"><file name="Setup.php" hash="2550781c7bdcdccfe3069f20f8789be9"/><dir name=".AppleDouble"><file name="Setup.php" hash="546029b74b43c3f554001469157acc7a"/><file name=".Parent" hash="172f28d50fdad38ea57a0693605b65b0"/></dir></dir><file name="Status.php" hash="29770579a91f1fa49b1c9fc11ac1e40b"/><dir name=".AppleDouble"><file name="Attribute.php" hash="be0f9b6ff1fcb8b4866dcd04db70440e"/><file name="Cron.php" hash="2b6fb671ad6f38e3269b3d2d21bf0124"/><file name="Status.php" hash="125ddc4d36d1afaba347a131c49515e8"/><file name=".Parent" hash="2fb15a8b4a4fad3c31fed0b6bd20f5a0"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AstralbackendController.php" hash="29a51380836a37db5abadfc7ae57ae77"/><dir name=".AppleDouble"><file name="AstralbackendController.php" hash="99128f8b10aa05841b163fe7206309ab"/><file name=".Parent" hash="0afb534d62aadd6c99c32e4036ef3053"/></dir></dir><file name="IndexController.php" hash="193366f73a6e98040d9126cb4d58f92c"/><dir name="Sales"><file name="OrderController.php" hash="4070e54fca6d513bdfd9940c18959180"/><dir name=".AppleDouble"><file name="OrderController.php" hash="2f484c7b0d3ee393bac85df450242133"/><file name=".Parent" hash="375be5f8a9f9f6d9ec1f1438688a6388"/></dir></dir><dir name=".AppleDouble"><file name="IndexController.php" hash="4cbf1b272eb75565677fbe5964c39ba7"/><file name=".Parent" hash="d9cd18bc2e19e290831982f189fee7d0"/></dir></dir><dir name="etc"><file name="config.xml" hash="0a30bc8f053c2b6b8fb1e178cfc7ac34"/><file name="system.xml" hash="041e423950d67a8a17b73bb57fea0409"/><dir name=".AppleDouble"><file name="config.xml" hash="d5ee59c17496f1855e0759de899cc67e"/><file name="system.xml" hash="5df29a18ff08509f068bdf2185ad9e42"/><file name=".Parent" hash="05fc3b68d338e3465134055b74c1b7fe"/></dir></dir><dir name="sql"><dir name="notive_astral_setup"><file name="mysql4-install-1.0.0.php" hash="4fde1e6915b8e98b8496b41ce32640de"/><dir name=".AppleDouble"><file name="mysql4-install-1.0.0.php" hash="497ba8f4108890245c50d4590aed8ee6"/><file name=".Parent" hash="c11d5a38f43a705633bd11de23dfb12e"/></dir></dir><dir name=".AppleDouble"><file name=".Parent" hash="d46aa7b591f42e8e3227252ef2fc8cac"/></dir></dir><dir name=".AppleDouble"><file name=".Parent" hash="9c63ed48f7f48dea8e71414cd42cd164"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Notive_Astral.xml" hash="604c81025a90afaad8bdd5ca7fd2471f"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>10.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max></max></package><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
|
18 |
+
</package>
|