Version Notes
Initial Public Release
Download this release
Release Info
Developer | Magento Core Team |
Extension | MageTitan_DefaultShippingAddress |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/MageTitan/DefaultShippingAddress/Model/Observer.php +45 -0
- app/code/local/MageTitan/DefaultShippingAddress/Model/System/Options.php +23 -0
- app/code/local/MageTitan/DefaultShippingAddress/etc/config.xml +40 -0
- app/code/local/MageTitan/DefaultShippingAddress/etc/system.xml +29 -0
- package.xml +28 -0
app/code/local/MageTitan/DefaultShippingAddress/Model/Observer.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* MageTitan's Default Shipping Address
|
4 |
+
* For assistance please contact support@magetitan.com
|
5 |
+
*
|
6 |
+
* @category MageTitan
|
7 |
+
* @author Michael Potter (magetitan.com)
|
8 |
+
* @copyright Copyright (c) 2011 NetMediaGroup (www.netmediagroup.com)
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @package MageTitan_DefaultShippingAddress
|
11 |
+
*/
|
12 |
+
class MageTitan_DefaultShippingAddress_Model_Observer
|
13 |
+
{
|
14 |
+
public function setShippingAddress($observer)
|
15 |
+
{
|
16 |
+
if ( !$this->calledFromCheckout() ) { return; }
|
17 |
+
$quote = $observer->getEvent()->getQuote();
|
18 |
+
$shippingAddress = $quote->getShippingAddress();
|
19 |
+
if ( $this->isEmptyAddress( $shippingAddress ) ) {
|
20 |
+
$shippingAddress->setSameAsBilling( $this->sameAsBilling() );
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function isEmptyAddress( $address )
|
25 |
+
{
|
26 |
+
$firstName = $address->getFirstname();
|
27 |
+
$lasName = $address->getLastname();
|
28 |
+
$street = $address->getStreet1();
|
29 |
+
return ( empty($firstName) && empty($lasName) && empty($street) );
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function sameAsBilling()
|
33 |
+
{
|
34 |
+
return Mage::getStoreConfig('shipping/defaultshippingaddress/default_shipping_address');
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function calledFromCheckout()
|
38 |
+
{
|
39 |
+
$targetRequestString = 'checkout_onepage_index';
|
40 |
+
$request = Mage::app()->getRequest();
|
41 |
+
$requestString = $request->getRequestedRouteName() . '_' . $request->getRequestedControllerName() . '_' . $request->getActionName();
|
42 |
+
return $targetRequestString == $requestString;
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/local/MageTitan/DefaultShippingAddress/Model/System/Options.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* MageTitan's Default Shipping Address
|
4 |
+
* For assistance please contact support@magetitan.com
|
5 |
+
*
|
6 |
+
* @category MageTitan
|
7 |
+
* @author Michael Potter (magetitan.com)
|
8 |
+
* @copyright Copyright (c) 2011 NetMediaGroup (www.netmediagroup.com)
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @package MageTitan_DefaultShippingAddress
|
11 |
+
*/
|
12 |
+
class MageTitan_DefaultShippingAddress_Model_System_Options
|
13 |
+
{
|
14 |
+
|
15 |
+
public function toOptionArray()
|
16 |
+
{
|
17 |
+
return array(
|
18 |
+
array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Ship to this address')),
|
19 |
+
array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Ship to a different address')),
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/MageTitan/DefaultShippingAddress/etc/config.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<modules>
|
5 |
+
<MageTitan_DefaultShippingAddress>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</MageTitan_DefaultShippingAddress>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
<models>
|
12 |
+
<defaultshippingaddress>
|
13 |
+
<class>MageTitan_DefaultShippingAddress_Model</class>
|
14 |
+
</defaultshippingaddress>
|
15 |
+
</models>
|
16 |
+
</global>
|
17 |
+
|
18 |
+
<frontend>
|
19 |
+
<events>
|
20 |
+
<sales_quote_load_after>
|
21 |
+
<observers>
|
22 |
+
<defaultshippingaddress>
|
23 |
+
<type>singleton</type>
|
24 |
+
<class>defaultshippingaddress/observer</class>
|
25 |
+
<method>setShippingAddress</method>
|
26 |
+
</defaultshippingaddress>
|
27 |
+
</observers>
|
28 |
+
</sales_quote_load_after>
|
29 |
+
</events>
|
30 |
+
</frontend>
|
31 |
+
|
32 |
+
<default>
|
33 |
+
<shipping>
|
34 |
+
<defaultshippingaddress>
|
35 |
+
<default_shipping_address>1</default_shipping_address>
|
36 |
+
</defaultshippingaddress>
|
37 |
+
</shipping>
|
38 |
+
</default>
|
39 |
+
|
40 |
+
</config>
|
app/code/local/MageTitan/DefaultShippingAddress/etc/system.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<shipping>
|
5 |
+
<groups>
|
6 |
+
<defaultshippingaddress translate="label">
|
7 |
+
<label>Default Shipping Address</label>
|
8 |
+
<frontend_type>select</frontend_type>
|
9 |
+
<sort_order>50</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>0</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<default_shipping_address translate="label">
|
15 |
+
<label>Default Shipping Address</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>MageTitan_DefaultShippingAddress_Model_System_Options</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>0</show_in_store>
|
22 |
+
<comment>Default ship to selected on One Page Checkout / Billing</comment>
|
23 |
+
</default_shipping_address>
|
24 |
+
</fields>
|
25 |
+
</defaultshippingaddress>
|
26 |
+
</groups>
|
27 |
+
</shipping>
|
28 |
+
</sections>
|
29 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MageTitan_DefaultShippingAddress</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 3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>If most people ship to the same address as their billing address, why make them the exception? Let's make "Ship to this address" the default during checkout. The Default Shipping Address extension adds the ability to choose which is selected by default.</summary>
|
10 |
+
<description><p>By default, the Magento checkout process automatically assumes the customer checking out will have a different shipping address from their billing address. With this simple extension you can simple change the default shipping to be the same as the billing address. Without this extension, you'll have to update the Magento core code so even though it's simple, it's very useful.</p>
|
11 |
+
<h3>Checkout the features offered with the Default Shipping Address Extension:</h3>
|
12 |
+
<ul>
|
13 |
+
<li>Simplify the Checkout Process</li>
|
14 |
+
<li>Manage your Default Shipping Address</li>
|
15 |
+
<li>Includes Free Upgrades &amp; Support</li>
|
16 |
+
<li>Intuitive Admin Interface blends well with existing Magento interface.</li>
|
17 |
+
</ul>
|
18 |
+
<h3>Support &amp; Documentation</h3>
|
19 |
+
<p>We proudly stand behind our products and provide support 24/7 on all of them! Also, each of our items come included with full documentation.</p>
|
20 |
+
<p>Buy today in confidence knowing we will respond within minutes to your support problems.</p></description>
|
21 |
+
<notes>Initial Public Release</notes>
|
22 |
+
<authors><author><name>MageTitan</name><user>auto-converted</user><email>mike@magetitan.com</email></author></authors>
|
23 |
+
<date>2011-11-09</date>
|
24 |
+
<time>23:05:31</time>
|
25 |
+
<contents><target name="magelocal"><dir name="MageTitan"><dir name="DefaultShippingAddress"><dir name="etc"><file name="config.xml" hash="f6fa0eb73b7aa82082377f5f33e56c25"/><file name="system.xml" hash="df17515ae05224147a7adf8e81e069a9"/></dir><dir name="Model"><dir name="System"><file name="Options.php" hash="77ba5191d139bd76dbc7cfc2757e7468"/></dir><file name="Observer.php" hash="2e8ab303cb58d30b8bdeb9237e44164a"/></dir></dir></dir></target></contents>
|
26 |
+
<compatible/>
|
27 |
+
<dependencies/>
|
28 |
+
</package>
|