Quadra_Extensions - Version 1.0.0

Version Notes

1.0.0
- Bug fixed order state
- Bug fixed multishipping email

Download this release

Release Info

Developer Magento Core Team
Extension Quadra_Extensions
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Quadra/Extensions/Model/Checkout/Type/Multishipping.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Quadra
16
+ * @package Quadra_Extensions
17
+ * @name Quadra_Extensions_Model_Checkout_Type_Multishipping
18
+ * @author Quadra Team
19
+ */
20
+
21
+ class Quadra_Extensions_Model_Checkout_Type_Multishipping extends Mage_Checkout_Model_Type_Multishipping
22
+ {
23
+ /**
24
+ * Create orders per each quote address
25
+ *
26
+ * @return Mage_Checkout_Model_Type_Multishipping
27
+ */
28
+ public function createOrders()
29
+ {
30
+ $version = Mage::getVersion();
31
+ $version = substr($version, 0, 5);
32
+ $version = str_replace('.', '', $version);
33
+ while (strlen($version) < 3) {
34
+ $version .= "0";
35
+ }
36
+
37
+ if (((int)$version) >= 150) {
38
+ return parent::createOrders();
39
+ }
40
+
41
+ $orderIds = array();
42
+ $this->_validate();
43
+ $shippingAddresses = $this->getQuote()->getAllShippingAddresses();
44
+ $orders = array();
45
+
46
+ if ($this->getQuote()->hasVirtualItems()) {
47
+ $shippingAddresses[] = $this->getQuote()->getBillingAddress();
48
+ }
49
+
50
+ try {
51
+ foreach ($shippingAddresses as $address) {
52
+ $order = $this->_prepareOrder($address);
53
+
54
+ $orders[] = $order;
55
+ Mage::dispatchEvent(
56
+ 'checkout_type_multishipping_create_orders_single',
57
+ array('order'=>$order, 'address'=>$address)
58
+ );
59
+ }
60
+
61
+ foreach ($orders as $order) {
62
+ $order->place();
63
+ $order->save();
64
+ if (!method_exists(Mage::getModel('sales/order'), 'getCanSendNewEmailFlag') ||
65
+ (method_exists(Mage::getModel('sales/order'), 'getCanSendNewEmailFlag')
66
+ && $order->getCanSendNewEmailFlag())) {
67
+ $order->sendNewOrderEmail();
68
+ }
69
+ $orderIds[$order->getId()] = $order->getIncrementId();
70
+ }
71
+
72
+ Mage::getSingleton('core/session')->setOrderIds($orderIds);
73
+ Mage::getSingleton('checkout/session')->setLastQuoteId($this->getQuote()->getId());
74
+
75
+ $this->getQuote()
76
+ ->setIsActive(false)
77
+ ->save();
78
+
79
+ Mage::dispatchEvent('checkout_submit_all_after', array('orders' => $orders, 'quote' => $this->getQuote()));
80
+
81
+ return $this;
82
+ } catch (Exception $e) {
83
+ Mage::dispatchEvent('checkout_multishipping_refund_all', array('orders' => $orders));
84
+ throw $e;
85
+ }
86
+ }
87
+ }
app/code/community/Quadra/Extensions/Model/Sales/Order.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Quadra
16
+ * @package Quadra_Extensions
17
+ * @name Quadra_Extensions_Model_Sales_Order_Config
18
+ * @author Quadra Team
19
+ */
20
+
21
+ class Quadra_Extensions_Model_Sales_Order extends Mage_Sales_Model_Order
22
+ {
23
+ /**
24
+ * Flag: if after order placing we can send new email to the customer.
25
+ *
26
+ * @var bool
27
+ */
28
+ protected $_canSendNewEmailFlag = true;
29
+
30
+ /**
31
+ * Return flag for order if it can sends new email to customer.
32
+ *
33
+ * @return bool
34
+ */
35
+ public function getCanSendNewEmailFlag()
36
+ {
37
+ return $this->_canSendNewEmailFlag;
38
+ }
39
+
40
+ /**
41
+ * Set flag for order if it can sends new email to customer.
42
+ *
43
+ * @param bool $flag
44
+ * @return Mage_Sales_Model_Order
45
+ */
46
+ public function setCanSendNewEmailFlag($flag)
47
+ {
48
+ $this->_canSendNewEmailFlag = (boolean) $flag;
49
+ return $this;
50
+ }
51
+ }
app/code/community/Quadra/Extensions/Model/Sales/Order/Config.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Quadra
16
+ * @package Quadra_Extensions
17
+ * @name Quadra_Extensions_Model_Sales_Order_Config
18
+ * @author Quadra Team
19
+ */
20
+
21
+ class Quadra_Extensions_Model_Sales_Order_Config extends Mage_Sales_Model_Order_Config
22
+ {
23
+ /**
24
+ * Retrieve statuses available for state
25
+ * Get all possible statuses, or for specified state, or specified states array
26
+ * Add labels by default. Return plain array of statuses, if no labels.
27
+ *
28
+ * @param mixed $state
29
+ * @param bool $addLabels
30
+ * @return array
31
+ */
32
+ public function getStateStatuses($state, $addLabels = true)
33
+ {
34
+ $version = Mage::getVersion();
35
+ $version = substr($version, 0, 5);
36
+ $version = str_replace('.', '', $version);
37
+ while (strlen($version) < 3) {
38
+ $version .= "0";
39
+ }
40
+
41
+ if (((int)$version) < 150) {
42
+ return parent::getStateStatuses($state, $addLabels);
43
+ }
44
+
45
+ if (is_array($state)) {
46
+ $key = implode('', $state) . $addLabels;
47
+ } else {
48
+ $key = $state . $addLabels;
49
+ }
50
+
51
+ if (isset($this->_stateStatuses[$key])) {
52
+ return $this->_stateStatuses[$key];
53
+ }
54
+ $statuses = array();
55
+ if (empty($state) || !is_array($state)) {
56
+ $state = array($state);
57
+ }
58
+ foreach ($state as $_state) {
59
+ if ($stateNode = $this->_getState($_state)) {
60
+ $collection = Mage::getResourceModel('sales/order_status_collection')
61
+ ->addStateFilter($_state)
62
+ ->orderByLabel();
63
+ foreach ($collection as $status) {
64
+ $code = $status->getStatus();
65
+ if ($addLabels) {
66
+ $statuses[$code] = $status->getStoreLabel();
67
+ } else {
68
+ $statuses[] = $code;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ $this->_stateStatuses[$key] = $statuses;
74
+ return $statuses;
75
+ }
76
+ }
app/code/community/Quadra/Extensions/etc/config.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Quadra
17
+ * @package Quadra_Extensions
18
+ * @author Quadra Team
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <Quadra_Extensions>
24
+ <version>1.0.0</version>
25
+ </Quadra_Extensions>
26
+ </modules>
27
+ <global>
28
+ <models>
29
+ <checkout>
30
+ <rewrite>
31
+ <type_multishipping>Quadra_Extensions_Model_Checkout_Type_Multishipping</type_multishipping>
32
+ </rewrite>
33
+ </checkout>
34
+ <sales>
35
+ <rewrite>
36
+ <order>Quadra_Extensions_Model_Sales_Order</order>
37
+ <order_config>Quadra_Extensions_Model_Sales_Order_Config</order_config>
38
+ </rewrite>
39
+ </sales>
40
+ </models>
41
+ </global>
42
+ </config>
app/etc/modules/Quadra_Extensions.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Quadra
17
+ * @package Quadra_Extensions
18
+ * @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @author Quadra Team <magento@quadra-informatique.fr>
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Quadra_Extensions>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ <depends>
29
+ <Mage_Checkout />
30
+ <Mage_Sales />
31
+ </depends>
32
+ </Quadra_Extensions>
33
+ </modules>
34
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Quadra_Extensions</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Quadra Extensions for compatibility of modules ATOS/SIPS, Paybox and Cybermut with magento.</summary>
10
+ <description>Allows the compatibility of modules ATOS/SIPS, Paybox and Cybermut with the different versions of magento.
11
+
12
+ Changelog :
13
+ 1.0.0
14
+ - Bug fixed order state
15
+ - Bug fixed multishipping email</description>
16
+ <notes>1.0.0
17
+ - Bug fixed order state
18
+ - Bug fixed multishipping email</notes>
19
+ <authors><author><name>Quadra Informatique</name><user>auto-converted</user><email>ecommerce@quadra-informatique.fr</email></author></authors>
20
+ <date>2011-07-12</date>
21
+ <time>12:55:26</time>
22
+ <contents><target name="mageetc"><dir name="modules"><file name="Quadra_Extensions.xml" hash="667733ecc79c9b6bcb0fd98202058d67"/></dir></target><target name="magecommunity"><dir name="Quadra"><dir name="Extensions"><dir name="etc"><file name="config.xml" hash="cacf720ee6ed4119707c4acc94c0ba15"/></dir><dir name="Model"><dir name="Checkout"><dir name="Type"><file name="Multishipping.php" hash="792447c218b81b66a3c4c9d2da68ac7c"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Config.php" hash="d43ec1ca417a0284fedf6364683a0ff6"/></dir><file name="Order.php" hash="006a8d2e82e3909be0b44701eee081fd"/></dir></dir></dir></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies/>
25
+ </package>