Version Notes
Notes
Download this release
Release Info
Developer | Bobby Burden |
Extension | iparcel_logistics |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Dashboard.php +28 -0
- app/code/community/Iparcel/All/Helper/Api.php +51 -13
- app/code/community/Iparcel/All/Model/Catalog/Product/Observer.php +67 -0
- app/code/community/Iparcel/All/Model/Cron.php +24 -0
- app/code/community/Iparcel/All/Model/System/Config/Catalog/Mapping.php +4 -3
- app/code/community/Iparcel/All/Model/System/Config/Data/Date/Monthday.php +1 -1
- app/code/community/Iparcel/All/Model/System/Config/Data/Date/Weekday.php +1 -1
- app/code/community/Iparcel/All/Model/System/Config/Data/Time/Hour.php +1 -1
- app/code/community/Iparcel/All/Model/System/Config/Data/Time/Minute.php +1 -1
- app/code/community/Iparcel/All/controllers/InfoController.php +48 -0
- app/code/community/Iparcel/All/etc/config.xml +51 -1
- app/code/community/Iparcel/All/etc/system.xml +9 -0
- app/code/community/Iparcel/Logistics/Helper/Api.php +1 -2
- app/code/community/Iparcel/Logistics/Helper/Data.php +3 -3
- app/code/community/Iparcel/Logistics/Model/Carrier/Iparcel.php +68 -70
- app/code/community/Iparcel/Logistics/Model/Observer.php +63 -34
- app/code/community/Iparcel/Logistics/etc/config.xml +13 -3
- app/code/community/Iparcel/Logistics/etc/system.xml +15 -5
- app/code/community/Iparcel/Logistics/sql/iplogistics_setup/{mysql4-upgrade-1.0.2-1.0.3.php → mysql4-upgrade-1.0.5-1.0.6.php} +1 -1
- package.xml +4 -4
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Dashboard.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend Model Class for carriers/i-parcel/additionalfields config button
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_All
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_All_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get Button Html
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
$url = 'http://globalaccess.i-parcel.com';
|
20 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setType('button')
|
22 |
+
->setClass('scalable')
|
23 |
+
->setLabel('Go to i-parcel Dashboard')
|
24 |
+
->setOnClick("window.location.href='" . $url . "'")
|
25 |
+
->toHtml();
|
26 |
+
return $html;
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Iparcel/All/Helper/Api.php
CHANGED
@@ -259,26 +259,48 @@ class Iparcel_All_Helper_Api
|
|
259 |
$customOptions = array();
|
260 |
$optSortOrder = $option["sort_order"];
|
261 |
$optSortKey = 0;
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
$customOption = array();
|
264 |
-
|
265 |
-
$customOption["
|
266 |
-
$customOption["
|
267 |
-
$customOption["
|
268 |
-
$customOption["sort_order"] = $values["sort_order"];
|
269 |
-
/**
|
270 |
-
* Add `required` bit. Used later to build SKU variations.
|
271 |
-
* If this store uses Mageworx_CustomOptions, act as if we are
|
272 |
-
* on a product page
|
273 |
-
*/
|
274 |
if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
|
275 |
$customOption['required'] = $option->getIsRequire(true);
|
276 |
} else {
|
277 |
$customOption['required'] = $option->getIsRequire();
|
278 |
}
|
279 |
-
// add custom option type to collection
|
280 |
$customOptions[$optTypeCount] = $customOption;
|
281 |
$optTypeCount++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
}
|
283 |
// maintain index to sort order relationship
|
284 |
$productSorting[$optCount] = $optSortOrder;
|
@@ -311,6 +333,7 @@ class Iparcel_All_Helper_Api
|
|
311 |
$options = array_filter($options);
|
312 |
$result = array(array());
|
313 |
$optionalProductOptions = array();
|
|
|
314 |
|
315 |
// Remove the optional product options
|
316 |
foreach ($options as $key => $option) {
|
@@ -334,8 +357,13 @@ class Iparcel_All_Helper_Api
|
|
334 |
$result = $append;
|
335 |
}
|
336 |
|
|
|
|
|
|
|
|
|
|
|
337 |
// Add a new product to the $result array for each variation of optional
|
338 |
-
// product options.
|
339 |
foreach ($result as $productConfiguration) {
|
340 |
foreach ($optionalProductOptions as $option) {
|
341 |
foreach ($option as $product) {
|
@@ -346,6 +374,16 @@ class Iparcel_All_Helper_Api
|
|
346 |
}
|
347 |
}
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
return $result;
|
350 |
}
|
351 |
|
259 |
$customOptions = array();
|
260 |
$optSortOrder = $option["sort_order"];
|
261 |
$optSortKey = 0;
|
262 |
+
/**
|
263 |
+
* If this option has no values (text field, text area, etc.) just
|
264 |
+
* build a sku for the option ID, otherwise, build out each value as
|
265 |
+
* well.
|
266 |
+
*/
|
267 |
+
if (count($option->getValues()) == 0) {
|
268 |
+
$productOption = $product->getOptions();
|
269 |
+
$productOption = $productOption[$option->getId()];
|
270 |
$customOption = array();
|
271 |
+
$customOption["sku"] = $option->getId();
|
272 |
+
$customOption["price"] = $option->getPrice();
|
273 |
+
$customOption["title"] = $productOption->getTitle();;
|
274 |
+
$customOption["sort_order"] = $option->getSortOrder();
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
|
276 |
$customOption['required'] = $option->getIsRequire(true);
|
277 |
} else {
|
278 |
$customOption['required'] = $option->getIsRequire();
|
279 |
}
|
|
|
280 |
$customOptions[$optTypeCount] = $customOption;
|
281 |
$optTypeCount++;
|
282 |
+
} else {
|
283 |
+
foreach ($option->getValues() as $values) {
|
284 |
+
$customOption = array();
|
285 |
+
// create the sku portion with custom option id and option type id.. 1_2 -> Size_Large
|
286 |
+
$customOption["sku"] = $values["option_id"] . "-" . $values["option_type_id"];
|
287 |
+
$customOption["price"] = $values["price"];
|
288 |
+
$customOption["title"] = $values["title"];
|
289 |
+
$customOption["sort_order"] = $values["sort_order"];
|
290 |
+
/**
|
291 |
+
* Add `required` bit. Used later to build SKU variations.
|
292 |
+
* If this store uses Mageworx_CustomOptions, act as if we are
|
293 |
+
* on a product page
|
294 |
+
*/
|
295 |
+
if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
|
296 |
+
$customOption['required'] = $option->getIsRequire(true);
|
297 |
+
} else {
|
298 |
+
$customOption['required'] = $option->getIsRequire();
|
299 |
+
}
|
300 |
+
// add custom option type to collection
|
301 |
+
$customOptions[$optTypeCount] = $customOption;
|
302 |
+
$optTypeCount++;
|
303 |
+
}
|
304 |
}
|
305 |
// maintain index to sort order relationship
|
306 |
$productSorting[$optCount] = $optSortOrder;
|
333 |
$options = array_filter($options);
|
334 |
$result = array(array());
|
335 |
$optionalProductOptions = array();
|
336 |
+
$requiredOptions = true;
|
337 |
|
338 |
// Remove the optional product options
|
339 |
foreach ($options as $key => $option) {
|
357 |
$result = $append;
|
358 |
}
|
359 |
|
360 |
+
// Check for any required options
|
361 |
+
if (count($result[0]) != 0 || count($result) == 1) {
|
362 |
+
$requiredOptions = false;
|
363 |
+
}
|
364 |
+
|
365 |
// Add a new product to the $result array for each variation of optional
|
366 |
+
// product options + the existing required options.
|
367 |
foreach ($result as $productConfiguration) {
|
368 |
foreach ($optionalProductOptions as $option) {
|
369 |
foreach ($option as $product) {
|
374 |
}
|
375 |
}
|
376 |
|
377 |
+
// If there were no required options, add all variations of optional
|
378 |
+
// product options
|
379 |
+
if ($requiredOptions == false && count($optionalProductOptions) > 1) {
|
380 |
+
$allOptionals = array();
|
381 |
+
foreach ($optionalProductOptions as $key => $option) {
|
382 |
+
$allOptionals[] = array_shift($option);
|
383 |
+
}
|
384 |
+
$result[] = $allOptionals;
|
385 |
+
}
|
386 |
+
|
387 |
return $result;
|
388 |
}
|
389 |
|
app/code/community/Iparcel/All/Model/Catalog/Product/Observer.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog_Product observer class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_GlobaleCommerce
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_All_Model_Catalog_Product_Observer
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if catalog upload on product save is enabled
|
13 |
+
*
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
protected function _isEnabled()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig('catalog_mapping/config/auto_upload') == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::ON_UPDATE;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* catalog_product_save_after event handler
|
23 |
+
*/
|
24 |
+
public function product_save($observer)
|
25 |
+
{
|
26 |
+
if ($this->_isEnabled()) {
|
27 |
+
$product = $observer->getProduct();
|
28 |
+
$productCollection = new Varien_Data_Collection();
|
29 |
+
$productCollection->addItem($product);
|
30 |
+
Mage::helper('iparcel/api')->submitCatalog($productCollection);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* catalog_product_attribute_update_before event handler
|
36 |
+
*/
|
37 |
+
public function product_massUpdate($observer)
|
38 |
+
{
|
39 |
+
if ($this->_isEnabled()) {
|
40 |
+
$productIds = $observer->getProductIds();
|
41 |
+
$attributesData = $observer->getAttributesData();
|
42 |
+
$productCollection = new Varien_Data_Collection();
|
43 |
+
foreach ($productIds as $id) {
|
44 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
45 |
+
foreach ($attributesData as $code => $value) {
|
46 |
+
$product->setData($code, $value);
|
47 |
+
}
|
48 |
+
$productCollection->addItem($product);
|
49 |
+
}
|
50 |
+
Mage::helper('iparcel/api')->submitCatalog($productCollection);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* catalog_product_delete_before event handler
|
56 |
+
*/
|
57 |
+
public function product_delete($observer)
|
58 |
+
{
|
59 |
+
if ($this->_isEnabled()) {
|
60 |
+
$product = $observer->getProduct();
|
61 |
+
$product->setIsDeleted(true);
|
62 |
+
$productCollection = new Varien_Data_Collection();
|
63 |
+
$productCollection->addItem($product);
|
64 |
+
Mage::helper('iparcel/api')->submitCatalog($productCollection);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Iparcel/All/Model/Cron.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Model for managing Cron jobs
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_All
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_All_Model_Cron
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Performs Catalog Mapping via cronjobs
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
public function catalogMapping()
|
16 |
+
{
|
17 |
+
// Only run the cronjob if auto_upload is set to CRON
|
18 |
+
$cronSettingValue = Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::CRON;
|
19 |
+
if (Mage::getStoreConfig('catalog_mapping/config/auto_upload') == $cronSettingValue) {
|
20 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
21 |
+
Mage::helper('iparcel/api')->submitCatalog($productCollection);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Iparcel/All/Model/System/Config/Catalog/Mapping.php
CHANGED
@@ -26,22 +26,23 @@ class Iparcel_All_Model_System_Config_Catalog_Mapping extends Mage_Core_Model_Co
|
|
26 |
*/
|
27 |
protected function _afterSave()
|
28 |
{
|
29 |
-
if ($this->getValue() ==
|
30 |
$params = Mage::app()->getRequest()->getParams();
|
31 |
$params = $params["groups"]["config"]["fields"];
|
32 |
/* var $params array */
|
33 |
|
34 |
$freq = $params['cron_frequency']['value'];
|
35 |
$cron_expr = array();
|
|
|
36 |
$cron_expr[3] = '*';
|
|
|
37 |
switch ($freq) {
|
38 |
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
|
39 |
$cron_expr[2] = $params['cron_monthday']['value'];
|
40 |
-
$cron_expr[4] = '*';
|
41 |
break;
|
42 |
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
|
43 |
$cron_expr[4] = $params['cron_weekday']['value'];
|
44 |
-
|
45 |
}
|
46 |
$cron_expr[0] = $params['cron_minute']['value'];
|
47 |
$cron_expr[1] = $params['cron_hour']['value'];
|
26 |
*/
|
27 |
protected function _afterSave()
|
28 |
{
|
29 |
+
if ($this->getValue() == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::CRON) {
|
30 |
$params = Mage::app()->getRequest()->getParams();
|
31 |
$params = $params["groups"]["config"]["fields"];
|
32 |
/* var $params array */
|
33 |
|
34 |
$freq = $params['cron_frequency']['value'];
|
35 |
$cron_expr = array();
|
36 |
+
$cron_expr[2] = '*';
|
37 |
$cron_expr[3] = '*';
|
38 |
+
$cron_expr[4] = '*';
|
39 |
switch ($freq) {
|
40 |
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
|
41 |
$cron_expr[2] = $params['cron_monthday']['value'];
|
|
|
42 |
break;
|
43 |
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
|
44 |
$cron_expr[4] = $params['cron_weekday']['value'];
|
45 |
+
break;
|
46 |
}
|
47 |
$cron_expr[0] = $params['cron_minute']['value'];
|
48 |
$cron_expr[1] = $params['cron_hour']['value'];
|
app/code/community/Iparcel/All/Model/System/Config/Data/Date/Monthday.php
CHANGED
@@ -14,7 +14,7 @@ class Iparcel_All_Model_System_Config_Data_Date_Monthday extends Mage_Core_Model
|
|
14 |
public function save()
|
15 |
{
|
16 |
$_monthday = $this->getValue();
|
17 |
-
if (
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong day of month'));
|
14 |
public function save()
|
15 |
{
|
16 |
$_monthday = $this->getValue();
|
17 |
+
if (is_numeric($_monthday) && $_monthday<=31 && $_monthday>0) {
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong day of month'));
|
app/code/community/Iparcel/All/Model/System/Config/Data/Date/Weekday.php
CHANGED
@@ -14,7 +14,7 @@ class Iparcel_All_Model_System_Config_Data_Date_Weekday extends Mage_Core_Model_
|
|
14 |
public function save()
|
15 |
{
|
16 |
$_weekday = $this->getValue();
|
17 |
-
if (
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong day of week'));
|
14 |
public function save()
|
15 |
{
|
16 |
$_weekday = $this->getValue();
|
17 |
+
if (is_numeric($_weekday) && $_weekday<=7 && $_weekday>0) {
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong day of week'));
|
app/code/community/Iparcel/All/Model/System/Config/Data/Time/Hour.php
CHANGED
@@ -14,7 +14,7 @@ class Iparcel_All_Model_System_Config_Data_Time_Hour extends Mage_Core_Model_Con
|
|
14 |
public function save()
|
15 |
{
|
16 |
$_hour = $this->getValue();
|
17 |
-
if (
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong hour'));
|
14 |
public function save()
|
15 |
{
|
16 |
$_hour = $this->getValue();
|
17 |
+
if (is_numeric($_hour) && $_hour<24 && $_hour>=0) {
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong hour'));
|
app/code/community/Iparcel/All/Model/System/Config/Data/Time/Minute.php
CHANGED
@@ -14,7 +14,7 @@ class Iparcel_All_Model_System_Config_Data_Time_Minute extends Mage_Core_Model_C
|
|
14 |
public function save()
|
15 |
{
|
16 |
$_minute = $this->getValue();
|
17 |
-
if (
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong minute'));
|
14 |
public function save()
|
15 |
{
|
16 |
$_minute = $this->getValue();
|
17 |
+
if (is_numeric($_minute) && $_minute<60 && $_minute>=0) {
|
18 |
return parent::save();
|
19 |
} else {
|
20 |
Mage::throwException(Mage::helper('iparcel')->__('Wrong minute'));
|
app/code/community/Iparcel/All/controllers/InfoController.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Controller to display extension information
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_All
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_All_InfoController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Format and display extension information
|
13 |
+
*/
|
14 |
+
public function indexAction()
|
15 |
+
{
|
16 |
+
$versions = $this->_gatherExtensionVersions();
|
17 |
+
|
18 |
+
foreach ($versions as $key => $version) {
|
19 |
+
print "<b>$key</b>: $version<br />";
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Gathers extension versions for any installed i-parcel extensions
|
25 |
+
*
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
private function _gatherExtensionVersions()
|
29 |
+
{
|
30 |
+
$extensions = array(
|
31 |
+
'Iparcel_All' => 0,
|
32 |
+
'Iparcel_GlobaleCommerce' => 0,
|
33 |
+
'Iparcel_Logistics' => 0
|
34 |
+
);
|
35 |
+
|
36 |
+
$allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
|
37 |
+
|
38 |
+
foreach ($extensions as $key => &$version) {
|
39 |
+
if (array_key_exists($key, $allExtensions)) {
|
40 |
+
$version = $allExtensions[$key]['version'];
|
41 |
+
} else {
|
42 |
+
unset($extensions[$key]);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
return $extensions;
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Iparcel/All/etc/config.xml
CHANGED
@@ -2,9 +2,30 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_All>
|
5 |
-
<version>0.0
|
6 |
</Iparcel_All>
|
7 |
</modules>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<global>
|
9 |
<models>
|
10 |
<iparcel>
|
@@ -21,6 +42,35 @@
|
|
21 |
<class>Iparcel_All_Helper</class>
|
22 |
</iparcel>
|
23 |
</helpers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</global>
|
25 |
<adminhtml>
|
26 |
<layout>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_All>
|
5 |
+
<version>1.0.0</version>
|
6 |
</Iparcel_All>
|
7 |
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<iparcel>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Iparcel_All</module>
|
14 |
+
<frontName>iparcel</frontName>
|
15 |
+
</args>
|
16 |
+
</iparcel>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
<crontab>
|
20 |
+
<jobs>
|
21 |
+
<iparcel_catalog_mapping>
|
22 |
+
<schedule><cron_expr>0 0 1 1 *</cron_expr></schedule>
|
23 |
+
<run>
|
24 |
+
<model>iparcel/cron::catalogMapping</model>
|
25 |
+
</run>
|
26 |
+
</iparcel_catalog_mapping>
|
27 |
+
</jobs>
|
28 |
+
</crontab>
|
29 |
<global>
|
30 |
<models>
|
31 |
<iparcel>
|
42 |
<class>Iparcel_All_Helper</class>
|
43 |
</iparcel>
|
44 |
</helpers>
|
45 |
+
<events>
|
46 |
+
<catalog_product_save_after>
|
47 |
+
<observers>
|
48 |
+
<iparcel_catalog_product_observer>
|
49 |
+
<type>singleton</type>
|
50 |
+
<class>Iparcel_All_Model_Catalog_Product_Observer</class>
|
51 |
+
<method>product_save</method>
|
52 |
+
</iparcel_catalog_product_observer>
|
53 |
+
</observers>
|
54 |
+
</catalog_product_save_after>
|
55 |
+
<catalog_product_attribute_update_before>
|
56 |
+
<observers>
|
57 |
+
<iparcel_catalog_product_observer>
|
58 |
+
<type>singleton</type>
|
59 |
+
<class>Iparcel_All_Model_Catalog_Product_Observer</class>
|
60 |
+
<method>product_massUpdate</method>
|
61 |
+
</iparcel_catalog_product_observer>
|
62 |
+
</observers>
|
63 |
+
</catalog_product_attribute_update_before>
|
64 |
+
<catalog_product_delete_before>
|
65 |
+
<observers>
|
66 |
+
<iparcel_catalog_product_observer>
|
67 |
+
<type>singleton</type>
|
68 |
+
<class>Iparcel_All_Model_Catalog_Product_Observer</class>
|
69 |
+
<method>product_delete</method>
|
70 |
+
</iparcel_catalog_product_observer>
|
71 |
+
</observers>
|
72 |
+
</catalog_product_delete_before>
|
73 |
+
</events>
|
74 |
</global>
|
75 |
<adminhtml>
|
76 |
<layout>
|
app/code/community/Iparcel/All/etc/system.xml
CHANGED
@@ -43,6 +43,15 @@
|
|
43 |
<show_in_store>0</show_in_store>
|
44 |
<tooltip>This is Web Service Key provided by i-parcel.</tooltip>
|
45 |
</userid>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
</fields>
|
47 |
</config>
|
48 |
</groups>
|
43 |
<show_in_store>0</show_in_store>
|
44 |
<tooltip>This is Web Service Key provided by i-parcel.</tooltip>
|
45 |
</userid>
|
46 |
+
<dashboard>
|
47 |
+
<label>Dashboard</label>
|
48 |
+
<frontend_type>button</frontend_type>
|
49 |
+
<frontend_model>iparcel/adminhtml_iparcel_dashboard</frontend_model>
|
50 |
+
<sort_order>115</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</dashboard>
|
55 |
</fields>
|
56 |
</config>
|
57 |
</groups>
|
app/code/community/Iparcel/Logistics/Helper/Api.php
CHANGED
@@ -144,7 +144,6 @@ class Iparcel_Logistics_Helper_Api extends Iparcel_All_Helper_Api
|
|
144 |
$json['OtherDiscount'] = $discount;
|
145 |
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
146 |
$json['ParcelID'] = 0;
|
147 |
-
$json['ServiceLevel'] = 115;
|
148 |
$json['SessionID'] = '';
|
149 |
$json['key'] = Mage::helper('iplogistics')->getGuid();
|
150 |
|
@@ -280,7 +279,7 @@ class Iparcel_Logistics_Helper_Api extends Iparcel_All_Helper_Api
|
|
280 |
$json['ItemDetailsList'] = $itemsList;
|
281 |
|
282 |
// if order_reference is set add it to request
|
283 |
-
if (Mage::getStoreConfig('carriers/
|
284 |
$json['OrderReference'] = $order->getIncrementId();
|
285 |
}
|
286 |
|
144 |
$json['OtherDiscount'] = $discount;
|
145 |
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
146 |
$json['ParcelID'] = 0;
|
|
|
147 |
$json['SessionID'] = '';
|
148 |
$json['key'] = Mage::helper('iplogistics')->getGuid();
|
149 |
|
279 |
$json['ItemDetailsList'] = $itemsList;
|
280 |
|
281 |
// if order_reference is set add it to request
|
282 |
+
if (Mage::getStoreConfig('carriers/iplogistics/order_reference')) {
|
283 |
$json['OrderReference'] = $order->getIncrementId();
|
284 |
}
|
285 |
|
app/code/community/Iparcel/Logistics/Helper/Data.php
CHANGED
@@ -39,7 +39,7 @@ class Iparcel_Logistics_Helper_Data extends Iparcel_All_Helper_Data
|
|
39 |
*/
|
40 |
public function getServiceLevels()
|
41 |
{
|
42 |
-
$serviceLevels = unserialize(Mage::getStoreConfig('carriers/
|
43 |
$formatted = array();
|
44 |
foreach ($serviceLevels as $level) {
|
45 |
$formatted[$level['service_id']] = $level['title'];
|
@@ -56,8 +56,8 @@ class Iparcel_Logistics_Helper_Data extends Iparcel_All_Helper_Data
|
|
56 |
private function _getOriginCountry()
|
57 |
{
|
58 |
// If the admin has chose to select a different "origin" country
|
59 |
-
if (Mage::getStoreConfig('carriers/
|
60 |
-
return Mage::getStoreConfig('carriers/
|
61 |
}
|
62 |
|
63 |
return Mage::getStoreConfig('shipping/origin/country_id');
|
39 |
*/
|
40 |
public function getServiceLevels()
|
41 |
{
|
42 |
+
$serviceLevels = unserialize(Mage::getStoreConfig('carriers/iplogistics/name'));
|
43 |
$formatted = array();
|
44 |
foreach ($serviceLevels as $level) {
|
45 |
$formatted[$level['service_id']] = $level['title'];
|
56 |
private function _getOriginCountry()
|
57 |
{
|
58 |
// If the admin has chose to select a different "origin" country
|
59 |
+
if (Mage::getStoreConfig('carriers/iplogistics/choose_domestic')) {
|
60 |
+
return Mage::getStoreConfig('carriers/iplogistics/origin_country_id');
|
61 |
}
|
62 |
|
63 |
return Mage::getStoreConfig('shipping/origin/country_id');
|
app/code/community/Iparcel/Logistics/Model/Carrier/Iparcel.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
*/
|
9 |
class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
10 |
{
|
11 |
-
protected $_code = '
|
12 |
-
|
13 |
protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
|
14 |
|
15 |
/**
|
@@ -42,7 +42,7 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
42 |
{
|
43 |
return new Varien_Object(array(
|
44 |
'tracking' => $number,
|
45 |
-
'carrier_title' => $this->
|
46 |
'url' => $this->_trackingUrl.$number
|
47 |
));
|
48 |
}
|
@@ -112,71 +112,72 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
112 |
/** @var boolean $internationalOrder */
|
113 |
$internationalOrder = Mage::helper('iplogistics')->getIsInternational($request);
|
114 |
|
115 |
-
if ($internationalOrder && Mage::getStoreConfig('carriers/
|
116 |
/** @var array $iparcel Tax & Duty totals */
|
117 |
$iparcelTaxAndDuty = array();
|
118 |
/** @var Mage_Shipping_Model_Rate_Result $result*/
|
119 |
$result = Mage::getModel('shipping/rate_result');
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
180 |
|
181 |
Mage::unregister('iparcel_duty_and_taxes');
|
182 |
Mage::register('iparcel_duty_and_taxes', $iparcelTaxAndDuty);
|
@@ -191,7 +192,7 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
191 |
public function getMethodsNames()
|
192 |
{
|
193 |
$names = array();
|
194 |
-
$raw =
|
195 |
|
196 |
$raw = unserialize($raw);
|
197 |
|
@@ -219,10 +220,7 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
219 |
* @return array
|
220 |
*/
|
221 |
public function getAllowedMethods()
|
222 |
-
{
|
223 |
-
return
|
224 |
-
'i-parcel' => $this->_carrier,
|
225 |
-
'auto' => 'Auto'
|
226 |
-
);
|
227 |
}
|
228 |
}
|
8 |
*/
|
9 |
class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
10 |
{
|
11 |
+
protected $_code = 'iplogistics';
|
12 |
+
|
13 |
protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
|
14 |
|
15 |
/**
|
42 |
{
|
43 |
return new Varien_Object(array(
|
44 |
'tracking' => $number,
|
45 |
+
'carrier_title' => $this->getConfigData('title'),
|
46 |
'url' => $this->_trackingUrl.$number
|
47 |
));
|
48 |
}
|
112 |
/** @var boolean $internationalOrder */
|
113 |
$internationalOrder = Mage::helper('iplogistics')->getIsInternational($request);
|
114 |
|
115 |
+
if ($internationalOrder && Mage::getStoreConfig('carriers/iplogistics/active')) {
|
116 |
/** @var array $iparcel Tax & Duty totals */
|
117 |
$iparcelTaxAndDuty = array();
|
118 |
/** @var Mage_Shipping_Model_Rate_Result $result*/
|
119 |
$result = Mage::getModel('shipping/rate_result');
|
120 |
+
|
121 |
+
// Get Allowed Methods
|
122 |
+
/** @var array $allowed_methods Shipping method allowed via admin config "names" */
|
123 |
+
$allowed_methods = $this->getAllowedMethods();
|
124 |
+
|
125 |
+
/** @var stdClass $quote */
|
126 |
+
$quote = Mage::helper('iplogistics/api')->quote($request);
|
127 |
+
$iparcelTaxAndDuty['parcel_id'] = $quote->ParcelID;
|
128 |
+
|
129 |
+
$serviceLevel = new stdClass;
|
130 |
+
if (isset($quote->ServiceLevels)) {
|
131 |
+
$serviceLevel = $quote->ServiceLevels;
|
132 |
+
}
|
133 |
+
|
134 |
+
// Handling serviceLevels results and set up the shipping method
|
135 |
+
foreach ($serviceLevel as $ci) {
|
136 |
+
// setting up values
|
137 |
+
$servicename = @$ci->ServiceLevelID;
|
138 |
+
|
139 |
+
$duty = (float)@$ci->DutyCompanyCurrency;
|
140 |
+
$tax = (float)@$ci->TaxCompanyCurrency;
|
141 |
+
$shipping = (float)@$ci->ShippingChargeCompanyCurrency;
|
142 |
+
|
143 |
+
$tax_flag = Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Logistics_Model_System_Config_Source_Tax_Mode::DISABLED
|
144 |
+
|| $request->getDestCountryId() == $request->getCountryId();
|
145 |
+
// true if tax intercepting is disabled
|
146 |
+
|
147 |
+
$total = $tax_flag ? (float)($duty + $tax + $shipping) : (float)$shipping;
|
148 |
+
if (!isset($allowed_methods[$servicename])) {
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
|
152 |
+
$shiplabel = $allowed_methods[$servicename];
|
153 |
+
|
154 |
+
$title = $shiplabel;
|
155 |
+
if ($tax_flag) {
|
156 |
+
$title = Mage::helper('iplogistics')->__(
|
157 |
+
'%s (Shipping Price: %s Duty: %s Tax: %s)',
|
158 |
+
$shiplabel,
|
159 |
+
$this->_formatPrice($shipping),
|
160 |
+
$this->_formatPrice($duty),
|
161 |
+
$this->_formatPrice($tax)
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
166 |
+
$method->setCarrier($this->_code);
|
167 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
168 |
+
$method->setMethod($servicename);
|
169 |
+
$method->setMethodTitle($title);
|
170 |
+
$method->setPrice($total);
|
171 |
+
$method->setCost($total);
|
172 |
+
|
173 |
+
// append method to result
|
174 |
+
$result->append($method);
|
175 |
+
|
176 |
+
$iparcelTaxAndDuty['service_levels'][$this->_code . '_' . $servicename] = array(
|
177 |
+
'duty' => $duty,
|
178 |
+
'tax' => $tax
|
179 |
+
);
|
180 |
+
}
|
181 |
|
182 |
Mage::unregister('iparcel_duty_and_taxes');
|
183 |
Mage::register('iparcel_duty_and_taxes', $iparcelTaxAndDuty);
|
192 |
public function getMethodsNames()
|
193 |
{
|
194 |
$names = array();
|
195 |
+
$raw = $this->getConfigData('name');
|
196 |
|
197 |
$raw = unserialize($raw);
|
198 |
|
220 |
* @return array
|
221 |
*/
|
222 |
public function getAllowedMethods()
|
223 |
+
{
|
224 |
+
return $this->getMethodsNames();
|
|
|
|
|
|
|
225 |
}
|
226 |
}
|
app/code/community/Iparcel/Logistics/Model/Observer.php
CHANGED
@@ -15,42 +15,45 @@ class Iparcel_Logistics_Model_Observer
|
|
15 |
*/
|
16 |
public function shipment_save_after($observer)
|
17 |
{
|
18 |
-
//
|
19 |
-
if (Mage::
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
// number attached
|
25 |
-
$shipment = $observer->getShipment();
|
26 |
-
$shipmentTracks = Mage::getModel('sales/order_shipment_api')->info(
|
27 |
-
$shipment->getIncrementId()
|
28 |
-
);
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
$api = Mage::helper('iplogistics/api');
|
37 |
-
$response = $api->submitParcel($shipment);
|
38 |
-
|
39 |
-
// Find the name of the Service Level as defined in the Admin
|
40 |
-
$serviceLevels = Mage::helper('iplogistics')->getServiceLevels();
|
41 |
-
$responseServiceLevelId = $response->ServiceLevels[0][0]->ServiceLevelID;
|
42 |
-
$serviceLevelTitle = 'I-Parcel';
|
43 |
-
if (array_key_exists($responseServiceLevelId, $serviceLevels)) {
|
44 |
-
$serviceLevelTitle = $serviceLevels[$responseServiceLevelId];
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
$
|
50 |
-
$
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
|
@@ -68,12 +71,12 @@ class Iparcel_Logistics_Model_Observer
|
|
68 |
return;
|
69 |
}
|
70 |
// if it's i-parcel shipping method
|
71 |
-
if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != '
|
72 |
return;
|
73 |
}
|
74 |
|
75 |
// if autoship is enabled and order can be shipped
|
76 |
-
if (Mage::getStoreConfigFlag('carriers/
|
77 |
if ($order->canShip()) {
|
78 |
$converter = Mage::getModel('sales/convert_order');
|
79 |
/* var $converter Mage_Sales_Model_Convert_Order */
|
@@ -158,4 +161,30 @@ class Iparcel_Logistics_Model_Observer
|
|
158 |
|
159 |
return true;
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
15 |
*/
|
16 |
public function shipment_save_after($observer)
|
17 |
{
|
18 |
+
// if autotrack is enabled then order can be tracked when shipped
|
19 |
+
if (Mage::getStoreConfigFlag('carriers/iplogistics/autotrack')) {
|
20 |
+
// If we are splitting shipments, skip automatic submission.
|
21 |
+
if (Mage::registry('iparcel_skip_auto_submit')) {
|
22 |
+
return true;
|
23 |
+
}
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
// Check the shipment to make sure we don't already have a tracking
|
26 |
+
// number attached
|
27 |
+
$shipment = $observer->getShipment();
|
28 |
+
$shipmentTracks = Mage::getModel('sales/order_shipment_api')->info(
|
29 |
+
$shipment->getIncrementId()
|
30 |
+
);
|
31 |
|
32 |
+
if (count($shipmentTracks['tracks'])) {
|
33 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
+
$order = $observer->getShipment()->getOrder();
|
37 |
+
if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() == 'iplogistics') {
|
38 |
+
$api = Mage::helper('iplogistics/api');
|
39 |
+
$response = $api->submitParcel($shipment);
|
40 |
+
|
41 |
+
// Find the name of the Service Level as defined in the Admin
|
42 |
+
$serviceLevels = Mage::helper('iplogistics')->getServiceLevels();
|
43 |
+
$responseServiceLevelId = $response->ServiceLevels[0][0]->ServiceLevelID;
|
44 |
+
$serviceLevelTitle = 'I-Parcel';
|
45 |
+
if (array_key_exists($responseServiceLevelId, $serviceLevels)) {
|
46 |
+
$serviceLevelTitle = $serviceLevels[$responseServiceLevelId];
|
47 |
+
}
|
48 |
+
|
49 |
+
// Add tracking number from submitParcel response
|
50 |
+
Mage::getModel('sales/order_shipment_api')->addTrack(
|
51 |
+
$shipment->getIncrementId(),
|
52 |
+
$order->getShippingCarrier()->getCarrierCode(),
|
53 |
+
$serviceLevelTitle,
|
54 |
+
$response->CarrierTrackingNumber
|
55 |
+
);
|
56 |
+
}
|
57 |
}
|
58 |
}
|
59 |
|
71 |
return;
|
72 |
}
|
73 |
// if it's i-parcel shipping method
|
74 |
+
if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != 'iplogistics') {
|
75 |
return;
|
76 |
}
|
77 |
|
78 |
// if autoship is enabled and order can be shipped
|
79 |
+
if (Mage::getStoreConfigFlag('carriers/iplogistics/autoship')) {
|
80 |
if ($order->canShip()) {
|
81 |
$converter = Mage::getModel('sales/convert_order');
|
82 |
/* var $converter Mage_Sales_Model_Convert_Order */
|
161 |
|
162 |
return true;
|
163 |
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Adds the "tax" and "duty" line item to PayPal API requests
|
167 |
+
*
|
168 |
+
* @param Varien_Event_Observer $observer
|
169 |
+
*/
|
170 |
+
public function paypal_prepare_line_items(Varien_Event_Observer $observer)
|
171 |
+
{
|
172 |
+
$cart = $observer->getEvent()->getPaypalCart();
|
173 |
+
$carrierCode = $cart->getSalesEntity()->getShippingCarrier()->getCarrierCode();
|
174 |
+
if ($carrierCode == 'i-parcel') {
|
175 |
+
$iparcelTax = $cart->getSalesEntity()->getIparcelTaxAmount();
|
176 |
+
$iparcelDuty = $cart->getSalesEntity()->getIparcelDutyAmount();
|
177 |
+
|
178 |
+
if ($iparcelTax > 0) {
|
179 |
+
$cart->addItem('Tax', 1, $iparcelTax, 'tax');
|
180 |
+
}
|
181 |
+
|
182 |
+
if ($iparcelDuty > 0) {
|
183 |
+
$cart->addItem('Duty', 1, $iparcelDuty, 'duty');
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
return true;
|
189 |
+
}
|
190 |
}
|
app/code/community/Iparcel/Logistics/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_Logistics>
|
5 |
-
<version>1.0.
|
6 |
</Iparcel_Logistics>
|
7 |
</modules>
|
8 |
<global>
|
@@ -90,6 +90,15 @@
|
|
90 |
</iplogistics>
|
91 |
</observers>
|
92 |
</core_block_abstract_to_html_before>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</events>
|
94 |
<sales>
|
95 |
<quote>
|
@@ -173,7 +182,7 @@
|
|
173 |
</admin>
|
174 |
<default>
|
175 |
<carriers>
|
176 |
-
<
|
177 |
<active>1</active>
|
178 |
<model>iplogistics/carrier_iparcel</model>
|
179 |
<title>I-Parcel</title>
|
@@ -182,10 +191,11 @@
|
|
182 |
<username>custtest</username>
|
183 |
<password>custtest</password>
|
184 |
<autoship>1</autoship>
|
|
|
185 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
186 |
<whitelabelpay>i-parcel</whitelabelpay>
|
187 |
<whitelabelship>i-parcel</whitelabelship>
|
188 |
-
</
|
189 |
</carriers>
|
190 |
</default>
|
191 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_Logistics>
|
5 |
+
<version>1.0.6</version>
|
6 |
</Iparcel_Logistics>
|
7 |
</modules>
|
8 |
<global>
|
90 |
</iplogistics>
|
91 |
</observers>
|
92 |
</core_block_abstract_to_html_before>
|
93 |
+
<paypal_prepare_line_items>
|
94 |
+
<observers>
|
95 |
+
<iplogistics>
|
96 |
+
<type>singleton</type>
|
97 |
+
<class>iplogistics/observer</class>
|
98 |
+
<method>paypal_prepare_line_items</method>
|
99 |
+
</iplogistics>
|
100 |
+
</observers>
|
101 |
+
</paypal_prepare_line_items>
|
102 |
</events>
|
103 |
<sales>
|
104 |
<quote>
|
182 |
</admin>
|
183 |
<default>
|
184 |
<carriers>
|
185 |
+
<iplogistics>
|
186 |
<active>1</active>
|
187 |
<model>iplogistics/carrier_iparcel</model>
|
188 |
<title>I-Parcel</title>
|
191 |
<username>custtest</username>
|
192 |
<password>custtest</password>
|
193 |
<autoship>1</autoship>
|
194 |
+
<autotrack>1</autotrack>
|
195 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
196 |
<whitelabelpay>i-parcel</whitelabelpay>
|
197 |
<whitelabelship>i-parcel</whitelabelship>
|
198 |
+
</iplogistics>
|
199 |
</carriers>
|
200 |
</default>
|
201 |
</config>
|
app/code/community/Iparcel/Logistics/etc/system.xml
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<tabs>
|
4 |
-
<
|
5 |
<label>i-parcel</label>
|
6 |
<sort_order>500</sort_order>
|
7 |
-
</
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<carriers>
|
11 |
<groups>
|
12 |
-
<
|
13 |
<label>i-parcel</label>
|
14 |
<frontend_type>text</frontend_type>
|
15 |
<sort_order>99</sort_order>
|
@@ -35,7 +35,7 @@
|
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</title>
|
37 |
<name>
|
38 |
-
<label>
|
39 |
<frontend_model>iplogistics/adminhtml_system_config_form_field_method</frontend_model>
|
40 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
41 |
<sort_order>102</sort_order>
|
@@ -80,6 +80,16 @@
|
|
80 |
<show_in_website>1</show_in_website>
|
81 |
<show_in_store>1</show_in_store>
|
82 |
</autoship>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
<prefix>
|
84 |
<label>Completed Orders Use Different Order Prefix (Blank for None)</label>
|
85 |
<frontend_type>text</frontend_type>
|
@@ -118,7 +128,7 @@
|
|
118 |
<can_be_empty>1</can_be_empty>
|
119 |
</specificcountry>
|
120 |
</fields>
|
121 |
-
</
|
122 |
</groups>
|
123 |
</carriers>
|
124 |
<iparcel>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<tabs>
|
4 |
+
<iplogistics translate="label" module="iplogistics">
|
5 |
<label>i-parcel</label>
|
6 |
<sort_order>500</sort_order>
|
7 |
+
</iplogistics>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<carriers>
|
11 |
<groups>
|
12 |
+
<iplogistics translate="label">
|
13 |
<label>i-parcel</label>
|
14 |
<frontend_type>text</frontend_type>
|
15 |
<sort_order>99</sort_order>
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</title>
|
37 |
<name>
|
38 |
+
<label>Allowed Services</label>
|
39 |
<frontend_model>iplogistics/adminhtml_system_config_form_field_method</frontend_model>
|
40 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
41 |
<sort_order>102</sort_order>
|
80 |
<show_in_website>1</show_in_website>
|
81 |
<show_in_store>1</show_in_store>
|
82 |
</autoship>
|
83 |
+
<autotrack>
|
84 |
+
<label>Auto Generate Tracking on Shipping</label>
|
85 |
+
<frontend_type>select</frontend_type>
|
86 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
87 |
+
<tooltip>Set to No if you submit parcel tracking via API and use fulfilment system to create shipment</tooltip>
|
88 |
+
<sort_order>165</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</autotrack>
|
93 |
<prefix>
|
94 |
<label>Completed Orders Use Different Order Prefix (Blank for None)</label>
|
95 |
<frontend_type>text</frontend_type>
|
128 |
<can_be_empty>1</can_be_empty>
|
129 |
</specificcountry>
|
130 |
</fields>
|
131 |
+
</iplogistics>
|
132 |
</groups>
|
133 |
</carriers>
|
134 |
<iparcel>
|
app/code/community/Iparcel/Logistics/sql/iplogistics_setup/{mysql4-upgrade-1.0.2-1.0.3.php → mysql4-upgrade-1.0.5-1.0.6.php}
RENAMED
@@ -44,7 +44,7 @@ $data = array(
|
|
44 |
Mage::getModel('core/config_data')
|
45 |
->setScope('default')
|
46 |
->setScopeId(0)
|
47 |
-
->setPath('carriers/
|
48 |
->setValue(serialize($data))
|
49 |
->save();
|
50 |
|
44 |
Mage::getModel('core/config_data')
|
45 |
->setScope('default')
|
46 |
->setScopeId(0)
|
47 |
+
->setPath('carriers/iplogistics/name')
|
48 |
->setValue(serialize($data))
|
49 |
->save();
|
50 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_logistics</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
@@ -16,9 +16,9 @@
|
|
16 |
<email>bburden@i-parcel.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
-
<date>
|
20 |
-
<time>
|
21 |
-
<contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="2f375c30334e2d4a6bae03ccab808dd3"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Logistics"><file name=".DS_Store" hash="43572f0bc4d22c23da3b68bbfd7983d5"/><dir name="Block"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="99e8ca49bb180c05bf05e44e41f880f7"/></dir><file name="Split.php" hash="848f88a16a03e5d58453e03e454a9a78"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="09224de41e6bdb1fa951c631128fa2b9"/></dir></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="e947a0fdfc0fdb3ce7fa7babb89937a2"/><file name="Duty.php" hash="afb0726fe989e1acc65aee33a7b627f6"/><file name="Tax.php" hash="6fe811b4600365d25bf9a51e4d953e0c"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><file name="SplitController.php" hash="69ab4c55cc6436dc0fb2f6a722805c01"/></dir><file name="ShipmentController.php" hash="ebcac746bc97c046e71b0910e96174d9"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8b8a4a0643ce23b42709f3b82e46e830"/><file name="config.xml" hash="
|
22 |
<compatible/>
|
23 |
<dependencies>
|
24 |
<required>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_logistics</name>
|
4 |
+
<version>1.0.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
16 |
<email>bburden@i-parcel.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
+
<date>2016-01-08</date>
|
20 |
+
<time>20:53:20</time>
|
21 |
+
<contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="2f375c30334e2d4a6bae03ccab808dd3"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Logistics"><file name=".DS_Store" hash="43572f0bc4d22c23da3b68bbfd7983d5"/><dir name="Block"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="99e8ca49bb180c05bf05e44e41f880f7"/></dir><file name="Split.php" hash="848f88a16a03e5d58453e03e454a9a78"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="09224de41e6bdb1fa951c631128fa2b9"/></dir></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="e947a0fdfc0fdb3ce7fa7babb89937a2"/><file name="Duty.php" hash="afb0726fe989e1acc65aee33a7b627f6"/><file name="Tax.php" hash="6fe811b4600365d25bf9a51e4d953e0c"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><file name="SplitController.php" hash="69ab4c55cc6436dc0fb2f6a722805c01"/></dir><file name="ShipmentController.php" hash="ebcac746bc97c046e71b0910e96174d9"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8b8a4a0643ce23b42709f3b82e46e830"/><file name="config.xml" hash="1f55e8ae074f030020c646714d0bc18e"/><file name="system.xml" hash="f76253c6d1ac4fe57bd8808e7e12b16b"/></dir><dir name="Helper"><file name="Api.php" hash="8b9342e61fdb35afecc61fc8bd5ea16f"/><file name="Data.php" hash="e5c84fd4b138e87026f186db9cb959aa"/></dir><dir name="Model"><dir name="Api"><file name="Quote.php" hash="dd94fe794f8bff3c122e721ae28e2f5b"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="8df8fa818ef9f6cd06557107ba221432"/></dir><file name="Observer.php" hash="4048c8573a91462b24a5d759e0498458"/><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Duty.php" hash="d0fcc186046a33801ac5e77dc25a3152"/><file name="Tax.php" hash="2df3ee20703bcd793a2f214b7c30a057"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Duty.php" hash="8dbca3de53bdf5159cc21a889c0b84bc"/><file name="Tax.php" hash="d1b26d33237835d922c343e94cbefdae"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Abstract.php" hash="c8bd35b5d8cd34827e1de43e7ff2529d"/><file name="Collector.php" hash="11eb9174e5feea80a4b3c693dbc4edee"/><file name="Duty.php" hash="1997a432a12e19fcb90cd87fb673f8b7"/><file name="Tax.php" hash="41730f0644ba29cbc5731b1054697da6"/></dir></dir></dir><dir name="Resource"><dir name="Api"><file name="Quote.php" hash="d2120075a3a82084cbea35657e1f2dca"/></dir><dir name="Mysql4"><file name="Setup.php" hash="3eee28f86610e6cf1b83ee58b83d5e83"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Tax"><file name="Mode.php" hash="e8e734bcc2128ef9cdbb8381d7969c68"/></dir></dir></dir></dir><dir name="Tax"><dir name="Quote"><file name="Shipping.php" hash="06426983a284970284adbdf0221abeed"/><file name="Subtotal.php" hash="81b55a134b1cc6a45c920f40605a1fcb"/><file name="Tax.php" hash="ff7cd4a769646ed25aaab7c2cdc23775"/></dir></dir></dir><dir name="sql"><dir name="iplogistics_setup"><file name="mysql4-install-1.0.0.php" hash="69d5c2429cf5ee2d11e598f2137e7dc8"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="5f5645be5c8cd64394d8692e7fa847f9"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="a298c97b931d6dcf9cb6a70eb716b354"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9c0ccf88b7be483f52beb6a72156da63"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="97e22b1de739c3ee752c154b155f7987"/></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="dfdaf5a2fbf824a10fccc952fdccf567"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="ec9dddd10368136f1bdfe79fddd4500c"/><file name="Logs.php" hash="be8765472a9d2adc54473fe1df677921"/><dir name="Logs"><file name="Grid.php" hash="d78e239ba695619627c114cb52d38646"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="b30163b1c1b06b76c778b815cb0485d9"/><file name="SyncController.php" hash="9378f5db27d059bbb36ff1e71bd38d32"/><dir name="Sync"><file name="AjaxController.php" hash="671afecdeaed8f4c80a85d78605cd6da"/></dir></dir></dir><file name="InfoController.php" hash="6543b1e9803489e507d2470f8e3e408b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="713a6455fd9ba664fa6fbe4de0f28e76"/><file name="system.xml" hash="809d4deab49bffad6a6820c05bad49f6"/></dir><dir name="Helper"><file name="Api.php" hash="aa9c589ecf90b26c4ed2684ac8fd68a1"/><file name="Data.php" hash="4cfb227c77a5597bb21ba1ab1cbc65bd"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="d16d89cea8eea6352a7d9b1193cd9512"/></dir></dir><file name="Cron.php" hash="670d37cd6cdbe60aa69fad8eb0a0759e"/><file name="Log.php" hash="0209908a304c4940fe20b961b3d82c6c"/><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="8895678aa59e49226509d2b4709c5f43"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="baec5b8a27c5b037529ba935aae0370a"/><file name="Weekday.php" hash="173edc075325d932f8dad6d4674b8153"/></dir><dir name="Time"><file name="Hour.php" hash="ddad98b85290d9b13ec9f65fbe8a10b3"/><file name="Minute.php" hash="4a76af0057d60e8ff0ff7fedc1d50575"/></dir></dir><file name="Guid.php" hash="311c7f8072f02a6be9e25b6411298c5c"/><dir name="Script"><file name="Js.php" hash="3e3f23b38ecdc361bf6ff6cee1871e92"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="f9116fd446914467e7fb31bed5a6dd0b"/></dir><file name="Mode.php" hash="36140a050ea65ff23d45264fa67e1a2b"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="ca1883122659f1b48890ecd46a1590ee"/></dir><file name="Attribute.php" hash="8ca9c929cda497400865751ffba991e6"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="143c26f9661e5dc995ff064e333a2018"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="f1e414c08c43ebb2fcc6ccf5b41a2ff2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="fb09f17b54ef8ffa22580741cc66ac14"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iplogistics.xml" hash="dc215a898f4c73c61832b4f64ab2608b"/><file name="iparcel.xml" hash="c75b2082a2d5ceb3e507843ca793ea05"/></dir><dir name="template"><dir name="iplogistics"><dir name="order"><dir name="totals"><file name="duty.phtml" hash="0ea5054e7e70bd6d7b33bb46e0785bfb"/><file name="tax.phtml" hash="b208790d106afa82f2723c0d1ec12ed5"/></dir></dir><dir name="shipment"><dir name="split"><file name="form.phtml" hash="3f6284be75f13da03413d2d7aa96fdda"/><file name="items.phtml" hash="93be5dc4c1feae63a0dc751ae33420a7"/><dir name="renderer"><file name="default.phtml" hash="85053a7fe01567e023a30bbd0a03b27e"/></dir></dir></dir></dir><dir name="iparcel"><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="4959462a90a5c2b6c01ba722b73e8f58"/><file name="checkitems.phtml" hash="c19b0e4fd0feddedbc2cef3b2f4ce79b"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iplogistics.xml" hash="01774751e5a2cd7a3356eb5ca8f39faf"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="iparcel-logistics"><dir name="adminhtml"><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/></dir></dir><dir name="iparcel"><dir name="adminhtml"><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies>
|
24 |
<required>
|