Version Notes
First release.
Download this release
Release Info
Developer | PHPro |
Extension | karibooshipping |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Download.php +24 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Download/Grid.php +89 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order.php +24 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/Grid.php +215 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/View/Tab/Returnbarcode.php +135 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/View/Tab/Returnlabels.php +192 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/Shipping/Carrier/Kariboo/Tablerate/Grid.php +131 -0
- app/code/community/Kariboo/Shipping/Block/Adminhtml/System/Config/Form/Export.php +39 -0
- app/code/community/Kariboo/Shipping/Block/Carrier/Kariboo.php +31 -0
- app/code/community/Kariboo/Shipping/Helper/Data.php +153 -0
- app/code/community/Kariboo/Shipping/Model/Adminhtml/Kariboogrid.php +240 -0
- app/code/community/Kariboo/Shipping/Model/Cron.php +36 -0
- app/code/community/Kariboo/Shipping/Model/Observer.php +211 -0
- app/code/community/Kariboo/Shipping/Model/Payment/Kariboocod.php +55 -0
- app/code/community/Kariboo/Shipping/Model/Resource/Returnlabel.php +21 -0
- app/code/community/Kariboo/Shipping/Model/Resource/Returnlabel/Collection.php +22 -0
- app/code/community/Kariboo/Shipping/Model/Resource/Tablerate.php +434 -0
- app/code/community/Kariboo/Shipping/Model/Resource/Tablerate/Collection.php +107 -0
- app/code/community/Kariboo/Shipping/Model/Returnlabel.php +85 -0
- app/code/community/Kariboo/Shipping/Model/Shipping/Geocode.php +104 -0
- app/code/community/Kariboo/Shipping/Model/Shipping/Kariboo.php +220 -0
- app/code/community/Kariboo/Shipping/Model/System/Config/Backend/Shipping/Tablerate.php +22 -0
- app/code/community/Kariboo/Shipping/Model/System/Config/Source/Display.php +45 -0
- app/code/community/Kariboo/Shipping/Model/System/Config/Source/Ratetypes.php +45 -0
- app/code/community/Kariboo/Shipping/Model/System/Config/Source/Weightunit.php +47 -0
- app/code/community/Kariboo/Shipping/Model/Tablerate.php +15 -0
- app/code/community/Kariboo/Shipping/Model/Webservice.php +283 -0
- app/code/community/Kariboo/Shipping/controllers/Adminhtml/KaribooconfigController.php +35 -0
- app/code/community/Kariboo/Shipping/controllers/Adminhtml/KariboodownloadController.php +39 -0
- app/code/community/Kariboo/Shipping/controllers/Adminhtml/KaribooorderController.php +207 -0
- app/code/community/Kariboo/Shipping/controllers/AjaxController.php +52 -0
- app/code/community/Kariboo/Shipping/etc/adminhtml.xml +40 -0
- app/code/community/Kariboo/Shipping/etc/config.xml +224 -0
- app/code/community/Kariboo/Shipping/etc/system.xml +289 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-install-0.0.1.php +22 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.1-0.0.2.php +92 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.2-0.0.3.php +25 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.3-0.0.4.php +17 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.4-0.0.5.php +25 -0
- app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.5-0.0.6.php +25 -0
- app/design/adminhtml/default/default/layout/kariboo_shipping.xml +17 -0
- app/design/frontend/base/default/layout/kariboo_shipping.xml +27 -0
- app/design/frontend/base/default/template/kariboo/shipping/gmapsapi.phtml +21 -0
- app/design/frontend/base/default/template/kariboo/shipping/kariboo_checkout_append.phtml +58 -0
- app/etc/modules/zKariboo_Shipping.xml +9 -0
- app/locale/en_US/Kariboo_Shipping.csv +58 -0
- app/locale/en_US/template/email/sales/kariboo_returnlabel.html +42 -0
- app/locale/fr_FR/template/email/sales/kariboo_returnlabel.html +42 -0
- app/locale/nl_NL/Kariboo_Shipping.csv +62 -0
- app/locale/nl_NL/template/email/sales/kariboo_returnlabel.html +42 -0
- js/kariboo/shipping/checkout.js +601 -0
- package.xml +18 -0
- skin/frontend/base/default/css/kariboo/window.css +446 -0
- skin/frontend/base/default/images/kariboo/ajax-loader.gif +0 -0
- skin/frontend/base/default/images/kariboo/ajax-loader_filter.gif +0 -0
- skin/frontend/base/default/images/kariboo/button_close.png +0 -0
- skin/frontend/base/default/images/kariboo/icon_sprite.png +0 -0
- skin/frontend/base/default/images/kariboo/kariboo.png +0 -0
- skin/frontend/base/default/images/kariboo/marker_open.png +0 -0
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Download.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Download extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Sets blockgroup for our Kariboo download page.
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
$this->_blockGroup = 'kariboo_shipping';
|
19 |
+
$this->_controller = 'adminhtml_sales_download';
|
20 |
+
$this->_headerText = Mage::helper('kariboo_shipping')->__('Kariboo! Downloads');
|
21 |
+
parent::__construct();
|
22 |
+
$this->_removeButton('add');
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Download/Grid.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Block_Adminhtml_Sales_Download_Grid
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Download_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Constructs the grid and sets basic parameters.
|
18 |
+
*/
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
+
parent::__construct();
|
22 |
+
$this->setId('kariboo_download_grid');
|
23 |
+
$this->setDefaultDir('ASC');
|
24 |
+
$this->setSaveParametersInSession(true);
|
25 |
+
$this->setUseAjax(true);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* prepare collection to use for the grid.
|
30 |
+
*
|
31 |
+
* @return $this
|
32 |
+
*/
|
33 |
+
protected function _prepareCollection()
|
34 |
+
{
|
35 |
+
$collection = new Varien_Data_Collection();
|
36 |
+
|
37 |
+
$pattern = Mage::getBaseDir('media') . "/kariboo/orderlabels/zips/*.zip";
|
38 |
+
$i=1;
|
39 |
+
foreach (array_reverse(glob($pattern),true) as $filename) {
|
40 |
+
$obj = new Varien_Object();
|
41 |
+
$obj->id = $i;
|
42 |
+
$obj->filename = basename($filename);
|
43 |
+
$collection->addItem($obj);
|
44 |
+
$i++;
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->setCollection($collection);
|
48 |
+
parent::_prepareCollection();
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* prepare columns used in the grid.
|
54 |
+
*
|
55 |
+
* @return $this
|
56 |
+
*/
|
57 |
+
protected function _prepareColumns()
|
58 |
+
{
|
59 |
+
|
60 |
+
$this->addColumn('filename', array(
|
61 |
+
'header' => Mage::helper('kariboo_shipping')->__('Filename'),
|
62 |
+
'index' => 'filename',
|
63 |
+
'filter' => false,
|
64 |
+
'sortable' => false
|
65 |
+
));
|
66 |
+
return parent::_prepareColumns();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Gets grid url for callbacks.
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function getGridUrl()
|
75 |
+
{
|
76 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Generate rowurl.
|
81 |
+
*
|
82 |
+
* @param $row
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
public function getRowUrl($row)
|
86 |
+
{
|
87 |
+
return Mage::getBaseUrl("media") . "kariboo/orderlabels/zips/".$row->getFilename();
|
88 |
+
}
|
89 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Sets blockgroup for our Kariboo Orders page.
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
$this->_blockGroup = 'kariboo_shipping';
|
19 |
+
$this->_controller = 'adminhtml_sales_order';
|
20 |
+
$this->_headerText = Mage::helper('kariboo_shipping')->__('Kariboo! Orders');
|
21 |
+
parent::__construct();
|
22 |
+
$this->_removeButton('add');
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Block_Adminhtml_Sales_Order_Grid
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Constructs the grid and sets basic parameters.
|
18 |
+
*/
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
+
parent::__construct();
|
22 |
+
$this->setId('kariboo_shipping_grid');
|
23 |
+
$this->setDefaultSort('created_at');
|
24 |
+
$this->setDefaultDir('DESC');
|
25 |
+
$this->setSaveParametersInSession(true);
|
26 |
+
$this->setUseAjax(true);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* prepare collection to use for the grid.
|
31 |
+
*
|
32 |
+
* @return $this
|
33 |
+
*/
|
34 |
+
protected function _prepareCollection()
|
35 |
+
{
|
36 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
37 |
+
$collection->getSelect()->join(Mage::getConfig()->getTablePrefix() . 'sales_flat_order as sfo', 'sfo.entity_id=`main_table`.entity_id', array(
|
38 |
+
'shipping_method' => 'shipping_method',
|
39 |
+
'total_qty_ordered' => 'ROUND(total_qty_ordered,0)',
|
40 |
+
'kariboo_label_exported' => 'kariboo_label_exported',
|
41 |
+
'kariboo_label_exists' => 'kariboo_label_exists'
|
42 |
+
));
|
43 |
+
$collection->addAttributeToFilter('shipping_method', array('like' => '%kariboo%'));
|
44 |
+
$this->setCollection($collection);
|
45 |
+
parent::_prepareCollection();
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* prepare columns used in the grid.
|
51 |
+
*
|
52 |
+
* @return $this
|
53 |
+
*/
|
54 |
+
protected function _prepareColumns()
|
55 |
+
{
|
56 |
+
$helper = Mage::helper('kariboo_shipping');
|
57 |
+
$currency = (string)Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
|
58 |
+
$this->addColumn('real_order_id', array(
|
59 |
+
'header' => $helper->__('Order #'),
|
60 |
+
'width' => '80px',
|
61 |
+
'type' => 'text',
|
62 |
+
'index' => 'increment_id',
|
63 |
+
'filter_index' => 'main_table.increment_id'
|
64 |
+
));
|
65 |
+
|
66 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
67 |
+
$this->addColumn('store_id', array(
|
68 |
+
'header' => $helper->__('Purchased From (Store)'),
|
69 |
+
'index' => 'store_id',
|
70 |
+
'type' => 'store',
|
71 |
+
'store_view' => true,
|
72 |
+
'display_deleted' => true,
|
73 |
+
'filter_index' => 'sfo.store_id'
|
74 |
+
));
|
75 |
+
}
|
76 |
+
$this->addColumn('created_at', array(
|
77 |
+
'header' => $helper->__('Purchased On'),
|
78 |
+
'index' => 'created_at',
|
79 |
+
'type' => 'datetime',
|
80 |
+
'width' => '100px',
|
81 |
+
'filter_index' => 'main_table.created_at'
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('billing_name', array(
|
85 |
+
'header' => $helper->__('Bill to Name'),
|
86 |
+
'index' => 'billing_name',
|
87 |
+
'filter_index' => 'main_table.billing_name'
|
88 |
+
));
|
89 |
+
$this->addColumn('shipping_name', array(
|
90 |
+
'header' => $helper->__('Ship to Name'),
|
91 |
+
'index' => 'shipping_name',
|
92 |
+
'filter_index' => 'main_table.shipping_name'
|
93 |
+
));
|
94 |
+
$this->addColumn('base_grand_total', array(
|
95 |
+
'header' => $helper->__('G.T. (Base)'),
|
96 |
+
'index' => 'base_grand_total',
|
97 |
+
'type' => 'currency',
|
98 |
+
'currency' => 'base_currency_code',
|
99 |
+
'filter_index' => 'main_table.base_grand_total'
|
100 |
+
));
|
101 |
+
|
102 |
+
$this->addColumn('grand_total', array(
|
103 |
+
'header' => $helper->__('G.T. (Purchased)'),
|
104 |
+
'index' => 'grand_total',
|
105 |
+
'type' => 'currency',
|
106 |
+
'currency' => 'order_currency_code',
|
107 |
+
'filter_index' => 'main_table.grand_total'
|
108 |
+
));
|
109 |
+
|
110 |
+
$this->addColumn('total_qty_ordered', array(
|
111 |
+
'header' => $helper->__('# of Items'),
|
112 |
+
'type' => 'int',
|
113 |
+
'index' => 'total_qty_ordered',
|
114 |
+
'width' => '100px',
|
115 |
+
));
|
116 |
+
|
117 |
+
$this->addColumn('status', array(
|
118 |
+
'header' => $helper->__('Status'),
|
119 |
+
'index' => 'status',
|
120 |
+
'type' => 'options',
|
121 |
+
'width' => '70px',
|
122 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
123 |
+
'filter_index' => 'main_table.status'
|
124 |
+
));
|
125 |
+
$this->addColumn('kariboo_label_exists', array(
|
126 |
+
'header' => $helper->__('Kariboo! Label'),
|
127 |
+
'index' => 'kariboo_label_exists',
|
128 |
+
'type' => 'options',
|
129 |
+
'width' => '100px',
|
130 |
+
'options' => array(
|
131 |
+
0 => 'No',
|
132 |
+
1 => 'Yes',
|
133 |
+
)
|
134 |
+
));
|
135 |
+
$this->addColumn('kariboo_label_exported', array(
|
136 |
+
'header' => $helper->__('Label Downloaded'),
|
137 |
+
'index' => 'kariboo_label_exported',
|
138 |
+
'type' => 'options',
|
139 |
+
'width' => '100px',
|
140 |
+
'options' => array(
|
141 |
+
0 => 'No',
|
142 |
+
1 => 'Yes',
|
143 |
+
)
|
144 |
+
));
|
145 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
146 |
+
$this->addColumn('action',
|
147 |
+
array(
|
148 |
+
'header' => $helper->__('Action'),
|
149 |
+
'width' => '50px',
|
150 |
+
'type' => 'action',
|
151 |
+
'getter' => 'getId',
|
152 |
+
'actions' => array(
|
153 |
+
array(
|
154 |
+
'caption' => $helper->__('View'),
|
155 |
+
'url' => array('base' => '*/sales_order/view', 'params' => array('karibooReturn' => '1')),
|
156 |
+
'field' => 'order_id',
|
157 |
+
)
|
158 |
+
),
|
159 |
+
'filter' => false,
|
160 |
+
'sortable' => false,
|
161 |
+
'index' => 'stores',
|
162 |
+
'is_system' => true,
|
163 |
+
));
|
164 |
+
}
|
165 |
+
$this->addExportType('*/*/exportKaribooOrdersCsv', $helper->__('CSV'));
|
166 |
+
$this->addExportType('*/*/exportKaribooOrdersExcel', $helper->__('Excel XML'));
|
167 |
+
return parent::_prepareColumns();
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Gets grid url for callbacks.
|
172 |
+
*
|
173 |
+
* @return string
|
174 |
+
*/
|
175 |
+
public function getGridUrl()
|
176 |
+
{
|
177 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Prepares Massactions for the grid.
|
182 |
+
*
|
183 |
+
* @return $this
|
184 |
+
*/
|
185 |
+
protected function _prepareMassaction()
|
186 |
+
{
|
187 |
+
$this->setMassactionIdField('`main_table`.entity_id');
|
188 |
+
$this->getMassactionBlock()->setFormFieldName('entity_id');
|
189 |
+
$this->getMassactionBlock()->addItem('generateAndComplete', array(
|
190 |
+
'label' => Mage::helper('kariboo_shipping')->__('Generate Label and Complete'),
|
191 |
+
'url' => $this->getUrl('*/*/generateAndComplete'),
|
192 |
+
'confirm' => Mage::helper('kariboo_shipping')->__('Generating a label can take up to 1 second per label, please be patient during this process. It can take up to maximum 2 minutes. Do you want to continue?')
|
193 |
+
));
|
194 |
+
$this->getMassactionBlock()->addItem('dowloadAllUndownloaded', array(
|
195 |
+
'label' => Mage::helper('kariboo_shipping')->__('Download all undownloaded'),
|
196 |
+
'url' => $this->getUrl('*/*/dowloadAllUndownloaded'),
|
197 |
+
));
|
198 |
+
return $this;
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Generate rowurl.
|
204 |
+
*
|
205 |
+
* @param $row
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
public function getRowUrl($row)
|
209 |
+
{
|
210 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
211 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId(), 'karibooReturn' => '1'));
|
212 |
+
}
|
213 |
+
return false;
|
214 |
+
}
|
215 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/View/Tab/Returnbarcode.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Block_Adminhtml_Sales_Order_View_Tab_Returnbarcode
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Order_View_Tab_Returnbarcode
|
14 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
15 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructs the block
|
19 |
+
*
|
20 |
+
*/
|
21 |
+
public function __construct(){
|
22 |
+
parent::__construct();
|
23 |
+
$this->setId('kariboo_returnbarcode_grid');
|
24 |
+
$this->setDefaultDir('DESC');
|
25 |
+
$this->setSaveParametersInSession(true);
|
26 |
+
$this->setUseAjax(true);
|
27 |
+
$this->_emptyText = Mage::helper('adminhtml')->__('This order did not (yet) generate labels which automatically returned return label barcodes.
|
28 |
+
This feature might not be active for your account. Please refer to the documentation or your Kariboo!
|
29 |
+
accountmanager for more information.');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* prepare collection to use for the grid.
|
34 |
+
*
|
35 |
+
* @return $this
|
36 |
+
*/
|
37 |
+
protected function _prepareCollection()
|
38 |
+
{
|
39 |
+
$collection = Mage::getModel('sales/order_shipment')
|
40 |
+
->getCollection()
|
41 |
+
->addFieldToFilter('order_id',array('eq' => $this->getOrder()->getId()))
|
42 |
+
->addFieldToFilter('kariboo_return_barcode',array('notnull'=>1));
|
43 |
+
$this->setCollection($collection);
|
44 |
+
parent::_prepareCollection();
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
/**
|
48 |
+
* prepare columns used in the grid.
|
49 |
+
*
|
50 |
+
* @return $this
|
51 |
+
*/
|
52 |
+
protected function _prepareColumns()
|
53 |
+
{
|
54 |
+
$helper = Mage::helper('kariboo_shipping');
|
55 |
+
$this->addColumn('increment_id', array(
|
56 |
+
'header' => $helper->__('Shipment'),
|
57 |
+
'type' => 'text',
|
58 |
+
'index' => 'increment_id',
|
59 |
+
'filter_index' => 'main_table.increment_id'
|
60 |
+
));
|
61 |
+
$this->addColumn('returnbarcode', array(
|
62 |
+
'header' => $helper->__('Barcode #'),
|
63 |
+
'type' => 'text',
|
64 |
+
'index' => 'kariboo_return_barcode',
|
65 |
+
'filter_index' => 'main_table.kariboo_return_barcode'
|
66 |
+
));
|
67 |
+
return parent::_prepareColumns();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Gets grid url for callbacks.
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function getGridUrl()
|
76 |
+
{
|
77 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Generate rowurl.
|
82 |
+
*
|
83 |
+
* @param $row
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getRowUrl($row)
|
87 |
+
{
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Returns tab label.
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function getTabLabel() {
|
97 |
+
return Mage::helper('kariboo_shipping')->__('Kariboo! Return Barcodes');
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Returns tab title.
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getTabTitle() {
|
106 |
+
return Mage::helper('kariboo_shipping')->__('Kariboo! Return Barcodes');
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Checks if tab can be shown.
|
111 |
+
*
|
112 |
+
* @return bool
|
113 |
+
*/
|
114 |
+
public function canShowTab() {
|
115 |
+
return true;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Checks if the tab has to be hidden.
|
120 |
+
*
|
121 |
+
* @return bool
|
122 |
+
*/
|
123 |
+
public function isHidden() {
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Returns the order object.
|
129 |
+
*
|
130 |
+
* @return mixed
|
131 |
+
*/
|
132 |
+
public function getOrder(){
|
133 |
+
return Mage::registry('current_order');
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Sales/Order/View/Tab/Returnlabels.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Block_Adminhtml_Sales_Order_View_Tab_Returnlabels
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Block_Adminhtml_Sales_Order_View_Tab_Returnlabels
|
14 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
15 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructs the block
|
19 |
+
*
|
20 |
+
*/
|
21 |
+
protected function _construct()
|
22 |
+
{
|
23 |
+
//parent::__construct();
|
24 |
+
$this->setId('kariboo_returnlabel_grid');
|
25 |
+
$this->setDefaultDir('DESC');
|
26 |
+
$this->setSaveParametersInSession(true);
|
27 |
+
$this->setUseAjax(true);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* prepare collection to use for the grid.
|
32 |
+
*
|
33 |
+
* @return $this
|
34 |
+
*/
|
35 |
+
protected function _prepareCollection()
|
36 |
+
{
|
37 |
+
$collection = Mage::getModel('kariboo_shipping/returnlabel')
|
38 |
+
->getCollection()
|
39 |
+
->addFieldToFilter('order_id',array('eq' => $this->getOrder()->getId()));
|
40 |
+
|
41 |
+
$this->setCollection($collection);
|
42 |
+
parent::_prepareCollection();
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
/**
|
46 |
+
* prepare columns used in the grid.
|
47 |
+
*
|
48 |
+
* @return $this
|
49 |
+
*/
|
50 |
+
protected function _prepareColumns()
|
51 |
+
{
|
52 |
+
$helper = Mage::helper('kariboo_shipping');
|
53 |
+
$this->addColumn('date_created', array(
|
54 |
+
'header' => $helper->__('Date Created'),
|
55 |
+
'type' => 'text',
|
56 |
+
'index' => 'date_created',
|
57 |
+
'filter_index' => 'main_table.date_created'
|
58 |
+
));
|
59 |
+
$this->addColumn('label_barcode', array(
|
60 |
+
'header' => $helper->__('Label Barcode #'),
|
61 |
+
'type' => 'text',
|
62 |
+
'index' => 'label_barcode',
|
63 |
+
'filter_index' => 'main_table.label_barcode'
|
64 |
+
));
|
65 |
+
$this->addColumn('label_pdf_path', array(
|
66 |
+
'header' => $helper->__('Filename'),
|
67 |
+
'index' => 'label_pdf_path',
|
68 |
+
'filter_index' => 'main_table.label_pdf_path'
|
69 |
+
));
|
70 |
+
$this->addColumn('Download', array(
|
71 |
+
'header' => $helper->__('Action'),
|
72 |
+
'type' => 'action',
|
73 |
+
'getter' => 'getLabelPdfPath',
|
74 |
+
'actions' => array(
|
75 |
+
array(
|
76 |
+
'caption' => Mage::helper('catalog')->__('Download'),
|
77 |
+
'url' => Mage::getBaseUrl("media") . "kariboo/returnlabel/" .'$label_pdf_path',
|
78 |
+
'target' => '_blank',
|
79 |
+
)
|
80 |
+
),
|
81 |
+
'filter' => false,
|
82 |
+
'sortable' => false,
|
83 |
+
'index' => 'label_pdf_path',
|
84 |
+
));
|
85 |
+
$this->addColumn('Email', array(
|
86 |
+
'header' => $helper->__('Email'),
|
87 |
+
'type' => 'action',
|
88 |
+
'getter' => 'getId',
|
89 |
+
'actions' => array(
|
90 |
+
array(
|
91 |
+
'caption' => Mage::helper('catalog')->__('Send Email'),
|
92 |
+
'url' => array(
|
93 |
+
'base'=>'*/karibooorder/sendEmail',
|
94 |
+
),
|
95 |
+
'field'=> 'return_id'
|
96 |
+
)
|
97 |
+
),
|
98 |
+
'filter' => false,
|
99 |
+
'sortable' => false,
|
100 |
+
'index' => '',
|
101 |
+
));
|
102 |
+
return parent::_prepareColumns();
|
103 |
+
}
|
104 |
+
|
105 |
+
public function _afterToHtml($html)
|
106 |
+
{
|
107 |
+
$suphtml = "";
|
108 |
+
if(Mage::app()->getRequest()->getParam('karibooReturn') || Mage::getSingleton('core/session')->getKaribooReturn() == 1){
|
109 |
+
if(!Mage::getSingleton('core/session')->getKaribooReturn()){
|
110 |
+
Mage::getSingleton('core/session')->setKaribooReturn(1);
|
111 |
+
}
|
112 |
+
$suphtml = '
|
113 |
+
<script type="text/javascript">
|
114 |
+
document.observe("dom:loaded", function (evt) {
|
115 |
+
$$(".form-buttons .back")[0].observe("click", function () {
|
116 |
+
setLocation("'.Mage::helper("adminhtml")->getUrl("adminhtml/karibooorder/").'");
|
117 |
+
evt.preventDefault();
|
118 |
+
});
|
119 |
+
});
|
120 |
+
</script>';
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
return $suphtml .$html;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Gets grid url for callbacks.
|
129 |
+
*
|
130 |
+
* @return string
|
131 |
+
*/
|
132 |
+
public function getGridUrl()
|
133 |
+
{
|
134 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Generate rowurl.
|
139 |
+
*
|
140 |
+
* @param $row
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
public function getRowUrl($row)
|
144 |
+
{
|
145 |
+
return false;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Returns tab label.
|
150 |
+
*
|
151 |
+
* @return string
|
152 |
+
*/
|
153 |
+
public function getTabLabel() {
|
154 |
+
return Mage::helper('kariboo_shipping')->__('Kariboo! Return Labels');
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Returns tab title.
|
159 |
+
*
|
160 |
+
* @return string
|
161 |
+
*/
|
162 |
+
public function getTabTitle() {
|
163 |
+
return Mage::helper('kariboo_shipping')->__('Kariboo! Return Labels');
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Checks if tab can be shown.
|
168 |
+
*
|
169 |
+
* @return bool
|
170 |
+
*/
|
171 |
+
public function canShowTab() {
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Checks if the tab has to be hidden.
|
177 |
+
*
|
178 |
+
* @return bool
|
179 |
+
*/
|
180 |
+
public function isHidden() {
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Returns the order object.
|
186 |
+
*
|
187 |
+
* @return mixed
|
188 |
+
*/
|
189 |
+
public function getOrder(){
|
190 |
+
return Mage::registry('current_order');
|
191 |
+
}
|
192 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/Shipping/Carrier/Kariboo/Tablerate/Grid.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Block_Adminhtml_Shipping_Carrier_Kariboo_Tablerate_Grid
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Block_Adminhtml_Shipping_Carrier_Kariboo_Tablerate_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Website filter
|
18 |
+
*
|
19 |
+
* @var int
|
20 |
+
*/
|
21 |
+
protected $_websiteId;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Condition filter
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $_conditionName;
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
*
|
33 |
+
*/
|
34 |
+
public function __construct()
|
35 |
+
{
|
36 |
+
parent::__construct();
|
37 |
+
$this->setId('shippingKaribooTablerateGrid');
|
38 |
+
$this->_exportPageSize = 10000;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
43 |
+
*/
|
44 |
+
protected function _prepareCollection()
|
45 |
+
{
|
46 |
+
$collection = Mage::getResourceModel('kariboo_shipping/tablerate_collection');
|
47 |
+
$collection->setConditionFilter($this->getConditionName())
|
48 |
+
->setWebsiteFilter($this->getWebsiteId());
|
49 |
+
|
50 |
+
$this->setCollection($collection);
|
51 |
+
|
52 |
+
return parent::_prepareCollection();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
public function getConditionName()
|
59 |
+
{
|
60 |
+
return $this->_conditionName;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @param $name
|
65 |
+
* @return $this
|
66 |
+
*/
|
67 |
+
public function setConditionName($name)
|
68 |
+
{
|
69 |
+
$this->_conditionName = $name;
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return int|mixed
|
75 |
+
*/
|
76 |
+
public function getWebsiteId()
|
77 |
+
{
|
78 |
+
if (is_null($this->_websiteId)) {
|
79 |
+
$this->_websiteId = Mage::app()->getWebsite()->getId();
|
80 |
+
}
|
81 |
+
return $this->_websiteId;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param $websiteId
|
86 |
+
* @return $this
|
87 |
+
*/
|
88 |
+
public function setWebsiteId($websiteId)
|
89 |
+
{
|
90 |
+
$this->_websiteId = Mage::app()->getWebsite($websiteId)->getId();
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @return $this
|
96 |
+
*/
|
97 |
+
protected function _prepareColumns()
|
98 |
+
{
|
99 |
+
$this->addColumn('dest_country', array(
|
100 |
+
'header' => Mage::helper('kariboo_shipping')->__('Country'),
|
101 |
+
'index' => 'dest_country',
|
102 |
+
'default' => '*',
|
103 |
+
));
|
104 |
+
|
105 |
+
$this->addColumn('dest_region', array(
|
106 |
+
'header' => Mage::helper('kariboo_shipping')->__('Region/State'),
|
107 |
+
'index' => 'dest_region',
|
108 |
+
'default' => '*',
|
109 |
+
));
|
110 |
+
|
111 |
+
$this->addColumn('dest_zip', array(
|
112 |
+
'header' => Mage::helper('kariboo_shipping')->__('Zip/Postal Code'),
|
113 |
+
'index' => 'dest_zip',
|
114 |
+
'default' => '*',
|
115 |
+
));
|
116 |
+
|
117 |
+
$label = Mage::getSingleton('shipping/carrier_tablerate')
|
118 |
+
->getCode('condition_name_short', $this->getConditionName());
|
119 |
+
$this->addColumn('condition_value', array(
|
120 |
+
'header' => $label,
|
121 |
+
'index' => 'condition_value',
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->addColumn('price', array(
|
125 |
+
'header' => Mage::helper('kariboo_shipping')->__('Shipping Price'),
|
126 |
+
'index' => 'price',
|
127 |
+
));
|
128 |
+
|
129 |
+
return parent::_prepareColumns();
|
130 |
+
}
|
131 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Adminhtml/System/Config/Form/Export.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Block_Adminhtml_System_Config_Form_Export
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Block_Adminhtml_System_Config_Form_Export extends Mage_Adminhtml_Block_System_Config_Form_Field implements Varien_Data_Form_Element_Renderer_Interface
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
+
* @return mixed
|
19 |
+
*/
|
20 |
+
public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
21 |
+
{
|
22 |
+
$buttonBlock = Mage::app()->getLayout()->createBlock('adminhtml/widget_button');
|
23 |
+
|
24 |
+
$params = array(
|
25 |
+
'website' => $buttonBlock->getRequest()->getParam('website')
|
26 |
+
);
|
27 |
+
|
28 |
+
$data = array(
|
29 |
+
'label' => Mage::helper('adminhtml')->__('Export CSV'),
|
30 |
+
'onclick' => 'setLocation(\'' . Mage::helper('adminhtml')->getUrl("adminhtml/karibooconfig/exportKaribooTablerates", $params) . 'conditionName/\' + $(\'carriers_kariboo_table_rate_condition\').value + \'/kariboospotstablerates.csv\' )',
|
31 |
+
'class' => '',
|
32 |
+
'id' => 'carriers_kariboo_export'
|
33 |
+
);
|
34 |
+
|
35 |
+
$html = $buttonBlock->setData($data)->toHtml();
|
36 |
+
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Kariboo/Shipping/Block/Carrier/Kariboo.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Block_Carrier_Kariboo
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Block_Carrier_Kariboo extends Mage_Core_Block_Template
|
15 |
+
{
|
16 |
+
public function _construct()
|
17 |
+
{
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getResult(){
|
22 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
23 |
+
if($customerData->getKariboo_shopid() != ""){
|
24 |
+
$oldSpot = Mage::getSingleton('kariboo_shipping/webservice')->getSpot($customerData->getKariboo_shopid());
|
25 |
+
if($oldSpot->Active != false){
|
26 |
+
return $oldSpot->PickUpPoint;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return null;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Kariboo/Shipping/Helper/Data.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Helper_Data
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Logs bugs/info.
|
18 |
+
* Zend_Log::DEBUG = 7
|
19 |
+
* Zend_Log::ERR = 3
|
20 |
+
* Zend_Log::INFO = 6
|
21 |
+
*
|
22 |
+
* @param $message
|
23 |
+
* @param $level
|
24 |
+
*/
|
25 |
+
public function log($message, $level)
|
26 |
+
{
|
27 |
+
$allowedLogLevel = Mage::getStoreConfig('shipping/kariboo/log_level');
|
28 |
+
if ($level <= $allowedLogLevel) {
|
29 |
+
Mage::log($message, $level, 'kariboo.log');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Gets all spots from kariboo webservice based on shipping address and selected filter.
|
35 |
+
*
|
36 |
+
* @return mixed
|
37 |
+
*/
|
38 |
+
public function getKaribooSpots()
|
39 |
+
{
|
40 |
+
$geocode = Mage::getModel("kariboo_shipping/shipping_geocode")->setAddress(Mage::getModel('checkout/cart')->getQuote()->getShippingAddress())->makeCall();
|
41 |
+
if ($geocode) {
|
42 |
+
$param_openafter = Mage::app()->getRequest()->getPost("filter_openafter16") == "on" ? 'true' : '';
|
43 |
+
$param_opensunday = Mage::app()->getRequest()->getPost("filter_openonsunday") == "on" ? 'true' : '';
|
44 |
+
$param_postalcode = Mage::app()->getRequest()->getPost("filter_postalcode");
|
45 |
+
return Mage::getSingleton('kariboo_shipping/webservice')->getKaribooSpots($geocode->getLat(), $geocode->getLng(), $param_postalcode, $param_opensunday, $param_openafter);
|
46 |
+
} else {
|
47 |
+
return array(Mage::helper('kariboo_shipping')->__("Sorry, something went wrong processing your shipping address. Your address was not recognised. Please correct any errors in your shipping address and try again."));
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
*
|
53 |
+
* Creates new IO object and inputs base 64 pdf string fetched from webservice.
|
54 |
+
*
|
55 |
+
* @param $pdfString
|
56 |
+
* @param $folder
|
57 |
+
* @param $name
|
58 |
+
*/
|
59 |
+
public function generatePdfAndSave($pdfString, $folder, $name)
|
60 |
+
{
|
61 |
+
$hash = bin2hex(mcrypt_create_iv(5, MCRYPT_DEV_URANDOM));;
|
62 |
+
$io = new Varien_Io_File();
|
63 |
+
$io->setAllowCreateFolders(true);
|
64 |
+
$io->open(array('path' => Mage::getBaseDir('media') . "/kariboo/" . $folder));
|
65 |
+
$io->streamOpen($name . "-" . $hash . '.pdf', 'w+');
|
66 |
+
$io->streamLock(true);
|
67 |
+
$io->streamWrite($pdfString);
|
68 |
+
$io->streamUnlock();
|
69 |
+
$io->streamClose();
|
70 |
+
return $name . "-" . $hash;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param $shipment
|
76 |
+
* @return int
|
77 |
+
*/
|
78 |
+
public function calculateTotalShippingWeight($shipment)
|
79 |
+
{
|
80 |
+
$weight = 0;
|
81 |
+
$shipmentItems = $shipment->getAllItems();
|
82 |
+
foreach ($shipmentItems as $shipmentItem) {
|
83 |
+
$orderItem = $shipmentItem->getOrderItem();
|
84 |
+
if (!$orderItem->getParentItemId()) {
|
85 |
+
$weight = $weight + ($shipmentItem->getWeight() * $shipmentItem->getQty());
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
return $weight;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Returns the language based on storeId.
|
94 |
+
*
|
95 |
+
* @param $storeId
|
96 |
+
* @return string language
|
97 |
+
*/
|
98 |
+
public function getLanguageFromStore($storeId)
|
99 |
+
{
|
100 |
+
$locale = Mage::app()->getStore($storeId)->getConfig('general/locale/code');
|
101 |
+
$localeCode = explode('_', $locale);
|
102 |
+
return $localeCode[0];
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param $shipments
|
108 |
+
* @return mixed
|
109 |
+
*/
|
110 |
+
public function processAllShipmentItems($shipments)
|
111 |
+
{
|
112 |
+
$productsInfoArray['product'] = array();
|
113 |
+
foreach ($shipments as $shipment) {
|
114 |
+
$shipmentItems = $shipment->getItemsCollection();
|
115 |
+
foreach ($shipmentItems as $shipmentItem) {
|
116 |
+
$orderItem = $shipmentItem->getOrderItem();
|
117 |
+
if (!$orderItem->getParentItemId()) {
|
118 |
+
$productsInfoArray['product'][] = array('Id' => $shipmentItem->getProductId(), 'Name' => $shipmentItem->getName(), 'Quantity' => $shipmentItem->getQty());
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
return $productsInfoArray;
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @param $shipments
|
128 |
+
* @return int
|
129 |
+
*/
|
130 |
+
public function processShipmentWeight($shipments)
|
131 |
+
{
|
132 |
+
$weightPerShipmentArray['Shipment'] = array();
|
133 |
+
foreach ($shipments as $shipment) {
|
134 |
+
if (Mage::getStoreConfig('shipping/kariboo_weight_unit') == "") {
|
135 |
+
$weight = $shipment->getTotalWeight() * 100;
|
136 |
+
} else {
|
137 |
+
$weight = $shipment->getTotalWeight() * Mage::getStoreConfig('shipping/kariboo_weight_unit');
|
138 |
+
}
|
139 |
+
$weightPerShipmentArray['Shipment'][] = array('Weight' => $weight);
|
140 |
+
}
|
141 |
+
|
142 |
+
return $weightPerShipmentArray;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* @return array
|
147 |
+
*/
|
148 |
+
public function getJsDaysArray()
|
149 |
+
{
|
150 |
+
$jsDaysArray = array("LU" => $this->__("Ma"), "MA" => $this->__("Di"), "ME" => $this->__("Wo"), "JE" => $this->__("Do"), "VE" => $this->__("Vr"), "SA" => $this->__("Za"), "DI" => $this->__("Zo"));
|
151 |
+
return $jsDaysArray;
|
152 |
+
}
|
153 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Adminhtml/Kariboogrid.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Kariboo_Shipping_Model_Adminhtml_Kariboogrid
|
5 |
+
*/
|
6 |
+
class Kariboo_Shipping_Model_Adminhtml_Kariboogrid extends Mage_Core_Model_Abstract
|
7 |
+
{
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @param $order
|
11 |
+
* @return bool
|
12 |
+
*/
|
13 |
+
public function generateAndCompleteOrder($order)
|
14 |
+
{
|
15 |
+
$shipmentCollection = $order->getShipmentsCollection();
|
16 |
+
if ($shipmentCollection->count() > 0 && !$order->getKaribooLabelExists()) {
|
17 |
+
return $this->_processAvailableShipments($order);
|
18 |
+
} elseif (!$order->getKaribooLabelExists()) {
|
19 |
+
return $this->_createKaribooShipment($order);
|
20 |
+
} else {
|
21 |
+
$message = Mage::helper('kariboo_shipping')->__("The order with id %s is not ready to be shipped or has already been shipped.", $order->getIncrementId());
|
22 |
+
Mage::getSingleton('core/session')->addNotice($message);
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param $order
|
29 |
+
* @return bool
|
30 |
+
*/
|
31 |
+
protected function _createKaribooShipment($order)
|
32 |
+
{
|
33 |
+
$shipment = $order->prepareShipment();
|
34 |
+
$shipment->register();
|
35 |
+
$weight = Mage::helper('kariboo_shipping')->calculateTotalShippingWeight($shipment);
|
36 |
+
$shipment->setTotalWeight($weight);
|
37 |
+
$labelArray = $this->_generateLabelAndReturnLabel($order, array($shipment), 1);
|
38 |
+
$pdfBaseName = $labelArray[0]['pdfBasename'];
|
39 |
+
$barCode = $labelArray[0]['barcode'];
|
40 |
+
if (!$pdfBaseName) {
|
41 |
+
$message = Mage::helper('kariboo_shipping')->__("Something went wrong while processing order %s, please check your error logs.", $order->getIncrementId());
|
42 |
+
Mage::getSingleton('core/session')->addError($message);
|
43 |
+
return false;
|
44 |
+
} else {
|
45 |
+
$explodeForCarrier = explode('_', $order->getShippingMethod(), 3);
|
46 |
+
if (array_key_exists('returnBarcode', $labelArray[0])) {
|
47 |
+
$shipment->setKaribooReturnBarcode($labelArray[0]['returnBarcode']);
|
48 |
+
}
|
49 |
+
$shipment->setKaribooLabelPath($pdfBaseName . ".pdf");
|
50 |
+
$order->setIsInProcess(true);
|
51 |
+
$order->addStatusHistoryComment(Mage::helper('kariboo_shipping')->__('Shipped with Kariboo generateLabelAndComplete'), true);
|
52 |
+
$order->setKaribooLabelExists(1);
|
53 |
+
$tracker = Mage::getModel('sales/order_shipment_track')
|
54 |
+
->setShipment($shipment)
|
55 |
+
->setData('title', 'Kariboo')
|
56 |
+
->setData('number', $barCode)
|
57 |
+
->setData('carrier_code', $explodeForCarrier[0])
|
58 |
+
->setData('order_id', $shipment->getData('order_id'));
|
59 |
+
try {
|
60 |
+
//save all objects in 1 transaction
|
61 |
+
Mage::getModel('core/resource_transaction')
|
62 |
+
->addObject($shipment)
|
63 |
+
->addObject($shipment->getOrder())
|
64 |
+
->addObject($tracker)
|
65 |
+
->save();
|
66 |
+
} catch (Exception $e) {
|
67 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
68 |
+
}
|
69 |
+
return 1;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param $order
|
76 |
+
* @return bool
|
77 |
+
*/
|
78 |
+
protected function _processAvailableShipments($order)
|
79 |
+
{
|
80 |
+
$trackCollection = Mage::getResourceModel('sales/order_shipment_track_collection')
|
81 |
+
->addFieldToFilter('order_id', $order->getId())
|
82 |
+
->addFieldToFilter('carrier_code', 'kariboo');
|
83 |
+
if ($trackCollection->count() > 0) {
|
84 |
+
$counter = 0;
|
85 |
+
$shipmentsArray = array();
|
86 |
+
foreach ($trackCollection as $tracker) {
|
87 |
+
if (!array_key_exists($tracker->getParentId(), $shipmentsArray)) {
|
88 |
+
$shipmentsArray[$tracker->getParentId()] = Mage::getResourceModel('sales/order_shipment_collection')->addFieldToFilter('entity_id', $tracker->getParentId())->getFirstItem();
|
89 |
+
}
|
90 |
+
}
|
91 |
+
$labelArray = $this->_generateLabelAndReturnLabel($order, $shipmentsArray, $trackCollection->count());
|
92 |
+
foreach ($trackCollection as $tracker) {
|
93 |
+
$shipment = $shipmentsArray[$tracker->getParentId()];
|
94 |
+
$pdfBaseName = $labelArray[$counter]['pdfBasename'];
|
95 |
+
$barCode = $labelArray[$counter]['barcode'];
|
96 |
+
if (!$pdfBaseName) {
|
97 |
+
$message = Mage::helper('kariboo_shipping')->__("Something went wrong while processing order %s, please check your error logs.", $order->getIncrementId());
|
98 |
+
Mage::getSingleton('core/session')->addError($message);
|
99 |
+
continue;
|
100 |
+
} else {
|
101 |
+
try {
|
102 |
+
if (array_key_exists('returnBarcode', $labelArray[$counter])) {
|
103 |
+
$shipment->setKaribooReturnBarcode($labelArray[$counter]['returnBarcode']);
|
104 |
+
}
|
105 |
+
$shipment->setKaribooLabelPath($pdfBaseName . ".pdf");
|
106 |
+
$tracker->setData('number', $barCode);
|
107 |
+
Mage::getModel('core/resource_transaction')
|
108 |
+
->addObject($shipment)
|
109 |
+
->addObject($tracker)
|
110 |
+
->save();
|
111 |
+
} catch (Exception $e) {
|
112 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
113 |
+
continue;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
$counter++;
|
117 |
+
}
|
118 |
+
$order->addStatusHistoryComment(Mage::helper('kariboo_shipping')->__('Shipped with Kariboo generateLabelAndComplete'), true);
|
119 |
+
$order->setKaribooLabelExists(1);
|
120 |
+
$order->save();
|
121 |
+
return $counter;
|
122 |
+
} else {
|
123 |
+
$message = Mage::helper('kariboo_shipping')->__("The order with id %s only has non-Kariboo! shipments.", $order->getIncrementId());
|
124 |
+
Mage::getSingleton('core/session')->addNotice($message);
|
125 |
+
return false;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param $order
|
132 |
+
* @param $shipment
|
133 |
+
* @param $count
|
134 |
+
* @return array|bool
|
135 |
+
*/
|
136 |
+
protected function _generateLabelAndReturnLabel($order, $shipment, $count)
|
137 |
+
{
|
138 |
+
$labelWebserviceCallback = Mage::getSingleton('kariboo_shipping/webservice')->getPickUpLabel($order, $shipment, $count);
|
139 |
+
if ($labelWebserviceCallback) {
|
140 |
+
$returnArray = array();
|
141 |
+
$pdfLabel = $labelWebserviceCallback->LabelPdfs->LabelPdf;
|
142 |
+
$counter = 0;
|
143 |
+
foreach ($pdfLabel as $shipmentPdflabel) {
|
144 |
+
$returnArray[$counter] = array('barcode' => $shipmentPdflabel->Barcode, 'pdfBasename' => Mage::helper('kariboo_shipping')->generatePdfAndSave($shipmentPdflabel->label, 'orderlabels', $order->getIncrementId() . "-" . $shipmentPdflabel->Barcode));
|
145 |
+
if (isset($shipmentPdflabel->BarcodeReturn)) {
|
146 |
+
$returnArray[$counter]['returnBarcode'] = $shipmentPdflabel->BarcodeReturn;
|
147 |
+
}
|
148 |
+
$counter++;
|
149 |
+
}
|
150 |
+
return $returnArray;
|
151 |
+
} else {
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Processes the undownloadable labels. (set mark and zip)
|
158 |
+
*
|
159 |
+
* @param $orderIds
|
160 |
+
* @return bool|string
|
161 |
+
*/
|
162 |
+
public function processUndownloadedLabels($orderIds)
|
163 |
+
{
|
164 |
+
$labelPdfArray = array();
|
165 |
+
$i = 0;
|
166 |
+
foreach ($orderIds as $orderId) {
|
167 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
168 |
+
$exported = false;
|
169 |
+
if (!$order->getKaribooLabelExported()) {
|
170 |
+
$shippingCollection = Mage::getResourceModel('sales/order_shipment_collection')
|
171 |
+
->setOrderFilter($order)
|
172 |
+
->load();
|
173 |
+
if (count($shippingCollection)) {
|
174 |
+
foreach ($shippingCollection as $shipment) {
|
175 |
+
if ($shipment->getKaribooLabelPath() != "" && file_exists(Mage::getBaseDir('media') . "/kariboo/orderlabels/" . $shipment->getKaribooLabelPath()) && $shipment->getKaribooLabelPath() != ".pdf") {
|
176 |
+
$labelPdfArray[] = Mage::getBaseDir('media') . "/kariboo/orderlabels/" . $shipment->getKaribooLabelPath();
|
177 |
+
$exported = true;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
if ($exported) {
|
181 |
+
$order->setKaribooLabelExported(1)->save();
|
182 |
+
}
|
183 |
+
}
|
184 |
+
} else {
|
185 |
+
$i++;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
if (!count($labelPdfArray)) {
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
if ($i > 0) {
|
192 |
+
$message = Mage::helper('kariboo_shipping')->__('%s orders already had downloaded labels.', $i);
|
193 |
+
Mage::getSingleton('core/session')->addNotice($message);
|
194 |
+
}
|
195 |
+
$generated_name = date("Y_m_d_H_i_s_u") . "_undownloaded.zip";
|
196 |
+
if (!is_dir(Mage::getBaseDir('media') . "/kariboo/orderlabels/zips/")) {
|
197 |
+
mkdir(Mage::getBaseDir('media') . "/kariboo/orderlabels/zips/");
|
198 |
+
}
|
199 |
+
return $this->_zipLabelPdfArray($labelPdfArray, $generated_name, true);
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Zips the labels.
|
204 |
+
*
|
205 |
+
* @param array $files
|
206 |
+
* @param string $generated_name
|
207 |
+
* @param bool $overwrite
|
208 |
+
* @return bool|string
|
209 |
+
*/
|
210 |
+
protected function _zipLabelPdfArray($files = array(), $generated_name = '', $overwrite = false)
|
211 |
+
{
|
212 |
+
$destination = Mage::getBaseDir('media') . "/kariboo/orderlabels/zips/" . $generated_name;
|
213 |
+
if (file_exists($destination) && !$overwrite) {
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
$valid_files = array();
|
217 |
+
if (is_array($files)) {
|
218 |
+
foreach ($files as $file) {
|
219 |
+
if (file_exists($file)) {
|
220 |
+
$valid_files[] = $file;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
if (count($valid_files)) {
|
225 |
+
$zip = new ZipArchive();
|
226 |
+
if ($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
foreach ($valid_files as $file) {
|
230 |
+
$zip->addFile($file, basename($file));
|
231 |
+
}
|
232 |
+
$zip->close();
|
233 |
+
|
234 |
+
return $generated_name;
|
235 |
+
} else {
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Cron.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kariboo_Shipping_Model_Cron
|
4 |
+
{
|
5 |
+
public function reloadTrackingStatus()
|
6 |
+
{
|
7 |
+
Mage::helper('kariboo_shipping')->log('T&T Cron – START', Zend_Log::INFO);
|
8 |
+
|
9 |
+
$updateArray = array();
|
10 |
+
$objectsToUpdate = array();
|
11 |
+
$result = Mage::getResourceModel('sales/order_shipment_track_collection')
|
12 |
+
->addAttributeToFilter("carrier_code", "kariboo")
|
13 |
+
->addFieldToFilter("kariboo_status", array(array('neq' => 68), array('neq' => 148)))
|
14 |
+
->addAttributeToSelect("*")
|
15 |
+
->join(array("order" => "sales/order"), " main_table.order_id=order.entity_id", array("store_id" => "store_id"));
|
16 |
+
foreach ($result as $value) {
|
17 |
+
$updateArray[] = array(
|
18 |
+
"barcode" => $value->getNumber(),
|
19 |
+
"language" => Mage::helper('kariboo_shipping')->getLanguageFromStore($value->getStoreId())
|
20 |
+
);
|
21 |
+
$value->unsOrder();
|
22 |
+
$objectsToUpdate[$value->getNumber()] = $value;
|
23 |
+
}
|
24 |
+
unset($result);
|
25 |
+
|
26 |
+
$wscall = Mage::getSingleton("kariboo_shipping/webservice")->getTracking($updateArray, $objectsToUpdate);
|
27 |
+
|
28 |
+
if ($wscall) {
|
29 |
+
Mage::helper("kariboo_shipping")->log("Tracking: " . count($updateArray) . " trackingnumbers updated", Zend_Log::DEBUG);
|
30 |
+
} else {
|
31 |
+
Mage::helper("kariboo_shipping")->log("Tracking: " . count($updateArray) . " trackingnumbers not updated", Zend_Log::WARN);
|
32 |
+
}
|
33 |
+
|
34 |
+
Mage::helper('kariboo_shipping')->log('T&T Cron - END', Zend_Log::INFO);
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Observer.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Model_Observer
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Model_Observer
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Sets generate return label button on order detail view in the admin.
|
18 |
+
* Sets download kariboo button on shipment order detail.
|
19 |
+
*
|
20 |
+
* @param $observer
|
21 |
+
*/
|
22 |
+
public function core_block_abstract_to_html_before($observer)
|
23 |
+
{
|
24 |
+
$block = $observer->getBlock();
|
25 |
+
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View && $block->getRequest()->getControllerName() == 'sales_order') {
|
26 |
+
$orderId = Mage::app()->getRequest()->getParam('order_id');
|
27 |
+
$block->addButton('print_retour_label', array(
|
28 |
+
'label' => Mage::helper('kariboo_shipping')->__('Kariboo! Return Label'),
|
29 |
+
'onclick' => 'setLocation(\'' . Mage::helper("adminhtml")->getUrl('adminhtml/karibooorder/generateReturnLabel/order_id/' . $orderId) . '\')',
|
30 |
+
'class' => 'go'
|
31 |
+
));
|
32 |
+
|
33 |
+
}
|
34 |
+
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View && $block->getRequest()->getControllerName() == "sales_order_shipment") {
|
35 |
+
$shipment = Mage::registry('current_shipment');
|
36 |
+
$shipmentId = $shipment->getId();
|
37 |
+
$order = Mage::getModel('sales/order')->load($shipment->getOrderId());
|
38 |
+
if (strpos($order->getShippingMethod(), 'kariboo') !== false) {
|
39 |
+
$block->addButton('download_kariboo_label', array(
|
40 |
+
'label' => Mage::helper('kariboo_shipping')->__('Download Kariboo! Label'),
|
41 |
+
'onclick' => 'setLocation(\'' . Mage::helper("adminhtml")->getUrl('adminhtml/karibooorder/downloadKaribooLabel/shipment_id/' . $shipmentId) . '\')',
|
42 |
+
'class' => 'scalable save'
|
43 |
+
));
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Calculate and set the weight on the shipping to pass it to the webservice after a standard shipment save.
|
50 |
+
*
|
51 |
+
* @param $observer
|
52 |
+
*/
|
53 |
+
public function sales_order_shipment_save_before($observer)
|
54 |
+
{
|
55 |
+
$shipment = $observer->getEvent()->getShipment();
|
56 |
+
if (!$shipment->hasId() && !$shipment->getTotalWeight()) {
|
57 |
+
$weight = Mage::helper('kariboo_shipping')->calculateTotalShippingWeight($shipment);
|
58 |
+
$shipment->setTotalWeight($weight);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Observes html load, this will add html to the Kariboo shipping method.
|
64 |
+
*
|
65 |
+
* @param $observer
|
66 |
+
* @return $this
|
67 |
+
*/
|
68 |
+
public function core_block_abstract_to_html_after($observer)
|
69 |
+
{
|
70 |
+
if ($observer->getBlock() instanceof Mage_Checkout_Block_Onepage_Shipping_Method_Available) {
|
71 |
+
$availablerates = $observer->getBlock()->getShippingRates();
|
72 |
+
if (array_key_exists("kariboo", $availablerates)) {
|
73 |
+
//get HTML
|
74 |
+
$html = $observer->getTransport()->getHtml();
|
75 |
+
//intercept html and append block
|
76 |
+
$html .= Mage::app()->getLayout()->createBlock("kariboo_shipping/carrier_kariboo")->setTemplate("kariboo/shipping/kariboo_checkout_append.phtml")->toHtml();
|
77 |
+
//set HTML
|
78 |
+
$observer->getTransport()->setHtml($html);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
if ($observer->getBlock() instanceof Mage_Checkout_Block_Onepage_Payment_Methods) {
|
82 |
+
if (Mage::getSingleton('checkout/session')->getKaribooReloadProgress()) {
|
83 |
+
$html = $observer->getTransport()->getHtml();
|
84 |
+
$html .= "<script>checkout.reloadProgressBlock('shipping');</script>";
|
85 |
+
$observer->getTransport()->setHtml($html);
|
86 |
+
Mage::getSingleton('checkout/session')->unsKaribooReloadProgress();
|
87 |
+
}
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Observe shipping address and create alternative shipping address in the session. (we select only the necessary data to keep the object small)
|
94 |
+
*
|
95 |
+
* @param $observer
|
96 |
+
* @return $this
|
97 |
+
*/
|
98 |
+
public function controller_action_postdispatch_checkout_onepage_saveAddress($observer)
|
99 |
+
{
|
100 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
101 |
+
$shippingAddress = $checkoutSession->getQuote()->getShippingAddress();
|
102 |
+
if (((bool)$shippingAddress->getSameAsBilling() && $observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveBilling") ||
|
103 |
+
$observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveShipping"
|
104 |
+
) {
|
105 |
+
$karibooOriginalShippingAddress = new Varien_Object();
|
106 |
+
$karibooOriginalShippingAddress
|
107 |
+
->setFirstname($shippingAddress->getFirstname())
|
108 |
+
->setLastname($shippingAddress->getLastname())
|
109 |
+
->setCompany($shippingAddress->getCompany())
|
110 |
+
->setStreet($shippingAddress->getStreet(1) . " " . $shippingAddress->getStreet(2))
|
111 |
+
->setCity($shippingAddress->getCity())
|
112 |
+
->setRegion($shippingAddress->getRegion())
|
113 |
+
->setPostcode($shippingAddress->getPostcode())
|
114 |
+
->setCountryId($shippingAddress->getCountryId())
|
115 |
+
->setTelephone($shippingAddress->getTelephone())
|
116 |
+
->setFax($shippingAddress->getFax());
|
117 |
+
if($shippingAddress->getAddressId() != "" && $shippingAddress->hasAddressId()){
|
118 |
+
$karibooOriginalShippingAddress->setAddressId($shippingAddress->getAddressId());
|
119 |
+
}
|
120 |
+
$checkoutSession->setKaribooOriginalShippingAddress($karibooOriginalShippingAddress);
|
121 |
+
}
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Change shipping address if needed, save previous shipping method, add progress bar reload flag.
|
127 |
+
*
|
128 |
+
* @param $observer
|
129 |
+
* @return $this
|
130 |
+
*/
|
131 |
+
public function checkout_controller_onepage_save_shipping_method($observer)
|
132 |
+
{
|
133 |
+
//init all neseccary data
|
134 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
135 |
+
$quote = $checkoutSession->getQuote();
|
136 |
+
$address = $quote->getShippingAddress();
|
137 |
+
|
138 |
+
//get the kariboo data
|
139 |
+
$params = Mage::app()->getRequest()->getPost();
|
140 |
+
|
141 |
+
//if all necessary fields are filled in.
|
142 |
+
if ($address->getShippingMethod() == "kariboo_kariboo" && $params["kariboo"]["spotid"] && $params["kariboo"]["name"] && $params["kariboo"]["street"]
|
143 |
+
&& $params["kariboo"]["city"] && $params["kariboo"]["postcode"]
|
144 |
+
) {
|
145 |
+
|
146 |
+
//set the spot as chosen by the customer
|
147 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
148 |
+
Mage::getSingleton('customer/session')
|
149 |
+
->getCustomer()
|
150 |
+
->setKariboo_shopid($params["kariboo"]["spotid"])
|
151 |
+
->save();
|
152 |
+
}
|
153 |
+
//set it in the quote
|
154 |
+
Mage::getSingleton('checkout/session')->getQuote()->setKariboo_spotid($params["kariboo"]["spotid"]);
|
155 |
+
|
156 |
+
//now set the current address to the kariboo!-spot and add a flag for progress reload
|
157 |
+
$address->unsetAddressId()
|
158 |
+
->setTelephone("00 000 00 00")
|
159 |
+
->setFax('')
|
160 |
+
->setSaveInAddressBook(0)
|
161 |
+
->setFirstname('Kariboo!-spot: ')
|
162 |
+
->setLastname($params["kariboo"]["name"])
|
163 |
+
->setStreet($params["kariboo"]["street"])
|
164 |
+
->setCity($params["kariboo"]["city"])
|
165 |
+
->setPostcode($params["kariboo"]["postcode"])
|
166 |
+
->setCod($params["kariboo"]["cod"])
|
167 |
+
->save();
|
168 |
+
$checkoutSession->setKaribooReloadProgress(true);
|
169 |
+
} elseif ($checkoutSession->getAlternativeShippingMethod() == "kariboo_kariboo") {
|
170 |
+
|
171 |
+
//if prev shippingmethod was kariboo, change shipping address
|
172 |
+
|
173 |
+
$mergedShippingAddressData = array_merge($address->getData(), $checkoutSession->getKaribooOriginalShippingAddress()->getData());
|
174 |
+
$address->setData($mergedShippingAddressData);
|
175 |
+
$checkoutSession->setKaribooReloadProgress(true);
|
176 |
+
|
177 |
+
}
|
178 |
+
else{
|
179 |
+
|
180 |
+
//reload is not needed
|
181 |
+
|
182 |
+
$checkoutSession->setKaribooReloadProgress(false);
|
183 |
+
}
|
184 |
+
|
185 |
+
//set this so we know what the previous method was.
|
186 |
+
$checkoutSession->setAlternativeShippingMethod($address->getShippingMethod());
|
187 |
+
return $this;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @param $observer
|
192 |
+
*/
|
193 |
+
public function checkout_submit_all_after($observer){
|
194 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
195 |
+
$quote = $checkoutSession->getQuote();
|
196 |
+
if($quote->getShippingAddress()->getShippingMethod()){
|
197 |
+
$observer->getEvent()->getOrder()
|
198 |
+
->setKaribooOriginalShippingaddress(json_encode(Mage::getSingleton('checkout/session')->getKaribooOriginalShippingAddress()->getData()))
|
199 |
+
->setKariboo_spotid($quote->getKariboo_spotid())
|
200 |
+
->save();
|
201 |
+
}
|
202 |
+
|
203 |
+
//remember the spot
|
204 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
205 |
+
Mage::getSingleton('customer/session')
|
206 |
+
->getCustomer()
|
207 |
+
->setKariboo_shopid($quote->getKariboo_spotid())
|
208 |
+
->save();
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Payment/Kariboocod.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Model_Method_Kariboocod
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Model_Payment_Kariboocod extends Mage_Payment_Model_Method_Abstract
|
15 |
+
{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Payment method code
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $_code = 'kariboocod';
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function isAvailable($quote = null)
|
30 |
+
{
|
31 |
+
$isActive = (bool)(int)$this->getConfigData('active', $quote ? $quote->getStoreId() : null);
|
32 |
+
$shippingaddress = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
|
33 |
+
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
34 |
+
$grandtotal = round($totals["grand_total"]->getValue());
|
35 |
+
|
36 |
+
$karibooShippingMethodSelected = (int)(bool) ($shippingaddress->getShippingMethod() == "kariboo_kariboo");
|
37 |
+
$karibooSpotAllowsCod = (int)(bool) ($shippingaddress->getCod() === "true" || $shippingaddress->getCod() === null);
|
38 |
+
$grandTotalSmallerOrEquals499 = (int)(bool) ($grandtotal <= 499);
|
39 |
+
|
40 |
+
// Shipping method is kariboo_kariboo
|
41 |
+
// Payment method is active
|
42 |
+
// The spot must support COD
|
43 |
+
// The grandtotal must be lower or equal to 499
|
44 |
+
if($karibooShippingMethodSelected && $isActive && $karibooSpotAllowsCod && $grandTotalSmallerOrEquals499){
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
|
48 |
+
Mage::helper('kariboo_shipping')->log('Not showing Kariboo! COD... karibooselected=' .
|
49 |
+
$karibooShippingMethodSelected .
|
50 |
+
', karibooSpotAllowsCod=' . $karibooSpotAllowsCod .
|
51 |
+
', grandTotalSmallerOrEquals499=' . $grandTotalSmallerOrEquals499, Zend_Log::INFO);
|
52 |
+
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Resource/Returnlabel.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_Resource_Returnlabel
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_Resource_Returnlabel extends Mage_Core_Model_Mysql4_Abstract{
|
14 |
+
/**
|
15 |
+
* Sets model primary key.
|
16 |
+
*/
|
17 |
+
protected function _construct()
|
18 |
+
{
|
19 |
+
$this->_init("kariboo_shipping/returnlabel", "label_id");
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Resource/Returnlabel/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_Mysql4_Returnlabel_Collection
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_Resource_Returnlabel_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Initialises the model, the abstract file will render a collection from it.
|
17 |
+
*/
|
18 |
+
public function _construct()
|
19 |
+
{
|
20 |
+
$this->_init("kariboo_shipping/returnlabel");
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Resource/Tablerate.php
ADDED
@@ -0,0 +1,434 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PHPro
|
5 |
+
*
|
6 |
+
* @package Kariboo
|
7 |
+
* @subpackage Shipping
|
8 |
+
* @category Checkout
|
9 |
+
* @author PHPro (info@phpro.be)
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class Kariboo_Shipping_Model_Resource_TableRate
|
14 |
+
*/
|
15 |
+
class Kariboo_Shipping_Model_Resource_Tablerate extends Mage_Core_Model_Mysql4_Abstract{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Website Id selected in scope.
|
19 |
+
*
|
20 |
+
* @var int
|
21 |
+
*/
|
22 |
+
protected $_importWebsiteId = 0;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Array to fill with possible errors.
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
protected $_importErrors = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Number of rows imported.
|
33 |
+
*
|
34 |
+
* @var int
|
35 |
+
*/
|
36 |
+
protected $_importedRows = 0;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Conversion.
|
40 |
+
*
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
protected $_importUniqueHash = array();
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Conversion.
|
47 |
+
*
|
48 |
+
* @var
|
49 |
+
*/
|
50 |
+
protected $_importIso2Countries;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Conversion.
|
54 |
+
*
|
55 |
+
* @var
|
56 |
+
*/
|
57 |
+
protected $_importIso3Countries;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Regions to import.
|
61 |
+
*
|
62 |
+
* @var
|
63 |
+
*/
|
64 |
+
protected $_importRegions;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Condition name selected in sysconfig.
|
68 |
+
*
|
69 |
+
* @var
|
70 |
+
*/
|
71 |
+
protected $_importConditionName;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Full name of condition selected in sysconfig.
|
75 |
+
*
|
76 |
+
* @var array
|
77 |
+
*/
|
78 |
+
protected $_conditionFullNames = array();
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Initialise the model.
|
83 |
+
*/
|
84 |
+
protected function _construct()
|
85 |
+
{
|
86 |
+
$this->_init("kariboo_shipping/tablerate", "pk");
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Fetch rate from the table for selected shipping address.
|
92 |
+
*
|
93 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
public function getRate(Mage_Shipping_Model_Rate_Request $request)
|
97 |
+
{
|
98 |
+
$adapter = $this->_getReadAdapter();
|
99 |
+
$bind = array(
|
100 |
+
':website_id' => (int) $request->getWebsiteId(),
|
101 |
+
':country_id' => $request->getDestCountryId(),
|
102 |
+
':region_id' => (int) $request->getDestRegionId(),
|
103 |
+
':postcode' => $request->getDestPostcode()
|
104 |
+
);
|
105 |
+
$select = $adapter->select()
|
106 |
+
->from($this->getMainTable())
|
107 |
+
->where('website_id = :website_id')
|
108 |
+
->order(array('dest_country_id DESC', 'dest_region_id DESC', 'dest_zip DESC', 'condition_value DESC'))
|
109 |
+
->limit(1);
|
110 |
+
|
111 |
+
// Render destination condition
|
112 |
+
$orWhere = '(' . implode(') OR (', array(
|
113 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
|
114 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''",
|
115 |
+
|
116 |
+
// Handle asterix in dest_zip field
|
117 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = '*'",
|
118 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'",
|
119 |
+
"dest_country_id = '0' AND dest_region_id = :region_id AND dest_zip = '*'",
|
120 |
+
"dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = '*'",
|
121 |
+
|
122 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''",
|
123 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
|
124 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'",
|
125 |
+
)) . ')';
|
126 |
+
$select->where($orWhere);
|
127 |
+
|
128 |
+
// Render condition by condition name
|
129 |
+
if (is_array($request->getConditionName())) {
|
130 |
+
$orWhere = array();
|
131 |
+
$i = 0;
|
132 |
+
foreach ($request->getConditionName() as $conditionName) {
|
133 |
+
$bindNameKey = sprintf(':condition_name_%d', $i);
|
134 |
+
$bindValueKey = sprintf(':condition_value_%d', $i);
|
135 |
+
$orWhere[] = "(condition_name = {$bindNameKey} AND condition_value <= {$bindValueKey})";
|
136 |
+
$bind[$bindNameKey] = $conditionName;
|
137 |
+
$bind[$bindValueKey] = $request->getData($conditionName);
|
138 |
+
$i++;
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($orWhere) {
|
142 |
+
$select->where(implode(' OR ', $orWhere));
|
143 |
+
}
|
144 |
+
} else {
|
145 |
+
$bind[':condition_name'] = $request->getConditionName();
|
146 |
+
$bind[':condition_value'] = $request->getData($request->getConditionName());
|
147 |
+
$select->where('condition_name = :condition_name');
|
148 |
+
$select->where('condition_value <= :condition_value');
|
149 |
+
}
|
150 |
+
$result = $adapter->fetchRow($select, $bind);
|
151 |
+
// Normalize destination zip code
|
152 |
+
if ($result && $result['dest_zip'] == '*') {
|
153 |
+
$result['dest_zip'] = '';
|
154 |
+
}
|
155 |
+
return $result;
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Upload and import table rates csv.
|
161 |
+
*
|
162 |
+
* @param Varien_Object $object
|
163 |
+
* @return $this
|
164 |
+
*/
|
165 |
+
public function uploadAndImport(Varien_Object $object)
|
166 |
+
{
|
167 |
+
if (empty($_FILES['groups']['tmp_name']['kariboo']['fields']['table_rate_file']['value'])) {
|
168 |
+
return $this;
|
169 |
+
}
|
170 |
+
|
171 |
+
$csvFile = $_FILES['groups']['tmp_name']['kariboo']['fields']['table_rate_file']['value'];
|
172 |
+
$website = Mage::app()->getWebsite($object->getScopeId());
|
173 |
+
|
174 |
+
$this->_importWebsiteId = (int)$website->getId();
|
175 |
+
$this->_importUniqueHash = array();
|
176 |
+
$this->_importErrors = array();
|
177 |
+
$this->_importedRows = 0;
|
178 |
+
|
179 |
+
$io = new Varien_Io_File();
|
180 |
+
$info = pathinfo($csvFile);
|
181 |
+
$io->open(array('path' => $info['dirname']));
|
182 |
+
$io->streamOpen($info['basename'], 'r');
|
183 |
+
|
184 |
+
// check and skip headers
|
185 |
+
$headers = $io->streamReadCsv();
|
186 |
+
if ($headers === false || count($headers) < 5) {
|
187 |
+
$io->streamClose();
|
188 |
+
Mage::throwException(Mage::helper('kariboo_shipping')->__('Invalid Table Rates File Format'));
|
189 |
+
}
|
190 |
+
|
191 |
+
if ($object->getData('groups/kariboo/fields/table_rate_condition/inherit') == '1') {
|
192 |
+
$conditionName = (string)Mage::getConfig()->getNode('default/carriers/kariboo/table_rate_condition');
|
193 |
+
} else {
|
194 |
+
$conditionName = $object->getData('groups/kariboo/fields/table_rate_condition/value');
|
195 |
+
}
|
196 |
+
|
197 |
+
$this->_importConditionName = $conditionName;
|
198 |
+
$adapter = $this->_getWriteAdapter();
|
199 |
+
$adapter->beginTransaction();
|
200 |
+
|
201 |
+
try {
|
202 |
+
$rowNumber = 1;
|
203 |
+
$importData = array();
|
204 |
+
|
205 |
+
$this->_loadDirectoryCountries();
|
206 |
+
$this->_loadDirectoryRegions();
|
207 |
+
|
208 |
+
// delete old data by website and condition name
|
209 |
+
$condition = array(
|
210 |
+
'website_id = ?' => $this->_importWebsiteId,
|
211 |
+
'condition_name = ?' => $this->_importConditionName
|
212 |
+
);
|
213 |
+
$adapter->delete($this->getMainTable(), $condition);
|
214 |
+
|
215 |
+
while (false !== ($csvLine = $io->streamReadCsv())) {
|
216 |
+
$rowNumber ++;
|
217 |
+
|
218 |
+
if (empty($csvLine)) {
|
219 |
+
continue;
|
220 |
+
}
|
221 |
+
|
222 |
+
$row = $this->_getImportRow($csvLine, $rowNumber);
|
223 |
+
if ($row !== false) {
|
224 |
+
$importData[] = $row;
|
225 |
+
}
|
226 |
+
|
227 |
+
if (count($importData) == 5000) {
|
228 |
+
$this->_saveImportData($importData);
|
229 |
+
$importData = array();
|
230 |
+
}
|
231 |
+
}
|
232 |
+
$this->_saveImportData($importData);
|
233 |
+
$io->streamClose();
|
234 |
+
} catch (Mage_Core_Exception $e) {
|
235 |
+
$adapter->rollback();
|
236 |
+
$io->streamClose();
|
237 |
+
Mage::throwException($e->getMessage());
|
238 |
+
} catch (Exception $e) {
|
239 |
+
$adapter->rollback();
|
240 |
+
$io->streamClose();
|
241 |
+
Mage::helper('kariboo_shipping')->log($e,Zend_Log::ERR);
|
242 |
+
Mage::throwException(Mage::helper('kariboo_shipping')->__('An error occurred while importing table rates.'));
|
243 |
+
}
|
244 |
+
|
245 |
+
$adapter->commit();
|
246 |
+
|
247 |
+
if ($this->_importErrors) {
|
248 |
+
$error = Mage::helper('kariboo_shipping')->__('File has not been imported. See the following list of errors: %s', implode(" \n", $this->_importErrors));
|
249 |
+
Mage::throwException($error);
|
250 |
+
}
|
251 |
+
|
252 |
+
return $this;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Load directory countries.
|
257 |
+
*
|
258 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
259 |
+
*/
|
260 |
+
protected function _loadDirectoryCountries()
|
261 |
+
{
|
262 |
+
if (!is_null($this->_importIso2Countries) && !is_null($this->_importIso3Countries)) {
|
263 |
+
return $this;
|
264 |
+
}
|
265 |
+
|
266 |
+
$this->_importIso2Countries = array();
|
267 |
+
$this->_importIso3Countries = array();
|
268 |
+
|
269 |
+
/** @var $collection Mage_Directory_Model_Resource_Country_Collection */
|
270 |
+
$collection = Mage::getResourceModel('directory/country_collection');
|
271 |
+
foreach ($collection->getData() as $row) {
|
272 |
+
$this->_importIso2Countries[$row['iso2_code']] = $row['country_id'];
|
273 |
+
$this->_importIso3Countries[$row['iso3_code']] = $row['country_id'];
|
274 |
+
}
|
275 |
+
|
276 |
+
return $this;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Load directory regions.
|
281 |
+
*
|
282 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
283 |
+
*/
|
284 |
+
protected function _loadDirectoryRegions()
|
285 |
+
{
|
286 |
+
if (!is_null($this->_importRegions)) {
|
287 |
+
return $this;
|
288 |
+
}
|
289 |
+
|
290 |
+
$this->_importRegions = array();
|
291 |
+
|
292 |
+
/** @var $collection Mage_Directory_Model_Resource_Region_Collection */
|
293 |
+
$collection = Mage::getResourceModel('directory/region_collection');
|
294 |
+
foreach ($collection->getData() as $row) {
|
295 |
+
$this->_importRegions[$row['country_id']][$row['code']] = (int)$row['region_id'];
|
296 |
+
}
|
297 |
+
|
298 |
+
return $this;
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Return import condition full name by condition name code.
|
303 |
+
*
|
304 |
+
* @param string $conditionName
|
305 |
+
* @return string
|
306 |
+
*/
|
307 |
+
protected function _getConditionFullName($conditionName)
|
308 |
+
{
|
309 |
+
if (!isset($this->_conditionFullNames[$conditionName])) {
|
310 |
+
$name = Mage::getSingleton('shipping/carrier_tablerate')->getCode('condition_name_short', $conditionName);
|
311 |
+
$this->_conditionFullNames[$conditionName] = $name;
|
312 |
+
}
|
313 |
+
return $this->_conditionFullNames[$conditionName];
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Validate row for import and return table rate array or false.
|
318 |
+
* Error will be added to _importErrors array.
|
319 |
+
*
|
320 |
+
* @param array $row
|
321 |
+
* @param int $rowNumber
|
322 |
+
* @return array|false
|
323 |
+
*/
|
324 |
+
protected function _getImportRow($row, $rowNumber = 0)
|
325 |
+
{
|
326 |
+
// validate row
|
327 |
+
if (count($row) < 5) {
|
328 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Invalid Table Rates format in the Row #%s', $rowNumber);
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
|
332 |
+
// strip whitespace from the beginning and end of each row
|
333 |
+
foreach ($row as $k => $v) {
|
334 |
+
$row[$k] = trim($v);
|
335 |
+
}
|
336 |
+
|
337 |
+
// validate country
|
338 |
+
if (isset($this->_importIso2Countries[$row[0]])){
|
339 |
+
$countryId = $this->_importIso2Countries[$row[0]];
|
340 |
+
} elseif (isset($this->_importIso3Countries[$row[0]])) {
|
341 |
+
$countryId = $this->_importIso3Countries[$row[0]];
|
342 |
+
} elseif ($row[0] == '*' || $row[0] == '') {
|
343 |
+
$countryId = '0';
|
344 |
+
} else {
|
345 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Invalid Country "%s" in the Row #%s.', $row[0], $rowNumber);
|
346 |
+
return false;
|
347 |
+
}
|
348 |
+
|
349 |
+
// validate region
|
350 |
+
if ($countryId != '0' && isset($this->_importRegions[$countryId][$row[1]])) {
|
351 |
+
$regionId = $this->_importRegions[$countryId][$row[1]];
|
352 |
+
} elseif ($row[1] == '*' || $row[1] == '') {
|
353 |
+
$regionId = 0;
|
354 |
+
} else {
|
355 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Invalid Region/State "%s" in the Row #%s.', $row[1], $rowNumber);
|
356 |
+
return false;
|
357 |
+
}
|
358 |
+
|
359 |
+
// detect zip code
|
360 |
+
if ($row[2] == '*' || $row[2] == '') {
|
361 |
+
$zipCode = '*';
|
362 |
+
} else {
|
363 |
+
$zipCode = $row[2];
|
364 |
+
}
|
365 |
+
|
366 |
+
// validate condition value
|
367 |
+
$value = $this->_parseDecimalValue($row[3]);
|
368 |
+
if ($value === false) {
|
369 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Invalid %s "%s" in the Row #%s.', $this->_getConditionFullName($this->_importConditionName), $row[3], $rowNumber);
|
370 |
+
return false;
|
371 |
+
}
|
372 |
+
|
373 |
+
// validate price
|
374 |
+
$price = $this->_parseDecimalValue($row[4]);
|
375 |
+
if ($price === false) {
|
376 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Invalid Shipping Price "%s" in the Row #%s.', $row[4], $rowNumber);
|
377 |
+
return false;
|
378 |
+
}
|
379 |
+
|
380 |
+
// protect from duplicate
|
381 |
+
$hash = sprintf("%s-%d-%s-%F", $countryId, $regionId, $zipCode, $value);
|
382 |
+
if (isset($this->_importUniqueHash[$hash])) {
|
383 |
+
$this->_importErrors[] = Mage::helper('kariboo_shipping')->__('Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s").', $rowNumber, $row[0], $row[1], $zipCode, $value);
|
384 |
+
return false;
|
385 |
+
}
|
386 |
+
$this->_importUniqueHash[$hash] = true;
|
387 |
+
|
388 |
+
return array(
|
389 |
+
$this->_importWebsiteId, // website_id
|
390 |
+
$countryId, // dest_country_id
|
391 |
+
$regionId, // dest_region_id,
|
392 |
+
$zipCode, // dest_zip
|
393 |
+
$this->_importConditionName,// condition_name,
|
394 |
+
$value, // condition_value
|
395 |
+
$price // price
|
396 |
+
);
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Save all import data.
|
401 |
+
*
|
402 |
+
* @param array $data
|
403 |
+
* @return $this
|
404 |
+
*/
|
405 |
+
protected function _saveImportData(array $data)
|
406 |
+
{
|
407 |
+
if (!empty($data)) {
|
408 |
+
$columns = array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip',
|
409 |
+
'condition_name', 'condition_value', 'price');
|
410 |
+
$this->_getWriteAdapter()->insertArray($this->getMainTable(), $columns, $data);
|
411 |
+
$this->_importedRows += count($data);
|
412 |
+
}
|
413 |
+
|
414 |
+
return $this;
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Conversion.
|
419 |
+
*
|
420 |
+
* @param $value
|
421 |
+
* @return bool|float
|
422 |
+
*/
|
423 |
+
protected function _parseDecimalValue($value)
|
424 |
+
{
|
425 |
+
if (!is_numeric($value)) {
|
426 |
+
return false;
|
427 |
+
}
|
428 |
+
$value = (float)sprintf('%.4F', $value);
|
429 |
+
if ($value < 0.0000) {
|
430 |
+
return false;
|
431 |
+
}
|
432 |
+
return $value;
|
433 |
+
}
|
434 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Resource/Tablerate/Collection.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Model_Resource_TableRate_Collection
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Model_Resource_Tablerate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* main table name
|
18 |
+
*
|
19 |
+
* @deprecated since 1.4.1.0
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $_shipTable;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* directory/country table name
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
protected $_countryTable;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* directory/country_region table name
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $_regionTable;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Define resource model and item
|
40 |
+
*
|
41 |
+
*/
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
$this->_init("kariboo_shipping/tablerate");
|
45 |
+
$this->_shipTable = $this->getMainTable();
|
46 |
+
$this->_countryTable = $this->getTable('directory/country');
|
47 |
+
$this->_regionTable = $this->getTable('directory/country_region');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Initialize select, add country iso3 code and region name
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
public function _initSelect()
|
56 |
+
{
|
57 |
+
parent::_initSelect();
|
58 |
+
|
59 |
+
$this->_select
|
60 |
+
->joinLeft(
|
61 |
+
array('country_table' => $this->_countryTable),
|
62 |
+
'country_table.country_id = main_table.dest_country_id',
|
63 |
+
array('dest_country' => 'iso3_code'))
|
64 |
+
->joinLeft(
|
65 |
+
array('region_table' => $this->_regionTable),
|
66 |
+
'region_table.region_id = main_table.dest_region_id',
|
67 |
+
array('dest_region' => 'code'));
|
68 |
+
|
69 |
+
$this->addOrder('dest_country', self::SORT_ORDER_ASC);
|
70 |
+
$this->addOrder('dest_region', self::SORT_ORDER_ASC);
|
71 |
+
$this->addOrder('dest_zip', self::SORT_ORDER_ASC);
|
72 |
+
$this->addOrder('condition_value', self::SORT_ORDER_ASC);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Add website filter to collection
|
77 |
+
*
|
78 |
+
* @param int $websiteId
|
79 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
80 |
+
*/
|
81 |
+
public function setWebsiteFilter($websiteId)
|
82 |
+
{
|
83 |
+
return $this->addFieldToFilter('website_id', $websiteId);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Add condition name (code) filter to collection
|
88 |
+
*
|
89 |
+
* @param string $conditionName
|
90 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
91 |
+
*/
|
92 |
+
public function setConditionFilter($conditionName)
|
93 |
+
{
|
94 |
+
return $this->addFieldToFilter('condition_name', $conditionName);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Add country filter to collection
|
99 |
+
*
|
100 |
+
* @param string $countryId
|
101 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
102 |
+
*/
|
103 |
+
public function setCountryFilter($countryId)
|
104 |
+
{
|
105 |
+
return $this->addFieldToFilter('dest_country_id', $countryId);
|
106 |
+
}
|
107 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Returnlabel.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_Returnlabel
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_Returnlabel extends Mage_Core_Model_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Initialise the model.
|
17 |
+
*/
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->_init("kariboo_shipping/returnlabel");
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Gets label from webservice, saves it and returns the saved id.
|
25 |
+
*
|
26 |
+
* @param $orderId
|
27 |
+
* @return int
|
28 |
+
*/
|
29 |
+
public function generateLabelAndSave($orderId)
|
30 |
+
{
|
31 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
32 |
+
$returnlabel = Mage::getSingleton('kariboo_shipping/webservice')->getReturnLabel($order);
|
33 |
+
|
34 |
+
//convertstring to pdf and save
|
35 |
+
$pdfname = Mage::helper('kariboo_shipping')->generatePdfAndSave($returnlabel->label, 'returnlabel', $returnlabel->Barcode);
|
36 |
+
|
37 |
+
//save labeldata for admin display
|
38 |
+
$returnLabelObject = new Kariboo_Shipping_Model_Returnlabel;
|
39 |
+
$returnLabelObject
|
40 |
+
->setLabelBarcode($returnlabel->Barcode)
|
41 |
+
->setLabelPdfPath($pdfname . ".pdf")
|
42 |
+
->setOrderId($orderId)
|
43 |
+
->setDateCreated(time())
|
44 |
+
->save();
|
45 |
+
return $returnLabelObject->getId();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Sends email with custom kariboo email and attached the pdf
|
50 |
+
*
|
51 |
+
* @param $order
|
52 |
+
* @param $returnId
|
53 |
+
* @return $this
|
54 |
+
*/
|
55 |
+
public function sendEmail($returnId)
|
56 |
+
{
|
57 |
+
$translate = Mage::getSingleton('core/translate');
|
58 |
+
$translate->setTranslateInline(false);
|
59 |
+
$returnLabel = Mage::getModel('kariboo_shipping/returnlabel')->load($returnId);
|
60 |
+
$order = Mage::getModel('sales/order')->load($returnLabel->getOrderId());
|
61 |
+
$billingAddress = $order->getBillingAddress();
|
62 |
+
$pdf_attachment = $returnLabel->getLabelPdfPath();
|
63 |
+
$templateVars = array('returnlabel' => $returnLabel, 'order' => $order, 'store' => Mage::app()->getStore($order->getStoreId()));
|
64 |
+
$transactionalEmail = Mage::getModel('core/email_template')
|
65 |
+
->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()));
|
66 |
+
if (!empty($pdf_attachment) && file_exists(Mage::getBaseDir('media') . "/kariboo/returnlabel/" . $pdf_attachment)) {
|
67 |
+
$transactionalEmail->getMail()
|
68 |
+
->createAttachment(
|
69 |
+
file_get_contents(Mage::getBaseDir('media') . "/kariboo/returnlabel/" . $pdf_attachment),
|
70 |
+
Zend_Mime::TYPE_OCTETSTREAM,
|
71 |
+
Zend_Mime::DISPOSITION_ATTACHMENT,
|
72 |
+
Zend_Mime::ENCODING_BASE64,
|
73 |
+
basename($pdf_attachment)
|
74 |
+
);
|
75 |
+
}
|
76 |
+
$transactionalEmail->sendTransactional('kariboo_returnlabel_email_template',
|
77 |
+
array('name' => Mage::getStoreConfig('trans_email/ident_support/name'),
|
78 |
+
'email' => Mage::getStoreConfig('trans_email/ident_support/email')),
|
79 |
+
$billingAddress->getEmail(),
|
80 |
+
$billingAddress->getFirstname() . " " . $billingAddress->getLastname(),
|
81 |
+
$templateVars);
|
82 |
+
$translate->setTranslateInline(true);
|
83 |
+
return $billingAddress->getEmail();
|
84 |
+
}
|
85 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Shipping/Geocode.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
class Kariboo_Shipping_Model_Shipping_Geocode
|
11 |
+
{
|
12 |
+
protected $address_line;
|
13 |
+
/**
|
14 |
+
* @var Kariboo_Shipping_Helper_Data
|
15 |
+
*/
|
16 |
+
protected $success = false;
|
17 |
+
protected $xml;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
21 |
+
* @return $this
|
22 |
+
*/
|
23 |
+
public function setAddress(Mage_Sales_Model_Quote_Address $address){
|
24 |
+
$addressToInsert = $address->getStreet(1) . " ";
|
25 |
+
if ($address->getStreet(2)) {
|
26 |
+
$addressToInsert .= $address->getStreet(2) . " ";
|
27 |
+
}
|
28 |
+
$addressToInsert .= $address->getPostcode() . " " . $address->getCity() . " " . $address->getCountry();
|
29 |
+
|
30 |
+
$this->address_line = $addressToInsert;
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Make the call to google geocode
|
36 |
+
* @return $this
|
37 |
+
*/
|
38 |
+
public function makeCall()
|
39 |
+
{
|
40 |
+
$key = Mage::getStoreConfig("carriers/kariboo/google_maps_api");
|
41 |
+
$url = 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($this->address_line) . '&key='.$key;
|
42 |
+
try{
|
43 |
+
$xml = simplexml_load_file($url);
|
44 |
+
switch($xml->status){
|
45 |
+
case "OK":
|
46 |
+
$this->success = true;
|
47 |
+
$this->xml = $xml;
|
48 |
+
Mage::helper('kariboo_shipping')->log("Geocode: OK ".$this->address_line." to xml" ,Zend_Log::DEBUG);
|
49 |
+
return $this;
|
50 |
+
break;
|
51 |
+
case "ZERO_RESULTS":
|
52 |
+
Mage::helper('kariboo_shipping')->log("Geocode: no results found for ".$this->address_line,Zend_Log::DEBUG);
|
53 |
+
return false;
|
54 |
+
break;
|
55 |
+
case "OVER_QUERY_LIMIT":
|
56 |
+
Mage::helper('kariboo_shipping')->log("Geocode: Over Query Limit. check your api console",Zend_Log::WARN);
|
57 |
+
return false;
|
58 |
+
break;
|
59 |
+
case "REQUEST_DENIED":
|
60 |
+
Mage::helper('kariboo_shipping')->log("Geocode: Request denied",Zend_Log::WARN);
|
61 |
+
return false;
|
62 |
+
break;
|
63 |
+
case "INVALID_REQUEST":
|
64 |
+
Mage::helper('kariboo_shipping')->log("Geocode: invalid request , address missing?",Zend_Log::WARN);
|
65 |
+
return false;
|
66 |
+
break;
|
67 |
+
case "UNKNOWN_ERROR":
|
68 |
+
Mage::helper('kariboo_shipping')->log("Geocode: unknown Error",Zend_Log::WARN);
|
69 |
+
return false;
|
70 |
+
break;
|
71 |
+
default:
|
72 |
+
Mage::helper('kariboo_shipping')->log("Geocode: unknown Status",Zend_Log::WARN);
|
73 |
+
return false;
|
74 |
+
break;
|
75 |
+
}
|
76 |
+
}catch (Exception $e){
|
77 |
+
Mage::helper('kariboo_shipping')->log("Geocode: ". $e->getMessage() ,Zend_Log::ERR);
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get the Latitude of this object
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getLat()
|
87 |
+
{
|
88 |
+
if($this->success){
|
89 |
+
return (string)$this->xml->result->geometry->location->lat;
|
90 |
+
}
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
/**
|
94 |
+
* Get the Longitude of this object
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getLng()
|
98 |
+
{
|
99 |
+
if($this->success){
|
100 |
+
return (string)$this->xml->result->geometry->location->lng;
|
101 |
+
}
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Shipping/Kariboo.php
ADDED
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_Shipping_Kariboo
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_Shipping_Kariboo extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
protected $_code = 'kariboo';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
22 |
+
* @return bool|Mage_Shipping_Model_Rate_Result|null
|
23 |
+
*/
|
24 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
25 |
+
{
|
26 |
+
//If webservice does not work or carrier is not set active, stop initializing.
|
27 |
+
$webservice = Mage::getSingleton("kariboo_shipping/webservice");
|
28 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
29 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active') || !$webservice->checkConnection() || $quote->getData('is_multi_shipping')) {
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
|
33 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
34 |
+
$result = Mage::getModel('shipping/rate_result');
|
35 |
+
|
36 |
+
if (!$this->getConfigData('rate_type')) {
|
37 |
+
$price = $this->getConfigData('flat_rate_price');
|
38 |
+
if ($request->getFreeShipping() === true) {
|
39 |
+
$price = 0;
|
40 |
+
}
|
41 |
+
} else {
|
42 |
+
$freeQty = 0;
|
43 |
+
if ($request->getAllItems()) {
|
44 |
+
$freePackageValue = 0;
|
45 |
+
foreach ($request->getAllItems() as $item) {
|
46 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
47 |
+
continue;
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
51 |
+
foreach ($item->getChildren() as $child) {
|
52 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
53 |
+
$freeShipping = is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0;
|
54 |
+
$freeQty += $item->getQty() * ($child->getQty() - $freeShipping);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
} elseif ($item->getFreeShipping()) {
|
58 |
+
$freeShipping = is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0;
|
59 |
+
$freeQty += $item->getQty() - $freeShipping;
|
60 |
+
$freePackageValue += $item->getBaseRowTotal();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$oldValue = $request->getPackageValue();
|
64 |
+
$request->setPackageValue($oldValue - $freePackageValue);
|
65 |
+
}
|
66 |
+
|
67 |
+
if ($freePackageValue) {
|
68 |
+
$request->setPackageValue($request->getPackageValue() - $freePackageValue);
|
69 |
+
}
|
70 |
+
|
71 |
+
$conditionName = $this->getConfigData('table_rate_condition');
|
72 |
+
$request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name);
|
73 |
+
|
74 |
+
$oldWeight = $request->getPackageWeight();
|
75 |
+
$oldQty = $request->getPackageQty();
|
76 |
+
|
77 |
+
$request->setPackageWeight($request->getFreeMethodWeight());
|
78 |
+
$request->setPackageQty($oldQty - $freeQty);
|
79 |
+
|
80 |
+
$rate = $this->getRate($request);
|
81 |
+
$request->setPackageWeight($oldWeight);
|
82 |
+
$request->setPackageQty($oldQty);
|
83 |
+
|
84 |
+
if (!empty($rate) && $rate['price'] >= 0) {
|
85 |
+
if ($request->getFreeShipping() === true || ($request->getPackageQty() == $freeQty)) {
|
86 |
+
$price = 0;
|
87 |
+
} else {
|
88 |
+
$price = $rate['price'];
|
89 |
+
}
|
90 |
+
} elseif (empty($rate) && $request->getFreeShipping() === true) {
|
91 |
+
$request->setPackageValue($freePackageValue);
|
92 |
+
$request->setPackageQty($freeQty);
|
93 |
+
$rate = $this->getRate($request);
|
94 |
+
if (!empty($rate) && $rate['price'] >= 0) {
|
95 |
+
$price = 0;
|
96 |
+
}
|
97 |
+
} else {
|
98 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
99 |
+
$error->setCarrier($this->_code);
|
100 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
101 |
+
$error->setErrorMessage(Mage::helper('kariboo_shipping')->__('This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.'));
|
102 |
+
$result->append($error);
|
103 |
+
return $result;
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
$method->setCarrier($this->_code);
|
109 |
+
$method->setMethod($this->_code);
|
110 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
111 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
112 |
+
$method->setPrice($price);
|
113 |
+
$method->setCost($price);
|
114 |
+
$result->append($method);
|
115 |
+
|
116 |
+
return $result;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Add this shipping method to list of allowed methods so Magento can display it.
|
121 |
+
*
|
122 |
+
* @return array
|
123 |
+
*/
|
124 |
+
public function getAllowedMethods()
|
125 |
+
{
|
126 |
+
return array('kariboospots' => $this->getConfigData('name'));
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get tracking result object.
|
131 |
+
*
|
132 |
+
* @param string $tracking_number
|
133 |
+
* @return Mage_Shipping_Model_Tracking_Result $tracking_result
|
134 |
+
*/
|
135 |
+
public function getTrackingInfo($tracking_number)
|
136 |
+
{
|
137 |
+
$tracking_result = $this->getTracking($tracking_number);
|
138 |
+
|
139 |
+
if ($tracking_result instanceof Mage_Shipping_Model_Tracking_Result) {
|
140 |
+
$trackings = $tracking_result->getAllTrackings();
|
141 |
+
if (is_array($trackings) && count($trackings) > 0) {
|
142 |
+
return $trackings[0];
|
143 |
+
}
|
144 |
+
}
|
145 |
+
return false;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Get tracking Url.
|
150 |
+
*
|
151 |
+
* @param string $tracking_number
|
152 |
+
* @return Mage_Shipping_Model_Tracking_Result
|
153 |
+
*/
|
154 |
+
public function getTracking($tracking_number)
|
155 |
+
{
|
156 |
+
$collection = Mage::getResourceModel('sales/order_shipment_track_collection')
|
157 |
+
->addFieldToFilter('track_number', $tracking_number)
|
158 |
+
->addAttributeToSelect("*");
|
159 |
+
|
160 |
+
$status = Mage::getSingleton("kariboo_shipping/webservice")->getTracking(
|
161 |
+
array(
|
162 |
+
"barcode" => $tracking_number,
|
163 |
+
"language" => Mage::helper('kariboo_shipping')->getLanguageFromStore(Mage::app()->getStore()->getStoreId())
|
164 |
+
),array($tracking_number => $collection->getFirstItem()));
|
165 |
+
|
166 |
+
if(!$status){
|
167 |
+
$returntext = $collection->getFirstItem()->getKaribooStatus();
|
168 |
+
$returntext .= "<br />" . Mage::helper('kariboo_shipping')->__("Real-time data is not available at the moment, last status update is from %s", $collection->getFirstItem()->getUpdatedAt());
|
169 |
+
}else{
|
170 |
+
$returntext = $status;
|
171 |
+
}
|
172 |
+
if(!$returntext || $returntext == "" || $returntext == "1"){
|
173 |
+
$returntext = Mage::helper('kariboo_shipping')->__("Tracking info is not available. Please contact the store owner.");
|
174 |
+
}
|
175 |
+
$tracking_result = Mage::getModel('shipping/tracking_result');
|
176 |
+
$tracking_status = Mage::getModel('shipping/tracking_result_status');
|
177 |
+
$tracking_status->setCarrier($this->_code);
|
178 |
+
$tracking_status->setCarrierTitle($this->getConfigData('title'));
|
179 |
+
$tracking_status->setTracking($tracking_number);
|
180 |
+
$tracking_status->addData(
|
181 |
+
array(
|
182 |
+
'status' => $returntext
|
183 |
+
)
|
184 |
+
);
|
185 |
+
$tracking_result->append($tracking_status);
|
186 |
+
|
187 |
+
return $tracking_result;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Make tracking available for kariboo shippingmethods.
|
192 |
+
*
|
193 |
+
* @return bool
|
194 |
+
*/
|
195 |
+
public function isTrackingAvailable()
|
196 |
+
{
|
197 |
+
return true;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Make shipping labels not available as we provided our own method.
|
202 |
+
*
|
203 |
+
* @return bool
|
204 |
+
*/
|
205 |
+
public function isShippingLabelsAvailable()
|
206 |
+
{
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Get the rateobject from our resource model.
|
212 |
+
*
|
213 |
+
* @param $request
|
214 |
+
* @return mixed
|
215 |
+
*/
|
216 |
+
public function getRate($request)
|
217 |
+
{
|
218 |
+
return Mage::getResourceModel('kariboo_shipping/tablerate')->getRate($request);
|
219 |
+
}
|
220 |
+
}
|
app/code/community/Kariboo/Shipping/Model/System/Config/Backend/Shipping/Tablerate.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_System_Config_Backend_Shipping_Tablerate
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_System_Config_Backend_Shipping_Tablerate extends Mage_Core_Model_Config_Data
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Call the uploadAndImport function from the classic tablerate recourcemodel.
|
17 |
+
*/
|
18 |
+
public function _afterSave()
|
19 |
+
{
|
20 |
+
Mage::getResourceModel('kariboo_shipping/tablerate')->uploadAndImport($this);
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Kariboo/Shipping/Model/System/Config/Source/Display.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_System_Config_Source_Display
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_System_Config_Source_Display
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Options getter.
|
17 |
+
* Returns an option array for Google maps display.
|
18 |
+
*
|
19 |
+
* @return array
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
public function toOptionArray()
|
23 |
+
{
|
24 |
+
return array(
|
25 |
+
array('value' => 1, 'label' => Mage::helper('kariboo_shipping')->__('Overlay')),
|
26 |
+
array('value' => 0, 'label' => Mage::helper('kariboo_shipping')->__('Inline')),
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get options in "key-value" format.
|
32 |
+
* Returns an array for Google maps display. (Magento basically expects both functions)
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
public function toArray()
|
38 |
+
{
|
39 |
+
return array(
|
40 |
+
0 => Mage::helper('kariboo_shipping')->__('Inline'),
|
41 |
+
1 => Mage::helper('kariboo_shipping')->__('Overlay'),
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/community/Kariboo/Shipping/Model/System/Config/Source/Ratetypes.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_System_Config_Source_Ratetypes
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_System_Config_Source_Ratetypes
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Options getter.
|
17 |
+
* Returns an option array for Shipping cost handler.
|
18 |
+
*
|
19 |
+
* @return array
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
public function toOptionArray()
|
23 |
+
{
|
24 |
+
return array(
|
25 |
+
array('value' => 1, 'label' => Mage::helper('kariboo_shipping')->__('Table Rates')),
|
26 |
+
array('value' => 0, 'label' => Mage::helper('kariboo_shipping')->__('Flat Rate')),
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get options in "key-value" format.
|
32 |
+
* Returns an array for Shipping cost handler. (Magento basically expects both functions)
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
public function toArray()
|
38 |
+
{
|
39 |
+
return array(
|
40 |
+
0 => Mage::helper('kariboo_shipping')->__('Flat Rate'),
|
41 |
+
1 => Mage::helper('kariboo_shipping')->__('Table Rates'),
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/community/Kariboo/Shipping/Model/System/Config/Source/Weightunit.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package DPD
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Class Kariboo_Shipping_Model_System_Config_Source_Weightunit
|
12 |
+
*/
|
13 |
+
class Kariboo_Shipping_Model_System_Config_Source_Weightunit
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Options getter.
|
17 |
+
* Returns an option array for unit weight to pass to the webservice.
|
18 |
+
*
|
19 |
+
* @return array
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
public function toOptionArray()
|
23 |
+
{
|
24 |
+
return array(
|
25 |
+
array('value' => 100, 'label' => Mage::helper('kariboo_shipping')->__('kg')),
|
26 |
+
array('value' => 0.1, 'label' => Mage::helper('kariboo_shipping')->__('g')),
|
27 |
+
array('value' => 45.3592, 'label' => Mage::helper('kariboo_shipping')->__('lb')),
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get options in "key-value" format.
|
33 |
+
* Returns an array for unit weight to pass to the webservice. (Magento basically expects both functions)
|
34 |
+
*
|
35 |
+
* @return array
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
public function toArray()
|
39 |
+
{
|
40 |
+
return array(
|
41 |
+
'100' => Mage::helper('kariboo_shipping')->__('kg'),
|
42 |
+
'0,1' => Mage::helper('kariboo_shipping')->__('g'),
|
43 |
+
'45.3592' => Mage::helper('kariboo_shipping')->__('lb')
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Tablerate.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Kariboo_Shipping_Model_Tablerate
|
5 |
+
*/
|
6 |
+
class Kariboo_Shipping_Model_Tablerate extends Mage_Core_Model_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Initialise the model.
|
10 |
+
*/
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init("kariboo_shipping/tablerate");
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Kariboo/Shipping/Model/Webservice.php
ADDED
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Model_Webservice
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Model_Webservice extends Mage_Core_Model_Abstract
|
15 |
+
{
|
16 |
+
|
17 |
+
protected $soap_connection;
|
18 |
+
/**
|
19 |
+
* @var Kariboo_Shipping_Helper_Data
|
20 |
+
*/
|
21 |
+
protected $_helper;
|
22 |
+
protected $connected = false;
|
23 |
+
private $password;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Casual construct
|
27 |
+
*/
|
28 |
+
public function _construct()
|
29 |
+
{
|
30 |
+
$this->_helper = Mage::helper('kariboo_shipping');
|
31 |
+
$this->init();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Start initialisation and setup connection
|
36 |
+
* @return bool
|
37 |
+
*/
|
38 |
+
protected function init()
|
39 |
+
{
|
40 |
+
$this->password = Mage::helper('core')->decrypt(Mage::getStoreConfig("shipping/kariboo/authorization_code"));
|
41 |
+
$webserviceUrl = Mage::getStoreConfig("shipping/kariboo/webservice_url");
|
42 |
+
|
43 |
+
try {
|
44 |
+
$client = new SoapClient($webserviceUrl, array('trace' => TRUE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
|
45 |
+
|
46 |
+
$this->_helper->log('Connecting webservice succeeded', Zend_Log::INFO);
|
47 |
+
//$this->_helper->log($result, Zend_Log::DEBUG);
|
48 |
+
} catch (SoapFault $soapE) {
|
49 |
+
$this->_helper->log('Webservice Login failed:', Zend_Log::ERR);
|
50 |
+
$this->_helper->log($soapE->getMessage(), Zend_Log::ERR);
|
51 |
+
Mage::getSingleton('adminhtml/session')->addError('A problem occurred with the kariboo webservice, please contact the store owner.');
|
52 |
+
return false;
|
53 |
+
} catch (Exception $e) {
|
54 |
+
$this->_helper->log($e->getMessage(), Zend_Log::ERR);
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
$this->soap_connection = $client;
|
59 |
+
$this->connected = true;
|
60 |
+
return true;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Check the connection of the soap client
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
public function checkConnection()
|
68 |
+
{
|
69 |
+
return $this->connected;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* get Kariboo spots
|
75 |
+
* @param $lat
|
76 |
+
* @param $lng
|
77 |
+
* @param string $postalCode
|
78 |
+
* @param bool $openOnSunday
|
79 |
+
* @param bool $openAfter16
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
public function getKaribooSpots($lat, $lng, $postalCode = "", $openOnSunday = "", $openAfter16 = "")
|
83 |
+
{
|
84 |
+
if ($postalCode != "") {
|
85 |
+
$lat = "";
|
86 |
+
$lng = "";
|
87 |
+
}
|
88 |
+
$parameters = array(
|
89 |
+
"aroundMe" => array(
|
90 |
+
'Longitude' => $lng,
|
91 |
+
'Latitude' => $lat,
|
92 |
+
'AuthorizationCode' => $this->password,
|
93 |
+
'OpenOnSunday' => $openOnSunday,
|
94 |
+
'OpenAfter1600' => $openAfter16,
|
95 |
+
'PostCode' => $postalCode
|
96 |
+
)
|
97 |
+
);
|
98 |
+
|
99 |
+
$result = $this->_webserviceCall('PlugGetSpotsAroundMe01', $parameters);
|
100 |
+
return $result;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Check if the spot still exists
|
105 |
+
* @param string $spotID
|
106 |
+
* @return object
|
107 |
+
*/
|
108 |
+
public function getSpot($spotID)
|
109 |
+
{
|
110 |
+
$parameters = array(
|
111 |
+
'shopId' => $spotID,
|
112 |
+
'authorizationCode' => $this->password,
|
113 |
+
);
|
114 |
+
|
115 |
+
$result = $this->_webserviceCall('PlugGetSpotActive01', $parameters);
|
116 |
+
return $result->PlugGetSpotActive01Result;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get the tracking result and save it
|
121 |
+
* @param mixed $trackingNumber
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
public function getTracking($trackingNumber, $objectsToUpdate = null)
|
125 |
+
{
|
126 |
+
$parameters = array(
|
127 |
+
'authorizationCode' => $this->password,
|
128 |
+
'TrackingBarcodes' => array("TrackingBarcode" => $trackingNumber)
|
129 |
+
);
|
130 |
+
|
131 |
+
$result = $this->_webserviceCall('PlugGetTrackingData01', $parameters);
|
132 |
+
|
133 |
+
//return a boolean if the result failed
|
134 |
+
if (!$result) {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
//loop trough results and save them
|
139 |
+
$transactionModel = Mage::getModel('core/resource_transaction');
|
140 |
+
$trackings = (array)$result->PlugGetTrackingData01Result->Trackings;
|
141 |
+
if (is_array($trackings)) {
|
142 |
+
$trackings = $trackings["Tracking"];
|
143 |
+
}
|
144 |
+
$size = count($trackings);
|
145 |
+
$objectsUpdated = array();
|
146 |
+
foreach ($trackings as $tracking) {
|
147 |
+
|
148 |
+
$historyTracking = $tracking->HistoryTrackings->HistoryTracking;
|
149 |
+
if (isset($historyTracking[0]->StatusText) && isset($historyTracking[0]->StatusCode)) {
|
150 |
+
$objectToUpdate = $objectsToUpdate[$tracking->Barcode];
|
151 |
+
$objectsUpdated[] = $tracking->Barcode;
|
152 |
+
$objectToUpdate->setKaribooText($historyTracking[0]->StatusText);
|
153 |
+
$objectToUpdate->setKaribooStatus($historyTracking[0]->StatusCode);
|
154 |
+
$transactionModel->addObject($objectToUpdate);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
$transactionModel->save();
|
158 |
+
unset($transactionModel);
|
159 |
+
if ($size == 1 && isset($historyTracking[0]->StatusText)) {
|
160 |
+
return $historyTracking[0]->StatusText;
|
161 |
+
}
|
162 |
+
Mage::helper('kariboo_shipping')->log('Updated T&T status for the following barcodes:' . implode(', ', $objectsUpdated), Zend_Log::INFO);
|
163 |
+
return true;
|
164 |
+
}
|
165 |
+
|
166 |
+
public function getReturnLabel(Mage_Sales_Model_Order $order)
|
167 |
+
{
|
168 |
+
$billingAddress = $order->getBillingAddress();
|
169 |
+
$parameters = array("label" => array(
|
170 |
+
'AuthorizationCode' => $this->password,
|
171 |
+
'Language' => Mage::helper('kariboo_shipping')->getLanguageFromStore($order->getStoreId()),
|
172 |
+
'CustomerName' => $billingAddress->getFirstname() . " " . $billingAddress->getLastname(),
|
173 |
+
'CustomerStreet' => $billingAddress->getStreet(1) . " " . $billingAddress->getStreet(2),
|
174 |
+
'CustomerCountry' => $billingAddress->getCountry(),
|
175 |
+
'CustomerPostalCode' => $billingAddress->getPostcode(),
|
176 |
+
'CustomerCity' => $billingAddress->getCity(),
|
177 |
+
'Products' => Mage::helper('kariboo_shipping')->processAllShipmentItems($order->getShipmentsCollection())
|
178 |
+
));
|
179 |
+
|
180 |
+
$result = $this->_webserviceCall('PlugGetReturnLabel01', $parameters);
|
181 |
+
return $result->PlugGetReturnLabel01Result;
|
182 |
+
}
|
183 |
+
|
184 |
+
public function getPickUpLabel(Mage_Sales_Model_Order $order, $shipments, $count)
|
185 |
+
{
|
186 |
+
$karibooOriginalShippingAddress = json_decode($order->getKaribooOriginalShippingaddress());
|
187 |
+
$currencyCode = $order->getOrderCurrencyCode();
|
188 |
+
$paymentMethod = $order->getPayment()->getMethodInstance()->getTitle();
|
189 |
+
$parameters = array("label" => array(
|
190 |
+
'AuthorizationCode' => $this->password,
|
191 |
+
'Language' => Mage::helper('kariboo_shipping')->getLanguageFromStore($order->getStoreId()),
|
192 |
+
'ShopId' => $order->getKaribooSpotid(),
|
193 |
+
'CustomerName' => $karibooOriginalShippingAddress->firstname . " " . $karibooOriginalShippingAddress->lastname,
|
194 |
+
'CustomerStreet' => $karibooOriginalShippingAddress->street,
|
195 |
+
'CustomerPostalCode' => $karibooOriginalShippingAddress->postcode,
|
196 |
+
'CustomerCity' => $karibooOriginalShippingAddress->city,
|
197 |
+
'CustomerCountry' => $karibooOriginalShippingAddress->country_id,
|
198 |
+
'CustomerEmail' => $order->getCustomerEmail(),
|
199 |
+
'CustomerPhone' => $karibooOriginalShippingAddress->telephone,
|
200 |
+
'OrderId' => $order->getIncrementId(),
|
201 |
+
'NumberLabelToReturn' => (string)$count,
|
202 |
+
'Shipments' => Mage::helper('kariboo_shipping')->processShipmentWeight($shipments),
|
203 |
+
'COD' => ($paymentMethod == "Kariboo! COD" ? true : false),
|
204 |
+
'CODPrice' => '0',
|
205 |
+
'Weight' => '0', //obsolete attribute
|
206 |
+
'CODCurrency' => strtolower(Mage::app()->getLocale()->currency($currencyCode)->getName()),
|
207 |
+
'Products' => Mage::helper('kariboo_shipping')->processAllShipmentItems($shipments)
|
208 |
+
));
|
209 |
+
|
210 |
+
$result = $this->_webserviceCall('PlugGetPickUpLabel01', $parameters);
|
211 |
+
return $result->PlugGetPickUpLabel01Result;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Does the webservice call towards kariboo for functions with authentication.
|
216 |
+
*
|
217 |
+
* @param $method
|
218 |
+
* @param $parameters
|
219 |
+
* @internal param $webserviceUrl
|
220 |
+
* @return mixed
|
221 |
+
*/
|
222 |
+
protected function _webserviceCall($method, $parameters)
|
223 |
+
{
|
224 |
+
if ($this->connected) {
|
225 |
+
try {
|
226 |
+
Mage::helper('kariboo_shipping')->log('Starting webservice ' . $method . '...', Zend_Log::INFO);
|
227 |
+
Mage::helper('kariboo_shipping')->log(json_encode($parameters), Zend_Log::DEBUG);
|
228 |
+
$result = $this->soap_connection->__soapCall($method, array($parameters));
|
229 |
+
|
230 |
+
if ($result->{$method . "Result"}->ErrorCode != "OK") {
|
231 |
+
Mage::helper('kariboo_shipping')->log('Webservice ' . $method . ' failed: ' . $result->{$method . "Result"}->ErrorCode, Zend_Log::ERR);
|
232 |
+
return false;
|
233 |
+
}
|
234 |
+
|
235 |
+
Mage::helper('kariboo_shipping')->log('Webservice ' . $method . ' succeeded', Zend_Log::INFO);
|
236 |
+
if (($method == "PlugGetPickUpLabel01" || $method == "PlugGetReturnLabel01") && Mage::getStoreConfig('shipping/kariboo/log_level') == 7) {
|
237 |
+
$logTruncated = $this->_truncateLog($method, $result);
|
238 |
+
Mage::helper('kariboo_shipping')->log($logTruncated, Zend_Log::DEBUG);
|
239 |
+
} else {
|
240 |
+
Mage::helper('kariboo_shipping')->log($result, Zend_Log::DEBUG);
|
241 |
+
}
|
242 |
+
return $result;
|
243 |
+
|
244 |
+
} catch (SoapFault $soapE) {
|
245 |
+
Mage::helper('kariboo_shipping')->log('Webservice ' . $method . ' failed:', Zend_Log::ERR);
|
246 |
+
Mage::helper('kariboo_shipping')->log($soapE->getMessage(), Zend_Log::ERR);
|
247 |
+
return false;
|
248 |
+
} catch (Exception $e) {
|
249 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
250 |
+
Mage::getSingleton('adminhtml/session')->addError('Something went wrong with the webservice, please check the log files.');
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
|
254 |
+
} else {
|
255 |
+
Mage::helper('kariboo_shipping')->log("Webservice not initialised.", Zend_Log::ERR);
|
256 |
+
return false;
|
257 |
+
}
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
protected function _truncateLog($method, $result)
|
262 |
+
{
|
263 |
+
$arrayToLog = array();
|
264 |
+
if ($method == "PlugGetPickUpLabel01") {
|
265 |
+
$arrayToLog['ErrorCode'] = $result->PlugGetPickUpLabel01Result->ErrorCode;
|
266 |
+
$counter = 0;
|
267 |
+
foreach ($result->PlugGetPickUpLabel01Result->LabelPdfs->LabelPdf as $labelPdf) {
|
268 |
+
$arrayToLog['LabelPdf'][$counter]['Barcode'] = $labelPdf->Barcode;
|
269 |
+
$arrayToLog['LabelPdf'][$counter]['BarcodeReturn'] = $labelPdf->BarcodeReturn;
|
270 |
+
$editedLabel = substr(str_replace(array("\r\n", "\n", "\r"), ' ', $labelPdf->label), 0, 50);
|
271 |
+
$arrayToLog['LabelPdf'][$counter]['label'] = $editedLabel;
|
272 |
+
$counter++;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
else{
|
276 |
+
$arrayToLog['ErrorCode'] = $result->PlugGetReturnLabel01Result->ErrorCode;
|
277 |
+
$arrayToLog['Barcode'] = $result->PlugGetReturnLabel01Result->Barcode;
|
278 |
+
$editedLabel = substr(str_replace(array("\r\n", "\n", "\r"), ' ', $result->PlugGetReturnLabel01Result->label),0, 50);
|
279 |
+
$arrayToLog['label'] = $editedLabel;
|
280 |
+
}
|
281 |
+
return $arrayToLog;
|
282 |
+
}
|
283 |
+
}
|
app/code/community/Kariboo/Shipping/controllers/Adminhtml/KaribooconfigController.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Adminhtml_KaribooconfigController
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Adminhtml_KaribooconfigController extends Mage_Adminhtml_Controller_Action
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Export shipping table rates in csv format
|
18 |
+
*
|
19 |
+
*/
|
20 |
+
public function exportKaribooTableratesAction()
|
21 |
+
{
|
22 |
+
$fileName = 'kariboo_tablerates.csv';
|
23 |
+
/** @var $gridBlock Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid */
|
24 |
+
$gridBlock = $this->getLayout()->createBlock('kariboo_shipping/adminhtml_shipping_carrier_kariboo_tablerate_grid');
|
25 |
+
$website = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
|
26 |
+
if ($this->getRequest()->getParam('conditionName')) {
|
27 |
+
$conditionName = $this->getRequest()->getParam('conditionName');
|
28 |
+
} else {
|
29 |
+
$conditionName = $website->getConfig('carriers/kariboo/table_rate_condition');
|
30 |
+
}
|
31 |
+
$gridBlock->setWebsiteId($website->getId())->setConditionName($conditionName);
|
32 |
+
$content = $gridBlock->getCsvFile();
|
33 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Kariboo/Shipping/controllers/Adminhtml/KariboodownloadController.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Adminhtml_KariboodownloadController
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Adminhtml_KariboodownloadController extends Mage_Adminhtml_Controller_Action
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Load indexpage of this controller.
|
18 |
+
*/
|
19 |
+
public function indexAction()
|
20 |
+
{
|
21 |
+
Mage::getModel('core/session')->setKaribooReturn(0);
|
22 |
+
$this->_title($this->__('kariboo'))->_title($this->__('Kariboo! Downloads'));
|
23 |
+
$this->loadLayout();
|
24 |
+
$this->_setActiveMenu('sales/sales');
|
25 |
+
$this->_addContent($this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_download'));
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Load the grid.
|
31 |
+
*/
|
32 |
+
public function gridAction()
|
33 |
+
{
|
34 |
+
$this->loadLayout();
|
35 |
+
$this->getResponse()->setBody(
|
36 |
+
$this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_download_grid')->toHtml()
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Kariboo/Shipping/controllers/Adminhtml/KaribooorderController.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_Adminhtml_KaribooorderController
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_Adminhtml_KaribooorderController extends Mage_Adminhtml_Controller_Action
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Load indexpage of this controller.
|
18 |
+
*/
|
19 |
+
public function indexAction()
|
20 |
+
{
|
21 |
+
Mage::getSingleton('core/session')->setKaribooReturn(0);
|
22 |
+
$this->_title($this->__('kariboo'))->_title($this->__('Kariboo! Orders'));
|
23 |
+
$this->loadLayout();
|
24 |
+
$this->_setActiveMenu('sales/sales');
|
25 |
+
$this->_addContent($this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_order'));
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Load the grid.
|
31 |
+
*/
|
32 |
+
public function gridAction()
|
33 |
+
{
|
34 |
+
$this->loadLayout();
|
35 |
+
$this->getResponse()->setBody(
|
36 |
+
$this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_order_grid')->toHtml()
|
37 |
+
);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Export csvs, this fetches all current gridentries.
|
42 |
+
*/
|
43 |
+
public function exportKaribooOrdersCsvAction()
|
44 |
+
{
|
45 |
+
$fileName = 'kariboo_orders.csv';
|
46 |
+
$grid = $this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_order_grid');
|
47 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Export excel (xml), this fetches all current gridentries.
|
52 |
+
*/
|
53 |
+
public function exportKaribooOrdersExcelAction()
|
54 |
+
{
|
55 |
+
$fileName = 'kariboo_orders.xml';
|
56 |
+
$grid = $this->getLayout()->createBlock('kariboo_shipping/adminhtml_sales_order_grid');
|
57 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Generate the returnlabel pdf, this fetches the label from kariboo webservices.
|
62 |
+
* On fail this method will remove all db entries / generated pdfs to prevent outputting wrong entries.
|
63 |
+
* Logs all errors in try catch.
|
64 |
+
*/
|
65 |
+
public function generateReturnLabelAction()
|
66 |
+
{
|
67 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
68 |
+
try {
|
69 |
+
$returnId = Mage::getModel('kariboo_shipping/returnlabel')->generateLabelAndSave($orderId);
|
70 |
+
if ($returnId) {
|
71 |
+
$message = Mage::helper('kariboo_shipping')->__("Your return label has been generated and is available under 'Kariboo! Return Labels' in this order.");
|
72 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
73 |
+
}
|
74 |
+
} catch (Exception $e) {
|
75 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
76 |
+
}
|
77 |
+
$this->_redirect('adminhtml/sales_order/view/order_id/' . $orderId);
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Fetches the label and puts it in a download response.
|
83 |
+
*/
|
84 |
+
public function downloadKaribooLabelAction()
|
85 |
+
{
|
86 |
+
$shipmentId = $this->getRequest()->getParam('shipment_id');
|
87 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
88 |
+
if ($shipment->getKaribooLabelPath() == "") {
|
89 |
+
$message = Mage::helper('kariboo_shipping')->__("No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview.");
|
90 |
+
Mage::getSingleton('core/session')->addError($message);
|
91 |
+
$this->_redirect('*/sales_order_shipment/view/shipment_id/' . $shipmentId);
|
92 |
+
} else {
|
93 |
+
$pdf_Path = Mage::getBaseDir('media') . "/kariboo/orderlabels/" . $shipment->getKaribooLabelPath();
|
94 |
+
$this->_prepareDownloadResponse($shipment->getKaribooLabelPath(), file_get_contents($pdf_Path), 'application/pdf');
|
95 |
+
$shipment->setKaribooLabelExported(1)->save();
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Call this to send an email with the kariboo template.
|
101 |
+
* This calls the model to handle emails the magento way.
|
102 |
+
* Logs all errors in try catch.
|
103 |
+
*/
|
104 |
+
public function sendEmailAction()
|
105 |
+
{
|
106 |
+
$returnId = $this->getRequest()->getParam('return_id');
|
107 |
+
try {
|
108 |
+
$email = Mage::getModel('kariboo_shipping/returnlabel')->sendEmail($returnId);
|
109 |
+
} catch (Exception $e) {
|
110 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
111 |
+
$this->_redirectReferer();
|
112 |
+
return $this;
|
113 |
+
}
|
114 |
+
$message = Mage::helper('kariboo_shipping')->__("The email with return label has been sent to %s.", $email);
|
115 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
116 |
+
$this->_redirectReferer();
|
117 |
+
return $this;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Generates a label and completes the shipment.
|
122 |
+
* This is called by the action in the order grid dropdown.
|
123 |
+
*/
|
124 |
+
public function generateAndCompleteAction()
|
125 |
+
{
|
126 |
+
ini_set('max_execution_time', 120);
|
127 |
+
$orderIds = $this->getRequest()->getParam('entity_id');
|
128 |
+
|
129 |
+
//load order collection and process each order
|
130 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection()
|
131 |
+
->addFieldToSelect('*')
|
132 |
+
->addFieldToFilter('entity_id', array('in' => $orderIds));
|
133 |
+
|
134 |
+
//count orders to show how much have been processed in feedback
|
135 |
+
$counter = 0;
|
136 |
+
$ordercounter = 0;
|
137 |
+
try {
|
138 |
+
foreach ($orderCollection as $order) {
|
139 |
+
try {
|
140 |
+
$result = Mage::getModel('kariboo_shipping/adminhtml_kariboogrid')->generateAndCompleteOrder($order);
|
141 |
+
if ($result != false) {
|
142 |
+
$counter= $counter + $result;
|
143 |
+
$ordercounter++;
|
144 |
+
}
|
145 |
+
} catch (Exception $e) {
|
146 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
147 |
+
$message = Mage::helper('kariboo_shipping')->__("The order with id %s is not ready to be shipped or has already been shipped.", $order->getIncrementId());
|
148 |
+
Mage::getSingleton('core/session')->addNotice($message);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if ($counter > 0) {
|
152 |
+
$message = Mage::helper('kariboo_shipping')->__("%s label(s) have been generated for %s order(s) and statuses have been changed.", $counter, $ordercounter);
|
153 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
154 |
+
}
|
155 |
+
} catch (Exception $e) {
|
156 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
157 |
+
$message = Mage::helper('kariboo_shipping')->__("Some of the selected orders are not ready to be shipped or have already been shipped, operation canceled.");
|
158 |
+
Mage::getSingleton('core/session')->addError($message);
|
159 |
+
}
|
160 |
+
|
161 |
+
$this->_redirect('*/*/index');
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Zips all undownloaded labels and gives downloadlink.
|
166 |
+
*/
|
167 |
+
public function dowloadAllUndownloadedAction()
|
168 |
+
{
|
169 |
+
$orderIds = $this->getRequest()->getParam('entity_id');
|
170 |
+
try {
|
171 |
+
$generated_name = Mage::getModel('kariboo_shipping/adminhtml_kariboogrid')->processUndownloadedLabels($orderIds);
|
172 |
+
if (!$generated_name) {
|
173 |
+
$message = Mage::helper('kariboo_shipping')->__('No undownloaded labels found.');
|
174 |
+
Mage::getSingleton('core/session')->addError($message);
|
175 |
+
$this->_redirect('*/*/index');
|
176 |
+
} else {
|
177 |
+
$message = Mage::helper('kariboo_shipping')->__('Successfully exported order(s). Download the file here: %s',
|
178 |
+
' <a id="downloadzip" href="'
|
179 |
+
. Mage::helper('adminhtml')->getUrl('*/*/downloadZip', array('file_name' => $generated_name)) . '" target="_blank">'
|
180 |
+
. 'kariboo_undownloaded.zip' . '</a>');
|
181 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
182 |
+
$this->_redirect('*/*/index');
|
183 |
+
}
|
184 |
+
} catch (Exception $e) {
|
185 |
+
Mage::helper('kariboo_shipping')->log($e->getMessage(), Zend_Log::ERR);
|
186 |
+
$message = Mage::helper('kariboo_shipping')->__("The file(s) could not be downloaded, please check your Kariboo logs.");
|
187 |
+
Mage::getSingleton('core/session')->addError($message);
|
188 |
+
$this->_redirect('*/*/index');
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Download responseAction for the zip
|
194 |
+
*/
|
195 |
+
public function downloadZipAction()
|
196 |
+
{
|
197 |
+
$filename = $this->getRequest()->getParam('file_name');
|
198 |
+
$fileLocation = Mage::getBaseDir('media') . "/kariboo/orderlabels/zips/" . $filename;
|
199 |
+
if (file_exists($fileLocation)) {
|
200 |
+
$this->_prepareDownloadResponse('kariboo_undownloaded.zip', file_get_contents($fileLocation));
|
201 |
+
} else {
|
202 |
+
$message = Mage::helper('kariboo_shipping')->__("The requested file does not exist, it is either removed or not readable.");
|
203 |
+
Mage::getSingleton('core/session')->addError($message);
|
204 |
+
$this->_redirect('*/*/index');
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Kariboo/Shipping/controllers/AjaxController.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Kariboo_Shipping_AjaxController
|
13 |
+
*/
|
14 |
+
class Kariboo_Shipping_AjaxController extends Mage_Core_Controller_Front_Action {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Undefined method
|
18 |
+
*/
|
19 |
+
public function indexAction(){
|
20 |
+
$this->loadLayout();
|
21 |
+
$this->renderLayout();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get spotswindow
|
26 |
+
*/
|
27 |
+
public function getwindowAction(){
|
28 |
+
$isAjax = Mage::app()->getRequest()->isAjax();
|
29 |
+
if ($isAjax) {
|
30 |
+
//make call and check if it returns an error.
|
31 |
+
$wsCall = Mage::helper("kariboo_shipping")->getKaribooSpots();
|
32 |
+
$error = array();
|
33 |
+
if(gettype($wsCall) != "array"){
|
34 |
+
try{
|
35 |
+
$payloadShops = $wsCall->PlugGetSpotsAroundMe01Result->PickUpPoints->PickUpPoint;
|
36 |
+
}catch (Exception $e){
|
37 |
+
Mage::helper("kariboo_shipping")->log("Webservice: not expected result returned :" . $e->getMessage() ,Zend_Log::WARN);
|
38 |
+
$payloadShops ="";
|
39 |
+
$error[] = Mage::helper('kariboo_shipping')->__("Sorry, there was a problem contacting Kariboo! , please contact the store owner for support.");
|
40 |
+
}
|
41 |
+
|
42 |
+
}else{
|
43 |
+
$error[] = $wsCall[0];
|
44 |
+
$payloadShops = "";
|
45 |
+
}
|
46 |
+
|
47 |
+
$payloadFull = array("error" => $error,"shops" => $payloadShops, "days" => Mage::helper('kariboo_shipping')->getJsDaysArray());
|
48 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
49 |
+
$this->getResponse()->setBody(json_encode($payloadFull));
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Kariboo/Shipping/etc/adminhtml.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<menu>
|
3 |
+
<sales>
|
4 |
+
<children>
|
5 |
+
<kariboo translate="title" module="kariboo_shipping">
|
6 |
+
<sort_order>20</sort_order>
|
7 |
+
<title>Kariboo!</title>
|
8 |
+
<children>
|
9 |
+
<kariboo_order>
|
10 |
+
<sort_order>10</sort_order>
|
11 |
+
<title>Orders</title>
|
12 |
+
<action>adminhtml/karibooorder/</action>
|
13 |
+
</kariboo_order>
|
14 |
+
<kariboo_downloads>
|
15 |
+
<sort_order>20</sort_order>
|
16 |
+
<title>Downloads</title>
|
17 |
+
<action>adminhtml/kariboodownload/</action>
|
18 |
+
</kariboo_downloads>
|
19 |
+
</children>
|
20 |
+
</kariboo>
|
21 |
+
</children>
|
22 |
+
</sales>
|
23 |
+
</menu>
|
24 |
+
<acl>
|
25 |
+
<resources>
|
26 |
+
<admin>
|
27 |
+
<children>
|
28 |
+
<sales>
|
29 |
+
<children>
|
30 |
+
<kariboo translate="title" module="kariboo_shipping">
|
31 |
+
<title>Kariboo! Orders</title>
|
32 |
+
<sort_order>20</sort_order>
|
33 |
+
</kariboo>
|
34 |
+
</children>
|
35 |
+
</sales>
|
36 |
+
</children>
|
37 |
+
</admin>
|
38 |
+
</resources>
|
39 |
+
</acl>
|
40 |
+
</config>
|
app/code/community/Kariboo/Shipping/etc/config.xml
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kariboo_Shipping>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Kariboo_Shipping>
|
7 |
+
</modules>
|
8 |
+
<default>
|
9 |
+
<shipping>
|
10 |
+
<kariboo>
|
11 |
+
<webservice_url>https://plugtest.kariboo.be:8443/karibooplug.asmx?wsdl</webservice_url>
|
12 |
+
<log_level>7</log_level>
|
13 |
+
</kariboo>
|
14 |
+
</shipping>
|
15 |
+
<carriers>
|
16 |
+
<kariboo>
|
17 |
+
<active>1</active>
|
18 |
+
<model>kariboo_shipping/shipping_kariboo</model>
|
19 |
+
<title>Kariboo!</title>
|
20 |
+
<name>Delivery at Kariboo!-spot</name>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<default_selected>0</default_selected>
|
23 |
+
<rate_type>0</rate_type>
|
24 |
+
<flat_rate_price>0</flat_rate_price>
|
25 |
+
<sallowspecific>1</sallowspecific>
|
26 |
+
<specificcountry>BE</specificcountry>
|
27 |
+
<google_maps_width>600</google_maps_width>
|
28 |
+
<google_maps_height>430</google_maps_height>
|
29 |
+
<google_maps_display>0</google_maps_display>
|
30 |
+
<google_maps_enable_list>0</google_maps_enable_list>
|
31 |
+
</kariboo>
|
32 |
+
</carriers>
|
33 |
+
<payment>
|
34 |
+
<kariboocod>
|
35 |
+
<active>0</active>
|
36 |
+
<model>kariboo_shipping/payment_kariboocod</model>
|
37 |
+
<title>Kariboo! COD</title>
|
38 |
+
<order_status>processing</order_status>
|
39 |
+
<sort_order>0</sort_order>
|
40 |
+
<allowspecific>1</allowspecific>
|
41 |
+
<specificcountry>BE</specificcountry>
|
42 |
+
</kariboocod>
|
43 |
+
</payment>
|
44 |
+
</default>
|
45 |
+
<global>
|
46 |
+
<blocks>
|
47 |
+
<kariboo_shipping>
|
48 |
+
<class>Kariboo_Shipping_Block</class>
|
49 |
+
</kariboo_shipping>
|
50 |
+
</blocks>
|
51 |
+
<models>
|
52 |
+
<kariboo_shipping>
|
53 |
+
<class>Kariboo_Shipping_Model</class>
|
54 |
+
<resourceModel>kariboo_shipping_resource</resourceModel>
|
55 |
+
</kariboo_shipping>
|
56 |
+
<kariboo_shipping_resource>
|
57 |
+
<class>Kariboo_Shipping_Model_Resource</class>
|
58 |
+
<entities>
|
59 |
+
<returnlabel>
|
60 |
+
<table>kariboo_shipping_returnlabel</table>
|
61 |
+
</returnlabel>
|
62 |
+
<tablerate>
|
63 |
+
<table>kariboo_shipping_tablerate</table>
|
64 |
+
</tablerate>
|
65 |
+
</entities>
|
66 |
+
</kariboo_shipping_resource>
|
67 |
+
</models>
|
68 |
+
<helpers>
|
69 |
+
<kariboo_shipping>
|
70 |
+
<class>Kariboo_Shipping_Helper</class>
|
71 |
+
</kariboo_shipping>
|
72 |
+
</helpers>
|
73 |
+
<resources>
|
74 |
+
<kariboo_setup>
|
75 |
+
<setup>
|
76 |
+
<module>Kariboo_Shipping</module>
|
77 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
78 |
+
</setup>
|
79 |
+
</kariboo_setup>
|
80 |
+
</resources>
|
81 |
+
<template>
|
82 |
+
<email>
|
83 |
+
<kariboo_returnlabel_email_template translate="label" module="kariboo_shipping">
|
84 |
+
<label>Kariboo Returnlabel Email</label>
|
85 |
+
<file>sales/kariboo_returnlabel.html</file>
|
86 |
+
<type>html</type>
|
87 |
+
</kariboo_returnlabel_email_template>
|
88 |
+
</email>
|
89 |
+
</template>
|
90 |
+
</global>
|
91 |
+
<frontend>
|
92 |
+
<layout>
|
93 |
+
<updates>
|
94 |
+
<kariboo_shipping>
|
95 |
+
<file>kariboo_shipping.xml</file>
|
96 |
+
</kariboo_shipping>
|
97 |
+
</updates>
|
98 |
+
</layout>
|
99 |
+
<events>
|
100 |
+
<core_block_abstract_to_html_after>
|
101 |
+
<observers>
|
102 |
+
<karibooshipping>
|
103 |
+
<class>kariboo_shipping/observer</class>
|
104 |
+
<method>core_block_abstract_to_html_after</method>
|
105 |
+
</karibooshipping>
|
106 |
+
</observers>
|
107 |
+
</core_block_abstract_to_html_after>
|
108 |
+
<checkout_controller_onepage_save_shipping_method>
|
109 |
+
<observers>
|
110 |
+
<karibooshipping>
|
111 |
+
<type>singleton</type>
|
112 |
+
<class>kariboo_shipping/observer</class>
|
113 |
+
<method>checkout_controller_onepage_save_shipping_method</method>
|
114 |
+
</karibooshipping>
|
115 |
+
</observers>
|
116 |
+
</checkout_controller_onepage_save_shipping_method>
|
117 |
+
<controller_action_postdispatch_checkout_onepage_saveBilling>
|
118 |
+
<observers>
|
119 |
+
<karibooshipping>
|
120 |
+
<type>singleton</type>
|
121 |
+
<class>kariboo_shipping/observer</class>
|
122 |
+
<method>controller_action_postdispatch_checkout_onepage_saveAddress</method>
|
123 |
+
</karibooshipping>
|
124 |
+
</observers>
|
125 |
+
</controller_action_postdispatch_checkout_onepage_saveBilling>
|
126 |
+
<controller_action_postdispatch_checkout_onepage_saveShipping>
|
127 |
+
<observers>
|
128 |
+
<karibooshipping>
|
129 |
+
<type>singleton</type>
|
130 |
+
<class>kariboo_shipping/observer</class>
|
131 |
+
<method>controller_action_postdispatch_checkout_onepage_saveAddress</method>
|
132 |
+
</karibooshipping>
|
133 |
+
</observers>
|
134 |
+
</controller_action_postdispatch_checkout_onepage_saveShipping>
|
135 |
+
<checkout_submit_all_after>
|
136 |
+
<observers>
|
137 |
+
<karibooshipping>
|
138 |
+
<class>kariboo_shipping/observer</class>
|
139 |
+
<method>checkout_submit_all_after</method>
|
140 |
+
</karibooshipping>
|
141 |
+
</observers>
|
142 |
+
</checkout_submit_all_after>
|
143 |
+
</events>
|
144 |
+
<translate>
|
145 |
+
<modules>
|
146 |
+
<kariboo_shipping>
|
147 |
+
<files>
|
148 |
+
<default>Kariboo_Shipping.csv</default>
|
149 |
+
</files>
|
150 |
+
</kariboo_shipping>
|
151 |
+
</modules>
|
152 |
+
</translate>
|
153 |
+
<routers>
|
154 |
+
<kariboo>
|
155 |
+
<use>standard</use>
|
156 |
+
<args>
|
157 |
+
<module>Kariboo_Shipping</module>
|
158 |
+
<frontName>kariboo</frontName>
|
159 |
+
</args>
|
160 |
+
</kariboo>
|
161 |
+
</routers>
|
162 |
+
</frontend>
|
163 |
+
<adminhtml>
|
164 |
+
<events>
|
165 |
+
<core_block_abstract_to_html_before>
|
166 |
+
<observers>
|
167 |
+
<karibooshipping>
|
168 |
+
<class>kariboo_shipping/observer</class>
|
169 |
+
<method>core_block_abstract_to_html_before</method>
|
170 |
+
<type>model</type>
|
171 |
+
</karibooshipping>
|
172 |
+
</observers>
|
173 |
+
</core_block_abstract_to_html_before>
|
174 |
+
<sales_order_shipment_save_before>
|
175 |
+
<observers>
|
176 |
+
<karibooshipping>
|
177 |
+
<class>kariboo_shipping/observer</class>
|
178 |
+
<method>sales_order_shipment_save_before</method>
|
179 |
+
<type>model</type>
|
180 |
+
</karibooshipping>
|
181 |
+
</observers>
|
182 |
+
</sales_order_shipment_save_before>
|
183 |
+
</events>
|
184 |
+
<translate>
|
185 |
+
<modules>
|
186 |
+
<kariboo_shipping>
|
187 |
+
<files>
|
188 |
+
<default>Kariboo_Shipping.csv</default>
|
189 |
+
</files>
|
190 |
+
</kariboo_shipping>
|
191 |
+
</modules>
|
192 |
+
</translate>
|
193 |
+
<layout>
|
194 |
+
<updates>
|
195 |
+
<karibooshipping>
|
196 |
+
<file>kariboo_shipping.xml</file>
|
197 |
+
</karibooshipping>
|
198 |
+
</updates>
|
199 |
+
</layout>
|
200 |
+
</adminhtml>
|
201 |
+
<admin>
|
202 |
+
<routers>
|
203 |
+
<adminhtml>
|
204 |
+
<args>
|
205 |
+
<modules>
|
206 |
+
<kariboo_shipping before="Mage_Adminhtml">Kariboo_Shipping_Adminhtml</kariboo_shipping>
|
207 |
+
</modules>
|
208 |
+
</args>
|
209 |
+
</adminhtml>
|
210 |
+
</routers>
|
211 |
+
</admin>
|
212 |
+
<crontab>
|
213 |
+
<jobs>
|
214 |
+
<reload_tracking_status>
|
215 |
+
<schedule>
|
216 |
+
<cron_expr>0 * * * *</cron_expr>
|
217 |
+
</schedule>
|
218 |
+
<run>
|
219 |
+
<model>kariboo_shipping/cron::reloadTrackingStatus</model>
|
220 |
+
</run>
|
221 |
+
</reload_tracking_status>
|
222 |
+
</jobs>
|
223 |
+
</crontab>
|
224 |
+
</config>
|
app/code/community/Kariboo/Shipping/etc/system.xml
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<kariboo>
|
7 |
+
<label>Kariboo! Shipping</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>100</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>10</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<name translate="label">
|
24 |
+
<label>Carrier Name</label>
|
25 |
+
<comment>The name of the shipping method</comment>
|
26 |
+
<frontend_type>text</frontend_type>
|
27 |
+
<sort_order>20</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>1</show_in_store>
|
31 |
+
</name>
|
32 |
+
<sort_order translate="label">
|
33 |
+
<label>Sort Order</label>
|
34 |
+
<comment>The order in which the shipping method should appear</comment>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>30</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
</sort_order>
|
41 |
+
<default_selected>
|
42 |
+
<label>Default Selected</label>
|
43 |
+
<frontend_type>select</frontend_type>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<sort_order>40</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<comment>Automatically selects this shipping method during checkout by default</comment>
|
50 |
+
</default_selected>
|
51 |
+
<rate_type translate="label">
|
52 |
+
<label>Rate type</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>kariboo_shipping/system_config_source_ratetypes</source_model>
|
55 |
+
<sort_order>50</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
<comment>You can use flat rate or calculated table rates</comment>
|
60 |
+
</rate_type>
|
61 |
+
<flat_rate_price translate="label">
|
62 |
+
<label>Flat rate price</label>
|
63 |
+
<frontend_type>text</frontend_type>
|
64 |
+
<sort_order>60</sort_order>
|
65 |
+
<depends>
|
66 |
+
<rate_type>0</rate_type>
|
67 |
+
</depends>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Fixed fee for Kariboo! shipments</comment>
|
72 |
+
</flat_rate_price>
|
73 |
+
<table_rate_condition translate="label">
|
74 |
+
<label>Table rates condition</label>
|
75 |
+
<frontend_type>select</frontend_type>
|
76 |
+
<source_model>adminhtml/system_config_source_shipping_tablerate</source_model>
|
77 |
+
<sort_order>70</sort_order>
|
78 |
+
<depends>
|
79 |
+
<rate_type>1</rate_type>
|
80 |
+
</depends>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>0</show_in_store>
|
84 |
+
</table_rate_condition>
|
85 |
+
<table_rate_file translate="label">
|
86 |
+
<label>Import table rates file</label>
|
87 |
+
<frontend_type>import</frontend_type>
|
88 |
+
<sort_order>80</sort_order>
|
89 |
+
<backend_model>kariboo_shipping/system_config_backend_shipping_tablerate</backend_model>
|
90 |
+
<depends>
|
91 |
+
<rate_type>1</rate_type>
|
92 |
+
</depends>
|
93 |
+
<show_in_default>0</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>0</show_in_store>
|
96 |
+
<comment>Upload your table rates configuration here. Refer to the manual for more information</comment>
|
97 |
+
</table_rate_file>
|
98 |
+
<export translate="label">
|
99 |
+
<label>Export table rates file</label>
|
100 |
+
<frontend_type>button</frontend_type>
|
101 |
+
<frontend_model>kariboo_shipping/adminhtml_system_config_form_export</frontend_model>
|
102 |
+
<sort_order>85</sort_order>
|
103 |
+
<depends>
|
104 |
+
<rate_type>1</rate_type>
|
105 |
+
</depends>
|
106 |
+
<show_in_default>0</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>0</show_in_store>
|
109 |
+
<comment>Export your table rates configuration here</comment>
|
110 |
+
</export>
|
111 |
+
<sallowspecific translate="label">
|
112 |
+
<label>Ship to countries</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<sort_order>90</sort_order>
|
115 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
116 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>0</show_in_store>
|
120 |
+
<comment>Make Kariboo! available in all countries or in specific</comment>
|
121 |
+
</sallowspecific>
|
122 |
+
<specificcountry translate="label">
|
123 |
+
<label>Allowed countries</label>
|
124 |
+
<frontend_type>multiselect</frontend_type>
|
125 |
+
<sort_order>100</sort_order>
|
126 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
<can_be_empty>1</can_be_empty>
|
131 |
+
<comment>Select one or more countries where Kariboo! should be available for</comment>
|
132 |
+
</specificcountry>
|
133 |
+
<google_maps_api translate="label">
|
134 |
+
<label>Google Maps API</label>
|
135 |
+
<frontend_type>text</frontend_type>
|
136 |
+
<sort_order>120</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
<comment><![CDATA[<a href="https://developers.google.com/maps/documentation/javascript/tutorial?hl=nl#api_key" target="_blank">How to request an API key</a>]]></comment>
|
141 |
+
</google_maps_api>
|
142 |
+
<google_maps_width translate="label">
|
143 |
+
<label>Map width</label>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>130</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
<comment>Width of the inline map (in px)</comment>
|
150 |
+
</google_maps_width>
|
151 |
+
<google_maps_height translate="label">
|
152 |
+
<label>Map height</label>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>140</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
<comment>Height of the inline map (in px)</comment>
|
159 |
+
</google_maps_height>
|
160 |
+
<google_maps_display translate="label">
|
161 |
+
<label>Map presentation</label>
|
162 |
+
<frontend_type>select</frontend_type>
|
163 |
+
<frontend_type>select</frontend_type>
|
164 |
+
<source_model>kariboo_shipping/system_config_source_display</source_model>
|
165 |
+
<sort_order>160</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>Show the map inline or as an overlay</comment>
|
170 |
+
</google_maps_display>
|
171 |
+
<google_maps_enable_list translate="label">
|
172 |
+
<label>Map list</label>
|
173 |
+
<frontend_type>select</frontend_type>
|
174 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
175 |
+
<sort_order>170</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>1</show_in_website>
|
178 |
+
<show_in_store>1</show_in_store>
|
179 |
+
<comment>Show the list of Kariboo!-spots to the right of the map</comment>
|
180 |
+
</google_maps_enable_list>
|
181 |
+
</fields>
|
182 |
+
</kariboo>
|
183 |
+
</groups>
|
184 |
+
</carriers>
|
185 |
+
<shipping>
|
186 |
+
<groups>
|
187 |
+
<kariboo>
|
188 |
+
<label>Kariboo! Shipping</label>
|
189 |
+
<frontend_type>text</frontend_type>
|
190 |
+
<sort_order>10</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>1</show_in_store>
|
194 |
+
<fields>
|
195 |
+
<webservice_url translate="label">
|
196 |
+
<label>Webservice Url</label>
|
197 |
+
<frontend_type>text</frontend_type>
|
198 |
+
<sort_order>1</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
<comment>Do NOT change unless instructed by Kariboo!</comment>
|
203 |
+
</webservice_url>
|
204 |
+
<authorization_code translate="label">
|
205 |
+
<label>Authorization Code</label>
|
206 |
+
<frontend_type>obscure</frontend_type>
|
207 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
208 |
+
<sort_order>2</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>1</show_in_store>
|
212 |
+
<comment>Please contact Kariboo! for your authorization code</comment>
|
213 |
+
</authorization_code>
|
214 |
+
<weight_unit>
|
215 |
+
<label>Weight unit</label>
|
216 |
+
<frontend_type>select</frontend_type>
|
217 |
+
<source_model>kariboo_shipping/system_config_source_weightunit</source_model>
|
218 |
+
<sort_order>3</sort_order>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>1</show_in_website>
|
221 |
+
<show_in_store>1</show_in_store>
|
222 |
+
<comment>Select the unit of the weight attribute of products</comment>
|
223 |
+
</weight_unit>
|
224 |
+
</fields>
|
225 |
+
</kariboo>
|
226 |
+
</groups>
|
227 |
+
</shipping>
|
228 |
+
<payment>
|
229 |
+
<groups>
|
230 |
+
<kariboocod translate="label">
|
231 |
+
<label>Kariboo! COD</label>
|
232 |
+
<frontend_type>text</frontend_type>
|
233 |
+
<sort_order>10</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>1</show_in_website>
|
236 |
+
<show_in_store>1</show_in_store>
|
237 |
+
<fields>
|
238 |
+
<active translate="label">
|
239 |
+
<label>Enabled</label>
|
240 |
+
<frontend_type>select</frontend_type>
|
241 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
242 |
+
<sort_order>0</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
</active>
|
247 |
+
<title translate="label">
|
248 |
+
<label>Title</label>
|
249 |
+
<frontend_type>text</frontend_type>
|
250 |
+
<sort_order>5</sort_order>
|
251 |
+
<show_in_default>1</show_in_default>
|
252 |
+
<show_in_website>1</show_in_website>
|
253 |
+
<show_in_store>1</show_in_store>
|
254 |
+
<comment>The name of the payment method</comment>
|
255 |
+
</title>
|
256 |
+
<sort_order translate="label">
|
257 |
+
<label>Sort Order</label>
|
258 |
+
<frontend_type>text</frontend_type>
|
259 |
+
<sort_order>10</sort_order>
|
260 |
+
<show_in_default>1</show_in_default>
|
261 |
+
<show_in_website>1</show_in_website>
|
262 |
+
<show_in_store>1</show_in_store>
|
263 |
+
<comment>The order in which the payment method should appear</comment>
|
264 |
+
</sort_order>
|
265 |
+
<allowspecific translate="label">
|
266 |
+
<label>Payment from Applicable Countries</label>
|
267 |
+
<frontend_type>allowspecific</frontend_type>
|
268 |
+
<sort_order>20</sort_order>
|
269 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
270 |
+
<show_in_default>1</show_in_default>
|
271 |
+
<show_in_website>1</show_in_website>
|
272 |
+
<show_in_store>1</show_in_store>
|
273 |
+
</allowspecific>
|
274 |
+
<specificcountry translate="label">
|
275 |
+
<label>Payment from Specific Countries</label>
|
276 |
+
<frontend_type>multiselect</frontend_type>
|
277 |
+
<sort_order>25</sort_order>
|
278 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
279 |
+
<show_in_default>1</show_in_default>
|
280 |
+
<show_in_website>1</show_in_website>
|
281 |
+
<show_in_store>1</show_in_store>
|
282 |
+
<comment>Select one or more countries where Kariboo! COD should be available</comment>
|
283 |
+
</specificcountry>
|
284 |
+
</fields>
|
285 |
+
</kariboocod>
|
286 |
+
</groups>
|
287 |
+
</payment>
|
288 |
+
</sections>
|
289 |
+
</config>
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Customer_Model_Entity_Setup */
|
12 |
+
$installer = new Mage_Customer_Model_Entity_Setup;
|
13 |
+
|
14 |
+
$installer->addAttribute('customer', 'kariboo_shopid', array(
|
15 |
+
'label' => 'Kariboo ShopID',
|
16 |
+
'type' => 'varchar',
|
17 |
+
'input' => 'text',
|
18 |
+
'visible' => false,
|
19 |
+
'required' => false,
|
20 |
+
));
|
21 |
+
|
22 |
+
?>
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.1-0.0.2.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//create the return label table
|
16 |
+
$table_returnLabel = $installer->getConnection()->newTable($installer->getTable('kariboo_shipping_returnlabel'))
|
17 |
+
->addColumn('label_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
18 |
+
'unsigned' => true,
|
19 |
+
'nullable' => false,
|
20 |
+
'primary' => true,
|
21 |
+
'identity' => true,
|
22 |
+
), 'Label unique ID')
|
23 |
+
->addColumn('label_barcode', Varien_Db_Ddl_Table::TYPE_VARCHAR,255,array(
|
24 |
+
'nullable' => false,
|
25 |
+
'default' => "",
|
26 |
+
),"Barcode of the Label")
|
27 |
+
->addColumn('label_pdf_path', Varien_Db_Ddl_Table::TYPE_VARCHAR,255,array(
|
28 |
+
'nullable' => false,
|
29 |
+
),"Local path of the pdf file")
|
30 |
+
->addColumn('order_id',Varien_Db_Ddl_Table::TYPE_INTEGER,11,array(
|
31 |
+
'nullable' => false,
|
32 |
+
),"Id of the order")
|
33 |
+
->addColumn('date_created', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
|
34 |
+
), 'Creation Date')
|
35 |
+
->setComment('Kariboo! Shipping Return Labels');
|
36 |
+
$installer->getConnection()->createTable($table_returnLabel);
|
37 |
+
|
38 |
+
//add the tablerate table
|
39 |
+
$table_tableRate = $installer->getConnection()->newTable($installer->getTable('kariboo_shipping_tablerate'))
|
40 |
+
->addColumn('pk', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
|
41 |
+
'unsigned' => true,
|
42 |
+
'nullable' => false,
|
43 |
+
'primary' => true,
|
44 |
+
'identity' => true,
|
45 |
+
), 'Primary key')
|
46 |
+
->addColumn('website_id',Varien_Db_Ddl_Table::TYPE_INTEGER,11,array(
|
47 |
+
'nullable' => false,
|
48 |
+
'default' => '0',
|
49 |
+
),"Website Id")
|
50 |
+
->addColumn('dest_country_id', Varien_Db_Ddl_Table::TYPE_VARCHAR,4,array(
|
51 |
+
'nullable' => false,
|
52 |
+
'default' => '0',
|
53 |
+
),"Destination coutry ISO/2 or ISO/3 code")
|
54 |
+
->addColumn('dest_region_id', Varien_Db_Ddl_Table::TYPE_INTEGER,11,array(
|
55 |
+
'nullable' => false,
|
56 |
+
'default' => '0',
|
57 |
+
),"Destination Region Id")
|
58 |
+
->addColumn('dest_zip', Varien_Db_Ddl_Table::TYPE_VARCHAR,10,array(
|
59 |
+
'nullable' => false,
|
60 |
+
'default' => "*",
|
61 |
+
),"Destination Post Code (Zip)")
|
62 |
+
->addColumn('condition_name', Varien_Db_Ddl_Table::TYPE_VARCHAR,20,array(
|
63 |
+
'nullable' => false,
|
64 |
+
),"Rate Condition name")
|
65 |
+
->addColumn('condition_value', Varien_Db_Ddl_Table::TYPE_DECIMAL,array(12,4),array(
|
66 |
+
'nullable' => false,
|
67 |
+
'default' => "0.0000",
|
68 |
+
),"Rate condition value")
|
69 |
+
->addColumn('price', Varien_Db_Ddl_Table::TYPE_DECIMAL,array(12,4),array(
|
70 |
+
'nullable' => false,
|
71 |
+
'default' => "0.0000",
|
72 |
+
),"Price")
|
73 |
+
->addColumn('cost', Varien_Db_Ddl_Table::TYPE_DECIMAL,array(12,4),array(
|
74 |
+
'nullable' => false,
|
75 |
+
'default' => "0.0000",
|
76 |
+
),"Cost")
|
77 |
+
->setComment('Kariboo! Shipping TableRate');
|
78 |
+
$installer->getConnection()->createTable($table_tableRate);
|
79 |
+
|
80 |
+
//sales/shipment
|
81 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/shipment'), 'kariboo_label_exported', "int(11) null");
|
82 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/shipment'), 'kariboo_label_path', "varchar(255) null default ''");
|
83 |
+
|
84 |
+
//sales/quote
|
85 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'kariboo_spotid', "varchar(255) null");
|
86 |
+
|
87 |
+
//sales/order
|
88 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'kariboo_spotid', "varchar(255) null");
|
89 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'kariboo_label_exported', "bool null default 0");
|
90 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'kariboo_label_exists', "bool null default 0");
|
91 |
+
|
92 |
+
$installer->endSetup();
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.2-0.0.3.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//sales/shipment/track
|
16 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/shipment_track'),
|
17 |
+
'kariboo_status',
|
18 |
+
array(
|
19 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
20 |
+
'nullable' => false,
|
21 |
+
'default' => 0,
|
22 |
+
'comment' => "Tracking Status"
|
23 |
+
));
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.3-0.0.4.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'kariboo_original_shippingaddress', "TEXT");
|
16 |
+
|
17 |
+
$installer->endSetup();
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.4-0.0.5.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//sales/shipment/track
|
16 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/shipment_track'),
|
17 |
+
'kariboo_text',
|
18 |
+
array(
|
19 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
20 |
+
'nullable' => true,
|
21 |
+
'default' => null,
|
22 |
+
'comment' => "Tracking Status Text"
|
23 |
+
));
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/code/community/Kariboo/Shipping/sql/kariboo_setup/mysql4-upgrade-0.0.5-0.0.6.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//sales/shipment/track
|
16 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/shipment'),
|
17 |
+
'kariboo_return_barcode',
|
18 |
+
array(
|
19 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
20 |
+
'nullable' => true,
|
21 |
+
'default' => null,
|
22 |
+
'comment' => "Automatic Kariboo! return barcode"
|
23 |
+
));
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/kariboo_shipping.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
<action method="addTab">
|
6 |
+
<name>order_view_tab_karibooreturnlabeltab</name>
|
7 |
+
<block>kariboo_shipping/adminhtml_sales_order_view_tab_returnlabels</block>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
<reference name="sales_order_tabs">
|
11 |
+
<action method="addTab">
|
12 |
+
<name>order_view_tab_karibooreturnbarcodetab</name>
|
13 |
+
<block>kariboo_shipping/adminhtml_sales_order_view_tab_returnbarcode</block>
|
14 |
+
</action>
|
15 |
+
</reference>
|
16 |
+
</adminhtml_sales_order_view>
|
17 |
+
</layout>
|
app/design/frontend/base/default/layout/kariboo_shipping.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<checkout_onepage_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs">
|
6 |
+
<script>kariboo/shipping/checkout.js</script>
|
7 |
+
</action>
|
8 |
+
<action method="addJs">
|
9 |
+
<script>prototype/window.js</script>
|
10 |
+
</action>
|
11 |
+
<action method="addCss">
|
12 |
+
<name>css/kariboo/window.css</name>
|
13 |
+
</action>
|
14 |
+
<block type="core/template" name="gmapsapi" template="kariboo/shipping/gmapsapi.phtml"/>
|
15 |
+
</reference>
|
16 |
+
</checkout_onepage_index>
|
17 |
+
<kariboo_ajax_getwindow>
|
18 |
+
<reference name="root">
|
19 |
+
<action method="setTemplate">
|
20 |
+
<template>page/empty.phtml</template>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
<reference name="content">
|
24 |
+
<block type="kariboo_shipping/carrier_kariboo" name="kariboo" template="kariboo/shipping/kariboo_checkout_spots.phtml"/>
|
25 |
+
</reference>
|
26 |
+
</kariboo_ajax_getwindow>
|
27 |
+
</layout>
|
app/design/frontend/base/default/template/kariboo/shipping/gmapsapi.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
/**
|
11 |
+
* Import the api with or without key in header.
|
12 |
+
*/
|
13 |
+
?>
|
14 |
+
<?php if (Mage::getStoreConfig('carriers/kariboo/google_maps_api') != ""): ?>
|
15 |
+
<script
|
16 |
+
src="https://maps.googleapis.com/maps/api/js?key=<?php echo Mage::getStoreConfig('carriers/kariboo/google_maps_api') ?>&sensor=false&v=3.17&sensor=false&libraries=geometry"
|
17 |
+
type="text/javascript"></script>
|
18 |
+
<?php else: ?>
|
19 |
+
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&v=3.17&sensor=false&libraries=geometry" type="text/javascript"></script>
|
20 |
+
<?php endif; ?>
|
21 |
+
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js"></script>
|
app/design/frontend/base/default/template/kariboo/shipping/kariboo_checkout_append.phtml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PHPro
|
4 |
+
*
|
5 |
+
* @package Kariboo
|
6 |
+
* @subpackage Shipping
|
7 |
+
* @category Checkout
|
8 |
+
* @author PHPro (info@phpro.be)
|
9 |
+
*/
|
10 |
+
|
11 |
+
$suggested_spot = $this->getResult();
|
12 |
+
if ($suggested_spot == null) {
|
13 |
+
$suggested_spot_json = null;
|
14 |
+
} else {
|
15 |
+
$suggested_spot->days = Mage::helper('kariboo_shipping')->getJsDaysArray();
|
16 |
+
$suggested_spot_json = json_encode($suggested_spot);
|
17 |
+
}
|
18 |
+
$settings = array(
|
19 |
+
"display" => Mage::getStoreConfig("carriers/kariboo/google_maps_display"),
|
20 |
+
"list" => Mage::getStoreConfig("carriers/kariboo/google_maps_enable_list"),
|
21 |
+
"width" => Mage::getStoreConfig("carriers/kariboo/google_maps_width"),
|
22 |
+
"height" => Mage::getStoreConfig("carriers/kariboo/google_maps_height"),
|
23 |
+
"default_selected" => Mage::getStoreConfig("carriers/kariboo/default_selected"),
|
24 |
+
"imgpath" => DS . "skin" . DS . "frontend" . DS . "base" . DS . "default" . DS . "images" . DS . "kariboo" . DS,
|
25 |
+
"label_click" => Mage::helper('kariboo_shipping')->__("Click here to select your Kariboo!-spot"),
|
26 |
+
"label_change" => Mage::helper('kariboo_shipping')->__("Click here to change your Kariboo!-spot"),
|
27 |
+
"label_openafter" => Mage::helper('kariboo_shipping')->__("Open after 16h"),
|
28 |
+
"label_opensund" => Mage::helper('kariboo_shipping')->__("Open Sunday"),
|
29 |
+
"label_filter" => Mage::helper('kariboo_shipping')->__("Filter"),
|
30 |
+
"label_select" => Mage::helper('kariboo_shipping')->__("Select"),
|
31 |
+
"label_postcode" => Mage::helper('kariboo_shipping')->__("Postal code"),
|
32 |
+
'label_loading' => Mage::helper('kariboo_shipping')->__("Loading please wait.."),
|
33 |
+
'base_url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)
|
34 |
+
);
|
35 |
+
$message = $settings['label_click'];
|
36 |
+
?>
|
37 |
+
<div id="kariboospots" class="kariboospotswrapper">
|
38 |
+
<div id="karibooinfo"></div>
|
39 |
+
<?php if ($suggested_spot != null) { ?>
|
40 |
+
<p class="samespot"><?php echo Mage::helper('kariboo_shipping')->__('Based on your previous order, we already selected the same Kariboo!-spot for you:'); ?></p>
|
41 |
+
<?php $message = $settings['label_change'] ?>
|
42 |
+
<?php } ?>
|
43 |
+
<div id="karibooresult"><?php echo $suggested_spot_json ?></div>
|
44 |
+
<a href="#" id="showspots"><?php echo $message ?></a>
|
45 |
+
<input type="hidden" name="kariboo[spotid]" class="validate-kariboospot"/>
|
46 |
+
<input type="hidden" name="kariboo[street]"/>
|
47 |
+
<input type="hidden" name="kariboo[city]"/>
|
48 |
+
<input type="hidden" name="kariboo[postcode]"/>
|
49 |
+
<input type="hidden" name="kariboo[country]"/>
|
50 |
+
<input type="hidden" name="kariboo[name]"/>
|
51 |
+
<input type="hidden" name="kariboo[cod]"/>
|
52 |
+
</div>
|
53 |
+
<script type="text/javascript">
|
54 |
+
window.karibooShipping = new Kariboo.Shipping(<?php echo json_encode($settings); ?>);
|
55 |
+
Validation.add('validate-kariboospot', '<?php echo Mage::helper('kariboo_shipping')->__('Please select a Kariboo!-spot'); ?>', function (v) {
|
56 |
+
return !($('s_method_kariboo_kariboo').checked && Validation.get('IsEmpty').test(v))
|
57 |
+
});
|
58 |
+
</script>
|
app/etc/modules/zKariboo_Shipping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kariboo_Shipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Kariboo_Shipping>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Kariboo_Shipping.csv
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Click here to select your Kariboo!-spot","Click here to select your Kariboo!-spot"
|
2 |
+
"Click here to change your Kariboo!-spot","Click here to change your Kariboo!-spot"
|
3 |
+
"Open after 16h","Open after 16h"
|
4 |
+
"Open Sunday","Open Sunday"
|
5 |
+
"Filter","Filter"
|
6 |
+
"Select","Select"
|
7 |
+
"Postal code","Postal code"
|
8 |
+
"Kariboo! Orders","Kariboo! Orders"
|
9 |
+
"Generate Label and Complete","Generate Label and Complete"
|
10 |
+
"Generating a label can take up to 1 second per label, please be patient during this process. It can take up to maximum 2 minutes. Do you want to continue?","Generating a label can take up to 1 second per label, please be patient during this process. It can take up to maximum 2 minutes. Do you want to continue?"
|
11 |
+
"Download all undownloaded","Download all undownloaded"
|
12 |
+
"Please refresh the page after downloading to review the confirmation messages including any problems encountered. Continue?","Please refresh the page after downloading to review the confirmation messages including any problems encountered. Continue?"
|
13 |
+
"Kariboo! Return Labels","Kariboo! Return Labels"
|
14 |
+
"Country","Country"
|
15 |
+
"Region/State","Region/State"
|
16 |
+
"Zip/Postal Code","Zip/Postal Code"
|
17 |
+
"Shipping Price","Shipping Price"
|
18 |
+
"Sorry, there was a problem contacting Kariboo! , please contact the store owner for support.","Sorry, there was a problem contacting Kariboo! , please contact the store owner for support."
|
19 |
+
"Your return label has been generated and is available under 'Kariboo! Return Labels' in this order.","Your return label has been generated and is available under 'Kariboo! Return Labels' in this order."
|
20 |
+
"The email with return label and instructions has been sent to %s.","The email with return label and instructions has been sent to %s."
|
21 |
+
"No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview.","No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview."
|
22 |
+
"The order with id %s is not ready to be shipped or has already been shipped.","The order with id %s is not ready to be shipped or has already been shipped."
|
23 |
+
"%s label(s) have been generated for %s order(s) and statuses have been changed.","%s label(s) have been generated for %s order(s) and statuses have been changed."
|
24 |
+
"Some of the selected orders are not ready to be shipped or have already been shipped, operation canceled.","Some of the selected orders are not ready to be shipped or have already been shipped, operation canceled."
|
25 |
+
"No undownloaded labels found.","No undownloaded labels found."
|
26 |
+
"The file(s) could not be downloaded, please check your Kariboo logs.","The file(s) could not be downloaded, please check your Kariboo logs."
|
27 |
+
"Sorry, something went wrong processing your shipping address. Your address was not recognised. Please correct any errors in your shipping address and try again.","Sorry, something went wrong processing your shipping address. Your address was not recognised. Please correct any errors in your shipping address and try again."
|
28 |
+
"Kariboo! Return Label","Kariboo! Return Label"
|
29 |
+
"Download Kariboo! Label","Download Kariboo! Label"
|
30 |
+
"The order with id %s is not ready to be shipped or has already been shipped.","The order with id %s is not ready to be shipped or has already been shipped."
|
31 |
+
"Something went wrong while processing order %s, please check your error logs.","Something went wrong while processing order %s, please check your error logs."
|
32 |
+
"Shipped with Kariboo generateLabelAndComplete","Shipped with Kariboo generateLabelAndComplete"
|
33 |
+
"The order with id %s only has non-Kariboo! shipments.","The order with id %s only has non-Kariboo! shipments."
|
34 |
+
"%s orders already had downloaded labels.","%s orders already had downloaded labels."
|
35 |
+
"All labels have been downloaded.","All labels have been downloaded."
|
36 |
+
"Invalid Table Rates File Format","Invalid Table Rates File Format"
|
37 |
+
"An error occurred while importing table rates.","An error occurred while importing table rates."
|
38 |
+
"File has not been imported. See the following list of errors: %s","File has not been imported. See the following list of errors: %s"
|
39 |
+
"Invalid Table Rates format in the Row #%s","Invalid Table Rates format in the Row #%s"
|
40 |
+
"Invalid Country "%s" in the Row #%s.","Invalid Country "%s" in the Row #%s."
|
41 |
+
"Invalid Region/State "%s" in the Row #%s.","Invalid Region/State "%s" in the Row #%s."
|
42 |
+
"Invalid %s "%s" in the Row #%s.","Invalid %s "%s" in the Row #%s."
|
43 |
+
"Invalid Shipping Price "%s" in the Row #%s.","Invalid Shipping Price "%s" in the Row #%s."
|
44 |
+
"Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s").","Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s")."
|
45 |
+
"This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.","This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us."
|
46 |
+
"Overlay","Overlay"
|
47 |
+
"Inline","Inline"
|
48 |
+
"Table Rates","Table Rates"
|
49 |
+
"Flat Rate","Flat Rate"
|
50 |
+
"Loading please wait..","Loading please wait.."
|
51 |
+
"Based on your previous order, we already selected the same Kariboo!-spot for you:","Based on your previous order, we already selected the same Kariboo!-spot for you:"
|
52 |
+
"Ma","Mo"
|
53 |
+
"Di","Thu"
|
54 |
+
"Wo","Wed"
|
55 |
+
"Do","Thu"
|
56 |
+
"Vr","Fri"
|
57 |
+
"Za","Sa"
|
58 |
+
"Zo","Sun"
|
app/locale/en_US/template/email/sales/kariboo_returnlabel.html
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var store.getFrontendName()}}: New returnlabel #{{var returnlabel.label_barcode}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"var logo_url":"Email Logo Image Url",
|
5 |
+
"var logo_alt":"Email Logo Image Alt",
|
6 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
7 |
+
"var order":"order object",
|
8 |
+
"var returnlabel":"return label object"}
|
9 |
+
|
10 |
+
@-->
|
11 |
+
<!--@styles
|
12 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
13 |
+
@-->
|
14 |
+
|
15 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
16 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
17 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
18 |
+
<tr>
|
19 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
20 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
21 |
+
<!-- [ header starts here] -->
|
22 |
+
<tr>
|
23 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
|
24 |
+
</tr>
|
25 |
+
<!-- [ middle starts here] -->
|
26 |
+
<tr>
|
27 |
+
<td valign="top">
|
28 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
|
29 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
30 |
+
You can find your returnlabel in the attachments of this email.
|
31 |
+
</p>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
36 |
+
</tr>
|
37 |
+
</table>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
41 |
+
</div>
|
42 |
+
</body>
|
app/locale/fr_FR/template/email/sales/kariboo_returnlabel.html
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var store.getFrontendName()}}: Nouveau étiquette de retour #{{var returnlabel.label_barcode}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"var logo_url":"Email Logo Image Url",
|
5 |
+
"var logo_alt":"Email Logo Image Alt",
|
6 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
7 |
+
"var order":"order object",
|
8 |
+
"var returnlabel":"return label object"}
|
9 |
+
|
10 |
+
@-->
|
11 |
+
<!--@styles
|
12 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
13 |
+
@-->
|
14 |
+
|
15 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
16 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
17 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
18 |
+
<tr>
|
19 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
20 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
21 |
+
<!-- [ header starts here] -->
|
22 |
+
<tr>
|
23 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
|
24 |
+
</tr>
|
25 |
+
<!-- [ middle starts here] -->
|
26 |
+
<tr>
|
27 |
+
<td valign="top">
|
28 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Cher, {{htmlescape var=$order.getCustomerName()}}</h1>
|
29 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
30 |
+
Vous pouvez trouver votre étiquette de retour dans les pièces jointes de cet email .
|
31 |
+
</p>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Merci, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
36 |
+
</tr>
|
37 |
+
</table>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
41 |
+
</div>
|
42 |
+
</body>
|
app/locale/nl_NL/Kariboo_Shipping.csv
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Click here to select your Kariboo!-spot","Klik hier om uw Kariboo!-spot te selecteren"
|
2 |
+
"Click here to change your Kariboo!-spot","Klik hier om uw Kariboo!-spot te veranderen"
|
3 |
+
"Open after 16h","Open na 16 uur"
|
4 |
+
"Open Sunday","Open op zondag"
|
5 |
+
"Filter","Filteren"
|
6 |
+
"Select","Selecteren"
|
7 |
+
"Postal code","Postcode"
|
8 |
+
"Kariboo! Orders","Kariboo! Bestellingen"
|
9 |
+
"Generate Label and Complete","Label maken en invullen"
|
10 |
+
"Generating a label can take up to 1 second per label, please be patient during this process. It can take up to maximum 2 minutes. Do you want to continue?","Een label maken duurt 1 seconde per label, wees a.u.b. geduldig tijdens dit proces. Het kan tot maximaal 2 minuten duren. Wilt u verdergaan?"
|
11 |
+
"Download all undownloaded","Alle niet-gedownloade items downloaden"
|
12 |
+
"Please refresh the page after downloading to review the confirmation messages including any problems encountered. Continue?","A.u.b. na het downloaden de pagina verversen om bevestigingsboodschappen over mogelijke problemen te bekijken. Verdergaan?"
|
13 |
+
"Kariboo! Return Labels","Kariboo! Retourlabels"
|
14 |
+
"Country","Land"
|
15 |
+
"Region/State","Streek/Provincie"
|
16 |
+
"Zip/Postal Code","Postcode"
|
17 |
+
"Shipping Price","Verzendingsprijs"
|
18 |
+
"Sorry, there was a problem contacting Kariboo! , please contact the store owner for support.","Sorry, er was een probleem bij het contacteren van Kariboo!, neem a.u.b. contact op met de winkeleigenaar voor hulp."
|
19 |
+
"Your return label has been generated and is available under 'Kariboo! Return Labels' in this order.","Uw retourlabel is klaar en beschikbaar onder 'Kariboo! Retourlabels' in deze bestelling."
|
20 |
+
"The email with return label and instructions has been sent to %s.","De e-mail met het retourlabel en de richtlijnen werd gestuurd naar %s."
|
21 |
+
"No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview.","Er is nog geen label gemaakt gelieve a.u.b. de handeling 'Label maken en invullen' in het overzicht uitvoeren."
|
22 |
+
"The order with id %s is not ready to be shipped or has already been shipped.","De bestelling met id %s werd nog niet verzonden of is al verzonden."
|
23 |
+
"%s label(s) have been generated for %s order(s) and statuses have been changed.","Er werden %s label(s) gemaakt voor %s bestelling(en) en de statussen werden veranderd."
|
24 |
+
"Some of the selected orders are not ready to be shipped or have already been shipped, operation canceled.","Bepaalde geselecteerde bestellingen zijn nog niet klaar voor verzending of zijn al verzonden, verzending geannuleerd."
|
25 |
+
"No undownloaded labels found.","Geen niet-gedownloade labels gevonden.."
|
26 |
+
"The file(s) could not be downloaded, please check your Kariboo logs.","Het(de) bestand(en) kon(konden) niet worden gedownload,gelieve a.u.b. uw Kariboo-rapporten controleren."
|
27 |
+
"Sorry, something went wrong processing your shipping address. Your address was not recognised. Please correct any errors in your shipping address and try again.","Sorry, er is iets verkeerd gegaan tijdens het verwerken van uw verzendingsadres. Uw adres werd niet herkend. A.u.b. mogelijke fouten in uw verzendingsadres verbeteren en opnieuw proberen."
|
28 |
+
"Kariboo! Return Label","Kariboo! Retourlabel"
|
29 |
+
"Download Kariboo! Label","Kariboo! Label downloaden"
|
30 |
+
"The order with id %s is not ready to be shipped or has already been shipped.","De bestelling met id %s is nog niet klaar voor verzending of werd al verzonden."
|
31 |
+
"Something went wrong while processing order %s, please check your error logs.","Er is iets verkeerd gegaan tijdens het verwerken van de bestelling %s,gelieve a.u.b. uw foutrapporten controleren."
|
32 |
+
"Shipped with Kariboo generateLabelAndComplete","Verzonden met Kariboo Label maken en invullen"
|
33 |
+
"The order with id %s only has non-Kariboo! shipments.","De bestelling met id %s heeft geen Kariboo verzendingen."
|
34 |
+
"%s orders already had downloaded labels.","Er werden al %s bestellabels gedownload."
|
35 |
+
"All labels have been downloaded.","Alle labels werden gedownload."
|
36 |
+
"Invalid Table Rates File Format","Ongeldig tabelprijzen bestandsformaat"
|
37 |
+
"An error occurred while importing table rates.","Er is een fout opgetreden tijdens het importeren van tabelprijzen."
|
38 |
+
"File has not been imported. See the following list of errors: %s","Het bestand werd niet geïmporteerd. Zie de volgende lijst met fouten: %s"
|
39 |
+
"Invalid Table Rates format in the Row #%s","Ongeldig formaat tabelprijzen in rij #%s"
|
40 |
+
"Invalid Country "%s" in the Row #%s.","Ongeldig land""%s""in rij #%s."
|
41 |
+
"Invalid Region/State "%s" in the Row #%s.","Ongeldige streek/provincie %s""in rij #%s."
|
42 |
+
"Invalid %s "%s" in the Row #%s.","Ongeldig %s""%s""in rij #%s."
|
43 |
+
"Invalid Shipping Price "%s" in the Row #%s.","Ongeldige verzendingsprijs""%s""in rij #%s."
|
44 |
+
"Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s").","Rij #%s (Land %s"", Streek/provincie""%s"", postcode""%s""en waarde""%s"") is 2 maal opgegeven."
|
45 |
+
"This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.","Deze verzendingsmethode is momenteel niet beschikbaar. Als u deze verzendingsmethode wilt gebruiken, neem dan contact met ons op."
|
46 |
+
"Overlay","Popup"
|
47 |
+
"Inline","Gealigneerd"
|
48 |
+
"Table Rates","Tabelprijzen”"
|
49 |
+
"Flat Rate","Vaste prijs"
|
50 |
+
"Loading please wait..","Bezig met laden, wachten a.u.b.."
|
51 |
+
"Based on your previous order, we already selected the same Kariboo!-spot for you:","Op basis van uw eerdere bestelling hebben wij al dezelfde Kariboo!-spot voor u gekozen:"
|
52 |
+
"Please select a Kariboo!-spot","Gelieve een Kariboo!-spot te selecteren"
|
53 |
+
"Real-time data is not available at the moment, last status update is from %s","Real-time gegevens zijn momenteel niet beschikbaar, de laatste update dateerd van %s"
|
54 |
+
"Tracking info is not available. Please contact the store owner.","De leveringsinformatie is niet beschikbaar, gelieve de winkeleigenaar te contacteren."
|
55 |
+
"This order did not (yet) generate labels which automatically returned return label barcodes. This feature might not be active for your account. Please refer to the documentation or your Kariboo! accountmanager for more information."
|
56 |
+
"Ma","Ma"
|
57 |
+
"Di","Di"
|
58 |
+
"Wo","Wo"
|
59 |
+
"Do","Do"
|
60 |
+
"Vr","Vr"
|
61 |
+
"Za","Za"
|
62 |
+
"Zo","Zo"
|
app/locale/nl_NL/template/email/sales/kariboo_returnlabel.html
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var store.getFrontendName()}}: Nieuw retourlabel #{{var returnlabel.label_barcode}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"var logo_url":"Email Logo Image Url",
|
5 |
+
"var logo_alt":"Email Logo Image Alt",
|
6 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
7 |
+
"var order":"order object",
|
8 |
+
"var returnlabel":"return label object"}
|
9 |
+
|
10 |
+
@-->
|
11 |
+
<!--@styles
|
12 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
13 |
+
@-->
|
14 |
+
|
15 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
16 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
17 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
18 |
+
<tr>
|
19 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
20 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
21 |
+
<!-- [ header starts here] -->
|
22 |
+
<tr>
|
23 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
|
24 |
+
</tr>
|
25 |
+
<!-- [ middle starts here] -->
|
26 |
+
<tr>
|
27 |
+
<td valign="top">
|
28 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Beste, {{htmlescape var=$order.getCustomerName()}}</h1>
|
29 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
30 |
+
U kan uw retourlabel terugvinden in de bijlage van deze e-mail.
|
31 |
+
</p>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Bedankt, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
36 |
+
</tr>
|
37 |
+
</table>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
41 |
+
</div>
|
42 |
+
</body>
|
js/kariboo/shipping/checkout.js
ADDED
@@ -0,0 +1,601 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Object.extend(Prototype.Browser, {
|
2 |
+
IE6: (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ? (Number(RegExp.$1) == 6 ? true : false) : false,
|
3 |
+
IE7: (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ? (Number(RegExp.$1) == 7 ? true : false) : false,
|
4 |
+
IE8: (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ? (Number(RegExp.$1) == 8 ? true : false) : false,
|
5 |
+
IE9: (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ? (Number(RegExp.$1) == 9 ? true : false) : false
|
6 |
+
});
|
7 |
+
if (!window.Kariboo) {
|
8 |
+
window.Kariboo = {};
|
9 |
+
}
|
10 |
+
;
|
11 |
+
Kariboo.Shipping = Class.create({
|
12 |
+
initialize: function (json) {
|
13 |
+
this.settings = json;
|
14 |
+
$$('label[for="s_method_kariboo_kariboo"]').first().insert({'after': $("kariboospots")});
|
15 |
+
this.container = $("kariboospots");
|
16 |
+
this.selectedspot = false;
|
17 |
+
|
18 |
+
this.showSpotsLinkClick = this.showSpotsLinkClick.bind(this);
|
19 |
+
this.resolveSettings = this.resolveSettings.bind(this);
|
20 |
+
this.openModal = this.openModal.bind(this);
|
21 |
+
this.openInline = this.openInline.bind(this);
|
22 |
+
this.drawMap = this.drawMap.bind(this);
|
23 |
+
this.generateHours = this.generateHours.bind(this);
|
24 |
+
this.pinMarkers = this.pinMarkers.bind(this);
|
25 |
+
this.showExtraInfo = this.showExtraInfo.bind(this);
|
26 |
+
this.filterMarkers = this.filterMarkers.bind(this);
|
27 |
+
this.clearMarkers = this.clearMarkers.bind(this);
|
28 |
+
this.closeInfobox = this.closeInfobox.bind(this);
|
29 |
+
this.selectSpot = this.selectSpot.bind(this);
|
30 |
+
this.clickSpot = this.clickSpot.bind(this);
|
31 |
+
this.karibooClose = this.karibooClose.bind(this);
|
32 |
+
this.topClose = this.topClose.bind(this);
|
33 |
+
|
34 |
+
this.imageOpen = {
|
35 |
+
url: this.settings.base_url + 'skin/frontend/base/default/images/kariboo/marker_open.png',
|
36 |
+
size: new google.maps.Size(45, 45),
|
37 |
+
origin: new google.maps.Point(0, 0),
|
38 |
+
anchor: new google.maps.Point(22, 45)
|
39 |
+
};
|
40 |
+
this.mapOptions = {
|
41 |
+
zoom: 11,
|
42 |
+
panControl: false,
|
43 |
+
zoomControl: false,
|
44 |
+
mapTypeControl: false,
|
45 |
+
scaleControl: false,
|
46 |
+
streetViewControl: false,
|
47 |
+
overviewMapControl: false,
|
48 |
+
center: new google.maps.LatLng(51, 4),
|
49 |
+
styles: [
|
50 |
+
{"featureType": "all", "elementType": "all", "stylers": [
|
51 |
+
{"saturation": -93},
|
52 |
+
{"lightness": 8}
|
53 |
+
]},
|
54 |
+
{featureType: "poi", stylers: [
|
55 |
+
{visibility: "off"}
|
56 |
+
]}
|
57 |
+
]
|
58 |
+
};
|
59 |
+
this.infoboxOptions = {
|
60 |
+
content: document.createElement("div"),
|
61 |
+
disableAutoPan: false,
|
62 |
+
maxWidth: 0,
|
63 |
+
pixelOffset: new google.maps.Size(0, -10),
|
64 |
+
zIndex: null,
|
65 |
+
boxStyle: {
|
66 |
+
width: "235px"
|
67 |
+
},
|
68 |
+
closeBoxURL: "",
|
69 |
+
infoBoxClearance: new google.maps.Size(20, 20),
|
70 |
+
isHidden: false,
|
71 |
+
pane: "floatPane",
|
72 |
+
enableEventPropagation: true
|
73 |
+
};
|
74 |
+
this.shape = {
|
75 |
+
coord: [1, 1, 1, 45, 45, 45, 45, 1],
|
76 |
+
type: 'poly'
|
77 |
+
};
|
78 |
+
if (typeof $(document).eventsBinded == "undefined") {
|
79 |
+
this.bindEvents();
|
80 |
+
}
|
81 |
+
$(document).eventsBinded = true;
|
82 |
+
if (this.settings.default_selected == 1) {
|
83 |
+
$("s_method_kariboo_kariboo").checked = true;
|
84 |
+
}
|
85 |
+
//a spot is already suggested.
|
86 |
+
if ($("karibooresult").innerHTML != "") {
|
87 |
+
var json = $("karibooresult").innerHTML.evalJSON(true);
|
88 |
+
this.selectSpot(json);
|
89 |
+
}
|
90 |
+
},
|
91 |
+
bindEvents: function () {
|
92 |
+
//click to open map
|
93 |
+
$(document).on('click', "#showspots", function (event) {
|
94 |
+
event.preventDefault();
|
95 |
+
this.showSpotsLinkClick();
|
96 |
+
}.bind(this));
|
97 |
+
|
98 |
+
//click on the little icon to see more information
|
99 |
+
$(document).on('click', ".infobtn", function (event) {
|
100 |
+
event.preventDefault();
|
101 |
+
this.showExtraInfo();
|
102 |
+
}.bind(this));
|
103 |
+
$(document).on('click', ".info", function (event) {
|
104 |
+
event.preventDefault();
|
105 |
+
this.showExtraInfo();
|
106 |
+
}.bind(this));
|
107 |
+
|
108 |
+
//click on the filter submit
|
109 |
+
$(document).on('click', "#filter_submit", function (event) {
|
110 |
+
event.preventDefault();
|
111 |
+
this.filterMarkers();
|
112 |
+
}.bind(this));
|
113 |
+
|
114 |
+
$(document).on('keypress', ".kariboofilter", function (event) {
|
115 |
+
if (event.keyCode == Event.KEY_RETURN || event.which == Event.KEY_RETURN) {
|
116 |
+
this.filterMarkers();
|
117 |
+
Event.stop(event);
|
118 |
+
}
|
119 |
+
}.bind(this));
|
120 |
+
|
121 |
+
$(document).on('click', '.close-infoBox', function (event) {
|
122 |
+
this.closeInfobox();
|
123 |
+
event.preventDefault();
|
124 |
+
}.bind(this));
|
125 |
+
|
126 |
+
$(document).on('click', '.selectspot', function (event) {
|
127 |
+
this.selectSpot(this.markers[Event.element(event).readAttribute("data-shopid")].json, this.json.days);
|
128 |
+
event.preventDefault();
|
129 |
+
}.bind(this));
|
130 |
+
|
131 |
+
$(document).on('focusin', '#filter_postalcode', function () {
|
132 |
+
this.postalCodeFocus();
|
133 |
+
}.bind(this));
|
134 |
+
|
135 |
+
$(document).on('focusout', '#filter_postalcode', function () {
|
136 |
+
this.postalCodeBlur();
|
137 |
+
}.bind(this));
|
138 |
+
|
139 |
+
$(document).on('click', '.shoplistitem', function (event) {
|
140 |
+
if (!event.target.hasClassName("selectspot")) {
|
141 |
+
this.clickSpot((event.target.up('.shoplistitem') || event.target).id);
|
142 |
+
}
|
143 |
+
}.bind(this));
|
144 |
+
|
145 |
+
$(document).on('click', '.karibooclose', function (event) {
|
146 |
+
this.karibooClose();
|
147 |
+
event.preventDefault();
|
148 |
+
}.bind(this));
|
149 |
+
},
|
150 |
+
topClose: function () {
|
151 |
+
if (this.settings.display == 1) {
|
152 |
+
//callback will go tho karibooclose();
|
153 |
+
this.modal.close();
|
154 |
+
} else {
|
155 |
+
this.karibooClose();
|
156 |
+
}
|
157 |
+
},
|
158 |
+
karibooClose: function () {
|
159 |
+
this.clearMarkers();
|
160 |
+
$("karibooinfo").update("").setStyle({
|
161 |
+
width: 'auto',
|
162 |
+
height: 'auto'
|
163 |
+
});
|
164 |
+
|
165 |
+
$('showspots').style.display = 'inline';
|
166 |
+
|
167 |
+
if (this.selectedspot === false) {
|
168 |
+
$("karibooresult").style.display = "none";
|
169 |
+
} else {
|
170 |
+
$("karibooresult").style.display = "block";
|
171 |
+
}
|
172 |
+
|
173 |
+
this.map = null;
|
174 |
+
this.firstMarker = null;
|
175 |
+
},
|
176 |
+
showSpotsLinkClick: function () {
|
177 |
+
//hide button & current selected spot
|
178 |
+
$("showspots").style.display = "none";
|
179 |
+
$("karibooresult").style.display = "none";
|
180 |
+
|
181 |
+
//hide the text for previous spot
|
182 |
+
if (typeof $("kariboospots").down(".samespot", 0) != "undefined") {
|
183 |
+
$("kariboospots").down(".samespot", 0).hide();
|
184 |
+
}
|
185 |
+
|
186 |
+
//start resolving setings
|
187 |
+
this.resolveSettings();
|
188 |
+
|
189 |
+
//already open the modal or inlinewindow
|
190 |
+
if (this.settings.display == "1") {
|
191 |
+
this.openModal();
|
192 |
+
} else if (this.settings.display == "0") {
|
193 |
+
this.openInline();
|
194 |
+
}
|
195 |
+
|
196 |
+
//place loader and show it
|
197 |
+
$('map-canvas').update(this.html_loading);
|
198 |
+
|
199 |
+
//AJAX!
|
200 |
+
new Ajax.Request(this.settings.base_url + 'kariboo/ajax/getwindow', {
|
201 |
+
method: 'get',
|
202 |
+
requestHeaders: {Accept: 'application/json'},
|
203 |
+
onSuccess: function (transport) {
|
204 |
+
this.json = transport.responseText.evalJSON(true);
|
205 |
+
|
206 |
+
if (this.json.error.length == 0) {
|
207 |
+
this.drawMap();
|
208 |
+
this.pinMarkers();
|
209 |
+
} else {
|
210 |
+
alert(this.json.error);
|
211 |
+
this.topClose();
|
212 |
+
}
|
213 |
+
}.bind(this),
|
214 |
+
onFailure: function () {
|
215 |
+
alert("Could not contact the server , please try again");
|
216 |
+
this.topClose();
|
217 |
+
},
|
218 |
+
onComplete: function () {
|
219 |
+
$("kariboo_loading").style.display = "none";
|
220 |
+
}.bind(this)
|
221 |
+
});
|
222 |
+
},
|
223 |
+
selectSpot: function (json, days) {
|
224 |
+
//spot selected
|
225 |
+
var image;
|
226 |
+
//fill form
|
227 |
+
$$('input[name^=kariboo[spotid]]').first().value = json.ShopID;
|
228 |
+
$$('input[name^=kariboo[street]]').first().value = json.ShopStreet + " " + json.ShopStreetNumber;
|
229 |
+
$$('input[name^=kariboo[city]]').first().value = json.ShopCity;
|
230 |
+
$$('input[name^=kariboo[postcode]]').first().value = json.ShopPostCode;
|
231 |
+
$$('input[name^=kariboo[country]]').first().value = json.ShopCountry;
|
232 |
+
$$('input[name^=kariboo[name]]').first().value = json.ShopName;
|
233 |
+
$$('input[name^=kariboo[cod]]').first().value = json.COD;
|
234 |
+
this.selectedspot = json.ShopID;
|
235 |
+
|
236 |
+
//fill the infobox
|
237 |
+
if (json.ShopPhoto) {
|
238 |
+
image = json.ShopPhoto;
|
239 |
+
} else {
|
240 |
+
image = this.settings.imgpath + "kariboo.png";
|
241 |
+
}
|
242 |
+
|
243 |
+
var karibooresult = '<img src="' + image + '" alt="Kariboo!-spot" /><p><a href="#" class="info"><b>' + json.ShopName + '</b></a><a href="#" class="infobtn">?</a><br />' + json.ShopStreet + ' ' + json.ShopStreetNumber + '<br />' + json.ShopPostCode + ' ' + json.ShopCity + '</p><ul class="infobtnvw">' + this.generateHours(json, days);
|
244 |
+
if (json.ShopAddressDescription !== "") {
|
245 |
+
karibooresult += '<br />' + json.ShopAddressDescription;
|
246 |
+
}
|
247 |
+
karibooresult += '</ul>';
|
248 |
+
$("karibooresult").update(karibooresult)
|
249 |
+
.setStyle({
|
250 |
+
display: 'block'
|
251 |
+
});
|
252 |
+
|
253 |
+
//if this is not true , it means that there was already a spot suggested.
|
254 |
+
if (this.json) {
|
255 |
+
//change link text
|
256 |
+
$("showspots").update(this.settings.label_change);
|
257 |
+
//close everything
|
258 |
+
this.topClose();
|
259 |
+
}
|
260 |
+
|
261 |
+
//select spot after selection
|
262 |
+
$("s_method_kariboo_kariboo").checked = true;
|
263 |
+
|
264 |
+
//reset
|
265 |
+
this.active_info = null;
|
266 |
+
spotId = null;
|
267 |
+
},
|
268 |
+
closeInfobox: function () {
|
269 |
+
if (this.active_info != null && this.infowindows[this.active_info])
|
270 |
+
this.infowindows[this.active_info].close();
|
271 |
+
|
272 |
+
this.active_info = null;
|
273 |
+
},
|
274 |
+
resolveSettings: function () {
|
275 |
+
//if the width setting is empty apply full width
|
276 |
+
if (this.settings.width) {
|
277 |
+
this.mapwidth = this.settings.width + 'px';
|
278 |
+
} else {
|
279 |
+
this.mapwidth = window.document.documentElement.clientWidth;
|
280 |
+
}
|
281 |
+
|
282 |
+
//if the height setting is empty apply full width
|
283 |
+
if (this.settings.height) {
|
284 |
+
this.mapheight = this.settings.height + 'px';
|
285 |
+
$$('label[for="s_method_kariboo_kariboo"]')
|
286 |
+
} else {
|
287 |
+
if (this.settings.display == 0) {
|
288 |
+
this.mapheight = "600px";
|
289 |
+
} else {
|
290 |
+
this.mapheight = window.document.documentElement.clientHeight;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
this.filterLoading = false;
|
295 |
+
|
296 |
+
//add html
|
297 |
+
this.html_filter = '<div class="filter"><form action="/kariboo/ajax/filterspots" method="post" id="kariboospotsfilterform">' +
|
298 |
+
'<div class="inputgroup postalcode"><input type="text" id="filter_postalcode" class="kariboofilter" name="filter_postalcode" placeholder="' + this.settings.label_postcode + '"/></div>' +
|
299 |
+
'<div class="inputgroup"><label for="filter_openafter16">' + this.settings.label_openafter + '</label><input type="checkbox" class="kariboofilter" id="filter_openafter16" name="filter_openafter16" /></div>' +
|
300 |
+
'<div class="inputgroup"><label for="filter_openonsunday">' + this.settings.label_opensund + '</label><input type="checkbox" class="kariboofilter" id="filter_openonsunday" name="filter_openonsunday" /></div>' +
|
301 |
+
'<input type="submit" value="' + this.settings.label_filter + '" id="filter_submit" /></form></div>';
|
302 |
+
this.html_close = '<a class="karibooclose">Close</a>';
|
303 |
+
this.html_list = '<ul class="list" id="kariboolist"></ul>';
|
304 |
+
this.html_map = '<div id="map-canvas" class="map"></div>';
|
305 |
+
this.html_loading = '<div class="kariboo_loading"><div class="image"></div><span class="ajaxloading"></span><span class="kariboo-please-wait">' + this.settings.label_loading + '</span></div>';
|
306 |
+
this.min_filter_width = 430;
|
307 |
+
|
308 |
+
this.iecompat = Prototype.Browser.IE6 || Prototype.Browser.IE7 || Prototype.Browser.IE8 || Prototype.Browser.IE9;
|
309 |
+
},
|
310 |
+
openModal: function () {
|
311 |
+
this.modal = new Window({
|
312 |
+
id: 'kariboo_shipping_popup',
|
313 |
+
className: 'kariboo_shipping_window',
|
314 |
+
width: this.mapwidth,
|
315 |
+
height: this.mapheight,
|
316 |
+
minimizable: false,
|
317 |
+
maximizable: false,
|
318 |
+
showEffectOptions: {
|
319 |
+
duration: 0.4
|
320 |
+
},
|
321 |
+
hideEffectOptions: {
|
322 |
+
duration: 0.4
|
323 |
+
},
|
324 |
+
destroyOnClose: true
|
325 |
+
});
|
326 |
+
this.modal.setZIndex(100);
|
327 |
+
this.modal.showCenter(true);
|
328 |
+
this.modal.setCloseCallback(function () {
|
329 |
+
this.karibooClose();
|
330 |
+
return true;
|
331 |
+
}.bind(this));
|
332 |
+
|
333 |
+
if (this.settings.list == 1) {
|
334 |
+
this.modal.setHTMLContent('<div class="mapcontainer">' + this.html_filter + this.html_map + this.html_list + '</div>');
|
335 |
+
|
336 |
+
$("map-canvas").setStyle({
|
337 |
+
width: this.settings.width - 220 + "px"
|
338 |
+
});
|
339 |
+
|
340 |
+
if ((this.settings.width - 320) >= this.min_filter_width && this.iecompat == false) {
|
341 |
+
$$(".mapcontainer").first().down(".filter", 0)
|
342 |
+
.setStyle({
|
343 |
+
width: (this.settings.width - 320) + "px"
|
344 |
+
});
|
345 |
+
} else {
|
346 |
+
$$(".mapcontainer").first().down(".filter", 0).addClassName("response");
|
347 |
+
}
|
348 |
+
|
349 |
+
} else {
|
350 |
+
this.modal.setHTMLContent('<div class="mapcontainer">' + this.html_filter + this.html_map + '</div>');
|
351 |
+
}
|
352 |
+
|
353 |
+
if (this.iecompat) {
|
354 |
+
$('filter_postalcode').value = this.settings.label_postcode;
|
355 |
+
}
|
356 |
+
},
|
357 |
+
openInline: function () {
|
358 |
+
var mapcontainer = new Element("div")
|
359 |
+
.addClassName("mapcontainer inline")
|
360 |
+
.setStyle({
|
361 |
+
width: this.mapwidth,
|
362 |
+
height: this.mapheight
|
363 |
+
})
|
364 |
+
.insert(this.html_filter)
|
365 |
+
.insert(this.html_map);
|
366 |
+
var inlinemapwidth = this.settings.width;
|
367 |
+
|
368 |
+
if (this.settings.list == 1) {
|
369 |
+
$$('.kariboospotswrapper').first().addClassName('inline');
|
370 |
+
|
371 |
+
inlinemapwidth = this.settings.width - 220;
|
372 |
+
|
373 |
+
mapcontainer.insert(this.html_list)
|
374 |
+
.down('.map', 0)
|
375 |
+
.setStyle({
|
376 |
+
width: inlinemapwidth + "px"
|
377 |
+
});
|
378 |
+
}
|
379 |
+
if ((inlinemapwidth - 100) >= this.min_filter_width && this.iecompat == false) {
|
380 |
+
$("karibooinfo").update(mapcontainer.insert(this.html_close))
|
381 |
+
.down(".filter", 0)
|
382 |
+
.setStyle({
|
383 |
+
width: (inlinemapwidth - 100) + "px"
|
384 |
+
});
|
385 |
+
} else {
|
386 |
+
$("karibooinfo").update(mapcontainer.insert(this.html_close))
|
387 |
+
.down(".filter", 0)
|
388 |
+
.addClassName("response");
|
389 |
+
}
|
390 |
+
|
391 |
+
//hide the link and result
|
392 |
+
$("showspots").setStyle({
|
393 |
+
display: 'none'
|
394 |
+
});
|
395 |
+
$("karibooresult").setStyle({
|
396 |
+
display: 'none'
|
397 |
+
});
|
398 |
+
|
399 |
+
if (this.iecompat) {
|
400 |
+
$('filter_postalcode').value = this.settings.label_postcode;
|
401 |
+
}
|
402 |
+
},
|
403 |
+
postalCodeFocus: function () {
|
404 |
+
if (this.iecompat) {
|
405 |
+
if ($('filter_postalcode').value == this.settings.label_postcode) {
|
406 |
+
$('filter_postalcode').value = '';
|
407 |
+
}
|
408 |
+
}
|
409 |
+
},
|
410 |
+
postalCodeBlur: function () {
|
411 |
+
if (this.iecompat) {
|
412 |
+
if ($('filter_postalcode').value == '') {
|
413 |
+
$('filter_postalcode').value = this.settings.label_postcode;
|
414 |
+
}
|
415 |
+
}
|
416 |
+
},
|
417 |
+
drawMap: function () {
|
418 |
+
this.map = null; //reset
|
419 |
+
this.map = new google.maps.Map($('map-canvas'), this.mapOptions);
|
420 |
+
},
|
421 |
+
pinMarkers: function () {
|
422 |
+
this.infowindows = {};
|
423 |
+
this.markers = {};
|
424 |
+
|
425 |
+
//loop trough shops
|
426 |
+
for (var i = 0, LtLgLen = this.json.shops.length; i < LtLgLen; i++) {
|
427 |
+
//google maps infobox
|
428 |
+
this.infowindows[this.json.shops[i].ShopID] = new InfoBox(this.infoboxOptions);
|
429 |
+
this.infowindows[this.json.shops[i].ShopID].setContent('<a href="#" class="close close-infoBox"></a>' +
|
430 |
+
'<h3>' + this.json.shops[i].ShopName + '</h3>' +
|
431 |
+
'<p>' + this.json.shops[i].ShopStreet + ' ' + this.json.shops[i].ShopStreetNumber +
|
432 |
+
'<br />' + this.json.shops[i].ShopPostCode + ' ' + this.json.shops[i].ShopCity +
|
433 |
+
'</p><ul class="hours">' + this.generateHours(this.json.shops[i], this.json.days) + '</ul>' +
|
434 |
+
'<a href="#" data-shopid="' + this.json.shops[i].ShopID + '" class="selectspot">Select »</a>');
|
435 |
+
|
436 |
+
//google maps marker
|
437 |
+
this.markers[this.json.shops[i].ShopID] = new google.maps.Marker({
|
438 |
+
position: new google.maps.LatLng(this.json.shops[i].ShopLatitude, this.json.shops[i].ShopLongitude),
|
439 |
+
map: this.map,
|
440 |
+
icon: this.imageOpen,
|
441 |
+
shape: this.shape,
|
442 |
+
zIndex: 1,
|
443 |
+
json: this.json.shops[i]
|
444 |
+
});
|
445 |
+
|
446 |
+
google.maps.event.addListener(this.markers[this.json.shops[i].ShopID], 'click', (function (marker) {
|
447 |
+
return function () {
|
448 |
+
this.clickSpot(marker.json.ShopID);
|
449 |
+
}.bind(this)
|
450 |
+
}.bind(this))(this.markers[this.json.shops[i].ShopID]));
|
451 |
+
|
452 |
+
//center the map on the closest spot
|
453 |
+
if (i == 0) {
|
454 |
+
this.firstMarker = this.markers[this.json.shops[i].ShopID];
|
455 |
+
}
|
456 |
+
|
457 |
+
//list
|
458 |
+
if (this.settings.list == 1) {
|
459 |
+
$$('ul.list').first().insert("<li class='shoplistitem' id='" + this.json.shops[i].ShopID + "'>" + "<span class='title'>" + this.json.shops[i].ShopName + "</span>" + "<span class='address'>" + this.json.shops[i].ShopStreet + " " + this.json.shops[i].ShopStreetNumber + "</span>" + "<span class='city'>" + this.json.shops[i].ShopPostCode + " " + this.json.shops[i].ShopCity + "</span><a href='#' data-shopid='" + this.json.shops[i].ShopID + "' class='selectspot' >" + this.settings.label_select + "</a></li>");
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
google.maps.event.addListenerOnce(this.map, 'idle', function () {
|
464 |
+
google.maps.event.trigger(this.map, 'resize');
|
465 |
+
google.maps.event.trigger(this.firstMarker, 'click');
|
466 |
+
}.bind(this));
|
467 |
+
},
|
468 |
+
clickSpot: function (spotid) {
|
469 |
+
//move map to center of this marker
|
470 |
+
this.map.panTo(this.markers[spotid].getPosition());
|
471 |
+
|
472 |
+
//update the list (if enabled)
|
473 |
+
if (this.settings.list == 1) {
|
474 |
+
var expanded = $$(".expanded").first();
|
475 |
+
if (expanded != undefined) {
|
476 |
+
expanded.removeClassName("expanded");
|
477 |
+
}
|
478 |
+
|
479 |
+
$$(".list").first().scrollTop = $(spotid).addClassName("expanded").offsetTop - 50;
|
480 |
+
}
|
481 |
+
|
482 |
+
//open the infobubble
|
483 |
+
if (this.active_info != null) {
|
484 |
+
this.infowindows[this.active_info].close();
|
485 |
+
}
|
486 |
+
this.infowindows[spotid].open(this.map, this.markers[spotid]);
|
487 |
+
|
488 |
+
//active marker is this one
|
489 |
+
this.active_info = spotid;
|
490 |
+
},
|
491 |
+
showExtraInfo: function () {
|
492 |
+
if ($$(".infobtnvw").first().style.visibility == "visible") {
|
493 |
+
$$(".infobtnvw").first().style.visibility = "hidden";
|
494 |
+
} else {
|
495 |
+
$$(".infobtnvw").first().setStyle({
|
496 |
+
left: ($$(".infobtn").first().offsetLeft + $$(".infobtn").first().getDimensions().width) + "px",
|
497 |
+
visibility: "visible"
|
498 |
+
});
|
499 |
+
}
|
500 |
+
},
|
501 |
+
clearMarkers: function () {
|
502 |
+
for (var key in this.markers) {
|
503 |
+
//remove marker from map
|
504 |
+
this.markers[key].setMap(null);
|
505 |
+
//remove infowindow
|
506 |
+
this.infowindows[key].close();
|
507 |
+
//remove item from list
|
508 |
+
if (this.settings.list == 1) {
|
509 |
+
if (key != null && typeof $(key) != "undefined") {
|
510 |
+
$(key).remove();
|
511 |
+
}
|
512 |
+
}
|
513 |
+
}
|
514 |
+
this.markers = {};
|
515 |
+
this.active_info = null;
|
516 |
+
this.infowindows = {};
|
517 |
+
},
|
518 |
+
generateHours: function (json, days) {
|
519 |
+
//generate openinghours
|
520 |
+
if (!json.days) {
|
521 |
+
var jdls = days;
|
522 |
+
}
|
523 |
+
else {
|
524 |
+
var jdls = json.days;
|
525 |
+
}
|
526 |
+
var hoursoutput = "";
|
527 |
+
for (var datum in jdls) {
|
528 |
+
var one = json.ShopOpeningHours["HD1" + datum];
|
529 |
+
var two = json.ShopOpeningHours["HF1" + datum];
|
530 |
+
var three = json.ShopOpeningHours["HD2" + datum];
|
531 |
+
var four = json.ShopOpeningHours["HF2" + datum];
|
532 |
+
|
533 |
+
one = one.slice(0, 2) + ":" + one.slice(2);
|
534 |
+
two = two.slice(0, 2) + ":" + two.slice(2);
|
535 |
+
three = three.slice(0, 2) + ":" + three.slice(2);
|
536 |
+
four = four.slice(0, 2) + ":" + four.slice(2);
|
537 |
+
|
538 |
+
if (one == "00:00" && two == "00:00") {
|
539 |
+
one = "";
|
540 |
+
two = "";
|
541 |
+
}
|
542 |
+
if (three == "00:00" && four == "00:00") {
|
543 |
+
three = "";
|
544 |
+
four = "";
|
545 |
+
}
|
546 |
+
hoursoutput = hoursoutput + "<li>" + "<span class='day'>" + jdls[datum] + "</span><span class='large'>" + one + '-' + two + "</span><span class='small'>/</span><span class='large'>" + three + '-' + four + "</span></li>";
|
547 |
+
}
|
548 |
+
|
549 |
+
return hoursoutput;
|
550 |
+
},
|
551 |
+
filterMarkers: function () {
|
552 |
+
//disable a second click
|
553 |
+
if (this.filterLoading != true) {
|
554 |
+
|
555 |
+
this.filterLoading = true;
|
556 |
+
$("filter_submit").addClassName("busy");
|
557 |
+
|
558 |
+
if ($("filter_postalcode").value == this.settings.label_postcode) {
|
559 |
+
$("filter_postalcode").value = "";
|
560 |
+
}
|
561 |
+
|
562 |
+
var parameters = "";
|
563 |
+
if (this.settings.display == "1") {
|
564 |
+
//overlay
|
565 |
+
parameters = $("kariboospotsfilterform").serialize();
|
566 |
+
} else if (this.settings.display == "0") {
|
567 |
+
//inline
|
568 |
+
parameters = $("co-shipping-method-form").serialize();
|
569 |
+
}
|
570 |
+
|
571 |
+
new Ajax.Request(this.settings.base_url + 'kariboo/ajax/getwindow', {
|
572 |
+
method: 'post',
|
573 |
+
parameters: parameters,
|
574 |
+
requestHeaders: {Accept: 'application/json'},
|
575 |
+
onSuccess: function (transport) {
|
576 |
+
var json = transport.responseText.evalJSON(true);
|
577 |
+
if (json.error.length == 0) {
|
578 |
+
this.clearMarkers();
|
579 |
+
this.json = json;
|
580 |
+
this.pinMarkers();
|
581 |
+
google.maps.event.trigger(this.map, 'resize');
|
582 |
+
google.maps.event.trigger(this.firstMarker, 'click');
|
583 |
+
} else {
|
584 |
+
alert(json.error);
|
585 |
+
this.topClose();
|
586 |
+
}
|
587 |
+
}.bind(this),
|
588 |
+
onFailure: function () {
|
589 |
+
alert("Could not contact the server , please try again");
|
590 |
+
this.topClose();
|
591 |
+
},
|
592 |
+
onComplete: function () {
|
593 |
+
//enable the button and reset the click
|
594 |
+
this.filterLoading = false;
|
595 |
+
$("filter_submit").removeClassName("busy");
|
596 |
+
this.postalCodeBlur();
|
597 |
+
}.bind(this)
|
598 |
+
});
|
599 |
+
}
|
600 |
+
}
|
601 |
+
});
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>karibooshipping</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Kariboo! Shipping</summary>
|
10 |
+
<description>Kariboo! Shipping By PHPro</description>
|
11 |
+
<notes>First release.</notes>
|
12 |
+
<authors><author><name>PHPro</name><user>heremke</user><email>info@phpro.be</email></author></authors>
|
13 |
+
<date>2015-04-09</date>
|
14 |
+
<time>07:18:38</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Kariboo"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Download"><file name="Grid.php" hash="2059968ef6c0e9ae87d96aa5982d7822"/></dir><file name="Download.php" hash="a4e3cf8bfd8b689d876bd63397e6aaef"/><dir name="Order"><file name="Grid.php" hash="45b2a31e2bdcc7ab61ae942fe85b6cd4"/><dir name="View"><dir name="Tab"><file name="Returnbarcode.php" hash="557aaa2dfa70d5902e37049c6c9ed0d5"/><file name="Returnlabels.php" hash="6e364e3799d513e196dbb3f4b5afad28"/></dir></dir></dir><file name="Order.php" hash="7a74b1b8cb2c37472711084c140b4e79"/></dir><dir name="Shipping"><dir name="Carrier"><dir name="Kariboo"><dir name="Tablerate"><file name="Grid.php" hash="28cb7ea6767b54e326b71a874ba85f11"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Export.php" hash="017954013ce77b3a8a540ba7228ddc98"/></dir></dir></dir></dir><dir name="Carrier"><file name="Kariboo.php" hash="c4b364ead065ecaa9d2e72741ad13ea6"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b832bb2d32fe7f66df1e69f30a1b2dc2"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Kariboogrid.php" hash="ffd22a615231371cdb7b975423020f11"/></dir><file name="Cron.php" hash="8bcbce7dc8570097db91ed476ed596c2"/><file name="Observer.php" hash="6e70432af9d3a37b6e7a3fc90b69442e"/><dir name="Payment"><file name="Kariboocod.php" hash="16ee0b246ed695210f3e10983a8a5917"/></dir><dir name="Resource"><dir name="Returnlabel"><file name="Collection.php" hash="2ad5f68dbc18664e493564fea163e871"/></dir><file name="Returnlabel.php" hash="abfb5a6037f4af51b3c903898236fc14"/><dir name="Tablerate"><file name="Collection.php" hash="3a14f5cf4a78d2e1ac4dc1255f0781b3"/></dir><file name="Tablerate.php" hash="837f138445c51cc58afbd53d25654387"/></dir><file name="Returnlabel.php" hash="5c3ae19bf102542fd5faf9f5a98940ff"/><dir name="Shipping"><file name="Geocode.php" hash="aaede1ca16eb8d8d6db5c1ff41046635"/><file name="Kariboo.php" hash="7b05df7d91af9d6c259001d03c14ccb1"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><file name="Tablerate.php" hash="ee7ff32c57b6d4cf1756a58b2f4abaf7"/></dir></dir><dir name="Source"><file name="Display.php" hash="eb9b1f3fd9c895bf0a05f9c39267c9dc"/><file name="Ratetypes.php" hash="fe32849768ab2828b2b63512f02660cc"/><file name="Weightunit.php" hash="eb824dfb2e2851d5d81fa07872707806"/></dir></dir></dir><file name="Tablerate.php" hash="0a10fa2714cc41751f235696ae9cf8b1"/><file name="Webservice.php" hash="9b837896c8ec62a1334eb791e8683782"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="KaribooconfigController.php" hash="ecec952de24f424c999b0cf164c4dae4"/><file name="KariboodownloadController.php" hash="849c184bfddd86759602a48861557ab8"/><file name="KaribooorderController.php" hash="6ff986fb490b0a9c6ba06fef6648737c"/></dir><file name="AjaxController.php" hash="833bbfc62345d4f9c57d0f77e0356ec3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7cb295efbbae95b39cd7f7b90afafb79"/><file name="config.xml" hash="4d9660eb137243ba97e81633b9264145"/><file name="system.xml" hash="ca9a43a7c9fcb8e862e64ef5300e5e90"/></dir><dir name="sql"><dir name="kariboo_setup"><file name="mysql4-install-0.0.1.php" hash="9047bec29de80267f5f94becae86ff1a"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="33e8988ffe88526127aefe4139fb8811"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="3fedbc1f931f72f98845b6d1331c8ba8"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="e2306c44553e540b478bdcb26a5ea039"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="7700369a4196663393443c93bc64eb4f"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="5784f03156a8e659711cad3cf3b8248f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="kariboo_shipping.xml" hash="4dfcad00c420622f1d3dadb444b6df99"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="kariboo_shipping.xml" hash="1afe66bff989b0781d870ab292bbda31"/></dir><dir name="template"><dir name="kariboo"><dir name="shipping"><file name="gmapsapi.phtml" hash="1f21e215eea984addd4d0d2407e620bc"/><file name="kariboo_checkout_append.phtml" hash="01e4a1f444f8f34644781c814472c848"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="zKariboo_Shipping.xml" hash="ffafdf9e1d8ea3d8e686e31b44d1d667"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Kariboo_Shipping.csv" hash="2000a912536dc95e5fc663c78fa998ad"/><dir name="template"><dir name="email"><dir name="sales"><file name="kariboo_returnlabel.html" hash="60db11e0d6fa3163be620a333ff9d2b5"/></dir></dir></dir></dir><dir name="fr_DR"><file name="Kariboo_Shipping.csv" hash=""/></dir><dir name="nl_NL"><file name="Kariboo_Shipping.csv" hash="9c867fc355a46ebc4fd5d2f0001008da"/><dir name="template"><dir name="email"><dir name="sales"><file name="kariboo_returnlabel.html" hash="15c5af14b524f7f0c7f0e72aae7c9a0f"/></dir></dir></dir></dir><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="sales"><file name="kariboo_returnlabel.html" hash="2fc2bb28ffd20ef5143b5e78fa73d039"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="kariboo"><dir name="shipping"><file name="checkout.js" hash="fde7c32d6c41d3b1d14d1ca99b8e4d7f"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="kariboo"><file name="window.css" hash="27fc379d87f6c6874a9db71bb5279717"/></dir></dir><dir name="images"><dir name="kariboo"><file name="ajax-loader.gif" hash="7f2182aab07294851ba2447a83e18b2a"/><file name="ajax-loader_filter.gif" hash="aeb0aed0887598ccbd0b8fe17c02686a"/><file name="button_close.png" hash="040640376fe4f699f97f0d59b64e79cf"/><file name="icon_sprite.png" hash="ab00de43927913a16c028f40dd9b36a2"/><file name="kariboo.png" hash="5160c94d4de796605cbece978187dcf6"/><file name="marker_open.png" hash="6c2bee98b9cc9feb2ed73f1096a251fc"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/css/kariboo/window.css
ADDED
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.overlay_kariboo_shipping_window {
|
2 |
+
background-color: #666666;
|
3 |
+
filter: alpha(opacity=60);
|
4 |
+
-moz-opacity: 0.6;
|
5 |
+
opacity: 0.6;
|
6 |
+
}
|
7 |
+
|
8 |
+
.kariboo_shipping_window_close {
|
9 |
+
width: 30px;
|
10 |
+
height: 30px;
|
11 |
+
background-image: url('../../images/kariboo/button_close.png');
|
12 |
+
position: absolute;
|
13 |
+
top: -10px;
|
14 |
+
right: -10px;
|
15 |
+
cursor: pointer;
|
16 |
+
z-index: 2000;
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
|
20 |
+
#kariboo_shipping_popup {
|
21 |
+
background: white;
|
22 |
+
display: block;
|
23 |
+
position: absolute;
|
24 |
+
}
|
25 |
+
|
26 |
+
#kariboo_shipping_popup .top.table_window {
|
27 |
+
display: none;
|
28 |
+
}
|
29 |
+
|
30 |
+
#kariboo_shipping_popup .mapcontainer {
|
31 |
+
height: 100%;
|
32 |
+
position: relative;
|
33 |
+
}
|
34 |
+
.mapcontainer{
|
35 |
+
background-color: #FFFFFF;
|
36 |
+
}
|
37 |
+
.mapcontainer.inline {
|
38 |
+
width: 100%;
|
39 |
+
height: 100%;
|
40 |
+
}
|
41 |
+
|
42 |
+
.mapcontainer .filter {
|
43 |
+
margin: 0 50px;
|
44 |
+
height: 50px;
|
45 |
+
display: block;
|
46 |
+
position: absolute;
|
47 |
+
border-bottom-left-radius: 5px;
|
48 |
+
border-bottom-right-radius: 5px;
|
49 |
+
z-index: 1000;
|
50 |
+
background-color: #FFFFFF;
|
51 |
+
box-shadow: 0px 6px 14px 0px rgba(50, 50, 50, 0.73);
|
52 |
+
overflow: hidden;
|
53 |
+
padding-left: 10px;
|
54 |
+
text-align: center;
|
55 |
+
}
|
56 |
+
|
57 |
+
.mapcontainer .filter.response {
|
58 |
+
width: 100% !important;
|
59 |
+
position: relative;
|
60 |
+
margin: 0;
|
61 |
+
padding: 0;
|
62 |
+
border-radius: 0;
|
63 |
+
box-shadow: none;
|
64 |
+
}
|
65 |
+
|
66 |
+
.mapcontainer .filter .inputgroup {
|
67 |
+
width: 28%;
|
68 |
+
float: left;
|
69 |
+
line-height: 50px;
|
70 |
+
}
|
71 |
+
|
72 |
+
.mapcontainer .filter .inputgroup.postalcode {
|
73 |
+
width: 20%;
|
74 |
+
float: left;
|
75 |
+
line-height: 50px;
|
76 |
+
}
|
77 |
+
|
78 |
+
.mapcontainer .filter .inputgroup input {
|
79 |
+
max-width: 75px;
|
80 |
+
color: #003067;
|
81 |
+
font-weight: bold;
|
82 |
+
}
|
83 |
+
|
84 |
+
.mapcontainer .filter .inputgroup.postalcode input {
|
85 |
+
max-width: 95%;
|
86 |
+
color: #000000;
|
87 |
+
font-weight: normal;
|
88 |
+
margin-left: 5px;
|
89 |
+
}
|
90 |
+
|
91 |
+
.mapcontainer .filter .inputgroup label {
|
92 |
+
margin-right: 10px;
|
93 |
+
padding: 0 !important;
|
94 |
+
background-color: #FFFFFF !important;
|
95 |
+
min-width: 0 !important;
|
96 |
+
}
|
97 |
+
|
98 |
+
.mapcontainer .filter #filter_submit {
|
99 |
+
float: right;
|
100 |
+
background-color: #4acb35;
|
101 |
+
height: 50px;
|
102 |
+
display: inline-block;
|
103 |
+
color: #ffffff;
|
104 |
+
border: none;
|
105 |
+
padding: 10px 0;
|
106 |
+
width: 100px;
|
107 |
+
font-weight: bold;
|
108 |
+
text-decoration: none;
|
109 |
+
outline: 0;
|
110 |
+
cursor: pointer;
|
111 |
+
}
|
112 |
+
|
113 |
+
.mapcontainer .filter #filter_submit:hover {
|
114 |
+
color: #003067;
|
115 |
+
}
|
116 |
+
|
117 |
+
.mapcontainer .filter #filter_submit.busy {
|
118 |
+
text-indent: 9999px;
|
119 |
+
background: url(../../images/kariboo/ajax-loader_filter.gif) no-repeat center #d3d3d3;
|
120 |
+
}
|
121 |
+
|
122 |
+
.mapcontainer .filter #filter_submit.busy:hover {
|
123 |
+
color: #FFFFFF;
|
124 |
+
cursor: not-allowed;
|
125 |
+
}
|
126 |
+
|
127 |
+
.mapcontainer #map-canvas {
|
128 |
+
width: 100%;
|
129 |
+
height: 100%;
|
130 |
+
float: left;
|
131 |
+
background-color: #FFFFFF;
|
132 |
+
}
|
133 |
+
|
134 |
+
ul#kariboolist {
|
135 |
+
background-color: #FFFFFF;
|
136 |
+
display: block;
|
137 |
+
width: 220px;
|
138 |
+
height: 100%;
|
139 |
+
overflow-y: auto;
|
140 |
+
overflow-x: hidden;
|
141 |
+
float: left;
|
142 |
+
}
|
143 |
+
|
144 |
+
ul#kariboolist li {
|
145 |
+
padding-left: 10px;
|
146 |
+
margin: 5px 0;
|
147 |
+
border-bottom: 1px solid #d3d3d3;
|
148 |
+
padding-bottom: 5px;
|
149 |
+
cursor: pointer;
|
150 |
+
}
|
151 |
+
|
152 |
+
ul#kariboolist li:first-child {
|
153 |
+
margin-top: 0;
|
154 |
+
}
|
155 |
+
|
156 |
+
ul#kariboolist li.expanded {
|
157 |
+
background-color: #003067;
|
158 |
+
display: inline-block;
|
159 |
+
width: 100%;
|
160 |
+
border: none;
|
161 |
+
padding-bottom: 0;
|
162 |
+
cursor: default;
|
163 |
+
}
|
164 |
+
|
165 |
+
ul#kariboolist li .selectspot {
|
166 |
+
display: none;
|
167 |
+
}
|
168 |
+
|
169 |
+
ul#kariboolist li.expanded .selectspot {
|
170 |
+
display: block;
|
171 |
+
background-color: #4acb35;
|
172 |
+
color: #FFFFFF;
|
173 |
+
float: right;
|
174 |
+
width: 100px;
|
175 |
+
text-align: center;
|
176 |
+
border-radius: 5px 0 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
ul#kariboolist li .title {
|
180 |
+
display: block;
|
181 |
+
clear: both;
|
182 |
+
color: #4acb35;
|
183 |
+
font-weight: bold;
|
184 |
+
}
|
185 |
+
|
186 |
+
ul#kariboolist li .address {
|
187 |
+
display: block;
|
188 |
+
clear: both;
|
189 |
+
color: #003067;
|
190 |
+
font-size: 12px;
|
191 |
+
text-transform: lowercase;
|
192 |
+
}
|
193 |
+
|
194 |
+
ul#kariboolist li .address:first-letter {
|
195 |
+
text-transform: uppercase;
|
196 |
+
}
|
197 |
+
|
198 |
+
ul#kariboolist li.expanded .address {
|
199 |
+
color: #FFFFFF;
|
200 |
+
}
|
201 |
+
|
202 |
+
ul#kariboolist li .city {
|
203 |
+
display: block;
|
204 |
+
clear: both;
|
205 |
+
color: #003067;
|
206 |
+
font-size: 12px;
|
207 |
+
}
|
208 |
+
|
209 |
+
ul#kariboolist li.expanded .city {
|
210 |
+
color: #FFFFFF;
|
211 |
+
}
|
212 |
+
|
213 |
+
.kariboospotswrapper.inline #karibooinfo {
|
214 |
+
position: relative;
|
215 |
+
display:inline-block;
|
216 |
+
}
|
217 |
+
|
218 |
+
a.karibooclose {
|
219 |
+
display: block;
|
220 |
+
float: right;
|
221 |
+
width: 100px;
|
222 |
+
background-color: #003067;
|
223 |
+
color: #FFFFFF;
|
224 |
+
text-align: right;
|
225 |
+
border-radius: 0 0 0 5px;
|
226 |
+
padding-right: 5px;
|
227 |
+
font-weight: bold;
|
228 |
+
cursor: pointer;
|
229 |
+
}
|
230 |
+
|
231 |
+
a.karibooclose:hover {
|
232 |
+
color: #4ACB35;
|
233 |
+
text-decoration: none;
|
234 |
+
}
|
235 |
+
|
236 |
+
.infoBox {
|
237 |
+
display: block;
|
238 |
+
overflow: hidden;
|
239 |
+
margin-top: 8px;
|
240 |
+
background: #4ACB35;
|
241 |
+
text-align: left;
|
242 |
+
border-radius: 0 6px 6px;
|
243 |
+
font: lighter 13px/16px "marselispro","Lucida Grande",Lucida,Verdana,sans-serif;
|
244 |
+
}
|
245 |
+
|
246 |
+
.infoBox .close {
|
247 |
+
top: 6px;
|
248 |
+
right: 6px;
|
249 |
+
background: url(../../images/kariboo/icon_sprite.png) no-repeat 0 0;
|
250 |
+
position: absolute;
|
251 |
+
height: 14px;
|
252 |
+
text-indent: -9999px;
|
253 |
+
width: 14px;
|
254 |
+
}
|
255 |
+
|
256 |
+
.infoBox h3 {
|
257 |
+
background: #fff;
|
258 |
+
margin: 0;
|
259 |
+
font-weight: bold;
|
260 |
+
padding: 15px 20px 5px;
|
261 |
+
color: #4BCD43;
|
262 |
+
font-size: 19px;
|
263 |
+
line-height: 19px;
|
264 |
+
}
|
265 |
+
|
266 |
+
.infoBox p {
|
267 |
+
background: #fff;
|
268 |
+
margin: 0;
|
269 |
+
font-size: 12px;
|
270 |
+
padding: 5px 20px 0px;
|
271 |
+
}
|
272 |
+
|
273 |
+
.infoBox ul.hours {
|
274 |
+
background: #fff;
|
275 |
+
margin: 0;
|
276 |
+
padding: 5px 20px 10px;
|
277 |
+
border-radius: 0 0 6px 6px;
|
278 |
+
display: block;
|
279 |
+
}
|
280 |
+
|
281 |
+
.infoBox ul.hours li {
|
282 |
+
display: inline-block;
|
283 |
+
clear: both;
|
284 |
+
margin: 0;
|
285 |
+
font-size: 11px;
|
286 |
+
}
|
287 |
+
|
288 |
+
.infoBox ul.hours li span.day {
|
289 |
+
width: 23px;
|
290 |
+
display: block;
|
291 |
+
float: left;
|
292 |
+
text-align: center;
|
293 |
+
color: #003067;
|
294 |
+
font-weight: bold;
|
295 |
+
}
|
296 |
+
|
297 |
+
.infoBox ul.hours li span.small {
|
298 |
+
width: 10px;
|
299 |
+
display: block;
|
300 |
+
float: left;
|
301 |
+
text-align: center;
|
302 |
+
}
|
303 |
+
|
304 |
+
.infoBox ul.hours li span.large {
|
305 |
+
width: 80px;
|
306 |
+
display: block;
|
307 |
+
float: left;
|
308 |
+
text-align: center;
|
309 |
+
}
|
310 |
+
|
311 |
+
.infoBox .selectspot {
|
312 |
+
color: #fff;
|
313 |
+
display: block;
|
314 |
+
padding: 10px 20px;
|
315 |
+
text-decoration: none;
|
316 |
+
font-weight: bold;
|
317 |
+
}
|
318 |
+
|
319 |
+
.infoBox .selectspot:hover {
|
320 |
+
color: #003067;
|
321 |
+
}
|
322 |
+
|
323 |
+
.kariboo_loading {
|
324 |
+
text-align: center;
|
325 |
+
width: 200px;
|
326 |
+
margin: 100px auto 0;
|
327 |
+
}
|
328 |
+
|
329 |
+
.kariboo_loading .image {
|
330 |
+
background: url(../../images/kariboo/icon_sprite.png) no-repeat 0 -234px;
|
331 |
+
display: block;
|
332 |
+
height: 121px;
|
333 |
+
width: 161px;
|
334 |
+
text-indent: -9999px;
|
335 |
+
margin: 0 auto;
|
336 |
+
animation: animationFrames linear 1s;
|
337 |
+
animation-iteration-count: infinite;
|
338 |
+
transform-origin: 50% 50%;
|
339 |
+
-webkit-animation: animationFrames linear 1s;
|
340 |
+
-webkit-animation-iteration-count: infinite;
|
341 |
+
-webkit-transform-origin: 50% 50%;
|
342 |
+
}
|
343 |
+
|
344 |
+
@keyframes animationFrames{
|
345 |
+
0% {transform: rotate(0deg)}
|
346 |
+
25% {transform: rotate(7deg)}
|
347 |
+
50% {transform: rotate(0deg)}
|
348 |
+
75% {transform: rotate(-7deg)}
|
349 |
+
100% {transform: rotate(0deg)}
|
350 |
+
}
|
351 |
+
|
352 |
+
@-webkit-keyframes animationFrames {
|
353 |
+
0% {-webkit-transform: rotate(0deg)}
|
354 |
+
25% {-webkit-transform: rotate(7deg)}
|
355 |
+
50% {-webkit-transform: rotate(0deg)}
|
356 |
+
75% {-webkit-transform: rotate(-7deg)}
|
357 |
+
100% {-webkit-transform: rotate(0deg)}
|
358 |
+
}
|
359 |
+
|
360 |
+
.kariboo_loading span.kariboo-please-wait {
|
361 |
+
width: 100%;
|
362 |
+
display: block;
|
363 |
+
}
|
364 |
+
|
365 |
+
.kariboo_loading span.ajaxloading {
|
366 |
+
background: url(../../images/kariboo/ajax-loader.gif) no-repeat center;
|
367 |
+
width: 100%;
|
368 |
+
display: block;
|
369 |
+
height: 20px;
|
370 |
+
}
|
371 |
+
|
372 |
+
#karibooresult {
|
373 |
+
clear: both;
|
374 |
+
width: 100%;
|
375 |
+
height: 100px;
|
376 |
+
display: none;
|
377 |
+
}
|
378 |
+
|
379 |
+
#karibooresult:after {
|
380 |
+
clear: both;
|
381 |
+
content: " ";
|
382 |
+
display: block;
|
383 |
+
}
|
384 |
+
|
385 |
+
#karibooresult img {
|
386 |
+
height: 100%;
|
387 |
+
display: block;
|
388 |
+
float: left;
|
389 |
+
max-width: 200px;
|
390 |
+
margin-left: 3px;
|
391 |
+
}
|
392 |
+
|
393 |
+
#karibooresult p {
|
394 |
+
margin-left: 10px;
|
395 |
+
display: block;
|
396 |
+
float: left;
|
397 |
+
line-height: inherit;
|
398 |
+
}
|
399 |
+
|
400 |
+
#karibooresult b {
|
401 |
+
float: left;
|
402 |
+
}
|
403 |
+
|
404 |
+
#karibooresult a.infobtn {
|
405 |
+
background: url(../../images/kariboo/icon_sprite.png) no-repeat -39px -20px;
|
406 |
+
display: inline-block;
|
407 |
+
float: left;
|
408 |
+
height: 14px;
|
409 |
+
width: 14px;
|
410 |
+
margin: 0px 5px 0;
|
411 |
+
text-indent: -9999px;
|
412 |
+
}
|
413 |
+
|
414 |
+
#karibooresult a.infobtn:hover {
|
415 |
+
border-radius: 7px;
|
416 |
+
box-shadow: 0 0 5px rgba(0, 48, 103, 0.5);
|
417 |
+
}
|
418 |
+
|
419 |
+
#karibooresult ul {
|
420 |
+
background-color: #f4f4f4;
|
421 |
+
display: inline-block;
|
422 |
+
visibility: hidden;
|
423 |
+
font-size: 13px;
|
424 |
+
padding: 10px;
|
425 |
+
line-height: 13px;
|
426 |
+
border-left: 3px solid #003067;
|
427 |
+
border-radius: 5px;
|
428 |
+
position: absolute;
|
429 |
+
margin-top: 10px;
|
430 |
+
}
|
431 |
+
|
432 |
+
#karibooresult ul li span.day {
|
433 |
+
width: 25px;
|
434 |
+
display: inline-block;
|
435 |
+
color: #003067;
|
436 |
+
font-weight: bold;
|
437 |
+
}
|
438 |
+
#karibooresult ul li span.small {
|
439 |
+
margin: 0 3px;
|
440 |
+
}
|
441 |
+
.samespot{
|
442 |
+
font-size: 13px;
|
443 |
+
}
|
444 |
+
.kariboospotswrapper{
|
445 |
+
margin-top: 3px;
|
446 |
+
}
|
skin/frontend/base/default/images/kariboo/ajax-loader.gif
ADDED
Binary file
|
skin/frontend/base/default/images/kariboo/ajax-loader_filter.gif
ADDED
Binary file
|
skin/frontend/base/default/images/kariboo/button_close.png
ADDED
Binary file
|
skin/frontend/base/default/images/kariboo/icon_sprite.png
ADDED
Binary file
|
skin/frontend/base/default/images/kariboo/kariboo.png
ADDED
Binary file
|
skin/frontend/base/default/images/kariboo/marker_open.png
ADDED
Binary file
|