Version Notes
RAS
Download this release
Release Info
Developer | Addonline |
Extension | Addonline_Gls |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.3
- app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php +50 -36
- app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Informations.php +16 -13
- app/code/community/Addonline/Gls/Block/Export/Orders.php +6 -5
- app/code/community/Addonline/Gls/Block/Export/Orders/Grid.php +152 -97
- app/code/community/Addonline/Gls/Block/Import/Form.php +6 -5
- app/code/community/Addonline/Gls/Block/Listrelay.php +12 -8
- app/code/community/Addonline/Gls/Block/OneStepCheckout/Checkout.php +52 -0
- app/code/community/Addonline/Gls/Block/Selector.php +13 -11
- app/code/community/Addonline/Gls/GLS_14_GuideInstallationModuleMagento_07.pdf +0 -0
- app/code/community/Addonline/Gls/Helper/Data.php +151 -92
- app/code/community/Addonline/Gls/Helper/OneStepCheckout/Checkout.php +18 -19
- app/code/community/Addonline/Gls/Model/Carrier/Abstract.php +1 -1
- app/code/community/Addonline/Gls/Model/Export.php +50 -40
- app/code/community/Addonline/Gls/Model/Import.php +32 -16
- app/code/community/Addonline/Gls/Model/Observer.php +31 -23
- app/code/community/Addonline/Gls/Model/Sales/Quote/Address.php +10 -12
- app/code/community/Addonline/Gls/Model/Service.php +47 -33
- app/code/community/Addonline/Gls/controllers/AjaxController.php +76 -47
- app/code/community/Addonline/Gls/controllers/ExportController.php +11 -9
- app/code/community/Addonline/Gls/controllers/ImportController.php +19 -14
- app/code/community/Addonline/Gls/etc/config.xml +6 -1
- app/code/community/Addonline/Gls/etc/system.xml +1 -1
- app/code/community/Addonline/Gls/owebia_includes/OwebiaShippingHelper_GLS.php +2 -2
- app/locale/fr_FR/Addonline_Gls.csv +4 -2
- package.xml +4 -4
- skin/frontend/base/default/js/gls.js +2 -2
app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2008-13 Owebia
|
4 |
*
|
@@ -22,32 +23,33 @@
|
|
22 |
/**
|
23 |
* Addonline_Gls
|
24 |
*
|
25 |
-
* @category
|
26 |
-
* @package
|
27 |
-
* @copyright
|
28 |
-
* @author
|
29 |
*/
|
30 |
class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage_Adminhtml_Block_System_Config_Form_Field
|
31 |
{
|
32 |
|
33 |
/**
|
|
|
34 |
* @var boolean
|
35 |
*/
|
36 |
private static $JS_INCLUDED = false;
|
37 |
-
|
38 |
-
/*
|
39 |
-
* @see Mage_Core_Block_Abstract::__()
|
40 |
*/
|
41 |
-
public function __()
|
42 |
{
|
43 |
$args = func_get_args();
|
44 |
return Mage::helper('gls')->__($args);
|
45 |
}
|
46 |
-
|
47 |
-
/*
|
48 |
-
* @see Mage_Core_Block_Abstract::_prepareLayout()
|
49 |
*/
|
50 |
-
protected function _prepareLayout()
|
51 |
{
|
52 |
$layout = $this->getLayout();
|
53 |
$head = $layout->getBlock('head');
|
@@ -58,10 +60,14 @@ class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage
|
|
58 |
// $head->addJs('gls/owebia_shipping2/colorbox/jquery.colorbox-min.js');
|
59 |
// $head->addJs('gls/owebia_shipping2/jquery.caret.1.02.min.js');
|
60 |
// $head->addJs('gls/owebia_shipping2/os2editor.js');
|
61 |
-
// //$head->addItem('js_css',
|
62 |
-
//
|
63 |
-
// $head->addItem('js_css',
|
64 |
-
//
|
|
|
|
|
|
|
|
|
65 |
// $head->append($block);
|
66 |
|
67 |
parent::_prepareLayout();
|
@@ -69,27 +75,32 @@ class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage
|
|
69 |
|
70 |
/**
|
71 |
* tradution et echappement
|
72 |
-
*
|
|
|
73 |
*/
|
74 |
-
private function label__($input)
|
75 |
{
|
76 |
-
return str_replace(
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
}
|
88 |
-
|
89 |
-
/*
|
90 |
-
* @see
|
|
|
91 |
*/
|
92 |
-
protected function _getElementHtml(
|
|
|
93 |
{
|
94 |
$output = '';
|
95 |
// if (!self::$JS_INCLUDED) {
|
@@ -97,14 +108,16 @@ class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage
|
|
97 |
// ."//<![CDATA[\n"
|
98 |
// ."jQuery.noConflict();\n"
|
99 |
// ."var os2editor = new OS2Editor({\n"
|
100 |
-
// ."ajax_url:
|
|
|
101 |
// ."form_key: FORM_KEY,\n"
|
102 |
// ."apply_btn_label: '".$this->label__('Apply')."',\n"
|
103 |
// ."cancel_btn_label: '".$this->label__('Cancel')."',\n"
|
104 |
// ."menu_item_dissociate_label: '".$this->label__('Dissociate')."',\n"
|
105 |
// ."menu_item_remove_label: '".$this->label__('Remove')."',\n"
|
106 |
// ."menu_item_edit_label: '".$this->label__('Edit')."',\n"
|
107 |
-
// ."prompt_new_value_label: '".$this->label__('Enter the new
|
|
|
108 |
// ."default_row_label: '".$this->label__('[No label]')."',\n"
|
109 |
// ."loading_label: '".$this->label__('Loading...')."'\n"
|
110 |
// ."});\n"
|
@@ -116,7 +129,8 @@ class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage
|
|
116 |
// self::$JS_INCLUDED = true;
|
117 |
// }
|
118 |
|
119 |
-
$shipping_code = preg_replace('/^groups\[([^\]]*)\].*$/', '\1',
|
|
|
120 |
return <<<EOD
|
121 |
{$output}
|
122 |
<!--<div style="margin-bottom:1px;">
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2008-13 Owebia
|
5 |
*
|
23 |
/**
|
24 |
* Addonline_Gls
|
25 |
*
|
26 |
+
* @category Addonline
|
27 |
+
* @package Addonline_Gls
|
28 |
+
* @copyright Copyright (c) 2014 GLS
|
29 |
+
* @author Addonline (http://www.addonline.fr)
|
30 |
*/
|
31 |
class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage_Adminhtml_Block_System_Config_Form_Field
|
32 |
{
|
33 |
|
34 |
/**
|
35 |
+
*
|
36 |
* @var boolean
|
37 |
*/
|
38 |
private static $JS_INCLUDED = false;
|
39 |
+
|
40 |
+
/*
|
41 |
+
* (non-PHPdoc) @see Mage_Core_Block_Abstract::__()
|
42 |
*/
|
43 |
+
public function __ ()
|
44 |
{
|
45 |
$args = func_get_args();
|
46 |
return Mage::helper('gls')->__($args);
|
47 |
}
|
48 |
+
|
49 |
+
/*
|
50 |
+
* (non-PHPdoc) @see Mage_Core_Block_Abstract::_prepareLayout()
|
51 |
*/
|
52 |
+
protected function _prepareLayout ()
|
53 |
{
|
54 |
$layout = $this->getLayout();
|
55 |
$head = $layout->getBlock('head');
|
60 |
// $head->addJs('gls/owebia_shipping2/colorbox/jquery.colorbox-min.js');
|
61 |
// $head->addJs('gls/owebia_shipping2/jquery.caret.1.02.min.js');
|
62 |
// $head->addJs('gls/owebia_shipping2/os2editor.js');
|
63 |
+
// //$head->addItem('js_css',
|
64 |
+
// 'gls/owebia_/jquery-ui-1.8.23.custom/css/ui-lightness/jquery-ui-1.8.23.custom.css');
|
65 |
+
// $head->addItem('js_css',
|
66 |
+
// 'gls/owebia_shipping2/colorbox/colorbox.css', 'media="all"');
|
67 |
+
// $head->addItem('js_css', 'gls/owebia_shipping2/os2editor.css',
|
68 |
+
// 'media="all"');
|
69 |
+
// $head->addItem('other',
|
70 |
+
// 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
|
71 |
// $head->append($block);
|
72 |
|
73 |
parent::_prepareLayout();
|
75 |
|
76 |
/**
|
77 |
* tradution et echappement
|
78 |
+
*
|
79 |
+
* @param string $input
|
80 |
*/
|
81 |
+
private function label__ ($input)
|
82 |
{
|
83 |
+
return str_replace(
|
84 |
+
array(
|
85 |
+
"\r\n",
|
86 |
+
"\r",
|
87 |
+
"\n",
|
88 |
+
"'"
|
89 |
+
),
|
90 |
+
array(
|
91 |
+
"\\n",
|
92 |
+
"\\n",
|
93 |
+
"\\n",
|
94 |
+
"\\'"
|
95 |
+
), $this->__($input));
|
96 |
}
|
97 |
+
|
98 |
+
/*
|
99 |
+
* (non-PHPdoc) @see
|
100 |
+
* Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
|
101 |
*/
|
102 |
+
protected function _getElementHtml (
|
103 |
+
Varien_Data_Form_Element_Abstract $element)
|
104 |
{
|
105 |
$output = '';
|
106 |
// if (!self::$JS_INCLUDED) {
|
108 |
// ."//<![CDATA[\n"
|
109 |
// ."jQuery.noConflict();\n"
|
110 |
// ."var os2editor = new OS2Editor({\n"
|
111 |
+
// ."ajax_url:
|
112 |
+
// '".$this->getUrl('adminhtml/gls_ajax/index')."?isAjax=true',\n"
|
113 |
// ."form_key: FORM_KEY,\n"
|
114 |
// ."apply_btn_label: '".$this->label__('Apply')."',\n"
|
115 |
// ."cancel_btn_label: '".$this->label__('Cancel')."',\n"
|
116 |
// ."menu_item_dissociate_label: '".$this->label__('Dissociate')."',\n"
|
117 |
// ."menu_item_remove_label: '".$this->label__('Remove')."',\n"
|
118 |
// ."menu_item_edit_label: '".$this->label__('Edit')."',\n"
|
119 |
+
// ."prompt_new_value_label: '".$this->label__('Enter the new
|
120 |
+
// value:')."',\n"
|
121 |
// ."default_row_label: '".$this->label__('[No label]')."',\n"
|
122 |
// ."loading_label: '".$this->label__('Loading...')."'\n"
|
123 |
// ."});\n"
|
129 |
// self::$JS_INCLUDED = true;
|
130 |
// }
|
131 |
|
132 |
+
$shipping_code = preg_replace('/^groups\[([^\]]*)\].*$/', '\1',
|
133 |
+
$element->getName());
|
134 |
return <<<EOD
|
135 |
{$output}
|
136 |
<!--<div style="margin-bottom:1px;">
|
app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Informations.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2008-13 Owebia
|
4 |
*
|
@@ -21,28 +22,30 @@
|
|
21 |
/**
|
22 |
* Addonline_Gls
|
23 |
*
|
24 |
-
* @category
|
25 |
-
* @package
|
26 |
-
* @copyright
|
27 |
-
* @author
|
28 |
*/
|
29 |
-
|
30 |
{
|
31 |
-
|
32 |
-
/*
|
33 |
-
* @see Mage_Core_Block_Abstract::__()
|
34 |
*/
|
35 |
-
public function __()
|
36 |
{
|
37 |
$args = func_get_args();
|
38 |
// return Mage::helper('owebia-shipping2')->__($args);
|
39 |
return false;
|
40 |
}
|
41 |
-
|
42 |
-
/*
|
43 |
-
* @see
|
|
|
44 |
*/
|
45 |
-
protected function _getElementHtml(
|
|
|
46 |
{
|
47 |
$version = Mage::getConfig()->getNode('modules/Addonline_Gls/version');
|
48 |
return 'Version: ' . $version;
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2008-13 Owebia
|
5 |
*
|
22 |
/**
|
23 |
* Addonline_Gls
|
24 |
*
|
25 |
+
* @category Addonline
|
26 |
+
* @package Addonline_Gls
|
27 |
+
* @copyright Copyright (c) 2014 GLS
|
28 |
+
* @author Addonline (http://www.addonline.fr)
|
29 |
*/
|
30 |
+
class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Informations extends Mage_Adminhtml_Block_System_Config_Form_Field
|
31 |
{
|
32 |
+
|
33 |
+
/*
|
34 |
+
* (non-PHPdoc) @see Mage_Core_Block_Abstract::__()
|
35 |
*/
|
36 |
+
public function __ ()
|
37 |
{
|
38 |
$args = func_get_args();
|
39 |
// return Mage::helper('owebia-shipping2')->__($args);
|
40 |
return false;
|
41 |
}
|
42 |
+
|
43 |
+
/*
|
44 |
+
* (non-PHPdoc) @see
|
45 |
+
* Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
|
46 |
*/
|
47 |
+
protected function _getElementHtml (
|
48 |
+
Varien_Data_Form_Element_Abstract $element)
|
49 |
{
|
50 |
$version = Mage::getConfig()->getNode('modules/Addonline_Gls/version');
|
51 |
return 'Version: ' . $version;
|
app/code/community/Addonline/Gls/Block/Export/Orders.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid
|
|
29 |
/**
|
30 |
* Enter Description here
|
31 |
*/
|
32 |
-
public function __construct()
|
33 |
{
|
34 |
$this->_blockGroup = 'gls';
|
35 |
$this->_controller = 'export_orders';
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
28 |
{
|
30 |
/**
|
31 |
* Enter Description here
|
32 |
*/
|
33 |
+
public function __construct ()
|
34 |
{
|
35 |
$this->_blockGroup = 'gls';
|
36 |
$this->_controller = 'export_orders';
|
app/code/community/Addonline/Gls/Block/Export/Orders/Grid.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
29 |
/**
|
30 |
* Constructor
|
31 |
*/
|
32 |
-
public function __construct()
|
33 |
{
|
34 |
parent::__construct();
|
35 |
$this->setId('gls_export_order_grid');
|
@@ -43,34 +44,75 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
43 |
*
|
44 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
45 |
*/
|
46 |
-
protected function _prepareCollection()
|
47 |
{
|
48 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
49 |
-
$collection = Mage::getResourceModel('sales/order_grid_collection')
|
50 |
-
|
51 |
-
|
52 |
-
'
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
54 |
} else {
|
55 |
-
$collection = Mage::getResourceModel('sales/order_collection')
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
'
|
65 |
-
'
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
'
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
$this->setCollection($collection);
|
@@ -82,13 +124,13 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
82 |
*
|
83 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
84 |
*/
|
85 |
-
protected function _prepareColumns()
|
86 |
{
|
87 |
$columnData = array(
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
);
|
93 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
94 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
@@ -96,57 +138,69 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
96 |
$this->addColumn('real_order_id', $columnData);
|
97 |
|
98 |
if (! Mage::app()->isSingleStoreMode()) {
|
99 |
-
$this->addColumn(
|
100 |
-
'
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
}
|
107 |
|
108 |
$columnData = array(
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
);
|
114 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
115 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
116 |
}
|
117 |
$this->addColumn('created_at', $columnData);
|
118 |
|
119 |
-
$this->addColumn(
|
120 |
-
'
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
123 |
|
124 |
-
$this->addColumn(
|
125 |
-
'
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
128 |
|
129 |
$columnData = array(
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
);
|
135 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
136 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
137 |
}
|
138 |
$this->addColumn('base_grand_total', $columnData);
|
139 |
|
140 |
-
$this->addColumn(
|
141 |
-
'
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
144 |
|
145 |
$columnData = array(
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
);
|
151 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
152 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
@@ -154,25 +208,27 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
154 |
$this->addColumn('status', $columnData);
|
155 |
|
156 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
157 |
-
$this->addColumn(
|
158 |
-
'
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
'
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
167 |
),
|
168 |
-
'
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
'is_system' => true
|
175 |
-
));
|
176 |
}
|
177 |
|
178 |
return parent::_prepareColumns();
|
@@ -183,7 +239,7 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
183 |
*
|
184 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
185 |
*/
|
186 |
-
protected function _prepareMassaction()
|
187 |
{
|
188 |
$this->setMassactionIdField('entity_id');
|
189 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
@@ -191,10 +247,13 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
191 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
192 |
}
|
193 |
|
194 |
-
$this->getMassactionBlock()->addItem(
|
195 |
-
'
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
198 |
|
199 |
return $this;
|
200 |
}
|
@@ -204,12 +263,10 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
204 |
*
|
205 |
* @return string boolean
|
206 |
*/
|
207 |
-
public function getRowUrl($row)
|
208 |
{
|
209 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
210 |
-
return $this->getUrl('adminhtml/sales_order/view', array(
|
211 |
-
'order_id' => $row->getId()
|
212 |
-
));
|
213 |
}
|
214 |
return false;
|
215 |
}
|
@@ -219,10 +276,8 @@ class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget
|
|
219 |
*
|
220 |
* @return string
|
221 |
*/
|
222 |
-
public function getGridUrl()
|
223 |
{
|
224 |
-
return $this->getUrl('*/*/*', array(
|
225 |
-
'_current' => true
|
226 |
-
));
|
227 |
}
|
228 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
28 |
{
|
30 |
/**
|
31 |
* Constructor
|
32 |
*/
|
33 |
+
public function __construct ()
|
34 |
{
|
35 |
parent::__construct();
|
36 |
$this->setId('gls_export_order_grid');
|
44 |
*
|
45 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
46 |
*/
|
47 |
+
protected function _prepareCollection ()
|
48 |
{
|
49 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
50 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
51 |
+
$collection->join(
|
52 |
+
'order',
|
53 |
+
'main_table.entity_id = order.entity_id',
|
54 |
+
array('shipping_method')
|
55 |
+
);
|
56 |
+
$collection->addAttributeToFilter(
|
57 |
+
'shipping_method',
|
58 |
+
array('like' => 'gls_%')
|
59 |
+
);
|
60 |
} else {
|
61 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
62 |
+
$collection->addAttributeToSelect(
|
63 |
+
array(
|
64 |
+
'status',
|
65 |
+
'shipping_method'
|
66 |
+
)
|
67 |
+
);
|
68 |
+
$collection->joinAttribute(
|
69 |
+
'billing_firstname',
|
70 |
+
'order_address/firstname',
|
71 |
+
'billing_address_id',
|
72 |
+
null,
|
73 |
+
'left'
|
74 |
+
);
|
75 |
+
$collection->joinAttribute(
|
76 |
+
'billing_lastname',
|
77 |
+
'order_address/lastname',
|
78 |
+
'billing_address_id',
|
79 |
+
null,
|
80 |
+
'left'
|
81 |
+
);
|
82 |
+
$collection->joinAttribute(
|
83 |
+
'shipping_firstname',
|
84 |
+
'order_address/firstname',
|
85 |
+
'shipping_address_id',
|
86 |
+
null,
|
87 |
+
'left'
|
88 |
+
);
|
89 |
+
$collection->joinAttribute(
|
90 |
+
'shipping_lastname',
|
91 |
+
'order_address/lastname',
|
92 |
+
'shipping_address_id',
|
93 |
+
null,
|
94 |
+
'left'
|
95 |
+
);
|
96 |
+
$collection->addExpressionAttributeToSelect(
|
97 |
+
'billing_name',
|
98 |
+
'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
|
99 |
+
array(
|
100 |
+
'billing_firstname',
|
101 |
+
'billing_lastname'
|
102 |
+
)
|
103 |
+
);
|
104 |
+
$collection->addExpressionAttributeToSelect(
|
105 |
+
'shipping_name',
|
106 |
+
'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
|
107 |
+
array(
|
108 |
+
'shipping_firstname',
|
109 |
+
'shipping_lastname'
|
110 |
+
)
|
111 |
+
);
|
112 |
+
$collection->addAttributeToFilter(
|
113 |
+
'shipping_method',
|
114 |
+
array('like' => 'gls_%')
|
115 |
+
);
|
116 |
}
|
117 |
|
118 |
$this->setCollection($collection);
|
124 |
*
|
125 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
126 |
*/
|
127 |
+
protected function _prepareColumns ()
|
128 |
{
|
129 |
$columnData = array(
|
130 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
131 |
+
'width' => '80px',
|
132 |
+
'type' => 'text',
|
133 |
+
'index' => 'increment_id'
|
134 |
);
|
135 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
136 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
138 |
$this->addColumn('real_order_id', $columnData);
|
139 |
|
140 |
if (! Mage::app()->isSingleStoreMode()) {
|
141 |
+
$this->addColumn(
|
142 |
+
'store_id',
|
143 |
+
array(
|
144 |
+
'header' => Mage::helper('sales')->__('Purchased from (store)'),
|
145 |
+
'index' => 'store_id',
|
146 |
+
'type' => 'store',
|
147 |
+
'store_view' => true,
|
148 |
+
'display_deleted' => true
|
149 |
+
)
|
150 |
+
);
|
151 |
}
|
152 |
|
153 |
$columnData = array(
|
154 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
155 |
+
'index' => 'created_at',
|
156 |
+
'type' => 'datetime',
|
157 |
+
'width' => '100px'
|
158 |
);
|
159 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
160 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
161 |
}
|
162 |
$this->addColumn('created_at', $columnData);
|
163 |
|
164 |
+
$this->addColumn(
|
165 |
+
'billing_name',
|
166 |
+
array(
|
167 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
168 |
+
'index' => 'billing_name'
|
169 |
+
)
|
170 |
+
);
|
171 |
|
172 |
+
$this->addColumn(
|
173 |
+
'shipping_name',
|
174 |
+
array(
|
175 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
176 |
+
'index' => 'shipping_name'
|
177 |
+
)
|
178 |
+
);
|
179 |
|
180 |
$columnData = array(
|
181 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
182 |
+
'index' => 'base_grand_total',
|
183 |
+
'type' => 'currency',
|
184 |
+
'currency' => 'base_currency_code'
|
185 |
);
|
186 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
187 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
188 |
}
|
189 |
$this->addColumn('base_grand_total', $columnData);
|
190 |
|
191 |
+
$this->addColumn(
|
192 |
+
'carrier',
|
193 |
+
array(
|
194 |
+
'header' => Mage::helper('sales')->__('Carrier'),
|
195 |
+
'index' => 'shipping_method'
|
196 |
+
)
|
197 |
+
);
|
198 |
|
199 |
$columnData = array(
|
200 |
+
'header' => Mage::helper('sales')->__('Status'),
|
201 |
+
'index' => 'status',
|
202 |
+
'type' => 'options',
|
203 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses()
|
204 |
);
|
205 |
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
206 |
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
208 |
$this->addColumn('status', $columnData);
|
209 |
|
210 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
211 |
+
$this->addColumn(
|
212 |
+
'action',
|
213 |
+
array(
|
214 |
+
'header' => Mage::helper('sales')->__('Action'),
|
215 |
+
'width' => '50px',
|
216 |
+
'type' => 'action',
|
217 |
+
'getter' => 'getId',
|
218 |
+
'actions' => array(
|
219 |
+
array(
|
220 |
+
'caption' => Mage::helper('sales')->__('View'),
|
221 |
+
'url' => array('base' => 'adminhtml/sales_order/view'
|
222 |
+
),
|
223 |
+
'field' => 'order_id'
|
224 |
+
)
|
225 |
),
|
226 |
+
'filter' => false,
|
227 |
+
'sortable' => false,
|
228 |
+
'index' => 'stores',
|
229 |
+
'is_system' => true
|
230 |
+
)
|
231 |
+
);
|
|
|
|
|
232 |
}
|
233 |
|
234 |
return parent::_prepareColumns();
|
239 |
*
|
240 |
* @return Addonline_Gls_Block_Export_Orders_Grid
|
241 |
*/
|
242 |
+
protected function _prepareMassaction ()
|
243 |
{
|
244 |
$this->setMassactionIdField('entity_id');
|
245 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
247 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
248 |
}
|
249 |
|
250 |
+
$this->getMassactionBlock()->addItem(
|
251 |
+
'export_order',
|
252 |
+
array(
|
253 |
+
'label' => Mage::helper('gls')->__('Export'),
|
254 |
+
'url' => $this->getUrl('*/*/export')
|
255 |
+
)
|
256 |
+
);
|
257 |
|
258 |
return $this;
|
259 |
}
|
263 |
*
|
264 |
* @return string boolean
|
265 |
*/
|
266 |
+
public function getRowUrl ($row)
|
267 |
{
|
268 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
269 |
+
return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
|
|
|
|
|
270 |
}
|
271 |
return false;
|
272 |
}
|
276 |
*
|
277 |
* @return string
|
278 |
*/
|
279 |
+
public function getGridUrl ()
|
280 |
{
|
281 |
+
return $this->getUrl('*/*/*', array('_current' => true));
|
|
|
|
|
282 |
}
|
283 |
}
|
app/code/community/Addonline/Gls/Block/Import/Form.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Block_Import_Form extends Mage_Adminhtml_Block_Widget
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_Block_Import_Form extends Mage_Adminhtml_Block_Widget
|
|
29 |
/**
|
30 |
* Constructor
|
31 |
*/
|
32 |
-
public function __construct()
|
33 |
{
|
34 |
parent::__construct();
|
35 |
$this->setTemplate('gls/import/form.phtml');
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Block_Import_Form extends Mage_Adminhtml_Block_Widget
|
28 |
{
|
30 |
/**
|
31 |
* Constructor
|
32 |
*/
|
33 |
+
public function __construct ()
|
34 |
{
|
35 |
parent::__construct();
|
36 |
$this->setTemplate('gls/import/form.phtml');
|
app/code/community/Addonline/Gls/Block/Listrelay.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,33 +19,36 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Block_Listrelay extends Mage_Core_Block_Template
|
27 |
{
|
28 |
|
29 |
/**
|
|
|
30 |
* @var array
|
31 |
*/
|
32 |
private $_listRelay = array();
|
33 |
|
34 |
/**
|
35 |
* getter listRelay
|
|
|
36 |
* @return array
|
37 |
*/
|
38 |
-
public function getListRelay()
|
39 |
{
|
40 |
return $this->_listRelay;
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
* setter listRelay
|
45 |
-
*
|
|
|
46 |
*/
|
47 |
-
public function setListRelay($list)
|
48 |
{
|
49 |
$this->_listRelay = $list;
|
50 |
}
|
@@ -52,7 +56,7 @@ class Addonline_Gls_Block_Listrelay extends Mage_Core_Block_Template
|
|
52 |
/**
|
53 |
* Constructor
|
54 |
*/
|
55 |
-
public function __construct()
|
56 |
{
|
57 |
parent::__construct();
|
58 |
$this->setTemplate('gls/listrelais.phtml');
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Block_Listrelay extends Mage_Core_Block_Template
|
28 |
{
|
29 |
|
30 |
/**
|
31 |
+
*
|
32 |
* @var array
|
33 |
*/
|
34 |
private $_listRelay = array();
|
35 |
|
36 |
/**
|
37 |
* getter listRelay
|
38 |
+
*
|
39 |
* @return array
|
40 |
*/
|
41 |
+
public function getListRelay ()
|
42 |
{
|
43 |
return $this->_listRelay;
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* setter listRelay
|
48 |
+
*
|
49 |
+
* @param array $list
|
50 |
*/
|
51 |
+
public function setListRelay ($list)
|
52 |
{
|
53 |
$this->_listRelay = $list;
|
54 |
}
|
56 |
/**
|
57 |
* Constructor
|
58 |
*/
|
59 |
+
public function __construct ()
|
60 |
{
|
61 |
parent::__construct();
|
62 |
$this->setTemplate('gls/listrelais.phtml');
|
app/code/community/Addonline/Gls/Block/OneStepCheckout/Checkout.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 GLS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Addonline_Gls
|
14 |
+
* @copyright Copyright (c) 2014 GLS
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Addonline_Gls
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
+
class Addonline_Gls_Block_OneStepCheckout_Checkout extends Idev_OneStepCheckout_Block_Checkout
|
28 |
+
{
|
29 |
+
|
30 |
+
/*
|
31 |
+
* (non-PHPdoc) @see Idev_OneStepCheckout_Block_Checkout::differentShippingAvailable()
|
32 |
+
*/
|
33 |
+
public function differentShippingAvailable ()
|
34 |
+
{
|
35 |
+
|
36 |
+
// dans le cas où on livre dans un relais colis GLS, on se comporte
|
37 |
+
// comme si la livraison
|
38 |
+
// dans une adresse différente de l'adresse de facturation n'était pas
|
39 |
+
// possible pour éviter d'écraser
|
40 |
+
// l'addresse du relais colis qui a été enregistrée auparavent
|
41 |
+
$request = Mage::app()->getRequest();
|
42 |
+
$shippingMethod = $request->getParam('shipping_method');
|
43 |
+
|
44 |
+
if (strpos($shippingMethod, 'gls_relay') === 0) {
|
45 |
+
$idRelais = $request->getParam('relais_socolissimo');
|
46 |
+
if ($idRelais) {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
return parent::differentShippingAvailable();
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Addonline/Gls/Block/Selector.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
27 |
{
|
@@ -29,16 +30,17 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
29 |
/**
|
30 |
* adresse de livraison
|
31 |
*/
|
32 |
-
private function _getShippingAddress()
|
33 |
{
|
34 |
return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
* methode de livraison
|
|
|
39 |
* @return string
|
40 |
*/
|
41 |
-
public function getAddressShippingMethod()
|
42 |
{
|
43 |
if ($adress = $this->_getShippingAddress()) {
|
44 |
return $adress->getShippingMethod();
|
@@ -50,7 +52,7 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
50 |
/**
|
51 |
* rue
|
52 |
*/
|
53 |
-
public function getShippingStreet()
|
54 |
{
|
55 |
return $this->_getShippingAddress()->getStreetFull();
|
56 |
}
|
@@ -58,7 +60,7 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
58 |
/**
|
59 |
* code postal
|
60 |
*/
|
61 |
-
public function getShippingPostcode()
|
62 |
{
|
63 |
return $this->_getShippingAddress()->getPostcode();
|
64 |
}
|
@@ -66,7 +68,7 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
66 |
/**
|
67 |
* ville
|
68 |
*/
|
69 |
-
public function getShippingCity()
|
70 |
{
|
71 |
return $this->_getShippingAddress()->getCity();
|
72 |
}
|
@@ -74,7 +76,7 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
74 |
/**
|
75 |
* pays
|
76 |
*/
|
77 |
-
public function getShippingCountry()
|
78 |
{
|
79 |
return $this->_getShippingAddress()->getCountry();
|
80 |
}
|
@@ -82,7 +84,7 @@ class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
|
82 |
/**
|
83 |
* telephone
|
84 |
*/
|
85 |
-
public function getTelephone()
|
86 |
{
|
87 |
return $this->_getShippingAddress()->getTelephone();
|
88 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
28 |
{
|
30 |
/**
|
31 |
* adresse de livraison
|
32 |
*/
|
33 |
+
private function _getShippingAddress ()
|
34 |
{
|
35 |
return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* methode de livraison
|
40 |
+
*
|
41 |
* @return string
|
42 |
*/
|
43 |
+
public function getAddressShippingMethod ()
|
44 |
{
|
45 |
if ($adress = $this->_getShippingAddress()) {
|
46 |
return $adress->getShippingMethod();
|
52 |
/**
|
53 |
* rue
|
54 |
*/
|
55 |
+
public function getShippingStreet ()
|
56 |
{
|
57 |
return $this->_getShippingAddress()->getStreetFull();
|
58 |
}
|
60 |
/**
|
61 |
* code postal
|
62 |
*/
|
63 |
+
public function getShippingPostcode ()
|
64 |
{
|
65 |
return $this->_getShippingAddress()->getPostcode();
|
66 |
}
|
68 |
/**
|
69 |
* ville
|
70 |
*/
|
71 |
+
public function getShippingCity ()
|
72 |
{
|
73 |
return $this->_getShippingAddress()->getCity();
|
74 |
}
|
76 |
/**
|
77 |
* pays
|
78 |
*/
|
79 |
+
public function getShippingCountry ()
|
80 |
{
|
81 |
return $this->_getShippingAddress()->getCountry();
|
82 |
}
|
84 |
/**
|
85 |
* telephone
|
86 |
*/
|
87 |
+
public function getTelephone ()
|
88 |
{
|
89 |
return $this->_getShippingAddress()->getTelephone();
|
90 |
}
|
app/code/community/Addonline/Gls/GLS_14_GuideInstallationModuleMagento_07.pdf
CHANGED
Binary file
|
app/code/community/Addonline/Gls/Helper/Data.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
|
29 |
/**
|
30 |
* seulement les relay XL configuré en BO
|
31 |
*/
|
32 |
-
public function isOnlyXLRelay()
|
33 |
{
|
34 |
return Mage::getStoreConfig('carriers/gls/relay_xl_only');
|
35 |
}
|
@@ -37,7 +38,7 @@ class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
|
37 |
/**
|
38 |
* répertoire d'export configuré en BO
|
39 |
*/
|
40 |
-
public function getExportFolder()
|
41 |
{
|
42 |
return Mage::getStoreConfig('carriers/gls/export_folder');
|
43 |
}
|
@@ -45,20 +46,21 @@ class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
|
45 |
/**
|
46 |
* répertoire d'import configuré en BO
|
47 |
*/
|
48 |
-
public function getImportFolder()
|
49 |
{
|
50 |
return Mage::getStoreConfig('carriers/gls/import_folder');
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
-
*
|
|
|
55 |
*/
|
56 |
-
protected $
|
57 |
-
|
58 |
-
/*
|
59 |
-
* @see Mage_Core_Helper_Abstract::__()
|
60 |
*/
|
61 |
-
public function __()
|
62 |
{
|
63 |
$args = func_get_args();
|
64 |
if (isset($args[0]) && is_array($args[0]) && count($args) == 1) {
|
@@ -73,15 +75,24 @@ class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
|
73 |
$output = parent::__($message);
|
74 |
|
75 |
/*
|
76 |
-
* if (true) { $translations = @file_get_contents('translations.os2'); $translations = eval('return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
*/
|
78 |
|
79 |
if (count($args) == 0) {
|
80 |
$result = $output;
|
81 |
} else {
|
82 |
-
if (! isset($this->
|
83 |
-
$this->
|
84 |
-
if ($this->
|
85 |
$parts = explode('}}{{', $output);
|
86 |
$parts[0] = vsprintf($parts[0], $args);
|
87 |
$result = implode('}}{{', $parts);
|
@@ -94,104 +105,152 @@ class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
|
94 |
|
95 |
/**
|
96 |
* Construit le nom de la méthode de livraison affiché
|
97 |
-
*
|
98 |
-
* @param unknown $
|
99 |
-
* @param unknown $
|
100 |
-
* @param unknown $
|
|
|
101 |
* @return string
|
102 |
*/
|
103 |
-
public function getMethodText($helper, $process, $row, $property)
|
104 |
{
|
105 |
if (! isset($row[$property]))
|
106 |
return '';
|
107 |
|
108 |
$output = '';
|
109 |
$cart = $process['data']['cart'];
|
110 |
-
return $helper->evalInput(
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
/**
|
128 |
* Construit la mpa de données
|
129 |
-
*
|
130 |
-
* @param unknown $
|
131 |
-
* @param unknown $
|
132 |
-
* @
|
|
|
133 |
*/
|
134 |
-
public function getDataModelMap($helper, $
|
135 |
{
|
136 |
-
$
|
137 |
return array(
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
'
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
)
|
157 |
-
)
|
158 |
-
)),
|
159 |
-
'quote' => Mage::getModel('gls/Os2_Data_Quote'),
|
160 |
-
'selection' => Mage::getModel('gls/Os2_Data_Selection'),
|
161 |
-
'customer' => Mage::getModel('gls/Os2_Data_Customer'),
|
162 |
-
'customer_group' => Mage::getModel('gls/Os2_Data_CustomerGroup'),
|
163 |
-
'customvar' => Mage::getModel('gls/Os2_Data_Customvar'),
|
164 |
-
'date' => Mage::getModel('gls/Os2_Data_Date'),
|
165 |
-
'address_filter' => Mage::getModel('gls/Os2_Data_AddressFilter'),
|
166 |
-
'origin' => Mage::getModel('gls/Os2_Data_Address', $this->_extract($request->getData(), array(
|
167 |
-
'country_id' => 'country_id',
|
168 |
-
'region_id' => 'region_id',
|
169 |
-
'postcode' => 'postcode',
|
170 |
-
'city' => 'city'
|
171 |
-
))),
|
172 |
-
'shipto' => Mage::getModel('gls/Os2_Data_Address', $this->_extract($request->getData(), array(
|
173 |
-
'country_id' => 'dest_country_id',
|
174 |
-
'region_id' => 'dest_region_id',
|
175 |
-
'region_code' => 'dest_region_code',
|
176 |
-
'street' => 'dest_street',
|
177 |
-
'city' => 'dest_city',
|
178 |
-
'postcode' => 'dest_postcode'
|
179 |
-
))),
|
180 |
-
'billto' => Mage::getModel('gls/Os2_Data_Billto'),
|
181 |
-
'store' => Mage::getModel('gls/Os2_Data_Store', array(
|
182 |
-
'id' => $request->getData('store_id')
|
183 |
-
)),
|
184 |
'request' => Mage::getModel('gls/Os2_Data_Abstract', $request->getData())
|
185 |
);
|
186 |
}
|
187 |
|
188 |
/**
|
189 |
* extrait les données du tableau
|
190 |
-
*
|
191 |
-
* @param unknown $
|
192 |
-
* @
|
|
|
193 |
*/
|
194 |
-
protected function _extract($data, $attributes)
|
195 |
{
|
196 |
$extract = array();
|
197 |
foreach ($attributes as $to => $from) {
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
28 |
{
|
30 |
/**
|
31 |
* seulement les relay XL configuré en BO
|
32 |
*/
|
33 |
+
public function isOnlyXLRelay ()
|
34 |
{
|
35 |
return Mage::getStoreConfig('carriers/gls/relay_xl_only');
|
36 |
}
|
38 |
/**
|
39 |
* répertoire d'export configuré en BO
|
40 |
*/
|
41 |
+
public function getExportFolder ()
|
42 |
{
|
43 |
return Mage::getStoreConfig('carriers/gls/export_folder');
|
44 |
}
|
46 |
/**
|
47 |
* répertoire d'import configuré en BO
|
48 |
*/
|
49 |
+
public function getImportFolder ()
|
50 |
{
|
51 |
return Mage::getStoreConfig('carriers/gls/import_folder');
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
+
*
|
56 |
+
* @var $_translateInline
|
57 |
*/
|
58 |
+
protected $_translateInline;
|
59 |
+
|
60 |
+
/*
|
61 |
+
* (non-PHPdoc) @see Mage_Core_Helper_Abstract::__()
|
62 |
*/
|
63 |
+
public function __ ()
|
64 |
{
|
65 |
$args = func_get_args();
|
66 |
if (isset($args[0]) && is_array($args[0]) && count($args) == 1) {
|
75 |
$output = parent::__($message);
|
76 |
|
77 |
/*
|
78 |
+
* if (true) { $translations = @file_get_contents('translations.os2'); $translations = eval('return
|
79 |
+
* '.$translations.';'); if (!is_array($translations)) $translations = array(); $file = 'NC'; $line = 'NC';
|
80 |
+
* $backtrace = debug_backtrace(); foreach ($backtrace as $trace) { if (!isset($trace['function'])) continue; if
|
81 |
+
* (substr($trace['function'], strlen($trace['function'])-2, strlen($trace['function']))=='__') { $file =
|
82 |
+
* ltrim(str_replace(Mage::getBaseDir(), '', $trace['file']), '/'); $line = $trace['line']; continue; } //$file
|
83 |
+
* = ltrim(str_replace(Mage::getBaseDir(), '', $trace['file']), '/'); //echo $file.', '.$trace['function'].'(),
|
84 |
+
* '.$line.', '.$message.'<br/>'; break; }
|
85 |
+
* $translations[Mage::app()->getLocale()->getLocaleCode()][$file][$message] = $output;
|
86 |
+
* ksort($translations[Mage::app()->getLocale()->getLocaleCode()]); file_put_contents('translations.os2',
|
87 |
+
* var_export($translations, true)); }
|
88 |
*/
|
89 |
|
90 |
if (count($args) == 0) {
|
91 |
$result = $output;
|
92 |
} else {
|
93 |
+
if (! isset($this->_translateInline))
|
94 |
+
$this->_translateInline = Mage::getSingleton('core/translate')->get_translateInline();
|
95 |
+
if ($this->_translateInline) {
|
96 |
$parts = explode('}}{{', $output);
|
97 |
$parts[0] = vsprintf($parts[0], $args);
|
98 |
$result = implode('}}{{', $parts);
|
105 |
|
106 |
/**
|
107 |
* Construit le nom de la méthode de livraison affiché
|
108 |
+
*
|
109 |
+
* @param unknown $helper
|
110 |
+
* @param unknown $process
|
111 |
+
* @param unknown $row
|
112 |
+
* @param unknown $property
|
113 |
* @return string
|
114 |
*/
|
115 |
+
public function getMethodText ($helper, $process, $row, $property)
|
116 |
{
|
117 |
if (! isset($row[$property]))
|
118 |
return '';
|
119 |
|
120 |
$output = '';
|
121 |
$cart = $process['data']['cart'];
|
122 |
+
return $helper->evalInput(
|
123 |
+
$process,
|
124 |
+
$row,
|
125 |
+
$property,
|
126 |
+
str_replace(
|
127 |
+
array(
|
128 |
+
'{cart.weight}',
|
129 |
+
'{cart.price-tax+discount}',
|
130 |
+
'{cart.price-tax-discount}',
|
131 |
+
'{cart.price+tax+discount}',
|
132 |
+
'{cart.price+tax-discount}'
|
133 |
+
),
|
134 |
+
array(
|
135 |
+
$cart->weight . $cart->weight_unit,
|
136 |
+
$this->currency($cart->price_including_tax),
|
137 |
+
$this->currency($cart->price_excluding_tax),
|
138 |
+
$this->currency($cart->{'price-tax+discount'}),
|
139 |
+
$this->currency($cart->{'price-tax-discount'}),
|
140 |
+
$this->currency($cart->{'price+tax+discount'}),
|
141 |
+
$this->currency($cart->{'price+tax-discount'})
|
142 |
+
),
|
143 |
+
$helper->getRowProperty($row, $property)
|
144 |
+
)
|
145 |
+
);
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
* Construit la mpa de données
|
150 |
+
*
|
151 |
+
* @param unknown $helper
|
152 |
+
* @param unknown $carrier_code
|
153 |
+
* @param unknown $request
|
154 |
+
* @return multitype:NULL
|
155 |
*/
|
156 |
+
public function getDataModelMap ($helper, $carrierCode, $request)
|
157 |
{
|
158 |
+
$mageConfig = Mage::getConfig();
|
159 |
return array(
|
160 |
+
'info' => Mage::getModel(
|
161 |
+
'gls/Os2_Data_Info',
|
162 |
+
array_merge(
|
163 |
+
$helper->getInfos(),
|
164 |
+
array(
|
165 |
+
'magento_version' => Mage::getVersion(),
|
166 |
+
'module_version' => (string) $mageConfig->getNode('modules/Addonline_Gls/version'),
|
167 |
+
'carrier_code' => $carrierCode
|
168 |
+
)
|
169 |
+
)
|
170 |
+
),
|
171 |
+
'cart' => Mage::getModel(
|
172 |
+
'gls/Os2_Data_Cart',
|
173 |
+
array(
|
174 |
+
'request' => $request,
|
175 |
+
'options' => array(
|
176 |
+
'bundle' => array(
|
177 |
+
'process_children' =>
|
178 |
+
(boolean) Mage::getStoreConfig('gls/bundle_product/process_children'),
|
179 |
+
'load_item_options_on_parent' =>
|
180 |
+
(boolean) Mage::getStoreConfig('gls/bundle_product/load_item_options_on_parent'),
|
181 |
+
'load_item_data_on_parent' =>
|
182 |
+
(boolean) Mage::getStoreConfig('gls/bundle_product/load_item_data_on_parent'),
|
183 |
+
'load_product_data_on_parent' =>
|
184 |
+
(boolean) Mage::getStoreConfig('gls/bundle_product/load_product_data_on_parent')
|
185 |
+
),
|
186 |
+
'configurable' => array(
|
187 |
+
'load_item_options_on_parent' =>
|
188 |
+
(boolean) Mage::getStoreConfig(
|
189 |
+
'gls/configurable_product/load_item_options_on_parent'
|
190 |
+
),
|
191 |
+
'load_item_data_on_parent' =>
|
192 |
+
(boolean) Mage::getStoreConfig(
|
193 |
+
'gls/configurable_product/load_item_data_on_parent'
|
194 |
+
),
|
195 |
+
'load_product_data_on_parent' =>
|
196 |
+
(boolean) Mage::getStoreConfig(
|
197 |
+
'gls/configurable_product/load_product_data_on_parent'
|
198 |
+
)
|
199 |
+
)
|
200 |
+
)
|
201 |
+
)
|
202 |
+
),
|
203 |
+
'quote' => Mage::getModel('gls/Os2_Data_Quote'),
|
204 |
+
'selection' => Mage::getModel('gls/Os2_Data_Selection'),
|
205 |
+
'customer' => Mage::getModel('gls/Os2_Data_Customer'),
|
206 |
+
'customer_group' => Mage::getModel('gls/Os2_Data_CustomerGroup'),
|
207 |
+
'customvar' => Mage::getModel('gls/Os2_Data_Customvar'),
|
208 |
+
'date' => Mage::getModel('gls/Os2_Data_Date'),
|
209 |
+
'address_filter' => Mage::getModel('gls/Os2_Data_AddressFilter'),
|
210 |
+
'origin' => Mage::getModel(
|
211 |
+
'gls/Os2_Data_Address',
|
212 |
+
$this->_extract(
|
213 |
+
$request->getData(),
|
214 |
+
array(
|
215 |
+
'country_id' => 'country_id',
|
216 |
+
'region_id' => 'region_id',
|
217 |
+
'postcode' => 'postcode',
|
218 |
+
'city' => 'city'
|
219 |
+
)
|
220 |
+
)
|
221 |
+
),
|
222 |
+
'shipto' => Mage::getModel(
|
223 |
+
'gls/Os2_Data_Address',
|
224 |
+
$this->_extract(
|
225 |
+
$request->getData(),
|
226 |
+
array(
|
227 |
+
'country_id' => 'dest_country_id',
|
228 |
+
'region_id' => 'dest_region_id',
|
229 |
+
'region_code' => 'dest_region_code',
|
230 |
+
'street' => 'dest_street',
|
231 |
+
'city' => 'dest_city',
|
232 |
+
'postcode' => 'dest_postcode'
|
233 |
+
)
|
234 |
+
)
|
235 |
+
),
|
236 |
+
'billto' => Mage::getModel('gls/Os2_Data_Billto'),
|
237 |
+
'store' => Mage::getModel(
|
238 |
+
'gls/Os2_Data_Store',
|
239 |
+
array('id' => $request->getData('store_id')
|
240 |
)
|
241 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
'request' => Mage::getModel('gls/Os2_Data_Abstract', $request->getData())
|
243 |
);
|
244 |
}
|
245 |
|
246 |
/**
|
247 |
* extrait les données du tableau
|
248 |
+
*
|
249 |
+
* @param unknown $data
|
250 |
+
* @param unknown $attributes
|
251 |
+
* @return multitype:Ambigous <NULL, unknown>
|
252 |
*/
|
253 |
+
protected function _extract ($data, $attributes)
|
254 |
{
|
255 |
$extract = array();
|
256 |
foreach ($attributes as $to => $from) {
|
app/code/community/Addonline/Gls/Helper/OneStepCheckout/Checkout.php
CHANGED
@@ -14,17 +14,16 @@
|
|
14 |
* @author Addonline (http://www.addonline.fr)
|
15 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
*/
|
17 |
-
|
18 |
if ((string) Mage::getConfig()->getModuleConfig('Idev_OneStepCheckout')->active != 'true') {
|
19 |
|
20 |
-
/**
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
class Idev_OneStepCheckout_Helper_Checkout extends Mage_Core_Helper_Abstract
|
29 |
{
|
30 |
}
|
@@ -33,21 +32,21 @@ if ((string) Mage::getConfig()->getModuleConfig('Idev_OneStepCheckout')->active
|
|
33 |
/**
|
34 |
* Addonline_Gls
|
35 |
*
|
36 |
-
* @category
|
37 |
-
* @package
|
38 |
-
* @copyright
|
39 |
-
* @author
|
40 |
*/
|
41 |
class Addonline_Gls_Helper_OneStepCheckout_Checkout extends Idev_OneStepCheckout_Helper_Checkout
|
42 |
{
|
43 |
-
|
44 |
-
/*
|
45 |
-
* @see Idev_OneStepCheckout_Helper_Checkout::saveShipping()
|
46 |
*/
|
47 |
-
public function saveShipping($data, $customerAddressId)
|
48 |
{
|
49 |
-
$
|
50 |
-
if ($
|
51 |
return array();
|
52 |
else
|
53 |
return parent::saveShipping($data, $customerAddressId);
|
14 |
* @author Addonline (http://www.addonline.fr)
|
15 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
*/
|
|
|
17 |
if ((string) Mage::getConfig()->getModuleConfig('Idev_OneStepCheckout')->active != 'true') {
|
18 |
|
19 |
+
/**
|
20 |
+
* Addonline_Gls
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
class Idev_OneStepCheckout_Helper_Checkout extends Mage_Core_Helper_Abstract
|
28 |
{
|
29 |
}
|
32 |
/**
|
33 |
* Addonline_Gls
|
34 |
*
|
35 |
+
* @category Addonline
|
36 |
+
* @package Addonline_Gls
|
37 |
+
* @copyright Copyright (c) 2014 GLS
|
38 |
+
* @author Addonline (http://www.addonline.fr)
|
39 |
*/
|
40 |
class Addonline_Gls_Helper_OneStepCheckout_Checkout extends Idev_OneStepCheckout_Helper_Checkout
|
41 |
{
|
42 |
+
|
43 |
+
/*
|
44 |
+
* (non-PHPdoc) @see Idev_OneStepCheckout_Helper_Checkout::saveShipping()
|
45 |
*/
|
46 |
+
public function saveShipping ($data, $customerAddressId)
|
47 |
{
|
48 |
+
$shippingData = Mage::getSingleton('checkout/session')->getData('gls_shipping_relay_data');
|
49 |
+
if ($shippingData)
|
50 |
return array();
|
51 |
else
|
52 |
return parent::saveShipping($data, $customerAddressId);
|
app/code/community/Addonline/Gls/Model/Carrier/Abstract.php
CHANGED
@@ -158,7 +158,7 @@ abstract class Addonline_Gls_Model_Carrier_Abstract extends Mage_Shipping_Model_
|
|
158 |
if($this->__getConfigData('livraisonrelay')){
|
159 |
$allConfigurations .= ($allConfigurations?',':'').$this->__getConfigData('configrelay');
|
160 |
}
|
161 |
-
Mage::log($allConfigurations);
|
162 |
$this->_helper = new OwebiaShippingHelper_GLS(
|
163 |
$allConfigurations,
|
164 |
true
|
158 |
if($this->__getConfigData('livraisonrelay')){
|
159 |
$allConfigurations .= ($allConfigurations?',':'').$this->__getConfigData('configrelay');
|
160 |
}
|
161 |
+
//Mage::log($allConfigurations, null, 'gls.log');
|
162 |
$this->_helper = new OwebiaShippingHelper_GLS(
|
163 |
$allConfigurations,
|
164 |
true
|
app/code/community/Addonline/Gls/Model/Export.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Model_Export
|
27 |
{
|
@@ -36,7 +37,7 @@ class Addonline_Gls_Model_Export
|
|
36 |
|
37 |
public $fileCharset;
|
38 |
|
39 |
-
public function run()
|
40 |
{
|
41 |
Mage::log('run GLS export', null, self::LOG_FILE);
|
42 |
if (! Mage::getStoreConfig('carrier/gls/export')) {
|
@@ -44,7 +45,7 @@ class Addonline_Gls_Model_Export
|
|
44 |
}
|
45 |
}
|
46 |
|
47 |
-
public function export($collection)
|
48 |
{
|
49 |
if ($collection->getSize() > 0) {
|
50 |
|
@@ -67,21 +68,21 @@ class Addonline_Gls_Model_Export
|
|
67 |
|
68 |
// HEADERS of the file
|
69 |
$aheaders = array(
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
);
|
86 |
$aOrdersToExport[] = $aheaders;
|
87 |
|
@@ -97,30 +98,33 @@ class Addonline_Gls_Model_Export
|
|
97 |
$aRow[] = $order->getIncrementId();
|
98 |
|
99 |
// ORDERNAME
|
100 |
-
$aRow[] = mb_strtoupper(
|
|
|
|
|
|
|
101 |
|
102 |
// PRODUCTNO
|
103 |
-
$
|
104 |
-
$
|
105 |
-
if (strpos($
|
106 |
-
// $
|
107 |
-
$
|
108 |
}
|
109 |
// if (strpos($shipping_method, 'ls_toyou') > 0) {
|
110 |
// $shipping_code = 'ADO';
|
111 |
// }
|
112 |
-
if (strpos($
|
113 |
-
$
|
114 |
}
|
115 |
-
$aRow[] = $
|
116 |
|
117 |
// ORDERWEIGHTTOT
|
118 |
-
$
|
119 |
$items = $order->getAllItems();
|
120 |
foreach ($items as $item) {
|
121 |
-
$
|
122 |
}
|
123 |
-
$aRow[] = $
|
124 |
|
125 |
// CONSID
|
126 |
$aRow[] = $order->getCustomerId();
|
@@ -135,8 +139,10 @@ class Addonline_Gls_Model_Export
|
|
135 |
$aRow[] = $shippingAddress->getTelephone();
|
136 |
|
137 |
// Repartition de l'adresse en fonction des tailles.
|
138 |
-
if (strlen($shippingAddress->getStreet(1)) > 35 || strlen($shippingAddress->getStreet(2)) > 35 ||
|
139 |
-
|
|
|
|
|
140 |
$street = wordwrap($street, 35, ';', true);
|
141 |
$aStreet = explode(';', $street);
|
142 |
|
@@ -172,7 +178,7 @@ class Addonline_Gls_Model_Export
|
|
172 |
// Adding the order to the export array
|
173 |
$aOrdersToExport[] = $aRow;
|
174 |
}
|
175 |
-
|
176 |
/*
|
177 |
* Save the file
|
178 |
*/
|
@@ -181,8 +187,8 @@ class Addonline_Gls_Model_Export
|
|
181 |
Mage::log("Export : " . Mage::helper('gls')->__('No Order has been selected'), null, self::LOG_FILE);
|
182 |
}
|
183 |
}
|
184 |
-
|
185 |
-
private function udate($format = 'u', $utimestamp = null)
|
186 |
{
|
187 |
if (is_null($utimestamp))
|
188 |
$utimestamp = microtime(true);
|
@@ -192,8 +198,12 @@ class Addonline_Gls_Model_Export
|
|
192 |
$milliseconds = substr($milliseconds, 0, 2);
|
193 |
return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
|
194 |
}
|
195 |
-
|
196 |
-
private function array2csv(array &$array,
|
|
|
|
|
|
|
|
|
197 |
{
|
198 |
if (count($array) == 0) {
|
199 |
return null;
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Model_Export
|
28 |
{
|
37 |
|
38 |
public $fileCharset;
|
39 |
|
40 |
+
public function run ()
|
41 |
{
|
42 |
Mage::log('run GLS export', null, self::LOG_FILE);
|
43 |
if (! Mage::getStoreConfig('carrier/gls/export')) {
|
45 |
}
|
46 |
}
|
47 |
|
48 |
+
public function export ($collection)
|
49 |
{
|
50 |
if ($collection->getSize() > 0) {
|
51 |
|
68 |
|
69 |
// HEADERS of the file
|
70 |
$aheaders = array(
|
71 |
+
'ORDERID',
|
72 |
+
'ORDERNAME',
|
73 |
+
'PRODUCTNO',
|
74 |
+
'ORDERWEIGHTTOT',
|
75 |
+
'CONSID',
|
76 |
+
'CONTACTMAIL',
|
77 |
+
'CONTACTMOBILE',
|
78 |
+
'CONTACTPHONE',
|
79 |
+
'STREET1',
|
80 |
+
'STREET2',
|
81 |
+
'STREET3',
|
82 |
+
'COUNTRYCODE',
|
83 |
+
'CITY',
|
84 |
+
'ZIPCODE',
|
85 |
+
'REFPR'
|
86 |
);
|
87 |
$aOrdersToExport[] = $aheaders;
|
88 |
|
98 |
$aRow[] = $order->getIncrementId();
|
99 |
|
100 |
// ORDERNAME
|
101 |
+
$aRow[] = mb_strtoupper(
|
102 |
+
$shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname(),
|
103 |
+
'UTF-8'
|
104 |
+
);
|
105 |
|
106 |
// PRODUCTNO
|
107 |
+
$shippingMethod = $order->getShippingMethod();
|
108 |
+
$shippingCode = $shippingMethod;
|
109 |
+
if (strpos($shippingMethod, 'ls_tohome') > 0) {
|
110 |
+
// $shippingCode = 'BP';
|
111 |
+
$shippingCode = ''; // le bon code sera déterminé par winExpé, selon le pays de destination
|
112 |
}
|
113 |
// if (strpos($shipping_method, 'ls_toyou') > 0) {
|
114 |
// $shipping_code = 'ADO';
|
115 |
// }
|
116 |
+
if (strpos($shippingMethod, 'ls_relay') > 0) {
|
117 |
+
$shippingCode = 'SHD';
|
118 |
}
|
119 |
+
$aRow[] = $shippingCode;
|
120 |
|
121 |
// ORDERWEIGHTTOT
|
122 |
+
$totalWeight = 0;
|
123 |
$items = $order->getAllItems();
|
124 |
foreach ($items as $item) {
|
125 |
+
$totalWeight += $item->getRowWeight();
|
126 |
}
|
127 |
+
$aRow[] = $totalWeight;
|
128 |
|
129 |
// CONSID
|
130 |
$aRow[] = $order->getCustomerId();
|
139 |
$aRow[] = $shippingAddress->getTelephone();
|
140 |
|
141 |
// Repartition de l'adresse en fonction des tailles.
|
142 |
+
if (strlen($shippingAddress->getStreet(1)) > 35 || strlen($shippingAddress->getStreet(2)) > 35 ||
|
143 |
+
strlen($shippingAddress->getStreet(3)) > 35) {
|
144 |
+
$street = $shippingAddress->getStreet(1) . ' ' . $shippingAddress->getStreet(2) . ' ' .
|
145 |
+
$shippingAddress->getStreet(3);
|
146 |
$street = wordwrap($street, 35, ';', true);
|
147 |
$aStreet = explode(';', $street);
|
148 |
|
178 |
// Adding the order to the export array
|
179 |
$aOrdersToExport[] = $aRow;
|
180 |
}
|
181 |
+
|
182 |
/*
|
183 |
* Save the file
|
184 |
*/
|
187 |
Mage::log("Export : " . Mage::helper('gls')->__('No Order has been selected'), null, self::LOG_FILE);
|
188 |
}
|
189 |
}
|
190 |
+
|
191 |
+
private function udate ($format = 'u', $utimestamp = null)
|
192 |
{
|
193 |
if (is_null($utimestamp))
|
194 |
$utimestamp = microtime(true);
|
198 |
$milliseconds = substr($milliseconds, 0, 2);
|
199 |
return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
|
200 |
}
|
201 |
+
|
202 |
+
private function array2csv (array &$array,
|
203 |
+
$filename,
|
204 |
+
$delimiter = ';',
|
205 |
+
$encloser = '"',
|
206 |
+
$folder = 'var/export/gls/')
|
207 |
{
|
208 |
if (count($array) == 0) {
|
209 |
return null;
|
app/code/community/Addonline/Gls/Model/Import.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Model_Import
|
27 |
{
|
@@ -36,7 +37,7 @@ class Addonline_Gls_Model_Import
|
|
36 |
|
37 |
public $fileCharset;
|
38 |
|
39 |
-
public function run()
|
40 |
{
|
41 |
Mage::log('run GLS import', null, self::LOG_FILE);
|
42 |
|
@@ -45,7 +46,7 @@ class Addonline_Gls_Model_Import
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
public function import()
|
49 |
{
|
50 |
$importFolder = Mage::helper('gls')->getImportFolder();
|
51 |
if (! is_dir($importFolder)) {
|
@@ -56,7 +57,8 @@ class Addonline_Gls_Model_Import
|
|
56 |
|
57 |
// Parcour du dossier
|
58 |
while ($file = readdir($dir)) {
|
59 |
-
if ($file != '.' && $file != '..' && ! is_dir($importFolder . $file) &&
|
|
|
60 |
$aOrdersUpdated = array();
|
61 |
// Parcour du fichier
|
62 |
if (($handle = fopen($importFolder . DS . $file, "r")) !== FALSE) {
|
@@ -96,7 +98,15 @@ class Addonline_Gls_Model_Import
|
|
96 |
$count --;
|
97 |
}
|
98 |
} catch (Exception $e) {
|
99 |
-
Mage::log(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
}
|
102 |
|
@@ -113,7 +123,7 @@ class Addonline_Gls_Model_Import
|
|
113 |
return $count;
|
114 |
}
|
115 |
|
116 |
-
private function _createShipment($order, $trackcode)
|
117 |
{
|
118 |
if ($order->canShip()) {
|
119 |
/**
|
@@ -143,9 +153,9 @@ class Addonline_Gls_Model_Import
|
|
143 |
$shipment->register();
|
144 |
|
145 |
$arrTracking = array(
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
);
|
150 |
|
151 |
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
@@ -158,12 +168,18 @@ class Addonline_Gls_Model_Import
|
|
158 |
$this->_saveOrder($order);
|
159 |
return 1;
|
160 |
} else {
|
161 |
-
$this->addError(
|
|
|
|
|
|
|
|
|
|
|
162 |
return 0;
|
163 |
}
|
164 |
}
|
165 |
|
166 |
-
protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order,
|
|
|
167 |
{
|
168 |
$shipment->getOrder()->setIsInProcess(true);
|
169 |
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)
|
@@ -179,7 +195,7 @@ class Addonline_Gls_Model_Import
|
|
179 |
return $this;
|
180 |
}
|
181 |
|
182 |
-
protected function _saveOrder(Mage_Sales_Model_Order $order)
|
183 |
{
|
184 |
// $order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
|
185 |
// $order->setData('status', Mage_Sales_Model_Order::STATE_COMPLETE);
|
@@ -188,7 +204,7 @@ class Addonline_Gls_Model_Import
|
|
188 |
return $this;
|
189 |
}
|
190 |
|
191 |
-
protected function addError($message)
|
192 |
{
|
193 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
194 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Model_Import
|
28 |
{
|
37 |
|
38 |
public $fileCharset;
|
39 |
|
40 |
+
public function run ()
|
41 |
{
|
42 |
Mage::log('run GLS import', null, self::LOG_FILE);
|
43 |
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
public function import ()
|
50 |
{
|
51 |
$importFolder = Mage::helper('gls')->getImportFolder();
|
52 |
if (! is_dir($importFolder)) {
|
57 |
|
58 |
// Parcour du dossier
|
59 |
while ($file = readdir($dir)) {
|
60 |
+
if ($file != '.' && $file != '..' && ! is_dir($importFolder . $file) &&
|
61 |
+
strpos($file, 'GlsWinExpe6_') !== FALSE) {
|
62 |
$aOrdersUpdated = array();
|
63 |
// Parcour du fichier
|
64 |
if (($handle = fopen($importFolder . DS . $file, "r")) !== FALSE) {
|
98 |
$count --;
|
99 |
}
|
100 |
} catch (Exception $e) {
|
101 |
+
Mage::log(
|
102 |
+
Mage::helper('gls')->__(
|
103 |
+
'Shipment creation error for Order %s : %s',
|
104 |
+
$key,
|
105 |
+
$e->getMessage()
|
106 |
+
),
|
107 |
+
null,
|
108 |
+
self::LOG_FILE
|
109 |
+
);
|
110 |
}
|
111 |
}
|
112 |
|
123 |
return $count;
|
124 |
}
|
125 |
|
126 |
+
private function _createShipment ($order, $trackcode)
|
127 |
{
|
128 |
if ($order->canShip()) {
|
129 |
/**
|
153 |
$shipment->register();
|
154 |
|
155 |
$arrTracking = array(
|
156 |
+
'carrier_code' => $order->getShippingCarrier()->getCarrierCode(),
|
157 |
+
'title' => $order->getShippingCarrier()->getConfigData('title'),
|
158 |
+
'number' => $trackcode
|
159 |
);
|
160 |
|
161 |
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
168 |
$this->_saveOrder($order);
|
169 |
return 1;
|
170 |
} else {
|
171 |
+
$this->addError(
|
172 |
+
Mage::helper('gls')->__(
|
173 |
+
'Order %s can not be shipped or has already been shipped',
|
174 |
+
$order->getRealOrderId()
|
175 |
+
)
|
176 |
+
);
|
177 |
return 0;
|
178 |
}
|
179 |
}
|
180 |
|
181 |
+
protected function _saveShipment (Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order,
|
182 |
+
$customerEmailComments = '')
|
183 |
{
|
184 |
$shipment->getOrder()->setIsInProcess(true);
|
185 |
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)
|
195 |
return $this;
|
196 |
}
|
197 |
|
198 |
+
protected function _saveOrder (Mage_Sales_Model_Order $order)
|
199 |
{
|
200 |
// $order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
|
201 |
// $order->setData('status', Mage_Sales_Model_Order::STATE_COMPLETE);
|
204 |
return $this;
|
205 |
}
|
206 |
|
207 |
+
protected function addError ($message)
|
208 |
{
|
209 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
210 |
}
|
app/code/community/Addonline/Gls/Model/Observer.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,23 +19,26 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Model_Observer extends Varien_Object
|
27 |
{
|
28 |
|
29 |
-
public function __construct()
|
30 |
-
{
|
|
|
|
|
31 |
|
32 |
-
public function checkoutEventGlsdata($observer)
|
33 |
{
|
34 |
$quote = $observer->getEvent()->getQuote();
|
35 |
$request = Mage::app()->getRequest();
|
36 |
|
37 |
-
// si on n'a pas le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de
|
|
|
38 |
// dans ce cas on ne change rien
|
39 |
if (! $request->getParam('shipping_method')) {
|
40 |
return $this;
|
@@ -46,33 +50,37 @@ class Addonline_Gls_Model_Observer extends Varien_Object
|
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
-
public function setShippingRelayAddress($observer)
|
50 |
{
|
51 |
-
$
|
52 |
$quote = $observer->getEvent()->getQuote();
|
53 |
$shippingAddress = $quote->getShippingAddress();
|
54 |
$billingAddress = $quote->getBillingAddress();
|
55 |
$shippingMethod = $shippingAddress->getShippingMethod();
|
56 |
if (strpos($shippingMethod, 'gls_relay') !== false) {
|
57 |
$request = Mage::app()->getRequest();
|
58 |
-
// si on a le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de
|
|
|
59 |
// il faut mettre à jour l'addresse de livraison si on a le mode de livraison relais
|
60 |
-
if ($
|
61 |
-
Mage::getSingleton('checkout/session')->setData(
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
$shippingAddress->setData('
|
|
|
|
|
|
|
67 |
$shippingAddress->setData('save_in_address_book', 0);
|
68 |
-
if ($
|
69 |
-
$shippingAddress->setData('telephone', $
|
70 |
} else {
|
71 |
$shippingAddress->setData('telephone', $shippingAddress->getData('telephone'));
|
72 |
}
|
73 |
}
|
74 |
} else {
|
75 |
-
if ($
|
76 |
// Si l'adresse était une adresse de relais colis (on a les données en session) :
|
77 |
// on réinitialise l'adresse de livraison avec l'adresse de facturation
|
78 |
$shippingAddress->setData('prefix', $billingAddress->getData('prefix'));
|
@@ -88,7 +96,7 @@ class Addonline_Gls_Model_Observer extends Varien_Object
|
|
88 |
}
|
89 |
}
|
90 |
|
91 |
-
public function addGlsInformationsToOrder($observer)
|
92 |
{
|
93 |
try {
|
94 |
// puis on vide les données en session
|
@@ -108,7 +116,7 @@ class Addonline_Gls_Model_Observer extends Varien_Object
|
|
108 |
->save();
|
109 |
}
|
110 |
} catch (Exception $e) {
|
111 |
-
Mage::Log('Failed to save GLS data : ' . print_r($shippingData, true));
|
112 |
}
|
113 |
}
|
114 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Model_Observer extends Varien_Object
|
28 |
{
|
29 |
|
30 |
+
public function __construct ()
|
31 |
+
{
|
32 |
+
|
33 |
+
}
|
34 |
|
35 |
+
public function checkoutEventGlsdata ($observer)
|
36 |
{
|
37 |
$quote = $observer->getEvent()->getQuote();
|
38 |
$request = Mage::app()->getRequest();
|
39 |
|
40 |
+
// si on n'a pas le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de
|
41 |
+
// livraison
|
42 |
// dans ce cas on ne change rien
|
43 |
if (! $request->getParam('shipping_method')) {
|
44 |
return $this;
|
50 |
return $this;
|
51 |
}
|
52 |
|
53 |
+
public function setShippingRelayAddress ($observer)
|
54 |
{
|
55 |
+
$shippingData = Mage::getSingleton('checkout/session')->getData('gls_shipping_relay_data');
|
56 |
$quote = $observer->getEvent()->getQuote();
|
57 |
$shippingAddress = $quote->getShippingAddress();
|
58 |
$billingAddress = $quote->getBillingAddress();
|
59 |
$shippingMethod = $shippingAddress->getShippingMethod();
|
60 |
if (strpos($shippingMethod, 'gls_relay') !== false) {
|
61 |
$request = Mage::app()->getRequest();
|
62 |
+
// si on a le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de
|
63 |
+
// livraison :
|
64 |
// il faut mettre à jour l'addresse de livraison si on a le mode de livraison relais
|
65 |
+
if ($shippingData && $request->getParam('shipping_method')) {
|
66 |
+
Mage::getSingleton('checkout/session')->setData(
|
67 |
+
'gls_shipping_warnbyphone',
|
68 |
+
$shippingData['warnbyphone']
|
69 |
+
);
|
70 |
+
Mage::getSingleton('checkout/session')->setData('gls_relay_id', $shippingData['relayId']);
|
71 |
+
$shippingAddress->setData('company', $shippingData['name']);
|
72 |
+
$shippingAddress->setData('street', $shippingData['address']);
|
73 |
+
$shippingAddress->setData('city', $shippingData['city']);
|
74 |
+
$shippingAddress->setData('postcode', $shippingData['zipcode']);
|
75 |
$shippingAddress->setData('save_in_address_book', 0);
|
76 |
+
if ($shippingData['phone']) {
|
77 |
+
$shippingAddress->setData('telephone', $shippingData['phone']);
|
78 |
} else {
|
79 |
$shippingAddress->setData('telephone', $shippingAddress->getData('telephone'));
|
80 |
}
|
81 |
}
|
82 |
} else {
|
83 |
+
if ($shippingData) {
|
84 |
// Si l'adresse était une adresse de relais colis (on a les données en session) :
|
85 |
// on réinitialise l'adresse de livraison avec l'adresse de facturation
|
86 |
$shippingAddress->setData('prefix', $billingAddress->getData('prefix'));
|
96 |
}
|
97 |
}
|
98 |
|
99 |
+
public function addGlsInformationsToOrder ($observer)
|
100 |
{
|
101 |
try {
|
102 |
// puis on vide les données en session
|
116 |
->save();
|
117 |
}
|
118 |
} catch (Exception $e) {
|
119 |
+
Mage::Log('Failed to save GLS data : ' . print_r($shippingData, true), null, 'gls.log');
|
120 |
}
|
121 |
}
|
122 |
}
|
app/code/community/Addonline/Gls/Model/Sales/Quote/Address.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,18 +19,18 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
|
27 |
{
|
28 |
-
|
29 |
-
/*
|
30 |
-
* @see Mage_Sales_Model_Quote_Address::getGroupedAllShippingRates()
|
31 |
*/
|
32 |
-
public function getGroupedAllShippingRates()
|
33 |
{
|
34 |
$rates = array();
|
35 |
foreach ($this->getShippingRatesCollection() as $rate) {
|
@@ -42,10 +43,7 @@ class Addonline_Gls_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Add
|
|
42 |
$rates[$rate->getCarrier()][0]->carrier_sort_order = $rate->getCarrierInstance()->getSortOrder();
|
43 |
}
|
44 |
}
|
45 |
-
uasort($rates, array(
|
46 |
-
$this,
|
47 |
-
'_sortRates'
|
48 |
-
));
|
49 |
|
50 |
/*
|
51 |
* On tri selon les paramètres du Back office
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
|
28 |
{
|
29 |
+
|
30 |
+
/*
|
31 |
+
* (non-PHPdoc) @see Mage_Sales_Model_Quote_Address::getGroupedAllShippingRates()
|
32 |
*/
|
33 |
+
public function getGroupedAllShippingRates ()
|
34 |
{
|
35 |
$rates = array();
|
36 |
foreach ($this->getShippingRatesCollection() as $rate) {
|
43 |
$rates[$rate->getCarrier()][0]->carrier_sort_order = $rate->getCarrierInstance()->getSortOrder();
|
44 |
}
|
45 |
}
|
46 |
+
uasort($rates, array($this,'_sortRates'));
|
|
|
|
|
|
|
47 |
|
48 |
/*
|
49 |
* On tri selon les paramètres du Back office
|
app/code/community/Addonline/Gls/Model/Service.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,17 +19,17 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_Model_Service
|
27 |
{
|
28 |
|
29 |
protected $_urlWsdl;
|
30 |
|
31 |
-
public function getUrlWsdl()
|
32 |
{
|
33 |
if (! $this->_urlWsdl) {
|
34 |
$this->_urlWsdl = "http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/ParcelShopSearch/wsdl/2010_01_ParcelShopSearch.wsdl";
|
@@ -36,7 +37,7 @@ class Addonline_Gls_Model_Service
|
|
36 |
return $this->_urlWsdl;
|
37 |
}
|
38 |
|
39 |
-
public function getRelayPointsForZipCode($zipcode, $country)
|
40 |
{
|
41 |
$login = Mage::getStoreConfig('carriers/gls/usernamews');
|
42 |
$mdp = Mage::getStoreConfig('carriers/gls/passws');
|
@@ -46,37 +47,50 @@ class Addonline_Gls_Model_Service
|
|
46 |
else
|
47 |
require_once dirname(__FILE__) . DS . 'Addonline_Gls_Model_Webservice_PointsRelaisWSService.php';
|
48 |
|
49 |
-
$pointsRelaisWSService = new PointsRelaisWSService(array(
|
50 |
-
'trace' => TRUE
|
51 |
-
), $this->getUrlWsdl());
|
52 |
-
// $aParameters = array('UserName' =>$login,'Password' =>$mdp,'ZipCode' => $zipcode,'Country' => $country);
|
53 |
-
|
54 |
-
$aParameters = array(
|
55 |
-
'Credentials' => array(
|
56 |
-
'UserName' => $login,
|
57 |
-
'Password' => $mdp
|
58 |
-
),
|
59 |
-
'Address' => array(
|
60 |
-
'Name1' => '',
|
61 |
-
'Name2' => '',
|
62 |
-
'Name3' => '',
|
63 |
-
'Street1' => '',
|
64 |
-
'BlockNo1' => '',
|
65 |
-
'Street2' => '',
|
66 |
-
'BlockNo2' => '',
|
67 |
-
'ZipCode' => $zipcode,
|
68 |
-
'City' => '',
|
69 |
-
'Province' => '',
|
70 |
-
'Country' => $country
|
71 |
-
)
|
72 |
-
);
|
73 |
-
|
74 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
$result = $pointsRelaisWSService->findRelayPoints($aParameters);
|
76 |
return $result;
|
77 |
} catch (SoapFault $fault) {
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
}
|
82 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_Model_Service
|
28 |
{
|
29 |
|
30 |
protected $_urlWsdl;
|
31 |
|
32 |
+
public function getUrlWsdl ()
|
33 |
{
|
34 |
if (! $this->_urlWsdl) {
|
35 |
$this->_urlWsdl = "http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/ParcelShopSearch/wsdl/2010_01_ParcelShopSearch.wsdl";
|
37 |
return $this->_urlWsdl;
|
38 |
}
|
39 |
|
40 |
+
public function getRelayPointsForZipCode ($zipcode, $country)
|
41 |
{
|
42 |
$login = Mage::getStoreConfig('carriers/gls/usernamews');
|
43 |
$mdp = Mage::getStoreConfig('carriers/gls/passws');
|
47 |
else
|
48 |
require_once dirname(__FILE__) . DS . 'Addonline_Gls_Model_Webservice_PointsRelaisWSService.php';
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
try {
|
51 |
+
$pointsRelaisWSService = new PointsRelaisWSService(
|
52 |
+
array('trace' => TRUE),
|
53 |
+
$this->getUrlWsdl()
|
54 |
+
);
|
55 |
+
// $aParameters = array('UserName' =>$login,'Password' =>$mdp,'ZipCode' => $zipcode,'Country' => $country);
|
56 |
+
|
57 |
+
$aParameters = array(
|
58 |
+
'Credentials' => array('UserName' => $login,'Password' => $mdp
|
59 |
+
),
|
60 |
+
'Address' => array(
|
61 |
+
'Name1' => '',
|
62 |
+
'Name2' => '',
|
63 |
+
'Name3' => '',
|
64 |
+
'Street1' => '',
|
65 |
+
'BlockNo1' => '',
|
66 |
+
'Street2' => '',
|
67 |
+
'BlockNo2' => '',
|
68 |
+
'ZipCode' => $zipcode,
|
69 |
+
'City' => '',
|
70 |
+
'Province' => '',
|
71 |
+
'Country' => $country
|
72 |
+
)
|
73 |
+
);
|
74 |
+
|
75 |
$result = $pointsRelaisWSService->findRelayPoints($aParameters);
|
76 |
return $result;
|
77 |
} catch (SoapFault $fault) {
|
78 |
+
/* On va flusher le cache wsdl, car parfois une mise à jour du WS peut nécéssiter un flush de ce cache */
|
79 |
+
foreach (glob(sys_get_temp_dir() . DS . 'wsdl*') as $filename) {
|
80 |
+
if (strpos(file_get_contents($filename), $this->getUrlWsdl()) !== false) {
|
81 |
+
unlink($filename);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
if (isset($pointRetraitServiceWSService)) {
|
85 |
+
Mage::log('Request ' . $pointRetraitServiceWSService->__getLastRequest(), null, 'gls.log');
|
86 |
+
Mage::log('Response ' . $pointRetraitServiceWSService->__getLastResponse(), null, 'gls.log');
|
87 |
+
}
|
88 |
+
Mage::log($fault, null, 'gls.log');
|
89 |
+
$result = new Varien_Object();
|
90 |
+
$result->exitCode = new Varien_Object();
|
91 |
+
$result->exitCode->ErrorCode = 500;
|
92 |
+
$result->exitCode->ErrorDscr = 'Erreur WebService : ' . $fault->faultcode . ' ' . $fault->faultstring;
|
93 |
+
return $result;
|
94 |
}
|
95 |
}
|
96 |
}
|
app/code/community/Addonline/Gls/controllers/AjaxController.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
27 |
{
|
@@ -29,13 +30,14 @@ class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
|
29 |
/**
|
30 |
* Affiche le bloc selector
|
31 |
*/
|
32 |
-
public function selectorAction()
|
33 |
{
|
34 |
// Creation du block
|
35 |
$this->loadLayout();
|
36 |
-
$block = $this->getLayout()->createBlock(
|
37 |
-
'
|
38 |
-
|
|
|
39 |
$this->getLayout()
|
40 |
->getBlock('content')
|
41 |
->append($block);
|
@@ -45,7 +47,7 @@ class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
|
45 |
/**
|
46 |
* affiche la liste des Point relais
|
47 |
*/
|
48 |
-
public function listPointsRelaisAction()
|
49 |
{
|
50 |
$aPointsRelais = array();
|
51 |
$response = new Varien_Object();
|
@@ -54,52 +56,79 @@ class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
|
54 |
$country = $this->getRequest()->getParam('country', false);
|
55 |
|
56 |
$listrelais = Mage::getSingleton('gls/service')->getRelayPointsForZipCode($zipcode, $country);
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
} else {
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$onlyxlrelay = Mage::getStoreConfig('carriers/gls/onlyxlrelay') || ($productMaxWeight > Mage::getStoreConfig('carriers/gls/maxrelayweight'));
|
69 |
-
foreach ($listrelais->SearchResults as $key => $pointRelais) {
|
70 |
-
|
71 |
-
if ($onlyxlrelay && substr($pointRelais->Parcelshop->Address->Name1, strlen($pointRelais->Parcelshop->Address->Name1) - 2, strlen($pointRelais->Parcelshop->Address->Name1)) != 'XL') {
|
72 |
-
continue;
|
73 |
}
|
74 |
-
$aRelay = array();
|
75 |
-
$aRelay['relayId'] = $pointRelais->Parcelshop->ParcelShopId;
|
76 |
-
$aRelay['relayName'] = $pointRelais->Parcelshop->Address->Name1 . ' ' . $pointRelais->Parcelshop->Address->Name2 . ' ' . $pointRelais->Parcelshop->Address->Name3;
|
77 |
-
$aRelay['relayAddress'] = $pointRelais->Parcelshop->Address->Street1 . ' ' . $pointRelais->Parcelshop->Address->BlockNo1 . ' ' . $pointRelais->Parcelshop->Address->Street2 . ' ' . $pointRelais->Parcelshop->Address->BlockNo2;
|
78 |
-
$aRelay['relayZipCode'] = $pointRelais->Parcelshop->Address->ZipCode;
|
79 |
-
$aRelay['relayCity'] = $pointRelais->Parcelshop->Address->City;
|
80 |
-
$aRelay['relayCountry'] = $pointRelais->Parcelshop->Address->Country;
|
81 |
-
$aRelay['relayLatitude'] = $pointRelais->Parcelshop->GLSCoordinates->Latitude;
|
82 |
-
$aRelay['relayLongitude'] = $pointRelais->Parcelshop->GLSCoordinates->Longitude;
|
83 |
|
84 |
-
$
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$
|
90 |
-
$
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
-
|
94 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
}
|
97 |
-
|
98 |
// Creation du block
|
99 |
$this->loadLayout();
|
100 |
-
$block = $this->getLayout()->createBlock(
|
101 |
-
'
|
102 |
-
|
|
|
|
|
103 |
$block->setListRelay($aPointsRelais);
|
104 |
$this->getLayout()
|
105 |
->getBlock('content')
|
@@ -110,7 +139,7 @@ class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
|
110 |
/**
|
111 |
* enregsitre en session
|
112 |
*/
|
113 |
-
public function saveInSessionRelayInformationsAction()
|
114 |
{
|
115 |
if (count($_GET)) {
|
116 |
Mage::getSingleton('checkout/session')->setData('gls_shipping_relay_data', $_GET);
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
28 |
{
|
30 |
/**
|
31 |
* Affiche le bloc selector
|
32 |
*/
|
33 |
+
public function selectorAction ()
|
34 |
{
|
35 |
// Creation du block
|
36 |
$this->loadLayout();
|
37 |
+
$block = $this->getLayout()->createBlock(
|
38 |
+
'Addonline_Gls_Block_Selector', 'root',
|
39 |
+
array('template' => 'gls/selector.phtml')
|
40 |
+
);
|
41 |
$this->getLayout()
|
42 |
->getBlock('content')
|
43 |
->append($block);
|
47 |
/**
|
48 |
* affiche la liste des Point relais
|
49 |
*/
|
50 |
+
public function listPointsRelaisAction ()
|
51 |
{
|
52 |
$aPointsRelais = array();
|
53 |
$response = new Varien_Object();
|
56 |
$country = $this->getRequest()->getParam('country', false);
|
57 |
|
58 |
$listrelais = Mage::getSingleton('gls/service')->getRelayPointsForZipCode($zipcode, $country);
|
59 |
+
|
60 |
+
if (! isset($listrelais->exitCode->ErrorCode)) {
|
61 |
+
echo $this->__('Error call GLS webservice, it might be down, see var/log/gls.log');
|
62 |
} else {
|
63 |
+
if ($listrelais->exitCode->ErrorCode == 0) {
|
64 |
+
$productMaxWeight = 0;
|
65 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
66 |
+
foreach ($items as $item) {
|
67 |
+
$productMaxWeight = (($productMaxWeight > $item->getWeight()) ?
|
68 |
+
$productMaxWeight : $item->getWeight());
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
+
$onlyxlrelay = Mage::getStoreConfig('carriers/gls/onlyxlrelay') ||
|
72 |
+
($productMaxWeight > Mage::getStoreConfig('carriers/gls/maxrelayweight'));
|
73 |
+
foreach ($listrelais->SearchResults as $key => $pointRelais) {
|
74 |
+
|
75 |
+
$endName = substr(
|
76 |
+
$pointRelais->Parcelshop->Address->Name1,
|
77 |
+
strlen($pointRelais->Parcelshop->Address->Name1) - 2,
|
78 |
+
strlen($pointRelais->Parcelshop->Address->Name1)
|
79 |
+
);
|
80 |
+
|
81 |
+
if ($onlyxlrelay && $endName != 'XL') {
|
82 |
+
continue;
|
83 |
}
|
84 |
+
$aRelay = array();
|
85 |
+
$aRelay['relayId'] = $pointRelais->Parcelshop->ParcelShopId;
|
86 |
+
$aRelay['relayName'] = $pointRelais->Parcelshop->Address->Name1 . ' ' .
|
87 |
+
$pointRelais->Parcelshop->Address->Name2 . ' ' .
|
88 |
+
$pointRelais->Parcelshop->Address->Name3;
|
89 |
+
$aRelay['relayAddress'] = $pointRelais->Parcelshop->Address->Street1 . ' ' .
|
90 |
+
$pointRelais->Parcelshop->Address->BlockNo1 . ' ' .
|
91 |
+
$pointRelais->Parcelshop->Address->Street2 . ' ' .
|
92 |
+
$pointRelais->Parcelshop->Address->BlockNo2;
|
93 |
+
$aRelay['relayZipCode'] = $pointRelais->Parcelshop->Address->ZipCode;
|
94 |
+
$aRelay['relayCity'] = $pointRelais->Parcelshop->Address->City;
|
95 |
+
$aRelay['relayCountry'] = $pointRelais->Parcelshop->Address->Country;
|
96 |
+
$aRelay['relayLatitude'] = $pointRelais->Parcelshop->GLSCoordinates->Latitude;
|
97 |
+
$aRelay['relayLongitude'] = $pointRelais->Parcelshop->GLSCoordinates->Longitude;
|
98 |
+
|
99 |
+
$relayWorkingDays = array();
|
100 |
+
for ($i = 0; $i < 7; $i ++) {
|
101 |
+
if (isset($pointRelais->Parcelshop->GLSWorkingDay[$i])) {
|
102 |
+
$relayWorkingDays[$i]['hours']['from'] =
|
103 |
+
$pointRelais->Parcelshop->GLSWorkingDay[$i]->OpeningHours->Hours->From;
|
104 |
+
$relayWorkingDays[$i]['hours']['to'] =
|
105 |
+
$pointRelais->Parcelshop->GLSWorkingDay[$i]->OpeningHours->Hours->To;
|
106 |
+
$relayWorkingDays[$i]['breaks']['from'] =
|
107 |
+
$pointRelais->Parcelshop->GLSWorkingDay[$i]->Breaks->Hours->From;
|
108 |
+
$relayWorkingDays[$i]['breaks']['to'] =
|
109 |
+
$pointRelais->Parcelshop->GLSWorkingDay[$i]->Breaks->Hours->To;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
$aRelay['relayWorkingDays'] = $relayWorkingDays;
|
113 |
+
$aPointsRelais[$pointRelais->Parcelshop->ParcelShopId] = $aRelay;
|
114 |
}
|
115 |
+
} elseif ($listrelais->exitCode->ErrorCode == 502) {
|
116 |
+
echo $this->__('Authentification error GLS webservice, login or password might be wrong');
|
117 |
+
} elseif ($listrelais->exitCode->ErrorCode == 998) {
|
118 |
+
// Aucune donnée ne correspond à la recherche. La requête est formulée correctement mais aucun
|
119 |
+
// résultat dans la base de données points relais GLS.
|
120 |
+
echo $this->__('Aucun relais ne correspond à votre recherche');
|
121 |
+
} else {
|
122 |
+
echo $listrelais->exitCode->ErrorDscr;
|
123 |
}
|
124 |
}
|
|
|
125 |
// Creation du block
|
126 |
$this->loadLayout();
|
127 |
+
$block = $this->getLayout()->createBlock(
|
128 |
+
'Addonline_Gls_Block_Listrelay',
|
129 |
+
'root',
|
130 |
+
array('template' => 'gls/listrelais.phtml')
|
131 |
+
);
|
132 |
$block->setListRelay($aPointsRelais);
|
133 |
$this->getLayout()
|
134 |
->getBlock('content')
|
139 |
/**
|
140 |
* enregsitre en session
|
141 |
*/
|
142 |
+
public function saveInSessionRelayInformationsAction ()
|
143 |
{
|
144 |
if (count($_GET)) {
|
145 |
Mage::getSingleton('checkout/session')->setData('gls_shipping_relay_data', $_GET);
|
app/code/community/Addonline/Gls/controllers/ExportController.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_ExportController extends Mage_Adminhtml_Controller_Action
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_ExportController extends Mage_Adminhtml_Controller_Action
|
|
29 |
/**
|
30 |
* Constructor
|
31 |
*/
|
32 |
-
protected function _construct()
|
33 |
{
|
34 |
$this->setUsedModuleName('Addonline_Gls');
|
35 |
}
|
@@ -37,19 +38,20 @@ class Addonline_Gls_ExportController extends Mage_Adminhtml_Controller_Action
|
|
37 |
/**
|
38 |
* Main action : show orders list
|
39 |
*/
|
40 |
-
public function indexAction()
|
41 |
{
|
42 |
$this->loadLayout()
|
43 |
->_setActiveMenu('gls/export')
|
44 |
-
->_addContent(
|
45 |
-
|
|
|
46 |
->renderLayout();
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* Export Action : Generates a CSV file to download
|
51 |
*/
|
52 |
-
public function exportAction()
|
53 |
{
|
54 |
/* get the orders */
|
55 |
$orderIds = $this->getRequest()->getPost('order_ids');
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_ExportController extends Mage_Adminhtml_Controller_Action
|
28 |
{
|
30 |
/**
|
31 |
* Constructor
|
32 |
*/
|
33 |
+
protected function _construct ()
|
34 |
{
|
35 |
$this->setUsedModuleName('Addonline_Gls');
|
36 |
}
|
38 |
/**
|
39 |
* Main action : show orders list
|
40 |
*/
|
41 |
+
public function indexAction ()
|
42 |
{
|
43 |
$this->loadLayout()
|
44 |
->_setActiveMenu('gls/export')
|
45 |
+
->_addContent(
|
46 |
+
$this->getLayout()->createBlock('gls/export_orders')
|
47 |
+
)
|
48 |
->renderLayout();
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
* Export Action : Generates a CSV file to download
|
53 |
*/
|
54 |
+
public function exportAction ()
|
55 |
{
|
56 |
/* get the orders */
|
57 |
$orderIds = $this->getRequest()->getPost('order_ids');
|
app/code/community/Addonline/Gls/controllers/ImportController.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Copyright (c) 2014 GLS
|
4 |
*
|
@@ -18,10 +19,10 @@
|
|
18 |
/**
|
19 |
* Addonline_Gls
|
20 |
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
-
* @copyright
|
24 |
-
* @author
|
25 |
*/
|
26 |
class Addonline_Gls_ImportController extends Mage_Adminhtml_Controller_Action
|
27 |
{
|
@@ -29,7 +30,7 @@ class Addonline_Gls_ImportController extends Mage_Adminhtml_Controller_Action
|
|
29 |
/**
|
30 |
* Constructor
|
31 |
*/
|
32 |
-
protected function _construct()
|
33 |
{
|
34 |
$this->setUsedModuleName('Addonline_Gls');
|
35 |
}
|
@@ -37,27 +38,31 @@ class Addonline_Gls_ImportController extends Mage_Adminhtml_Controller_Action
|
|
37 |
/**
|
38 |
* Main action : show import form
|
39 |
*/
|
40 |
-
public function indexAction()
|
41 |
{
|
42 |
$this->loadLayout()
|
43 |
->_setActiveMenu('gls/import')
|
44 |
-
->_addContent(
|
45 |
-
|
46 |
-
->renderLayout();
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* Import Action
|
51 |
*/
|
52 |
-
public function importAction()
|
53 |
{
|
54 |
$import = Mage::getModel('gls/import');
|
55 |
-
$
|
56 |
|
57 |
-
if ($
|
58 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
|
|
|
|
59 |
} else {
|
60 |
-
Mage::getSingleton('adminhtml/session')->addError(
|
|
|
|
|
61 |
}
|
62 |
$this->_redirect('*/*/');
|
63 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Copyright (c) 2014 GLS
|
5 |
*
|
19 |
/**
|
20 |
* Addonline_Gls
|
21 |
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Gls
|
24 |
+
* @copyright Copyright (c) 2014 GLS
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
*/
|
27 |
class Addonline_Gls_ImportController extends Mage_Adminhtml_Controller_Action
|
28 |
{
|
30 |
/**
|
31 |
* Constructor
|
32 |
*/
|
33 |
+
protected function _construct ()
|
34 |
{
|
35 |
$this->setUsedModuleName('Addonline_Gls');
|
36 |
}
|
38 |
/**
|
39 |
* Main action : show import form
|
40 |
*/
|
41 |
+
public function indexAction ()
|
42 |
{
|
43 |
$this->loadLayout()
|
44 |
->_setActiveMenu('gls/import')
|
45 |
+
->_addContent(
|
46 |
+
$this->getLayout()->createBlock('gls/import_form')
|
47 |
+
)->renderLayout();
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Import Action
|
52 |
*/
|
53 |
+
public function importAction ()
|
54 |
{
|
55 |
$import = Mage::getModel('gls/import');
|
56 |
+
$nbrImported = $import->import();
|
57 |
|
58 |
+
if ($nbrImported) {
|
59 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
60 |
+
$nbrImported . ' ' . $this->__('Orders have been imported')
|
61 |
+
);
|
62 |
} else {
|
63 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
64 |
+
$this->__('No orders to import in the folder ') . Mage::helper('gls')->getImportFolder()
|
65 |
+
);
|
66 |
}
|
67 |
$this->_redirect('*/*/');
|
68 |
}
|
app/code/community/Addonline/Gls/etc/config.xml
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Addonline_Gls>
|
22 |
-
<version>1.0.
|
23 |
<depends>
|
24 |
<Mage_Shipping />
|
25 |
</depends>
|
@@ -31,6 +31,11 @@
|
|
31 |
<gls>
|
32 |
<class>Addonline_Gls_Block</class>
|
33 |
</gls>
|
|
|
|
|
|
|
|
|
|
|
34 |
</blocks>
|
35 |
<helpers>
|
36 |
<gls>
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Addonline_Gls>
|
22 |
+
<version>1.0.3</version>
|
23 |
<depends>
|
24 |
<Mage_Shipping />
|
25 |
</depends>
|
31 |
<gls>
|
32 |
<class>Addonline_Gls_Block</class>
|
33 |
</gls>
|
34 |
+
<onestepcheckout>
|
35 |
+
<rewrite>
|
36 |
+
<checkout>Addonline_Gls_Block_OneStepCheckout_Checkout</checkout>
|
37 |
+
</rewrite>
|
38 |
+
</onestepcheckout>
|
39 |
</blocks>
|
40 |
<helpers>
|
41 |
<gls>
|
app/code/community/Addonline/Gls/etc/system.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
<carriers>
|
22 |
<groups>
|
23 |
<gls translate="label" module="gls">
|
24 |
-
<label>GLS</label>
|
25 |
<frontend_type>text</frontend_type>
|
26 |
<sort_order>18</sort_order>
|
27 |
<show_in_default>1</show_in_default>
|
21 |
<carriers>
|
22 |
<groups>
|
23 |
<gls translate="label" module="gls">
|
24 |
+
<label>GLS, votre partenaire transport</label>
|
25 |
<frontend_type>text</frontend_type>
|
26 |
<sort_order>18</sort_order>
|
27 |
<show_in_default>1</show_in_default>
|
app/code/community/Addonline/Gls/owebia_includes/OwebiaShippingHelper_GLS.php
CHANGED
@@ -397,7 +397,7 @@ class OwebiaShippingHelper_GLS
|
|
397 |
$conditions = $this->getRowProperty($row, 'conditions');
|
398 |
//ADDONLINE : on exclu la livraison GLS si un article dépasse le point max XL (30kg)
|
399 |
$code = $row['*id'];
|
400 |
-
$conditionGLS = '({count items where
|
401 |
if (isset($conditions)) {
|
402 |
$conditions .= ' && '.$conditionGLS;
|
403 |
} else {
|
@@ -471,7 +471,7 @@ class OwebiaShippingHelper_GLS
|
|
471 |
if (isset($row[$key]['value'])) {
|
472 |
$property = $row[$key]['value'];
|
473 |
if ($key == 'label' || $key == 'description' ) {
|
474 |
-
|
475 |
$property = Mage::helper('gls')->__($property);
|
476 |
}
|
477 |
$output = $property;
|
397 |
$conditions = $this->getRowProperty($row, 'conditions');
|
398 |
//ADDONLINE : on exclu la livraison GLS si un article dépasse le point max XL (30kg)
|
399 |
$code = $row['*id'];
|
400 |
+
$conditionGLS = '({count items where product.weight > '.Mage::getStoreConfig('carriers/gls/maxxlrelayweight').'} == 0)';
|
401 |
if (isset($conditions)) {
|
402 |
$conditions .= ' && '.$conditionGLS;
|
403 |
} else {
|
471 |
if (isset($row[$key]['value'])) {
|
472 |
$property = $row[$key]['value'];
|
473 |
if ($key == 'label' || $key == 'description' ) {
|
474 |
+
//Mage::log('getRowProperty '.$property, null, 'gls.log');
|
475 |
$property = Mage::helper('gls')->__($property);
|
476 |
}
|
477 |
$output = $property;
|
app/locale/fr_FR/Addonline_Gls.csv
CHANGED
@@ -39,8 +39,10 @@
|
|
39 |
"Import tracking","Importer les numéros de suivi"
|
40 |
"{debug_help}","Affichage du debug sur le panier lors d'une estimation de livraison"
|
41 |
"{importexport_help}","Après enregistrement du changement de valeur, il faut se déconnecter et se reconnecter afin de faire apparaitre le nouveau menu"
|
42 |
-
"
|
43 |
-
|
|
|
|
|
44 |
# app/code/local/Addonline/Gls/Block/Adminhtml/Os2/Editor.php
|
45 |
"New shipping method","Nouvelle méthode de livraison"
|
46 |
"Remove","Supprimer"
|
39 |
"Import tracking","Importer les numéros de suivi"
|
40 |
"{debug_help}","Affichage du debug sur le panier lors d'une estimation de livraison"
|
41 |
"{importexport_help}","Après enregistrement du changement de valeur, il faut se déconnecter et se reconnecter afin de faire apparaitre le nouveau menu"
|
42 |
+
"Authentification error GLS webservice, login or password might be wrong","Erreur authentification Webservice GLS, Login ou mot de passe incorrects"
|
43 |
+
"Error call GLS webservice, it might be down, see var/log/gls.log","Erreur appel webservice GLS, il doit être hors service, voir var/log/gls.log"
|
44 |
+
"No ParcelShop fit your search","Aucun relais ne correspond à votre recherche"
|
45 |
+
|
46 |
# app/code/local/Addonline/Gls/Block/Adminhtml/Os2/Editor.php
|
47 |
"New shipping method","Nouvelle méthode de livraison"
|
48 |
"Remove","Supprimer"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Addonline_Gls</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -39,9 +39,9 @@ Vous n’êtes pas encore client GLS, prenez vite contact avec nous : g
|
|
39 |
</description>
|
40 |
<notes>RAS</notes>
|
41 |
<authors><author><name>Addonline</name><user>addonline</user><email>contact@addonline.fr</email></author></authors>
|
42 |
-
<date>2014-
|
43 |
-
<time>
|
44 |
-
<contents><target name="magecommunity"><dir name="Addonline"><dir name="Gls"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Config.php" hash="
|
45 |
<compatible/>
|
46 |
<dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
|
47 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Addonline_Gls</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
39 |
</description>
|
40 |
<notes>RAS</notes>
|
41 |
<authors><author><name>Addonline</name><user>addonline</user><email>contact@addonline.fr</email></author></authors>
|
42 |
+
<date>2014-07-04</date>
|
43 |
+
<time>10:45:44</time>
|
44 |
+
<contents><target name="magecommunity"><dir name="Addonline"><dir name="Gls"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Config.php" hash="958fc83f82dd4faa008bd92869e5cc49"/><file name="Informations.php" hash="b372c0fbb1b84cc012782bc1cb99685c"/></dir></dir></dir></dir></dir><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="4b277602bd6908d9b6747733fe1a53ac"/></dir><file name="Orders.php" hash="19b038fe15bd7ccc445dbded573ba417"/></dir><dir name="Import"><file name="Form.php" hash="5017a2fc58636214a7e361dbf76d6406"/></dir><file name="Listrelay.php" hash="cb0fc25e5bf89de25b797e8dec0227de"/><dir name="OneStepCheckout"><file name="Checkout.php" hash="e797538c0576937b6670bc6de7297942"/></dir><file name="Selector.php" hash="5e226804c12cf7b843d06b430d63ab7d"/></dir><file name="GLS_14_GuideInstallationModuleMagento_07.pdf" hash="fe30a61e9539b84a24fda681e335aff8"/><dir name="Helper"><file name="Data.php" hash="f12719337ebb017814a3767df54d54b8"/><dir name="OneStepCheckout"><file name="Checkout.php" hash="4e2adceed7bff56bae6f57d321b6856e"/></dir></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="7b234759e465f105f130b6ce67b652af"/><file name="ShippingMethod.php" hash="7b03a4f9a6d198bfbe7a80ab48343afc"/></dir><file name="Export.php" hash="d588c23379729722949154faecfac143"/><file name="Import.php" hash="ffd85138df5d8b18be785f9a9f190d62"/><file name="Observer.php" hash="ee5c92a8f6f8e419907555a80c3bd3e3"/><dir name="Os2"><dir name="Data"><file name="Abstract.php" hash="cf7d7d51c0908e9b5cc08224ee399636"/><file name="AbstractWithAttributes.php" hash="1aa1eb14f97aa3add7a0b64ef73bfe3b"/><file name="Address.php" hash="7c890ba9f1c53124857afbe6ae2c9f15"/><file name="AddressFilter.php" hash="dd42df6d750b32fd7cd7ac76ce08e3e8"/><file name="AttributeSet.php" hash="5d9c06b56ee855da5489991342b1eca2"/><file name="Billto.php" hash="3244e2dd918527f68ea29433c1c02eaf"/><file name="Cart.php" hash="72c3d3c57a7f366d97a4b4957a34272e"/><file name="CartItem.php" hash="b2067067bbb396d3f7c311d2b023a975"/><file name="Category.php" hash="c140772d71740330fbe66f8f79c7a3a5"/><file name="Customer.php" hash="9a2185b18922472a235fc69f022f00b8"/><file name="CustomerGroup.php" hash="c713d2f93ebbe1208b7d94b0a433b45e"/><file name="Customvar.php" hash="badab1052f9156aef76d5c1a0919348e"/><file name="Date.php" hash="3f93564d011f3f2b7d0caba6a1eddf28"/><file name="Info.php" hash="f2a9302fa56e58c027e7df18e6666ffa"/><file name="Product.php" hash="a48c5d512cc87950c25194fc1fdb27a9"/><file name="Quote.php" hash="9804f0da7dd9255b21d240ff59beed0b"/><file name="Selection.php" hash="b61d47ae7048ee2e86b622f4fb473236"/><file name="StockItem.php" hash="02252936341dd9ed77fa6e7205d43c14"/><file name="Store.php" hash="3d9b4033ff9689d9ed07d5c5fa5b68ad"/></dir></dir><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="145da0de58c0da564d38f4b8dcc535ad"/></dir></dir><file name="Service.php" hash="e1ba3d882a1227d5a58df3ec8dab6f65"/><dir name="System"><dir name="Config"><dir name="Source"><file name="LoadOnParent.php" hash="9dd7fc02abf059f724220b8dc4559110"/><file name="ProcessChildren.php" hash="5fb9c1cf8600e9ead938869f95016267"/></dir></dir></dir><dir name="Webservice"><file name="PointsRelaisWSService.php" hash="e5d9ee0793a35ef36b110ca07d9701aa"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="19d793890aa777a2c0d071bc2d8fd10f"/><file name="ExportController.php" hash="b4297358859a6473e790d8a6c5a979ae"/><file name="ImportController.php" hash="0f0eab8e544dc8cbb9c7428c8e7d11e1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a250aa03bbef4cb0e2016a23d8797eb5"/><file name="config.xml" hash="a16a7820af6c72b134591c6b33f90e16"/><file name="system.xml" hash="fbda63fbf7bcbd929858306f24bd3359"/></dir><dir name="owebia_includes"><file name="OS2_AddressFilter.php" hash="9a436fe014d55491a416adb0d8478d7e"/><file name="OS2_AddressFilterParser_GLS.php" hash="8f53f491dee35100dccfb6769577317d"/><file name="OS2_CustomerGroup.php" hash="55a9f08487bdbb310d0123737e0a7e9c"/><file name="OwebiaShippingHelper_GLS.php" hash="c22a635f8ec74c27eff6736b0ebd4b2b"/><dir name="cache"><file name="countries" hash="6b1a5494b6dddcc65f2946dbf0226c29"/></dir></dir><dir name="sql"><dir name="gls_setup"><file name="mysql4-install-1.0.0.php" hash="f6fc56f69d25c888f2d43ab2cf325660"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="gls.xml" hash="f21000e0cebbd7dc2e41269ca5e26055"/></dir><dir name="template"><dir name="gls"><file name="additional.phtml" hash="0418b6448ee50a094e0611cc6161b5ca"/><file name="listrelais.phtml" hash="435226bbece90126c407c4ff3252ac88"/><file name="selector.phtml" hash="6e5f50efeadad01fc87c23b823c38971"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="gls"><dir name="import"><file name="form.phtml" hash="6881f6dfac3b32fcf2385d517fed80c1"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Addonline_Gls.xml" hash="db260e73c2dad1f28966032a661336bf"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Addonline_Gls.csv" hash="0e637fb534f28dbde8ce553a98fd5611"/></dir><dir name="en_US"><file name="Addonline_Gls.csv" hash="96e4b64437cb483e3010ad9c7aa1eb19"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.7.1.min.js" hash="ddb84c1587287b2df08966081ef063bf"/><file name="jquery.noconflict.js" hash="47bba3ca4c65f94846c39e145bed446f"/><file name="jquery.tools.min.js" hash="b0d4ed5c2edf5bcb74cd615ee46feb79"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="gls.css" hash="597cb48748bf3cc24b787dad0eeebb6d"/></dir><dir name="images"><dir name="gls"><file name="btn_fermer.png" hash="58a433ef56074381c61a3bc416605b8b"/><file name="marker.png" hash="4c52822636e198d8e407b143af2eb4b3"/><file name="marker_current.png" hash="9aad92afa544f45be79dd49977c71c54"/><file name="picto-arrow.png" hash="e6c75a88103b56cde0c8f2f5db1abba2"/><file name="picto_relay.png" hash="f80a398509e93b7077b166ddaa755abc"/><file name="picto_tohome.png" hash="42abf1332ac5dcd16673d3b216a2a121"/><file name="picto_toyou.png" hash="066908bd4639344eed0396950bd77895"/><file name="search-repeat.png" hash="ddf661a783afc11958972a86278c818b"/><file name="title-repeat.png" hash="ffc9c726e21a9dc862c29283500aa271"/></dir></dir><dir name="js"><file name="gls.js" hash="7cd11dc6fe9126f830477601f996de23"/></dir></dir></dir></dir></target></contents>
|
45 |
<compatible/>
|
46 |
<dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
|
47 |
</package>
|
skin/frontend/base/default/js/gls.js
CHANGED
@@ -54,8 +54,8 @@ jQuery(function($) {
|
|
54 |
// choisi gls
|
55 |
jQuery('.onestepcheckout-index-index .address-select').on("change", function() {
|
56 |
if(jQuery('#gls-location').size() <= 0 ){
|
57 |
-
$("#
|
58 |
-
$("label[for=\"billing-address-select\"]").parent().before('<p id="
|
59 |
}
|
60 |
});
|
61 |
|
54 |
// choisi gls
|
55 |
jQuery('.onestepcheckout-index-index .address-select').on("change", function() {
|
56 |
if(jQuery('#gls-location').size() <= 0 ){
|
57 |
+
$("#attentionGLS").remove();
|
58 |
+
$("label[for=\"billing-address-select\"]").parent().before('<p id="attentionGLS" style="font-weight:bold;color:red;text-align:justify; padding-right:5px;">Suite à la modification de votre adresse et si votre mode de livraison est GLS, veuillez séléctionner votre point de retrait en cliquant sur le mode de livraison.</p>');
|
59 |
}
|
60 |
});
|
61 |
|