Version Notes
New version
Download this release
Release Info
Developer | Stathis Kapaniaris |
Extension | Sendabox_Sendabox |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 2.0.0
- CityOrigin.php +0 -29
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment.php +0 -15
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit.php +0 -123
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Form.php +0 -22
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Tab/Form/Boxes.php +0 -8
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Tabs.php +0 -14
- app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Grid.php +0 -115
- app/code/community/Sendabox/Sendabox/Helper/Data.php +0 -247
- app/code/community/Sendabox/Sendabox/Model/Box.php +0 -35
- app/code/community/Sendabox/Sendabox/Model/Carrier.php +0 -54
- app/code/community/Sendabox/Sendabox/Model/Observer.php +0 -226
- app/code/community/Sendabox/Sendabox/Model/Quote.php +0 -80
- app/code/community/Sendabox/Sendabox/Model/Resource/Box.php +0 -11
- app/code/community/Sendabox/Sendabox/Model/Resource/Box/Collection.php +0 -12
- app/code/community/Sendabox/Sendabox/Model/Resource/Carrier.php +0 -11
- app/code/community/Sendabox/Sendabox/Model/Resource/Carrier/Collection.php +0 -12
- app/code/community/Sendabox/Sendabox/Model/Resource/Quote.php +0 -11
- app/code/community/Sendabox/Sendabox/Model/Resource/Quote/Collection.php +0 -74
- app/code/community/Sendabox/Sendabox/Model/Resource/Shipment.php +0 -11
- app/code/community/Sendabox/Sendabox/Model/Resource/Shipment/Collection.php +0 -29
- app/code/community/Sendabox/Sendabox/Model/Shipment.php +0 -230
- app/code/community/Sendabox/Sendabox/Model/Shipping/Carrier/Sendabox.php +0 -320
- app/code/community/Sendabox/Sendabox/Model/Shipping/Carrier/Sendabox/Source/Method.php +0 -74
- app/code/community/Sendabox/Sendabox/Model/System/Config/Backend/Form/Field/Required/Text.php +0 -17
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source.php +0 -82
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Errorprocess.php +0 -17
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Insurance.php +0 -19
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Pricing.php +0 -21
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Shipment/Status.php +0 -17
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit.php +0 -56
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit/Measure.php +0 -28
- app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit/Weight.php +0 -28
- app/code/community/Sendabox/Sendabox/controllers/Adminhtml/ShipmentController.php +0 -260
- app/code/community/Sendabox/Sendabox/etc/adminhtml.xml +0 -73
- app/code/community/Sendabox/Sendabox/etc/config.xml +0 -168
- app/code/community/Sendabox/Sendabox/etc/system.xml +0 -476
- app/code/community/Sendabox/Sendabox/sql/sendabox_sendabox_setup/mysql4-install-1.0.0.php +0 -205
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Check.php +17 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order.php +18 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit.php +50 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Form.php +21 -0
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Abstract.php +8 -8
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form.php +6 -7
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Anywhere.php +1 -1
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Tab/Form/Boxes.php +8 -0
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Products.php +1 -1
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Quotes.php +1 -1
- app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Status.php +1 -1
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Tabs.php +16 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Grid.php +99 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/LDV.php +12 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/NameSurname.php +16 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/Price.php +15 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/Tracking.php +15 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment.php +21 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit.php +52 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Form.php +344 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Abstract.php +64 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Content.php +116 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form.php +35 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Anywhere.php +8 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Boxes.php +8 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Products.php +18 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Quotes.php +50 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Status.php +27 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Image.php +107 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Main.php +115 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tabs.php +16 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Grid.php +109 -0
- app/code/community/Sendabox/Shippingext/Block/Adminhtml/System/Config/Agenda/Button.php +37 -0
- app/code/community/Sendabox/{Sendabox → Shippingext}/Block/Adminhtml/System/Config/Form/Field/Required.php +1 -1
- app/code/community/Sendabox/{Sendabox → Shippingext}/Block/Adminhtml/System/Config/Form/Fieldset/General.php +1 -1
- app/code/community/Sendabox/Shippingext/Helper/Data.php +15 -0
- app/code/community/Sendabox/Shippingext/Model/Agenda.php +17 -0
- app/code/community/Sendabox/Shippingext/Model/Box.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Create.php +19 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Agenda.php +21 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Agenda/Collection.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Box.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Box/Collection.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Shipment.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Resource/Shipment/Collection.php +16 -0
- app/code/community/Sendabox/Shippingext/Model/Shipment.php +16 -0
- app/code/community/Sendabox/Shippingext/controllers/Adminhtml/AjaxController.php +697 -0
- app/code/community/Sendabox/Shippingext/controllers/Adminhtml/OrderController.php +71 -0
- app/code/community/Sendabox/Shippingext/controllers/Adminhtml/ShipmentController.php +76 -0
- app/code/community/Sendabox/Shippingext/etc/adminhtml.xml +52 -0
- app/code/community/Sendabox/Shippingext/etc/config.xml +89 -0
- app/code/community/Sendabox/Shippingext/etc/system.xml +84 -0
- app/code/community/Sendabox/Shippingext/sql/sendabox_shippingext_setup/mysql4-data-install-2.0.0.php +15 -0
- app/code/community/Sendabox/Shippingext/sql/sendabox_shippingext_setup/mysql4-install-2.0.0.php +175 -0
- app/code/community/Sendabox/Shippingext/tmp/100000095.xml +36 -0
- app/code/community/Sendabox/Shippingext/tmp/100000211.xml +36 -0
- app/code/community/Sendabox/Shippingext/tmp/145000003.xml +36 -0
- app/code/community/Sendabox/Shippingext/tmp/145000006.xml +36 -0
- app/code/community/Sendabox/Shippingext/tmp/145000007.xml +36 -0
- app/design/adminhtml/default/default/layout/sendabox.xml +57 -21
- app/design/adminhtml/default/default/template/sendabox/order.phtml +204 -0
- app/design/adminhtml/default/default/template/sendabox/shippingform.phtml +594 -0
- app/design/adminhtml/default/default/template/sendabox/system/config/agenda/button.phtml +21 -0
- app/etc/modules/Sendabox_Sendabox.xml +0 -19
- app/etc/modules/Sendabox_Shippingext.xml +12 -0
- js/sendabox/autocomplete.js +0 -7
- package.xml +10 -15
- skin/adminhtml/default/default/sendabox/sendabox.css +28 -19
CityOrigin.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$destination_city = $_REQUEST['destination_city'];
|
3 |
-
if(isset($destination_city)){
|
4 |
-
$destination_city = str_replace(" ", "%20", $destination_city);
|
5 |
-
$url = 'http://www.sendabox.it/_magento/get/city?q=' .$destination_city;
|
6 |
-
$html = file_get_contents($url);
|
7 |
-
if ($html) {
|
8 |
-
$chiamata = json_decode($html, true);
|
9 |
-
if(!is_array($chiamata)) { $chiamata = array($chiamata); }
|
10 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
11 |
-
//echo $chiamata['msg'];
|
12 |
-
return;
|
13 |
-
}
|
14 |
-
else {
|
15 |
-
if(count($chiamata)==0) return;
|
16 |
-
echo "<ul>" ;
|
17 |
-
foreach($chiamata as $suggest){
|
18 |
-
$city = explode('-',$suggest['label'])[0];
|
19 |
-
$id= $suggest['id'];
|
20 |
-
echo "<li id='$id'>$city</li>";
|
21 |
-
}
|
22 |
-
echo "</ul>" ;
|
23 |
-
}
|
24 |
-
} else {
|
25 |
-
//echo 'ERRORE CHIAMATA';
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
$this->_blockGroup = 'sendabox_sendabox';
|
9 |
-
$this->_controller = 'adminhtml_shipment';
|
10 |
-
$this->_headerText = Mage::helper('sendabox_sendabox')->__('Manage Shipments');
|
11 |
-
parent::__construct();
|
12 |
-
$this->removeButton('add');
|
13 |
-
}
|
14 |
-
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit.php
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $_shipment;
|
7 |
-
|
8 |
-
public function __construct()
|
9 |
-
{
|
10 |
-
parent::__construct();
|
11 |
-
$this->_blockGroup = 'sendabox_sendabox';
|
12 |
-
$this->_controller = 'adminhtml_shipment';
|
13 |
-
|
14 |
-
$this->removeButton('save');
|
15 |
-
$this->removeButton('delete');
|
16 |
-
|
17 |
-
$add_button_method = 'addButton';
|
18 |
-
if (!method_exists($this, $add_button_method)) {
|
19 |
-
$add_button_method = '_addButton';
|
20 |
-
}
|
21 |
-
|
22 |
-
if ($this->getShipment()->getStatus() == Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status::PENDING) {
|
23 |
-
$this->$add_button_method('getquote', array(
|
24 |
-
'label' => Mage::helper('sendabox_sendabox')->__('Save and Get Quotes'),
|
25 |
-
'id' => 'getquote',
|
26 |
-
'onclick' => 'saveAndGetQuotes()',
|
27 |
-
'value' => '',
|
28 |
-
'class' => 'save',
|
29 |
-
));
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
-
$max_boxes = 40;
|
34 |
-
$script = "
|
35 |
-
function saveAndGetQuotes() {
|
36 |
-
editForm.submit($('edit_form').action+'and/getquotes/');
|
37 |
-
}
|
38 |
-
|
39 |
-
function box_add() {
|
40 |
-
num_boxes = $$('table#boxes tbody tr').length - 1;
|
41 |
-
if (num_boxes < $max_boxes) {
|
42 |
-
if (!box_add.highest_num) {
|
43 |
-
box_add.highest_num = num_boxes;
|
44 |
-
}
|
45 |
-
// add a new box (row) to the table
|
46 |
-
new_row = new Element('tr');
|
47 |
-
new_row.id = 'box_row_' + ++box_add.highest_num;
|
48 |
-
new_row
|
49 |
-
.addClassName(box_add.highest_num % 2 ? 'odd' : 'even')
|
50 |
-
.addClassName('new_box')
|
51 |
-
.insert($('blank_box_row').innerHTML
|
52 |
-
.replace(/@@id@@/g, box_add.highest_num)
|
53 |
-
.replace(/box_blank/g, 'box'));
|
54 |
-
|
55 |
-
$$('table#boxes tbody')[0].insert(new_row);
|
56 |
-
return box_add.highest_num;
|
57 |
-
} else {
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
function box_clear() {
|
63 |
-
// remove all rows in the table.
|
64 |
-
$$('table#boxes tr.existing_box, table#boxes tr.new_box').each(function (row) {
|
65 |
-
row.remove();
|
66 |
-
});
|
67 |
-
}
|
68 |
-
|
69 |
-
function box_remove(num) {
|
70 |
-
row = $('box_row_' + num);
|
71 |
-
if ($('box_' + num + '_id') && $('boxes_deleted')) {
|
72 |
-
if (!$('boxes_deleted').value.length == 0) {
|
73 |
-
$('boxes_deleted').value += ',';
|
74 |
-
}
|
75 |
-
$('boxes_deleted').value += $('box_' + num + '_id').value;
|
76 |
-
}
|
77 |
-
if (row) {
|
78 |
-
row.remove();
|
79 |
-
}
|
80 |
-
}
|
81 |
-
";
|
82 |
-
|
83 |
-
$this->_formScripts[] = $script;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Gets the shipment being edited.
|
88 |
-
*
|
89 |
-
* @return Sendabox_Sendabox_Model_Shipment
|
90 |
-
*/
|
91 |
-
public function getShipment()
|
92 |
-
{
|
93 |
-
if (!$this->_shipment) {
|
94 |
-
$this->_shipment = Mage::registry('sendabox_shipment_data');
|
95 |
-
}
|
96 |
-
return $this->_shipment;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Gets the current order for the shipment being edited.
|
101 |
-
*
|
102 |
-
* @return Mage_Sales_Model_Order
|
103 |
-
*/
|
104 |
-
public function getOrder()
|
105 |
-
{
|
106 |
-
if($this->getShipment()) {
|
107 |
-
return $this->getShipment()->getOrder();
|
108 |
-
}
|
109 |
-
return null;
|
110 |
-
}
|
111 |
-
|
112 |
-
public function getHeaderText()
|
113 |
-
{
|
114 |
-
if ($this->getShipment() && $this->getShipment()->getId()) {
|
115 |
-
return $foo= Mage::helper('sendabox_sendabox')->__(
|
116 |
-
'Order # %s | %s',
|
117 |
-
$this->htmlEscape($this->getShipment()->getOrder()->getRealOrderId()),
|
118 |
-
$this->htmlEscape($this->formatDate($this->getShipment()->getOrder()->getCreatedAtDate(), 'medium', true))
|
119 |
-
);
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Form.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _prepareForm()
|
7 |
-
{
|
8 |
-
$form = new Varien_Data_Form(
|
9 |
-
array(
|
10 |
-
'id' => 'edit_form',
|
11 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
12 |
-
'method' => 'post',
|
13 |
-
'enctype' => 'multipart/form-data'
|
14 |
-
)
|
15 |
-
);
|
16 |
-
|
17 |
-
$form->setUseContainer(true);
|
18 |
-
$this->setForm($form);
|
19 |
-
return parent::_prepareForm();
|
20 |
-
}
|
21 |
-
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Tab/Form/Boxes.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Form_Boxes extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Edit/Tabs.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setId('sendabox_shipment_edit_tabs');
|
10 |
-
$this->setDestElementId('edit_form');
|
11 |
-
$this->setTitle(Mage::helper('sendabox_sendabox')->__('Shipment View'));
|
12 |
-
}
|
13 |
-
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Block/Adminhtml/Shipment/Grid.php
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Block_Adminhtml_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setSaveParametersInSession(true);
|
10 |
-
}
|
11 |
-
|
12 |
-
protected function _prepareLayout() {
|
13 |
-
parent::_prepareLayout();
|
14 |
-
return $this;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function getMainButtonsHtml() {
|
18 |
-
$html = '';
|
19 |
-
if ($this->getFilterVisibility()) {
|
20 |
-
$html.= $this->getResetFilterButtonHtml();
|
21 |
-
$html.= $this->getSearchButtonHtml();
|
22 |
-
}
|
23 |
-
return $html;
|
24 |
-
}
|
25 |
-
|
26 |
-
protected function _prepareCollection()
|
27 |
-
{
|
28 |
-
$collection = Mage::getModel('sendabox_sendabox/shipment')->getCollection();
|
29 |
-
$collection->join('sales/order', 'main_table.order_id=`sales/order`.entity_id', array('increment_id', 'created_at', 'shipping_amount'));
|
30 |
-
/* @var $collection Sendabox_Sendabox_Model_Shipment */
|
31 |
-
|
32 |
-
$collection->getSelect()->order(array(
|
33 |
-
'main_table.status ASC',
|
34 |
-
'created_at DESC'
|
35 |
-
));
|
36 |
-
|
37 |
-
$this->setCollection($collection);
|
38 |
-
return parent::_prepareCollection();
|
39 |
-
}
|
40 |
-
|
41 |
-
protected function _prepareColumns()
|
42 |
-
{
|
43 |
-
$this->addColumn('order_number', array(
|
44 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Order #'),
|
45 |
-
'width' => '100px',
|
46 |
-
'index' => 'increment_id',
|
47 |
-
));
|
48 |
-
|
49 |
-
$this->addColumn('created_at', array(
|
50 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Purchased On'),
|
51 |
-
'width' => '160px',
|
52 |
-
'type' => 'datetime',
|
53 |
-
'index' => 'created_at',
|
54 |
-
'filter_index' => '`sales/order`.created_at',
|
55 |
-
));
|
56 |
-
|
57 |
-
$this->addColumn('status', array(
|
58 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Status'),
|
59 |
-
'index' => 'status',
|
60 |
-
'type' => 'options',
|
61 |
-
'width' => '100px',
|
62 |
-
'options' => Mage::getSingleton('sendabox_sendabox/system_config_source_shipment_status')->getOptions(),
|
63 |
-
'filter_index' => 'main_table.status',
|
64 |
-
));
|
65 |
-
|
66 |
-
$this->addColumn('anticipated_cost', array(
|
67 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Anticipated Cost'),
|
68 |
-
'align' => 'left',
|
69 |
-
'type' => 'currency',
|
70 |
-
'currency_code' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
71 |
-
'index' => 'shipping_amount',
|
72 |
-
));
|
73 |
-
|
74 |
-
$this->addColumn('shipping_paid', array(
|
75 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Shipping Paid'),
|
76 |
-
'align' => 'left',
|
77 |
-
'type' => 'currency',
|
78 |
-
'currency_code' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
79 |
-
'index' => 'customer_cost',
|
80 |
-
));
|
81 |
-
|
82 |
-
$this->addColumn('selected_quote_description', array(
|
83 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Customer Selected Quote'),
|
84 |
-
'align' => 'left',
|
85 |
-
'index' => 'customer_selected_quote_description',
|
86 |
-
));
|
87 |
-
|
88 |
-
$this->addColumn('action', array(
|
89 |
-
'header' => Mage::helper('sendabox_sendabox')->__('Action'),
|
90 |
-
'width' => '100',
|
91 |
-
'type' => 'action',
|
92 |
-
'getter' => 'getId',
|
93 |
-
'actions' => array(
|
94 |
-
'view' => array(
|
95 |
-
'caption' => Mage::helper('sendabox_sendabox')->__('View'),
|
96 |
-
'url' => array('base' => '*/*/edit'),
|
97 |
-
'field' => 'id'
|
98 |
-
)
|
99 |
-
),
|
100 |
-
'filter' => false,
|
101 |
-
'sortable' => false,
|
102 |
-
'index' => 'stores',
|
103 |
-
'is_system' => true,
|
104 |
-
));
|
105 |
-
|
106 |
-
return parent::_prepareColumns();
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
public function getRowUrl($row)
|
111 |
-
{
|
112 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Helper/Data.php
DELETED
@@ -1,247 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
-
|
5 |
-
const DEFAULT_WAREHOUSE_NAME = 'Magento Warehouse';
|
6 |
-
|
7 |
-
private $_sendaboxAttributes = array(
|
8 |
-
'sendabox_length',
|
9 |
-
'sendabox_width',
|
10 |
-
'sendabox_height'
|
11 |
-
);
|
12 |
-
|
13 |
-
protected $_allowedCountries = array(
|
14 |
-
'IT' => 'Italia',
|
15 |
-
);
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Retrieves an element from the module configuration data.
|
19 |
-
*
|
20 |
-
* @param string $field
|
21 |
-
*/
|
22 |
-
public function getConfigData($field) {
|
23 |
-
$path = 'sendabox_options/' . $field;
|
24 |
-
return Mage::getStoreConfig($path);
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Returns array of allowed countries based on Magento system configuration
|
29 |
-
* and Sendabox plugin allowed countries.
|
30 |
-
*
|
31 |
-
* @return array
|
32 |
-
*/
|
33 |
-
public function getAllowedCountries() {
|
34 |
-
$specific = Mage::getStoreConfig('carriers/sendabox_sendabox/sallowspecific');
|
35 |
-
//check if all allowed and return selected
|
36 |
-
if($specific == 1) {
|
37 |
-
$availableCountries = explode(',', Mage::getStoreConfig('carriers/sendabox_sendabox/specificcountry'));
|
38 |
-
$countries = array_intersect_key($this->_allowedCountries, array_flip($availableCountries));
|
39 |
-
return $countries;
|
40 |
-
}
|
41 |
-
//return all allowed
|
42 |
-
return $this->_allowedCountries;
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Retrieve Default Sendabox Product Attributes from Configuration
|
49 |
-
*
|
50 |
-
* @return array
|
51 |
-
*/
|
52 |
-
public function getDefaultSendaboxAttributes()
|
53 |
-
{
|
54 |
-
return array(
|
55 |
-
|
56 |
-
'sendabox_length' => (float)$this->getConfigData('defaults/length'),
|
57 |
-
'sendabox_width' => (float)$this->getConfigData('defaults/width'),
|
58 |
-
'senadbox_height' => (float)$this->getConfigData('defaults/height'),
|
59 |
-
);
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Converts given weight from configured unit to grams
|
64 |
-
*
|
65 |
-
* @param float $value Weight to convert
|
66 |
-
* @param string $currentUnit Current weight unit
|
67 |
-
* @return float Converted weight in grams
|
68 |
-
*/
|
69 |
-
public function getWeightInKGrams($value, $currentUnit = null)
|
70 |
-
{
|
71 |
-
$value = floatval($value);
|
72 |
-
$currentUnit = $currentUnit ? $currentUnit : $this->getConfigData('units/weight');
|
73 |
-
//from units as specified in configuration
|
74 |
-
switch($currentUnit) {
|
75 |
-
|
76 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Unit_Weight::OUNCES:
|
77 |
-
return $value * 28.3495; break;
|
78 |
-
|
79 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Unit_Weight::POUNDS:
|
80 |
-
return $value * 453.592; break;
|
81 |
-
|
82 |
-
default: return $value; break;
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Converts given distance from configured unit to centimetres
|
88 |
-
*
|
89 |
-
* @param float $value Distance to convert
|
90 |
-
* @param string $currentUnit Current measure unit
|
91 |
-
* @return float Converted distance in centimetres
|
92 |
-
*/
|
93 |
-
public function getDistanceInCentimetres($value, $currentUnit = null)
|
94 |
-
{
|
95 |
-
$value = floatval($value);
|
96 |
-
$currentUnit = $currentUnit ? $currentUnit : $this->getConfigData('units/measure');
|
97 |
-
switch($currentUnit) {
|
98 |
-
|
99 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Unit_Measure::FEET:
|
100 |
-
return $value * 30.48; break;
|
101 |
-
|
102 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Unit_Measure::INCHES:
|
103 |
-
return $value * 2.54; break;
|
104 |
-
|
105 |
-
default: return $value; break;
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Returns region name saved in customers session
|
115 |
-
* @return string|null
|
116 |
-
*/
|
117 |
-
public function getSessionRegion() {
|
118 |
-
$data = Mage::getSingleton('customer/session')->getData('estimate_product_shipping');
|
119 |
-
if ($data) {
|
120 |
-
return Mage::getModel('directory/region')->load($data['region_id'])->getName();
|
121 |
-
}
|
122 |
-
|
123 |
-
return null;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Returns city name saved in customers session
|
128 |
-
* @return string|null
|
129 |
-
*/
|
130 |
-
public function getSessionCity() {
|
131 |
-
$data = Mage::getSingleton('customer/session')->getData('estimate_product_shipping');
|
132 |
-
if ($data) {
|
133 |
-
return $data['city'];
|
134 |
-
}
|
135 |
-
|
136 |
-
return null;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Returns postal code saved in customers session
|
141 |
-
* @return string|null
|
142 |
-
*/
|
143 |
-
public function getSessionPostcode() {
|
144 |
-
$data = Mage::getSingleton('customer/session')->getData('estimate_product_shipping');
|
145 |
-
if ($data) {
|
146 |
-
return $data['postcode'];
|
147 |
-
}
|
148 |
-
|
149 |
-
return null;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Returns id of the region saved in customers session
|
154 |
-
* @return int|null
|
155 |
-
*/
|
156 |
-
public function getSessionRegionId() {
|
157 |
-
$data = Mage::getSingleton('customer/session')->getData('estimate_product_shipping');
|
158 |
-
if ($data) {
|
159 |
-
return $data['region_id'];
|
160 |
-
}
|
161 |
-
|
162 |
-
return null;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Return list of available origin locations
|
167 |
-
*
|
168 |
-
* @return array
|
169 |
-
*/
|
170 |
-
public function getLocationList() {
|
171 |
-
return array(
|
172 |
-
self::DEFAULT_WAREHOUSE_NAME => self::DEFAULT_WAREHOUSE_NAME
|
173 |
-
);
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Returns location create/update request array
|
178 |
-
*
|
179 |
-
* @return array
|
180 |
-
*/
|
181 |
-
public function getOriginRequestArray(Varien_Object $data) {
|
182 |
-
return array(
|
183 |
-
'description' => self::DEFAULT_WAREHOUSE_NAME,
|
184 |
-
'type' => 'Origin',
|
185 |
-
'contactName' => $data->getContactName(),
|
186 |
-
'companyName' => $data->getCompanyName(),
|
187 |
-
'street' => $data->getStreet(),
|
188 |
-
'suburb' => $data->getCity(),
|
189 |
-
'state' => $data->getRegion(),
|
190 |
-
'code' => $data->getPostcode(),
|
191 |
-
'country' => $data->getCountry(),
|
192 |
-
'phone1' => $data->getPhone1(),
|
193 |
-
'phone2' => $data->getPhone2(),
|
194 |
-
'fax' => $data->getFax(),
|
195 |
-
'email' => $data->getEmail(),
|
196 |
-
'loadingFacilities' => $data->getLoadingFacilities() ? 'Y' : 'N',
|
197 |
-
'forklift' => $data->getForklift() ? 'Y' : 'N',
|
198 |
-
'dock' => $data->getDock() ? 'Y' : 'N',
|
199 |
-
'limitedAccess' => $data->getLimitedAccess() ? 'Y' : 'N',
|
200 |
-
'postalBox' => $data->getPobox() ? 'Y' : 'N'
|
201 |
-
);
|
202 |
-
}
|
203 |
-
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Returns true if shipping quote is dynamic quote
|
207 |
-
*
|
208 |
-
* @param int $quote_id
|
209 |
-
* @return boolean
|
210 |
-
*/
|
211 |
-
public function isQuoteDynamic($quote_id) {
|
212 |
-
$fixed_carriers = array(
|
213 |
-
Sendabox_Sendabox_Model_Carrier::FLAT_RATE,
|
214 |
-
Sendabox_Sendabox_Model_Carrier::FREE,
|
215 |
-
);
|
216 |
-
|
217 |
-
if (in_array($quote_id, $fixed_carriers)) {
|
218 |
-
return false;
|
219 |
-
}
|
220 |
-
|
221 |
-
return true;
|
222 |
-
}
|
223 |
-
|
224 |
-
|
225 |
-
public function getCheapestQuote($quotes)
|
226 |
-
{
|
227 |
-
$cheapest = null;
|
228 |
-
foreach ($quotes as $quote) {
|
229 |
-
$cheapest = $this->_getCheaper($quote, $cheapest);
|
230 |
-
}
|
231 |
-
return $cheapest;
|
232 |
-
}
|
233 |
-
|
234 |
-
protected function _getCheaper($a, $b)
|
235 |
-
{
|
236 |
-
// if one is null, return the other (if both are null, null is returned).
|
237 |
-
if (is_null($a)) {
|
238 |
-
return $b;
|
239 |
-
}
|
240 |
-
if (is_null($b)) {
|
241 |
-
return $a;
|
242 |
-
}
|
243 |
-
|
244 |
-
return $a->getTotalPrice() <= $b->getTotalPrice() ? $a : $b;
|
245 |
-
}
|
246 |
-
|
247 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Box.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @method string getShipmentId()
|
5 |
-
* @method string getComment()
|
6 |
-
* @method string getQty()
|
7 |
-
* @method string getLength()
|
8 |
-
* @method string getWidth()
|
9 |
-
* @method string getHeight()
|
10 |
-
* @method string getMeasureUnit()
|
11 |
-
* @method string getWeight()
|
12 |
-
* @method string getWeightUnit()
|
13 |
-
* @method string getFragile()
|
14 |
-
*
|
15 |
-
* @method Temando_Temando_Model_Box setShipmentId()
|
16 |
-
* @method Temando_Temando_Model_Box setComment()
|
17 |
-
* @method Temando_Temando_Model_Box setQty()
|
18 |
-
* @method Temando_Temando_Model_Box setLength()
|
19 |
-
* @method Temando_Temando_Model_Box setWidth()
|
20 |
-
* @method Temando_Temando_Model_Box setHeight()
|
21 |
-
* @method Temando_Temando_Model_Box setMeasureUnit()
|
22 |
-
* @method Temando_Temando_Model_Box setWeight()
|
23 |
-
* @method Temando_Temando_Model_Box setWeightUnit()
|
24 |
-
* @method Temando_Temando_Model_Box setFragile()
|
25 |
-
*/
|
26 |
-
class Sendabox_Sendabox_Model_Box extends Mage_Core_Model_Abstract
|
27 |
-
{
|
28 |
-
|
29 |
-
public function _construct()
|
30 |
-
{
|
31 |
-
parent::_construct();
|
32 |
-
$this->_init('sendabox_sendabox/box');
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Carrier.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @method Temando_Temando_Model_Carrier setCarrierId()
|
5 |
-
* @method Temando_Temando_Model_Carrier setCompanyName()
|
6 |
-
* @method Temando_Temando_Model_Carrier setCompanyContact()
|
7 |
-
* @method Temando_Temando_Model_Carrier setStreetAddress()
|
8 |
-
* @method Temando_Temando_Model_Carrier setStreetSuburb()
|
9 |
-
* @method Temando_Temando_Model_Carrier setStreetCity()
|
10 |
-
* @method Temando_Temando_Model_Carrier setStreetState()
|
11 |
-
* @method Temando_Temando_Model_Carrier setStreetPostode()
|
12 |
-
* @method Temando_Temando_Model_Carrier setStreetCountry()
|
13 |
-
* @method Temando_Temando_Model_Carrier setPostalAddress()
|
14 |
-
* @method Temando_Temando_Model_Carrier setPostalSuburb()
|
15 |
-
* @method Temando_Temando_Model_Carrier setPostalCity()
|
16 |
-
* @method Temando_Temando_Model_Carrier setPostalState()
|
17 |
-
* @method Temando_Temando_Model_Carrier setPostalPostcode()
|
18 |
-
* @method Temando_Temando_Model_Carrier setPostalCountry()
|
19 |
-
* @method Temando_Temando_Model_Carrier setPhone()
|
20 |
-
* @method Temando_Temando_Model_Carrier setEmail()
|
21 |
-
* @method Temando_Temando_Model_Carrier setWebsite()
|
22 |
-
*
|
23 |
-
* @method string getCarrierId()
|
24 |
-
* @method string getCompanyName()
|
25 |
-
* @method string getCompanyContact()
|
26 |
-
* @method string getStreetAddress()
|
27 |
-
* @method string getStreetSuburb()
|
28 |
-
* @method string getStreetCity()
|
29 |
-
* @method string getStreetState()
|
30 |
-
* @method string getStreetPostode()
|
31 |
-
* @method string getStreetCountry()
|
32 |
-
* @method string getPostalAddress()
|
33 |
-
* @method string getPostalSuburb()
|
34 |
-
* @method string getPostalCity()
|
35 |
-
* @method string getPostalState()
|
36 |
-
* @method string getPostalPostcode()
|
37 |
-
* @method string getPostalCountry()
|
38 |
-
* @method string getPhone()
|
39 |
-
* @method string getEmail()
|
40 |
-
* @method string getWebsite()
|
41 |
-
*/
|
42 |
-
class Sendabox_Sendabox_Model_Carrier extends Mage_Core_Model_Abstract
|
43 |
-
{
|
44 |
-
|
45 |
-
const FLAT_RATE = 'flat';
|
46 |
-
const FREE = 'free';
|
47 |
-
|
48 |
-
public function _construct()
|
49 |
-
{
|
50 |
-
parent::_construct();
|
51 |
-
$this->_init('sendabox_sendabox/carrier');
|
52 |
-
}
|
53 |
-
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Observer.php
DELETED
@@ -1,226 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Observer
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Magento passes a Varien_Event_Observer object as
|
7 |
-
* the first parameter of dispatched events.
|
8 |
-
*/
|
9 |
-
/*public function logSpedito(Varien_Event_Observer $observer)
|
10 |
-
{
|
11 |
-
// Retrieve the shipment being updated from the event observer
|
12 |
-
$shipment = $observer->getEvent()->getShipment();
|
13 |
-
|
14 |
-
// Write a new line to var/log/product-updates.log
|
15 |
-
$order = $shipment->getOrder();
|
16 |
-
$id = $order->getId();
|
17 |
-
Mage::log(
|
18 |
-
"{$id} spedito",
|
19 |
-
null,
|
20 |
-
'ordinispediti.log', true
|
21 |
-
);
|
22 |
-
$items = $order->getAllItems();
|
23 |
-
$itemcount=count($items);
|
24 |
-
$name=array();
|
25 |
-
$unitPrice=array();
|
26 |
-
$sku=array();
|
27 |
-
$ids=array();
|
28 |
-
$qty=array();
|
29 |
-
$weight=array();
|
30 |
-
$width=array();
|
31 |
-
$length=array();
|
32 |
-
$height=array();
|
33 |
-
Mage::log(
|
34 |
-
"{$itemcount} oggetti",
|
35 |
-
null,
|
36 |
-
'ordinispediti.log', true
|
37 |
-
);
|
38 |
-
$i=0;
|
39 |
-
foreach ($items as $itemId => $item)
|
40 |
-
{
|
41 |
-
$name[] = $item->getName();
|
42 |
-
$unitPrice[]=$item->getPrice();
|
43 |
-
$sku[]=$item->getSku();
|
44 |
-
$ids[]=$item->getProductId();
|
45 |
-
$qty[]=$item->getQtyToInvoice();
|
46 |
-
$weight[]=$item->getWeight();
|
47 |
-
$product = Mage::getModel('catalog/product')->load($ids[$i]);
|
48 |
-
$width[] = $product->getSendaboxWidth();
|
49 |
-
$length[] = $product->getSendaboxLength();
|
50 |
-
$height[] = $product->getSendaboxHeight();
|
51 |
-
Mage::log(
|
52 |
-
"nome: {$name[$i]},prezzo: {$unitPrice[$i]}, sku: {$sku[$i]}, id: {$ids[$i]}, quantità: {$qty[$i]}, peso: {$weight[$i]}, larghezza: {$width[$i]}, lunghezza: {$length[$i]}, altezza: {$height[$i]}",
|
53 |
-
null,
|
54 |
-
'ordinispediti.log', true
|
55 |
-
);
|
56 |
-
$i++;
|
57 |
-
}
|
58 |
-
}*/
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Handles sales_order_place_after event
|
62 |
-
*/
|
63 |
-
public function createSendaboxShipment(Varien_Event_Observer $observer)
|
64 |
-
{
|
65 |
-
$order = $observer->getOrder();
|
66 |
-
/* @var $order Mage_Sales_Model_Order */
|
67 |
-
|
68 |
-
if(!array_key_exists($order->getShippingAddress()->getCountryId(), Mage::helper('sendabox_sendabox')->getAllowedCountries()))
|
69 |
-
return;
|
70 |
-
|
71 |
-
$shippingMethod = $order->getShippingMethod();
|
72 |
-
$__t = explode('_', $shippingMethod);
|
73 |
-
$is_sandabox_quote = ($__t[0] == 'sendabox') ;
|
74 |
-
|
75 |
-
$selected_quote_id = preg_replace('#^([^_]*_){3}#', '', $shippingMethod);
|
76 |
-
|
77 |
-
if($is_sandabox_quote)
|
78 |
-
{
|
79 |
-
$selected_quote = Mage::getModel('sendabox_sendabox/quote')->load($selected_quote_id);
|
80 |
-
}
|
81 |
-
if(!$is_sandabox_quote or !$selected_quote->getId()) {
|
82 |
-
//try loading cheapeast quote
|
83 |
-
try {
|
84 |
-
$selected_quote = $this->loadCheapestQuote($order);
|
85 |
-
/* @var $selected_quote Sendabox_Sendabox_Model_Quote */
|
86 |
-
}
|
87 |
-
catch (Exception $e)
|
88 |
-
{
|
89 |
-
$selected_quote = null;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
$sendabox_shipment = Mage::getModel('sendabox_sendabox/shipment');
|
96 |
-
/* @var $sendabox_shipment Sendabox_Sendabox_Model_Shipment */
|
97 |
-
|
98 |
-
if($is_sandabox_quote && Mage::helper('sendabox_sendabox')->isQuoteDynamic($selected_quote_id)) {
|
99 |
-
//DYNAMIC: carrier quote selected by customer - must have at least 1 available quote
|
100 |
-
$sendabox_shipment
|
101 |
-
->setAdminSelectedQuoteId($selected_quote->getId())
|
102 |
-
->setCustomerSelectedQuoteId($selected_quote->getId());
|
103 |
-
$selected_quote = $sendabox_shipment->getSelectedQuote();
|
104 |
-
$sendabox_shipment
|
105 |
-
->setCustomerSelectedQuoteDescription($selected_quote->getDescription())
|
106 |
-
->setCustomerCost($selected_quote->getTotalPrice());
|
107 |
-
}
|
108 |
-
elseif(!$is_sandabox_quote){
|
109 |
-
$sendabox_shipment
|
110 |
-
->setCustomerSelectedQuoteDescription($order->getShippingDescription());
|
111 |
-
|
112 |
-
if($selected_quote instanceof Sendabox_Sendabox_Model_Quote) {
|
113 |
-
//set cheapest as admin selected
|
114 |
-
$sendabox_shipment->setAdminSelectedQuoteId($selected_quote->getId())
|
115 |
-
->setCustomerCost($selected_quote->getTotalPrice());
|
116 |
-
}
|
117 |
-
}
|
118 |
-
else {
|
119 |
-
//STATIC: flat rate / free shipping selected by customer
|
120 |
-
$sendabox_shipment
|
121 |
-
->setCustomerSelectedQuoteDescription('Free Shipping');
|
122 |
-
|
123 |
-
if($selected_quote instanceof Sendabox_Sendabox_Model_Quote) {
|
124 |
-
//set cheapest as admin selected
|
125 |
-
$sendabox_shipment->setAdminSelectedQuoteId($selected_quote->getId())
|
126 |
-
->setCustomerCost($selected_quote->getTotalPrice());
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
$email = $order->getShippingAddress()->getEmail();
|
131 |
-
if(!$email) {
|
132 |
-
$email = $order->getCustomerEmail();
|
133 |
-
}
|
134 |
-
|
135 |
-
$sendabox_shipment
|
136 |
-
->setOrderId($order->getId() ? $order->getId() : null)
|
137 |
-
->setStatus(Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status::PENDING)
|
138 |
-
->setDestinationName($order->getShippingAddress()->getFirstname())
|
139 |
-
->setDestinationSurname($order->getShippingAddress()->getLastname())
|
140 |
-
->setDestinationStreet(str_replace("\n", ', ', $order->getShippingAddress()->getStreetFull()))
|
141 |
-
->setDestinationPhone($order->getShippingAddress()->getTelephone())
|
142 |
-
->setDestinationEmail($email)
|
143 |
-
->setDestinationPostcode($order->getShippingAddress()->getPostcode())
|
144 |
-
->setDestinationCity($order->getShippingAddress()->getCity())
|
145 |
-
->save();
|
146 |
-
|
147 |
-
$weight = 0;
|
148 |
-
$comment = '';
|
149 |
-
$value = 0;
|
150 |
-
foreach ($order->getAllVisibleItems() as $item) {
|
151 |
-
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
152 |
-
if($product->isVirtual()) { continue; }
|
153 |
-
|
154 |
-
/*Mage::helper('sendabox_sendabox')->applySendaboxParamsToItem($item);*/
|
155 |
-
|
156 |
-
$qty = $item->getQty() ? $item->getQty() : $item->getQtyOrdered();
|
157 |
-
$weight += $item->getWeight()*$qty;
|
158 |
-
$comment .= " " .$item->getName() ."-";
|
159 |
-
$value += $item->getRowTotalInclTax()*$qty;
|
160 |
-
}
|
161 |
-
|
162 |
-
$box = Mage::getModel('sendabox_sendabox/box');
|
163 |
-
/* @var $box Sendabox_Sendabox_Model_Box */
|
164 |
-
$box
|
165 |
-
->setShipmentId($sendabox_shipment->getId())
|
166 |
-
->setComment($comment)
|
167 |
-
->setQty(1)
|
168 |
-
->setValue($value)
|
169 |
-
->setLength(10)
|
170 |
-
->setWidth(10)
|
171 |
-
->setHeight(10)
|
172 |
-
->setMeasureUnit(Mage::helper('sendabox_sendabox')->getConfigData('units/measure'))
|
173 |
-
->setWeight($weight)
|
174 |
-
->setWeightUnit(Mage::helper('sendabox_sendabox')->getConfigData('units/weight'))
|
175 |
-
->save();
|
176 |
-
}
|
177 |
-
|
178 |
-
public function addJavascriptBlock($observer)
|
179 |
-
{
|
180 |
-
//exit(__METHOD__);
|
181 |
-
$controller = $observer->getAction();
|
182 |
-
$layout = $controller->getLayout();
|
183 |
-
$block = $layout->createBlock('core/text');
|
184 |
-
$credits = $this->getCredits();
|
185 |
-
$block->setText(
|
186 |
-
"<script type='text/javascript'>
|
187 |
-
function main_pulsestorm_hellojavascript()
|
188 |
-
{
|
189 |
-
var credits = document.getElementById('sendabox_options_general_credits');
|
190 |
-
if(credits!=null)
|
191 |
-
credits.value = ' {$credits} ';
|
192 |
-
}
|
193 |
-
main_pulsestorm_hellojavascript();
|
194 |
-
</script>"
|
195 |
-
);
|
196 |
-
$layout->getBlock('js')->append($block);
|
197 |
-
}
|
198 |
-
|
199 |
-
protected function getCredits(){
|
200 |
-
$username = Mage::helper('sendabox_sendabox')->getConfigData('general/username');
|
201 |
-
$password = Mage::helper('sendabox_sendabox')->getConfigData('general/password');
|
202 |
-
$url='http://www.sendabox.it/_magento/get/credits?api_user=' .$username .'&api_secret=' .$password;
|
203 |
-
$html = file_get_contents($url);
|
204 |
-
if ($html) {
|
205 |
-
$chiamata = json_decode($html, true);
|
206 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
207 |
-
return 'Sendabox account data not valid';
|
208 |
-
} else {
|
209 |
-
return $chiamata['credit'];
|
210 |
-
}
|
211 |
-
} else {
|
212 |
-
//exit('not html');
|
213 |
-
return 'Sendabox account data not valid';
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
protected function loadCheapestQuote($order)
|
218 |
-
{
|
219 |
-
$salesQuoteId = $order->getQuoteId();
|
220 |
-
$quotes = Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
221 |
-
->addFieldToFilter('magento_quote_id', $salesQuoteId)
|
222 |
-
->getItems();
|
223 |
-
if(!is_array($quotes)) { $quotes = array($quotes); }
|
224 |
-
return Mage::helper('sendabox_sendabox')->getCheapestQuote($quotes);
|
225 |
-
}
|
226 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Quote.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Quote extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $_carrier = null;
|
7 |
-
|
8 |
-
public function _construct()
|
9 |
-
{
|
10 |
-
parent::_construct();
|
11 |
-
$this->_init('sendabox_sendabox/quote');
|
12 |
-
}
|
13 |
-
|
14 |
-
public function __clone()
|
15 |
-
{
|
16 |
-
$this->_carrier = clone $this->getCarrier();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Sets the carrier providing this quote.
|
21 |
-
*
|
22 |
-
* @param <type> $carrier_id
|
23 |
-
*
|
24 |
-
* @return Sendabox_Sendabox_Model_Quote
|
25 |
-
*/
|
26 |
-
public function setCarrier($carrier_id)
|
27 |
-
{
|
28 |
-
$carrier = Mage::getModel('sendabox_sendabox/carrier')
|
29 |
-
->load($carrier_id);
|
30 |
-
|
31 |
-
if ($carrier->getId() == $carrier_id) {
|
32 |
-
// exists in the database
|
33 |
-
$this->_carrier = $carrier;
|
34 |
-
$this->setData('carrier_id', $carrier_id);
|
35 |
-
}
|
36 |
-
return $this;
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Gets the carrier providing this quote.
|
41 |
-
*
|
42 |
-
* @return Sendabox_Sendabox_Model_Carrier
|
43 |
-
*/
|
44 |
-
public function getCarrier()
|
45 |
-
{
|
46 |
-
if (!$this->_carrier) {
|
47 |
-
$this->setCarrier($this->getCarrierId());
|
48 |
-
}
|
49 |
-
return $this->_carrier;
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
public function toBookingRequestArray($options)
|
54 |
-
{
|
55 |
-
|
56 |
-
|
57 |
-
$request = array(
|
58 |
-
'totalPrice' => $this->getTotalPrice(),
|
59 |
-
'basePrice' => $this->getBasePrice(),
|
60 |
-
'tax' => $this->getTax(),
|
61 |
-
'currency' => $this->getCurrency(),
|
62 |
-
'carrierId' => $this->getCarrier()->getCarrierId(),
|
63 |
-
);
|
64 |
-
|
65 |
-
|
66 |
-
return $request;
|
67 |
-
}
|
68 |
-
|
69 |
-
|
70 |
-
public function getDescription($showMethod = false)
|
71 |
-
{
|
72 |
-
$title = '';
|
73 |
-
if ($showMethod)
|
74 |
-
$title .= $this->getCarrier()->getCompanyName() .' - ';
|
75 |
-
$title .= $this->getCommercialName();
|
76 |
-
|
77 |
-
//return $title . ' ' . $this->getExtraTitle();
|
78 |
-
return $title;
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Box.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Box extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
$this->_init('sendabox_sendabox/box', 'id');
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Box/Collection.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Box_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
parent::_construct();
|
9 |
-
$this->_init('sendabox_sendabox/box');
|
10 |
-
}
|
11 |
-
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Carrier.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Carrier extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
$this->_init('sendabox_sendabox/carrier', 'id');
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Carrier/Collection.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Carrier_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
parent::_construct();
|
9 |
-
$this->_init('sendabox_sendabox/carrier');
|
10 |
-
}
|
11 |
-
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Quote.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Quote extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
$this->_init('sendabox_sendabox/quote', 'id');
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Quote/Collection.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Quote_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $_options = null;
|
7 |
-
|
8 |
-
public function _construct()
|
9 |
-
{
|
10 |
-
parent::_construct();
|
11 |
-
$this->_init('sendabox_sendabox/quote');
|
12 |
-
}
|
13 |
-
|
14 |
-
public function __clone()
|
15 |
-
{
|
16 |
-
$this->load();
|
17 |
-
$new_items = array();
|
18 |
-
foreach ($this->_items as $item) {
|
19 |
-
$new_items[] = clone $item;
|
20 |
-
}
|
21 |
-
$this->_items = $new_items;
|
22 |
-
}
|
23 |
-
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Gets the cheapest quote in the collection.
|
27 |
-
*
|
28 |
-
* @return Sendabox_Sendabox_Model_Quote
|
29 |
-
*/
|
30 |
-
public function getCheapest()
|
31 |
-
{
|
32 |
-
$cheapest = null;
|
33 |
-
foreach ($this->_items as $item) {
|
34 |
-
$cheapest = $this->_getCheaper($item, $cheapest);
|
35 |
-
}
|
36 |
-
return $cheapest;
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Returns the cheaper of two quotes.
|
41 |
-
*
|
42 |
-
* If one is null, the other is returned. If both are the same price, the
|
43 |
-
* first quote is returned.
|
44 |
-
*
|
45 |
-
* @param Sendabox_Sendabox_Model_Quote $a the first quote.
|
46 |
-
* @param Sendabox_Sendabox_Model_Quote $b the second quote.
|
47 |
-
*
|
48 |
-
* @return Sendabox_Sendabox_Model_Quote
|
49 |
-
*/
|
50 |
-
protected function _getCheaper($a, $b)
|
51 |
-
{
|
52 |
-
// if one is null, return the other (if both are null, null is returned).
|
53 |
-
if (is_null($a)) {
|
54 |
-
return $b;
|
55 |
-
}
|
56 |
-
if (is_null($b)) {
|
57 |
-
return $a;
|
58 |
-
}
|
59 |
-
|
60 |
-
return $a->getTotalPrice() <= $b->getTotalPrice() ? $a : $b;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Don't try to load the collection if specific items have been added.
|
65 |
-
*
|
66 |
-
* @see Varien_Data_Collection::addItem()
|
67 |
-
*/
|
68 |
-
public function addItem(Varien_Object $item)
|
69 |
-
{
|
70 |
-
$this->_setIsLoaded();
|
71 |
-
return parent::addItem($item);
|
72 |
-
}
|
73 |
-
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Shipment.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Shipment extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
$this->_init('sendabox_sendabox/shipment', 'id');
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Resource/Shipment/Collection.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Resource_Shipment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function _construct()
|
7 |
-
{
|
8 |
-
parent::_construct();
|
9 |
-
$this->_init('sendabox_sendabox/shipment');
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Returns the shipment associated to an order or null if none
|
14 |
-
*
|
15 |
-
* NO SUPPORT FOR PARTIAL-SHIPMENTS HERE; ONLY 1 IS RETURNED
|
16 |
-
*
|
17 |
-
* @param string $orderId
|
18 |
-
* @return null|\Sendabox_Sendabox_Model_Shipment
|
19 |
-
*/
|
20 |
-
public function loadByOrderId($orderId) {
|
21 |
-
if(!$orderId) return false;
|
22 |
-
|
23 |
-
$this->addFieldToFilter('order_id', $orderId)->load();
|
24 |
-
if($this->count())
|
25 |
-
return $this->getFirstItem ();
|
26 |
-
|
27 |
-
return false;
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Shipment.php
DELETED
@@ -1,230 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @method int getId()
|
5 |
-
* @method int getOrderId()
|
6 |
-
* @method string getCustomerSelectedQuoteId()
|
7 |
-
* @method string getCustomerSelectedQuoteDescription()
|
8 |
-
* @method string getAdminSelectedQuoteId()
|
9 |
-
* @method float getAnticipatedCost()
|
10 |
-
* @method int getStatus()
|
11 |
-
* @method int getBookingRequestId()
|
12 |
-
* @method boolean getInsurance()
|
13 |
-
* @method string getDestinationCountry()
|
14 |
-
* @method string getDestinationPostcode()
|
15 |
-
* @method string getDestinationCity()
|
16 |
-
* @method string getReadyDate()
|
17 |
-
* @method string getReadyTime()
|
18 |
-
* @method string getCustomerSelectedOptions()
|
19 |
-
* @method string getOrderItems()
|
20 |
-
*
|
21 |
-
*/
|
22 |
-
class Sendabox_Sendabox_Model_Shipment extends Mage_Core_Model_Abstract
|
23 |
-
{
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var Mage_Sales_Model_Order
|
27 |
-
*/
|
28 |
-
protected $_order = null;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var array
|
32 |
-
*/
|
33 |
-
protected $_boxes = null;
|
34 |
-
|
35 |
-
public function _construct()
|
36 |
-
{
|
37 |
-
parent::_construct();
|
38 |
-
$this->_init('sendabox_sendabox/shipment');
|
39 |
-
}
|
40 |
-
|
41 |
-
public function getData($key = '', $index = null)
|
42 |
-
{
|
43 |
-
switch ($key) {
|
44 |
-
case 'selected_quote_description': return $this->getSelectedQuoteDescription();
|
45 |
-
case 'created_at': return $this->getCreatedAt();
|
46 |
-
case 'order_number': return $this->getOrderNumber();
|
47 |
-
case 'shipping_paid': return $this->getShippingPaid();
|
48 |
-
default:
|
49 |
-
}
|
50 |
-
return parent::getData($key, $index);
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Gets the Magento order associated with this shipment.
|
55 |
-
*
|
56 |
-
* @return Mage_Sales_Model_Order
|
57 |
-
*/
|
58 |
-
public function getOrder()
|
59 |
-
{
|
60 |
-
if (!$this->_order && $this->getId()) {
|
61 |
-
$this->_order = Mage::getModel('sales/order')->load($this->getOrderId());
|
62 |
-
}
|
63 |
-
return $this->_order;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Gets the creation date of this shipment.
|
68 |
-
*/
|
69 |
-
public function getCreatedAt()
|
70 |
-
{
|
71 |
-
if ($this->getOrder()) {
|
72 |
-
return $this->getOrder()->getCreatedAt();
|
73 |
-
}
|
74 |
-
return null;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Gets the Magento order number (as shown to customers, e.g. 100000123)
|
79 |
-
*/
|
80 |
-
public function getOrderNumber()
|
81 |
-
{
|
82 |
-
if ($this->getOrder()) {
|
83 |
-
return $this->getOrder()->getIncrementId();
|
84 |
-
}
|
85 |
-
return null;
|
86 |
-
}
|
87 |
-
|
88 |
-
public function getBoxes()
|
89 |
-
{
|
90 |
-
return Mage::getModel('sendabox_sendabox/box')->getCollection()
|
91 |
-
->addFieldToFilter('shipment_id', $this->getId());
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Gets the selected quote.
|
96 |
-
*
|
97 |
-
* If the Sendabox shipment status is Pending or Cancelled, this will be the
|
98 |
-
* quote selected by the user during checkout. If the Sendabox shipment
|
99 |
-
* status is Booked, then it will be the booked quote.
|
100 |
-
*
|
101 |
-
* @return Sendabox_Sendabox_Model_Quote
|
102 |
-
*/
|
103 |
-
public function getSelectedQuote()
|
104 |
-
{
|
105 |
-
$quote = null;
|
106 |
-
|
107 |
-
switch ($this->getStatus()) {
|
108 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status::BOOKED:
|
109 |
-
$quote = Mage::getModel('sendabox_sendabox/quote')
|
110 |
-
->load($this->getAdminSelectedQuoteId());
|
111 |
-
break;
|
112 |
-
case Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status::PENDING:
|
113 |
-
default:
|
114 |
-
$quote = Mage::getModel('sendabox_sendabox/quote')
|
115 |
-
->load($this->getCustomerSelectedQuoteId());
|
116 |
-
break;
|
117 |
-
}
|
118 |
-
|
119 |
-
return $quote;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Clears all quotes from the database relating to this shipment.
|
124 |
-
*/
|
125 |
-
public function clearQuotes()
|
126 |
-
{
|
127 |
-
|
128 |
-
$old_quotes = Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
129 |
-
->addFieldToFilter('magento_quote_id', $this->getOrder()->getQuoteId());
|
130 |
-
foreach ($old_quotes as $quote) {
|
131 |
-
/* @var $quote Sendabox_Sendabox_Model_Quote */
|
132 |
-
$quote->delete();
|
133 |
-
}
|
134 |
-
return $this;
|
135 |
-
}
|
136 |
-
|
137 |
-
public function getQuotes()
|
138 |
-
{
|
139 |
-
return Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
140 |
-
->addFieldToFilter('magento_quote_id', $this->getOrder()->getQuoteId());
|
141 |
-
}
|
142 |
-
|
143 |
-
public function getNewQuotes(){
|
144 |
-
Mage::log(
|
145 |
-
"dentro getnewquotes",
|
146 |
-
null,
|
147 |
-
'aggiornamento.log', true
|
148 |
-
);
|
149 |
-
$boxes = $this->getBoxes();
|
150 |
-
if(!$boxes) return;
|
151 |
-
$i = 1;
|
152 |
-
$destination = $this->getDestinationId();
|
153 |
-
foreach($boxes as $shipment){
|
154 |
-
$i++;
|
155 |
-
$weight = $shipment->getWeight();
|
156 |
-
$weight = ceil(Mage::helper('sendabox_sendabox')->getWeightInKGrams($weight,$shipment->getWeightUnit()));
|
157 |
-
$unit = Mage::helper('sendabox_sendabox')->getConfigData('units/weight');
|
158 |
-
Mage::log(
|
159 |
-
"{$weight}",
|
160 |
-
null,
|
161 |
-
'units.log', true
|
162 |
-
);
|
163 |
-
$dimensions = '' .ceil(Mage::helper('sendabox_sendabox')->getDistanceInCentimetres($shipment->getWidth(),$shipment->getMeasureUnit())) .',' .ceil(Mage::helper('sendabox_sendabox')->getDistanceInCentimetres($shipment->getHeight(),$shipment->getMeasureUnit())) .',' .ceil(Mage::helper('sendabox_sendabox')->getDistanceInCentimetres($shipment->getLength(),$shipment->getMeasureUnit()));
|
164 |
-
Mage::log(
|
165 |
-
"dimensioni: {$dimensions}",
|
166 |
-
null,
|
167 |
-
'units.log', true
|
168 |
-
);
|
169 |
-
$destination = $this->getDestinationId();
|
170 |
-
$from = Mage::getStoreConfig('sendabox_options/origin/city_id');
|
171 |
-
if($destination){
|
172 |
-
|
173 |
-
$this->createQuotes($from,$destination,$weight,$dimensions,$this->getOrder()->getQuoteId());
|
174 |
-
$this->createQuotes($from,$destination,$weight,$dimensions,$this->getOrder()->getQuoteId(),11);
|
175 |
-
$this->createQuotes($from,$destination,$weight,$dimensions,$this->getOrder()->getQuoteId(),13);
|
176 |
-
}
|
177 |
-
}
|
178 |
-
$i--;
|
179 |
-
foreach($this->getQuotes() as $quote){
|
180 |
-
$price = $quote->getTotalPrice();
|
181 |
-
$quote->setTotalPrice($price*$i)->save();
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
protected function createQuotes($from= 0, $to= 0, $weight, $dimensions='10,10,10', $salesQuoteId=null,$special=null){
|
186 |
-
/*if(!$from || !$to || !$weight)
|
187 |
-
return false;*/
|
188 |
-
$url='http://www.sendabox.it/_magento/get/prices?from=' .$from .'&to=' .$to .'&weight=' .$weight .'&dimensions=' .$dimensions;
|
189 |
-
if($special)
|
190 |
-
$url .= '&special=' .$special;
|
191 |
-
$html = file_get_contents($url);
|
192 |
-
if ($html) {
|
193 |
-
$chiamata = json_decode($html, true);
|
194 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
195 |
-
//$this->clearQuotes()->save();
|
196 |
-
return;
|
197 |
-
}
|
198 |
-
if(!is_array($chiamata)) { $chiamata = array($chiamata); }
|
199 |
-
foreach($chiamata as $quote_available){
|
200 |
-
$carrier = Mage::getModel('sendabox_sendabox/carrier')->load($quote_available['idcarrier'],'carrier_id');
|
201 |
-
$id = $carrier ? $carrier->getId() : 3 ;
|
202 |
-
$allowedCarriers = explode(',', Mage::getStoreConfig('carriers/sendabox_sendabox/allowed_methods'));
|
203 |
-
if(!in_array($carrier->getCarrierId(), $allowedCarriers)){
|
204 |
-
continue;}
|
205 |
-
$existing_quote = Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
206 |
-
->addFieldToFilter('magento_quote_id', $this->getOrder()->getQuoteId())
|
207 |
-
->addFieldToFilter('carrier_id', $id)
|
208 |
-
->addFieldToFilter('commercial_name', $quote_available['commercialname'])->getFirstItem();
|
209 |
-
if($existing_quote->getTotalPrice() < $quote_available['price']){
|
210 |
-
$existing_quote->delete()->save();
|
211 |
-
$quote=Mage::getModel('sendabox_sendabox/quote')
|
212 |
-
->setCarrierID($id)
|
213 |
-
->setAccepted(1)
|
214 |
-
->setTotalPrice($quote_available['price'])
|
215 |
-
->setBasePrice($quote_available['price'])
|
216 |
-
->setTax(0)
|
217 |
-
->setInsuranceTotalPrice(0)
|
218 |
-
->setCurrency('€')
|
219 |
-
->setIdPrice($quote_available['idprice'])
|
220 |
-
->setCommercialName($quote_available['commercialname'])
|
221 |
-
->save();
|
222 |
-
|
223 |
-
if($salesQuoteId) $quote->setMagentoQuoteId($salesQuoteId)->save();
|
224 |
-
}
|
225 |
-
}
|
226 |
-
} else {
|
227 |
-
echo 'ERRORE CHIAMATA';
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Shipping/Carrier/Sendabox.php
DELETED
@@ -1,320 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Shipping_Carrier_Sendabox extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
4 |
-
|
5 |
-
protected $_code = 'sendabox_sendabox';
|
6 |
-
protected $_title;
|
7 |
-
protected $request_new;
|
8 |
-
protected $request_old;
|
9 |
-
protected $_pricing_method;
|
10 |
-
protected $_from;
|
11 |
-
|
12 |
-
public function __construct()
|
13 |
-
{
|
14 |
-
parent::__construct();
|
15 |
-
$this->_pricing_method = Mage::getStoreConfig( 'sendabox_options/pricing/method');
|
16 |
-
$this->_from = Mage::getStoreConfig('sendabox_options/origin/city_id');
|
17 |
-
$this->_title = 'Sendabox';
|
18 |
-
}
|
19 |
-
|
20 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
21 |
-
|
22 |
-
$to_name = $request->getDestCity();
|
23 |
-
$region = $request->getDestRegionCode();
|
24 |
-
|
25 |
-
$result = Mage::getModel('shipping/rate_result');
|
26 |
-
/* @var $result Mage_Shipping_Model_Rate_Result */
|
27 |
-
|
28 |
-
//check origin/destination country
|
29 |
-
if (!$this->_canShip($request)) {
|
30 |
-
return;
|
31 |
-
}
|
32 |
-
|
33 |
-
$quote=Mage::getModel('sendabox_sendabox/quote');
|
34 |
-
|
35 |
-
$salesQuoteId = Mage::getSingleton('checkout/session')->getQuoteId();
|
36 |
-
if (!$salesQuoteId && Mage::app()->getStore()->isAdmin()) {
|
37 |
-
$salesQuoteId = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getId();
|
38 |
-
}
|
39 |
-
if (!$salesQuoteId && $this->getIsProductPage()) {
|
40 |
-
$salesQuoteId = 100000000 + mt_rand(0, 100000);
|
41 |
-
}
|
42 |
-
|
43 |
-
$total_weight = 0;
|
44 |
-
foreach ($request->getAllItems() as $item) {
|
45 |
-
/* @var $item Mage_Sales_Model_Quote_Item */
|
46 |
-
if ($item->getProduct()->isVirtual() || $item->getParentItem()) { continue; }
|
47 |
-
|
48 |
-
|
49 |
-
$qty = $item->getQty() ? $item->getQty() : $item->getQtyOrdered();
|
50 |
-
$value = $item->getWeight() * $qty;
|
51 |
-
|
52 |
-
$total_weight += $value;
|
53 |
-
}
|
54 |
-
$total_weight = ceil($total_weight);
|
55 |
-
$lastRequest = Mage::getSingleton('checkout/session')->getSendaboxRequestString();
|
56 |
-
$to_id = $this->getCityId($to_name, $region);
|
57 |
-
if($to_id==0) return;
|
58 |
-
$new_request = $this->_from .'_' .$to_id .'_' .$total_weight .'_10,10,10_' .$salesQuoteId;
|
59 |
-
if ($lastRequest !== $new_request){
|
60 |
-
$quotes_to_clear = Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
61 |
-
->addFieldToFilter('magento_quote_id', $salesQuoteId);
|
62 |
-
foreach ($quotes_to_clear as $quote) {
|
63 |
-
/* @var $quote Sendabox_Sendabox_Model_Quote */
|
64 |
-
$quote->delete();
|
65 |
-
}
|
66 |
-
$this->getQuotes($this->_from,$to_id,$total_weight,'10,10,10',$salesQuoteId,'STANDARD');
|
67 |
-
$this->getQuotes($this->_from,$to_id,$total_weight,'10,10,10',$salesQuoteId,11);
|
68 |
-
$this->getQuotes($this->_from,$to_id,$total_weight,'10,10,10',$salesQuoteId,13);
|
69 |
-
}
|
70 |
-
Mage::getSingleton('checkout/session')->setSendaboxRequestString($this->_from .'_' .$to_id .'_' .$total_weight .'_10,10,10_' .$salesQuoteId);
|
71 |
-
//check if eligible for free shipping
|
72 |
-
if ($this->isFreeShipping($request)) {
|
73 |
-
$result->append($this->_getFreeRateMethod());
|
74 |
-
return $result;
|
75 |
-
}
|
76 |
-
if($this->_pricing_method == Sendabox_Sendabox_Model_System_Config_Source_Pricing::FLAT_RATE){
|
77 |
-
$result->append($this->_getFlatRateMethod());
|
78 |
-
return $result;
|
79 |
-
}
|
80 |
-
|
81 |
-
$quotes = Mage::getModel('sendabox_sendabox/quote')->getCollection()
|
82 |
-
->addFieldToFilter('magento_quote_id', $salesQuoteId)
|
83 |
-
->getItems();
|
84 |
-
if(!is_array($quotes)) { $quotes = array($quotes); }
|
85 |
-
foreach($quotes as $quote){
|
86 |
-
$method_title = 'sendabox_' . $quote->getId();
|
87 |
-
$result->append($this->_getRateFromQuote($quote,$method_title));
|
88 |
-
}
|
89 |
-
return $result;
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns true if request is elegible for free shipping, false otherwise
|
95 |
-
*
|
96 |
-
* @param Mage_Shipping_Model_Rate_Request $request
|
97 |
-
* @return boolean
|
98 |
-
*/
|
99 |
-
public function isFreeShipping($request)
|
100 |
-
{
|
101 |
-
//check pricing method first
|
102 |
-
if($this->_pricing_method == Sendabox_Sendabox_Model_System_Config_Source_Pricing::FREE) {
|
103 |
-
return true;
|
104 |
-
}
|
105 |
-
|
106 |
-
//check if all items have free shipping or free shipping over amount enabled and valid for this request
|
107 |
-
$allItemsFree = true; $total = 0;
|
108 |
-
foreach ($request->getAllItems() as $item) {
|
109 |
-
/* @var $item Mage_Sales_Model_Quote_Item */
|
110 |
-
if ($item->getProduct()->isVirtual() || $item->getParentItem()) { continue; }
|
111 |
-
if ($item->getFreeShipping()) { continue; }
|
112 |
-
|
113 |
-
$value = $item->getValue();
|
114 |
-
if (!$value) { $value = $item->getRowTotalInclTax(); }
|
115 |
-
if (!$value) { $value = $item->getRowTotal(); }
|
116 |
-
if (!$value) {
|
117 |
-
$qty = $item->getQty() ? $item->getQty() : $item->getQtyOrdered();
|
118 |
-
$value = $item->getPrice() * $qty;
|
119 |
-
}
|
120 |
-
$total += $value;
|
121 |
-
//not all items with free shipping if here
|
122 |
-
$allItemsFree = false;
|
123 |
-
}
|
124 |
-
|
125 |
-
if($allItemsFree ||
|
126 |
-
($this->getConfigData('free_shipping_enable') && $total >= $this->getConfigData('free_shipping_subtotal'))) {
|
127 |
-
return true;
|
128 |
-
}
|
129 |
-
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Creates the flat rate method, with the price set in the config. An
|
135 |
-
* optional parameter allows the price to be overridden.
|
136 |
-
*
|
137 |
-
* @return Mage_Shipping_Model_Rate_Result_Method
|
138 |
-
*/
|
139 |
-
protected function _getFreeRateMethod()
|
140 |
-
{
|
141 |
-
$title = 'Free Shipping';
|
142 |
-
$method = Mage::getModel('shipping/rate_result_method')
|
143 |
-
->setCarrier($this->_code)
|
144 |
-
->setCarrierTitle($this->_title)
|
145 |
-
->setMethodTitle($title)
|
146 |
-
->setMethod('sendabox_' .Sendabox_Sendabox_Model_Carrier::FREE)
|
147 |
-
->setPrice(0.00)
|
148 |
-
->setCost(0.00);
|
149 |
-
|
150 |
-
return $method;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Creates the flat rate method, with the price set in the config. An
|
155 |
-
* optional parameter allows the price to be overridden.
|
156 |
-
*
|
157 |
-
* @return Mage_Shipping_Model_Rate_Result_Method
|
158 |
-
*/
|
159 |
-
protected function _getFlatRateMethod()
|
160 |
-
{
|
161 |
-
$title = 'Flat Shipping';
|
162 |
-
$price = Mage::helper('sendabox_sendabox')->getConfigData('pricing/shipping_fee');
|
163 |
-
$method = Mage::getModel('shipping/rate_result_method')
|
164 |
-
->setCarrier($this->_code)
|
165 |
-
->setCarrierTitle($this->_title)
|
166 |
-
->setMethodTitle($title)
|
167 |
-
->setMethod('sendabox_' .Sendabox_Sendabox_Model_Carrier::FLAT_RATE)
|
168 |
-
->setPrice($price)
|
169 |
-
->setCost(0.00);
|
170 |
-
|
171 |
-
return $method;
|
172 |
-
}
|
173 |
-
|
174 |
-
protected function getQuotes($from=0, $to= 0, $weight, $dimensions='10,10,10', $salesQuoteId=null,$special='STANDARD'){
|
175 |
-
|
176 |
-
/*if(!$from || !$to || !$weight)
|
177 |
-
return false;*/
|
178 |
-
|
179 |
-
$url='http://www.sendabox.it/_magento/get/prices?from=' .$from .'&to=' .$to .'&weight=' .$weight .'&dimensions=' .$dimensions;
|
180 |
-
if($special)
|
181 |
-
$url .= '&special=' .$special;
|
182 |
-
|
183 |
-
$html = file_get_contents($url);
|
184 |
-
|
185 |
-
if ($html) {
|
186 |
-
$chiamata = json_decode($html, true);
|
187 |
-
if(!is_array($chiamata)) { $chiamata = array($chiamata); }
|
188 |
-
foreach($chiamata as $quote_available){
|
189 |
-
$carrier = Mage::getModel('sendabox_sendabox/carrier')->load($quote_available['idcarrier'],'carrier_id');
|
190 |
-
$id = $carrier ? $carrier->getId() : 3 ;
|
191 |
-
$allowedCarriers = explode(',', Mage::getStoreConfig('carriers/sendabox_sendabox/allowed_methods'));
|
192 |
-
if($allowedCarriers != '' && !in_array($carrier->getCarrierId(), $allowedCarriers))
|
193 |
-
continue;
|
194 |
-
$quote=Mage::getModel('sendabox_sendabox/quote')
|
195 |
-
->setCarrierID($id)
|
196 |
-
->setAccepted(1)
|
197 |
-
->setTotalPrice($quote_available['price'])
|
198 |
-
->setBasePrice($quote_available['price'])
|
199 |
-
->setTax(0)
|
200 |
-
->setInsuranceTotalPrice(0)
|
201 |
-
->setCurrency('€')
|
202 |
-
->setIdPrice($quote_available['idprice'])
|
203 |
-
->setCommercialName($quote_available['commercialname'])
|
204 |
-
->save();
|
205 |
-
|
206 |
-
if($salesQuoteId) $quote->setMagentoQuoteId($salesQuoteId)->save();
|
207 |
-
}
|
208 |
-
} else {
|
209 |
-
echo 'ERRORE CHIAMATA';
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Creates a rate method based on a Sendabox quote.
|
215 |
-
*
|
216 |
-
* @param Mage_Shipping_Model_Rate_Result_Method the quote
|
217 |
-
*
|
218 |
-
* @return Mage_Shipping_Model_Rate_Result_Method
|
219 |
-
*/
|
220 |
-
protected function _getRateFromQuote($quote, $method_id)
|
221 |
-
{
|
222 |
-
$price = $quote->getTotalPrice();
|
223 |
-
$title = $quote->getDescription();
|
224 |
-
|
225 |
-
$method = Mage::getModel('shipping/rate_result_method');
|
226 |
-
$method->setCarrier($this->_code);
|
227 |
-
$method->setCarrierTitle($this->_title);
|
228 |
-
$method->setMethodTitle($title);
|
229 |
-
$method->setMethod($method_id);
|
230 |
-
$method->setPrice($price);
|
231 |
-
$method->setCost(0);
|
232 |
-
Mage::log(
|
233 |
-
"carrier: {$method->getCarrier()}, CarrierTitle: {$method->getCarrierTitle()}, MethodTitle: {$method->getMethodTitle()}, Method: {$method->getMethod()}, Price: {$method->getPrice()}, Cost: {$method->getCost()}",
|
234 |
-
null,
|
235 |
-
'createSendaboxShippingMethod.log', true
|
236 |
-
);
|
237 |
-
return $method;
|
238 |
-
}
|
239 |
-
|
240 |
-
protected function getCityId($city_name, $region_name="sa"){
|
241 |
-
$city = str_replace(" ", "%20", $city_name);
|
242 |
-
$url = 'http://www.sendabox.it/_magento/get/city?q=' .$city;
|
243 |
-
$html = file_get_contents($url);
|
244 |
-
Mage::log(
|
245 |
-
"{$html}",
|
246 |
-
null,
|
247 |
-
'getCityId.log', true
|
248 |
-
);
|
249 |
-
if ($html) {
|
250 |
-
$chiamata = json_decode($html, true);
|
251 |
-
$safe_return = 14323;
|
252 |
-
if(!is_array($chiamata)) { $chiamata = array($chiamata); }
|
253 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
254 |
-
//echo $chiamata['msg'];
|
255 |
-
return $safe_return;
|
256 |
-
}
|
257 |
-
else {
|
258 |
-
if(count($chiamata)==0) return $safe_return;
|
259 |
-
$i=0;
|
260 |
-
foreach($chiamata as $suggest){
|
261 |
-
$name = strtolower(trim(explode('-',$suggest['value'])[0]));
|
262 |
-
$city_tmp = strtolower(trim($city_name));
|
263 |
-
Mage::log(
|
264 |
-
"suggerito: {$name}, inserito: {$city_tmp}",
|
265 |
-
null,
|
266 |
-
'getCityId.log', true
|
267 |
-
);
|
268 |
-
if($name==$city_tmp){
|
269 |
-
$i++;
|
270 |
-
$region_tmp = strtolower(trim($region_name));
|
271 |
-
$abbreviation = strtolower($suggest['abbreviation']);
|
272 |
-
$province = strtolower($suggest['province']);
|
273 |
-
if($region_tmp ==$abbreviation || $region_tmp==$province){
|
274 |
-
$id= $suggest['id'];
|
275 |
-
return $id;
|
276 |
-
}
|
277 |
-
$safe_return = $i<2 ? $suggest['id'] : 14323;
|
278 |
-
}
|
279 |
-
}
|
280 |
-
return $safe_return;
|
281 |
-
}
|
282 |
-
} else {
|
283 |
-
//echo 'ERRORE CHIAMATA';
|
284 |
-
return 14323;
|
285 |
-
}
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Checks if the to address is within allowed countries
|
290 |
-
*
|
291 |
-
* @return boolean
|
292 |
-
*/
|
293 |
-
protected function _canShip(Mage_Shipping_Model_Rate_Request $request)
|
294 |
-
{
|
295 |
-
return array_key_exists($request->getDestCountryId(), Mage::helper('sendabox_sendabox')->getAllowedCountries());
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* Check if carrier has shipping tracking option available
|
300 |
-
*
|
301 |
-
* @return boolean
|
302 |
-
*/
|
303 |
-
public function isTrackingAvailable()
|
304 |
-
{
|
305 |
-
return false;
|
306 |
-
}
|
307 |
-
|
308 |
-
/*public function getAllowedMethods()
|
309 |
-
{
|
310 |
-
return array(
|
311 |
-
'standard' => 'Standard',
|
312 |
-
'express' => 'Express',
|
313 |
-
);
|
314 |
-
}*/
|
315 |
-
|
316 |
-
public function getAllowedMethods()
|
317 |
-
{
|
318 |
-
return explode(',', Mage::getStoreConfig('carriers/sendabox_sendabox/allowed_methods'));
|
319 |
-
}
|
320 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/Shipping/Carrier/Sendabox/Source/Method.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_Shipping_Carrier_Sendabox_Source_Method
|
4 |
-
{
|
5 |
-
|
6 |
-
public function toOptionArray()
|
7 |
-
{
|
8 |
-
$options = array();
|
9 |
-
|
10 |
-
$carriers = Mage::getModel('sendabox_sendabox/carrier')->getCollection();
|
11 |
-
foreach ($carriers as $carrier) {
|
12 |
-
$options[] = array('value' => $carrier->getCarrierId(), 'label' => $carrier->getCompanyName());
|
13 |
-
}
|
14 |
-
|
15 |
-
return $options;
|
16 |
-
}
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Gets all the options in the key => value type array.
|
21 |
-
*
|
22 |
-
* @return array
|
23 |
-
*/
|
24 |
-
public function getOptions($please_select = false)
|
25 |
-
{
|
26 |
-
if ($please_select) {
|
27 |
-
$options = array(null => '--Please Select--');
|
28 |
-
}
|
29 |
-
|
30 |
-
$carriers = Mage::getModel('sendabox_sendabox/carrier')->getCollection();
|
31 |
-
foreach ($carriers as $carrier) {
|
32 |
-
if(!$carrier->getCarrierId())
|
33 |
-
continue;
|
34 |
-
|
35 |
-
$options[$carrier->getCarrierId()] = $carrier->getCompanyName();
|
36 |
-
}
|
37 |
-
|
38 |
-
return $options;
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Gets all the options for html form.
|
43 |
-
*
|
44 |
-
* @return array ( 0 => array(
|
45 |
-
* 'label' = 'my label',
|
46 |
-
* 'value' = 'my value'
|
47 |
-
* )
|
48 |
-
* );
|
49 |
-
*/
|
50 |
-
public function getOptionsForForm($enabledOnly = false)
|
51 |
-
{
|
52 |
-
$options = array();
|
53 |
-
$carriers = Mage::getModel('sendabox_sendabox/carrier')->getCollection();
|
54 |
-
foreach ($carriers as $carrier) {
|
55 |
-
if(!$carrier->getCarrierId())
|
56 |
-
continue;
|
57 |
-
|
58 |
-
//skip carriers which are not allowed in config
|
59 |
-
if($enabledOnly) {
|
60 |
-
$allowedCarriers = explode(',', Mage::getStoreConfig('carriers/sendabox_sendabox/allowed_methods'));
|
61 |
-
if(!in_array($carrier->getCarrierId(), $allowedCarriers)) {
|
62 |
-
continue;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
$options[] = array(
|
67 |
-
'label' => $carrier->getCompanyName(),
|
68 |
-
'value' => $carrier->getCarrierId()
|
69 |
-
);
|
70 |
-
}
|
71 |
-
|
72 |
-
return $options;
|
73 |
-
}
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Backend/Form/Field/Required/Text.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Backend_Form_Field_Required_Text extends Mage_Core_Model_Config_Data
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _beforeSave()
|
7 |
-
{
|
8 |
-
$value = $this->getValue();
|
9 |
-
$config = $this->getFieldConfig();
|
10 |
-
|
11 |
-
if (!Zend_Validate::is($value, 'NotEmpty')) {
|
12 |
-
Mage::throwException(Mage::helper('sendabox')->__('"' . $config->label . '" is a required field.', $value));
|
13 |
-
}
|
14 |
-
return $this;
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
abstract class Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
/**
|
7 |
-
* The array of options in the configuration item.
|
8 |
-
*
|
9 |
-
* This array's keys are the values used in the database etc. and the
|
10 |
-
* values of this array are used as labels on the frontend.
|
11 |
-
*
|
12 |
-
* @var array
|
13 |
-
*/
|
14 |
-
protected $_options;
|
15 |
-
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
$this->_setupOptions();
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Sets up the $_options array with the correct values.
|
23 |
-
*
|
24 |
-
* This function is called in the constructor.
|
25 |
-
*
|
26 |
-
* @return Temando_Temando_Model_System_Config_Source_Abstract
|
27 |
-
*/
|
28 |
-
protected abstract function _setupOptions();
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Gets all the options in the key => value type array.
|
32 |
-
*
|
33 |
-
* @return array
|
34 |
-
*/
|
35 |
-
public function getOptions($please_select = false)
|
36 |
-
{
|
37 |
-
$options = $this->_options;
|
38 |
-
if ($please_select) {
|
39 |
-
$options = array(null => '--Please Select--') + $options;
|
40 |
-
}
|
41 |
-
return $options;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Converts the options into a format suitable for use in the admin area.
|
46 |
-
*
|
47 |
-
* @return array
|
48 |
-
*/
|
49 |
-
public function toOptionArray()
|
50 |
-
{
|
51 |
-
return $this->_toOptionArray($this->_options);
|
52 |
-
}
|
53 |
-
|
54 |
-
protected function _toOptionArray($input)
|
55 |
-
{
|
56 |
-
$array = array();
|
57 |
-
|
58 |
-
foreach ($input as $key => $value) {
|
59 |
-
$array[] = array(
|
60 |
-
'value' => $key,
|
61 |
-
'label' => $value,
|
62 |
-
);
|
63 |
-
}
|
64 |
-
|
65 |
-
return $array;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Looks up an option by key and gets the label.
|
70 |
-
*
|
71 |
-
* @param mixed $value
|
72 |
-
* @return mixed
|
73 |
-
*/
|
74 |
-
public function getOptionLabel($value)
|
75 |
-
{
|
76 |
-
if (array_key_exists($value, $this->_options)) {
|
77 |
-
return $this->_options[$value];
|
78 |
-
}
|
79 |
-
return null;
|
80 |
-
}
|
81 |
-
|
82 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Errorprocess.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Errorprocess extends Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
const VIEW = 'view';
|
7 |
-
const FLAT = 'flat';
|
8 |
-
|
9 |
-
protected function _setupOptions()
|
10 |
-
{
|
11 |
-
$this->_options = array(
|
12 |
-
self::FLAT => 'Show flat rate',
|
13 |
-
self::VIEW => 'Show error message',
|
14 |
-
);
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Insurance.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Insurance extends Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
const DISABLED = 'disabled';
|
7 |
-
const OPTIONAL = 'optional';
|
8 |
-
const MANDATORY = 'mandatory';
|
9 |
-
|
10 |
-
protected function _setupOptions()
|
11 |
-
{
|
12 |
-
$this->_options = array(
|
13 |
-
self::DISABLED => 'Disabled',
|
14 |
-
self::OPTIONAL => 'Optional',
|
15 |
-
self::MANDATORY => 'Mandatory',
|
16 |
-
);
|
17 |
-
}
|
18 |
-
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Pricing.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Pricing extends Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
const FREE = 'free';
|
7 |
-
const FLAT_RATE = 'flat';
|
8 |
-
const DYNAMIC = 'dynamic';
|
9 |
-
//const DYNAMIC_CHEAPEST = 'dynamiccheap';
|
10 |
-
|
11 |
-
protected function _setupOptions()
|
12 |
-
{
|
13 |
-
$this->_options = array(
|
14 |
-
self::FREE => 'Free Shipping',
|
15 |
-
self::FLAT_RATE => 'Fixed Price / Flat Rate',
|
16 |
-
self::DYNAMIC => 'Dynamic Pricing (All)',
|
17 |
-
//self::DYNAMIC_CHEAPEST => 'Dynamic Pricing (Cheapest only)',
|
18 |
-
);
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Shipment/Status.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status extends Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
const PENDING = '0';
|
7 |
-
const BOOKED = '1';
|
8 |
-
|
9 |
-
protected function _setupOptions()
|
10 |
-
{
|
11 |
-
$this->_options = array(
|
12 |
-
self::PENDING => Mage::helper('sendabox_sendabox')->__('Pending'),
|
13 |
-
self::BOOKED => Mage::helper('sendabox_sendabox')->__('Booked'),
|
14 |
-
);
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
abstract class Sendabox_Sendabox_Model_System_Config_Source_Unit extends Sendabox_Sendabox_Model_System_Config_Source
|
4 |
-
{
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Same as the parent::_options array, except with brief labels as values.
|
8 |
-
*
|
9 |
-
* As the $_options array will contain the name of the unit (e.g. "Metres",
|
10 |
-
* "Inches"), this will contain a shorter description e.g. the units when
|
11 |
-
* used after a measurement ("m.", "in.", etc).
|
12 |
-
*
|
13 |
-
* @var array
|
14 |
-
*/
|
15 |
-
protected $_brief_options;
|
16 |
-
|
17 |
-
public function __construct()
|
18 |
-
{
|
19 |
-
parent::__construct();
|
20 |
-
$this->_setupBriefOptions();
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Sets up the $_brief_options array with the correct values.
|
25 |
-
*
|
26 |
-
* This function is called in the constructor.
|
27 |
-
*
|
28 |
-
* @return Temando_Temando_Model_System_Config_Source_Abstract
|
29 |
-
*/
|
30 |
-
protected abstract function _setupBriefOptions();
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Looks up an option by key and gets the label.
|
34 |
-
*
|
35 |
-
* @param mixed $value
|
36 |
-
* @return mixed
|
37 |
-
*/
|
38 |
-
public function getBriefOptionLabel($value)
|
39 |
-
{
|
40 |
-
if (array_key_exists($value, $this->_brief_options)) {
|
41 |
-
return $this->_brief_options[$value];
|
42 |
-
}
|
43 |
-
return null;
|
44 |
-
}
|
45 |
-
|
46 |
-
public function toBriefOptionArray()
|
47 |
-
{
|
48 |
-
return $this->_toOptionArray($this->_brief_options);
|
49 |
-
}
|
50 |
-
|
51 |
-
public function getOptionValue($value)
|
52 |
-
{
|
53 |
-
return array_search($value, array_flip($this->_brief_options));
|
54 |
-
}
|
55 |
-
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit/Measure.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Unit_Measure extends Sendabox_Sendabox_Model_System_Config_Source_Unit
|
4 |
-
{
|
5 |
-
|
6 |
-
const CENTIMETRES = 'Centimetres';
|
7 |
-
const INCHES = 'Inches';
|
8 |
-
const FEET = 'Feet';
|
9 |
-
|
10 |
-
protected function _setupOptions()
|
11 |
-
{
|
12 |
-
$this->_options = array(
|
13 |
-
self::CENTIMETRES => 'Centimetres',
|
14 |
-
self::INCHES => 'Inches',
|
15 |
-
self::FEET => 'Feet',
|
16 |
-
);
|
17 |
-
}
|
18 |
-
|
19 |
-
protected function _setupBriefOptions()
|
20 |
-
{
|
21 |
-
$this->_brief_options = array(
|
22 |
-
self::CENTIMETRES => 'cm',
|
23 |
-
self::INCHES => 'in.',
|
24 |
-
self::FEET => 'ft.',
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/Model/System/Config/Source/Unit/Weight.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Model_System_Config_Source_Unit_Weight extends Sendabox_Sendabox_Model_System_Config_Source_Unit
|
4 |
-
{
|
5 |
-
|
6 |
-
const KILOGRAMS = 'Kilograms';
|
7 |
-
const OUNCES = 'Ounces';
|
8 |
-
const POUNDS = 'Pounds';
|
9 |
-
|
10 |
-
protected function _setupOptions()
|
11 |
-
{
|
12 |
-
$this->_options = array(
|
13 |
-
self::KILOGRAMS => 'Kilograms',
|
14 |
-
self::OUNCES => 'Ounces',
|
15 |
-
self::POUNDS => 'Pounds',
|
16 |
-
);
|
17 |
-
}
|
18 |
-
|
19 |
-
protected function _setupBriefOptions()
|
20 |
-
{
|
21 |
-
$this->_brief_options = array(
|
22 |
-
self::KILOGRAMS => 'kg',
|
23 |
-
self::OUNCES => 'oz.',
|
24 |
-
self::POUNDS => 'lb.',
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/controllers/Adminhtml/ShipmentController.php
DELETED
@@ -1,260 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Sendabox_Sendabox_Adminhtml_ShipmentController extends Mage_Adminhtml_Controller_Action {
|
4 |
-
|
5 |
-
public function indexAction() {
|
6 |
-
$this->loadLayout()
|
7 |
-
->_setActiveMenu('sendabox/shipment')
|
8 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Shipment Manager'), Mage::helper('adminhtml')->__('Shipment Manager'))
|
9 |
-
->renderLayout();
|
10 |
-
}
|
11 |
-
|
12 |
-
public function editAction() {
|
13 |
-
$id = $this->getRequest()->getParam('id');
|
14 |
-
$shipment = Mage::getModel('sendabox_sendabox/shipment')->load($id);
|
15 |
-
/* @var $shipment Sendabox_Sendabox_Model_Shipment */
|
16 |
-
|
17 |
-
if ($shipment->getId()) {
|
18 |
-
$notices = array();
|
19 |
-
|
20 |
-
if (!count($shipment->getBoxes())) {
|
21 |
-
$notices[] = 'Quotes cannot be refreshed until at least one box is added to the shipment.';
|
22 |
-
}
|
23 |
-
if (!count($shipment->getQuotes())){
|
24 |
-
$notices[] = 'No quotes available for the boxes of the shipment';
|
25 |
-
}
|
26 |
-
if($this->checkCredits() == 0){
|
27 |
-
$this->_getSession()->addError('No credits remaining or error in the settings configuration of the extension');
|
28 |
-
//$notices[] = 'No credits remaining or error in the settings configuration of the extension';
|
29 |
-
}
|
30 |
-
if($this->checkCredits() != 0 && $this->checkCredits()<= 10){
|
31 |
-
$notices[] = 'Check your credits, only {$this->checkCredits()} remaining';
|
32 |
-
}
|
33 |
-
foreach ($notices as $notice) {
|
34 |
-
$this->_getSession()->addNotice($this->__($notice));
|
35 |
-
}
|
36 |
-
|
37 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
38 |
-
if (!empty($data)) {
|
39 |
-
$shipment->addData($data);
|
40 |
-
}
|
41 |
-
|
42 |
-
Mage::register('sendabox_shipment_data', $shipment);
|
43 |
-
|
44 |
-
$this->loadLayout()
|
45 |
-
->_setActiveMenu('sendabox/shipment');
|
46 |
-
|
47 |
-
/*$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);*/
|
48 |
-
|
49 |
-
$this->renderLayout();
|
50 |
-
} else {
|
51 |
-
Mage::getSingleton('adminhtml/session')->addError($this->__('Shipment does not exist.'));
|
52 |
-
$this->_redirect('*/*/');
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
public function saveAction() {
|
57 |
-
if ($data = $this->getRequest()->getPost()) {
|
58 |
-
$shipment = Mage::getModel('sendabox_sendabox/shipment');
|
59 |
-
|
60 |
-
try {
|
61 |
-
$shipment->setId($this->getRequest()->getParam('id'))
|
62 |
-
->addData($data)->save();
|
63 |
-
|
64 |
-
if ($data['boxes_deleted']) {
|
65 |
-
$box_ids = explode(',', $data['boxes_deleted']);
|
66 |
-
foreach ($box_ids as $box_id) {
|
67 |
-
$box = Mage::getModel('sendabox_sendabox/box');
|
68 |
-
/* @var $box Sendabox_Sendabox_Model_Box */
|
69 |
-
$box->load($box_id);
|
70 |
-
if ($box->getId()) {
|
71 |
-
$box->delete();
|
72 |
-
}
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
if (isset($data['box']) && is_array($data['box'])) {
|
77 |
-
foreach ($data['box'] as $box_data) {
|
78 |
-
|
79 |
-
$box = Mage::getModel('sendabox_sendabox/box');
|
80 |
-
/* @var $box Sendabox_Sendabox_Model_Box */
|
81 |
-
if (isset($box_data['id'])) {
|
82 |
-
$box->load($box_data['id']);
|
83 |
-
}
|
84 |
-
|
85 |
-
$box->setShipmentId($shipment->getId())
|
86 |
-
->addData($box_data)
|
87 |
-
->save();
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
|
92 |
-
$shipment = Mage::getModel('sendabox_sendabox/shipment')->load($shipment->getId());
|
93 |
-
$shipment->clearQuotes()->save();
|
94 |
-
if ($shipment->getBoxes()) {
|
95 |
-
$shipment->getNewQuotes();
|
96 |
-
}
|
97 |
-
|
98 |
-
$this->_getSession()->addSuccess($this->__('The shipment data has been saved.'));
|
99 |
-
|
100 |
-
|
101 |
-
$this->_redirect('*/*/edit', array('id' => $shipment->getId()));
|
102 |
-
} catch (Exception $ex) {
|
103 |
-
$this->_getSession()->addError($ex->getMessage())->setFormData($data);
|
104 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
105 |
-
}
|
106 |
-
return;
|
107 |
-
}
|
108 |
-
|
109 |
-
// nothing to save
|
110 |
-
$this->_redirect('*/*/');
|
111 |
-
}
|
112 |
-
|
113 |
-
public function bookAction() {
|
114 |
-
$shipment_id = $this->getRequest()->getParam('shipment');
|
115 |
-
$shipment = Mage::getModel('sendabox_sendabox/shipment')
|
116 |
-
->load($shipment_id);
|
117 |
-
/* @var $shipment Sendabox_Sendabox_Model_Shipment */
|
118 |
-
|
119 |
-
$quote_id = $this->getRequest()->getParam('quote');
|
120 |
-
$quote = Mage::getModel('sendabox_sendabox/quote')
|
121 |
-
->load($quote_id);
|
122 |
-
/* @var $quote Sendabox_Sendabox_Model_Quote */
|
123 |
-
|
124 |
-
$error = null;
|
125 |
-
|
126 |
-
if (!$shipment->getId()) {
|
127 |
-
$error = 'Shipment does not exist.';
|
128 |
-
} else {
|
129 |
-
if (!$quote->getId()) {
|
130 |
-
$error = 'Selected quote does not exist.';
|
131 |
-
} else {
|
132 |
-
$username = Mage::helper('sendabox_sendabox')->getConfigData('general/username');
|
133 |
-
$password = Mage::helper('sendabox_sendabox')->getConfigData('general/password');
|
134 |
-
if (!$error && $username !='test' && $password !='test') {
|
135 |
-
// try to make booking
|
136 |
-
try {
|
137 |
-
$booking_result = $this->_makeBooking($shipment, $quote);
|
138 |
-
} catch (Exception $ex) {
|
139 |
-
$error = $ex->getMessage();
|
140 |
-
}
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
if (!$error) {
|
146 |
-
|
147 |
-
$shipment
|
148 |
-
->setAdminSelectedQuoteId($quote_id)
|
149 |
-
->setStatus(Sendabox_Sendabox_Model_System_Config_Source_Shipment_Status::BOOKED)
|
150 |
-
->setCustomerCost($quote->getTotalPrice())
|
151 |
-
->save();
|
152 |
-
|
153 |
-
$magento_shipment = Mage::getModel('sales/convert_order')
|
154 |
-
->toShipment($shipment->getOrder());
|
155 |
-
/* @var $magento_shipment Mage_Sales_Model_Order_Shipment */
|
156 |
-
|
157 |
-
$totalQty = 0;
|
158 |
-
foreach ($shipment->getOrder()->getAllItems() as $item) {
|
159 |
-
if ($item->getQtyToShip() && !$item->getIsVirtual()) {
|
160 |
-
$magento_shipment_item = Mage::getModel('sales/convert_order')
|
161 |
-
->itemToShipmentItem($item);
|
162 |
-
|
163 |
-
$qty = $item->getQtyToShip();
|
164 |
-
|
165 |
-
$magento_shipment_item->setQty($qty);
|
166 |
-
$magento_shipment->addItem($magento_shipment_item);
|
167 |
-
|
168 |
-
$totalQty += $qty;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
$magento_shipment->setTotalQty($totalQty);
|
173 |
-
|
174 |
-
try {
|
175 |
-
$magento_shipment->getOrder()->setIsInProcess(true)->setCustomerNoteNotify(true);
|
176 |
-
Mage::getModel('core/resource_transaction')
|
177 |
-
->addObject($shipment)
|
178 |
-
->addObject($magento_shipment)
|
179 |
-
->addObject($magento_shipment->getOrder())
|
180 |
-
->save();
|
181 |
-
$magento_shipment->sendEmail();
|
182 |
-
} catch (Mage_Core_Exception $e) {
|
183 |
-
$error = $e->getMessage();
|
184 |
-
}
|
185 |
-
|
186 |
-
$this->_getSession()->addSuccess($this->__('Shipment booked.'));
|
187 |
-
}
|
188 |
-
|
189 |
-
if ($error) {
|
190 |
-
$this->_getSession()
|
191 |
-
->addError($this->__($error))
|
192 |
-
/* ->setFormData($data) */;
|
193 |
-
}
|
194 |
-
$this->_redirect('*/*/edit', array('id' => $shipment_id));
|
195 |
-
}
|
196 |
-
|
197 |
-
protected function _makeBooking($shipment, $quote){
|
198 |
-
$username = Mage::helper('sendabox_sendabox')->getConfigData('general/username');
|
199 |
-
$password = Mage::helper('sendabox_sendabox')->getConfigData('general/password');
|
200 |
-
$nameFrom = Mage::getStoreConfig('sendabox_options/origin/contact_name');
|
201 |
-
$surnameFrom = Mage::getStoreConfig('sendabox_options/origin/contact_surname');
|
202 |
-
$careFrom = Mage::getStoreConfig('sendabox_options/origin/c_o');
|
203 |
-
$addressFrom = Mage::getStoreConfig('sendabox_options/origin/street');
|
204 |
-
$streetnumberFrom = Mage::getStoreConfig('sendabox_options/origin/number');
|
205 |
-
$cityFrom = Mage::getStoreConfig('sendabox_options/origin/city_id');
|
206 |
-
$zipFrom = Mage::getStoreConfig('sendabox_options/origin/postcode');
|
207 |
-
$notesFrom = Mage::getStoreConfig('sendabox_options/origin/notes');
|
208 |
-
$contactphoneFrom = Mage::getStoreConfig('sendabox_options/origin/phone');
|
209 |
-
$emailconfirmFrom = Mage::getStoreConfig('sendabox_options/origin/email');
|
210 |
-
foreach($shipment->getBoxes() as $box){
|
211 |
-
$weight = ceil($box->getWeight());
|
212 |
-
$dimensions = '' .ceil($box->getWidth()) .',' .ceil($box->getHeight()) .',' .ceil($box->getLength());
|
213 |
-
$url = 'http://www.sendabox.it/_magento/set/order?api_user=' .$username .'&api_secret=' .$password .'&weight=' .$weight .'&dimensions=' .$dimensions .'&nameFrom=' .$nameFrom .'&surnameFrom=' .$surnameFrom;
|
214 |
-
if($careFrom) $url .= '&careFrom=' .$careFrom;
|
215 |
-
$url .= '&addressFrom=' .$addressFrom .'&streetnumberFrom=' .$streetnumberFrom .'&cityFrom=' .$cityFrom .'&zipFrom=' .$zipFrom;
|
216 |
-
if($notesFrom) $url .= '¬esFrom=' .$notesFrom;
|
217 |
-
$url .= '&contactphoneFrom=' .$contactphoneFrom .'&emailconfirmFrom=' .$emailconfirmFrom .'&nameTo=' .$shipment->getDestinationName() .'&surnameTo=' .$shipment->getDestinationSurname();
|
218 |
-
if($shipment->getDestinationAt()) $url .= '&careTo=' .$shipment->getDestinationAt();
|
219 |
-
$url .= '&addressTo=' .$shipment->getDestinationStreet() .'&streetnumberTo=' .$shipment->getDestinationNumber() .'&cityTo=' .$shipment->getDestinationId() .'&zipTo=' .$shipment->getDestinationPostcode();
|
220 |
-
if($shipment->getDestinationNote()) $url .= '¬esTo=' .$shipment->getDestinationNote();
|
221 |
-
$url .= '&idprice=' .$quote->getIdPrice();
|
222 |
-
$url = str_replace(" ", "%20", $url);
|
223 |
-
$html = file_get_contents($url);
|
224 |
-
if ($html) {
|
225 |
-
$chiamata = json_decode($html, true);
|
226 |
-
if(!is_array($chiamata)) { $chiamata = array($chiamata); }
|
227 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
228 |
-
//echo $chiamata['msg'];
|
229 |
-
throw new Exception($chiamata['msg']);
|
230 |
-
}
|
231 |
-
else {
|
232 |
-
foreach($chiamata as $shipped_box){
|
233 |
-
$shipment_number = $shipped_box['id'];
|
234 |
-
}
|
235 |
-
}
|
236 |
-
} else {
|
237 |
-
//echo 'ERRORE CHIAMATA';
|
238 |
-
throw new Exception('Connection with the server failed');
|
239 |
-
}
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
protected function checkCredits(){
|
244 |
-
$username = Mage::helper('sendabox_sendabox')->getConfigData('general/username');
|
245 |
-
$password = Mage::helper('sendabox_sendabox')->getConfigData('general/password');
|
246 |
-
$url='http://www.sendabox.it/_magento/get/credits?api_user=' .$username .'&api_secret=' .$password;
|
247 |
-
$html = file_get_contents($url);
|
248 |
-
if ($html) {
|
249 |
-
$chiamata = json_decode($html, true);
|
250 |
-
if(isset($chiamata['error']) && $chiamata['error']){
|
251 |
-
return 0;
|
252 |
-
} else {
|
253 |
-
return $chiamata['credit'];
|
254 |
-
}
|
255 |
-
} else {
|
256 |
-
//exit('not html');
|
257 |
-
return 0;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/etc/adminhtml.xml
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<config>
|
2 |
-
<menu>
|
3 |
-
<sendabox translate="title" module="sendabox_sendabox">
|
4 |
-
<title>Sendabox</title>
|
5 |
-
<sort_order>75</sort_order>
|
6 |
-
<children>
|
7 |
-
<shipment translate="title" module="sendabox_sendabox">
|
8 |
-
<title>Manage Shipments</title>
|
9 |
-
<sort_order>10</sort_order>
|
10 |
-
<action>sendabox/adminhtml_shipment</action>
|
11 |
-
</shipment>
|
12 |
-
<configuration translate="title" module="sendabox_sendabox">
|
13 |
-
<title>Configuration Settings</title>
|
14 |
-
<sort_order>30</sort_order>
|
15 |
-
<children>
|
16 |
-
<sendabox_settings translate="title" module="sendabox_sendabox">
|
17 |
-
<title>Sendabox Settings</title>
|
18 |
-
<sort_order>10</sort_order>
|
19 |
-
<action>adminhtml/system_config/edit/section/sendabox_options</action>
|
20 |
-
</sendabox_settings>
|
21 |
-
<shipping_methods>
|
22 |
-
<title>Shipping Methods</title>
|
23 |
-
<sort_order>20</sort_order>
|
24 |
-
<action>adminhtml/system_config/edit/section/carriers</action>
|
25 |
-
</shipping_methods>
|
26 |
-
</children>
|
27 |
-
</configuration>
|
28 |
-
</children>
|
29 |
-
</sendabox>
|
30 |
-
</menu>
|
31 |
-
<acl>
|
32 |
-
<resources>
|
33 |
-
<all>
|
34 |
-
<title>Allow Everything</title>
|
35 |
-
</all>
|
36 |
-
<admin>
|
37 |
-
<children>
|
38 |
-
<sendabox translate="title" module="sendabox_sendabox">
|
39 |
-
<title>Sendabox</title>
|
40 |
-
<sort_order>10</sort_order>
|
41 |
-
<children>
|
42 |
-
<shipment>
|
43 |
-
<title>Manage Shipments</title>
|
44 |
-
</shipment>
|
45 |
-
<configuration>
|
46 |
-
<title>Configuration Settings</title>
|
47 |
-
<children>
|
48 |
-
<sendabox_settings>
|
49 |
-
<title>Sendabox Settings</title>
|
50 |
-
</sendabox_settings>
|
51 |
-
<shipping_methods>
|
52 |
-
<title>Shipping Methods</title>
|
53 |
-
</shipping_methods>
|
54 |
-
</children>
|
55 |
-
</configuration>
|
56 |
-
</children>
|
57 |
-
</sendabox>
|
58 |
-
<system>
|
59 |
-
<children>
|
60 |
-
<config>
|
61 |
-
<children>
|
62 |
-
<sendabox_settings>
|
63 |
-
<title>Sendabox Settings</title>
|
64 |
-
</sendabox_settings>
|
65 |
-
</children>
|
66 |
-
</config>
|
67 |
-
</children>
|
68 |
-
</system>
|
69 |
-
</children>
|
70 |
-
</admin>
|
71 |
-
</resources>
|
72 |
-
</acl>
|
73 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/etc/config.xml
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<config>
|
2 |
-
<modules>
|
3 |
-
<Sendabox_Sendabox>
|
4 |
-
<version>1.0.0</version>
|
5 |
-
</Sendabox_Sendabox>
|
6 |
-
</modules>
|
7 |
-
<global>
|
8 |
-
<models>
|
9 |
-
<sendabox_sendabox>
|
10 |
-
<class>Sendabox_Sendabox_Model</class>
|
11 |
-
<resourceModel>sendabox_resource</resourceModel>
|
12 |
-
</sendabox_sendabox>
|
13 |
-
<sendabox_resource>
|
14 |
-
<class>Sendabox_Sendabox_Model_Resource</class>
|
15 |
-
<entities>
|
16 |
-
<box><table>sendabox_box</table></box>
|
17 |
-
<quote><table>sendabox_quote</table></quote>
|
18 |
-
<shipment><table>sendabox_shipment</table></shipment>
|
19 |
-
<carrier><table>sendabox_carrier</table></carrier>
|
20 |
-
</entities>
|
21 |
-
</sendabox_resource>
|
22 |
-
</models>
|
23 |
-
<helpers>
|
24 |
-
<sendabox_sendabox>
|
25 |
-
<class>Sendabox_Sendabox_Helper</class>
|
26 |
-
</sendabox_sendabox>
|
27 |
-
</helpers>
|
28 |
-
<blocks>
|
29 |
-
<sendabox_sendabox>
|
30 |
-
<class>Sendabox_Sendabox_Block</class>
|
31 |
-
</sendabox_sendabox>
|
32 |
-
</blocks>
|
33 |
-
<resources>
|
34 |
-
<sendabox_sendabox_setup>
|
35 |
-
<setup>
|
36 |
-
<module>Sendabox_Sendabox</module>
|
37 |
-
<class>Mage_Eav_Model_Entity_Setup</class>
|
38 |
-
</setup>
|
39 |
-
<connection>
|
40 |
-
<use>core_setup</use>
|
41 |
-
</connection>
|
42 |
-
</sendabox_sendabox_setup>
|
43 |
-
<sendabox_sendabox_write>
|
44 |
-
<connection>
|
45 |
-
<use>core_write</use>
|
46 |
-
</connection>
|
47 |
-
</sendabox_sendabox_write>
|
48 |
-
<sendabox_sendabox_read>
|
49 |
-
<connection>
|
50 |
-
<use>core_read</use>
|
51 |
-
</connection>
|
52 |
-
</sendabox_sendabox_read>
|
53 |
-
</resources>
|
54 |
-
<sales>
|
55 |
-
<shipping>
|
56 |
-
<carriers>
|
57 |
-
<sendabox_sendabox>
|
58 |
-
<class>Sendabox_Sendabox_Model_Shipping_Carrier_Sendabox</class>
|
59 |
-
</sendabox_sendabox>
|
60 |
-
</carriers>
|
61 |
-
</shipping>
|
62 |
-
</sales>
|
63 |
-
<events>
|
64 |
-
<sales_order_place_after>
|
65 |
-
<observers>
|
66 |
-
<sendabox_sendabox_sales_order_place_after_handler>
|
67 |
-
<type>model</type>
|
68 |
-
<class>Sendabox_Sendabox_Model_Observer</class>
|
69 |
-
<method>createSendaboxShipment</method>
|
70 |
-
</sendabox_sendabox_sales_order_place_after_handler>
|
71 |
-
</observers>
|
72 |
-
</sales_order_place_after>
|
73 |
-
</events>
|
74 |
-
</global>
|
75 |
-
<admin>
|
76 |
-
<routers>
|
77 |
-
<sendabox>
|
78 |
-
<use>admin</use>
|
79 |
-
<args>
|
80 |
-
<module>Sendabox_Sendabox</module>
|
81 |
-
<frontName>sendabox</frontName>
|
82 |
-
</args>
|
83 |
-
</sendabox>
|
84 |
-
</routers>
|
85 |
-
</admin>
|
86 |
-
<adminhtml>
|
87 |
-
<events>
|
88 |
-
<controller_action_layout_generate_blocks_after>
|
89 |
-
<observers>
|
90 |
-
<sendabox_sendabox_addjs>
|
91 |
-
<type>singleton</type>
|
92 |
-
<class>sendabox_sendabox/observer</class>
|
93 |
-
<method>addJavascriptBlock</method>
|
94 |
-
</sendabox_sendabox_addjs>
|
95 |
-
</observers>
|
96 |
-
</controller_action_layout_generate_blocks_after>
|
97 |
-
</events>
|
98 |
-
<acl>
|
99 |
-
<resources>
|
100 |
-
<admin>
|
101 |
-
<children>
|
102 |
-
<system>
|
103 |
-
<children>
|
104 |
-
<config>
|
105 |
-
<children>
|
106 |
-
<sendabox_options>
|
107 |
-
<title>Sendabox Section</title>
|
108 |
-
</sendabox_options>
|
109 |
-
</children>
|
110 |
-
</config>
|
111 |
-
</children>
|
112 |
-
</system>
|
113 |
-
</children>
|
114 |
-
</admin>
|
115 |
-
</resources>
|
116 |
-
</acl>
|
117 |
-
<layout>
|
118 |
-
<updates>
|
119 |
-
<sendabox>
|
120 |
-
<file>sendabox.xml</file>
|
121 |
-
</sendabox>
|
122 |
-
</updates>
|
123 |
-
</layout>
|
124 |
-
</adminhtml>
|
125 |
-
<!-- Default configuration -->
|
126 |
-
<default>
|
127 |
-
<carriers>
|
128 |
-
<sendabox_sendabox>
|
129 |
-
<active>1</active>
|
130 |
-
<!--
|
131 |
-
This configuration should not be made visible
|
132 |
-
to the administrator, because it specifies
|
133 |
-
the model to be used for this carrier.
|
134 |
-
-->
|
135 |
-
<model>sendabox_sendabox/shipping_carrier_sendabox</model>
|
136 |
-
<!--
|
137 |
-
The title as referenced in the carrier class
|
138 |
-
-->
|
139 |
-
<title>Sendabox - Confronta e spedisci a prezzi imbattibili</title>
|
140 |
-
<!--
|
141 |
-
The sort order specifies the position that
|
142 |
-
this carrier appears relative to the other
|
143 |
-
carriers available in checkout.
|
144 |
-
-->
|
145 |
-
<sort_order>10</sort_order>
|
146 |
-
<!--
|
147 |
-
Out of the box, Magento offers shipping
|
148 |
-
carriers the ability to restrict themselves
|
149 |
-
to specific countries. For this configuration
|
150 |
-
option, 0 means allow all countries available,
|
151 |
-
and 1 means allow all countries specified
|
152 |
-
in the country list that we will add later
|
153 |
-
in system.xml
|
154 |
-
-->
|
155 |
-
<sallowspecific>0</sallowspecific>
|
156 |
-
<!--
|
157 |
-
Inserimenti miei
|
158 |
-
-->
|
159 |
-
<!--<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>-->
|
160 |
-
</sendabox_sendabox>
|
161 |
-
</carriers>
|
162 |
-
<sendabox_options>
|
163 |
-
<general>
|
164 |
-
<payment_type>Credits</payment_type>
|
165 |
-
</general>
|
166 |
-
</sendabox_options>
|
167 |
-
</default>
|
168 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/etc/system.xml
DELETED
@@ -1,476 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<sections>
|
4 |
-
<carriers translate="label" module="shipping">
|
5 |
-
<groups>
|
6 |
-
<sendabox_sendabox translate="label">
|
7 |
-
<label>Sendabox</label>
|
8 |
-
<frontend_type>text</frontend_type>
|
9 |
-
<sort_order>2</sort_order>
|
10 |
-
<show_in_default>1</show_in_default>
|
11 |
-
<show_in_website>1</show_in_website>
|
12 |
-
<show_in_store>1</show_in_store>
|
13 |
-
<fields>
|
14 |
-
<!--
|
15 |
-
The following fields are available
|
16 |
-
to modify in the admin panel.
|
17 |
-
The values are saved in the
|
18 |
-
database.
|
19 |
-
|
20 |
-
This shipping carrier abstract checks
|
21 |
-
this value to determine whether
|
22 |
-
the carrier should be shown.
|
23 |
-
-->
|
24 |
-
<active translate="label">
|
25 |
-
<label>Enabled</label>
|
26 |
-
<frontend_type>select</frontend_type>
|
27 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
28 |
-
<sort_order>1</sort_order>
|
29 |
-
<show_in_default>1</show_in_default>
|
30 |
-
<show_in_website>1</show_in_website>
|
31 |
-
<show_in_store>0</show_in_store>
|
32 |
-
</active>
|
33 |
-
<!--
|
34 |
-
This value can be used to specify a
|
35 |
-
custom title for our method.
|
36 |
-
-->
|
37 |
-
<!--<title translate="label">
|
38 |
-
<label>Title</label>
|
39 |
-
<frontend_type>text</frontend_type>
|
40 |
-
<sort_order>2</sort_order>
|
41 |
-
<show_in_default>1</show_in_default>
|
42 |
-
<show_in_website>1</show_in_website>
|
43 |
-
<show_in_store>1</show_in_store>
|
44 |
-
</title>-->
|
45 |
-
<!--
|
46 |
-
The sort order is used in Magento
|
47 |
-
to determine what order the carrier
|
48 |
-
will appear in relative to the
|
49 |
-
other carriers available.
|
50 |
-
-->
|
51 |
-
<!--<sort_order translate="label">
|
52 |
-
<label>Sort Order</label>
|
53 |
-
<frontend_type>text</frontend_type>
|
54 |
-
<sort_order>100</sort_order>
|
55 |
-
<show_in_default>1</show_in_default>
|
56 |
-
<show_in_website>1</show_in_website>
|
57 |
-
<show_in_store>0</show_in_store>
|
58 |
-
</sort_order>-->
|
59 |
-
<!--
|
60 |
-
This value is used to specify whether
|
61 |
-
the carrier is available only for
|
62 |
-
specific countries or all countries
|
63 |
-
available in the current Magento
|
64 |
-
installation.
|
65 |
-
-->
|
66 |
-
<sallowspecific translate="label">
|
67 |
-
<label>Ship to Applicable Countries</label>
|
68 |
-
<frontend_type>select</frontend_type>
|
69 |
-
<sort_order>90</sort_order>
|
70 |
-
<frontend_class>shipping-applicable-country</frontend_class>
|
71 |
-
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
72 |
-
<show_in_default>1</show_in_default>
|
73 |
-
<show_in_website>1</show_in_website>
|
74 |
-
<show_in_store>0</show_in_store>
|
75 |
-
</sallowspecific>
|
76 |
-
<!--
|
77 |
-
If 'specific countries' is chosen
|
78 |
-
in the previous option, then this field
|
79 |
-
allows the administrator to specify
|
80 |
-
which specific countries this carrier
|
81 |
-
should be available for.
|
82 |
-
-->
|
83 |
-
<specificcountry translate="label">
|
84 |
-
<label>Ship to Specific Countries</label>
|
85 |
-
<frontend_type>multiselect</frontend_type>
|
86 |
-
<sort_order>91</sort_order>
|
87 |
-
<source_model>adminhtml/system_config_source_country</source_model>
|
88 |
-
<show_in_default>1</show_in_default>
|
89 |
-
<show_in_website>1</show_in_website>
|
90 |
-
<show_in_store>0</show_in_store>
|
91 |
-
<can_be_empty>1</can_be_empty>
|
92 |
-
</specificcountry>
|
93 |
-
<free_shipping_enable translate="label">
|
94 |
-
<label>Free Shipping with Minimum Order Amount</label>
|
95 |
-
<frontend_type>select</frontend_type>
|
96 |
-
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
97 |
-
<sort_order>50</sort_order>
|
98 |
-
<show_in_default>1</show_in_default>
|
99 |
-
<show_in_website>1</show_in_website>
|
100 |
-
<show_in_store>1</show_in_store>
|
101 |
-
</free_shipping_enable>
|
102 |
-
<free_shipping_subtotal translate="label">
|
103 |
-
<label>Minimum Order Amount for Free Shipping</label>
|
104 |
-
<frontend_type>text</frontend_type>
|
105 |
-
<sort_order>60</sort_order>
|
106 |
-
<show_in_default>1</show_in_default>
|
107 |
-
<show_in_website>1</show_in_website>
|
108 |
-
<show_in_store>1</show_in_store>
|
109 |
-
</free_shipping_subtotal>
|
110 |
-
<allowed_methods translate="label">
|
111 |
-
<label>Allowed Carriers</label>
|
112 |
-
<frontend_type>multiselect</frontend_type>
|
113 |
-
<!--<config_path>carriers/sendabox/allowed_methods</config_path>-->
|
114 |
-
<sort_order>70</sort_order>
|
115 |
-
<source_model>sendabox_sendabox/shipping_carrier_sendabox_source_method</source_model>
|
116 |
-
<show_in_default>1</show_in_default>
|
117 |
-
<show_in_website>1</show_in_website>
|
118 |
-
<show_in_store>1</show_in_store>
|
119 |
-
<comment><![CDATA[Use CTRL + click to select multiple carriers.]]></comment>
|
120 |
-
</allowed_methods>
|
121 |
-
</fields>
|
122 |
-
</sendabox_sendabox>
|
123 |
-
</groups>
|
124 |
-
</carriers>
|
125 |
-
<sendabox_options translate="label" module="sendabox_sendabox">
|
126 |
-
<label>Sendabox Settings</label>
|
127 |
-
<tab>sales</tab>
|
128 |
-
<frontend_type>text</frontend_type>
|
129 |
-
<sort_order>321</sort_order>
|
130 |
-
<show_in_default>1</show_in_default>
|
131 |
-
<show_in_website>1</show_in_website>
|
132 |
-
<show_in_store>1</show_in_store>
|
133 |
-
<groups>
|
134 |
-
<general translate="label">
|
135 |
-
<label>General</label>
|
136 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_fieldset_general</frontend_model>
|
137 |
-
<sort_order>10</sort_order>
|
138 |
-
<show_in_default>1</show_in_default>
|
139 |
-
<show_in_website>1</show_in_website>
|
140 |
-
<show_in_store>1</show_in_store>
|
141 |
-
<comment>
|
142 |
-
<![CDATA[
|
143 |
-
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
144 |
-
Get your API Key and API Password from the profile page of your Sendabox.it account,
|
145 |
-
if you don't have one, you can <a href="https://www.sendabox.it" target="_blank">Sign Up</a> immediately.
|
146 |
-
</div>
|
147 |
-
]]>
|
148 |
-
</comment>
|
149 |
-
<fields>
|
150 |
-
<!--<client>
|
151 |
-
<label>Client ID</label>
|
152 |
-
<frontend_type>text</frontend_type>
|
153 |
-
<sort_order>30</sort_order>
|
154 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
155 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
156 |
-
<show_in_default>1</show_in_default>
|
157 |
-
<show_in_website>1</show_in_website>
|
158 |
-
<show_in_store>1</show_in_store>
|
159 |
-
</client>-->
|
160 |
-
<username translate="label">
|
161 |
-
<label>API Key</label>
|
162 |
-
<frontend_type>text</frontend_type>
|
163 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
164 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
165 |
-
<sort_order>10</sort_order>
|
166 |
-
<show_in_default>1</show_in_default>
|
167 |
-
<show_in_website>1</show_in_website>
|
168 |
-
<show_in_store>1</show_in_store>
|
169 |
-
<comment><![CDATA[Insert "test" for a test of the extension]]></comment>
|
170 |
-
</username>
|
171 |
-
<password translate="label">
|
172 |
-
<label>API Password</label>
|
173 |
-
<frontend_type>password</frontend_type>
|
174 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
175 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
176 |
-
<sort_order>20</sort_order>
|
177 |
-
<show_in_default>1</show_in_default>
|
178 |
-
<show_in_website>1</show_in_website>
|
179 |
-
<show_in_store>1</show_in_store>
|
180 |
-
<comment><![CDATA[Insert "test" for a test of the extension]]></comment>
|
181 |
-
</password>
|
182 |
-
<payment_type translate="label">
|
183 |
-
<label>Payment Type</label>
|
184 |
-
<frontend_type>label</frontend_type>
|
185 |
-
<sort_order>30</sort_order>
|
186 |
-
<show_in_default>1</show_in_default>
|
187 |
-
<show_in_website>1</show_in_website>
|
188 |
-
<show_in_store>1</show_in_store>
|
189 |
-
<comment><![CDATA[Please ensure you have sufficient credit in your Sendabox account]]></comment>
|
190 |
-
</payment_type>
|
191 |
-
<credits translate="label">
|
192 |
-
<label>Remaining Credits</label>
|
193 |
-
<frontend_type>text</frontend_type>
|
194 |
-
<sort_order>40</sort_order>
|
195 |
-
<show_in_default>1</show_in_default>
|
196 |
-
<show_in_website>1</show_in_website>
|
197 |
-
<show_in_store>1</show_in_store>
|
198 |
-
</credits>
|
199 |
-
</fields>
|
200 |
-
</general>
|
201 |
-
<!--<insurance translate="label">
|
202 |
-
<label>Insurance</label>
|
203 |
-
<frontend_type>text</frontend_type>
|
204 |
-
<sort_order>30</sort_order>
|
205 |
-
<show_in_default>1</show_in_default>
|
206 |
-
<show_in_website>1</show_in_website>
|
207 |
-
<show_in_store>1</show_in_store>
|
208 |
-
<fields>
|
209 |
-
<status translate="label">
|
210 |
-
<label>Insurance</label>
|
211 |
-
<frontend_type>select</frontend_type>
|
212 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_insurance</frontend_model>
|
213 |
-
<sort_order>10</sort_order>
|
214 |
-
<source_model>sendabox_sendabox/system_config_source_insurance</source_model>
|
215 |
-
<show_in_default>1</show_in_default>
|
216 |
-
<show_in_website>1</show_in_website>
|
217 |
-
<show_in_store>1</show_in_store>
|
218 |
-
<comment>
|
219 |
-
<![CDATA[
|
220 |
-
Disabled - This option is unavailable to users.<br/>
|
221 |
-
Optional - The option is presented during checkout.<br/>
|
222 |
-
Mandatory - Insurance must be added to all orders.
|
223 |
-
]]>
|
224 |
-
</comment>
|
225 |
-
</status>
|
226 |
-
</fields>
|
227 |
-
</insurance>-->
|
228 |
-
<pricing translate="label">
|
229 |
-
<label>Pricing</label>
|
230 |
-
<frontend_type>text</frontend_type>
|
231 |
-
<sort_order>20</sort_order>
|
232 |
-
<show_in_default>1</show_in_default>
|
233 |
-
<show_in_website>1</show_in_website>
|
234 |
-
<show_in_store>1</show_in_store>
|
235 |
-
<fields>
|
236 |
-
<method translate="label">
|
237 |
-
<label>Pricing Method</label>
|
238 |
-
<frontend_type>select</frontend_type>
|
239 |
-
<source_model>sendabox_sendabox/system_config_source_pricing</source_model>
|
240 |
-
<sort_order>10</sort_order>
|
241 |
-
<show_in_default>1</show_in_default>
|
242 |
-
<show_in_website>1</show_in_website>
|
243 |
-
<show_in_store>1</show_in_store>
|
244 |
-
<comment>
|
245 |
-
<![CDATA[
|
246 |
-
<strong>Free Shipping</strong> - no charge to customer.<br/>
|
247 |
-
<strong>Fixed Price / Flat Rate</strong> - customer always pays the amount set in "Shipping Price" below.<br/>
|
248 |
-
<strong>Dynamic Pricing</strong><br/>
|
249 |
-
- <strong>All</strong>: All quotes from carriers in "allowed carriers" are shown for the customer to choose from.<br/>
|
250 |
-
]]>
|
251 |
-
</comment>
|
252 |
-
</method>
|
253 |
-
<shipping_fee translate="label">
|
254 |
-
<label>Shipping Price</label>
|
255 |
-
<frontend_type>text</frontend_type>
|
256 |
-
<sort_order>20</sort_order>
|
257 |
-
<show_in_default>1</show_in_default>
|
258 |
-
<show_in_website>1</show_in_website>
|
259 |
-
<show_in_store>1</show_in_store>
|
260 |
-
</shipping_fee>
|
261 |
-
<!-- <handling_fee translate="label">
|
262 |
-
<label>Handling Fee / Markup</label>
|
263 |
-
<frontend_type>text</frontend_type>
|
264 |
-
<sort_order>30</sort_order>
|
265 |
-
<show_in_default>1</show_in_default>
|
266 |
-
<show_in_website>1</show_in_website>
|
267 |
-
<show_in_store>1</show_in_store>
|
268 |
-
</handling_fee>
|
269 |
-
<handling_type translate="label">
|
270 |
-
<label>Handling Fee Calculation</label>
|
271 |
-
<frontend_type>select</frontend_type>
|
272 |
-
<source_model>shipping/source_handlingType</source_model>
|
273 |
-
<sort_order>40</sort_order>
|
274 |
-
<show_in_default>1</show_in_default>
|
275 |
-
<show_in_website>1</show_in_website>
|
276 |
-
<show_in_store>0</show_in_store>
|
277 |
-
</handling_type>-->
|
278 |
-
</fields>
|
279 |
-
</pricing>
|
280 |
-
<units translate="label">
|
281 |
-
<label>Units</label>
|
282 |
-
<frontend_type>text</frontend_type>
|
283 |
-
<sort_order>40</sort_order>
|
284 |
-
<show_in_default>1</show_in_default>
|
285 |
-
<show_in_website>1</show_in_website>
|
286 |
-
<show_in_store>1</show_in_store>
|
287 |
-
<fields>
|
288 |
-
<measure translate="label">
|
289 |
-
<label>Measure Unit</label>
|
290 |
-
<frontend_type>select</frontend_type>
|
291 |
-
<source_model>sendabox_sendabox/system_config_source_unit_measure</source_model>
|
292 |
-
<sort_order>10</sort_order>
|
293 |
-
<show_in_default>1</show_in_default>
|
294 |
-
<show_in_website>1</show_in_website>
|
295 |
-
<show_in_store>1</show_in_store>
|
296 |
-
<comment><![CDATA[The units used for product measurements]]></comment>
|
297 |
-
</measure>
|
298 |
-
<weight translate="label">
|
299 |
-
<label>Weight Unit</label>
|
300 |
-
<frontend_type>select</frontend_type>
|
301 |
-
<source_model>sendabox_sendabox/system_config_source_unit_weight</source_model>
|
302 |
-
<sort_order>20</sort_order>
|
303 |
-
<show_in_default>1</show_in_default>
|
304 |
-
<show_in_website>1</show_in_website>
|
305 |
-
<show_in_store>1</show_in_store>
|
306 |
-
<comment><![CDATA[The units used for product weights]]></comment>
|
307 |
-
</weight>
|
308 |
-
</fields>
|
309 |
-
</units>
|
310 |
-
<defaults translate="label">
|
311 |
-
<label>Packaging</label>
|
312 |
-
<frontend_type>text</frontend_type>
|
313 |
-
<sort_order>50</sort_order>
|
314 |
-
<show_in_default>1</show_in_default>
|
315 |
-
<show_in_website>1</show_in_website>
|
316 |
-
<show_in_store>1</show_in_store>
|
317 |
-
<comment><![CDATA[Default values will be used for all products that do not have product specific dimensions.]]></comment>
|
318 |
-
<fields>
|
319 |
-
<length translate="label">
|
320 |
-
<label>Length</label>
|
321 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
322 |
-
<frontend_type>text</frontend_type>
|
323 |
-
<sort_order>30</sort_order>
|
324 |
-
<show_in_default>1</show_in_default>
|
325 |
-
<show_in_website>1</show_in_website>
|
326 |
-
<show_in_store>1</show_in_store>
|
327 |
-
</length>
|
328 |
-
<width translate="label">
|
329 |
-
<label>Width</label>
|
330 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
331 |
-
<frontend_type>text</frontend_type>
|
332 |
-
<sort_order>40</sort_order>
|
333 |
-
<show_in_default>1</show_in_default>
|
334 |
-
<show_in_website>1</show_in_website>
|
335 |
-
<show_in_store>1</show_in_store>
|
336 |
-
</width>
|
337 |
-
<height translate="label">
|
338 |
-
<label>Height</label>
|
339 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
340 |
-
<frontend_type>text</frontend_type>
|
341 |
-
<sort_order>50</sort_order>
|
342 |
-
<show_in_default>1</show_in_default>
|
343 |
-
<show_in_website>1</show_in_website>
|
344 |
-
<show_in_store>1</show_in_store>
|
345 |
-
<comment><![CDATA[If unknown use 10x10x10]]></comment>
|
346 |
-
</height>
|
347 |
-
</fields>
|
348 |
-
</defaults>
|
349 |
-
<origin translate="label">
|
350 |
-
<label>Stock origin (warehouse) details</label>
|
351 |
-
<frontend_type>text</frontend_type>
|
352 |
-
<sort_order>80</sort_order>
|
353 |
-
<show_in_default>1</show_in_default>
|
354 |
-
<show_in_website>0</show_in_website>
|
355 |
-
<show_in_store>0</show_in_store>
|
356 |
-
<comment><![CDATA[Please enter the details of your pick-up location for all products.]]></comment>
|
357 |
-
<fields>
|
358 |
-
<contact_name translate="label">
|
359 |
-
<label>Name</label>
|
360 |
-
<frontend_type>text</frontend_type>
|
361 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
362 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
363 |
-
<sort_order>10</sort_order>
|
364 |
-
<show_in_default>1</show_in_default>
|
365 |
-
<show_in_website>0</show_in_website>
|
366 |
-
<show_in_store>0</show_in_store>
|
367 |
-
</contact_name>
|
368 |
-
<contact_surname translate="label">
|
369 |
-
<label>Surname</label>
|
370 |
-
<frontend_type>text</frontend_type>
|
371 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
372 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
373 |
-
<sort_order>20</sort_order>
|
374 |
-
<show_in_default>1</show_in_default>
|
375 |
-
<show_in_website>0</show_in_website>
|
376 |
-
<show_in_store>0</show_in_store>
|
377 |
-
</contact_surname>
|
378 |
-
<street translate="label">
|
379 |
-
<label>Street</label>
|
380 |
-
<frontend_type>text</frontend_type>
|
381 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
382 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
383 |
-
<sort_order>30</sort_order>
|
384 |
-
<show_in_default>1</show_in_default>
|
385 |
-
<show_in_website>0</show_in_website>
|
386 |
-
<show_in_store>0</show_in_store>
|
387 |
-
</street>
|
388 |
-
<number translate="label">
|
389 |
-
<label>Number</label>
|
390 |
-
<frontend_type>text</frontend_type>
|
391 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
392 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
393 |
-
<sort_order>40</sort_order>
|
394 |
-
<show_in_default>1</show_in_default>
|
395 |
-
<show_in_website>0</show_in_website>
|
396 |
-
<show_in_store>0</show_in_store>
|
397 |
-
</number>
|
398 |
-
<c_o translate="label">
|
399 |
-
<label>C/O</label>
|
400 |
-
<frontend_type>text</frontend_type>
|
401 |
-
<sort_order>50</sort_order>
|
402 |
-
<show_in_default>1</show_in_default>
|
403 |
-
<show_in_website>0</show_in_website>
|
404 |
-
<show_in_store>0</show_in_store>
|
405 |
-
</c_o>
|
406 |
-
<city translate="label">
|
407 |
-
<label>City</label>
|
408 |
-
<frontend_type>text</frontend_type>
|
409 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
410 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
411 |
-
<sort_order>60</sort_order>
|
412 |
-
<show_in_default>1</show_in_default>
|
413 |
-
<show_in_website>0</show_in_website>
|
414 |
-
<show_in_store>0</show_in_store>
|
415 |
-
<comment>
|
416 |
-
<![CDATA[<div id="autocompleter_city_origin" class="ddl_city"></div>]]>
|
417 |
-
</comment>
|
418 |
-
</city>
|
419 |
-
<city_id translate="label">
|
420 |
-
<label>City Id</label>
|
421 |
-
<frontend_type>text</frontend_type>
|
422 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
423 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
424 |
-
<sort_order>70</sort_order>
|
425 |
-
<show_in_default>1</show_in_default>
|
426 |
-
<show_in_website>0</show_in_website>
|
427 |
-
<show_in_store>0</show_in_store>
|
428 |
-
<comment><![CDATA[Inserted automatically after choosing the city. Do not modify it]]></comment>
|
429 |
-
</city_id>
|
430 |
-
<postcode translate="label">
|
431 |
-
<label>Postcode</label>
|
432 |
-
<frontend_type>text</frontend_type>
|
433 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
434 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
435 |
-
<sort_order>80</sort_order>
|
436 |
-
<show_in_default>1</show_in_default>
|
437 |
-
<show_in_website>1</show_in_website>
|
438 |
-
<show_in_store>0</show_in_store>
|
439 |
-
<validate>validate-zip</validate>
|
440 |
-
</postcode>
|
441 |
-
<phone translate="label">
|
442 |
-
<label>Phone </label>
|
443 |
-
<frontend_type>text</frontend_type>
|
444 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
445 |
-
<backend_model>sendabox_sendabox/system_config_backend_form_field_required_text</backend_model>
|
446 |
-
<sort_order>90</sort_order>
|
447 |
-
<show_in_default>1</show_in_default>
|
448 |
-
<show_in_website>0</show_in_website>
|
449 |
-
<show_in_store>0</show_in_store>
|
450 |
-
</phone>
|
451 |
-
<email translate="label">
|
452 |
-
<label>Email</label>
|
453 |
-
<frontend_type>text</frontend_type>
|
454 |
-
<frontend_model>sendabox_sendabox/adminhtml_system_config_form_field_required</frontend_model>
|
455 |
-
<sort_order>100</sort_order>
|
456 |
-
<show_in_default>1</show_in_default>
|
457 |
-
<show_in_website>0</show_in_website>
|
458 |
-
<show_in_store>0</show_in_store>
|
459 |
-
<validate>validate-email</validate>
|
460 |
-
</email>
|
461 |
-
<notes translate="label">
|
462 |
-
<label>Notes</label>
|
463 |
-
<frontend_type>textarea</frontend_type>
|
464 |
-
<sort_order>110</sort_order>
|
465 |
-
<show_in_default>1</show_in_default>
|
466 |
-
<show_in_website>0</show_in_website>
|
467 |
-
<show_in_store>0</show_in_store>
|
468 |
-
<validate>validate-length maximum-length-60</validate>
|
469 |
-
<comment><![CDATA[Please, do not use more than 60 characters]]></comment>
|
470 |
-
</notes>
|
471 |
-
</fields>
|
472 |
-
</origin>
|
473 |
-
</groups>
|
474 |
-
</sendabox_options>
|
475 |
-
</sections>
|
476 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Sendabox/sql/sendabox_sendabox_setup/mysql4-install-1.0.0.php
DELETED
@@ -1,205 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
set_time_limit(0);
|
4 |
-
|
5 |
-
/* @var $this Mage_Eav_Model_Entity_Setup */
|
6 |
-
/* @var $installer Mage_Eav_Model_Entity_Setup */
|
7 |
-
|
8 |
-
$installer = $this;
|
9 |
-
$installer->startSetup();
|
10 |
-
|
11 |
-
// Add custom Sendabox attributes
|
12 |
-
$installer->addAttributeGroup('catalog_product', 'Default', 'Sendabox', 99);
|
13 |
-
|
14 |
-
$installer->addAttribute('catalog_product', 'sendabox_length',
|
15 |
-
array(
|
16 |
-
'type' => 'decimal',
|
17 |
-
'label' => 'Length',
|
18 |
-
'group' => 'Sendabox',
|
19 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
20 |
-
'visible' => true,
|
21 |
-
'required' => false,
|
22 |
-
'user_defined' => false,
|
23 |
-
'searchable' => false,
|
24 |
-
'filterable' => false,
|
25 |
-
'comparable' => false,
|
26 |
-
'visible_on_front' => false,
|
27 |
-
'unique' => false
|
28 |
-
)
|
29 |
-
);
|
30 |
-
|
31 |
-
$installer->addAttribute('catalog_product', 'sendabox_width',
|
32 |
-
array(
|
33 |
-
'type' => 'decimal',
|
34 |
-
'label' => 'Width',
|
35 |
-
'group' => 'Sendabox',
|
36 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
37 |
-
'visible' => true,
|
38 |
-
'required' => false,
|
39 |
-
'user_defined' => false,
|
40 |
-
'searchable' => false,
|
41 |
-
'filterable' => false,
|
42 |
-
'comparable' => false,
|
43 |
-
'visible_on_front' => false,
|
44 |
-
'unique' => false
|
45 |
-
)
|
46 |
-
);
|
47 |
-
|
48 |
-
$installer->addAttribute('catalog_product', 'sendabox_height',
|
49 |
-
array(
|
50 |
-
'type' => 'decimal',
|
51 |
-
'label' => 'Height',
|
52 |
-
'group' => 'Sendabox',
|
53 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
54 |
-
'visible' => true,
|
55 |
-
'required' => false,
|
56 |
-
'user_defined' => false,
|
57 |
-
'searchable' => false,
|
58 |
-
'filterable' => false,
|
59 |
-
'comparable' => false,
|
60 |
-
'visible_on_front' => false,
|
61 |
-
'unique' => false
|
62 |
-
)
|
63 |
-
);
|
64 |
-
|
65 |
-
// Create custom tables
|
66 |
-
$installer->run("
|
67 |
-
DROP TABLE IF EXISTS {$this->getTable('sendabox_shipment')};
|
68 |
-
CREATE TABLE {$this->getTable('sendabox_shipment')} (
|
69 |
-
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
70 |
-
`order_id` int(10) UNSIGNED NOT NULL,
|
71 |
-
`status` int(10) NOT NULL DEFAULT '0',
|
72 |
-
`customer_selected_quote_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
|
73 |
-
`customer_selected_quote_description` TEXT NOT NULL,
|
74 |
-
`admin_selected_quote_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
|
75 |
-
`customer_cost` decimal(12,4) UNSIGNED NOT NULL,
|
76 |
-
`destination_name` varchar(250) NOT NULL,
|
77 |
-
`destination_surname` varchar(250) NOT NULL,
|
78 |
-
`destination_at` varchar(250),
|
79 |
-
`destination_street` varchar(250) NOT NULL,
|
80 |
-
`destination_number` varchar(250),
|
81 |
-
`destination_city` varchar(250) NOT NULL,
|
82 |
-
`destination_id` varchar(250),
|
83 |
-
`destination_postcode` varchar(250) NOT NULL,
|
84 |
-
`destination_phone` varchar(250),
|
85 |
-
`destination_email` varchar(250) NOT NULL,
|
86 |
-
`destination_note` varchar(250),
|
87 |
-
PRIMARY KEY (`id`)
|
88 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
89 |
-
");
|
90 |
-
|
91 |
-
|
92 |
-
$installer->run("
|
93 |
-
DROP TABLE IF EXISTS {$this->getTable('sendabox_box')};
|
94 |
-
CREATE TABLE {$this->getTable('sendabox_box')} (
|
95 |
-
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
96 |
-
`shipment_id` int(13) NOT NULL,
|
97 |
-
`comment` text NOT NULL,
|
98 |
-
`qty` int(11) NOT NULL DEFAULT '1',
|
99 |
-
`value` decimal(12,4) NOT NULL,
|
100 |
-
`measure_unit` varchar(255) NOT NULL,
|
101 |
-
`length` decimal(12,4) NOT NULL,
|
102 |
-
`width` decimal(12,4) NOT NULL,
|
103 |
-
`height` decimal(12,4) NOT NULL,
|
104 |
-
`weight_unit` varchar(255) NOT NULL,
|
105 |
-
`weight` decimal(12,4) NOT NULL,
|
106 |
-
PRIMARY KEY (`id`),
|
107 |
-
KEY `shipment_id` (`shipment_id`)
|
108 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
109 |
-
");
|
110 |
-
|
111 |
-
$installer->run("
|
112 |
-
DROP TABLE IF EXISTS {$this->getTable('sendabox_quote')};
|
113 |
-
CREATE TABLE {$this->getTable('sendabox_quote')} (
|
114 |
-
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
115 |
-
`magento_quote_id` int(10) UNSIGNED NOT NULL,
|
116 |
-
`carrier_id` int(13) UNSIGNED NOT NULL,
|
117 |
-
`accepted` boolean NOT NULL DEFAULT '0',
|
118 |
-
`total_price` decimal(12, 4) NOT NULL,
|
119 |
-
`base_price` decimal(12, 4) NOT NULL,
|
120 |
-
`tax` decimal(12, 4) NOT NULL,
|
121 |
-
`insurance_total_price` decimal(12, 4) NOT NULL,
|
122 |
-
`currency` varchar(10) NOT NULL,
|
123 |
-
`id_price` int(13) UNSIGNED NOT NULL,
|
124 |
-
`commercial_name` varchar(255) NOT NULL,
|
125 |
-
PRIMARY KEY (`id`),
|
126 |
-
INDEX (`carrier_id`)
|
127 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
128 |
-
");
|
129 |
-
|
130 |
-
$installer->run("
|
131 |
-
DROP TABLE IF EXISTS {$this->getTable('sendabox_carrier')};
|
132 |
-
CREATE TABLE {$this->getTable('sendabox_carrier')} (
|
133 |
-
`id` int(13) UNSIGNED NOT NULL AUTO_INCREMENT,
|
134 |
-
`carrier_id` bigint(20) NOT NULL,
|
135 |
-
`company_name` varchar(250) NOT NULL,
|
136 |
-
PRIMARY KEY (`id`),
|
137 |
-
INDEX (`carrier_id`)
|
138 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
139 |
-
|
140 |
-
INSERT INTO {$this->getTable('sendabox_carrier')} (`id`, `carrier_id`, `company_name`) VALUES
|
141 |
-
(1, 2, 'Bartolini'),
|
142 |
-
(2, 6, 'SDA');
|
143 |
-
");
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
$installer
|
148 |
-
->getConnection()
|
149 |
-
->addConstraint(
|
150 |
-
'FK_QUOTE_CARRIER',
|
151 |
-
$installer->getTable('sendabox_quote'),
|
152 |
-
'carrier_id',
|
153 |
-
$installer->getTable('sendabox_carrier'),
|
154 |
-
'id',
|
155 |
-
'cascade',
|
156 |
-
'cascade'
|
157 |
-
);
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
// Insert a list of states into the regions database. Magento will then pick
|
164 |
-
// these up when displaying addresses and allow the user to select from a drop-down
|
165 |
-
// list, rather than having to type them in manually.
|
166 |
-
/*$regions = array(
|
167 |
-
array('code' => 'ACT', 'name' => 'Australia Capital Territory'),
|
168 |
-
array('code' => 'NSW', 'name' => 'New South Wales'),
|
169 |
-
array('code' => 'NT', 'name' => 'Northern Territory'),
|
170 |
-
array('code' => 'QLD', 'name' => 'Queensland'),
|
171 |
-
array('code' => 'SA', 'name' => 'South Australia'),
|
172 |
-
array('code' => 'TAS', 'name' => 'Tasmania'),
|
173 |
-
array('code' => 'VIC', 'name' => 'Victoria'),
|
174 |
-
array('code' => 'WA', 'name' => 'Western Australia')
|
175 |
-
);
|
176 |
-
|
177 |
-
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
178 |
-
|
179 |
-
foreach ($regions as $region) {
|
180 |
-
// Check if this region has already been added
|
181 |
-
$result = $db->fetchOne("SELECT code FROM " . $this->getTable('directory_country_region') . " WHERE `country_id` = 'AU' AND `code` = '" . $region['code'] . "'");
|
182 |
-
if ($result != $region['code']) {
|
183 |
-
$installer->run(
|
184 |
-
"INSERT INTO `{$this->getTable('directory_country_region')}` (`country_id`, `code`, `default_name`) VALUES
|
185 |
-
('AU', '" . $region['code'] . "', '" . $region['name'] . "');
|
186 |
-
INSERT INTO `{$this->getTable('directory_country_region_name')}` (`locale`, `region_id`, `name`) VALUES
|
187 |
-
('en_US', LAST_INSERT_ID(), '" . $region['name'] . "'), ('en_AU', LAST_INSERT_ID(), '" . $region['name'] . "');"
|
188 |
-
);
|
189 |
-
}
|
190 |
-
}
|
191 |
-
*/
|
192 |
-
/**Add foreign key to table. If FK with same name exist - it will be deleted
|
193 |
-
*
|
194 |
-
* @param string $fkName foreign key name
|
195 |
-
* @param string $tableName main table name
|
196 |
-
* @param string $keyName main table field name
|
197 |
-
* @param string $refTableName refered table name
|
198 |
-
* @param string $refKeyName refered table field name
|
199 |
-
* @param string $onUpdate on update statement
|
200 |
-
* @param string $onDelete on delete statement
|
201 |
-
* @param bool $purge
|
202 |
-
* @return mixed
|
203 |
-
*/
|
204 |
-
|
205 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Check.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 23/6/2015
|
6 |
+
* Time: 14:33
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Check extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_blockGroup = 'sendabox_shippingext';
|
13 |
+
$this->_controller = 'adminhtml_check';
|
14 |
+
parent::__construct();
|
15 |
+
$this->removeButton('add');
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 18/6/2015
|
6 |
+
* Time: 11:30
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_blockGroup = 'sendabox_shippingext';
|
13 |
+
$this->_controller = 'adminhtml_order';
|
14 |
+
$this->_headerText = Mage::helper('sendabox_shippingext')->__('Orders');
|
15 |
+
parent::__construct();
|
16 |
+
$this->removeButton('add');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 18/6/2015
|
6 |
+
* Time: 11:32
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
10 |
+
|
11 |
+
protected $_order;
|
12 |
+
protected $_order_details;
|
13 |
+
protected $_order_boxes;
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
// $this->_objectId = 'id';
|
17 |
+
parent::__construct();
|
18 |
+
$this->_blockGroup = 'sendabox_shippingext';
|
19 |
+
$this->_controller = 'adminhtml_order';
|
20 |
+
$this->_mode = 'edit';
|
21 |
+
|
22 |
+
$this->removeButton('save');
|
23 |
+
$this->removeButton('delete');
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getOrder()
|
28 |
+
{ if (!$this->_order) {
|
29 |
+
$this->_order = Mage::registry('sendabox_order');
|
30 |
+
}
|
31 |
+
return $this->_order;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getOrderDetails()
|
35 |
+
{ if (!$this->_order_details) {
|
36 |
+
$this->_order_details = Mage::registry('sendabox_order_details');
|
37 |
+
}
|
38 |
+
return $this->_order_details;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getHeaderText()
|
42 |
+
{
|
43 |
+
if ($this->getOrder() && $this->getOrder()->getId()) {
|
44 |
+
return $foo= Mage::helper('sendabox_shippingext')->__(
|
45 |
+
'Order # %s ',
|
46 |
+
$this->htmlEscape($this->getOrder()->getId())
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Form.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:03
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
protected $_order;
|
11 |
+
private function getOrder()
|
12 |
+
{
|
13 |
+
if (!$this->_order) {
|
14 |
+
$this->_order = Mage::registry('sendabox_order_data');
|
15 |
+
}
|
16 |
+
return $this->_order;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
}
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Abstract.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
abstract class
|
4 |
{
|
5 |
|
6 |
protected $_helper = null;
|
@@ -8,7 +8,7 @@ abstract class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract exte
|
|
8 |
public function __construct()
|
9 |
{
|
10 |
parent::__construct();
|
11 |
-
$this->setParentBlock(Mage::getBlockSingleton('
|
12 |
}
|
13 |
|
14 |
/**
|
@@ -16,9 +16,9 @@ abstract class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract exte
|
|
16 |
*
|
17 |
* @return Sendabox_Sendabox_Model_Shipment
|
18 |
*/
|
19 |
-
public function
|
20 |
{
|
21 |
-
return $this->getParentBlock()->
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -28,7 +28,7 @@ abstract class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract exte
|
|
28 |
*/
|
29 |
public function getQuotes()
|
30 |
{
|
31 |
-
return $this->
|
32 |
}
|
33 |
|
34 |
public function formatCurrency($price)
|
@@ -41,7 +41,7 @@ abstract class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract exte
|
|
41 |
if (!$unit) {
|
42 |
$unit = $this->getSendaboxHelper()->getConfigData('units/weight');
|
43 |
}
|
44 |
-
return Mage::getModel('
|
45 |
->getBriefOptionLabel($unit);
|
46 |
}
|
47 |
|
@@ -50,13 +50,13 @@ abstract class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract exte
|
|
50 |
if (!$unit) {
|
51 |
$unit = $this->getSendaboxHelper()->getConfigData('units/measure');
|
52 |
}
|
53 |
-
return Mage::getModel('
|
54 |
->getBriefOptionLabel($unit);
|
55 |
}
|
56 |
|
57 |
public function getSendaboxHelper() {
|
58 |
if (!$this->_helper) {
|
59 |
-
$this->_helper = Mage::helper('
|
60 |
}
|
61 |
return $this->_helper;
|
62 |
}
|
1 |
<?php
|
2 |
|
3 |
+
abstract class Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Tab_Abstract extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
|
6 |
protected $_helper = null;
|
8 |
public function __construct()
|
9 |
{
|
10 |
parent::__construct();
|
11 |
+
$this->setParentBlock(Mage::getBlockSingleton('sendabox_shippingext/adminhtml_order_edit'));
|
12 |
}
|
13 |
|
14 |
/**
|
16 |
*
|
17 |
* @return Sendabox_Sendabox_Model_Shipment
|
18 |
*/
|
19 |
+
public function getOrder()
|
20 |
{
|
21 |
+
return $this->getParentBlock()->getOrder();
|
22 |
}
|
23 |
|
24 |
/**
|
28 |
*/
|
29 |
public function getQuotes()
|
30 |
{
|
31 |
+
return $this->getOrder()->getQuotes(true);
|
32 |
}
|
33 |
|
34 |
public function formatCurrency($price)
|
41 |
if (!$unit) {
|
42 |
$unit = $this->getSendaboxHelper()->getConfigData('units/weight');
|
43 |
}
|
44 |
+
return Mage::getModel('sendabox_shippingext/system_config_source_unit_weight')
|
45 |
->getBriefOptionLabel($unit);
|
46 |
}
|
47 |
|
50 |
if (!$unit) {
|
51 |
$unit = $this->getSendaboxHelper()->getConfigData('units/measure');
|
52 |
}
|
53 |
+
return Mage::getModel('sendabox_shippingext/system_config_source_unit_measure')
|
54 |
->getBriefOptionLabel($unit);
|
55 |
}
|
56 |
|
57 |
public function getSendaboxHelper() {
|
58 |
if (!$this->_helper) {
|
59 |
+
$this->_helper = Mage::helper('sendabox_shippingext');
|
60 |
}
|
61 |
return $this->_helper;
|
62 |
}
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form.php
RENAMED
@@ -1,16 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
-
extends
|
5 |
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
{
|
7 |
-
|
8 |
-
protected $_template = 'sendabox/sendabox/shipment.phtml';
|
9 |
-
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
13 |
-
|
14 |
}
|
15 |
|
16 |
public function getTabLabel()
|
@@ -32,5 +29,7 @@ class Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Form
|
|
32 |
{
|
33 |
return false;
|
34 |
}
|
35 |
-
|
|
|
|
|
36 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Tab_Form
|
4 |
+
extends Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Tab_Abstract
|
5 |
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
{
|
|
|
|
|
|
|
7 |
public function __construct()
|
8 |
{
|
9 |
parent::__construct();
|
10 |
+
|
11 |
}
|
12 |
|
13 |
public function getTabLabel()
|
29 |
{
|
30 |
return false;
|
31 |
}
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
}
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Anywhere.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Tab_Form_Anywhere extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
{
|
5 |
|
6 |
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Tab/Form/Boxes.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Boxes extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Products.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
/**
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Products extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
{
|
5 |
|
6 |
/**
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Quotes.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
protected $_cheapest_quote_id;
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Quotes extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
{
|
5 |
|
6 |
protected $_cheapest_quote_id;
|
app/code/community/Sendabox/{Sendabox/Block/Adminhtml/Shipment → Shippingext/Block/Adminhtml/Order}/Edit/Tab/Form/Status.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
/**
|
6 |
* @var Sendabox_Sendabox_Model_Quote
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Status extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
{
|
5 |
/**
|
6 |
* @var Sendabox_Sendabox_Model_Quote
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Edit/Tabs.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* News List admin edit form tabs block
|
4 |
+
*
|
5 |
+
* @author Magento
|
6 |
+
*/
|
7 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
8 |
+
{
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this->setId('sendabox_order_edit_tabs');
|
13 |
+
$this->setDestElementId('edit_form');
|
14 |
+
$this->setTitle(Mage::helper('sendabox_shippingext')->__('Order Details'));
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Grid.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 18/6/2015
|
6 |
+
* Time: 11:38
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('grid_id');
|
15 |
+
$this->setDefaultDir('asc');
|
16 |
+
$this->setSaveParametersInSession(true);
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareCollection()
|
20 |
+
{
|
21 |
+
$collection = Mage::getModel('sendabox_shippingext/shipment')->getCollection()
|
22 |
+
->join('sendabox_shippingext/box', 'main_table.shipping_id=`sendabox_shippingext/box`.`shipment_id`',array('sendabox_order_id_encoded','value','carrier'));
|
23 |
+
|
24 |
+
$collection->getSelect()->group('shipment_id')->order(array(
|
25 |
+
'shipping_id DESC'
|
26 |
+
));
|
27 |
+
|
28 |
+
$this->setCollection($collection);
|
29 |
+
return parent::_prepareCollection();
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _prepareColumns()
|
33 |
+
{
|
34 |
+
$this->addColumn('shipping_id', array(
|
35 |
+
'header' => $this->__('Shipping Id #'),
|
36 |
+
'index' => 'shipping_id',
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->addColumn('order_id', array(
|
40 |
+
'header' => $this->__('Order ID'),
|
41 |
+
'index' => 'order_id'
|
42 |
+
));
|
43 |
+
|
44 |
+
$this->addColumn('destination_name', array(
|
45 |
+
'header' => $this->__('Order Name/Surname'),
|
46 |
+
'renderer' => 'Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_NameSurname',
|
47 |
+
'params' => 'destination_surname',
|
48 |
+
'index' => 'destination_name'
|
49 |
+
));
|
50 |
+
|
51 |
+
$this->addColumn('value', array(
|
52 |
+
'header' => $this->__('Price'),
|
53 |
+
'renderer' => 'Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_Price',
|
54 |
+
'index' => 'value'
|
55 |
+
));
|
56 |
+
$this->addColumn('ldv', array(
|
57 |
+
'header' => $this->__('LDV'),
|
58 |
+
'type' => 'text',
|
59 |
+
'renderer' => 'Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_LDV',
|
60 |
+
'params' => 'carrier',
|
61 |
+
'index' => 'sendabox_order_id_encoded'
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->addColumn('tracking', array(
|
65 |
+
'header' => $this->__('Tracking'),
|
66 |
+
'type' => 'text',
|
67 |
+
'renderer' => 'Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_Tracking',
|
68 |
+
'index' => 'sendabox_order_id_encoded'
|
69 |
+
));
|
70 |
+
|
71 |
+
$this->addColumn('action', array(
|
72 |
+
'header' => Mage::helper('sendabox_shippingext')->__('Action'),
|
73 |
+
'width' => '100',
|
74 |
+
'type' => 'action',
|
75 |
+
'getter' => 'getId',
|
76 |
+
'actions' => array(
|
77 |
+
'view' => array(
|
78 |
+
'caption' => Mage::helper('sendabox_shippingext')->__('View'),
|
79 |
+
'url' => array('base' => '*/*/edit'),
|
80 |
+
'field' => 'id'
|
81 |
+
)
|
82 |
+
),
|
83 |
+
'filter' => false,
|
84 |
+
'sortable' => false,
|
85 |
+
'is_system' => true,
|
86 |
+
));
|
87 |
+
|
88 |
+
$this->addExportType('*/*/exportCsv', $this->__('CSV'));
|
89 |
+
|
90 |
+
$this->addExportType('*/*/exportExcel', $this->__('Excel XML'));
|
91 |
+
|
92 |
+
return parent::_prepareColumns();
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getRowUrl($row)
|
96 |
+
{
|
97 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
98 |
+
}
|
99 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/LDV.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_LDV extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
5 |
+
{
|
6 |
+
public function render(Varien_Object $row)
|
7 |
+
{
|
8 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
9 |
+
$carrier = $row->getData($this->getColumn()->getParams());
|
10 |
+
return '<a href="http://sendabox.it/'.$carrier.'Trasporto/Index/'.$value.'" target="_blank">Link</a>';
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/NameSurname.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 25/6/2015
|
6 |
+
* Time: 16:05
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_NameSurname extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
9 |
+
{
|
10 |
+
public function render(Varien_Object $row)
|
11 |
+
{
|
12 |
+
$name = $row->getData($this->getColumn()->getIndex());
|
13 |
+
$surname = $row->getData($this->getColumn()->getParams());
|
14 |
+
return $name . " " . $surname;
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/Price.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 23/6/2015
|
6 |
+
* Time: 18:20
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_Price extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
9 |
+
{
|
10 |
+
public function render(Varien_Object $row)
|
11 |
+
{
|
12 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
13 |
+
return number_format($value,2).'€';
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Order/Rendered/Tracking.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 23/6/2015
|
6 |
+
* Time: 18:01
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Order_Rendered_Tracking extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
9 |
+
{
|
10 |
+
public function render(Varien_Object $row)
|
11 |
+
{
|
12 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
13 |
+
return '<a href="http://sendabox.it/Trackings/Index/'.$value.'" target="_blank">Link</a>';
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:03
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_blockGroup = 'sendabox_shippingext';
|
13 |
+
$this->_controller = 'adminhtml_shipment';
|
14 |
+
$this->_headerText = Mage::helper('sendabox_shippingext')->__('Manage Shipments');
|
15 |
+
parent::__construct();
|
16 |
+
$this->removeButton('add');
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
}
|
21 |
+
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:03
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
9 |
+
{
|
10 |
+
protected $_order;
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
// $this->_objectId = 'id';
|
14 |
+
parent::__construct();
|
15 |
+
$this->_blockGroup = 'sendabox_shippingext';
|
16 |
+
$this->_controller = 'adminhtml_shipment';
|
17 |
+
$this->_mode = 'edit';
|
18 |
+
|
19 |
+
$this->removeButton('save');
|
20 |
+
$this->removeButton('delete');
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
public function getOrder()
|
28 |
+
{ if (!$this->_order) {
|
29 |
+
$this->_order = Mage::registry('sendabox_order_data');
|
30 |
+
}
|
31 |
+
return $this->_order;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getHeaderText()
|
35 |
+
{
|
36 |
+
$baseDir = Mage::getBaseDir('app').DS.'code/community/Sendabox/Shippingext/tmp/';
|
37 |
+
|
38 |
+
$file=$this->getOrder()->getRealOrderId().'.xml';
|
39 |
+
if(file_exists($baseDir.$file)){
|
40 |
+
unlink($baseDir.$file);
|
41 |
+
}
|
42 |
+
if ($this->getOrder() && $this->getOrder()->getId()) {
|
43 |
+
return $foo= Mage::helper('sendabox_shippingext')->__(
|
44 |
+
'Order # %s | %s',
|
45 |
+
$this->htmlEscape($this->getOrder()->getRealOrderId()),
|
46 |
+
$this->htmlEscape($this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true))
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Form.php
ADDED
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:03
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
protected $_order;
|
11 |
+
private function getOrder()
|
12 |
+
{
|
13 |
+
if (!$this->_order) {
|
14 |
+
$this->_order = Mage::registry('sendabox_order_data');
|
15 |
+
}
|
16 |
+
return $this->_order;
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareForm()
|
20 |
+
{
|
21 |
+
$url='http://ws.sendabox.it/SBWS.asmx/GetCountries';
|
22 |
+
|
23 |
+
$headers=array("Content-Type"=>"application/json");
|
24 |
+
$http = new Varien_Http_Adapter_Curl();
|
25 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, "");
|
26 |
+
if ($http->read() === false) {
|
27 |
+
return false;
|
28 |
+
}
|
29 |
+
|
30 |
+
$countries = array();
|
31 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
32 |
+
$body = substr($http->read(), $header_size);
|
33 |
+
$result = json_decode($body,true);
|
34 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
35 |
+
echo $result["ErrorMsg"];
|
36 |
+
} else {
|
37 |
+
foreach($result as $res)
|
38 |
+
{
|
39 |
+
$countries[$res["idcountry"]] = $res["name"] ;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
$agenda = array();
|
44 |
+
$agenda[0] = "Select destination...";
|
45 |
+
$collection = Mage::getModel('sendabox_shippingext/agenda')->getCollection();
|
46 |
+
foreach($collection as $c){
|
47 |
+
$agenda[$c->getData("sender_id")] = $c->getData("name")." ".$c->getData("surname")." ".$c->getData("address")." ".$c->getData("street_number")." ".$c->getData("city")." ".$c->getData("province");
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
$form = new Varien_Data_Form();
|
52 |
+
|
53 |
+
$form->setUseContainer(true);
|
54 |
+
$this->setForm($form);
|
55 |
+
// $form->addField(
|
56 |
+
// 'fake_note',
|
57 |
+
// 'note',
|
58 |
+
// array(
|
59 |
+
// 'text' => '<ul class="messages"><li class="notice-msg"><ul><li>'
|
60 |
+
// . Mage::helper('sendabox_shippingext')->__('This form is fake, so the data in the grid '
|
61 |
+
// . 'you just clicked on won\'t be here, do not be alarmed, this is normal')
|
62 |
+
// . '</li></ul></li></ul>',
|
63 |
+
// )
|
64 |
+
// );
|
65 |
+
|
66 |
+
$form->addField(
|
67 |
+
'box_shiiping_from',
|
68 |
+
'note',
|
69 |
+
array(
|
70 |
+
'text' => '<div class="box-left">',
|
71 |
+
)
|
72 |
+
);
|
73 |
+
$fieldset = $form->addFieldset(
|
74 |
+
'shipping_fieldset',
|
75 |
+
array(
|
76 |
+
'legend' => Mage::helper('sendabox_shippingext')->__('Departure Information'),
|
77 |
+
)
|
78 |
+
);
|
79 |
+
# now add fields on to the fieldset object, for more detailed info
|
80 |
+
# see https://makandracards.com/magento/12737-admin-form-field-types
|
81 |
+
$fieldset->addField(
|
82 |
+
'shipping_agenda', # the input id
|
83 |
+
'select', # the type
|
84 |
+
array(
|
85 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Agenda'),
|
86 |
+
'name' => 'shipping_agenda',
|
87 |
+
'values' => $agenda,
|
88 |
+
'onchange' => 'populateFields()'
|
89 |
+
)
|
90 |
+
);
|
91 |
+
$fieldset->addField(
|
92 |
+
'shipping_name', # the input id
|
93 |
+
'text', # the type
|
94 |
+
array(
|
95 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Name'),
|
96 |
+
'class' => 'required-entry',
|
97 |
+
'required' => true,
|
98 |
+
'name' => 'shipping_name',
|
99 |
+
)
|
100 |
+
);
|
101 |
+
$fieldset->addField(
|
102 |
+
'shipping_surname', # the input id
|
103 |
+
'text', # the type
|
104 |
+
array(
|
105 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Surname'),
|
106 |
+
'class' => 'required-entry',
|
107 |
+
'required' => true,
|
108 |
+
'name' => 'shipping_surname',
|
109 |
+
)
|
110 |
+
);
|
111 |
+
$fieldset->addField(
|
112 |
+
'shipping_co', # the input id
|
113 |
+
'text', # the type
|
114 |
+
array(
|
115 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping CO'),
|
116 |
+
'name' => 'shipping_co',
|
117 |
+
)
|
118 |
+
);
|
119 |
+
$fieldset->addField(
|
120 |
+
'shipping_address', # the input id
|
121 |
+
'text', # the type
|
122 |
+
array(
|
123 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Address'),
|
124 |
+
'class' => 'required-entry',
|
125 |
+
'required' => true,
|
126 |
+
'name' => 'shipping_address',
|
127 |
+
)
|
128 |
+
);
|
129 |
+
$fieldset->addField(
|
130 |
+
'shipping_streetnumber', # the input id
|
131 |
+
'text', # the type
|
132 |
+
array(
|
133 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Street Number'),
|
134 |
+
'class' => 'required-entry',
|
135 |
+
'required' => true,
|
136 |
+
'name' => 'shipping_streetnumber',
|
137 |
+
)
|
138 |
+
);
|
139 |
+
$fieldset->addField(
|
140 |
+
'shipping_city', # the input id
|
141 |
+
'text', # the type
|
142 |
+
array(
|
143 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping City'),
|
144 |
+
'class' => 'required-entry',
|
145 |
+
'required' => true,
|
146 |
+
'name' => 'shipping_city',
|
147 |
+
)
|
148 |
+
);
|
149 |
+
$fieldset->addField(
|
150 |
+
'shipping_province', # the input id
|
151 |
+
'text', # the type
|
152 |
+
array(
|
153 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Province'),
|
154 |
+
'class' => 'required-entry',
|
155 |
+
'required' => true,
|
156 |
+
'name' => 'shipping_province',
|
157 |
+
)
|
158 |
+
);
|
159 |
+
$fieldset->addField(
|
160 |
+
'shipping_zip', # the input id
|
161 |
+
'text', # the type
|
162 |
+
array(
|
163 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Zip'),
|
164 |
+
'class' => 'required-entry',
|
165 |
+
'required' => true,
|
166 |
+
'name' => 'shipping_zip',
|
167 |
+
)
|
168 |
+
);
|
169 |
+
$fieldset->addField(
|
170 |
+
'shipping_tel', # the input id
|
171 |
+
'text', # the type
|
172 |
+
array(
|
173 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping Telephone'),
|
174 |
+
'class' => 'required-entry',
|
175 |
+
'required' => true,
|
176 |
+
'name' => 'shipping_tel',
|
177 |
+
)
|
178 |
+
);
|
179 |
+
$fieldset->addField(
|
180 |
+
'shipping_email', # the input id
|
181 |
+
'text', # the type
|
182 |
+
array(
|
183 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Shipping email'),
|
184 |
+
'class' => 'required-entry validate-email',
|
185 |
+
'required' => true,
|
186 |
+
'name' => 'shipping_email',
|
187 |
+
)
|
188 |
+
);
|
189 |
+
$form->addField(
|
190 |
+
'',
|
191 |
+
'note',
|
192 |
+
array(
|
193 |
+
'text' => '</div>',
|
194 |
+
)
|
195 |
+
);
|
196 |
+
|
197 |
+
$form->addField(
|
198 |
+
'box_shiiping_to',
|
199 |
+
'note',
|
200 |
+
array(
|
201 |
+
'text' => '<div class="box-right">',
|
202 |
+
)
|
203 |
+
);
|
204 |
+
$fieldset = $form->addFieldset(
|
205 |
+
'destination_fieldset',
|
206 |
+
array(
|
207 |
+
'legend' => Mage::helper('sendabox_shippingext')->__('Destination Information'),
|
208 |
+
)
|
209 |
+
);
|
210 |
+
|
211 |
+
$fieldset->addField(
|
212 |
+
'destination_name', # the input id
|
213 |
+
'text', # the type
|
214 |
+
array(
|
215 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Name'),
|
216 |
+
'class' => 'required-entry',
|
217 |
+
'required' => true,
|
218 |
+
'name' => 'destination_name',
|
219 |
+
'value' =>$this->getOrder()->getShippingAddress()->getFirstname(),
|
220 |
+
|
221 |
+
)
|
222 |
+
);
|
223 |
+
$fieldset->addField(
|
224 |
+
'destination_surname', # the input id
|
225 |
+
'text', # the type
|
226 |
+
array(
|
227 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Surname'),
|
228 |
+
'class' => 'required-entry',
|
229 |
+
'required' => true,
|
230 |
+
'name' => 'destination_surname',
|
231 |
+
'value' =>$this->getOrder()->getShippingAddress()->getLastname(),
|
232 |
+
)
|
233 |
+
);
|
234 |
+
$fieldset->addField(
|
235 |
+
'destination_co', # the input id
|
236 |
+
'text', # the type
|
237 |
+
array(
|
238 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination CO'),
|
239 |
+
'name' => 'destination_co',
|
240 |
+
'value' =>$this->getOrder()->getShippingAddress()->getCompany(),
|
241 |
+
)
|
242 |
+
);
|
243 |
+
$fieldset->addField(
|
244 |
+
'destination_address', # the input id
|
245 |
+
'text', # the type
|
246 |
+
array(
|
247 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Address'),
|
248 |
+
'class' => 'required-entry',
|
249 |
+
'required' => true,
|
250 |
+
'name' => 'destination_address',
|
251 |
+
'value' =>$this->getOrder()->getShippingAddress()->getStreet(1),
|
252 |
+
)
|
253 |
+
);
|
254 |
+
$fieldset->addField(
|
255 |
+
'destination_streetnumber', # the input id
|
256 |
+
'text', # the type
|
257 |
+
array(
|
258 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Street Number'),
|
259 |
+
'class' => 'required-entry',
|
260 |
+
'required' => true,
|
261 |
+
'name' => 'destination_streetnumber',
|
262 |
+
|
263 |
+
)
|
264 |
+
);
|
265 |
+
$fieldset->addField(
|
266 |
+
'destination_city', # the input id
|
267 |
+
'text', # the type
|
268 |
+
array(
|
269 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination City'),
|
270 |
+
'class' => 'required-entry',
|
271 |
+
'required' => true,
|
272 |
+
'name' => 'destination_city',
|
273 |
+
'value' =>$this->getOrder()->getShippingAddress()->getCity(),
|
274 |
+
)
|
275 |
+
);
|
276 |
+
$fieldset->addField(
|
277 |
+
'destination_province', # the input id
|
278 |
+
'text', # the type
|
279 |
+
array(
|
280 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Province'),
|
281 |
+
'class' => 'required-entry',
|
282 |
+
'required' => true,
|
283 |
+
'name' => 'destination_province',
|
284 |
+
'value' =>$this->getOrder()->getShippingAddress()->getRegion(),
|
285 |
+
)
|
286 |
+
);
|
287 |
+
|
288 |
+
$fieldset->addField(
|
289 |
+
'destination_country', # the input id
|
290 |
+
'select', # the type
|
291 |
+
array(
|
292 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Country'),
|
293 |
+
'class' => 'required-entry',
|
294 |
+
'required' => true,
|
295 |
+
'name' => 'destination_country',
|
296 |
+
'value' => '1',
|
297 |
+
'values' => $countries,
|
298 |
+
)
|
299 |
+
);
|
300 |
+
$fieldset->addField(
|
301 |
+
'destination_zip', # the input id
|
302 |
+
'text', # the type
|
303 |
+
array(
|
304 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Zip'),
|
305 |
+
'class' => 'required-entry',
|
306 |
+
'required' => true,
|
307 |
+
'name' => 'destination_zip',
|
308 |
+
'value' =>$this->getOrder()->getShippingAddress()->getPostcode(),
|
309 |
+
)
|
310 |
+
);
|
311 |
+
$fieldset->addField(
|
312 |
+
'destination_tel', # the input id
|
313 |
+
'text', # the type
|
314 |
+
array(
|
315 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Destination Telephone'),
|
316 |
+
'class' => 'required-entry',
|
317 |
+
'required' => true,
|
318 |
+
'name' => 'destination_tel',
|
319 |
+
'value' =>$this->getOrder()->getShippingAddress()->getTelephone(),
|
320 |
+
)
|
321 |
+
);
|
322 |
+
$fieldset->addField(
|
323 |
+
'payment_method', # the input id
|
324 |
+
'text', # the type
|
325 |
+
array(
|
326 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Payment Method'),
|
327 |
+
'name' => 'payment_method',
|
328 |
+
'value' =>$this->getOrder()->getPayment()->getMethodInstance()->getTitle(),
|
329 |
+
'readonly' => true
|
330 |
+
)
|
331 |
+
);
|
332 |
+
$form->addField(
|
333 |
+
'close_destination',
|
334 |
+
'note',
|
335 |
+
array(
|
336 |
+
'text' => '</div>',
|
337 |
+
)
|
338 |
+
);
|
339 |
+
|
340 |
+
|
341 |
+
return parent::_prepareForm();
|
342 |
+
}
|
343 |
+
|
344 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Abstract.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Abstract extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_helper = null;
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
$this->setParentBlock(Mage::getBlockSingleton('sendabox_shippingext/adminhtml_shipment_edit'));
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Gets the shipment being edited.
|
16 |
+
*
|
17 |
+
* @return Sendabox_Sendabox_Model_Shipment
|
18 |
+
*/
|
19 |
+
public function getOrder()
|
20 |
+
{
|
21 |
+
return $this->getParentBlock()->getOrder();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Gets the saved Sendabox quotes for this order from the database.
|
26 |
+
*
|
27 |
+
* @return Sendabox_Sendabox_Model_Mysql4_Quote_Collection
|
28 |
+
*/
|
29 |
+
public function getQuotes()
|
30 |
+
{
|
31 |
+
return $this->getOrder()->getQuotes(true);
|
32 |
+
}
|
33 |
+
|
34 |
+
public function formatCurrency($price)
|
35 |
+
{
|
36 |
+
return Mage::helper('core')->currency($price);
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getWeightUnitText($unit = null)
|
40 |
+
{
|
41 |
+
if (!$unit) {
|
42 |
+
$unit = $this->getSendaboxHelper()->getConfigData('units/weight');
|
43 |
+
}
|
44 |
+
return Mage::getModel('sendabox_shippingext/system_config_source_unit_weight')
|
45 |
+
->getBriefOptionLabel($unit);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getMeasureUnitText($unit = null)
|
49 |
+
{
|
50 |
+
if (!$unit) {
|
51 |
+
$unit = $this->getSendaboxHelper()->getConfigData('units/measure');
|
52 |
+
}
|
53 |
+
return Mage::getModel('sendabox_shippingext/system_config_source_unit_measure')
|
54 |
+
->getBriefOptionLabel($unit);
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getSendaboxHelper() {
|
58 |
+
if (!$this->_helper) {
|
59 |
+
$this->_helper = Mage::helper('sendabox_shippingext');
|
60 |
+
}
|
61 |
+
return $this->_helper;
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Content.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* News List admin edit form content tab
|
4 |
+
*
|
5 |
+
* @author Magento
|
6 |
+
*/
|
7 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Content
|
8 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Load WYSIWYG on demand and prepare layout
|
13 |
+
*
|
14 |
+
* @return Magentostudy_News_Block_Adminhtml_News_Edit_Tab_Content
|
15 |
+
*/
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
parent::_prepareLayout();
|
19 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
20 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Prepares tab form
|
27 |
+
*
|
28 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
29 |
+
*/
|
30 |
+
protected function _prepareForm()
|
31 |
+
{
|
32 |
+
$model = Mage::helper('sendabox_shippingext')->getNewsItemInstance();
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Checking if user have permissions to save information
|
36 |
+
*/
|
37 |
+
if (Mage::helper('sendabox_shippingext/admin')->isActionAllowed('save')) {
|
38 |
+
$isElementDisabled = false;
|
39 |
+
} else {
|
40 |
+
$isElementDisabled = true;
|
41 |
+
}
|
42 |
+
|
43 |
+
$form = new Varien_Data_Form();
|
44 |
+
|
45 |
+
$form->setHtmlIdPrefix('news_content_');
|
46 |
+
|
47 |
+
$fieldset = $form->addFieldset('content_fieldset', array(
|
48 |
+
'legend' => Mage::helper('sendabox_shippingext')->__('Content'),
|
49 |
+
'class' => 'fieldset-wide'
|
50 |
+
));
|
51 |
+
|
52 |
+
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array(
|
53 |
+
'tab_id' => $this->getTabId()
|
54 |
+
));
|
55 |
+
|
56 |
+
$contentField = $fieldset->addField('content', 'editor', array(
|
57 |
+
'name' => 'content',
|
58 |
+
'style' => 'height:36em;',
|
59 |
+
'required' => true,
|
60 |
+
'disabled' => $isElementDisabled,
|
61 |
+
'config' => $wysiwygConfig
|
62 |
+
));
|
63 |
+
|
64 |
+
// Setting custom renderer for content field to remove label column
|
65 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')
|
66 |
+
->setTemplate('cms/page/edit/form/renderer/content.phtml');
|
67 |
+
$contentField->setRenderer($renderer);
|
68 |
+
|
69 |
+
$form->setValues($model->getData());
|
70 |
+
$this->setForm($form);
|
71 |
+
|
72 |
+
Mage::dispatchEvent('adminhtml_news_edit_tab_content_prepare_form', array('form' => $form));
|
73 |
+
|
74 |
+
return parent::_prepareForm();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Prepare label for tab
|
79 |
+
*
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function getTabLabel()
|
83 |
+
{
|
84 |
+
return Mage::helper('sendabox_shippingext')->__('Content');
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Prepare title for tab
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
public function getTabTitle()
|
93 |
+
{
|
94 |
+
return Mage::helper('sendabox_shippingext')->__('Content');
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Returns status flag about this tab can be shown or not
|
99 |
+
*
|
100 |
+
* @return true
|
101 |
+
*/
|
102 |
+
public function canShowTab()
|
103 |
+
{
|
104 |
+
return true;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Returns status flag about this tab hidden or not
|
109 |
+
*
|
110 |
+
* @return true
|
111 |
+
*/
|
112 |
+
public function isHidden()
|
113 |
+
{
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form
|
4 |
+
extends Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getTabLabel()
|
14 |
+
{
|
15 |
+
return $this->__('Information');
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getTabTitle()
|
19 |
+
{
|
20 |
+
return $this->__('Information');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function canShowTab()
|
24 |
+
{
|
25 |
+
return true;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function isHidden()
|
29 |
+
{
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Anywhere.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Anywhere extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Boxes.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Boxes extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Products.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Products extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Gets a Magento catalog product belonging to a Magento order item.
|
8 |
+
*
|
9 |
+
* @param Mage_Sales_Model_Order_Item $item the Magento order item
|
10 |
+
*
|
11 |
+
* @return Mage_Catalog_Model_Product
|
12 |
+
*/
|
13 |
+
public function getProductFromItem(Mage_Sales_Model_Order_Item $item)
|
14 |
+
{
|
15 |
+
return Mage::getModel('catalog/product')->load($item->getProductId());
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Quotes.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Quotes extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_cheapest_quote_id;
|
7 |
+
protected $_customer_selected_quote_id;
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
parent::__construct();
|
11 |
+
if (($quotes = $this->getQuotes()->load())) {
|
12 |
+
if(($cheapest_quote = $quotes->getCheapest())) {
|
13 |
+
$this->_cheapest_quote_id = $cheapest_quote->getId();
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
if ($this->getShipment()) {
|
18 |
+
$this->_customer_selected_quote_id = $this->getShipment()->getCustomerSelectedQuoteId();
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
public function formatQuotePrice(Sendabox_Sendabox_Model_Quote $quote)
|
23 |
+
{
|
24 |
+
return $this->formatCurrency($quote->getTotalPrice());
|
25 |
+
/*$quote->getCurrency() . ' ' .
|
26 |
+
$this->formatCurrency($quote->getTotalPrice()) .
|
27 |
+
' (inc. ' .
|
28 |
+
$this->formatCurrency($quote->getTax()) .
|
29 |
+
' tax)';*/
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getQuoteNotes(Sendabox_Sendabox_Model_Quote $quote)
|
33 |
+
{
|
34 |
+
$text = '';
|
35 |
+
|
36 |
+
if ($this->_cheapest_quote_id == $quote->getId()) {
|
37 |
+
$text .= 'Cheapest';
|
38 |
+
}
|
39 |
+
|
40 |
+
if ($this->_customer_selected_quote_id == $quote->getId()) {
|
41 |
+
if ($text) {
|
42 |
+
$text .= ', ';
|
43 |
+
}
|
44 |
+
$text .= 'Customer Selected';
|
45 |
+
}
|
46 |
+
|
47 |
+
return $text;
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Form/Status.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Form_Status extends Sendabox_Sendabox_Block_Adminhtml_Shipment_Edit_Tab_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Sendabox_Sendabox_Model_Quote
|
7 |
+
*/
|
8 |
+
protected $_customer_selected_quote = null;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Gets the description of the Sendabox quote selected by the customer.
|
12 |
+
*
|
13 |
+
* @return TSendabox_Sendabox_Model_Quote
|
14 |
+
*/
|
15 |
+
public function getCustomerSelectedQuoteDescription()
|
16 |
+
{
|
17 |
+
return $this->getShipment()->getCustomerSelectedQuoteDescription();
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
public function getShipmentStatusText()
|
22 |
+
{
|
23 |
+
return Mage::getModel('sendabox_sendabox/system_config_source_shipment_status')
|
24 |
+
->getOptionLabel($this->getShipment()->getStatus());
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Image.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* News List admin edit form image tab
|
4 |
+
*
|
5 |
+
* @author Magento
|
6 |
+
*/
|
7 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Image
|
8 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Prepare form elements
|
13 |
+
*
|
14 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Checking if user have permissions to save information
|
20 |
+
*/
|
21 |
+
if (Mage::helper('sendabox_shippingext/admin')->isActionAllowed('save')) {
|
22 |
+
$isElementDisabled = false;
|
23 |
+
} else {
|
24 |
+
$isElementDisabled = true;
|
25 |
+
}
|
26 |
+
|
27 |
+
$form = new Varien_Data_Form();
|
28 |
+
|
29 |
+
$form->setHtmlIdPrefix('news_image_');
|
30 |
+
|
31 |
+
$model = Mage::helper('sendabox_shippingext')->getNewsItemInstance();
|
32 |
+
|
33 |
+
|
34 |
+
$fieldset = $form->addFieldset('image_fieldset', array(
|
35 |
+
'legend' => Mage::helper('sendabox_shippingext')->__('Image Thumbnail'), 'class' => 'fieldset-wide'
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->_addElementTypes($fieldset);
|
39 |
+
|
40 |
+
$fieldset->addField('image', 'image', array(
|
41 |
+
'name' => 'image',
|
42 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Image'),
|
43 |
+
'title' => Mage::helper('sendabox_shippingext')->__('Image'),
|
44 |
+
'required' => false,
|
45 |
+
'disabled' => $isElementDisabled
|
46 |
+
));
|
47 |
+
|
48 |
+
Mage::dispatchEvent('adminhtml_news_edit_tab_image_prepare_form', array('form' => $form));
|
49 |
+
|
50 |
+
$form->setValues($model->getData());
|
51 |
+
$this->setForm($form);
|
52 |
+
|
53 |
+
return parent::_prepareForm();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Prepare label for tab
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getTabLabel()
|
62 |
+
{
|
63 |
+
return Mage::helper('sendabox_shippingext')->__('Image Thumbnail');
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Prepare title for tab
|
68 |
+
*
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function getTabTitle()
|
72 |
+
{
|
73 |
+
return Mage::helper('sendabox_shippingext')->__('Image Thumbnail');
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns status flag about this tab can be showen or not
|
78 |
+
*
|
79 |
+
* @return true
|
80 |
+
*/
|
81 |
+
public function canShowTab()
|
82 |
+
{
|
83 |
+
return true;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Returns status flag about this tab hidden or not
|
88 |
+
*
|
89 |
+
* @return true
|
90 |
+
*/
|
91 |
+
public function isHidden()
|
92 |
+
{
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retrieve predefined additional element types
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
*/
|
101 |
+
protected function _getAdditionalElementTypes()
|
102 |
+
{
|
103 |
+
return array(
|
104 |
+
'image' => Mage::getConfig()->getBlockClassName('sendabox_shippingext/adminhtml_news_edit_form_element_image')
|
105 |
+
);
|
106 |
+
}
|
107 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tab/Main.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* News List admin edit form main tab
|
4 |
+
*
|
5 |
+
* @author Magento
|
6 |
+
*/
|
7 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tab_Main
|
8 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Prepare form elements for tab
|
13 |
+
*
|
14 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
$model = Mage::helper('sendabox_shippingext')->getNewsItemInstance();
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Checking if user have permissions to save information
|
22 |
+
*/
|
23 |
+
if (Mage::helper('sendabox_shippingext/admin')->isActionAllowed('save')) {
|
24 |
+
$isElementDisabled = false;
|
25 |
+
} else {
|
26 |
+
$isElementDisabled = true;
|
27 |
+
}
|
28 |
+
|
29 |
+
$form = new Varien_Data_Form();
|
30 |
+
|
31 |
+
$form->setHtmlIdPrefix('news_main_');
|
32 |
+
|
33 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
34 |
+
'legend' => Mage::helper('sendabox_shippingext')->__('News Item Info')
|
35 |
+
));
|
36 |
+
|
37 |
+
if ($model->getId()) {
|
38 |
+
$fieldset->addField('news_id', 'hidden', array(
|
39 |
+
'name' => 'news_id',
|
40 |
+
));
|
41 |
+
}
|
42 |
+
|
43 |
+
$fieldset->addField('title', 'text', array(
|
44 |
+
'name' => 'title',
|
45 |
+
'label' => Mage::helper('sendabox_shippingext')->__('News Title'),
|
46 |
+
'title' => Mage::helper('sendabox_shippingext')->__('News Title'),
|
47 |
+
'required' => true,
|
48 |
+
'disabled' => $isElementDisabled
|
49 |
+
));
|
50 |
+
|
51 |
+
$fieldset->addField('author', 'text', array(
|
52 |
+
'name' => 'author',
|
53 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Author'),
|
54 |
+
'title' => Mage::helper('sendabox_shippingext')->__('Author'),
|
55 |
+
'required' => true,
|
56 |
+
'disabled' => $isElementDisabled
|
57 |
+
));
|
58 |
+
|
59 |
+
$fieldset->addField('published_at', 'date', array(
|
60 |
+
'name' => 'published_at',
|
61 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
62 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
63 |
+
'label' => Mage::helper('sendabox_shippingext')->__('Publishing Date'),
|
64 |
+
'title' => Mage::helper('sendabox_shippingext')->__('Publishing Date'),
|
65 |
+
'required' => true
|
66 |
+
));
|
67 |
+
|
68 |
+
Mage::dispatchEvent('adminhtml_news_edit_tab_main_prepare_form', array('form' => $form));
|
69 |
+
|
70 |
+
$form->setValues($model->getData());
|
71 |
+
$this->setForm($form);
|
72 |
+
|
73 |
+
return parent::_prepareForm();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Prepare label for tab
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function getTabLabel()
|
82 |
+
{
|
83 |
+
return Mage::helper('sendabox_shippingext')->__('News Info');
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Prepare title for tab
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function getTabTitle()
|
92 |
+
{
|
93 |
+
return Mage::helper('sendabox_shippingext')->__('News Info');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Returns status flag about this tab can be shown or not
|
98 |
+
*
|
99 |
+
* @return true
|
100 |
+
*/
|
101 |
+
public function canShowTab()
|
102 |
+
{
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Returns status flag about this tab hidden or not
|
108 |
+
*
|
109 |
+
* @return true
|
110 |
+
*/
|
111 |
+
public function isHidden()
|
112 |
+
{
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Edit/Tabs.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* News List admin edit form tabs block
|
4 |
+
*
|
5 |
+
* @author Magento
|
6 |
+
*/
|
7 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
8 |
+
{
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this->setId('sendabox_shipment_edit_tabs');
|
13 |
+
$this->setDestElementId('edit_form');
|
14 |
+
$this->setTitle(Mage::helper('sendabox_shippingext')->__('Order Details'));
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/Shipment/Grid.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:03
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->setId('grid_id');
|
14 |
+
// $this->setDefaultSort('COLUMN_ID');
|
15 |
+
$this->setDefaultDir('asc');
|
16 |
+
$this->setSaveParametersInSession(true);
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareCollection()
|
20 |
+
{
|
21 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection')
|
22 |
+
->addAttributeToSelect('*')
|
23 |
+
->join('sales/order_address', 'main_table.entity_id=`sales/order_address`.parent_id and `sales/order_address`.address_type="shipping"', array('city','region'))
|
24 |
+
->addAttributeToFilter('status', array('nin' => array('canceled','complete')));
|
25 |
+
;
|
26 |
+
$collection->getSelect()->order(array(
|
27 |
+
'created_at DESC'
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->setCollection($collection);
|
31 |
+
return parent::_prepareCollection();
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _prepareColumns()
|
35 |
+
{
|
36 |
+
|
37 |
+
$this->addColumn('order_number', array(
|
38 |
+
'header' => $this->__('Order #'),
|
39 |
+
'index' => 'increment_id',
|
40 |
+
));
|
41 |
+
|
42 |
+
$this->addColumn('order_status', array(
|
43 |
+
'header' => $this->__('Order status'),
|
44 |
+
'index' => 'status'
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addColumn('created_at', array(
|
48 |
+
'header' => $this ->__('Purchased On'),
|
49 |
+
'type' => 'datetime',
|
50 |
+
'index' => 'created_at',
|
51 |
+
'filter_index' => '`sales/order`.created_at',
|
52 |
+
));
|
53 |
+
$this->addColumn('shipping_name', array(
|
54 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
55 |
+
'index' => 'shipping_name',
|
56 |
+
));
|
57 |
+
|
58 |
+
$this->addColumn('city', array(
|
59 |
+
'header' => $this->__('Ship to city'),
|
60 |
+
'index' => 'city',
|
61 |
+
));
|
62 |
+
$this->addColumn('region', array(
|
63 |
+
'header' => $this->__('Ship to region'),
|
64 |
+
'index' => 'region',
|
65 |
+
));
|
66 |
+
|
67 |
+
$this->addColumn('action', array(
|
68 |
+
'header' => Mage::helper('sendabox_shippingext')->__('Action'),
|
69 |
+
'width' => '100',
|
70 |
+
'type' => 'action',
|
71 |
+
'getter' => 'getId',
|
72 |
+
'actions' => array(
|
73 |
+
'view' => array(
|
74 |
+
'caption' => Mage::helper('sendabox_shippingext')->__('View'),
|
75 |
+
'url' => array('base' => '*/*/edit'),
|
76 |
+
'field' => 'id'
|
77 |
+
)
|
78 |
+
),
|
79 |
+
'filter' => false,
|
80 |
+
'sortable' => false,
|
81 |
+
'index' => 'stores',
|
82 |
+
'is_system' => true,
|
83 |
+
));
|
84 |
+
|
85 |
+
$this->addExportType('*/*/exportCsv', $this->__('CSV'));
|
86 |
+
|
87 |
+
$this->addExportType('*/*/exportExcel', $this->__('Excel XML'));
|
88 |
+
|
89 |
+
return parent::_prepareColumns();
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getRowUrl($row)
|
93 |
+
{
|
94 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
95 |
+
}
|
96 |
+
|
97 |
+
protected function _prepareMassaction()
|
98 |
+
{
|
99 |
+
$modelPk = Mage::getModel('sendabox_shippingext/shipment')->getResource()->getIdFieldName();
|
100 |
+
$this->setMassactionIdField($modelPk);
|
101 |
+
$this->getMassactionBlock()->setFormFieldName('ids');
|
102 |
+
// $this->getMassactionBlock()->setUseSelectAll(false);
|
103 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
104 |
+
'label'=> $this->__('Delete'),
|
105 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
106 |
+
));
|
107 |
+
return $this;
|
108 |
+
}
|
109 |
+
}
|
app/code/community/Sendabox/Shippingext/Block/Adminhtml/System/Config/Agenda/Button.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 23/6/2015
|
6 |
+
* Time: 14:28
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Block_Adminhtml_System_Config_Agenda_Button extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
9 |
+
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
parent::_construct();
|
13 |
+
$this->setTemplate('sendabox/system/config/agenda/button.phtml');
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
17 |
+
{
|
18 |
+
return $this->_toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getAjaxCheckUrl()
|
22 |
+
{
|
23 |
+
return $this->getUrl('sendabox/adminhtml_ajax/agenda');
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getButtonHtml()
|
27 |
+
{
|
28 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
29 |
+
->setData(array(
|
30 |
+
'id' => 'sendabox_button',
|
31 |
+
'label' => $this->helper('adminhtml')->__('Get data from Sendabox'),
|
32 |
+
'onclick' => 'check()'
|
33 |
+
));
|
34 |
+
|
35 |
+
return $button->toHtml();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Sendabox/{Sendabox → Shippingext}/Block/Adminhtml/System/Config/Form/Field/Required.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
protected $_element;
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_System_Config_Form_Field_Required extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
|
6 |
protected $_element;
|
app/code/community/Sendabox/{Sendabox → Shippingext}/Block/Adminhtml/System/Config/Form/Fieldset/General.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
/**
|
1 |
<?php
|
2 |
|
3 |
+
class Sendabox_Shippingext_Block_Adminhtml_System_Config_Form_Fieldset_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
{
|
5 |
|
6 |
/**
|
app/code/community/Sendabox/Shippingext/Helper/Data.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:41
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Helper_Data extends Mage_Core_Helper_Abstract {
|
9 |
+
|
10 |
+
public function getConfigData($field) {
|
11 |
+
$path = 'sendabox_settings/' . $field;
|
12 |
+
return Mage::getStoreConfig($path);
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Agenda.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 24/6/2015
|
6 |
+
* Time: 12:39
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Model_Agenda extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
$this->_init('sendabox_shippingext/agenda');
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Box.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Box extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/box');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Create.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 25/6/2015
|
6 |
+
* Time: 15:38
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Model_Create {
|
10 |
+
|
11 |
+
public function toOptionArray()
|
12 |
+
{
|
13 |
+
return array(
|
14 |
+
array('value'=>1, 'label'=>Mage::helper('sendabox_shippingext')->__('Yes')),
|
15 |
+
array('value'=>2, 'label'=>Mage::helper('sendabox_shippingext')->__('No')),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Agenda.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 24/6/2015
|
6 |
+
* Time: 12:39
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Model_Resource_Agenda extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
$this->_init('sendabox_shippingext/agenda', 'sender_id');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function truncate() {
|
18 |
+
$this->_getWriteAdapter()->query('TRUNCATE TABLE '.$this->getMainTable());
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Agenda/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Resource_Agenda_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/agenda');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Box.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Resource_Box extends Mage_Core_Model_Resource_Db_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/box', 'box_id');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Box/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Resource_Box_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/box');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Shipment.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Resource_Shipment extends Mage_Core_Model_Resource_Db_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/shipment', 'shipping_id');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Resource/Shipment/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Resource_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/shipment');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/Model/Shipment.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:52
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Model_Shipment extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('sendabox_shippingext/shipment');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Sendabox/Shippingext/controllers/Adminhtml/AjaxController.php
ADDED
@@ -0,0 +1,697 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by: Stathis Kapaniaris
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Sendabox_Shippingext_Adminhtml_AjaxController extends Mage_Adminhtml_Controller_Action{
|
7 |
+
|
8 |
+
private $_url = "http://testws.sendabox.it/SBWS.asmx/";
|
9 |
+
public function indexAction()
|
10 |
+
{
|
11 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
12 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
13 |
+
$boxes=$this->getRequest()->getParam("boxes");
|
14 |
+
|
15 |
+
$baseDir = Mage::getBaseDir('app').DS.'code/community/Sendabox/Shippingext/tmp/';
|
16 |
+
|
17 |
+
$file=$this->getRequest()->getParam("orderid").'.xml';
|
18 |
+
if(!is_writable($baseDir)){
|
19 |
+
echo Mage::helper('sendabox_shippingext')->__('The tmp file is not writable. Please change folder permissions');
|
20 |
+
return null;
|
21 |
+
}
|
22 |
+
|
23 |
+
$xmlLoad = new Varien_Simplexml_Config();
|
24 |
+
$results=array();
|
25 |
+
|
26 |
+
for($i=1;$i<=$boxes;$i++){
|
27 |
+
$modified=false;
|
28 |
+
if($xmlLoad->loadFile($baseDir.$file)){
|
29 |
+
$xml_edit = simplexml_load_file($baseDir.$file);
|
30 |
+
|
31 |
+
$departure_city=$xml_edit -> departure -> city;
|
32 |
+
$departure_province=$xml_edit -> departure -> province;
|
33 |
+
$departure_zip=$xml_edit -> departure -> zip;
|
34 |
+
$destination_city=$xml_edit -> destination -> city;
|
35 |
+
$destination_province=$xml_edit -> destination -> province;
|
36 |
+
$destination_country=$xml_edit -> destination -> country;
|
37 |
+
$destination_zip=$xml_edit -> destination -> zip;
|
38 |
+
|
39 |
+
if(strpos($departure_city,$this->getRequest()->getParam("shipping_city"))!==0 ||
|
40 |
+
strpos($departure_province,$this->getRequest()->getParam("shipping_province"))!==0 ||
|
41 |
+
strpos($departure_zip,$this->getRequest()->getParam("shipping_zip"))!==0){
|
42 |
+
$city=dom_import_simplexml($xml_edit -> departure->city);
|
43 |
+
$city->parentNode->removeChild($city);
|
44 |
+
$province=dom_import_simplexml($xml_edit -> departure->province);
|
45 |
+
$province->parentNode->removeChild($province);
|
46 |
+
$zip=dom_import_simplexml($xml_edit -> departure->zip);
|
47 |
+
$zip->parentNode->removeChild($zip);
|
48 |
+
$departure=$xml_edit -> departure[0];
|
49 |
+
$departure->addChild("city", $this->getRequest()->getParam("shipping_city"));
|
50 |
+
$departure->addChild("province", $this->getRequest()->getParam("shipping_province"));
|
51 |
+
$departure->addChild("zip", $this->getRequest()->getParam("shipping_zip"));
|
52 |
+
$xml_edit->asXML($baseDir.$file);
|
53 |
+
$modified=true;
|
54 |
+
}
|
55 |
+
|
56 |
+
if(strpos($destination_city,$this->getRequest()->getParam("destination_city"))!==0 ||
|
57 |
+
strpos($destination_province,$this->getRequest()->getParam("destination_province"))!==0 ||
|
58 |
+
strpos($destination_zip,$this->getRequest()->getParam("destination_zip"))!==0 ||
|
59 |
+
strpos($destination_country,$this->getRequest()->getParam("destination_country"))!==0){
|
60 |
+
$city=dom_import_simplexml($xml_edit -> destination ->city);
|
61 |
+
$city->parentNode->removeChild($city);
|
62 |
+
$province=dom_import_simplexml($xml_edit -> destination->province);
|
63 |
+
$province->parentNode->removeChild($province);
|
64 |
+
$zip=dom_import_simplexml($xml_edit -> destination->zip);
|
65 |
+
$zip->parentNode->removeChild($zip);
|
66 |
+
$country=dom_import_simplexml($xml_edit -> destination->country);
|
67 |
+
$country->parentNode->removeChild($country);
|
68 |
+
$departure=$xml_edit -> destination[0];
|
69 |
+
|
70 |
+
$departure->addChild("city", $this->getRequest()->getParam("destination_city"));
|
71 |
+
$departure->addChild("province", $this->getRequest()->getParam("destination_province"));
|
72 |
+
$departure->addChild("zip", $this->getRequest()->getParam("destination_zip"));
|
73 |
+
$departure->addChild("country", $this->getRequest()->getParam("destination_country"));
|
74 |
+
$modified=true;
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
$box=$xml_edit -> xpath('//boxes/box[@id='.$i.']');
|
79 |
+
if(count($box)>0){
|
80 |
+
$width=$box[0]->width["value"];
|
81 |
+
$height=$box[0]->height["value"];
|
82 |
+
$depth=$box[0]->depth["value"];
|
83 |
+
$weight=$box[0]->weight["value"];
|
84 |
+
if(strpos($width,$this->getRequest()->getParam("width-".$i))!==0 ||
|
85 |
+
strpos($height,$this->getRequest()->getParam("height-".$i))!==0 ||
|
86 |
+
strpos($depth,$this->getRequest()->getParam("depth-".$i))!==0 ||
|
87 |
+
strpos($weight,$this->getRequest()->getParam("weight-".$i))!==0){
|
88 |
+
$node=dom_import_simplexml($box[0]);
|
89 |
+
$node->parentNode->removeChild($node);
|
90 |
+
$newbox=$xml_edit->boxes->addChild('box','');
|
91 |
+
$newbox->addAttribute('id',$i);
|
92 |
+
$newwidth=$newbox->addChild('width','');
|
93 |
+
$newwidth->addAttribute('value',$this->getRequest()->getParam("width-".$i));
|
94 |
+
$newheight=$newbox->addChild('height','');
|
95 |
+
$newheight->addAttribute('value',$this->getRequest()->getParam("height-".$i));
|
96 |
+
$newdepth=$newbox->addChild('depth','');
|
97 |
+
$newdepth->addAttribute('value',$this->getRequest()->getParam("depth-".$i));
|
98 |
+
$newweight=$newbox->addChild('weight','');
|
99 |
+
$newweight->addAttribute('value',$this->getRequest()->getParam("weight-".$i));
|
100 |
+
$modified=true;
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
else{
|
105 |
+
$newbox=$xml_edit->boxes->addChild('box','');
|
106 |
+
$newbox->addAttribute('id',$i);
|
107 |
+
$newwidth=$newbox->addChild('width','');
|
108 |
+
$newwidth->addAttribute('value',$this->getRequest()->getParam("width-".$i));
|
109 |
+
$newheight=$newbox->addChild('height','');
|
110 |
+
$newheight->addAttribute('value',$this->getRequest()->getParam("height-".$i));
|
111 |
+
$newdepth=$newbox->addChild('depth','');
|
112 |
+
$newdepth->addAttribute('value',$this->getRequest()->getParam("depth-".$i));
|
113 |
+
$newweight=$newbox->addChild('weight','');
|
114 |
+
$newweight->addAttribute('value',$this->getRequest()->getParam("weight-".$i));
|
115 |
+
$modified=true;
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
$dom = dom_import_simplexml($xml_edit)->ownerDocument;
|
120 |
+
$dom->formatOutput = true;
|
121 |
+
$dom->save($baseDir.$file);
|
122 |
+
|
123 |
+
}
|
124 |
+
else{
|
125 |
+
$xml_array=array(
|
126 |
+
'name' => 'shipment',
|
127 |
+
array(
|
128 |
+
'name' => 'departure',
|
129 |
+
array(
|
130 |
+
'name' => 'name',
|
131 |
+
'value' => $this->getRequest()->getParam("shipping_name"),
|
132 |
+
),
|
133 |
+
array(
|
134 |
+
'name' => 'surname',
|
135 |
+
'value'=> $this->getRequest()->getParam("shipping_surname"),
|
136 |
+
),
|
137 |
+
array(
|
138 |
+
'name' => 'co',
|
139 |
+
'value' => $this->getRequest()->getParam("shipping_co"),
|
140 |
+
),
|
141 |
+
array(
|
142 |
+
'name' => 'address',
|
143 |
+
'value'=> $this->getRequest()->getParam("shipping_address"),
|
144 |
+
),
|
145 |
+
array(
|
146 |
+
'name' => 'streetnumber',
|
147 |
+
'value' => $this->getRequest()->getParam("shipping_streetnumber"),
|
148 |
+
),
|
149 |
+
array(
|
150 |
+
'name' => 'city',
|
151 |
+
'value'=> $this->getRequest()->getParam("shipping_city"),
|
152 |
+
),
|
153 |
+
array(
|
154 |
+
'name' => 'province',
|
155 |
+
'value' => $this->getRequest()->getParam("shipping_province"),
|
156 |
+
),
|
157 |
+
array(
|
158 |
+
'name' => 'zip',
|
159 |
+
'value'=> $this->getRequest()->getParam("shipping_zip"),
|
160 |
+
),
|
161 |
+
array(
|
162 |
+
'name' => 'phone',
|
163 |
+
'value' => $this->getRequest()->getParam("shipping_tel"),
|
164 |
+
),
|
165 |
+
array(
|
166 |
+
'name' => 'email',
|
167 |
+
'value'=> $this->getRequest()->getParam("shipping_email"),
|
168 |
+
),
|
169 |
+
),
|
170 |
+
array(
|
171 |
+
'name' => 'destination',
|
172 |
+
array(
|
173 |
+
'name' => 'name',
|
174 |
+
'value' => $this->getRequest()->getParam("destination_name"),
|
175 |
+
),
|
176 |
+
array(
|
177 |
+
'name' => 'surname',
|
178 |
+
'value'=> $this->getRequest()->getParam("destination_surname"),
|
179 |
+
),
|
180 |
+
array(
|
181 |
+
'name' => 'co',
|
182 |
+
'value' => $this->getRequest()->getParam("destination_co"),
|
183 |
+
),
|
184 |
+
array(
|
185 |
+
'name' => 'address',
|
186 |
+
'value'=> $this->getRequest()->getParam("destination_address"),
|
187 |
+
),
|
188 |
+
array(
|
189 |
+
'name' => 'streetnumber',
|
190 |
+
'value' => $this->getRequest()->getParam("destination_streetnumber"),
|
191 |
+
),
|
192 |
+
array(
|
193 |
+
'name' => 'city',
|
194 |
+
'value'=> $this->getRequest()->getParam("destination_city"),
|
195 |
+
),
|
196 |
+
array(
|
197 |
+
'name' => 'province',
|
198 |
+
'value' => $this->getRequest()->getParam("destination_province"),
|
199 |
+
),
|
200 |
+
array(
|
201 |
+
'name' => 'country',
|
202 |
+
'value'=> $this->getRequest()->getParam("destination_country"),
|
203 |
+
),
|
204 |
+
array(
|
205 |
+
'name' => 'zip',
|
206 |
+
'value'=> $this->getRequest()->getParam("destination_zip"),
|
207 |
+
),
|
208 |
+
array(
|
209 |
+
'name' => 'phone',
|
210 |
+
'value' => $this->getRequest()->getParam("destination_tel"),
|
211 |
+
),
|
212 |
+
array(
|
213 |
+
'name' => 'email',
|
214 |
+
'value'=> $this->getRequest()->getParam("destination_email"),
|
215 |
+
),
|
216 |
+
),
|
217 |
+
array(
|
218 |
+
'name' => 'boxes',
|
219 |
+
array(
|
220 |
+
'name' => 'box',
|
221 |
+
'attributes' => array(
|
222 |
+
'id' => $i,
|
223 |
+
),
|
224 |
+
array(
|
225 |
+
'name' => 'width',
|
226 |
+
'attributes' => array(
|
227 |
+
'value' => $this->getRequest()->getParam( "width-".$i),
|
228 |
+
),
|
229 |
+
),
|
230 |
+
array(
|
231 |
+
'name' => 'height',
|
232 |
+
'attributes' => array(
|
233 |
+
'value' => $this->getRequest()->getParam( "height-".$i),
|
234 |
+
),
|
235 |
+
),
|
236 |
+
array(
|
237 |
+
'name' => 'depth',
|
238 |
+
'attributes' => array(
|
239 |
+
'value' => $this->getRequest()->getParam( "depth-".$i),
|
240 |
+
),
|
241 |
+
),
|
242 |
+
array(
|
243 |
+
'name' => 'weight',
|
244 |
+
'attributes' => array(
|
245 |
+
'value' => $this->getRequest()->getParam( "weight-".$i),
|
246 |
+
),
|
247 |
+
),
|
248 |
+
),
|
249 |
+
),
|
250 |
+
);
|
251 |
+
|
252 |
+
|
253 |
+
$doc = new DOMDocument();
|
254 |
+
$child = $this->array_to_xml( $doc, $xml_array );
|
255 |
+
if ( $child )
|
256 |
+
$doc->appendChild($child);
|
257 |
+
$doc->formatOutput = true;
|
258 |
+
$doc->save($baseDir.$file);
|
259 |
+
$modified=true;
|
260 |
+
}
|
261 |
+
if(!$modified) continue;
|
262 |
+
|
263 |
+
$jsonData = array(
|
264 |
+
'apikey' => $username,
|
265 |
+
'apisecret' => $password,
|
266 |
+
'data'=>array(
|
267 |
+
'fromCity'=>$this->getRequest()->getParam("shipping_city"),
|
268 |
+
'fromProvince'=>$this->getRequest()->getParam("shipping_province"),
|
269 |
+
'fromZip'=>$this->getRequest()->getParam("shipping_zip"),
|
270 |
+
'toCity'=>$this->getRequest()->getParam("destination_city"),
|
271 |
+
'toProvince'=>$this->getRequest()->getParam("destination_province"),
|
272 |
+
'toZip'=>$this->getRequest()->getParam("destination_zip"),
|
273 |
+
'toCountry'=>$this->getRequest()->getParam("destination_country"),
|
274 |
+
'weight'=>$this->getRequest()->getParam("weight-".$i),
|
275 |
+
'width'=>$this->getRequest()->getParam("width-".$i),
|
276 |
+
'height'=>$this->getRequest()->getParam("height-".$i),
|
277 |
+
'depth'=>$this->getRequest()->getParam("depth-".$i)
|
278 |
+
)
|
279 |
+
);
|
280 |
+
|
281 |
+
$url=$this->_url."GetOffersJson";
|
282 |
+
|
283 |
+
$jsonDataEncoded = json_encode($jsonData);
|
284 |
+
$headers=array("Content-Type"=>"application/json");
|
285 |
+
|
286 |
+
$http = new Varien_Http_Adapter_Curl();
|
287 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
288 |
+
$header_result = $http->read();
|
289 |
+
if ($header_result === false) {
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
|
293 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
294 |
+
$body = substr($header_result, $header_size);
|
295 |
+
|
296 |
+
$result = json_decode($body,true);
|
297 |
+
|
298 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
299 |
+
echo json_encode(array("ErrorMsg"=>$result["ErrorMsg"]));
|
300 |
+
return null;
|
301 |
+
} else {
|
302 |
+
$offers=array();
|
303 |
+
foreach($result as $offer) {
|
304 |
+
$available_services=array();
|
305 |
+
foreach($offer['ServiziAggiuntivi'] as $service){
|
306 |
+
$available_services[]=$service['Name']." ";
|
307 |
+
}
|
308 |
+
$of=array(
|
309 |
+
'idcarrier' => $offer['IdCarrier'],
|
310 |
+
'idshippingdetail' => $offer['IdShipping'],
|
311 |
+
'idpricelist' => $offer['IdPriceList'],
|
312 |
+
'carrier' => $offer['Info'],
|
313 |
+
'price' => str_replace(',','.',$offer['Price']),
|
314 |
+
'services' => $available_services,
|
315 |
+
);
|
316 |
+
array_push($offers,$of);
|
317 |
+
}
|
318 |
+
$results[$i]=array('offers'=>$offers);
|
319 |
+
}
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
echo json_encode($results);
|
324 |
+
|
325 |
+
}
|
326 |
+
|
327 |
+
public function servicesAction(){
|
328 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
329 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
330 |
+
$box=$this->getRequest()->getParam("b");
|
331 |
+
$idcarrier=$this->getRequest()->getParam("i");
|
332 |
+
$jsonData = array(
|
333 |
+
'apikey' => $username,
|
334 |
+
'apisecret' => $password,
|
335 |
+
'data'=>array(
|
336 |
+
'idcarrier'=>$idcarrier,
|
337 |
+
)
|
338 |
+
);
|
339 |
+
|
340 |
+
$url=$this->_url."GetServiceJson";
|
341 |
+
$jsonDataEncoded = json_encode($jsonData);
|
342 |
+
|
343 |
+
$headers=array("Content-Type"=>"application/json");
|
344 |
+
|
345 |
+
$http = new Varien_Http_Adapter_Curl();
|
346 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
347 |
+
$header_result = $http->read();
|
348 |
+
if ($header_result === false) {
|
349 |
+
return false;
|
350 |
+
}
|
351 |
+
|
352 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
353 |
+
$body = substr($header_result, $header_size);
|
354 |
+
|
355 |
+
$result = json_decode($body,true);
|
356 |
+
|
357 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
358 |
+
echo $result["ErrorMsg"];
|
359 |
+
} else {
|
360 |
+
$table="<td colspan='6'><table>";
|
361 |
+
$table.="<thead><tr class=\"headings\">
|
362 |
+
<th>".Mage::helper('sendabox_shippingext')->__('Choose service(s)')."</th>
|
363 |
+
<th><strong>".Mage::helper('sendabox_shippingext')->__('Service')."</strong></th>
|
364 |
+
<th><strong>".Mage::helper('sendabox_shippingext')->__('Value')."</strong></th>
|
365 |
+
<th><strong>".Mage::helper('sendabox_shippingext')->__('Price')."</strong></th>
|
366 |
+
<th style=\"background-color: #fff;border: 0;\"><button onclick='closePanel(".$box.",".$idcarrier.")' class=\"scalable\">".Mage::helper('sendabox_shippingext')->__('Close')."</button></th>
|
367 |
+
</tr></thead>";
|
368 |
+
$servicecount=0;
|
369 |
+
foreach($result as $offer){
|
370 |
+
$table.="<tr>";
|
371 |
+
$table.="<td><input type=\"checkbox\" name=\"box_".$box."_service_".$idcarrier."_".$servicecount."\" id=\"box_".$box."_service_".$idcarrier."_".$servicecount."\" onclick=\"servicecheck(".$box.",".$idcarrier.",".$servicecount.")\" value=".$offer['idadditionalservices']."></td>";
|
372 |
+
$table.="<td>".$offer['servizio']."</td>";
|
373 |
+
if(strpos($offer['servizio'],'Assicurata')===0){
|
374 |
+
$table.="<td><input type=\"text\" onkeypress=\"validateInput(this)\" onkeyup=\"updateInsurance(".$box.",".$idcarrier.",".$servicecount.")\" name=\"box_".$box."_service_ins_".$idcarrier."_".$servicecount."\" id=\"box_".$box."_service_ins_".$idcarrier."_".$servicecount."\"> From: ".$offer['prezzo']."€</td>";
|
375 |
+
$table.="<td><div id=\"box_".$box."_serviceprice_".$idcarrier."_".$servicecount++."\">0€</div></td>";
|
376 |
+
}
|
377 |
+
else if(strpos($offer['servizio'],'Contrassegno')===0){
|
378 |
+
$table.="<td><input type=\"text\" onkeypress=\"validateInput(this)\" onkeyup=\"updateContrassegno(".$box.",".$idcarrier.",".$servicecount.")\" name=\"box_".$box."_service_con_".$idcarrier."_".$servicecount."\" id=\"box_".$box."_service_con_".$idcarrier."_".$servicecount."\"> From: ".$offer['prezzo']."€</td>";
|
379 |
+
$table.="<td><div id=\"box_".$box."_serviceprice_".$idcarrier."_".$servicecount++."\">0€</div></td>";
|
380 |
+
}else{
|
381 |
+
$table.="<td></td>";
|
382 |
+
$table.="<td><div id=\"box_".$box."_serviceprice_".$idcarrier."_".$servicecount++."\">".$offer['prezzo']."€</div></td>";
|
383 |
+
}
|
384 |
+
|
385 |
+
$table.="</tr>";
|
386 |
+
}
|
387 |
+
$table.="<input type=\"hidden\" name=\"box_".$box."_service_".$idcarrier."_count\" value=\"".$servicecount."\" ></table></td>";
|
388 |
+
echo $table;
|
389 |
+
}
|
390 |
+
|
391 |
+
}
|
392 |
+
|
393 |
+
public function orderAction(){
|
394 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
395 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
396 |
+
$create_shipment = Mage::helper('sendabox_shippingext')->getConfigData('general/create_shipment');
|
397 |
+
$boxes=$this->getRequest()->getParam("boxes");
|
398 |
+
$boxes_array=array();
|
399 |
+
|
400 |
+
for($i=1;$i<=$boxes;$i++){
|
401 |
+
$carrier = $this->getRequest()->getParam("box_".$i);
|
402 |
+
$selectedservices=array();
|
403 |
+
$serviceavail=$this->getRequest()->getParam("box_".$i."_service_".$carrier."_count");
|
404 |
+
|
405 |
+
if(!is_null($serviceavail)){
|
406 |
+
for($j=0;$j<intval($serviceavail);$j++){
|
407 |
+
$service=$this->getRequest()->getParam("box_".$i."_service_".$carrier."_".$j);
|
408 |
+
if(!is_null($service)){
|
409 |
+
$assurance=$this->getRequest()->getParam("box_".$i."_service_ins_".$carrier."_".$j);
|
410 |
+
$contrasegno=$this->getRequest()->getParam("box_".$i."_service_con_".$carrier."_".$j);
|
411 |
+
|
412 |
+
if(!is_null($assurance)){
|
413 |
+
array_push($selectedservices,array( 'service' => $service, 'value' => $assurance ));
|
414 |
+
continue;
|
415 |
+
}
|
416 |
+
if(!is_null($contrasegno)){
|
417 |
+
array_push($selectedservices,array( 'service' => $service, 'value' => $contrasegno ));
|
418 |
+
continue;
|
419 |
+
}
|
420 |
+
|
421 |
+
array_push($selectedservices,array( 'service' => $service ));
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
array_push($boxes_array,array(
|
427 |
+
'idpricelist' => $this->getRequest()->getParam("box_".$i."_carrier_".$carrier."_idpricelist"),
|
428 |
+
'idshippingdetail' => $this->getRequest()->getParam("box_".$i."_carrier_".$carrier."_idshippingdetail"),
|
429 |
+
'width' => $this->getRequest()->getParam("width-".$i),
|
430 |
+
'height' => $this->getRequest()->getParam("height-".$i),
|
431 |
+
'depth' => $this->getRequest()->getParam("depth-".$i),
|
432 |
+
'weight' => $this->getRequest()->getParam("weight-".$i),
|
433 |
+
'selected_services' => $selectedservices,
|
434 |
+
'box_price' => $this->getRequest()->getParam("box_".$i."_final_price"),
|
435 |
+
));
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
$jsonData = array(
|
440 |
+
'apikey' => $username,
|
441 |
+
'apisecret' => $password,
|
442 |
+
'departure' => array(
|
443 |
+
'name' => $this->getRequest()->getParam("shipping_name"),
|
444 |
+
'surname' => $this->getRequest()->getParam("shipping_surname"),
|
445 |
+
'co' => $this->getRequest()->getParam("shipping_co"),
|
446 |
+
'address' => $this->getRequest()->getParam("shipping_address"),
|
447 |
+
'streetnumber' => $this->getRequest()->getParam("shipping_streetnumber"),
|
448 |
+
'city'=> $this->getRequest()->getParam("shipping_city"),
|
449 |
+
'province'=> $this->getRequest()->getParam("shipping_province"),
|
450 |
+
'zip'=> $this->getRequest()->getParam("shipping_zip"),
|
451 |
+
'tel'=> $this->getRequest()->getParam("shipping_tel"),
|
452 |
+
'email'=> $this->getRequest()->getParam("shipping_email"),
|
453 |
+
),
|
454 |
+
'destination' => array(
|
455 |
+
'name' => $this->getRequest()->getParam("destination_name"),
|
456 |
+
'surname' => $this->getRequest()->getParam("destination_surname"),
|
457 |
+
'co' => $this->getRequest()->getParam("destination_co"),
|
458 |
+
'address' => $this->getRequest()->getParam("destination_address"),
|
459 |
+
'streetnumber' => $this->getRequest()->getParam("destination_streetnumber"),
|
460 |
+
'city'=> $this->getRequest()->getParam("destination_city"),
|
461 |
+
'province'=> $this->getRequest()->getParam("destination_province"),
|
462 |
+
'country'=> $this->getRequest()->getParam("destination_country"),
|
463 |
+
'zip'=> $this->getRequest()->getParam("destination_zip"),
|
464 |
+
'tel'=> $this->getRequest()->getParam("destination_tel"),
|
465 |
+
'email'=> $this->getRequest()->getParam("destination_email"),
|
466 |
+
),
|
467 |
+
'boxes' => $boxes_array,
|
468 |
+
'final-price' => $this->getRequest()->getParam("final-price")
|
469 |
+
);
|
470 |
+
|
471 |
+
$url= $this->_url."MakeOrder";
|
472 |
+
$jsonDataEncoded = json_encode($jsonData);
|
473 |
+
|
474 |
+
$headers=array("Content-Type" => "application/json");
|
475 |
+
|
476 |
+
$http = new Varien_Http_Adapter_Curl();
|
477 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
478 |
+
$header_result = $http->read();
|
479 |
+
if ($header_result === false) {
|
480 |
+
return false;
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
485 |
+
$body = substr($header_result, $header_size);
|
486 |
+
$result = json_decode($body,true);
|
487 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
488 |
+
echo json_encode(array("ErrorMsg"=>$result["ErrorMsg"]));
|
489 |
+
return null;
|
490 |
+
} else {
|
491 |
+
if(isset($result["Message"]) && $result["Message"]){
|
492 |
+
|
493 |
+
$data = array(
|
494 |
+
'order_id' => $this->getRequest()->getParam("orderid"),
|
495 |
+
'customer_cost' => $this->getRequest()->getParam("final-price"),
|
496 |
+
'shipping_name' => $this->getRequest()->getParam("shipping_name"),
|
497 |
+
'shipping_surname' => $this->getRequest()->getParam("shipping_surname"),
|
498 |
+
'shipping_at' => $this->getRequest()->getParam("shipping_co"),
|
499 |
+
'shipping_street' => $this->getRequest()->getParam("shipping_address"),
|
500 |
+
'shipping_number' => $this->getRequest()->getParam("shipping_streetnumber"),
|
501 |
+
'shipping_city'=> $this->getRequest()->getParam("shipping_city"). "(".$this->getRequest()->getParam("shipping_province").")",
|
502 |
+
'shipping_postcode'=> $this->getRequest()->getParam("shipping_zip"),
|
503 |
+
'shipping_phone'=> $this->getRequest()->getParam("shipping_tel"),
|
504 |
+
'shipping_email'=> $this->getRequest()->getParam("shipping_email"),
|
505 |
+
'destination_name' => $this->getRequest()->getParam("destination_name"),
|
506 |
+
'destination_surname' => $this->getRequest()->getParam("destination_surname"),
|
507 |
+
'destination_at' => $this->getRequest()->getParam("destination_co"),
|
508 |
+
'destination_street' => $this->getRequest()->getParam("destination_address"),
|
509 |
+
'destination_number' => $this->getRequest()->getParam("destination_streetnumber"),
|
510 |
+
'destination_city'=> $this->getRequest()->getParam("destination_city")." (".$this->getRequest()->getParam("destination_province").") " ,
|
511 |
+
'destination_postcode'=> $this->getRequest()->getParam("destination_zip"),
|
512 |
+
'destination_phone'=> $this->getRequest()->getParam("destination_tel"),
|
513 |
+
'destination_email'=> $this->getRequest()->getParam("destination_email"),
|
514 |
+
);
|
515 |
+
|
516 |
+
$model = Mage::getModel('sendabox_shippingext/shipment')->setData($data);
|
517 |
+
$insertId = $model->save()->getId();
|
518 |
+
$i=1;
|
519 |
+
|
520 |
+
$_order = Mage::getModel('sales/order')->loadByIncrementId($this->getRequest()->getParam("orderid"));
|
521 |
+
|
522 |
+
$shipment = Mage::getModel('sales/service_order', $_order)
|
523 |
+
->prepareShipment($this->_getItemQtys($_order));
|
524 |
+
|
525 |
+
$trackings="";
|
526 |
+
foreach( $result["Orders"] as $order){
|
527 |
+
|
528 |
+
$data = array(
|
529 |
+
'shipment_id' => $insertId,
|
530 |
+
'sendabox_order_id' => $order["IdUserCityOrder"] ,
|
531 |
+
'sendabox_order_id_encoded' => $order["Encoded"] ,
|
532 |
+
'carrier' => $order["Carrier"],
|
533 |
+
'Comment' => "Box-".$i,
|
534 |
+
'value' => $this->getRequest()->getParam("box_".$i."_final_price") ,
|
535 |
+
'width' => $this->getRequest()->getParam("width-".$i),
|
536 |
+
'height' => $this->getRequest()->getParam("height-".$i),
|
537 |
+
'depth' => $this->getRequest()->getParam("depth-".$i),
|
538 |
+
'weight' => $this->getRequest()->getParam("weight-".$i),
|
539 |
+
);
|
540 |
+
$model = Mage::getModel('sendabox_shippingext/box')->setData($data);
|
541 |
+
$model->save();
|
542 |
+
|
543 |
+
$arrTracking = array(
|
544 |
+
'carrier_code' => 'custom',
|
545 |
+
'title' =>'Sendabox',
|
546 |
+
'number' => $order["IdUserCityOrder"],
|
547 |
+
);
|
548 |
+
|
549 |
+
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
550 |
+
$shipment->addTrack($track);
|
551 |
+
$trackings.='http://sendabox.it/Trackings/Index/'.$order["Encoded"]." ";
|
552 |
+
$i++;
|
553 |
+
}
|
554 |
+
$shipment -> addComment($trackings);
|
555 |
+
if(strpos($create_shipment,"1")===0){
|
556 |
+
$shipment->register();
|
557 |
+
$this->_saveShipment($shipment, $_order, "");
|
558 |
+
}
|
559 |
+
|
560 |
+
echo json_encode( array( 'id' => $insertId )) ;
|
561 |
+
}
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
public function agendaAction(){
|
566 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
567 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
568 |
+
|
569 |
+
$jsonData = array(
|
570 |
+
'apikey' => $username,
|
571 |
+
'apisecret' => $password
|
572 |
+
);
|
573 |
+
|
574 |
+
$url=$this->_url."GetAgenda";
|
575 |
+
$jsonDataEncoded = json_encode($jsonData);
|
576 |
+
|
577 |
+
$headers=array("Content-Type"=>"application/json");
|
578 |
+
|
579 |
+
$http = new Varien_Http_Adapter_Curl();
|
580 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
581 |
+
$header_result = $http->read();
|
582 |
+
if ($header_result === false) {
|
583 |
+
return false;
|
584 |
+
}
|
585 |
+
|
586 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
587 |
+
$body = substr($header_result, $header_size);
|
588 |
+
|
589 |
+
$result = json_decode($body,true);
|
590 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
591 |
+
echo $result["ErrorMsg"];
|
592 |
+
} else {
|
593 |
+
|
594 |
+
Mage::getResourceModel('sendabox_shippingext/agenda')->truncate();
|
595 |
+
foreach($result as $sender){
|
596 |
+
$data = array(
|
597 |
+
'name' => $sender["Nome"],
|
598 |
+
'surname' => $sender["Cognome"],
|
599 |
+
'address' => $sender["Indirizzo"],
|
600 |
+
'street_number' => $sender["Civico"],
|
601 |
+
'city' => $sender["Citta"],
|
602 |
+
'province' => $sender["Provincia"],
|
603 |
+
'co'=> $sender["presso"],
|
604 |
+
'zip'=> $sender["cap"],
|
605 |
+
'mail'=> $sender["mail"],
|
606 |
+
'tel'=> $sender["tel"],
|
607 |
+
);
|
608 |
+
|
609 |
+
$model = Mage::getModel('sendabox_shippingext/agenda')->setData($data);
|
610 |
+
$model->save();
|
611 |
+
|
612 |
+
}
|
613 |
+
echo "Contacts inserted successfully";
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
public function populateAction(){
|
618 |
+
|
619 |
+
$id = $this->getRequest()->getParam("shipping_agenda");
|
620 |
+
$d = Mage::getModel('sendabox_shippingext/agenda')->load($id);
|
621 |
+
|
622 |
+
$data = array(
|
623 |
+
'name' => $d->getData('name'),
|
624 |
+
'surname' => $d->getData('surname'),
|
625 |
+
'co' => $d->getData('co'),
|
626 |
+
'address' => $d->getData('address'),
|
627 |
+
'street_number' => $d->getData('street_number'),
|
628 |
+
'city' => $d->getData('city'),
|
629 |
+
'province' => $d->getData('province'),
|
630 |
+
'zip' => $d->getData('zip'),
|
631 |
+
'tel' => $d->getData('tel'),
|
632 |
+
'email' => $d->getData('mail'),
|
633 |
+
);
|
634 |
+
echo json_encode($data);
|
635 |
+
}
|
636 |
+
|
637 |
+
protected function _getItemQtys(Mage_Sales_Model_Order $order)
|
638 |
+
{
|
639 |
+
$qty = array();
|
640 |
+
|
641 |
+
foreach ($order->getAllItems() as $_eachItem) {
|
642 |
+
if ($_eachItem->getParentItemId()) {
|
643 |
+
$qty[$_eachItem->getParentItemId()] = $_eachItem->getQtyOrdered();
|
644 |
+
} else {
|
645 |
+
$qty[$_eachItem->getId()] = $_eachItem->getQtyOrdered();
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
return $qty;
|
650 |
+
}
|
651 |
+
|
652 |
+
protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order, $customerEmailComments = '')
|
653 |
+
{
|
654 |
+
$shipment->getOrder()->setIsInProcess(true);
|
655 |
+
Mage::getModel('core/resource_transaction')
|
656 |
+
->addObject($shipment)
|
657 |
+
->addObject($order)
|
658 |
+
->save();
|
659 |
+
|
660 |
+
$emailSentStatus = $shipment->getData('email_sent');
|
661 |
+
if (!is_null($order->getShippingAddress()->getEmail()) && !$emailSentStatus) {
|
662 |
+
$shipment->sendEmail(true, $customerEmailComments);
|
663 |
+
$shipment->setEmailSent(true);
|
664 |
+
}
|
665 |
+
|
666 |
+
return $this;
|
667 |
+
}
|
668 |
+
|
669 |
+
function array_to_xml($dom, &$data) {
|
670 |
+
if ( empty( $data['name'] ) )
|
671 |
+
return false;
|
672 |
+
|
673 |
+
// Create the element
|
674 |
+
$element_value = ( ! empty( $data['value'] ) ) ? $data['value'] : null;
|
675 |
+
$element = $dom->createElement( $data['name'], $element_value );
|
676 |
+
|
677 |
+
// Add any attributes
|
678 |
+
if ( ! empty( $data['attributes'] ) && is_array( $data['attributes'] ) ) {
|
679 |
+
foreach ( $data['attributes'] as $attribute_key => $attribute_value ) {
|
680 |
+
$element->setAttribute( $attribute_key, $attribute_value );
|
681 |
+
}
|
682 |
+
}
|
683 |
+
|
684 |
+
// Any other items in the data array should be child elements
|
685 |
+
foreach ( $data as $data_key => $child_data ) {
|
686 |
+
if ( ! is_numeric( $data_key ) )
|
687 |
+
continue;
|
688 |
+
|
689 |
+
$child = $this->array_to_xml( $dom, $child_data );
|
690 |
+
if ( $child )
|
691 |
+
$element->appendChild( $child );
|
692 |
+
}
|
693 |
+
|
694 |
+
return $element;
|
695 |
+
}
|
696 |
+
|
697 |
+
}
|
app/code/community/Sendabox/Shippingext/controllers/Adminhtml/OrderController.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 18/6/2015
|
6 |
+
* Time: 11:21
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Sendabox_Shippingext_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action{
|
10 |
+
|
11 |
+
private $_url = "http://ws.sendabox.it/SBWS.asmx/";
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
if($this->getRequest()->getParam("id")){
|
15 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Order '.$this->getRequest()->getParam("id").' succesfully created'));
|
16 |
+
}
|
17 |
+
$this->loadLayout()
|
18 |
+
->_setActiveMenu('sendabox/shipment')
|
19 |
+
->renderLayout();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function editAction(){
|
23 |
+
$this->loadLayout()
|
24 |
+
->_setActiveMenu('sendabox/shipment');
|
25 |
+
$id = $this->getRequest()->getParam('id');
|
26 |
+
$order = Mage::getModel('sendabox_shippingext/shipment')->load($id);
|
27 |
+
if (!$order->getId()) {
|
28 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Shipment does not exist.'));
|
29 |
+
$this->_redirect('*/*/');
|
30 |
+
}
|
31 |
+
|
32 |
+
Mage::register('sendabox_order', $order);
|
33 |
+
|
34 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
35 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
36 |
+
|
37 |
+
$boxes= Mage::getModel('sendabox_shippingext/box')->getCollection()->addFilter('shipment_id',$order->getId());
|
38 |
+
$orders=array();
|
39 |
+
foreach($boxes as $box){
|
40 |
+
array_push($orders,array('idusercityorder' => $box->sendabox_order_id,'encoded' => $box->sendabox_order_id_encoded));
|
41 |
+
}
|
42 |
+
$jsonData = array(
|
43 |
+
'apikey' => $username,
|
44 |
+
'apisecret' => $password,
|
45 |
+
'orders' => $orders,
|
46 |
+
);
|
47 |
+
|
48 |
+
$url=$this->_url.'GetOrders';
|
49 |
+
$jsonDataEncoded = json_encode($jsonData);
|
50 |
+
|
51 |
+
$headers=array("Content-Type"=>"application/json");
|
52 |
+
|
53 |
+
$http = new Varien_Http_Adapter_Curl();
|
54 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
55 |
+
$header_result = $http->read();
|
56 |
+
if ($header_result === false) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
61 |
+
$body = substr($header_result, $header_size);
|
62 |
+
$result = json_decode($body,true);
|
63 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
64 |
+
echo $result["ErrorMsg"];
|
65 |
+
} else {
|
66 |
+
Mage::register('sendabox_order_details', $result["Orders"]);
|
67 |
+
}
|
68 |
+
$this->renderLayout();
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
app/code/community/Sendabox/Shippingext/controllers/Adminhtml/ShipmentController.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 16:18
|
7 |
+
*/
|
8 |
+
class Sendabox_Shippingext_Adminhtml_ShipmentController extends Mage_Adminhtml_Controller_Action{
|
9 |
+
|
10 |
+
private $_url = "http://ws.sendabox.it/SBWS.asmx/";
|
11 |
+
public function indexAction()
|
12 |
+
{
|
13 |
+
$this->loadLayout()
|
14 |
+
->_setActiveMenu('sendabox/shipment')
|
15 |
+
->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function editAction(){
|
19 |
+
$this->loadLayout()
|
20 |
+
->_setActiveMenu('sendabox/shipment');
|
21 |
+
$id = $this->getRequest()->getParam('id');
|
22 |
+
$order = Mage::getModel('sales/order')->load($id);
|
23 |
+
if (!$order->getId()) {
|
24 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Shipment does not exist.'));
|
25 |
+
$this->_redirect('*/*/');
|
26 |
+
}
|
27 |
+
|
28 |
+
$notices = array();
|
29 |
+
|
30 |
+
if($this->checkCredits() == 0){
|
31 |
+
$this->_getSession()->addError('No credits remaining or error in the settings configuration of the extension');
|
32 |
+
//$notices[] = 'No credits remaining or error in the settings configuration of the extension';
|
33 |
+
}
|
34 |
+
|
35 |
+
if($this->checkCredits()<= 10){
|
36 |
+
$notices[] = 'Check your credits, only {$this->checkCredits()} remaining';
|
37 |
+
}
|
38 |
+
|
39 |
+
Mage::register('sendabox_order_data', $order);
|
40 |
+
|
41 |
+
$this->renderLayout();
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function checkCredits(){
|
45 |
+
$username = Mage::helper('sendabox_shippingext')->getConfigData('general/username');
|
46 |
+
$password = Mage::helper('sendabox_shippingext')->getConfigData('general/password');
|
47 |
+
$jsonData = array(
|
48 |
+
'apikey' => $username,
|
49 |
+
'apisecret' => $password
|
50 |
+
);
|
51 |
+
$url=$this->_url.'GetCredits';
|
52 |
+
$jsonDataEncoded = json_encode($jsonData);
|
53 |
+
|
54 |
+
$headers=array("Content-Type"=>"application/json");
|
55 |
+
|
56 |
+
$http = new Varien_Http_Adapter_Curl();
|
57 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', $headers, $jsonDataEncoded);
|
58 |
+
$header_result = $http->read();
|
59 |
+
if ($header_result === false) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$header_size = $http->getInfo(CURLINFO_HEADER_SIZE) ;
|
64 |
+
$body = substr($header_result, $header_size);
|
65 |
+
|
66 |
+
$result = json_decode($body,true);
|
67 |
+
if(isset($result["ErrorMsg"]) && $result["ErrorMsg"]){
|
68 |
+
return 0;
|
69 |
+
} else {
|
70 |
+
return $result['Credits'];
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
app/code/community/Sendabox/Shippingext/etc/adminhtml.xml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<sendabox module="sendabox_shippingext" translate="title">
|
5 |
+
<title>SendABox</title>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
<children>
|
8 |
+
<shipment module="sendabox_shippingext" translate="title">
|
9 |
+
<title>Manage Shipments</title>
|
10 |
+
<sort_order>1</sort_order>
|
11 |
+
<action>sendabox/adminhtml_shipment</action>
|
12 |
+
</shipment>
|
13 |
+
<orders module="sendabox_shippingext" translate="title">
|
14 |
+
<title>Orders</title>
|
15 |
+
<sort_order>2</sort_order>
|
16 |
+
<action>sendabox/adminhtml_order</action>
|
17 |
+
</orders>
|
18 |
+
<configuration module="sendabox_shippingext" translate="title">
|
19 |
+
<title>Settings</title>
|
20 |
+
<sort_order>3</sort_order>
|
21 |
+
<action>adminhtml/system_config/edit/section/sendabox_settings</action>
|
22 |
+
</configuration>
|
23 |
+
</children>
|
24 |
+
</sendabox>
|
25 |
+
</menu>
|
26 |
+
<acl>
|
27 |
+
<resources>
|
28 |
+
<all>
|
29 |
+
<title>Allow Everything</title>
|
30 |
+
</all>
|
31 |
+
<admin>
|
32 |
+
<children>
|
33 |
+
<sendabox translate="title" module="sendabox_shippingext">
|
34 |
+
<title>Sendabox</title>
|
35 |
+
<sort_order>10</sort_order>
|
36 |
+
<children>
|
37 |
+
<shipment>
|
38 |
+
<title>Manage Shipments</title>
|
39 |
+
</shipment>
|
40 |
+
<orders>
|
41 |
+
<title>Orders</title>
|
42 |
+
</orders>
|
43 |
+
<configuration>
|
44 |
+
<title>Settings</title>
|
45 |
+
</configuration>
|
46 |
+
</children>
|
47 |
+
</sendabox>
|
48 |
+
</children>
|
49 |
+
</admin>
|
50 |
+
</resources>
|
51 |
+
</acl>
|
52 |
+
</config>
|
app/code/community/Sendabox/Shippingext/etc/config.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sendabox_Shippingext>
|
5 |
+
<version>2.0.0</version>
|
6 |
+
</Sendabox_Shippingext>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<sendabox_shippingext>
|
11 |
+
<class>Sendabox_Shippingext_Model</class>
|
12 |
+
<resourceModel>sendabox_shippingext_resource</resourceModel>
|
13 |
+
</sendabox_shippingext>
|
14 |
+
<sendabox_shippingext_resource>
|
15 |
+
<class>Sendabox_Shippingext_Model_Resource</class>
|
16 |
+
<entities>
|
17 |
+
<shipment>
|
18 |
+
<table>sendabox_shipment</table>
|
19 |
+
</shipment>
|
20 |
+
<box>
|
21 |
+
<table>sendabox_box</table>
|
22 |
+
</box>
|
23 |
+
<agenda>
|
24 |
+
<table>sendabox_agenda</table>
|
25 |
+
</agenda>
|
26 |
+
</entities>
|
27 |
+
</sendabox_shippingext_resource>
|
28 |
+
<shipment>
|
29 |
+
<class>Sendabox_Shippingext_Model</class>
|
30 |
+
</shipment>
|
31 |
+
</models>
|
32 |
+
<blocks>
|
33 |
+
<sendabox_shippingext>
|
34 |
+
<class>Sendabox_Shippingext_Block</class>
|
35 |
+
</sendabox_shippingext>
|
36 |
+
</blocks>
|
37 |
+
<helpers>
|
38 |
+
<sendabox_shippingext>
|
39 |
+
<class>Sendabox_Shippingext_Helper</class>
|
40 |
+
</sendabox_shippingext>
|
41 |
+
</helpers>
|
42 |
+
<resources>
|
43 |
+
<sendabox_shippingext_setup>
|
44 |
+
<setup>
|
45 |
+
<module>Sendabox_Shippingext</module>
|
46 |
+
</setup>
|
47 |
+
</sendabox_shippingext_setup>
|
48 |
+
</resources>
|
49 |
+
</global>
|
50 |
+
<admin>
|
51 |
+
<routers>
|
52 |
+
<sendabox>
|
53 |
+
<use>admin</use>
|
54 |
+
<args>
|
55 |
+
<module>Sendabox_Shippingext</module>
|
56 |
+
<frontName>sendabox</frontName>
|
57 |
+
</args>
|
58 |
+
</sendabox>
|
59 |
+
</routers>
|
60 |
+
</admin>
|
61 |
+
<adminhtml>
|
62 |
+
<acl>
|
63 |
+
<resources>
|
64 |
+
<admin>
|
65 |
+
<children>
|
66 |
+
<system>
|
67 |
+
<children>
|
68 |
+
<config>
|
69 |
+
<children>
|
70 |
+
<sendabox_settings>
|
71 |
+
<title>Sendabox Settings</title>
|
72 |
+
</sendabox_settings>
|
73 |
+
</children>
|
74 |
+
</config>
|
75 |
+
</children>
|
76 |
+
</system>
|
77 |
+
</children>
|
78 |
+
</admin>
|
79 |
+
</resources>
|
80 |
+
</acl>
|
81 |
+
<layout>
|
82 |
+
<updates>
|
83 |
+
<sendabox>
|
84 |
+
<file>sendabox.xml</file>
|
85 |
+
</sendabox>
|
86 |
+
</updates>
|
87 |
+
</layout>
|
88 |
+
</adminhtml>
|
89 |
+
</config>
|
app/code/community/Sendabox/Shippingext/etc/system.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<sendabox_settings translate="label" module="sendabox_shippingext">
|
5 |
+
<label>Sendabox settings</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>200</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<general translate="label">
|
14 |
+
<label>SendABox General Settings</label>
|
15 |
+
<sort_order>10</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<comment>
|
20 |
+
<![CDATA[
|
21 |
+
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
22 |
+
Get your API Key and API Password from the profile page of your Sendabox.it account,
|
23 |
+
if you don't have one, you can <a href="http://www.sendabox.it" target="_blank">Sign Up</a> immediately.
|
24 |
+
</div>
|
25 |
+
]]>
|
26 |
+
</comment>
|
27 |
+
<fields>
|
28 |
+
<username translate="label">
|
29 |
+
<label>API Key</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</username>
|
36 |
+
<password>
|
37 |
+
<label>API Password</label>
|
38 |
+
<frontend_type>password</frontend_type>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</password>
|
44 |
+
<create_shipment>
|
45 |
+
<label>Create new shipment</label>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<source_model>shipment/create</source_model>
|
48 |
+
<sort_order>30</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</create_shipment>
|
53 |
+
</fields>
|
54 |
+
</general>
|
55 |
+
<agenda translate="label">
|
56 |
+
<label>Agenda</label>
|
57 |
+
<sort_order>20</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
<comment>
|
62 |
+
<![CDATA[
|
63 |
+
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
64 |
+
Copy your contact details from Sendabox to your local store
|
65 |
+
</div>
|
66 |
+
]]>
|
67 |
+
</comment>
|
68 |
+
<fields>
|
69 |
+
<copyinfo>
|
70 |
+
<label>Copy data</label>
|
71 |
+
<frontend_type>button</frontend_type>
|
72 |
+
<frontend_model>sendabox_shippingext/adminhtml_system_config_agenda_button</frontend_model>
|
73 |
+
<sort_order>20</sort_order>
|
74 |
+
<show_in_default>1</show_in_default>
|
75 |
+
<show_in_website>1</show_in_website>
|
76 |
+
<show_in_store>1</show_in_store>
|
77 |
+
</copyinfo>
|
78 |
+
|
79 |
+
</fields>
|
80 |
+
</agenda>
|
81 |
+
</groups>
|
82 |
+
</sendabox_settings>
|
83 |
+
</sections>
|
84 |
+
</config>
|
app/code/community/Sendabox/Shippingext/sql/sendabox_shippingext_setup/mysql4-data-install-2.0.0.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:41
|
7 |
+
*/
|
8 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
9 |
+
$installer = $this;
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
$installer->endSetup();
|
app/code/community/Sendabox/Shippingext/sql/sendabox_shippingext_setup/mysql4-install-2.0.0.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Stathis
|
5 |
+
* Date: 28/5/2015
|
6 |
+
* Time: 10:41
|
7 |
+
*/
|
8 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
9 |
+
$installer = $this;
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
|
13 |
+
$table=$installer->getConnection()
|
14 |
+
->newTable($installer->getTable('sendabox_shippingext/shipment'))
|
15 |
+
->addColumn('shipping_id',Varien_Db_Ddl_Table::TYPE_BIGINT,20,array(
|
16 |
+
'unsigned'=>true,
|
17 |
+
'identity'=>true,
|
18 |
+
'nullable'=>false,
|
19 |
+
'primary'=>true
|
20 |
+
),'ID')
|
21 |
+
|
22 |
+
->addColumn('order_id',Varien_Db_Ddl_Table::TYPE_INTEGER,10,array(
|
23 |
+
'unsigned'=>true,
|
24 |
+
'nullable'=>false,
|
25 |
+
),'Order ID')
|
26 |
+
->addColumn('customer_cost',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
27 |
+
'unsigned'=>true,
|
28 |
+
'nullable'=>false,
|
29 |
+
),'Customer cost')
|
30 |
+
->addColumn('shipping_name',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
31 |
+
'nullable'=>false,
|
32 |
+
),'Shipping name')
|
33 |
+
->addColumn('shipping_surname',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
34 |
+
'nullable'=>false,
|
35 |
+
),'Shipping surname')
|
36 |
+
->addColumn('shipping_at',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
37 |
+
'nullable'=>true,
|
38 |
+
),'Shipping co')
|
39 |
+
->addColumn('shipping_street',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
40 |
+
'nullable'=>false,
|
41 |
+
),'Shipping address')
|
42 |
+
->addColumn('shipping_number',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
43 |
+
'nullable'=>true,
|
44 |
+
),'Shipping number')
|
45 |
+
->addColumn('shipping_city',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
46 |
+
'nullable'=>false,
|
47 |
+
),'Shipping city')
|
48 |
+
->addColumn('shipping_postcode',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
49 |
+
'nullable'=>false,
|
50 |
+
),'Shipping postcode')
|
51 |
+
->addColumn('shipping_phone',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
52 |
+
'nullable'=>true,
|
53 |
+
),'Shipping phone')
|
54 |
+
->addColumn('shipping_email',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
55 |
+
'nullable'=>false,
|
56 |
+
),'Shipping email')
|
57 |
+
->addColumn('shipping_note',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
58 |
+
'nullable'=>true,
|
59 |
+
),'Shipping note')
|
60 |
+
->addColumn('destination_name',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
61 |
+
'nullable'=>false,
|
62 |
+
),'Destination name')
|
63 |
+
->addColumn('destination_surname',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
64 |
+
'nullable'=>false,
|
65 |
+
),'Destination surname')
|
66 |
+
->addColumn('destination_at',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
67 |
+
'nullable'=>true,
|
68 |
+
),'Destination co')
|
69 |
+
->addColumn('destination_street',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
70 |
+
'nullable'=>false,
|
71 |
+
),'Destination address')
|
72 |
+
->addColumn('destination_number',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
73 |
+
'nullable'=>true,
|
74 |
+
),'Destination number')
|
75 |
+
->addColumn('destination_city',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
76 |
+
'nullable'=>false,
|
77 |
+
),'Destination city')
|
78 |
+
->addColumn('destination_postcode',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
79 |
+
'nullable'=>false,
|
80 |
+
),'Destination postcode')
|
81 |
+
->addColumn('destination_phone',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
82 |
+
'nullable'=>true,
|
83 |
+
),'Destination phone')
|
84 |
+
->addColumn('destination_email',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
85 |
+
'nullable'=>false,
|
86 |
+
),'Destination email')
|
87 |
+
->addColumn('destination_note',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
88 |
+
'nullable'=>true,
|
89 |
+
),'Destination note');
|
90 |
+
|
91 |
+
$installer->getConnection()->createTable($table);
|
92 |
+
|
93 |
+
$table=$installer->getConnection()
|
94 |
+
->newTable($installer->getTable('sendabox_shippingext/box'))
|
95 |
+
->addColumn('box_id',Varien_Db_Ddl_Table::TYPE_BIGINT,20,array(
|
96 |
+
'unsigned'=>true,
|
97 |
+
'identity'=>true,
|
98 |
+
'nullable'=>false,
|
99 |
+
'primary'=>true
|
100 |
+
),'ID')
|
101 |
+
->addColumn('shipment_id',Varien_Db_Ddl_Table::TYPE_INTEGER,13,array(
|
102 |
+
'nullable'=>false,
|
103 |
+
),'Shipment ID')
|
104 |
+
->addColumn('sendabox_order_id',Varien_Db_Ddl_Table::TYPE_INTEGER,10,array(
|
105 |
+
'unsigned'=>true,
|
106 |
+
'nullable'=>false,
|
107 |
+
),'Sendabox Order ID')
|
108 |
+
->addColumn('sendabox_order_id_encoded',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
109 |
+
'unsigned'=>true,
|
110 |
+
'nullable'=>false,
|
111 |
+
),'Sendabox Order ID Encoded')
|
112 |
+
->addColumn('carrier',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
113 |
+
'nullable'=>false,
|
114 |
+
),'Carrier')
|
115 |
+
->addColumn('Comment',Varien_Db_Ddl_Table::TYPE_TEXT,255,null,'Status')
|
116 |
+
->addColumn('value',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
117 |
+
'nullable'=>false,
|
118 |
+
),'Value')
|
119 |
+
->addColumn('depth',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
120 |
+
'nullable'=>false,
|
121 |
+
),'Length')
|
122 |
+
->addColumn('width',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
123 |
+
'nullable'=>false,
|
124 |
+
),'Width')
|
125 |
+
->addColumn('height',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
126 |
+
'nullable'=>false,
|
127 |
+
),'Height')
|
128 |
+
->addColumn('weight',Varien_Db_Ddl_Table::TYPE_DECIMAL,'12,4',array(
|
129 |
+
'nullable'=>false,
|
130 |
+
),'Weight');
|
131 |
+
|
132 |
+
$installer->getConnection()->createTable($table);
|
133 |
+
|
134 |
+
$table=$installer->getConnection()
|
135 |
+
->newTable($installer->getTable('sendabox_shippingext/agenda'))
|
136 |
+
->addColumn('sender_id',Varien_Db_Ddl_Table::TYPE_BIGINT,20,array(
|
137 |
+
'unsigned'=>true,
|
138 |
+
'identity'=>true,
|
139 |
+
'nullable'=>false,
|
140 |
+
'primary'=>true
|
141 |
+
),'ID')
|
142 |
+
->addColumn('name',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
143 |
+
'nullable'=>false,
|
144 |
+
),'Name')
|
145 |
+
->addColumn('surname',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
146 |
+
'nullable'=>false,
|
147 |
+
),'Surname')
|
148 |
+
->addColumn('address',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
149 |
+
'nullable'=>false,
|
150 |
+
),'Address')
|
151 |
+
->addColumn('street_number',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
152 |
+
'nullable'=>false,
|
153 |
+
),'Street Number')
|
154 |
+
->addColumn('city',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
155 |
+
'nullable'=>false,
|
156 |
+
),'City')
|
157 |
+
->addColumn('province',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
158 |
+
'nullable'=>false,
|
159 |
+
),'Province')
|
160 |
+
->addColumn('co',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
161 |
+
'nullable'=>true,
|
162 |
+
),'CO')
|
163 |
+
->addColumn('zip',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
164 |
+
'nullable'=>false,
|
165 |
+
),'Zip')
|
166 |
+
->addColumn('mail',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
167 |
+
'nullable'=>false,
|
168 |
+
),'Email')
|
169 |
+
->addColumn('tel',Varien_Db_Ddl_Table::TYPE_VARCHAR,250,array(
|
170 |
+
'nullable'=>false,
|
171 |
+
),'Tel');
|
172 |
+
|
173 |
+
$installer->getConnection()->createTable($table);
|
174 |
+
|
175 |
+
$installer->endSetup();
|
app/code/community/Sendabox/Shippingext/tmp/100000095.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<shipment>
|
3 |
+
<departure>
|
4 |
+
<name>Efstathios</name>
|
5 |
+
<surname>Kapaniaris</surname>
|
6 |
+
<co/>
|
7 |
+
<address>Via Ippodromo</address>
|
8 |
+
<streetnumber>9</streetnumber>
|
9 |
+
<city>Milano</city>
|
10 |
+
<province>MI</province>
|
11 |
+
<zip>20151</zip>
|
12 |
+
<phone>3480068531</phone>
|
13 |
+
<email>stathis.kapaniaris@gmail.com</email>
|
14 |
+
</departure>
|
15 |
+
<destination>
|
16 |
+
<name>Gogi</name>
|
17 |
+
<surname>Cooper</surname>
|
18 |
+
<co/>
|
19 |
+
<address>30th St</address>
|
20 |
+
<streetnumber>sfda</streetnumber>
|
21 |
+
<city>New York</city>
|
22 |
+
<province>New York</province>
|
23 |
+
<country>19</country>
|
24 |
+
<zip>10450</zip>
|
25 |
+
<phone>1234500001</phone>
|
26 |
+
<email/>
|
27 |
+
</destination>
|
28 |
+
<boxes>
|
29 |
+
<box id="1">
|
30 |
+
<width value="2"/>
|
31 |
+
<height value="2"/>
|
32 |
+
<depth value="2"/>
|
33 |
+
<weight value="2"/>
|
34 |
+
</box>
|
35 |
+
</boxes>
|
36 |
+
</shipment>
|
app/code/community/Sendabox/Shippingext/tmp/100000211.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<shipment>
|
3 |
+
<departure>
|
4 |
+
<name>Efstathios</name>
|
5 |
+
<surname>Kapaniaris</surname>
|
6 |
+
<co/>
|
7 |
+
<address>Via Ippodromo</address>
|
8 |
+
<streetnumber>9</streetnumber>
|
9 |
+
<city>Milano</city>
|
10 |
+
<province>MI</province>
|
11 |
+
<zip>20151</zip>
|
12 |
+
<phone>3480068531</phone>
|
13 |
+
<email>stathis.kapaniaris@gmail.com</email>
|
14 |
+
</departure>
|
15 |
+
<destination>
|
16 |
+
<name>John</name>
|
17 |
+
<surname>Doe</surname>
|
18 |
+
<co/>
|
19 |
+
<address>10441 Jefferson Blvd, Suite 200</address>
|
20 |
+
<streetnumber>12</streetnumber>
|
21 |
+
<city>Culver City</city>
|
22 |
+
<province>California</province>
|
23 |
+
<country>19</country>
|
24 |
+
<zip>90232</zip>
|
25 |
+
<phone>888-888-8888</phone>
|
26 |
+
<email/>
|
27 |
+
</destination>
|
28 |
+
<boxes>
|
29 |
+
<box id="1">
|
30 |
+
<width value="2"/>
|
31 |
+
<height value="2"/>
|
32 |
+
<depth value="2"/>
|
33 |
+
<weight value="2"/>
|
34 |
+
</box>
|
35 |
+
</boxes>
|
36 |
+
</shipment>
|
app/code/community/Sendabox/Shippingext/tmp/145000003.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<shipment>
|
3 |
+
<departure>
|
4 |
+
<name>Efstathios</name>
|
5 |
+
<surname>Kapaniaris</surname>
|
6 |
+
<co/>
|
7 |
+
<address>Via Ippodromo</address>
|
8 |
+
<streetnumber>9</streetnumber>
|
9 |
+
<city>Milano</city>
|
10 |
+
<province>MI</province>
|
11 |
+
<zip>20151</zip>
|
12 |
+
<phone>3480068531</phone>
|
13 |
+
<email>stathis.kapaniaris@gmail.com</email>
|
14 |
+
</departure>
|
15 |
+
<destination>
|
16 |
+
<name>Jay</name>
|
17 |
+
<surname>Smith</surname>
|
18 |
+
<co/>
|
19 |
+
<address>10441 Jefferson Blvd</address>
|
20 |
+
<streetnumber>100</streetnumber>
|
21 |
+
<city>Culver City</city>
|
22 |
+
<province>California</province>
|
23 |
+
<country>19</country>
|
24 |
+
<zip>90232</zip>
|
25 |
+
<phone>999 9999-9999</phone>
|
26 |
+
<email/>
|
27 |
+
</destination>
|
28 |
+
<boxes>
|
29 |
+
<box id="1">
|
30 |
+
<width value="2"/>
|
31 |
+
<height value="2"/>
|
32 |
+
<depth value="2"/>
|
33 |
+
<weight value="2"/>
|
34 |
+
</box>
|
35 |
+
<box id="2"><width value="2"/><height value="2"/><depth value="2"/><weight value="2"/></box></boxes>
|
36 |
+
</shipment>
|
app/code/community/Sendabox/Shippingext/tmp/145000006.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<shipment>
|
3 |
+
<departure>
|
4 |
+
<name>Efstathios</name>
|
5 |
+
<surname>Kapaniaris</surname>
|
6 |
+
<co/>
|
7 |
+
<address>Via Ippodromo</address>
|
8 |
+
<streetnumber>9</streetnumber>
|
9 |
+
<city>Milano</city>
|
10 |
+
<province>MI</province>
|
11 |
+
<zip>20151</zip>
|
12 |
+
<phone>3480068531</phone>
|
13 |
+
<email>stathis.kapaniaris@gmail.com</email>
|
14 |
+
</departure>
|
15 |
+
<destination>
|
16 |
+
<name>Efstathios</name>
|
17 |
+
<surname>Kapaniaris</surname>
|
18 |
+
<co>sendabox</co>
|
19 |
+
<address>Kärrhöksgatan 100</address>
|
20 |
+
<streetnumber/>
|
21 |
+
<city>milano</city>
|
22 |
+
<province>mi</province>
|
23 |
+
<country>1</country>
|
24 |
+
<zip>20151</zip>
|
25 |
+
<phone>12ww</phone>
|
26 |
+
<email/>
|
27 |
+
</destination>
|
28 |
+
<boxes>
|
29 |
+
<box id="1">
|
30 |
+
<width value="2"/>
|
31 |
+
<height value="2"/>
|
32 |
+
<depth value="2"/>
|
33 |
+
<weight value="2"/>
|
34 |
+
</box>
|
35 |
+
</boxes>
|
36 |
+
</shipment>
|
app/code/community/Sendabox/Shippingext/tmp/145000007.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<shipment>
|
3 |
+
<departure>
|
4 |
+
<name>Efstathios</name>
|
5 |
+
<surname>Kapaniaris</surname>
|
6 |
+
<co/>
|
7 |
+
<address>Via Ippodromo</address>
|
8 |
+
<streetnumber>9</streetnumber>
|
9 |
+
<city>Milano</city>
|
10 |
+
<province>MI</province>
|
11 |
+
<zip>20151</zip>
|
12 |
+
<phone>3480068531</phone>
|
13 |
+
<email>stathis.kapaniaris@gmail.com</email>
|
14 |
+
</departure>
|
15 |
+
<destination>
|
16 |
+
<name>Efstathios</name>
|
17 |
+
<surname>Kapaniaris</surname>
|
18 |
+
<co/>
|
19 |
+
<address>Milano</address>
|
20 |
+
<streetnumber>10</streetnumber>
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
<phone>+46769091335</phone>
|
26 |
+
<email/>
|
27 |
+
<city>milano</city><province>MI</province><zip>20151</zip><country>1</country></destination>
|
28 |
+
<boxes>
|
29 |
+
<box id="1">
|
30 |
+
<width value="2"/>
|
31 |
+
<height value="2"/>
|
32 |
+
<depth value="2"/>
|
33 |
+
<weight value="2"/>
|
34 |
+
</box>
|
35 |
+
<box id="2"><width value="3"/><height value="3"/><depth value="3"/><weight value="3"/></box></boxes>
|
36 |
+
</shipment>
|
app/design/adminhtml/default/default/layout/sendabox.xml
CHANGED
@@ -1,36 +1,72 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
-
|
4 |
<sendabox_adminhtml_shipment_index>
|
5 |
-
|
6 |
<reference name="content">
|
7 |
-
<block type="
|
8 |
-
<block type="
|
9 |
</block>
|
10 |
</reference>
|
11 |
</sendabox_adminhtml_shipment_index>
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<reference name="head">
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
<reference name="content">
|
18 |
-
<block type="
|
|
|
|
|
|
|
19 |
</reference>
|
20 |
<reference name="left">
|
21 |
-
<block type="
|
22 |
<action method="addTab">
|
23 |
-
<name>
|
24 |
-
<block>
|
25 |
</action>
|
26 |
</block>
|
27 |
</reference>
|
28 |
-
</
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
</
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
|
|
3 |
<sendabox_adminhtml_shipment_index>
|
|
|
4 |
<reference name="content">
|
5 |
+
<block type="sendabox_shippingext/adminhtml_shipment">
|
6 |
+
<block type="sendabox_shippingext/adminhtml_shipment_grid" />
|
7 |
</block>
|
8 |
</reference>
|
9 |
</sendabox_adminhtml_shipment_index>
|
10 |
+
<sendabox_adminhtml_ajax_index>
|
11 |
+
<block type="sendabox_shippingext/adminhtml_ajax" />
|
12 |
+
</sendabox_adminhtml_ajax_index>
|
13 |
+
<sendabox_adminhtml_order_index>
|
14 |
+
<reference name="content">
|
15 |
+
<block type="sendabox_shippingext/adminhtml_order">
|
16 |
+
<block type="sendabox_shippingext/adminhtml_order_grid" />
|
17 |
+
</block>
|
18 |
+
</reference>
|
19 |
+
</sendabox_adminhtml_order_index>
|
20 |
+
<sendabox_adminhtml_shipment_edit>
|
21 |
+
<reference name="head">
|
22 |
+
<action method="addCss"><stylesheet>sendabox/sendabox.css</stylesheet></action>
|
23 |
+
<action method="addJs"><script>lib/jquery/jquery-1.10.2.js</script></action>
|
24 |
+
<action method="addJs"><script>lib/jquery/noconflict.js</script></action>
|
25 |
+
</reference>
|
26 |
+
<reference name="content">
|
27 |
+
<block type="sendabox_shippingext/adminhtml_shipment_edit" name="sendabox_shipment_edit"/>
|
28 |
+
<block type="sendabox_shippingext/adminhtml_shipment_edit" name="sendabox_shipment_edit_form"
|
29 |
+
template="sendabox/shippingform.phtml"/>
|
30 |
+
|
31 |
+
</reference>
|
32 |
+
<reference name="left">
|
33 |
+
<block type="sendabox_shippingext/adminhtml_shipment_edit_tabs" name="sendabox_shipment_edit_tabs">
|
34 |
+
|
35 |
+
<action method="addTab">
|
36 |
+
<name>sendabox_shipment_edit_tab_form</name>
|
37 |
+
<block>sendabox_shippingext/adminhtml_shipment_edit_tab_form</block>
|
38 |
+
</action>
|
39 |
+
|
40 |
+
</block>
|
41 |
+
</reference>
|
42 |
+
</sendabox_adminhtml_shipment_edit>
|
43 |
+
<sendabox_adminhtml_order_edit>
|
44 |
<reference name="head">
|
45 |
+
<action method="addCss"><stylesheet>sendabox/sendabox.css</stylesheet></action>
|
46 |
+
<action method="addJs"><script>lib/jquery/jquery-1.10.2.js</script></action>
|
47 |
+
<action method="addJs"><script>lib/jquery/noconflict.js</script></action>
|
48 |
+
</reference>
|
49 |
<reference name="content">
|
50 |
+
<block type="sendabox_shippingext/adminhtml_order_edit" name="sendabox_order_edit"/>
|
51 |
+
<block type="sendabox_shippingext/adminhtml_order_edit" name="sendabox_order_edit_form"
|
52 |
+
template="sendabox/order.phtml"/>
|
53 |
+
|
54 |
</reference>
|
55 |
<reference name="left">
|
56 |
+
<block type="sendabox_shippingext/adminhtml_order_edit_tabs" name="sendabox_order_edit_tabs">
|
57 |
<action method="addTab">
|
58 |
+
<name>sendabox_order_edit_tab_form</name>
|
59 |
+
<block>sendabox_shippingext/adminhtml_order_edit_tab_form</block>
|
60 |
</action>
|
61 |
</block>
|
62 |
</reference>
|
63 |
+
</sendabox_adminhtml_order_edit>
|
64 |
+
|
65 |
+
<sendabox_adminhtml_system_config_edit>
|
66 |
+
<reference name="head">
|
67 |
+
<action method="addCss"><stylesheet>sendabox/sendabox.css</stylesheet></action>
|
68 |
+
<action method="removeItem"><type>js</type><name>prototype/prototype.js</name></action>
|
69 |
+
<action method="addJs"><script>lib/jquery/jquery-1.10.2.js</script></action>
|
70 |
+
</reference>
|
71 |
+
</sendabox_adminhtml_system_config_edit>
|
72 |
+
</layout>
|
app/design/adminhtml/default/default/template/sendabox/order.phtml
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_order = $this->getOrder();$_order_details = $this->getOrderDetails(); $_order_boxes = $this->getOrderBoxes();$box=1;?>
|
2 |
+
<div class="entry-edit">
|
3 |
+
<div></div><span class="field-row">
|
4 |
+
<span id="box_shiiping_from"><div class="box-left">
|
5 |
+
<div class="entry-edit-head">
|
6 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Departure Information</h4>
|
7 |
+
<div class="form-buttons"></div>
|
8 |
+
</div>
|
9 |
+
<div class="fieldset " id="shipping_fieldset">
|
10 |
+
<div class="hor-scroll">
|
11 |
+
<table cellspacing="0" class="form-list">
|
12 |
+
<tbody>
|
13 |
+
<tr>
|
14 |
+
<td class="label"><label>Shipping Name</label></td>
|
15 |
+
<td class="label"><label><?php echo $_order->shipping_name ?></label></td>
|
16 |
+
</tr>
|
17 |
+
<tr>
|
18 |
+
<td class="label"><label>Shipping Surname</label></td>
|
19 |
+
<td class="label"><label><?php echo $_order->shipping_surname ?></label></td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<td class="label"><label>Shipping CO</label></td>
|
23 |
+
<td class="label"><label><?php echo $_order->shipping_at?></label></td>
|
24 |
+
</tr>
|
25 |
+
<tr>
|
26 |
+
<td class="label"><label>Shipping Address</label></td>
|
27 |
+
<td class="label"><label><?php echo $_order->shipping_street?></label></td>
|
28 |
+
</tr>
|
29 |
+
<tr>
|
30 |
+
<td class="label"><label>Shipping Street Number</label></td>
|
31 |
+
<td class="label"><label><?php echo $_order->shipping_number?></label></td>
|
32 |
+
</tr>
|
33 |
+
<tr>
|
34 |
+
<td class="label"><label>Shipping City/Province</td>
|
35 |
+
<td class="label"><label><?php echo $_order->shipping_city?></td>
|
36 |
+
</tr>
|
37 |
+
<tr>
|
38 |
+
<td class="label"><label>Shipping Zip</label></td>
|
39 |
+
<td class="label"><label><?php echo $_order->shipping_postcode?></label></td>
|
40 |
+
</tr>
|
41 |
+
<tr>
|
42 |
+
<td class="label"><label>Shipping Telephone</label></td>
|
43 |
+
<td class="label"><label><?php echo $_order->shipping_phone?></label></td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<td class="label"><label>Shipping email</label></td>
|
47 |
+
<td class="label"><label><?php echo $_order->shipping_email?></label></td>
|
48 |
+
</tr>
|
49 |
+
</tbody>
|
50 |
+
</table>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<span class="field-row">
|
54 |
+
<span id=""></span></span></div></span></span>
|
55 |
+
<span class="field-row">
|
56 |
+
<span id="box_shiiping_to"><div class="box-right">
|
57 |
+
<div class="entry-edit-head">
|
58 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Destination Information</h4>
|
59 |
+
<div class="form-buttons"></div>
|
60 |
+
</div>
|
61 |
+
<div class="fieldset " id="destination_fieldset">
|
62 |
+
<div class="hor-scroll">
|
63 |
+
<table cellspacing="0" class="form-list">
|
64 |
+
<tbody>
|
65 |
+
<tr>
|
66 |
+
<td class="label"><label>Destination Name</label></td>
|
67 |
+
<td class="label"><label><?php echo $_order->destination_name?></label></td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<td class="label"><label>Destination Surname</label></td>
|
71 |
+
<td class="label"><label><?php echo $_order->destination_surname?></label></td>
|
72 |
+
</tr>
|
73 |
+
<tr>
|
74 |
+
<td class="label"><label>Destination CO</label></td>
|
75 |
+
<td class="label"><label><?php echo $_order->destination_at?></label></td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td class="label"><label>Destination Address</label></td>
|
79 |
+
<td class="label"><label><?php echo $_order->destination_street?></label></td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td class="label"><label>Destination Street Number</label></td>
|
83 |
+
<td class="label"><label><?php echo $_order->destination_number?></label></td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td class="label"><label>Destination City/Province</label></td>
|
87 |
+
<td class="label"><label><?php echo $_order->destination_city?></label></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td class="label"><label>Destination Zip</label></td>
|
91 |
+
<td class="label"><label><?php echo $_order->destination_postcode?></label></td>
|
92 |
+
</tr>
|
93 |
+
<tr>
|
94 |
+
<td class="label"><label>Destination Telephone</label></td>
|
95 |
+
<td class="label"><label><?php echo $_order->destination_phone?></label></td>
|
96 |
+
</tr>
|
97 |
+
<tr>
|
98 |
+
<td class="label"><label>Destination email</label></td>
|
99 |
+
<td class="label"><label><?php echo $_order->destination_email?></label></td>
|
100 |
+
</tr>
|
101 |
+
</tbody>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
<span class="field-row">
|
106 |
+
<span id="close_destination"></span></span></div></span></span>
|
107 |
+
</div>
|
108 |
+
<br />
|
109 |
+
|
110 |
+
<div class="clear"></div>
|
111 |
+
<div class="entry-edit">
|
112 |
+
<div class="entry-edit-head">
|
113 |
+
<h4 class="icon-head head-products">Order Details</h4>
|
114 |
+
<div class="form-buttons"></div>
|
115 |
+
</div>
|
116 |
+
<div class="fieldset">
|
117 |
+
<div class="hor-scroll">
|
118 |
+
<table cellspacing="0" class="form-list">
|
119 |
+
<tbody>
|
120 |
+
<?php foreach($_order_details as $order): ?>
|
121 |
+
<tr>
|
122 |
+
<td class="label" colspan="2"><label><strong>Box <?php echo $box++ ?></strong></label></td>
|
123 |
+
</tr>
|
124 |
+
<tr>
|
125 |
+
<td class="label"><label>Order Number</label></td>
|
126 |
+
<td class="label"><label><?php echo $order["Order"]["idusercityorder"] ?></label></td>
|
127 |
+
</tr>
|
128 |
+
<tr>
|
129 |
+
<td class="label"><label>Shipping Document</label></td>
|
130 |
+
<td class="label"><label><a href="http://sendabox.it/<?php echo $order["Order"]["carrier"]?>Trasporto/Index/<?php echo $order["Order"]["logs"] ?>" target="_blank">Link</a></label></td>
|
131 |
+
</tr>
|
132 |
+
<tr>
|
133 |
+
<td class="label"><label>Order Date</label></td>
|
134 |
+
<td class="label"><label><?php preg_match( "#/Date\((\d{10})\d{3}(.*?)\)/#", $order["Order"]["orderdate"], $match );
|
135 |
+
echo date( 'd-m-Y H:i:s', $match[1] );?></label></td>
|
136 |
+
</tr>
|
137 |
+
<tr>
|
138 |
+
<td class="label"><label>Tracking Link</label></td>
|
139 |
+
<td class="label"><label><a href="http://sendabox.it/Trackings/Index/<?php echo $order["Order"]["logs"] ?>" target="_blank">http://sendabox.it/Trackings/Index/<?php echo $order["Order"]["logs"];?></a></label></td>
|
140 |
+
</tr>
|
141 |
+
<tr>
|
142 |
+
<td class="label"><label>Carrier</label></td>
|
143 |
+
<td class="label"><label><?php echo $order["Order"]["carrier"]?></label></td>
|
144 |
+
</tr>
|
145 |
+
<tr>
|
146 |
+
<td class="label"><label>Carrier Status</label></td>
|
147 |
+
<td class="label"><label><?php echo strpos($order["Order"]["senttocarrierstatus"],"SENT")===0?"Ordine trasmesso al corriere":"Ordine in lavorazione"?></label></td>
|
148 |
+
</tr>
|
149 |
+
<?php if(strpos($order["Order"]["senttocarrierstatus"],"SENT")===0): ?>
|
150 |
+
<tr>
|
151 |
+
<td class="label"><label>Sent to carrier on</label></td>
|
152 |
+
<td class="label"><label><?php preg_match( "#/Date\((\d{10})\d{3}(.*?)\)/#", $order["Order"]["senttocarrieron"], $match );
|
153 |
+
echo date( 'd-m-Y H:i:s', $match[1] ) ?></label></td>
|
154 |
+
</tr>
|
155 |
+
<?php endif ?>
|
156 |
+
<tr>
|
157 |
+
<td class="label"><label>Dimensions</label></td>
|
158 |
+
<td class="label"><label><?php echo $order["Order"]["width"].'cm x '.$order["Order"]["height"].'cm x '.$order["Order"]["depth"].'cm' ?></label></td>
|
159 |
+
</tr>
|
160 |
+
<tr>
|
161 |
+
<td class="label"><label>Weight</label></td>
|
162 |
+
<td class="label"><label><?php echo $order["Order"]["weight"].'kg'?></label></td>
|
163 |
+
</tr>
|
164 |
+
<tr>
|
165 |
+
<td class="label"><label>Total</label></td>
|
166 |
+
<td class="label"><label><?php echo $order["Order"]["orderprice"].'€'?></label></td>
|
167 |
+
</tr>
|
168 |
+
<?php if(count($order["Services"])>0): ?>
|
169 |
+
<tr>
|
170 |
+
<td class="label"><label>Services added</label></td>
|
171 |
+
<td>
|
172 |
+
<div class="grid np">
|
173 |
+
<div class="hor-scroll">
|
174 |
+
<table cellspacing="0" class="data order-tables" id="boxes">
|
175 |
+
<thead>
|
176 |
+
<tr class="headings">
|
177 |
+
<th>Service</th>
|
178 |
+
<th>Price</th>
|
179 |
+
<th>Value</th>
|
180 |
+
</tr>
|
181 |
+
</thead>
|
182 |
+
<tbody>
|
183 |
+
|
184 |
+
<?php foreach($order["Services"] as $service): ?>
|
185 |
+
<tr>
|
186 |
+
<td><?php echo $service["Service"] ?></td>
|
187 |
+
<td><?php echo $service["Cost"] ?></td>
|
188 |
+
<td><?php echo $service["Value"] ?></td>
|
189 |
+
</tr>
|
190 |
+
<?php endforeach ?>
|
191 |
+
</tbody>
|
192 |
+
</table>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
<?php endif ?>
|
198 |
+
<?php endforeach ?>
|
199 |
+
</tbody>
|
200 |
+
</table>
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
</div>
|
app/design/adminhtml/default/default/template/sendabox/shippingform.phtml
ADDED
@@ -0,0 +1,594 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_order = $this->getOrder();$_orderqty=0; ?>
|
2 |
+
<input type="hidden" name="boxes">
|
3 |
+
<input type="hidden" name="orderid" value="<?php echo $_order->getRealOrderId() ?>" readonly>
|
4 |
+
<div class="grid np">
|
5 |
+
<div class="hor-scroll">
|
6 |
+
<table cellspacing="0" class="data order-tables">
|
7 |
+
|
8 |
+
<thead>
|
9 |
+
<tr class="headings">
|
10 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Sku') ?></th>
|
11 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Product name') ?></th>
|
12 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Total Weight') ?></th>
|
13 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Qty') ?></th>
|
14 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Total Price') ?></th>
|
15 |
+
|
16 |
+
</tr>
|
17 |
+
</thead>
|
18 |
+
<?php $_items = $_order->getAllItems() ?>
|
19 |
+
<tbody>
|
20 |
+
<?php $i=0;foreach ($_items as $_item):?>
|
21 |
+
<?php if ($_item->getParentItem()) continue; else $i++;?>
|
22 |
+
<tr>
|
23 |
+
<td><?php echo $_item->sku ?></td>
|
24 |
+
<td><?php echo $_item->getName() ?></td>
|
25 |
+
<td><?php echo number_format($_item->getWeight()*$_item->getQtyOrdered(),2) ?></td>
|
26 |
+
<td><?php $_orderqty+=$_item->getQtyOrdered(); echo number_format($_item->getQtyOrdered(),0) ?></td>
|
27 |
+
<td><?php echo Mage::helper('core')->currency($_item->getRowTotalInclTax(), true, false) ?></td>
|
28 |
+
</tr>
|
29 |
+
<?php endforeach; ?>
|
30 |
+
<tr>
|
31 |
+
<td><b>Total</b></td>
|
32 |
+
<td></td>
|
33 |
+
<td><?php echo number_format($_order->getWeight(),2) ?></td>
|
34 |
+
<td><?php echo number_format($_orderqty,0) ?></td>
|
35 |
+
<td><?php echo Mage::helper('core')->currency($_order->getGrandTotal()-$_order->getShippingAmount(), true, false)?></td>
|
36 |
+
</tr>
|
37 |
+
</tbody>
|
38 |
+
</table>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
<br />
|
42 |
+
|
43 |
+
<div class="clear"></div>
|
44 |
+
|
45 |
+
|
46 |
+
<div class="entry-edit">
|
47 |
+
<div class="entry-edit-head">
|
48 |
+
<h4 class="icon-head head-products"><?php echo $this->helper('sendabox_shippingext')->__('Package order details') ?></h4>
|
49 |
+
<button id="addBox" onclick="addBox()" title="<?php echo $this->helper('sendabox_shippingext')->__('Add another box') ?>" type="button" class="scalable save f-right" style=""><span><span><span><?php echo $this->helper('sendabox_shippingext')->__('Add another box') ?></span></span></span></button>
|
50 |
+
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<div class="grid np">
|
54 |
+
<div class="hor-scroll">
|
55 |
+
<table cellspacing="0" class="data order-tables" id="boxes">
|
56 |
+
|
57 |
+
<thead>
|
58 |
+
<tr class="headings">
|
59 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Box #') ?></th>
|
60 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Width') ?></th>
|
61 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Height') ?></th>
|
62 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Depth') ?></th>
|
63 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Weight') ?></th>
|
64 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Products in this box') ?></th>
|
65 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Remove') ?></th>
|
66 |
+
</tr>
|
67 |
+
</thead>
|
68 |
+
<tbody>
|
69 |
+
<tr id="box-1">
|
70 |
+
<td>Box 1</td>
|
71 |
+
<td><input class="input-text" type="number" id="width-1" name="width-1" ></td>
|
72 |
+
<td><input class="input-text" type="number" id="height-1" name="height-1" ></td>
|
73 |
+
<td><input class="input-text" type="number" id="depth-1" name="depth-1" ></td>
|
74 |
+
<td><input class="input-text" type="number" id="weight-1" name="weight-1" ></td>
|
75 |
+
<td>
|
76 |
+
<table>
|
77 |
+
<thead>
|
78 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Select') ?></th>
|
79 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Sku') ?></th>
|
80 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Product') ?></th>
|
81 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Quantity') ?></th>
|
82 |
+
</thead>
|
83 |
+
<?php $i=0;foreach ($_items as $_item):
|
84 |
+
?>
|
85 |
+
<?php if ($_item->getParentItem()) continue; else $i++;?>
|
86 |
+
<tr>
|
87 |
+
<td><input type="checkbox" class="box-1-item-<?php echo $_item->sku; ?>-checkbox" disabled></td>
|
88 |
+
<td><?php echo $_item->sku ?></td>
|
89 |
+
<td><?php echo $_item->getName() ?></td>
|
90 |
+
<td>
|
91 |
+
<input type="hidden" id="item-<?php echo $_item->sku; ?>-qty" value="<?php echo $_item->getQtyOrdered() ?>">
|
92 |
+
<select class="box-1-item-<?php echo $_item->sku; ?>" onchange="adjustQuantities(1,'<?php echo $_item->sku; ?>')">
|
93 |
+
<?php for($j=0;$j<=$_item->getQtyOrdered();$j++){ ?>
|
94 |
+
<option value="<?php echo $j; ?>"><?php echo $j; ?></option>
|
95 |
+
<?php } ?>
|
96 |
+
</select>
|
97 |
+
/ <?php echo number_format($_item->getQtyOrdered(),0) ?>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<?php endforeach; ?>
|
101 |
+
</table>
|
102 |
+
</td>
|
103 |
+
<td></td>
|
104 |
+
</tr>
|
105 |
+
|
106 |
+
</tbody>
|
107 |
+
</table>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
<div class="clear"></div>
|
111 |
+
<br>
|
112 |
+
<div class="entry-edit">
|
113 |
+
<div class="entry-edit-head">
|
114 |
+
<h4 class="icon-head head-products"><?php echo $this->helper('sendabox_shippingext')->__('Available carriers') ?></h4>
|
115 |
+
<button id="unblock" onclick="unblock()" title="<?php echo $this->helper('sendabox_shippingext')->__('Modify boxes') ?>" type="button" class="scalable save f-right" style="display: none"><span><span><span><?php echo $this->helper('sendabox_shippingext')->__('Modify boxes') ?></span></span></span></button>
|
116 |
+
<button id="getoffers" onclick="callController()" title="<?php echo $this->helper('sendabox_shippingext')->__('Search carriers') ?>" type="submit" class="scalable save f-right" style=""><span><span><span><?php echo $this->helper('sendabox_shippingext')->__('Search carriers') ?></span></span></span></button>
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
<div class="grid np" id=results-panel>
|
120 |
+
<div class="hor-scroll">
|
121 |
+
<table cellspacing="0" class="data order-tables">
|
122 |
+
<tbody>
|
123 |
+
<tr>
|
124 |
+
<td id="searchresults">
|
125 |
+
<?php echo $this->helper('sendabox_shippingext')->__('Complete the fields above and press \'Search Carrier\' to get offers') ?>
|
126 |
+
</td>
|
127 |
+
|
128 |
+
</tr>
|
129 |
+
<tr id="summary_panel" style="display: none">
|
130 |
+
<td>
|
131 |
+
<div class="entry-edit" >
|
132 |
+
<div class="entry-edit-head">
|
133 |
+
<h4 class="icon-head head-products">Summary</h4>
|
134 |
+
</div>
|
135 |
+
<table>
|
136 |
+
<thead>
|
137 |
+
<tr class="headings">
|
138 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Box')?></th>
|
139 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Carrier')?></th>
|
140 |
+
<th><?php echo $this->helper('sendabox_shippingext')->__('Total price')?></th>
|
141 |
+
</tr>
|
142 |
+
</thead>
|
143 |
+
<tbody id="selected_boxes">
|
144 |
+
</tbody>
|
145 |
+
</table>
|
146 |
+
<br>
|
147 |
+
<br>
|
148 |
+
<table>
|
149 |
+
<tbody>
|
150 |
+
<tr>
|
151 |
+
<td><?php echo $this->helper('sendabox_shippingext')->__('Total')?></td>
|
152 |
+
<td id = "final_price"><strong>0€</strong></td><td><button id="buybtn" class="scalable" onclick="submitOrder()"><?php echo $this->helper('sendabox_shippingext')->__('Buy')?></button></td>
|
153 |
+
</tr>
|
154 |
+
<input type="hidden" name="final-price"/>
|
155 |
+
</tbody>
|
156 |
+
</table>
|
157 |
+
|
158 |
+
</div>
|
159 |
+
</td>
|
160 |
+
</tr>
|
161 |
+
</tbody>
|
162 |
+
</table>
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
|
166 |
+
<script type="text/javascript">
|
167 |
+
var box=1;
|
168 |
+
function addBox(){
|
169 |
+
box++;
|
170 |
+
var total_products_left=0;
|
171 |
+
var build_box='<tr class="box" id="box-'+box+'"><td class="tag">Box '+box+'</td>' +
|
172 |
+
'<td><input class="input-text" type="number" id="width" name="width-'+box+'" ></td>'+
|
173 |
+
'<td><input class="input-text" type="number" id="height" name="height-'+box+'" ></td>'+
|
174 |
+
'<td><input class="input-text" type="number" id="depth" name="depth-'+box+'" ></td>'+
|
175 |
+
'<td><input class="input-text" type="number" id="weight" name="weight-'+box+'" ></td>'+
|
176 |
+
'<td><table><thead>'+
|
177 |
+
'<th><?php echo $this->helper('sendabox_shippingext')->__('Select') ?></th>'+
|
178 |
+
'<th><?php echo $this->helper('sendabox_shippingext')->__('Sku') ?></th>'+
|
179 |
+
'<th><?php echo $this->helper('sendabox_shippingext')->__('Product') ?></th>'+
|
180 |
+
'<th><?php echo $this->helper('sendabox_shippingext')->__('Quantity') ?></th>'+
|
181 |
+
'</thead>';
|
182 |
+
var skus=Array();
|
183 |
+
<?php $i=0;foreach ($_items as $_item):?>
|
184 |
+
<?php if ($_item->getParentItem()) continue; else $i++;?>
|
185 |
+
|
186 |
+
var sku='<?php echo $_item->sku ?>';
|
187 |
+
skus.push(sku);
|
188 |
+
var products='<?php echo $_item->getQtyOrdered(); ?>';
|
189 |
+
var products_selected=0;
|
190 |
+
for(var i=box-1;i>0;i--){
|
191 |
+
products_selected+=parseInt(jQuery(".box-"+i+"-item-"+sku+" option:selected").text());
|
192 |
+
}
|
193 |
+
|
194 |
+
products-=products_selected;
|
195 |
+
total_products_left+=products;
|
196 |
+
var constract='';
|
197 |
+
for(var i = 0;i<=products;i++){
|
198 |
+
constract+='<option value='+i+'>'+i+'</option>';
|
199 |
+
}
|
200 |
+
|
201 |
+
build_box+= '<tr>'+
|
202 |
+
'<td><input type="checkbox" class="box-'+box+'-item-<?php echo $_item->sku; ?>-checkbox" disabled></td>'+
|
203 |
+
'<td><?php echo $_item->sku ?></td>'+
|
204 |
+
'<td><?php echo $_item->getName() ?></td>'+
|
205 |
+
'<td><select class="box-'+box+'-item-<?php echo $_item->sku; ?>" onchange="adjustQuantities('+box+',\''+sku+'\')">'+constract+
|
206 |
+
'</select> / '+products+'</td>'+
|
207 |
+
'</tr>';
|
208 |
+
|
209 |
+
<?php endforeach; ?>
|
210 |
+
|
211 |
+
var deletefunction='deleterow('+box+',\''+skus+'\',this)';
|
212 |
+
build_box+='</table>'+
|
213 |
+
'</td>'+
|
214 |
+
'<td><button class="scalable removeboxbtn" onclick="'+deletefunction+'" >Remove Box</button></td></tr>'
|
215 |
+
|
216 |
+
if(total_products_left==0){
|
217 |
+
box--;
|
218 |
+
alert('<?php echo $this->helper('sendabox_shippingext')->__('No more products left to send')?> ');
|
219 |
+
return;
|
220 |
+
}
|
221 |
+
|
222 |
+
jQuery("#boxes tr[id^=box-]:last").after(build_box);
|
223 |
+
}
|
224 |
+
|
225 |
+
function adjustQuantities(box,sku){
|
226 |
+
var totalqtyselected=0;
|
227 |
+
for(var i=1;i<=this.box;i++){
|
228 |
+
totalqtyselected+=parseInt(jQuery(".box-"+i+"-item-"+sku+" option:selected").val());
|
229 |
+
}
|
230 |
+
var totalqty=parseInt(jQuery("#item-"+sku+"-qty").val());
|
231 |
+
var qtyleft=totalqty-totalqtyselected;
|
232 |
+
|
233 |
+
for(var i=1;i<=this.box;i++){
|
234 |
+
var currentval=parseInt(jQuery(".box-"+i+"-item-"+sku+" option:selected").val());
|
235 |
+
if(currentval===0){
|
236 |
+
jQuery(".box-"+i+"-item-"+sku+"-checkbox").attr("disabled","disabled");
|
237 |
+
}
|
238 |
+
else{
|
239 |
+
jQuery(".box-"+i+"-item-"+sku+"-checkbox").removeAttr("disabled");
|
240 |
+
}
|
241 |
+
if(box!=i){
|
242 |
+
|
243 |
+
jQuery(".box-"+i+"-item-"+sku).find('option').remove().end();
|
244 |
+
|
245 |
+
for(var j = 0;j<=(currentval+qtyleft);j++){
|
246 |
+
jQuery(".box-"+i+"-item-"+sku).append('<option value='+j+'>'+j+'</option>');
|
247 |
+
}
|
248 |
+
|
249 |
+
jQuery(".box-"+i+"-item-"+sku).val(currentval);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
function deleterow(b,skus,i){
|
255 |
+
var sku=skus.split(',');
|
256 |
+
sku.forEach(function(sku){
|
257 |
+
var totalqtyselected=0;
|
258 |
+
for(var i=1;i<=this.box;i++){
|
259 |
+
if(i===b) continue;
|
260 |
+
totalqtyselected+=parseInt(jQuery(".box-"+i+"-item-"+sku+" option:selected").val());
|
261 |
+
}
|
262 |
+
var totalqty=parseInt(jQuery("#item-"+sku+"-qty").val());
|
263 |
+
var qtyleft=totalqty-totalqtyselected;
|
264 |
+
|
265 |
+
for(var i=1;i<=this.box;i++){
|
266 |
+
var currentval=parseInt(jQuery(".box-"+i+"-item-"+sku+" option:selected").val());
|
267 |
+
jQuery(".box-"+i+"-item-"+sku).find('option').remove().end();
|
268 |
+
|
269 |
+
for(var j = 0;j<=(currentval+qtyleft);j++){
|
270 |
+
jQuery(".box-"+i+"-item-"+sku).append('<option value='+j+'>'+j+'</option>');
|
271 |
+
}
|
272 |
+
|
273 |
+
if(currentval===0){
|
274 |
+
jQuery(".box-"+i+"-item-"+sku+"-checkbox").attr("disabled","disabled");
|
275 |
+
}
|
276 |
+
else{
|
277 |
+
jQuery(".box-"+i+"-item-"+sku+"-checkbox").removeAttr("disabled");
|
278 |
+
}
|
279 |
+
jQuery(".box-"+i+"-item-"+sku).val(currentval);
|
280 |
+
|
281 |
+
}
|
282 |
+
});
|
283 |
+
|
284 |
+
var tr = jQuery(i).closest('tr');
|
285 |
+
tr.remove();
|
286 |
+
box=1;
|
287 |
+
|
288 |
+
jQuery("tr.box").each(function(){
|
289 |
+
box++;
|
290 |
+
jQuery(this).find("td.tag").html('Box '+box);
|
291 |
+
jQuery(this).find("input#width").attr('name',"width-"+box);
|
292 |
+
jQuery(this).find("input#height").attr('name',"height-"+box);
|
293 |
+
jQuery(this).find("input#depth").attr('name',"depth-"+box);
|
294 |
+
jQuery(this).find("input#weight").attr('name',"weight-"+box);
|
295 |
+
if(box>=b){
|
296 |
+
sku.forEach(function(key){
|
297 |
+
jQuery(".box-"+(box+1)+"-item-"+key).attr('onchange',"adjustQuantities("+box+",'"+key+"')");
|
298 |
+
jQuery(".box-"+(box+1)+"-item-"+key).attr('class',"box-"+box+"-item-"+key);
|
299 |
+
});
|
300 |
+
}
|
301 |
+
});
|
302 |
+
|
303 |
+
if(jQuery("#result-box-"+b).length>0){
|
304 |
+
jQuery("#result-box-"+b).remove();
|
305 |
+
}
|
306 |
+
|
307 |
+
|
308 |
+
|
309 |
+
}
|
310 |
+
function callController(){
|
311 |
+
|
312 |
+
jQuery("input[name=boxes]").val(box);
|
313 |
+
new Ajax.Request("<?php echo $this->getUrl('sendabox/adminhtml_ajax/index') ?>", {
|
314 |
+
method: 'Post',
|
315 |
+
parameters: jQuery("input,select").serialize(),
|
316 |
+
onComplete: function(data){
|
317 |
+
var json=jQuery.parseJSON(data.responseText);
|
318 |
+
if(json["ErrorMsg"]){
|
319 |
+
alert(json["ErrorMsg"]);
|
320 |
+
return null;
|
321 |
+
}
|
322 |
+
jQuery("#shipping_city,#shipping_province,#shipping_zip,#destination_city,#destination_province,#destination_country,#destination_zip,[name^=width-],[name^=height-],[name^=depth-],[name^=weight-]").attr("readonly","readonly").css("background-color","#C0C0C0 ");
|
323 |
+
jQuery("#unblock").css("display","block");
|
324 |
+
jQuery("#getoffers").css("display","none");
|
325 |
+
jQuery(".removeboxbtn").css("display","none");
|
326 |
+
jQuery("#addBox,#destination_country").attr("disabled","disabled");
|
327 |
+
|
328 |
+
jQuery("#results-panel input,#results-panel button").removeAttr("disabled");
|
329 |
+
var length=Object.keys(json).length;
|
330 |
+
if(length===0) return null;
|
331 |
+
|
332 |
+
for(var i=0;i<length;i++){
|
333 |
+
var html_builder='<table>';
|
334 |
+
html_builder+='<thead>';
|
335 |
+
html_builder+='<tr class=\"headings\">';
|
336 |
+
html_builder+='<th colspan="6"><strong><?php echo $this->helper('sendabox_shippingext')->__('Box') ?>'+Object.keys(json)[i]+'</strong></th>';
|
337 |
+
html_builder+='</tr>';
|
338 |
+
html_builder+='<tr class="headings">';
|
339 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Choose carrier') ?></strong></th>';
|
340 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Carrier') ?></strong></th>';
|
341 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Base price') ?></strong></th>';
|
342 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Available services') ?></strong></th>';
|
343 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Select services') ?></strong></th>';
|
344 |
+
html_builder+='<th><strong><?php echo $this->helper('sendabox_shippingext')->__('Total price') ?></strong></th>';
|
345 |
+
html_builder+='</tr></thead>';
|
346 |
+
for(var j=0;j<json[Object.keys(json)[i]].offers.length;j++){
|
347 |
+
html_builder+='<tr>';
|
348 |
+
html_builder+='<td><input type=hidden id="box_'+Object.keys(json)[i]+'_carrier_'+json[Object.keys(json)[i]].offers[j].idcarrier+'_idshippingdetail" name="box_'+Object.keys(json)[i]+'_carrier_'+json[Object.keys(json)[i]].offers[j].idcarrier+'_idshippingdetail" value="'+json[Object.keys(json)[i]].offers[j].idshippingdetail+'">';
|
349 |
+
html_builder+='<input type=hidden id="box_'+Object.keys(json)[i]+'_carrier_'+json[Object.keys(json)[i]].offers[j].idcarrier+'_idpricelist" name="box_'+Object.keys(json)[i]+'_carrier_'+json[Object.keys(json)[i]].offers[j].idcarrier+'_idpricelist" value="'+json[Object.keys(json)[i]].offers[j].idpricelist+'">';
|
350 |
+
html_builder+='<input onclick=\'addToSummary('+Object.keys(json)[i]+','+json[Object.keys(json)[i]].offers[j].idcarrier+')\' type="radio" name="box_'+Object.keys(json)[i]+'" id="box_'+Object.keys(json)[i]+'_carrier_'+json[Object.keys(json)[i]].offers[j].idcarrier+'" value="'+json[Object.keys(json)[i]].offers[j].idcarrier+'"></td>';
|
351 |
+
html_builder+='<td id="box_'+Object.keys(json)[i]+'_carrier_name_'+json[Object.keys(json)[i]].offers[j].idcarrier+'">'+json[Object.keys(json)[i]].offers[j].carrier+'</td>';
|
352 |
+
html_builder+='<td>'+json[Object.keys(json)[i]].offers[j].price+'€</td>';
|
353 |
+
var availableservices="";
|
354 |
+
for(var k=0;k<json[Object.keys(json)[i]].offers[j].services.length;k++){
|
355 |
+
availableservices+=json[Object.keys(json)[i]].offers[j].services[k]+" ";
|
356 |
+
}
|
357 |
+
html_builder+='<td>'+availableservices+'</td>';
|
358 |
+
html_builder+='<td><button onclick=\'callServices('+Object.keys(json)[i]+','+json[Object.keys(json)[i]].offers[j].idcarrier+')\' class=\"scalable\">Add services</button></td>';
|
359 |
+
html_builder+='<td id="box_'+Object.keys(json)[i]+'_carrier_price_'+json[Object.keys(json)[i]].offers[j].idcarrier+'\"><strong>'+json[Object.keys(json)[i]].offers[j].price.replace(',','.')+'€</strong></td>';
|
360 |
+
html_builder+='<tr style="display: none" id="box_'+Object.keys(json)[i]+'_services_'+json[Object.keys(json)[i]].offers[j].idcarrier+'"></tr>';
|
361 |
+
html_builder+='</tr>';
|
362 |
+
}
|
363 |
+
html_builder+='</table>';
|
364 |
+
|
365 |
+
if(jQuery("#result-box-"+Object.keys(json)[i]).length>0){
|
366 |
+
jQuery("#result-box-"+Object.keys(json)[i]).html(html_builder);
|
367 |
+
}
|
368 |
+
else {
|
369 |
+
jQuery("#searchresults").append("<div id='result-box-"+Object.keys(json)[i]+"'>"+html_builder+"</div>");
|
370 |
+
|
371 |
+
}
|
372 |
+
|
373 |
+
jQuery("#summary-box-"+Object.keys(json)[i]).remove();
|
374 |
+
|
375 |
+
}
|
376 |
+
|
377 |
+
|
378 |
+
}
|
379 |
+
});
|
380 |
+
// var validateform= new varienForm('edit_form', true);
|
381 |
+
// if (!validateform.validator.validate())
|
382 |
+
// {
|
383 |
+
// alert("<?php //echo $this->helper('sendabox_shippingext')->__('Complete all the required fields') ?>//");
|
384 |
+
// return;
|
385 |
+
//
|
386 |
+
// }
|
387 |
+
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
function unblock(){
|
392 |
+
jQuery("#shipping_city,#shipping_province,#shipping_zip,#destination_city,#destination_province,#destination_country,#destination_zip,[name^=width-],[name^=height-],[name^=depth-],[name^=weight-]").removeAttr("readonly").css("background-color","#ffffff ");;
|
393 |
+
jQuery("#unblock").css("display","none");
|
394 |
+
jQuery(".removeboxbtn").css("display","block");
|
395 |
+
jQuery("#getoffers").css("display","block");
|
396 |
+
jQuery("#addBox,#destination_country").removeAttr("disabled");
|
397 |
+
jQuery("#results-panel input,#results-panel button").attr("disabled","disabled");
|
398 |
+
|
399 |
+
}
|
400 |
+
function callServices(b,i){
|
401 |
+
new Ajax.Request("<?php echo $this->getUrl('sendabox/adminhtml_ajax/services') ?>", {
|
402 |
+
method: 'Post',
|
403 |
+
parameters: {b,i},
|
404 |
+
onComplete: function(data) {
|
405 |
+
jQuery("#box_"+b+"_services_"+i).html(data.responseText).show('slow');
|
406 |
+
}
|
407 |
+
});
|
408 |
+
}
|
409 |
+
|
410 |
+
function servicecheck(box,carrier,service){
|
411 |
+
var getserviceprice=parseFloat(jQuery("#box_"+box+"_serviceprice_"+carrier+"_"+service).html().replace('€',''));
|
412 |
+
var gettotalprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+carrier).html().replace('<strong>','').replace('€</strong>',''));
|
413 |
+
if(jQuery("#box_"+box+"_service_"+carrier+"_"+service).is(':checked')){
|
414 |
+
var newprice=Math.round((gettotalprice+getserviceprice)*100)/100;
|
415 |
+
jQuery("#box_"+box+"_carrier_price_"+carrier).html('<strong>'+newprice+'€</strong>');
|
416 |
+
}
|
417 |
+
else{
|
418 |
+
var newprice=Math.round((gettotalprice-getserviceprice)*100)/100;
|
419 |
+
jQuery("#box_"+box+"_carrier_price_"+carrier).html('<strong>'+newprice+'€</strong>');
|
420 |
+
}
|
421 |
+
|
422 |
+
if(jQuery('#box_'+box+'_final_price').length>0 && jQuery('#box_'+box+'_carrier_'+carrier).is(':checked')){
|
423 |
+
var totalprice=parseFloat(jQuery('#final_price').html().replace('<strong>','').replace('</strong>',''));
|
424 |
+
var currentprice=parseFloat(jQuery('#box_'+box+'_final_price').html().replace('<strong>','').replace('</strong>',''));
|
425 |
+
totalprice-=currentprice;
|
426 |
+
jQuery('#box_'+box+'_final_price').html(jQuery("#box_"+box+"_carrier_price_"+carrier).html());
|
427 |
+
var newprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+carrier).html().replace('<strong>','').replace('€</strong>',''));
|
428 |
+
totalprice+=newprice;
|
429 |
+
jQuery('#final_price').html('<strong>'+Math.round(totalprice*100)/100+'€</strong>');
|
430 |
+
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
function updateInsurance(box,idcarrier,service){
|
435 |
+
|
436 |
+
var price=0;
|
437 |
+
var ass=jQuery("#box_"+box+"_service_ins_"+idcarrier+"_"+service).val();
|
438 |
+
|
439 |
+
if (ass > 0 && ass <= 250) {
|
440 |
+
price = 2.95;
|
441 |
+
}
|
442 |
+
else if (ass > 250 && ass <= 500) {
|
443 |
+
price = 8;
|
444 |
+
}
|
445 |
+
else if (ass > 500 && ass <= 1000) {
|
446 |
+
price = 18;
|
447 |
+
}
|
448 |
+
else if (ass > 1000 && ass <= 2500) {
|
449 |
+
price = 48;
|
450 |
+
}
|
451 |
+
var currentprice=parseFloat(jQuery("#box_"+box+"_serviceprice_"+idcarrier+"_"+service).html().replace('€',''));
|
452 |
+
if(currentprice!=price){
|
453 |
+
jQuery("#box_"+box+"_serviceprice_"+idcarrier+"_"+service).html(price+'€');
|
454 |
+
var gettotalprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html().replace('<strong>','').replace('€</strong>',''));
|
455 |
+
if(jQuery("#box_"+box+"_service_"+idcarrier+"_"+service).is(':checked')){
|
456 |
+
var newprice=Math.round(((gettotalprice-currentprice)+price)*100)/100;
|
457 |
+
jQuery("#box_"+box+"_carrier_price_"+idcarrier).html('<strong>'+newprice+'€</strong>');
|
458 |
+
if(jQuery('#box_'+box+'_final_price').length>0 && jQuery('#box_'+box+'_carrier_'+idcarrier).is(':checked')){
|
459 |
+
var totalprice=parseFloat(jQuery('#final_price').html().replace('<strong>','').replace('</strong>',''));
|
460 |
+
var currentprice=parseFloat(jQuery('#box_'+box+'_final_price').html().replace('<strong>','').replace('</strong>',''));
|
461 |
+
totalprice-=currentprice;
|
462 |
+
jQuery("#box_"+box+"_final_price").html(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html());
|
463 |
+
var newprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html().replace('<strong>','').replace('€</strong>',''));
|
464 |
+
totalprice+=newprice;
|
465 |
+
jQuery('#final_price').html('<strong>'+Math.round(totalprice*100)/100+'€</strong>');
|
466 |
+
}
|
467 |
+
}
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
function updateContrassegno(box,idcarrier,service){
|
472 |
+
|
473 |
+
var price=0;
|
474 |
+
var con=jQuery("#box_"+box+"_service_con_"+idcarrier+"_"+service).val();
|
475 |
+
|
476 |
+
if (con>0 && con < 516.47) {
|
477 |
+
price = 2.48;
|
478 |
+
}
|
479 |
+
else if (con >= 516.47 && con<1000) {
|
480 |
+
price = Math.round((2.48 + (0.0249 * (con - 516.46)))*100)/100;
|
481 |
+
|
482 |
+
}
|
483 |
+
|
484 |
+
var currentprice=parseFloat(jQuery("#box_"+box+"_serviceprice_"+idcarrier+"_"+service).html().replace('€',''));
|
485 |
+
if(currentprice!=price){
|
486 |
+
jQuery("#box_"+box+"_serviceprice_"+idcarrier+"_"+service).html(price+'€');
|
487 |
+
var gettotalprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html().replace('<strong>','').replace('€</strong>',''));
|
488 |
+
if(jQuery("#box_"+box+"_service_"+idcarrier+"_"+service).is(':checked')){
|
489 |
+
var newprice=Math.round(((gettotalprice-currentprice)+price)*100)/100;
|
490 |
+
jQuery("#box_"+box+"_carrier_price_"+idcarrier).html('<strong>'+newprice+'€</strong>');
|
491 |
+
if(jQuery('#box_'+box+'_final_price').length>0 && jQuery('#box_'+box+'_carrier_'+idcarrier).is(':checked')){
|
492 |
+
var totalprice=parseFloat(jQuery('#final_price').html().replace('<strong>','').replace('</strong>',''));
|
493 |
+
var currentprice=parseFloat(jQuery('#box_'+box+'_final_price').html().replace('<strong>','').replace('</strong>',''));
|
494 |
+
totalprice-=currentprice;
|
495 |
+
jQuery("#box_"+box+"_final_price").html(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html());
|
496 |
+
var newprice=parseFloat(jQuery("#box_"+box+"_carrier_price_"+idcarrier).html().replace('<strong>','').replace('€</strong>',''));
|
497 |
+
totalprice+=newprice;
|
498 |
+
jQuery('#final_price').html('<strong>'+Math.round(totalprice*100)/100+'€</strong>');
|
499 |
+
}
|
500 |
+
}
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
function addToSummary(box,carrier){
|
505 |
+
jQuery('#summary_panel').show('slow');
|
506 |
+
var totalprice=parseFloat(jQuery('#final_price').html().replace('<strong>','').replace('</strong>',''));
|
507 |
+
if(jQuery('#selected_boxes tr#summary-box-'+box+'').length> 0){
|
508 |
+
var currentprice=parseFloat(jQuery('#box_'+box+'_final_price').html().replace('<strong>','').replace('</strong>',''));
|
509 |
+
totalprice-=currentprice;
|
510 |
+
jQuery('#selected_boxes tr#summary-box-'+box+'').remove();
|
511 |
+
}
|
512 |
+
|
513 |
+
jQuery('#selected_boxes').append('<tr id=summary-box-'+box+'>'+
|
514 |
+
'<td><?php echo $this->helper('sendabox_shippingext')->__('Box') ?> '+box+'</td>'+
|
515 |
+
'<td>'+jQuery('#box_'+box+'_carrier_name_'+carrier).html()+'</td>'+
|
516 |
+
'<td id="box_'+box+'_final_price">'+jQuery('#box_'+box+'_carrier_price_'+carrier).html()+'</td>'+
|
517 |
+
'<input type=\'hidden\' name="box_'+box+'_final_price" value='+jQuery('#box_'+box+'_carrier_price_'+carrier).html().replace('<strong>','').replace('</strong>','').replace('€','')+'>'+
|
518 |
+
'</tr>');
|
519 |
+
|
520 |
+
totalprice+=parseFloat(jQuery('#box_'+box+'_carrier_price_'+carrier).html().replace('<strong>','').replace('</strong>',''));
|
521 |
+
jQuery('#final_price').html('<strong>'+Math.round(totalprice*100)/100+'€</strong>')
|
522 |
+
}
|
523 |
+
|
524 |
+
function populateFields(){
|
525 |
+
new Ajax.Request("<?php echo $this->getUrl('sendabox/adminhtml_ajax/populate') ?>", {
|
526 |
+
method: 'Post',
|
527 |
+
parameters: jQuery("select#shipping_agenda").serialize(),
|
528 |
+
onComplete: function (data) {
|
529 |
+
var json = jQuery.parseJSON(data.responseText);
|
530 |
+
jQuery("#shipping_name").val(json.name);
|
531 |
+
jQuery("#shipping_surname").val(json.surname);
|
532 |
+
jQuery("#shipping_co").val(json.co);
|
533 |
+
jQuery("#shipping_address").val(json.address);
|
534 |
+
jQuery("#shipping_streetnumber").val(json.street_number);
|
535 |
+
jQuery("#shipping_city").val(json.city);
|
536 |
+
jQuery("#shipping_province").val(json.province);
|
537 |
+
jQuery("#shipping_zip").val(json.zip);
|
538 |
+
jQuery("#shipping_tel").val(json.tel);
|
539 |
+
jQuery("#shipping_email").val(json.email);
|
540 |
+
|
541 |
+
}
|
542 |
+
});
|
543 |
+
}
|
544 |
+
|
545 |
+
function validateInput(i){
|
546 |
+
var key = event.keyCode || event.which;
|
547 |
+
if (key == 37 || key == 39 || key == 8 || key == 46) {
|
548 |
+
return;
|
549 |
+
}
|
550 |
+
if (key == 44) {
|
551 |
+
jQuery(i).val(jQuery(i).val() + '.');
|
552 |
+
event.preventDefault();
|
553 |
+
}
|
554 |
+
|
555 |
+
var regex = new RegExp("^[0-9\.,]+$");
|
556 |
+
var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
|
557 |
+
|
558 |
+
|
559 |
+
if (!regex.test(key)) {
|
560 |
+
event.preventDefault();
|
561 |
+
return false;
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
function closePanel(b,i){
|
566 |
+
jQuery("#box_"+b+"_services_"+i).hide('slow');
|
567 |
+
}
|
568 |
+
|
569 |
+
function submitOrder(){
|
570 |
+
var confirm=window.confirm('Confirm your order?');
|
571 |
+
if(!confirm){
|
572 |
+
return;
|
573 |
+
}
|
574 |
+
|
575 |
+
jQuery("#destination_country").removeAttr("disabled");
|
576 |
+
jQuery("input[name=final-price]").val(jQuery('#final_price').html().replace('<strong>','').replace('</strong>','').replace('€',''));
|
577 |
+
|
578 |
+
new Ajax.Request("<?php echo $this->getUrl('sendabox/adminhtml_ajax/order') ?>", {
|
579 |
+
method: 'Post',
|
580 |
+
parameters: jQuery("input,select#destination_country").serialize(),
|
581 |
+
onComplete: function (data) {
|
582 |
+
var json = jQuery.parseJSON(data.responseText);
|
583 |
+
if (json["ErrorMsg"]) {
|
584 |
+
alert(json["ErrorMsg"]);
|
585 |
+
return null;
|
586 |
+
}
|
587 |
+
|
588 |
+
window.location="<?php echo $this->getUrl('sendabox/adminhtml_order/index') ?>"
|
589 |
+
|
590 |
+
}
|
591 |
+
});
|
592 |
+
|
593 |
+
}
|
594 |
+
</script>
|
app/design/adminhtml/default/default/template/sendabox/system/config/agenda/button.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
//<![CDATA[
|
3 |
+
function check() {
|
4 |
+
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
5 |
+
method: 'post',
|
6 |
+
onSuccess: function(data){
|
7 |
+
|
8 |
+
var json = data.responseText;
|
9 |
+
if (json !== "Contacts inserted successfully") {
|
10 |
+
alert(json);
|
11 |
+
return null;
|
12 |
+
}
|
13 |
+
|
14 |
+
alert(json);
|
15 |
+
}
|
16 |
+
});
|
17 |
+
}
|
18 |
+
//]]>
|
19 |
+
</script>
|
20 |
+
|
21 |
+
<?php echo $this->getButtonHtml() ?>
|
app/etc/modules/Sendabox_Sendabox.xml
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Module initial config
|
5 |
-
*
|
6 |
-
* @author Italmondo S.p.a.
|
7 |
-
*/
|
8 |
-
-->
|
9 |
-
<config>
|
10 |
-
<modules>
|
11 |
-
<Sendabox_Sendabox>
|
12 |
-
<active>true</active>
|
13 |
-
<codePool>community</codePool>
|
14 |
-
<depends>
|
15 |
-
<Mage_Shipping />
|
16 |
-
</depends>
|
17 |
-
</Sendabox_Sendabox>
|
18 |
-
</modules>
|
19 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Sendabox_Shippingext.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sendabox_Shippingext>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping/>
|
9 |
+
</depends>
|
10 |
+
</Sendabox_Shippingext>
|
11 |
+
</modules>
|
12 |
+
</config>
|
js/sendabox/autocomplete.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
window.onload = function() {var origin = document.getElementById('sendabox_options_origin_city');
|
2 |
-
if(origin!=null)
|
3 |
-
new Ajax.Autocompleter('sendabox_options_origin_city','autocompleter_city_origin','/CityOrigin.php', {paramName: 'destination_city',minChars: 3, afterUpdateElement : getSelectionIdOrigin});
|
4 |
-
}
|
5 |
-
function getSelectionIdOrigin(text, li) {
|
6 |
-
var city_id = document.getElementById("sendabox_options_origin_city_id").value = li.id;
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,23 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendabox_Sendabox</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<notes>Version number: 1.0.0 Stability: Stable</notes>
|
17 |
-
<authors><author><name>Italmondo S.p.a.</name><user>Italmondo</user><email>magentosupport@sendabox.it</email></author></authors>
|
18 |
-
<date>2014-04-08</date>
|
19 |
-
<time>16:47:40</time>
|
20 |
-
<contents><target name="magecommunity"><dir name="Sendabox"><dir name="Sendabox"><dir name="Block"><dir name="Adminhtml"><dir name="Shipment"><dir name="Edit"><file name="Form.php" hash="b4d902cc166eb31b6e35b2bdc7331f4f"/><dir name="Tab"><file name="Abstract.php" hash="ebb8f83e8b17a3422ea047dc2ac2cf43"/><dir name="Form"><file name="Anywhere.php" hash="98c7ce21b8349babd176e57e2ba8fba3"/><file name="Boxes.php" hash="d3b10ca692f612edc0aa462b5edcbf97"/><file name="Products.php" hash="6e9d8d036a7e703575437e600b22cedb"/><file name="Quotes.php" hash="91f6c1fc6667676bfa47ce033c3237b3"/><file name="Status.php" hash="c3dab296bd89e472bcce74593f04061d"/></dir><file name="Form.php" hash="b5c4cce9b10e15ca2fb913bc7ba20d18"/></dir><file name="Tabs.php" hash="efa399d3761c18474a9a9fdc0fe1d2ef"/></dir><file name="Edit.php" hash="fd82eaf484043569ac628c138e4fbe96"/><file name="Grid.php" hash="6391583bb311ad88cd0155ac200888da"/></dir><file name="Shipment.php" hash="105b7e239a95b9ffc3445b2c7f263552"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Required.php" hash="7935bc02781ac0a0927bbcfe223d25c5"/></dir><dir name="Fieldset"><file name="General.php" hash="cf999b29beaa075ac5713f630fa2f50f"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="578cdc7603dc8b5c13689defe120c67c"/></dir><dir name="Model"><file name="Box.php" hash="75843ccbe43474ff09d186530a9c91e0"/><file name="Carrier.php" hash="d79d2ef1a25ec8e0eb8a103e54f372f8"/><file name="Observer.php" hash="734dcf24b38d1c46b247a7a1eb2c5b20"/><file name="Quote.php" hash="fcb60a65289a4a16a4ebe56d52fe868f"/><dir name="Resource"><dir name="Box"><file name="Collection.php" hash="369c129a7475c54fd6b5f60b0a557921"/></dir><file name="Box.php" hash="116c8ae50a7e47a1ec311b32b5599522"/><dir name="Carrier"><file name="Collection.php" hash="1ee2d6e61e21764ee3b83fce3d5f8e92"/></dir><file name="Carrier.php" hash="03900b911f8ad844765c400ac05af44b"/><dir name="Quote"><file name="Collection.php" hash="312a840152ab0e80cc958c1c7e3f21e1"/></dir><file name="Quote.php" hash="ae9d39aeca2e97e09a20193f9617f528"/><dir name="Shipment"><file name="Collection.php" hash="9744be8c4244a939127c47a79373cf6f"/></dir><file name="Shipment.php" hash="c06ab95769cf1c5ed31c88a9dbc27e2f"/></dir><file name="Shipment.php" hash="7ce885cd83508d2a736693579688aa54"/><dir name="Shipping"><dir name="Carrier"><dir name="Sendabox"><dir name="Source"><file name="Method.php" hash="746879a722dc5ac517b5c6c8c99a9e09"/></dir></dir><file name="Sendabox.php" hash="9da79b03b4c3a6a08f9ce4d8abe892bc"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Form"><dir name="Field"><dir name="Required"><file name="Text.php" hash="3031600b8b04fa6065cb91b2000a6bb8"/></dir></dir></dir></dir><dir name="Source"><file name="Errorprocess.php" hash="b264868a3655591a85a8f633984e5a25"/><file name="Insurance.php" hash="8a50ea3b78902566f526dbc8e5f7d6d9"/><file name="Pricing.php" hash="21c17624e7ceceef986dbb56115f3d5d"/><dir name="Shipment"><file name="Status.php" hash="cb3da45507a2e9dd7567b37fe97cfb82"/></dir><dir name="Unit"><file name="Measure.php" hash="f002813a46092805f5c6cd9a8e7dee09"/><file name="Weight.php" hash="f0995a3c58f1a87ba7d718daee49e568"/></dir><file name="Unit.php" hash="dd31ac8b2a1d26bfcd3929efd57a11c2"/></dir><file name="Source.php" hash="d753983ac45e38d7739023515ea284f4"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ShipmentController.php" hash="72afd2ae16458ec4fb07f2038f77d41e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7400268460e2f9d273077c25ff04944d"/><file name="config.xml" hash="dcb8d4ef4219f06961cf85102eb0685b"/><file name="system.xml" hash="3841d0bbbdd88555afb3129cd4783f5f"/></dir><dir name="sql"><dir name="sendabox_sendabox_setup"><file name="mysql4-install-1.0.0.php" hash="e29438e67a8dabe5a24f9b9b6668042a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendabox.xml" hash="0ffd55d8b2ec22af645e5f911f6fdac2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendabox_Sendabox.xml" hash="0d1ad52218d5906f77f5c77971e2ebeb"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendabox"><file name="sendabox.css" hash="8f5e178cd5e4163770fcd4c6025d430f"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="sendabox"><file name="autocomplete.js" hash="83a5a9daf8526eac2e2b78dd98a45bc2"/></dir></dir><dir name="."><file name="CityOrigin.php" hash="31ebd027770221d00fa9e5c68f1527a6"/></dir></target></contents>
|
21 |
<compatible/>
|
22 |
-
<dependencies><required><php><min>5.
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendabox_Sendabox</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>Open Software License </license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Shipping extension for Sendabox.it</summary>
|
10 |
+
<description>Shipping extension for Sendabox.it</description>
|
11 |
+
<notes>New version</notes>
|
12 |
+
<authors><author><name>Stathis Kapaniaris</name><user>stathis</user><email>stathis.kapaniaris@gmail.com</email></author></authors>
|
13 |
+
<date>2015-07-06</date>
|
14 |
+
<time>13:57:13</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Sendabox"><dir name="Shippingext"><dir name="Block"><dir name="Adminhtml"><file name="Check.php" hash="6f67e05c24d69be38adaee8249922eff"/><dir name="Order"><dir name="Edit"><file name="Form.php" hash="63ce6d6d495363d73433846f64123165"/><dir name="Tab"><file name="Abstract.php" hash="504567041f7b5328b81e4f957d47fb9c"/><dir name="Form"><file name="Anywhere.php" hash="08369777d6be1f9cc5c2a38b7bb9dd77"/><file name="Boxes.php" hash="4ede99c6b3ecaf39ee625179e25a88b6"/><file name="Products.php" hash="781c7e5c1756e6a2cc6c7c20786108e4"/><file name="Quotes.php" hash="50a6c45d8eb54948c2abefa166305697"/><file name="Status.php" hash="4049342909c17056542ba49ddcef0423"/></dir><file name="Form.php" hash="f50908cf0e77322b633943275bc1a62c"/></dir><file name="Tabs.php" hash="3ddda60001995f6a0a665b6b32b4cb17"/></dir><file name="Edit.php" hash="19f9e971e2d4ab33ef6d7d9aeab14db9"/><file name="Grid.php" hash="18c5f3dfea5495e696f68273c3cb6e83"/><dir name="Rendered"><file name="LDV.php" hash="63113c884cb4bdc6853a4de80051014b"/><file name="NameSurname.php" hash="d6182c7b67ad6b57588f866c66401f5f"/><file name="Price.php" hash="672dbe39631bf3d7efc39c70b0c9da79"/><file name="Tracking.php" hash="b7fd471f0d6420e708a5060d90a3e5d9"/></dir></dir><file name="Order.php" hash="cd4e5120e4b1eecd6261f333558c5ddc"/><dir name="Shipment"><dir name="Edit"><file name="Form.php" hash="06b87a715476c0d90cbcdf6f6eeb8d69"/><dir name="Tab"><file name="Abstract.php" hash="78f17251f3777709552754834034a6a9"/><file name="Content.php" hash="e9a0cc06c406057864797648a7a35123"/><dir name="Form"><file name="Anywhere.php" hash="5a71bacb6ec05215546cd386b81130fa"/><file name="Boxes.php" hash="4ede99c6b3ecaf39ee625179e25a88b6"/><file name="Products.php" hash="781c7e5c1756e6a2cc6c7c20786108e4"/><file name="Quotes.php" hash="50a6c45d8eb54948c2abefa166305697"/><file name="Status.php" hash="4049342909c17056542ba49ddcef0423"/></dir><file name="Form.php" hash="2e4b54f45224d293fb2536164d60cdd5"/><file name="Image.php" hash="48ed269d5e3621e1d8783dfb2f9d1d15"/><file name="Main.php" hash="3083c9a1980ff717f06cb092ae885757"/></dir><file name="Tabs.php" hash="811d31434d5c29a91a66e9b197b3e464"/></dir><file name="Edit.php" hash="a08aa4e12fa5cc5bb69cf2d272d0e1de"/><file name="Grid.php" hash="3c4e241e69d87c3c3baa666925c497b9"/></dir><file name="Shipment.php" hash="f9886f15657d2812f83700c80894e992"/><dir name="System"><dir name="Config"><dir name="Agenda"><file name="Button.php" hash="1d3320aefb2f4d90099994767cc0394b"/></dir><dir name="Form"><dir name="Field"><file name="Required.php" hash="2a451600ef46f88a85a850640eb334b8"/></dir><dir name="Fieldset"><file name="General.php" hash="77f2b2f529b9a3f044fcb558cbe8a1a1"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d7a20cb44fb07d9c76abd01ee3f01d2d"/></dir><dir name="Model"><file name="Agenda.php" hash="7920662932020e98e3f9733893a9a73d"/><file name="Box.php" hash="371d556f3a9cb155e72db8c315ec1bb4"/><file name="Create.php" hash="a10da6a355b5214302e3dc3ad67c94db"/><dir name="Resource"><dir name="Agenda"><file name="Collection.php" hash="99bec7b56d15b20a4270e07936606b80"/></dir><file name="Agenda.php" hash="83c42d719ac6b352a1646d1242c8112f"/><dir name="Box"><file name="Collection.php" hash="4ce8a78ebb6004299126e771e6472b12"/></dir><file name="Box.php" hash="dc6c34ab2d238ef288bd1f9b4b05f3cf"/><dir name="Shipment"><file name="Collection.php" hash="e78e55c7fe6cd579ba65ba8613616dfa"/></dir><file name="Shipment.php" hash="ffde70079c50b451f8b29d4cf163eb87"/></dir><file name="Shipment.php" hash="36bbc3b139503e42cc34d88f723b220b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="d809bada09f9689136e2b0455caaba44"/><file name="OrderController.php" hash="6e67bdeb41d09c21aad37ab1feef533e"/><file name="ShipmentController.php" hash="96f86985a7b3e623d33108cc731bbdac"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="618f137613347c8cb0136c9175482b01"/><file name="config.xml" hash="a7c55d5485c82a5ecbb7f9023bdfa86b"/><file name="system.xml" hash="2e576fe15ac370dbd115caf294ec88cb"/></dir><dir name="sql"><dir name="sendabox_shippingext_setup"><file name="mysql4-data-install-2.0.0.php" hash="02577366f1672ad3b1446d53a48783d7"/><file name="mysql4-install-2.0.0.php" hash="b22e66e8066198b07a52036303907fd7"/></dir></dir><dir name="tmp"><file name="100000095.xml" hash="1f729cfe2b4b989687f8d20dd6671e93"/><file name="100000211.xml" hash="c320cbf46a0f8f6baf4bcd0c841b5dd5"/><file name="145000003.xml" hash="ccce4338aeba370b83641b924862a785"/><file name="145000006.xml" hash="2a8af2f2efb08c383964e0293f62d951"/><file name="145000007.xml" hash="142f45ba067ad29e7c61a4a930b6b78b"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendabox.xml" hash="1c2207a4a5c8abf189cff504e47f6568"/></dir><dir name="template"><dir name="sendabox"><file name="order.phtml" hash="921e67009a432b7f2b036fed35cdd69b"/><file name="shippingform.phtml" hash="5faf275f5d559585f25191ed715cd366"/><dir name="system"><dir name="config"><dir name="agenda"><file name="button.phtml" hash="27cba7709594a344aa62e9fe5219ae6c"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendabox_Shippingext.xml" hash="21aacabe6867318df2990f98c0275295"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendabox"><file name="sendabox.css" hash="25d8cbfcbb77c9a11b739e5892d0589a"/></dir></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.5.0</min><max>5.6.9</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/sendabox/sendabox.css
CHANGED
@@ -1,22 +1,31 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
background-color: #fff;
|
5 |
-
z-index: 15;
|
6 |
-
margin:0;
|
7 |
-
padding:0;
|
8 |
}
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
1 |
+
/* Form Validation */
|
2 |
+
.input-text {
|
3 |
+
position: relative !important;
|
|
|
|
|
|
|
|
|
4 |
}
|
5 |
+
.validation-advice {
|
6 |
+
background: #DB6D00;
|
7 |
+
bottom: -7px;
|
8 |
+
color: #fff;
|
9 |
+
font-size: 11px;
|
10 |
+
font-weight: bold;
|
11 |
+
line-height: 13px;
|
12 |
+
min-height: 13px;
|
13 |
+
padding: 10px;
|
14 |
+
position: absolute;
|
15 |
+
right: -150px;
|
16 |
+
width: 120px;
|
17 |
+
border-radius: 5px;
|
18 |
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
|
19 |
+
|
20 |
}
|
21 |
+
.validation-advice:after {
|
22 |
+
position: absolute;
|
23 |
+
left: -8px;
|
24 |
+
bottom: 8px;
|
25 |
+
content: " ";
|
26 |
+
width: 0;
|
27 |
+
height: 0;
|
28 |
+
border-top: 8px solid transparent;
|
29 |
+
border-bottom: 8px solid transparent;
|
30 |
+
border-right: 8px solid #DB6D00;
|
31 |
}
|