Version Notes
Stable Release.
Download this release
Release Info
Developer | PeteST |
Extension | Securetrading_Multishipping |
Version | 3.3.0 |
Comparing to | |
See all releases |
Version 3.3.0
- app/code/local/Securetrading/Multishipping/Block/Adminhtml/Sales/Order/View/Tab/Multishipping.php +47 -0
- app/code/local/Securetrading/Multishipping/Helper/Data.php +5 -0
- app/code/local/Securetrading/Multishipping/Model/Observer.php +11 -0
- app/code/local/Securetrading/Multishipping/Model/Order/Set.php +7 -0
- app/code/local/Securetrading/Multishipping/Model/Order/Set/Factory.php +35 -0
- app/code/local/Securetrading/Multishipping/Model/Order/Set/Orders.php +18 -0
- app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set.php +7 -0
- app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set/Orders.php +7 -0
- app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set/Orders/Collection.php +5 -0
- app/code/local/Securetrading/Multishipping/etc/config.xml +64 -0
- app/code/local/Securetrading/Multishipping/sql/securetrading_multishipping/install-1.0.0.php +47 -0
- app/design/adminhtml/default/default/layout/securetrading_multishipping.xml +9 -0
- app/etc/modules/SecureTrading_Multishipping.xml +9 -0
- package.xml +20 -0
app/code/local/Securetrading/Multishipping/Block/Adminhtml/Sales/Order/View/Tab/Multishipping.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Block_Adminhtml_Sales_Order_View_Tab_Multishipping
|
4 |
+
extends Mage_Adminhtml_Block_Sales_Order_Grid
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
public function __construct($attributes = array()) {
|
8 |
+
parent::__construct($attributes);
|
9 |
+
$this->setPagerVisibility(false);
|
10 |
+
$this->setFilterVisibility(false);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareLayout() {
|
14 |
+
$order = Mage::registry('current_order');
|
15 |
+
if (Mage::getModel('securetrading_multishipping/order_set_factory')->orderBelongsToAnySet($order->getId())) {
|
16 |
+
$this->getLayout()->getBlock('sales_order_tabs')->addTab('securetrading_multishipping_orders', $this);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareCollection() {
|
21 |
+
$order = Mage::registry('current_order');
|
22 |
+
$orderIds = Mage::getModel('securetrading_multishipping/order_set_factory')->getOrderIdsInSameSet($order->getId(), true);
|
23 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection')->addFieldToFilter('entity_id', array('in' => $orderIds));
|
24 |
+
$this->setCollection($collection);
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _prepareColumns() {
|
28 |
+
parent::_prepareColumns();
|
29 |
+
$this->_exportTypes = array();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getTabLabel() {
|
33 |
+
return Mage::helper('securetrading_stpp')->__('Related Multishipping Orders');
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getTabTitle() {
|
37 |
+
return Mage::helper('securetrading_stpp')->__('Related Multishipping Orders');
|
38 |
+
}
|
39 |
+
|
40 |
+
public function isHidden() {
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function canShowTab() {
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Securetrading/Multishipping/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Observer.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Observer {
|
4 |
+
public function onCheckoutSubmitAllAfter(Varien_Event_Observer $observer) {
|
5 |
+
$orders = $observer->getEvent()->getOrders();
|
6 |
+
if (!$orders || (count($orders) < 2)) { // Not multishipping checkout or only one order created in checkout (only one shipping address chosen).
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
Mage::getModel('securetrading_multishipping/order_set_factory')->addSet($orders);
|
10 |
+
}
|
11 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Order/Set.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Order_Set extends Mage_Core_Model_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('securetrading_multishipping/order_set');
|
6 |
+
}
|
7 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Order/Set/Factory.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Order_Set_Factory extends Varien_Object {
|
4 |
+
public function addSet(array $orders) {
|
5 |
+
$set = Mage::getModel('securetrading_multishipping/order_set')->setDataChanges(true)->save();
|
6 |
+
$setId = $set->getId();
|
7 |
+
foreach($orders as $order) {
|
8 |
+
$orderId = $order->getId();
|
9 |
+
Mage::getModel('securetrading_multishipping/order_set_orders')->setSetId($setId)->setOrderId($orderId)->save();
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getOrderIdsInSameSet($orderId, $excludeCurrentOrder = true) {
|
14 |
+
$orderSetOrders = Mage::getModel('securetrading_multishipping/order_set_orders')->loadByOrderId($orderId, false);
|
15 |
+
$setId = $orderSetOrders->getSetId();
|
16 |
+
|
17 |
+
$collection = Mage::getModel('securetrading_multishipping/order_set_orders')->getCollection();
|
18 |
+
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
|
19 |
+
$collection->addFieldToFilter('set_id', $setId);
|
20 |
+
$collection->addFieldToSelect('order_id');
|
21 |
+
|
22 |
+
$orderIds = array();
|
23 |
+
foreach($collection->getData() as $entry) {
|
24 |
+
#if ($excludeCurrentOrder && $entry['order_id'] !== $orderId) {
|
25 |
+
if (!$excludeCurrentOrder || ($excludeCurrentOrder && $entry['order_id'] !== $orderId)) {
|
26 |
+
$orderIds[] = $entry['order_id'];
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $orderIds;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function orderBelongsToAnySet($orderId) {
|
33 |
+
return (bool) Mage::getModel('securetrading_multishipping/order_set_orders')->loadByOrderId($orderId, true);
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Order/Set/Orders.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Order_Set_Orders extends Mage_Core_Model_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('securetrading_multishipping/order_set_orders');
|
6 |
+
}
|
7 |
+
|
8 |
+
public function loadByOrderId($orderId, $graceful = false) {
|
9 |
+
$object = $this->load($orderId, 'order_id');
|
10 |
+
if (!$object->getId()) {
|
11 |
+
if ($graceful) {
|
12 |
+
return false;
|
13 |
+
}
|
14 |
+
throw new Exception(sprintf(Mage::helper('securetrading_multishipping')->__('The order "%s" did not have a set ID. Only orders placed in the multishipping checkout will have a set ID.'), $orderId));
|
15 |
+
}
|
16 |
+
return $object;
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Resource_Order_Set extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('securetrading_multishipping/order_set', 'set_id');
|
6 |
+
}
|
7 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set/Orders.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Resource_Order_Set_Orders extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this->_init('securetrading_multishipping/order_set_orders', 'order_set_orders_id');
|
6 |
+
}
|
7 |
+
}
|
app/code/local/Securetrading/Multishipping/Model/Resource/Order/Set/Orders/Collection.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Securetrading_Multishipping_Model_Resource_Order_Set_Orders_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/local/Securetrading/Multishipping/etc/config.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Securetrading_Multishipping>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</Securetrading_Multishipping>
|
8 |
+
</modules>
|
9 |
+
<adminhtml>
|
10 |
+
<layout>
|
11 |
+
<updates>
|
12 |
+
<securetrading_multishipping module="Securetrading_Multishipping">
|
13 |
+
<file>securetrading_multishipping.xml</file>
|
14 |
+
</securetrading_multishipping>
|
15 |
+
</updates>
|
16 |
+
</layout>
|
17 |
+
</adminhtml>
|
18 |
+
<global>
|
19 |
+
<resources>
|
20 |
+
<securetrading_multishipping>
|
21 |
+
<setup>
|
22 |
+
<module>Securetrading_Multishipping</module>
|
23 |
+
</setup>
|
24 |
+
</securetrading_multishipping>
|
25 |
+
</resources>
|
26 |
+
<blocks>
|
27 |
+
<securetrading_multishipping>
|
28 |
+
<class>Securetrading_Multishipping_Block</class>
|
29 |
+
</securetrading_multishipping>
|
30 |
+
</blocks>
|
31 |
+
<helpers>
|
32 |
+
<securetrading_multishipping>
|
33 |
+
<class>Securetrading_Multishipping_Helper</class>
|
34 |
+
</securetrading_multishipping>
|
35 |
+
</helpers>
|
36 |
+
<models>
|
37 |
+
<securetrading_multishipping>
|
38 |
+
<class>Securetrading_Multishipping_Model</class>
|
39 |
+
<resourceModel>securetrading_multishipping_resource</resourceModel>
|
40 |
+
</securetrading_multishipping>
|
41 |
+
<securetrading_multishipping_resource>
|
42 |
+
<class>Securetrading_Multishipping_Model_Resource</class>
|
43 |
+
<entities>
|
44 |
+
<order_set>
|
45 |
+
<table>securetrading_multishipping_order_set</table>
|
46 |
+
</order_set>
|
47 |
+
<order_set_orders>
|
48 |
+
<table>securetrading_multishipping_order_set_orders</table>
|
49 |
+
</order_set_orders>
|
50 |
+
</entities>
|
51 |
+
</securetrading_multishipping_resource>
|
52 |
+
</models>
|
53 |
+
<events>
|
54 |
+
<checkout_submit_all_after>
|
55 |
+
<observers>
|
56 |
+
<secretrading_multishipping>
|
57 |
+
<class>Securetrading_Multishipping_Model_Observer</class>
|
58 |
+
<method>onCheckoutSubmitAllAfter</method>
|
59 |
+
</secretrading_multishipping>
|
60 |
+
</observers>
|
61 |
+
</checkout_submit_all_after>
|
62 |
+
</events>
|
63 |
+
</global>
|
64 |
+
</config>
|
app/code/local/Securetrading/Multishipping/sql/securetrading_multishipping/install-1.0.0.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$table = $installer->getConnection()
|
7 |
+
->newTable($installer->getTable('securetrading_multishipping/order_set'))
|
8 |
+
->addColumn('set_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
9 |
+
'identity' => true,
|
10 |
+
'unsigned' => true,
|
11 |
+
'nullable' => false,
|
12 |
+
'primary' => true,
|
13 |
+
), 'Set ID')
|
14 |
+
;
|
15 |
+
$installer->getConnection()->createTable($table);
|
16 |
+
|
17 |
+
$table = $installer->getConnection()
|
18 |
+
->newTable($installer->getTable('securetrading_multishipping/order_set_orders'))
|
19 |
+
->addColumn('order_set_orders_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'identity' => true,
|
21 |
+
'unsigned' => true,
|
22 |
+
'nullable' => false,
|
23 |
+
'primary' => true,
|
24 |
+
), 'Order Set Orders ID')
|
25 |
+
->addColumn('set_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
26 |
+
'unsigned' => true,
|
27 |
+
'nullable' => false,
|
28 |
+
), 'Set ID')
|
29 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
30 |
+
'unsigned' => null,
|
31 |
+
'nullable' => false,
|
32 |
+
), 'Order ID')
|
33 |
+
->addForeignKey(
|
34 |
+
$installer->getFkName('securetrading_multishipping/order_set_orders', 'set_id', 'securetrading_multishipping/order_set', 'set_id'),
|
35 |
+
'set_id', $installer->getTable('securetrading_multishipping/order_set'), 'set_id',
|
36 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
37 |
+
->addForeignKey(
|
38 |
+
$installer->getFkName('securetrading_multishipping/order_set_orders', 'order_id', 'sales/order', 'entity_id'),
|
39 |
+
'order_id', $installer->getTable('sales/order'), 'entity_id',
|
40 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
41 |
+
->addIndex(
|
42 |
+
$installer->getIdxName('securetrading_multishipping/order_set_orders', array('order_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
|
43 |
+
array('order_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
|
44 |
+
;
|
45 |
+
$installer->getConnection()->createTable($table);
|
46 |
+
|
47 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/securetrading_multishipping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<adminhtml_sales_order_view>
|
3 |
+
<reference name="left">
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
<block type="securetrading_multishipping/adminhtml_sales_order_view_tab_multishipping" name="securetrading_multishipping.adminhtml.sales.order.view.tab.multishipping" />
|
6 |
+
</reference>
|
7 |
+
</reference>
|
8 |
+
</adminhtml_sales_order_view>
|
9 |
+
</layout>
|
app/etc/modules/SecureTrading_Multishipping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Securetrading_Multishipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Securetrading_Multishipping>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Securetrading_Multishipping</name>
|
4 |
+
<version>3.3.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adds a tab to the single order page of the admin area that shows all orders created at the same time in the multishipping checkout.</summary>
|
10 |
+
<description>Adds a tab to the single order page of the admin area that shows all orders created at the same time in the multishipping checkout.
|
11 |
+

|
12 |
+
Also provides a set of public functions for determining if an order has related mulitshipping orders and for retrieving those orders.</description>
|
13 |
+
<notes>Stable Release.</notes>
|
14 |
+
<authors><author><name>Peter Barrow</name><user>PeteST</user><email>peter.barrow@securetrading.com</email></author></authors>
|
15 |
+
<date>2014-07-18</date>
|
16 |
+
<time>15:59:13</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Securetrading"><dir name="Multishipping"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Multishipping.php" hash="bdcde73d105e1afc684814a54bd9eb2c"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ef44651a71c3d35f75964b79415f107e"/></dir><dir name="Model"><file name="Observer.php" hash="5989bc4d2295dbde37e3e894a0cf4295"/><dir name="Order"><dir name="Set"><file name="Factory.php" hash="de63f03f322675e48a2196562bb972da"/><file name="Orders.php" hash="9264019c42414d020991ff9c19269745"/></dir><file name="Set.php" hash="80e0c054905b3bebd460f2d0b8e29b1b"/></dir><dir name="Resource"><dir name="Order"><dir name="Set"><dir name="Orders"><file name="Collection.php" hash="23d7a1c73629c47987c930e090d9a0e4"/></dir><file name="Orders.php" hash="5dfff1685fec9695605eb28264c5cac4"/></dir><file name="Set.php" hash="5742796d47acf5342b17ad292a83e547"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="f2be7b4ca3ca438333a2c3297cfb3fa1"/></dir><dir name="sql"><dir name="securetrading_multishipping"><file name="install-1.0.0.php" hash="7e4fc168ecd7b19ffcc64084b7e70481"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecureTrading_Multishipping.xml" hash="efa3f0c8c146aa898f835b6bcc196547"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="securetrading_multishipping.xml" hash="361acf85ce986e990b40fbc0f3c2b929"/></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.3.0</min><max>5.5.8</max></php></required></dependencies>
|
20 |
+
</package>
|