Version Notes
Fixed some minor bugs.
Download this release
Release Info
Developer | Fontis |
Extension | Mage_GoogleTrustedStore |
Version | 1.0.6 |
Comparing to | |
See all releases |
Version 1.0.6
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/OrderCancellationConfirmation.php +53 -0
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/OrderCreatedConfirmation.php +103 -0
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/GoogleShoppingAccountId.php +42 -0
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/Subscribe.php +55 -0
- app/code/core/Mage/GoogleTrustedStore/Block/Badge.php +126 -0
- app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Multishipping.php +67 -0
- app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Onepage.php +311 -0
- app/code/core/Mage/GoogleTrustedStore/Helper/Data.php +50 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Backend/FeedFilename.php +41 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Backend/Subscribe.php +47 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Config.php +289 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Feed/Abstract.php +107 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Feed/Cancellation.php +67 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Feed/Shipment.php +111 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Feeder.php +151 -0
- app/code/core/Mage/GoogleTrustedStore/Model/GoogleShoppingAdapter.php +119 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Observer.php +193 -0
- app/code/core/Mage/GoogleTrustedStore/Model/Source/OrderCancellationReason.php +75 -0
- app/code/core/Mage/GoogleTrustedStore/etc/config.xml +184 -0
- app/code/core/Mage/GoogleTrustedStore/etc/system.xml +156 -0
- app/code/core/Mage/GoogleTrustedStore/sql/googletrustedstore_setup/install-1.6.0.0.php +41 -0
- app/code/core/Mage/GoogleTrustedStore/sql/googletrustedstore_setup/mysql4-install-1.6.0.0.php +38 -0
- app/design/adminhtml/default/default/layout/googletrustedstore.xml +55 -0
- app/design/adminhtml/default/default/template/googletrustedstore/cancellation_confirmation_js.phtml +91 -0
- app/design/adminhtml/default/default/template/googletrustedstore/order_confirmation.phtml +84 -0
- app/design/frontend/base/default/layout/googletrustedstore.xml +48 -0
- app/design/frontend/base/default/template/googletrustedstore/badge.phtml +57 -0
- app/design/frontend/base/default/template/googletrustedstore/order_confirmation.phtml +67 -0
- app/etc/modules/Mage_GoogleTrustedStore.xml +39 -0
- app/locale/en_US/Mage_GoogleTrustedStore.csv +30 -0
- package.xml +18 -0
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/OrderCancellationConfirmation.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Form for order cancellation reason
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_GoogleTrustedStore_Block_Adminhtml_OrderCancellationConfirmation extends Mage_Adminhtml_Block_Widget_Form
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Create form with one field for cancellation reason
|
35 |
+
* and sets it to widget
|
36 |
+
*
|
37 |
+
* @see Mage_Adminhtml_Block_Widget_Form::_prepareForm()
|
38 |
+
*/
|
39 |
+
protected function _prepareForm()
|
40 |
+
{
|
41 |
+
$form = new Varien_Data_Form();
|
42 |
+
$form->setHtmlIdPrefix('order_cancellation_');
|
43 |
+
$fieldset = $form->addFieldset('base', array());
|
44 |
+
$source = Mage::getSingleton('googletrustedstore/source_orderCancellationReason');
|
45 |
+
$fieldset->addField('reason', 'select', array(
|
46 |
+
'name' => 'cancellation_reason',
|
47 |
+
'label' => Mage::helper('googletrustedstore')->__('Cancellation Reason'),
|
48 |
+
'values' => $source->toOptionArray(),
|
49 |
+
'value' => $source->getDefaultCode(),
|
50 |
+
));
|
51 |
+
$this->setForm($form);
|
52 |
+
}
|
53 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/OrderCreatedConfirmation.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adds Google provided JavaScript to admin panel order success page
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_GoogleTrustedStore_Block_Adminhtml_OrderCreatedConfirmation
|
32 |
+
extends Mage_GoogleTrustedStore_Block_OrderConfirmation_Onepage
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Placed order
|
36 |
+
*
|
37 |
+
* @var Mage_Sales_Model_Order
|
38 |
+
*/
|
39 |
+
private $_order;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Returns order placed
|
43 |
+
*
|
44 |
+
* @return Mage_Sales_Model_Order
|
45 |
+
* @throws RuntimeException If unable to load order
|
46 |
+
*/
|
47 |
+
protected function _getOrder()
|
48 |
+
{
|
49 |
+
if (!$this->_order) {
|
50 |
+
$orderId = Mage::getSingleton('adminhtml/session')->getLastAdminOrderId();
|
51 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
52 |
+
Mage::getSingleton('adminhtml/session')->unsLastAdminOrderId();
|
53 |
+
if (!$order->getId()) {
|
54 |
+
throw new RuntimeException('Unable to load last order.');
|
55 |
+
}
|
56 |
+
$this->_order = $order;
|
57 |
+
}
|
58 |
+
|
59 |
+
return $this->_order;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Return true if session contains ID of recently created order
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
protected function _hasOrder()
|
68 |
+
{
|
69 |
+
return Mage::getSingleton('adminhtml/session')->hasLastAdminOrderId();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returns Account ID entered in admin panel to use in template
|
74 |
+
*
|
75 |
+
* @return number
|
76 |
+
*/
|
77 |
+
public function getAccountId()
|
78 |
+
{
|
79 |
+
return Mage::getSingleton('googletrustedstore/config')->getAccountId();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Render block HTML if only extension is enabled
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
protected function _toHtml()
|
88 |
+
{
|
89 |
+
if (Mage::getSingleton('googletrustedstore/config')->isEnabled() && $this->_hasOrder()) {
|
90 |
+
return parent::_toHtml();
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns Google shopping account ID
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function getGoogleShoppingAccountId()
|
100 |
+
{
|
101 |
+
return Mage::getSingleton('googletrustedstore/googleShoppingAdapter')->getAccountId();
|
102 |
+
}
|
103 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/GoogleShoppingAccountId.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Custom renderer for for Google Shopping Account Id
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_GoogleShoppingAccountId
|
32 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
33 |
+
{
|
34 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
35 |
+
{
|
36 |
+
if (!Mage::getSingleton('googletrustedstore/googleShoppingAdapter')->isActive()) {
|
37 |
+
return parent::render($element);
|
38 |
+
} else {
|
39 |
+
return '';
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/Subscribe.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Custom renderer for subscriptin to group
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_Subscribe
|
32 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
33 |
+
{
|
34 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
35 |
+
{
|
36 |
+
$subscribeLabel = $this->__('Subscribe');
|
37 |
+
return <<<HTML
|
38 |
+
<input id="trustedstore_subscription_for_updates_value" type="text" value="" name="groups[trustedstore][fields][subscription_for_updates][value]" class="input-text validate-email" style="width:190px">
|
39 |
+
<button type="submit" id="trustedstore_subscription_for_updates_submit" class="disabled" disabled="disabled">$subscribeLabel</button>
|
40 |
+
<script type="text/javascript">
|
41 |
+
document.observe('dom:loaded', function () {
|
42 |
+
var trstdSubmit = $('trustedstore_subscription_for_updates_submit');
|
43 |
+
var trstdValue = $('trustedstore_subscription_for_updates_value');
|
44 |
+
Event.observe('trustedstore_subscription_for_updates_value', 'input', function (e) {
|
45 |
+
if (trstdValue.getValue()) {
|
46 |
+
enableElement(trstdSubmit);
|
47 |
+
} else {
|
48 |
+
disableElement(trstdSubmit);
|
49 |
+
}
|
50 |
+
});
|
51 |
+
});
|
52 |
+
</script>
|
53 |
+
HTML;
|
54 |
+
}
|
55 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/Badge.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Block_Badge extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @var Mage_GoogleShopping_Model_Item|null|false
|
31 |
+
*/
|
32 |
+
private $_gsItem = false;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Returns Account ID entered in admin panel to use in template
|
36 |
+
*
|
37 |
+
* @return number
|
38 |
+
*/
|
39 |
+
public function getAccountId()
|
40 |
+
{
|
41 |
+
return Mage::getSingleton('googletrustedstore/config')->getAccountId();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Returns true is Mage_GoogleShopping is active and product was published
|
46 |
+
* in Google shopping in current store
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
public function hasGoogleShoppingItem()
|
51 |
+
{
|
52 |
+
return $this->_getGoogleShoppingAdapter()->isActive() && $this->getGoogleShoppingItemId();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Returns Google shopping item ID or null if product was published in current store
|
57 |
+
*
|
58 |
+
* @return string|null
|
59 |
+
* @throws RuntimeException If Mage_GoogleShopping is not active
|
60 |
+
*/
|
61 |
+
public function getGoogleShoppingItemId()
|
62 |
+
{
|
63 |
+
if (false === $this->_gsItem) {
|
64 |
+
$this->_gsItem = ($product = Mage::registry('current_product'))
|
65 |
+
? $this->_getGoogleShoppingAdapter()->getItemId($product)
|
66 |
+
: null;
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->_gsItem;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returns Google shopping account ID for current store
|
74 |
+
*
|
75 |
+
* @return string
|
76 |
+
* @throws RuntimeException If Mage_GoogleShopping is not active
|
77 |
+
*/
|
78 |
+
public function getGoogleShoppingAccountId()
|
79 |
+
{
|
80 |
+
return $this->_getGoogleShoppingAdapter()->getAccountId();
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Returns ISO code of target country's language in Google shopping for current store
|
85 |
+
*
|
86 |
+
* @return string
|
87 |
+
* @throws RuntimeException If Mage_GoogleShopping is not active
|
88 |
+
*/
|
89 |
+
public function getGoogleShoppingLanguage()
|
90 |
+
{
|
91 |
+
return $this->_getGoogleShoppingAdapter()->getTargetLanguage();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns ISO code of target country in Google shopping for current store
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
* @throws RuntimeException If Mage_GoogleShopping is not active
|
99 |
+
*/
|
100 |
+
public function getGoogleShoppingCountry()
|
101 |
+
{
|
102 |
+
return $this->_getGoogleShoppingAdapter()->getTargetCountry();
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Returns adapter model to Google shopping extension
|
107 |
+
*
|
108 |
+
* @return Mage_GoogleTrustedStore_Helper_GoogleShopping
|
109 |
+
*/
|
110 |
+
protected function _getGoogleShoppingAdapter()
|
111 |
+
{
|
112 |
+
return Mage::getSingleton('googletrustedstore/googleShoppingAdapter');
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Render block HTML
|
117 |
+
*
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
protected function _toHtml()
|
121 |
+
{
|
122 |
+
if (Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
|
123 |
+
return parent::_toHtml();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Multishipping.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Block_OrderConfirmation_Multishipping extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Returns all order placed during multishipping ordering process
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
protected function _getAllOrders()
|
35 |
+
{
|
36 |
+
$allOrders = array();
|
37 |
+
$ids = Mage::getSingleton('checkout/session')->getMultishippingOrderIds(false);
|
38 |
+
if ($ids && is_array($ids)) {
|
39 |
+
$allOrders = Mage::getModel('sales/order')
|
40 |
+
->getCollection()
|
41 |
+
->addFieldToFilter('entity_id', array('in' => $ids));
|
42 |
+
}
|
43 |
+
|
44 |
+
return $allOrders;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Render block HTML if only extension is enabled
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
protected function _toHtml()
|
53 |
+
{
|
54 |
+
$html = '';
|
55 |
+
if (Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
|
56 |
+
foreach ($this->_getAllOrders() as $order) {
|
57 |
+
$html .= $this->getChild('googletrustedstore.item.success')->setOrder($order)->toHtml();
|
58 |
+
// leave only first order on the success page. May be will be changed in future, when Google starts
|
59 |
+
// support multishipping orders.
|
60 |
+
break;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
return $html;
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Onepage.php
ADDED
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Block_OrderConfirmation_Onepage extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Constant for "yes" value in Google provided format
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
const YES = 'Y';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Constant for "no" value in Google provided format
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
const NO = 'N';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Placed order
|
45 |
+
*
|
46 |
+
* @var Mage_Sales_Model_Order
|
47 |
+
*/
|
48 |
+
private $_order;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Placed order items
|
52 |
+
*
|
53 |
+
* @var array
|
54 |
+
*/
|
55 |
+
private $_orderItems = null;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns order placed
|
59 |
+
*
|
60 |
+
* @return Mage_Sales_Model_Order
|
61 |
+
* @throws RuntimeException If unable to load order
|
62 |
+
*/
|
63 |
+
protected function _getOrder()
|
64 |
+
{
|
65 |
+
if (!$this->_order) {
|
66 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
67 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
68 |
+
if (!$order->getId()) {
|
69 |
+
throw new RuntimeException('Unable to load last order.');
|
70 |
+
}
|
71 |
+
$this->_order = $order;
|
72 |
+
}
|
73 |
+
|
74 |
+
return $this->_order;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Sets order
|
79 |
+
*
|
80 |
+
* @param Mage_Sales_Model_Order $order
|
81 |
+
* @return Mage_GoogleTrustedStore_Block_OrderConfirmation_Onepage
|
82 |
+
*/
|
83 |
+
public function setOrder($order)
|
84 |
+
{
|
85 |
+
$this->_order = $order;
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns order items placed
|
91 |
+
*
|
92 |
+
* @return array
|
93 |
+
*/
|
94 |
+
protected function _getItems()
|
95 |
+
{
|
96 |
+
if (!$this->_orderItems) {
|
97 |
+
$this->_orderItems = $this->_getOrder()->getAllVisibleItems();
|
98 |
+
}
|
99 |
+
return $this->_orderItems;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Formats price into Google specified format (2 digits after dot)
|
104 |
+
* It's expected that Magento manages rounding prices before order saving, so this method shouldn't care
|
105 |
+
* about third and fourth digits after point
|
106 |
+
*
|
107 |
+
* @param float $price
|
108 |
+
* @return string
|
109 |
+
*/
|
110 |
+
protected function _formatPrice($price)
|
111 |
+
{
|
112 |
+
return sprintf("%01.2F", $price);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Returns order increment id
|
117 |
+
*
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function getOrderIncrementId()
|
121 |
+
{
|
122 |
+
return $this->_getOrder()->getIncrementId();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Returns domain where order was placed
|
127 |
+
*
|
128 |
+
* @return string
|
129 |
+
*/
|
130 |
+
public function getOrderDomain()
|
131 |
+
{
|
132 |
+
return Mage::getModel('core/url')->parseUrl(Mage::getBaseUrl())->getHost();
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Returns order's customer email
|
137 |
+
*
|
138 |
+
* @return string
|
139 |
+
*/
|
140 |
+
public function getCustomerEmail()
|
141 |
+
{
|
142 |
+
return $this->_getOrder()->getCustomerEmail();
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Returns order's customer country
|
147 |
+
*
|
148 |
+
* @return string
|
149 |
+
*/
|
150 |
+
public function getCustomerCountry()
|
151 |
+
{
|
152 |
+
if ($address = $this->_getOrder()->getShippingAddress()) {
|
153 |
+
return $address->getCountry();
|
154 |
+
}
|
155 |
+
return $this->_getOrder()->getBillingAddress()->getCountry();
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Returns order's currency code
|
160 |
+
*
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
public function getCurrencyCode()
|
164 |
+
{
|
165 |
+
return $this->_getOrder()->getOrderCurrencyCode();
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Returns order total
|
170 |
+
*
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function getOrderTotal()
|
174 |
+
{
|
175 |
+
return $this->_formatPrice($this->_getOrder()->getGrandTotal());
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Returns order discounts total
|
180 |
+
*
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
public function getOrderDiscount()
|
184 |
+
{
|
185 |
+
return $this->_formatPrice($this->_getOrder()->getDiscountAmount());
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Returns order shipping total
|
190 |
+
*
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
public function getOrderShipping()
|
194 |
+
{
|
195 |
+
return $this->_formatPrice($this->_getOrder()->getShippingAmount());
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Returns order tax total
|
200 |
+
*
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
+
public function getOrderTax()
|
204 |
+
{
|
205 |
+
return $this->_formatPrice($this->_getOrder()->getTaxAmount());
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Returns order ship date
|
210 |
+
*
|
211 |
+
* @returns string in format YYYY-MM-DD
|
212 |
+
*/
|
213 |
+
public function getOrderShipDate()
|
214 |
+
{
|
215 |
+
return $this->_getOrder()
|
216 |
+
->getCreatedAtDate()
|
217 |
+
->addDay(Mage::getSingleton('googletrustedstore/config')->getEstimatedShippingPeriod())
|
218 |
+
->toString('yyyy-MM-dd');
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Checks if order contains backordered items
|
223 |
+
*
|
224 |
+
* @returns string ('Y' or 'N')
|
225 |
+
*/
|
226 |
+
public function hasBackorderPreorder()
|
227 |
+
{
|
228 |
+
foreach ($this->_getItems() as $item) {
|
229 |
+
if($item->getQtyBackordered() > 0) {
|
230 |
+
return self::YES;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
return self::NO;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Checks if order contains virtual items
|
238 |
+
*
|
239 |
+
* @returns string ('Y' or 'N')
|
240 |
+
*/
|
241 |
+
public function hasDigitalGoods()
|
242 |
+
{
|
243 |
+
foreach ($this->_getItems() as $item) {
|
244 |
+
if($item->getIsVirtual()) {
|
245 |
+
return self::YES;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
return self::NO;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Prepares array with information about each order item - name, price, quantity
|
253 |
+
*
|
254 |
+
* @return array
|
255 |
+
*/
|
256 |
+
public function getItemsInformation()
|
257 |
+
{
|
258 |
+
$items = array();
|
259 |
+
foreach ($this->_getItems() as $item) {
|
260 |
+
$itemInfo = array(
|
261 |
+
'name' => $this->escapeHtml($item->getName()),
|
262 |
+
'price' => $this->_formatPrice($item->getPrice()),
|
263 |
+
'qty' => sprintf($item->getIsQtyDecimal() ? '%F' : '%d', $item->getQtyOrdered()),
|
264 |
+
);
|
265 |
+
if ($gsInfo = $this->_getGoogleShoppingItemInfo($item)) {
|
266 |
+
$itemInfo['gs'] = $gsInfo;
|
267 |
+
}
|
268 |
+
$items[] = $itemInfo;
|
269 |
+
}
|
270 |
+
|
271 |
+
return $items;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Tries to load Google shopping info related to order item
|
276 |
+
*
|
277 |
+
* @param Mage_Sales_Model_Order_Item $item
|
278 |
+
* @return array|null Null if cannot load; array if can
|
279 |
+
*/
|
280 |
+
protected function _getGoogleShoppingItemInfo(Mage_Sales_Model_Order_Item $item)
|
281 |
+
{
|
282 |
+
$helper = Mage::getSingleton('googletrustedstore/googleShoppingAdapter');
|
283 |
+
if ($helper->isActive()) {
|
284 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
285 |
+
if ($product->getId()) {
|
286 |
+
$storeId = $item->getStoreId();
|
287 |
+
$gsItemId = $helper->getItemId($product, $storeId);
|
288 |
+
if ($gsItemId) {
|
289 |
+
return array(
|
290 |
+
'id' => $this->escapeHtml($gsItemId),
|
291 |
+
'account_id' => $this->escapeHtml($helper->getAccountId($storeId)),
|
292 |
+
'country' => $helper->getTargetCountry($storeId),
|
293 |
+
'language' => $helper->getTargetLanguage($storeId),
|
294 |
+
);
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Render block HTML if only extension is enabled
|
302 |
+
*
|
303 |
+
* @return string|null
|
304 |
+
*/
|
305 |
+
protected function _toHtml()
|
306 |
+
{
|
307 |
+
if (Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
|
308 |
+
return parent::_toHtml();
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Helper/Data.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Helper_Data extends Mage_Core_Helper_Abstract
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @return Mage_GoogleTrustedStore_Model_Config
|
31 |
+
*/
|
32 |
+
protected function _getConfig()
|
33 |
+
{
|
34 |
+
return Mage::getSingleton('googletrustedstore/config');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Sends subscribe requst email to Google group
|
39 |
+
*
|
40 |
+
* @param string $email Email for subscription
|
41 |
+
*/
|
42 |
+
public function subscribeForUpdate($email)
|
43 |
+
{
|
44 |
+
$message = new Zend_Mail;
|
45 |
+
$message->setFrom($email)
|
46 |
+
->addTo($this->_getConfig()->getSubscriptionEmail())
|
47 |
+
->setBodyText('')
|
48 |
+
->send();
|
49 |
+
}
|
50 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Backend/FeedFilename.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_Backend_FeedFilename extends Mage_Core_Model_Config_Data
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Validates value before saving
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
protected function _beforeSave()
|
34 |
+
{
|
35 |
+
if (!preg_match('/^[a-z0-9_.]+/i', $this->getValue())) {
|
36 |
+
throw new Exception(Mage::helper('googletrustedstore')->__(
|
37 |
+
'Please use only letters (a-z or A-Z), numbers (0-9), underscore (_) or dot (.) in feed filename field. No spaces or other characters are allowed.'
|
38 |
+
));
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Backend/Subscribe.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_Backend_Subscribe extends Mage_Core_Model_Config_Data
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Validates value before saving
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
protected function _beforeSave()
|
34 |
+
{
|
35 |
+
if ($this->getValue()) {
|
36 |
+
if (!Zend_Validate::is($this->getValue(), 'EmailAddress')) {
|
37 |
+
throw new InvalidArgumentException(
|
38 |
+
Mage::helper('googletrustedstore')->__('Incorrect email for subscription.')
|
39 |
+
);
|
40 |
+
}
|
41 |
+
Mage::helper('googletrustedstore')->subscribeForUpdate($this->getValue());
|
42 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
43 |
+
Mage::helper('googletrustedstore')->__('Subscription request has been sent.')
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Config.php
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Module's config
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Mage_GoogleTrustedStore_Model_Config
|
32 |
+
{
|
33 |
+
const XML_PATH_LAST_TIME_GENERATED_DATE = 'google/trustedstore/last_generated_date';
|
34 |
+
const XML_PATH_CANCELLATION_REASONS = 'global/googletrustedstore/order_cancellation_reasons';
|
35 |
+
const XML_PATH_DEFAULT_CANCELLATION_REASON = 'google/trustedstore/default_order_cancellation_reason';
|
36 |
+
const XML_PATH_ENABLED = 'google/trustedstore/enabled';
|
37 |
+
const XML_PATH_ACCOUNT_ID = 'google/trustedstore/account_id';
|
38 |
+
const XML_PATH_ESTIMATED_SHIP_DATE = 'google/trustedstore/estimated_ship_date';
|
39 |
+
const XML_PATH_FTP_HOSTNAME = 'global/googletrustedstore/ftp_host';
|
40 |
+
const XML_PATH_FTP_USERNAME = 'google/trustedstore/ftp_username';
|
41 |
+
const XML_PATH_FTP_PASSWORD = 'google/trustedstore/ftp_password';
|
42 |
+
const XML_PATH_SHIPMENT_FEED_FILENAME = 'google/trustedstore/shipment_feed_filename';
|
43 |
+
const XML_PATH_CANCELLATION_FEED_FILENAME ='google/trustedstore/cancellation_feed_filename';
|
44 |
+
const XML_PATH_CARRIERS = 'global/googletrustedstore/carriers';
|
45 |
+
const XML_PATH_GOOGLE_SHOPPING_ACCOUNT_ID = 'google/trustedstore/google_shopping_account_id';
|
46 |
+
const XML_GOOGLE_GROUP_EMAIL = 'global/googletrustedstore/google_group_email';
|
47 |
+
|
48 |
+
const CARRIER_CODE_OTHER = 'Other';
|
49 |
+
const CARRIER_NAME_OTHER = 'OTHER';
|
50 |
+
/**
|
51 |
+
* Check if extension is enabled in admin panel or not
|
52 |
+
*
|
53 |
+
* @return boolean
|
54 |
+
*/
|
55 |
+
public function isEnabled()
|
56 |
+
{
|
57 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED);
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Returns ID of Google trusted stores account
|
62 |
+
*
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getAccountId()
|
66 |
+
{
|
67 |
+
return Mage::getStoreConfig(self::XML_PATH_ACCOUNT_ID);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Load reasons from config
|
72 |
+
*
|
73 |
+
* @throws RuntimeException if cannot load
|
74 |
+
* @return array array(code => description, ...)
|
75 |
+
*/
|
76 |
+
public function getCancellationReasons()
|
77 |
+
{
|
78 |
+
$reasons = Mage::getConfig()->getNode(self::XML_PATH_CANCELLATION_REASONS);
|
79 |
+
if (!$reasons) {
|
80 |
+
throw new RuntimeException("Order cancellation reasons were not found at "
|
81 |
+
. self::XML_PATH_CANCELLATION_REASONS . "; seems like config is broken."
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $reasons->children();
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns code of default cancellation reason
|
90 |
+
*
|
91 |
+
* @throws RuntimeException If cannot load code or invalid value of code
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public function getDefaultCancellationReasonCode()
|
95 |
+
{
|
96 |
+
$default = Mage::getStoreConfig(self::XML_PATH_DEFAULT_CANCELLATION_REASON);
|
97 |
+
if (!$default) {
|
98 |
+
throw new RuntimeException("Default order cancellation reasons was not found at "
|
99 |
+
. self::XML_PATH_DEFAULT_CANCELLATION_REASON . "; seems like config is broken."
|
100 |
+
);
|
101 |
+
}
|
102 |
+
// Check for consistence
|
103 |
+
if (!Mage::getConfig()->getNode(self::XML_PATH_CANCELLATION_REASONS . '/' . $default)) {
|
104 |
+
throw new RuntimeException(
|
105 |
+
"$default order cancellation reason was defined as default but there is no such reason by "
|
106 |
+
. self::XML_PATH_CANCELLATION_REASONS
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
return (string)$default;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns description by specified reason code
|
115 |
+
*
|
116 |
+
* @param string $code
|
117 |
+
* @return string
|
118 |
+
*/
|
119 |
+
public function getDescriptionOfCancellationReasonByCode($code)
|
120 |
+
{
|
121 |
+
return (string)Mage::getConfig()->getNode(self::XML_PATH_CANCELLATION_REASONS . '/' . $code);
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Returns estimated shipping period in days
|
126 |
+
*
|
127 |
+
* @return integer
|
128 |
+
*/
|
129 |
+
public function getEstimatedShippingPeriod()
|
130 |
+
{
|
131 |
+
return Mage::getStoreConfig(self::XML_PATH_ESTIMATED_SHIP_DATE);
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Returns FTP host's name of Google trusted stores account
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function getFtpHostName()
|
140 |
+
{
|
141 |
+
return Mage::getConfig()->getNode(self::XML_PATH_FTP_HOSTNAME);
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Returns FTP user name of Google trusted stores account
|
146 |
+
*
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
public function getFtpUserName()
|
150 |
+
{
|
151 |
+
return Mage::getStoreConfig(self::XML_PATH_FTP_USERNAME);
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Returns FTP user name of Google trusted stores account
|
156 |
+
*
|
157 |
+
* @return string
|
158 |
+
*/
|
159 |
+
public function getFtpPassword()
|
160 |
+
{
|
161 |
+
return Mage::helper('core')->decrypt(Mage::getStoreConfig(self::XML_PATH_FTP_PASSWORD));
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Returns full local path to feed
|
166 |
+
*
|
167 |
+
* @return string
|
168 |
+
*/
|
169 |
+
public function getFtpShipmentFileName()
|
170 |
+
{
|
171 |
+
return Mage::getBaseDir('tmp') . DIRECTORY_SEPARATOR . $this->getFtpShipmentTargetFileName();
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Get FTP shipment target file name
|
176 |
+
*
|
177 |
+
* @return string
|
178 |
+
*/
|
179 |
+
public function getFtpShipmentTargetFileName()
|
180 |
+
{
|
181 |
+
return Mage::getStoreConfig(self::XML_PATH_SHIPMENT_FEED_FILENAME);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Get FTP cancellation file name
|
186 |
+
*
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
public function getFtpCancellationFileName()
|
190 |
+
{
|
191 |
+
return Mage::getBaseDir('tmp') . DIRECTORY_SEPARATOR . $this->getFtpCancellationTargetFileName();
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Get FTP cancellation target file name
|
196 |
+
*
|
197 |
+
* @return string
|
198 |
+
*/
|
199 |
+
public function getFtpCancellationTargetFileName()
|
200 |
+
{
|
201 |
+
return Mage::getStoreConfig(self::XML_PATH_CANCELLATION_FEED_FILENAME);
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Get last time when files were generated
|
206 |
+
*
|
207 |
+
* @return Zend_Date
|
208 |
+
*/
|
209 |
+
public function getLastTimeGenerated()
|
210 |
+
{
|
211 |
+
$dateString = Mage::getStoreConfig(self::XML_PATH_LAST_TIME_GENERATED_DATE);
|
212 |
+
|
213 |
+
return $dateString
|
214 |
+
? new Zend_Date($dateString, Zend_Date::ISO_8601)
|
215 |
+
: Zend_Date::now()->subDay(1);
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Set last time when files were generated
|
220 |
+
*
|
221 |
+
* @param Zend_Date $lastTime
|
222 |
+
*/
|
223 |
+
public function setLastTimeGenerated(Zend_Date $lastTime = null)
|
224 |
+
{
|
225 |
+
if (!$lastTime) {
|
226 |
+
$lastTime = Zend_Date::now();
|
227 |
+
}
|
228 |
+
Mage::getModel('core/config_data')
|
229 |
+
->load(self::XML_PATH_LAST_TIME_GENERATED_DATE, 'path')
|
230 |
+
->setPath(self::XML_PATH_LAST_TIME_GENERATED_DATE) // in case new record
|
231 |
+
->setValue($lastTime->toString(Zend_Date::ISO_8601))
|
232 |
+
->save();
|
233 |
+
Mage::app()->getStore()->resetConfig();
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Returns values for "carrier code" field of shipment feed
|
238 |
+
*
|
239 |
+
* @param string $shipmentCarrierCode Carrier code from shipment
|
240 |
+
* @return string
|
241 |
+
*/
|
242 |
+
public function getCarrierCode($shipmentCarrierCode)
|
243 |
+
{
|
244 |
+
$code = Mage::getConfig()->getNode(self::XML_PATH_CARRIERS . '/main/' . $shipmentCarrierCode);
|
245 |
+
|
246 |
+
return $code ? (string)$code : self::CARRIER_CODE_OTHER;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Returns value for "other carrier name" field of shipment feed
|
251 |
+
*
|
252 |
+
* @param string $shipmentCarrierCode Carrier code from shipment
|
253 |
+
* @return string
|
254 |
+
*/
|
255 |
+
public function getOtherCarrierName($shipmentCarrierCode)
|
256 |
+
{
|
257 |
+
$code = Mage::getConfig()->getNode(self::XML_PATH_CARRIERS . '/other/' . $shipmentCarrierCode);
|
258 |
+
|
259 |
+
return $code ? (string)$code : self::CARRIER_NAME_OTHER;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Returns Google Shopping Account Id
|
264 |
+
*
|
265 |
+
* @return string
|
266 |
+
*/
|
267 |
+
public function getGoogleShoppingAccountId()
|
268 |
+
{
|
269 |
+
return Mage::getStoreConfig(self::XML_PATH_GOOGLE_SHOPPING_ACCOUNT_ID);
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Returns email for subscritin to group
|
274 |
+
*
|
275 |
+
* @return string
|
276 |
+
*/
|
277 |
+
public function getSubscriptionEmail()
|
278 |
+
{
|
279 |
+
$email = Mage::getConfig()->getNode(self::XML_GOOGLE_GROUP_EMAIL);
|
280 |
+
if (!$email) {
|
281 |
+
throw new RuntimeException(
|
282 |
+
'Structure of config is incorrect; cannot get item by path ' . self::XML_GOOGLE_GROUP_EMAIL
|
283 |
+
);
|
284 |
+
}
|
285 |
+
list ($name, $domain) = explode('@', $email, 2);
|
286 |
+
|
287 |
+
return $name . '+subscribe@' . $domain;
|
288 |
+
}
|
289 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Feed/Abstract.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Base abstract class for feeds
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
abstract class Mage_GoogleTrustedStore_Model_Feed_Abstract
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Columns delimiter
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
const DLM_COLUMN = "\t";
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Rows delimiter
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
const DLM_ROW = "\n";
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Column names of header
|
49 |
+
*
|
50 |
+
* @var array|null
|
51 |
+
*/
|
52 |
+
private $_header;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Rows
|
56 |
+
*
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
private $_data = array();
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Defines header of feed
|
63 |
+
*
|
64 |
+
* @param array $columnNames
|
65 |
+
*/
|
66 |
+
protected function _setHeader(array $columnNames)
|
67 |
+
{
|
68 |
+
$this->_header = $columnNames;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Adds row to feed
|
73 |
+
*
|
74 |
+
* @param array $fields Field data
|
75 |
+
* @throws RuntimeException If header was not initialized before
|
76 |
+
* @throws InvalidArgumentException If size of header does not match size of data
|
77 |
+
*/
|
78 |
+
protected function _addRow(array $fields)
|
79 |
+
{
|
80 |
+
if (!is_array($this->_header)) {
|
81 |
+
throw new RuntimeException('Header is not initialized; define it with _setHeader method first.');
|
82 |
+
}
|
83 |
+
if (count($fields) != count($this->_header)) {
|
84 |
+
throw new InvalidArgumentException('Size of row does not match size of header.');
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->_data[] = $fields;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return string representation of feed
|
92 |
+
*
|
93 |
+
* @param bool $withHeader add header or not
|
94 |
+
*/
|
95 |
+
final public function toString($withHeader = true)
|
96 |
+
{
|
97 |
+
$str = ($withHeader && $this->_header)
|
98 |
+
? implode(self::DLM_COLUMN, $this->_header) . self::DLM_ROW
|
99 |
+
: '';
|
100 |
+
|
101 |
+
foreach ($this->_data as $row) {
|
102 |
+
$str .= implode(self::DLM_COLUMN, $row) . self::DLM_ROW;
|
103 |
+
}
|
104 |
+
|
105 |
+
return $str;
|
106 |
+
}
|
107 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Feed/Cancellation.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Cancellation feed model
|
29 |
+
*/
|
30 |
+
|
31 |
+
class Mage_GoogleTrustedStore_Model_Feed_Cancellation extends Mage_GoogleTrustedStore_Model_Feed_Abstract
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Initializes header, adds data to feed
|
35 |
+
*
|
36 |
+
* @param Mage_Sales_Model_Resource_Order_Collection $orders canceled orders collection
|
37 |
+
*/
|
38 |
+
public function __construct($orders)
|
39 |
+
{
|
40 |
+
$this->_setHeader(
|
41 |
+
array(
|
42 |
+
'merchant order id',
|
43 |
+
'reason'
|
44 |
+
)
|
45 |
+
);
|
46 |
+
foreach ($orders as $order) {
|
47 |
+
$this->_addCanceledOrder($order);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Adds canceled order to feed
|
53 |
+
*
|
54 |
+
* @param Mage_Sales_Model_Order $order
|
55 |
+
*/
|
56 |
+
protected function _addCanceledOrder(Mage_Sales_Model_Order $order)
|
57 |
+
{
|
58 |
+
if ($order->getCancellationReason()) {
|
59 |
+
$this->_addRow(
|
60 |
+
array(
|
61 |
+
$order->getIncrementId(),
|
62 |
+
$order->getCancellationReason()
|
63 |
+
)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Feed/Shipment.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shipment feed model
|
29 |
+
*/
|
30 |
+
class Mage_GoogleTrustedStore_Model_Feed_Shipment extends Mage_GoogleTrustedStore_Model_Feed_Abstract
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Initializes header, adds data to feed
|
34 |
+
*
|
35 |
+
* @param Mage_Sales_Model_Resource_Order_Shipment_Collection $shipments
|
36 |
+
*/
|
37 |
+
public function __construct($shipments)
|
38 |
+
{
|
39 |
+
$this->_setHeader(array(
|
40 |
+
'merchant order id',
|
41 |
+
'tracking number',
|
42 |
+
'carrier code',
|
43 |
+
'other carrier name',
|
44 |
+
'ship date',
|
45 |
+
));
|
46 |
+
foreach ($shipments as $shipment) {
|
47 |
+
$this->_addShipment($shipment);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Adds shipment to feed
|
53 |
+
*
|
54 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
55 |
+
*/
|
56 |
+
protected function _addShipment(Mage_Sales_Model_Order_Shipment $shipment)
|
57 |
+
{
|
58 |
+
if (count($shipment->getTracksCollection())) {
|
59 |
+
foreach ($shipment->getTracksCollection() as $track) {
|
60 |
+
$this->_addShipmentWithTrack($shipment, $track);
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
$this->_addShipmentWithTrack($shipment);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Adds shipment with specified tracking number
|
69 |
+
*
|
70 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
71 |
+
* @param Mage_Sales_Model_Order_Shipment_Track $track
|
72 |
+
*/
|
73 |
+
private function _addShipmentWithTrack(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order_Shipment_Track $track = null)
|
74 |
+
{
|
75 |
+
$mageCarrierCode = $this->_getCarrierCodeFromOrder($shipment->getOrder());
|
76 |
+
$carrierCode = $this->_getConfig()->getCarrierCode($mageCarrierCode);
|
77 |
+
$otherCarrierName = ($carrierCode == Mage_GoogleTrustedStore_Model_Config::CARRIER_CODE_OTHER)
|
78 |
+
? $this->_getConfig()->getOtherCarrierName($mageCarrierCode)
|
79 |
+
: '';
|
80 |
+
$this->_addRow(array(
|
81 |
+
$shipment->getOrder()->getIncrementId(),
|
82 |
+
$track ? $track->getNumber() : '',
|
83 |
+
$carrierCode,
|
84 |
+
$otherCarrierName,
|
85 |
+
$shipment->getCreatedAtDate()->toString('yyyy-MM-dd'),
|
86 |
+
));
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns carrier code of order
|
91 |
+
*
|
92 |
+
* @param Mage_Sales_Model_Order $order
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
protected function _getCarrierCodeFromOrder(Mage_Sales_Model_Order $order)
|
96 |
+
{
|
97 |
+
list ($carrierCode, $method) = explode('_', $order->getShippingMethod(), 2);
|
98 |
+
|
99 |
+
return $carrierCode;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Returns config
|
104 |
+
*
|
105 |
+
* @return Mage_GoogleTrustedStore_Model_Config
|
106 |
+
*/
|
107 |
+
protected function _getConfig()
|
108 |
+
{
|
109 |
+
return Mage::getSingleton('googletrustedstore/config');
|
110 |
+
}
|
111 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Feeder.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_Feeder
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Generates feeds for shipment and cancellation
|
31 |
+
*/
|
32 |
+
public function generateFeeds()
|
33 |
+
{
|
34 |
+
if (!$this->_getConfig()->isEnabled()) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
try {
|
38 |
+
$this->_generateShipmentFeed();
|
39 |
+
$this->_generateCancellationFeed();
|
40 |
+
$this->_getConfig()->setLastTimeGenerated();
|
41 |
+
} catch (RuntimeException $e) {
|
42 |
+
Mage::log('GoogleTrustedStore: ' . $e->getMessage());
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Generates feed for shipment and save it in temporary directory
|
48 |
+
*/
|
49 |
+
protected function _generateShipmentFeed()
|
50 |
+
{
|
51 |
+
$fromDate = $this->_getConfig()->getLastTimeGenerated();
|
52 |
+
|
53 |
+
$shipments = Mage::getResourceModel('sales/order_shipment_collection')
|
54 |
+
->addFieldToFilter('created_at', array('from' => $fromDate->toString(Zend_Date::ISO_8601)));
|
55 |
+
|
56 |
+
$this->_saveFeedToFile(
|
57 |
+
Mage::getModel('googletrustedstore/feed_shipment', $shipments),
|
58 |
+
$this->_getConfig()->getFtpShipmentFileName()
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Generates feed for canceled orders and saves it in temporary directory
|
64 |
+
*/
|
65 |
+
protected function _generateCancellationFeed()
|
66 |
+
{
|
67 |
+
$fromDate = $this->_getConfig()->getLastTimeGenerated();
|
68 |
+
|
69 |
+
$orders = Mage::getResourceModel('sales/order_collection')
|
70 |
+
->addFieldToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_CANCELED))
|
71 |
+
->addFieldToFilter('updated_at', array('from' => $fromDate->toString(Zend_Date::ISO_8601)));
|
72 |
+
|
73 |
+
$this->_saveFeedToFile(
|
74 |
+
Mage::getModel('googletrustedstore/feed_cancellation', $orders),
|
75 |
+
$this->_getConfig()->getFtpCancellationFileName()
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Saves feed to file
|
81 |
+
*
|
82 |
+
* @param Mage_GoogleTrustedStore_Model_Feed_Abstract $feed
|
83 |
+
* @param string $fileName
|
84 |
+
* @throws RuntimeException If error on file writing
|
85 |
+
*/
|
86 |
+
protected function _saveFeedToFile(Mage_GoogleTrustedStore_Model_Feed_Abstract $feed, $fileName)
|
87 |
+
{
|
88 |
+
$append = file_exists($fileName);
|
89 |
+
if (false === @file_put_contents($fileName, $feed->toString(!$append), $append ? FILE_APPEND : 0)) {
|
90 |
+
throw new RuntimeException("Unable to write feed to file '$fileName'.");
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Upload feeds (shipment/cancelled orders) to Google
|
96 |
+
*/
|
97 |
+
public function uploadFeeds()
|
98 |
+
{
|
99 |
+
if (!$this->_getConfig()->isEnabled()) {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
try {
|
103 |
+
$this->_uploadFiles(array(
|
104 |
+
$this->_getConfig()->getFtpShipmentFileName() => $this->_getConfig()->getFtpShipmentTargetFileName(),
|
105 |
+
$this->_getConfig()->getFtpCancellationFileName() => $this->_getConfig()->getFtpCancellationTargetFileName(),
|
106 |
+
));
|
107 |
+
} catch (Varien_Io_Exception $e) {
|
108 |
+
Mage::log('GoogleTrustedStore FTP upload error: ' . $e->getMessage());
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Upload file by file map to Google FTP server and delete it from local file system
|
114 |
+
*
|
115 |
+
* @param array $fileNameMap array('local file name' => 'remote file name', ...)
|
116 |
+
* @throws Varien_Io_Exception If FTP related error occurred
|
117 |
+
*/
|
118 |
+
protected function _uploadFiles(array $fileNameMap)
|
119 |
+
{
|
120 |
+
$ftp = new Varien_Io_Ftp;
|
121 |
+
$fs = new Varien_Io_File;
|
122 |
+
|
123 |
+
$result = $ftp->open(array(
|
124 |
+
'host' => $host = $this->_getConfig()->getFtpHostName(),
|
125 |
+
'user' => $this->_getConfig()->getFtpUserName(),
|
126 |
+
'password' => $this->_getConfig()->getFtpPassword(),
|
127 |
+
));
|
128 |
+
|
129 |
+
foreach ($fileNameMap as $localFileName => $targetFileName) {
|
130 |
+
if ($fs->fileExists($localFileName)) {
|
131 |
+
$result = $ftp->write($targetFileName, $localFileName);
|
132 |
+
if (false === $result) {
|
133 |
+
throw new Varien_Io_Exception("Unable to upload $localFileName to $targetFileName on sever $host");
|
134 |
+
}
|
135 |
+
$fs->rm($localFileName);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
$ftp->close();
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Returns config
|
144 |
+
*
|
145 |
+
* @return Mage_GoogleTrustedStore_Model_Config
|
146 |
+
*/
|
147 |
+
protected function _getConfig()
|
148 |
+
{
|
149 |
+
return Mage::getSingleton('googletrustedstore/config');
|
150 |
+
}
|
151 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/GoogleShoppingAdapter.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_GoogleShoppingAdapter
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @return Mage_GoogleShopping_Model_Config
|
31 |
+
*/
|
32 |
+
protected function _getConfig()
|
33 |
+
{
|
34 |
+
return Mage::getSingleton('googleshopping/config');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @throws RuntimeException if module is not active
|
39 |
+
*/
|
40 |
+
protected function _checkIsActive()
|
41 |
+
{
|
42 |
+
if (!$this->isActive()) {
|
43 |
+
throw new RuntimeException('You can use this method only if Mage_GoogleShopping is active.');
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* If Mage_GoogleShopping is active returns true
|
49 |
+
*
|
50 |
+
* @return bool
|
51 |
+
*/
|
52 |
+
public function isActive()
|
53 |
+
{
|
54 |
+
return Mage::getConfig()->getModuleConfig('Mage_GoogleShopping')->is('active');
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns Google merchant account ID
|
59 |
+
* If Mage_GoogleShopping active returns ID from it's config; returns value from own config
|
60 |
+
* otherwise.
|
61 |
+
*
|
62 |
+
* @param integer Store ID
|
63 |
+
* @return string ID of Google merchant account; null for current store
|
64 |
+
*/
|
65 |
+
public function getAccountId($storeId = null)
|
66 |
+
{
|
67 |
+
return $this->isActive()
|
68 |
+
? $this->_getConfig()->getAccountId($storeId)
|
69 |
+
: Mage::getSingleton('googletrustedstore/config')->getGoogleShoppingAccountId();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returns ISO code of target countryof store
|
74 |
+
*
|
75 |
+
* @param integer $storeId store ID; null for current store
|
76 |
+
* @return string ISO code
|
77 |
+
* @throws RuntimeException If Mage_GoogleShopping is disabled
|
78 |
+
*/
|
79 |
+
public function getTargetCountry($storeId = null)
|
80 |
+
{
|
81 |
+
$this->_checkIsActive();
|
82 |
+
|
83 |
+
return $this->_getConfig()->getTargetCountry($storeId);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Returns language's ISO code of target country
|
88 |
+
*
|
89 |
+
* @param integer $storeId Store ID null for current store
|
90 |
+
* @return string ISO code
|
91 |
+
* @throws RuntimeException If Mage_GoogleShopping is disabled
|
92 |
+
*/
|
93 |
+
public function getTargetLanguage($storeId = null)
|
94 |
+
{
|
95 |
+
$this->_checkIsActive();
|
96 |
+
|
97 |
+
return $this->_getConfig()->getCountryInfo($this->getTargetCountry($storeId), 'language', $storeId);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Return Google shopping item ID
|
102 |
+
*
|
103 |
+
* @param Mage_Catalog_Model_Product $product
|
104 |
+
* @param integer $storeId ID of store in which product was published; null for current store
|
105 |
+
* @return string|null ID or null if no such item
|
106 |
+
* @throws RuntimeException If Mage_GoogleShopping is disabled
|
107 |
+
*/
|
108 |
+
public function getItemId(Mage_Catalog_Model_Product $product, $storeId = null)
|
109 |
+
{
|
110 |
+
$this->_checkIsActive();
|
111 |
+
if ($storeId === null) {
|
112 |
+
$storeId = Mage::app()->getStore()->getId();
|
113 |
+
}
|
114 |
+
|
115 |
+
return Mage::getModel('googleshopping/item')
|
116 |
+
->loadByProduct($product->setStoreId($storeId))
|
117 |
+
->getGcontentItemId();
|
118 |
+
}
|
119 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Observer.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_Observer
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Adds to checkout session all order ids.
|
31 |
+
* This is done, because in native behavior such data is cleared after native usage on success page
|
32 |
+
*
|
33 |
+
* @param Varien_Event_Observer $observer
|
34 |
+
*/
|
35 |
+
public function collectMultishippingOrderIds(Varien_Event_Observer $observer)
|
36 |
+
{
|
37 |
+
$orderIds = $observer->getEvent()->getOrderIds();
|
38 |
+
Mage::getModel('checkout/session')->setData('multishipping_order_ids', $orderIds);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Adds cancellation reason to order from request
|
43 |
+
* Adds cancellation reason to order history comments
|
44 |
+
*
|
45 |
+
* @param Varien_Event_Observer $observer
|
46 |
+
*/
|
47 |
+
public function addCancellationReasonToOrder(Varien_Event_Observer $observer)
|
48 |
+
{
|
49 |
+
$reasonCode = $this->_getCancellationReason();
|
50 |
+
if ($reasonCode && Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
|
51 |
+
$order = $observer->getEvent()->getDataObject();
|
52 |
+
if ($order && $order->isCanceled()) {
|
53 |
+
$origState = $order->getOrigData('state');
|
54 |
+
if ($origState != Mage_Sales_Model_Order::STATE_CANCELED) {
|
55 |
+
$order->setCancellationReason($reasonCode);
|
56 |
+
$reasonDescription = Mage::getSingleton('googletrustedstore/source_orderCancellationReason')
|
57 |
+
->getDescriptionByCode($reasonCode);
|
58 |
+
$order->addStatusHistoryComment(Mage::helper('googletrustedstore')->__(
|
59 |
+
'Order was canceled because of next reason: %s',
|
60 |
+
$reasonDescription
|
61 |
+
));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Adds cancellation reason from request to session
|
69 |
+
*
|
70 |
+
* @param Varien_Event_Observer $observer
|
71 |
+
*/
|
72 |
+
public function addCancellationReasonToSession(Varien_Event_Observer $observer)
|
73 |
+
{
|
74 |
+
$reasonCode = $this->_getCancellationReason();
|
75 |
+
if ($reasonCode) {
|
76 |
+
$order = $observer->getEvent()->getOrder();
|
77 |
+
if ($order && !$order->getReordered()) { // then order edited
|
78 |
+
$this->_getSession()->setCancellationReason($reasonCode);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @return Mage_Adminhtml_Model_Session
|
85 |
+
*/
|
86 |
+
protected function _getSession()
|
87 |
+
{
|
88 |
+
return Mage::getSingleton('adminhtml/session');
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Adds last created from admin panel order id into admin session for further use
|
93 |
+
*
|
94 |
+
* @param Varien_Event_Observer $observer
|
95 |
+
*/
|
96 |
+
public function collectAdminOrderId(Varien_Event_Observer $observer)
|
97 |
+
{
|
98 |
+
$order = $observer->getEvent()->getOrder();
|
99 |
+
if ($order) {
|
100 |
+
$this->_getSession()->setLastAdminOrderId($order->getId());
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Add observer to specific event
|
106 |
+
*
|
107 |
+
* @param type $area
|
108 |
+
* @param type $eventName
|
109 |
+
* @param type $observerName
|
110 |
+
* @param type $observerClass
|
111 |
+
* @param type $observerMethod
|
112 |
+
* @return Mage_GoogleTrustedStore_Model_Observer
|
113 |
+
*/
|
114 |
+
protected function _addObserver($area, $eventName, $observerName, $observerClass, $observerMethod)
|
115 |
+
{
|
116 |
+
$eventConfig = Mage::getConfig()->getEventConfig($area, $eventName);
|
117 |
+
if (!$eventConfig) {
|
118 |
+
$eventConfig = Mage::getConfig()->getNode($area)->events->addChild($eventName);
|
119 |
+
}
|
120 |
+
if (isset($eventConfig->observers)) {
|
121 |
+
$eventObservers = $eventConfig->observers;
|
122 |
+
} else {
|
123 |
+
$eventObservers = $eventConfig->addChild('observers');
|
124 |
+
}
|
125 |
+
$observer = $eventObservers->addChild($observerName);
|
126 |
+
$observer->addChild('class', $observerClass);
|
127 |
+
$observer->addChild('method', $observerMethod);
|
128 |
+
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Dynamically add adminhtml_block_html_before event observer for adminhtml_sales_order_index action
|
134 |
+
* observes controller_action_predispatch_adminhtml_sales_order_index event
|
135 |
+
*
|
136 |
+
* @param Varien_Event_Observer $observer
|
137 |
+
* @return Mage_GoogleTrustedStore_Model_Observer
|
138 |
+
*/
|
139 |
+
public function addOrderGridBlocksRenderingObserver(Varien_Event_Observer $observer)
|
140 |
+
{
|
141 |
+
$this->_addObserver('adminhtml',
|
142 |
+
'adminhtml_block_html_before',
|
143 |
+
'googletrustedstore_order_grid_add_cancellation_reasons',
|
144 |
+
'googletrustedstore/observer',
|
145 |
+
'orderGridAddCancellationReasons'
|
146 |
+
);
|
147 |
+
|
148 |
+
return $this;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Add cancellation reasons selector to the 'Cancel' action
|
153 |
+
*
|
154 |
+
* @param Varien_Event_Observer $observer
|
155 |
+
* @return Mage_GoogleTrustedStore_Model_Observer
|
156 |
+
*/
|
157 |
+
public function orderGridAddCancellationReasons(Varien_Event_Observer $observer)
|
158 |
+
{
|
159 |
+
$block = $observer->getBlock();
|
160 |
+
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract) {
|
161 |
+
$item = $block->getItem('cancel_order');
|
162 |
+
$source = Mage::getSingleton('googletrustedstore/source_orderCancellationReason');
|
163 |
+
$item->setAdditionalActionBlock(
|
164 |
+
array(
|
165 |
+
$block->getHtmlId() . '_' . 'cancellation_reason' => array(
|
166 |
+
'name' => 'cancellation_reason',
|
167 |
+
'type' => 'select',
|
168 |
+
'class' => 'required-entry',
|
169 |
+
'label' => Mage::helper('googletrustedstore')->__('Cancellation Reason'),
|
170 |
+
'values' => $source->toOptionArray(),
|
171 |
+
'value' => $source->getDefaultCode(),
|
172 |
+
)
|
173 |
+
)
|
174 |
+
);
|
175 |
+
}
|
176 |
+
return $this;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Return cancellation reason code from request or session if cannot get from request
|
181 |
+
*
|
182 |
+
* @return string|null
|
183 |
+
*/
|
184 |
+
protected function _getCancellationReason()
|
185 |
+
{
|
186 |
+
$reason = Mage::app()->getRequest()->getParam('cancellation_reason');
|
187 |
+
if (!$reason && $this->_getSession()->hasCancellationReason()) {
|
188 |
+
$reason = $this->_getSession()->getCancellationReason();
|
189 |
+
}
|
190 |
+
|
191 |
+
return $reason;
|
192 |
+
}
|
193 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Source/OrderCancellationReason.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_GoogleTrustedStore_Model_Source_OrderCancellationReason
|
28 |
+
{
|
29 |
+
private $_options;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepares array value=>label for available order cancellation reasons
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
* @throws RuntimeException If cannot read the reasons from the config
|
36 |
+
*/
|
37 |
+
public function toOptionArray()
|
38 |
+
{
|
39 |
+
if (!is_array($this->_options)) {
|
40 |
+
$this->_options = array();
|
41 |
+
$reasons = Mage::getSingleton('googletrustedstore/config')->getCancellationReasons();
|
42 |
+
foreach ($reasons as $code => $description) {
|
43 |
+
$this->_options[] = array(
|
44 |
+
'value' => $code,
|
45 |
+
'label' => Mage::helper('googletrustedstore')->__((string)$description),
|
46 |
+
);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return $this->_options;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns code of default cancelation reason
|
55 |
+
*
|
56 |
+
* @throws RuntimeException If cannot read the reason or reason is not listed
|
57 |
+
* @return string Reason
|
58 |
+
*/
|
59 |
+
public function getDefaultCode()
|
60 |
+
{
|
61 |
+
return Mage::getSingleton('googletrustedstore/config')->getDefaultCancellationReasonCode();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns reason text description by specified reason code
|
66 |
+
*
|
67 |
+
* @param string $code
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public function getDescriptionByCode($code)
|
71 |
+
{
|
72 |
+
return Mage::getSingleton('googletrustedstore/config')->getDescriptionOfCancellationReasonByCode($code);
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/etc/config.xml
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_GoogleTrustedStore
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Mage_GoogleTrustedStore>
|
31 |
+
<version>1.6.0.0</version>
|
32 |
+
</Mage_GoogleTrustedStore>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<helpers>
|
36 |
+
<googletrustedstore>
|
37 |
+
<class>Mage_GoogleTrustedStore_Helper</class>
|
38 |
+
</googletrustedstore>
|
39 |
+
</helpers>
|
40 |
+
<models>
|
41 |
+
<googletrustedstore>
|
42 |
+
<class>Mage_GoogleTrustedStore_Model</class>
|
43 |
+
</googletrustedstore>
|
44 |
+
</models>
|
45 |
+
<resources>
|
46 |
+
<googletrustedstore_setup>
|
47 |
+
<setup>
|
48 |
+
<module>Mage_GoogleTrustedStore</module>
|
49 |
+
</setup>
|
50 |
+
</googletrustedstore_setup>
|
51 |
+
</resources>
|
52 |
+
<blocks>
|
53 |
+
<googletrustedstore>
|
54 |
+
<class>Mage_GoogleTrustedStore_Block</class>
|
55 |
+
</googletrustedstore>
|
56 |
+
</blocks>
|
57 |
+
<googletrustedstore>
|
58 |
+
<google_group_email>mage-google-trusted-store-news@googlegroups.com</google_group_email>
|
59 |
+
<order_cancellation_reasons>
|
60 |
+
<BuyerCanceled>Buyer Canceled</BuyerCanceled>
|
61 |
+
<MerchantCanceled>Merchant Canceled</MerchantCanceled>
|
62 |
+
<DuplicateInvalid>Duplicate Invalid</DuplicateInvalid>
|
63 |
+
<FraudFake>Fraud Fake</FraudFake>
|
64 |
+
</order_cancellation_reasons>
|
65 |
+
<ftp_host>uploads.google.com</ftp_host>
|
66 |
+
<carriers>
|
67 |
+
<main>
|
68 |
+
<ups>UPS</ups>
|
69 |
+
<fedex>FedEx</fedex>
|
70 |
+
<usps>USPS</usps>
|
71 |
+
</main>
|
72 |
+
<other>
|
73 |
+
<dhl>DHL</dhl>
|
74 |
+
<dhlint>DHL</dhlint>
|
75 |
+
</other>
|
76 |
+
</carriers>
|
77 |
+
</googletrustedstore>
|
78 |
+
</global>
|
79 |
+
<default>
|
80 |
+
<google>
|
81 |
+
<trustedstore>
|
82 |
+
<enabled>1</enabled>
|
83 |
+
<default_order_cancellation_reason>BuyerCanceled</default_order_cancellation_reason>
|
84 |
+
<estimated_ship_date>3</estimated_ship_date>
|
85 |
+
</trustedstore>
|
86 |
+
</google>
|
87 |
+
</default>
|
88 |
+
<frontend>
|
89 |
+
<layout>
|
90 |
+
<updates>
|
91 |
+
<googletrustedstore>
|
92 |
+
<file>googletrustedstore.xml</file>
|
93 |
+
</googletrustedstore>
|
94 |
+
</updates>
|
95 |
+
</layout>
|
96 |
+
<events>
|
97 |
+
<checkout_multishipping_controller_success_action>
|
98 |
+
<observers>
|
99 |
+
<googletrustedstore>
|
100 |
+
<type>model</type>
|
101 |
+
<class>googletrustedstore/observer</class>
|
102 |
+
<method>collectMultishippingOrderIds</method>
|
103 |
+
</googletrustedstore>
|
104 |
+
</observers>
|
105 |
+
</checkout_multishipping_controller_success_action>
|
106 |
+
</events>
|
107 |
+
</frontend>
|
108 |
+
<adminhtml>
|
109 |
+
<translate>
|
110 |
+
<modules>
|
111 |
+
<Mage_GoogleShopping>
|
112 |
+
<files>
|
113 |
+
<default>Mage_GoogleTrustedStore.csv</default>
|
114 |
+
</files>
|
115 |
+
</Mage_GoogleShopping>
|
116 |
+
</modules>
|
117 |
+
</translate>
|
118 |
+
<layout>
|
119 |
+
<updates>
|
120 |
+
<googletrustedstore>
|
121 |
+
<file>googletrustedstore.xml</file>
|
122 |
+
</googletrustedstore>
|
123 |
+
</updates>
|
124 |
+
</layout>
|
125 |
+
<events>
|
126 |
+
<sales_order_save_before>
|
127 |
+
<observers>
|
128 |
+
<googletrustedstore>
|
129 |
+
<type>model</type>
|
130 |
+
<class>googletrustedstore/observer</class>
|
131 |
+
<method>addCancellationReasonToOrder</method>
|
132 |
+
</googletrustedstore>
|
133 |
+
</observers>
|
134 |
+
</sales_order_save_before>
|
135 |
+
<sales_convert_order_to_quote>
|
136 |
+
<observers>
|
137 |
+
<googletrustedstore>
|
138 |
+
<type>model</type>
|
139 |
+
<class>googletrustedstore/observer</class>
|
140 |
+
<method>addCancellationReasonToSession</method>
|
141 |
+
</googletrustedstore>
|
142 |
+
</observers>
|
143 |
+
</sales_convert_order_to_quote>
|
144 |
+
<checkout_submit_all_after>
|
145 |
+
<observers>
|
146 |
+
<googletrustedstore>
|
147 |
+
<type>model</type>
|
148 |
+
<class>googletrustedstore/observer</class>
|
149 |
+
<method>collectAdminOrderId</method>
|
150 |
+
</googletrustedstore>
|
151 |
+
</observers>
|
152 |
+
</checkout_submit_all_after>
|
153 |
+
<controller_action_predispatch_adminhtml_sales_order_index>
|
154 |
+
<observers>
|
155 |
+
<googletrustedstore>
|
156 |
+
<type>model</type>
|
157 |
+
<class>googletrustedstore/observer</class>
|
158 |
+
<method>addOrderGridBlocksRenderingObserver</method>
|
159 |
+
</googletrustedstore>
|
160 |
+
</observers>
|
161 |
+
</controller_action_predispatch_adminhtml_sales_order_index>
|
162 |
+
</events>
|
163 |
+
</adminhtml>
|
164 |
+
<crontab>
|
165 |
+
<jobs>
|
166 |
+
<googletrustedstore_generate_feeds>
|
167 |
+
<schedule>
|
168 |
+
<cron_expr>0 2 * * *</cron_expr>
|
169 |
+
</schedule>
|
170 |
+
<run>
|
171 |
+
<model>googletrustedstore/feeder::generateFeeds</model>
|
172 |
+
</run>
|
173 |
+
</googletrustedstore_generate_feeds>
|
174 |
+
<googletrustedstore_upload_feeds>
|
175 |
+
<schedule>
|
176 |
+
<cron_expr>0 5 * * *</cron_expr>
|
177 |
+
</schedule>
|
178 |
+
<run>
|
179 |
+
<model>googletrustedstore/feeder::uploadFeeds</model>
|
180 |
+
</run>
|
181 |
+
</googletrustedstore_upload_feeds>
|
182 |
+
</jobs>
|
183 |
+
</crontab>
|
184 |
+
</config>
|
app/code/core/Mage/GoogleTrustedStore/etc/system.xml
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_GoogleTrustedStore
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<google translate="label" module="googletrustedstore">
|
31 |
+
<groups>
|
32 |
+
<trustedstore translate="label">
|
33 |
+
<label>Google Trusted Store</label>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>250</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>0</show_in_store>
|
39 |
+
<fields>
|
40 |
+
<enabled translate="label">
|
41 |
+
<label>Google Trusted Store Program</label>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
44 |
+
<sort_order>5</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>0</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
</enabled>
|
49 |
+
<account_id translate="label">
|
50 |
+
<depends><enabled>1</enabled></depends>
|
51 |
+
<label>Google Trusted Store Merchant ID</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<validate>required-entry validate-digits</validate>
|
54 |
+
<sort_order>10</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>0</show_in_website>
|
57 |
+
<show_in_store>0</show_in_store>
|
58 |
+
</account_id>
|
59 |
+
<default_order_cancellation_reason translate="label">
|
60 |
+
<depends><enabled>1</enabled></depends>
|
61 |
+
<label>Default Order Cancellation Reason</label>
|
62 |
+
<comment><![CDATA[Used if origin of cancellation is outside of admin.]]></comment>
|
63 |
+
<frontend_type>select</frontend_type>
|
64 |
+
<source_model>googletrustedstore/source_orderCancellationReason</source_model>
|
65 |
+
<sort_order>15</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>0</show_in_website>
|
68 |
+
<show_in_store>0</show_in_store>
|
69 |
+
</default_order_cancellation_reason>
|
70 |
+
<estimated_ship_date translate="label">
|
71 |
+
<depends><enabled>1</enabled></depends>
|
72 |
+
<label>Estimated Ship Date</label>
|
73 |
+
<comment><![CDATA[The estimated days count from order created date, on which you will ship the order; this is not the estimated delivery date.]]></comment>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<validate>validate-not-negative-number</validate>
|
76 |
+
<sort_order>20</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>0</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
</estimated_ship_date>
|
81 |
+
<ftp_username translate="label">
|
82 |
+
<depends><enabled>1</enabled></depends>
|
83 |
+
<label>FTP Username</label>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
|
86 |
+
<validate>required-entry</validate>
|
87 |
+
<sort_order>25</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>0</show_in_website>
|
90 |
+
<show_in_store>0</show_in_store>
|
91 |
+
</ftp_username>
|
92 |
+
<ftp_password translate="label">
|
93 |
+
<depends><enabled>1</enabled></depends>
|
94 |
+
<label>FTP Password</label>
|
95 |
+
<frontend_type>obscure</frontend_type>
|
96 |
+
<comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
|
97 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
98 |
+
<validate>required-entry</validate>
|
99 |
+
<sort_order>30</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>0</show_in_website>
|
102 |
+
<show_in_store>0</show_in_store>
|
103 |
+
</ftp_password>
|
104 |
+
<cancellation_feed_filename translate="label">
|
105 |
+
<depends><enabled>1</enabled></depends>
|
106 |
+
<label>Cancellation Feed Filename</label>
|
107 |
+
<frontend_type>text</frontend_type>
|
108 |
+
<backend_model>googletrustedstore/backend_feedFilename</backend_model>
|
109 |
+
<comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
|
110 |
+
<validate>required-entry</validate>
|
111 |
+
<sort_order>35</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>0</show_in_website>
|
114 |
+
<show_in_store>0</show_in_store>
|
115 |
+
</cancellation_feed_filename>
|
116 |
+
<shipment_feed_filename translate="label">
|
117 |
+
<depends><enabled>1</enabled></depends>
|
118 |
+
<label>Shipment Feed Filename</label>
|
119 |
+
<frontend_type>text</frontend_type>
|
120 |
+
<backend_model>googletrustedstore/backend_feedFilename</backend_model>
|
121 |
+
<comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
|
122 |
+
<validate>required-entry</validate>
|
123 |
+
<sort_order>40</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>0</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
</shipment_feed_filename>
|
128 |
+
<google_shopping_account_id translate="label">
|
129 |
+
<depends><enabled>1</enabled></depends>
|
130 |
+
<label>Google Shopping Account ID</label>
|
131 |
+
<frontend_type>text</frontend_type>
|
132 |
+
<frontend_model>googletrustedstore/adminhtml_system_config_googleShoppingAccountId</frontend_model>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>0</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
<comment><![CDATA[Use this field to enter your Google Shopping Account ID if GoogleShopping module is unavailable.]]></comment>
|
137 |
+
<validate>validate-digits</validate>
|
138 |
+
<sort_order>45</sort_order>
|
139 |
+
</google_shopping_account_id>
|
140 |
+
<subscription_for_updates translate="label">
|
141 |
+
<label>Subscribe for updates</label>
|
142 |
+
<frontend_type>label</frontend_type>
|
143 |
+
<frontend_model>googletrustedstore/adminhtml_system_config_subscribe</frontend_model>
|
144 |
+
<backend_model>googletrustedstore/backend_subscribe</backend_model>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>0</show_in_website>
|
147 |
+
<show_in_store>0</show_in_store>
|
148 |
+
<comment><![CDATA[Enter your email address to receive important product updates. We will not distribute your information or use your email for any other communication.]]></comment>
|
149 |
+
<sort_order>50</sort_order>
|
150 |
+
</subscription_for_updates>
|
151 |
+
</fields>
|
152 |
+
</trustedstore>
|
153 |
+
</groups>
|
154 |
+
</google>
|
155 |
+
</sections>
|
156 |
+
</config>
|
app/code/core/Mage/GoogleTrustedStore/sql/googletrustedstore_setup/install-1.6.0.0.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
29 |
+
$installer = $this;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepare database for tables setup
|
33 |
+
*/
|
34 |
+
$installer->getConnection()
|
35 |
+
->addColumn($installer->getTable('sales/order'), 'cancellation_reason', array(
|
36 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
37 |
+
'length' => '64',
|
38 |
+
'nullable' => true,
|
39 |
+
'comment' => 'Order Cancellation Reason',
|
40 |
+
)
|
41 |
+
);
|
app/code/core/Mage/GoogleTrustedStore/sql/googletrustedstore_setup/mysql4-install-1.6.0.0.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleTrustedStore
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
29 |
+
$installer = $this;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepare database for tables setup
|
33 |
+
*/
|
34 |
+
$installer->getConnection()->addColumn(
|
35 |
+
$installer->getTable('sales/order'),
|
36 |
+
'cancellation_reason',
|
37 |
+
'varchar(64) DEFAULT NULL COMMENT "Order Cancellation Reason"'
|
38 |
+
);
|
app/design/adminhtml/default/default/layout/googletrustedstore.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category
|
23 |
+
* @package
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<layout>
|
29 |
+
<adminhtml_sales_order_view>
|
30 |
+
<reference name="head">
|
31 |
+
<action method="addItem" ifconfig="google/trustedstore/enabled"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
32 |
+
<action method="addItem" ifconfig="google/trustedstore/enabled"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
|
33 |
+
</reference>
|
34 |
+
|
35 |
+
<reference name="sales_order_edit">
|
36 |
+
<action method="updateButton" ifconfig="google/trustedstore/enabled">
|
37 |
+
<id>order_cancel</id>
|
38 |
+
<key>onclick</key>
|
39 |
+
<data><![CDATA[cancelConfirmationWindow.open('cancel')]]></data>
|
40 |
+
</action>
|
41 |
+
<action method="updateButton" ifconfig="google/trustedstore/enabled">
|
42 |
+
<id>order_edit</id>
|
43 |
+
<key>onclick</key>
|
44 |
+
<data><![CDATA[cancelConfirmationWindow.open('edit')]]></data>
|
45 |
+
</action>
|
46 |
+
</reference>
|
47 |
+
|
48 |
+
<reference name="content">
|
49 |
+
<block type="adminhtml/template" template="googletrustedstore/cancellation_confirmation_js.phtml" name='cancel_confirm_js' ifconfig="google/trustedstore/enabled">
|
50 |
+
<block name="form" type="googletrustedstore/adminhtml_orderCancellationConfirmation"/>
|
51 |
+
</block>
|
52 |
+
<block type="googletrustedstore/adminhtml_orderCreatedConfirmation" name="order_created_confirmation_js" template="googletrustedstore/order_confirmation.phtml" />
|
53 |
+
</reference>
|
54 |
+
</adminhtml_sales_order_view>
|
55 |
+
</layout>
|
app/design/adminhtml/default/default/template/googletrustedstore/cancellation_confirmation_js.phtml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
$currentOrderId = Mage::registry('current_order') ? Mage::registry('current_order')->getId() : null;
|
29 |
+
?>
|
30 |
+
<script type="text/javascript">
|
31 |
+
//<![CDATA[
|
32 |
+
|
33 |
+
var CancelConfirmation = function () {
|
34 |
+
var confirmationPopupHtml = <?php echo Mage::helper('core')->jsonEncode($this->getChild('form')->toHtml()) ?>;
|
35 |
+
var cancelTitle = '<?php echo $this->jsQuoteEscape($this->__('Are you sure to cancel order?')) ?>';
|
36 |
+
var editTitle = '<?php echo $this->jsQuoteEscape($this->__('Are you sure? This order will be canceled and a new one will be created instead.')) ?>';
|
37 |
+
|
38 |
+
this.open = function(reason) {
|
39 |
+
this.overlayShowEffectOptions = Windows.overlayShowEffectOptions;
|
40 |
+
this.overlayHideEffectOptions = Windows.overlayHideEffectOptions;
|
41 |
+
Windows.overlayShowEffectOptions = {duration:0};
|
42 |
+
Windows.overlayHideEffectOptions = {duration:0};
|
43 |
+
|
44 |
+
Dialog.confirm(confirmationPopupHtml, {
|
45 |
+
draggable: true,
|
46 |
+
resizable: true,
|
47 |
+
closable: true,
|
48 |
+
className: 'magento',
|
49 |
+
windowClassName: 'popup-window',
|
50 |
+
title: (reason == 'edit') ? editTitle : cancelTitle,
|
51 |
+
width: 550,
|
52 |
+
height: 100,
|
53 |
+
zIndex: 1000,
|
54 |
+
recenterAuto: false,
|
55 |
+
hideEffect: Element.hide,
|
56 |
+
showEffect: Element.show,
|
57 |
+
id: "catalog-wysiwyg-editor",
|
58 |
+
buttonClass: "form-button",
|
59 |
+
okLabel: '<?php echo $this->jsQuoteEscape($this->__('OK')) ?>',
|
60 |
+
cancelLabel: '<?php echo $this->jsQuoteEscape($this->__('Cancel')) ?>',
|
61 |
+
ok: function () {
|
62 |
+
var action;
|
63 |
+
if (reason == 'edit') {
|
64 |
+
action = <?php
|
65 |
+
echo Mage::helper('core')->jsonEncode(
|
66 |
+
$this->getUrl('*/sales_order_edit/start', array('order_id' => $currentOrderId))
|
67 |
+
);
|
68 |
+
?>;
|
69 |
+
} else {
|
70 |
+
action = <?php
|
71 |
+
echo Mage::helper('core')->jsonEncode(
|
72 |
+
$this->getUrl('*/*/cancel', array('order_id' => $currentOrderId))
|
73 |
+
);
|
74 |
+
?>;
|
75 |
+
}
|
76 |
+
|
77 |
+
window.location = action + '?cancellation_reason=' + escape($('order_cancellation_reason').getValue());
|
78 |
+
}
|
79 |
+
});
|
80 |
+
}
|
81 |
+
};
|
82 |
+
|
83 |
+
var cancelConfirmationWindow = new CancelConfirmation;
|
84 |
+
|
85 |
+
//]]>
|
86 |
+
</script>
|
87 |
+
|
88 |
+
<style type="text/css">
|
89 |
+
#catalog-wysiwyg-editor_content .magento_message {padding-top: 10px}
|
90 |
+
</style>
|
91 |
+
|
app/design/adminhtml/default/default/template/googletrustedstore/order_confirmation.phtml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Template to add Google provided JavaScript code on order created successfully page in admin panel
|
29 |
+
*/
|
30 |
+
?>
|
31 |
+
<!-- BEGIN: Google Trusted Store -->
|
32 |
+
<script type="text/javascript">
|
33 |
+
var gts = gts || [];
|
34 |
+
|
35 |
+
gts.push(["id", "<?php echo $this->getAccountId(); // there is only digits, validation in config ?>"]);
|
36 |
+
<?php if ($this->getGoogleShoppingAccountId()): ?>
|
37 |
+
gts.push(["google_base_subaccount_id", "<?php echo $this->getGoogleShoppingAccountId() // could be only digits ?>"]);
|
38 |
+
<?php endif; ?>
|
39 |
+
(function() {
|
40 |
+
var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
|
41 |
+
var gts = document.createElement("script");
|
42 |
+
gts.type = "text/javascript";
|
43 |
+
gts.async = true;
|
44 |
+
gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
|
45 |
+
var s = document.getElementsByTagName("script")[0];
|
46 |
+
s.parentNode.insertBefore(gts, s);
|
47 |
+
})();
|
48 |
+
</script>
|
49 |
+
<!-- END: Google Trusted Store -->
|
50 |
+
<!-- START Trusted Stores Order -->
|
51 |
+
<div id="gts-order" style="display:none;">
|
52 |
+
|
53 |
+
<!-- start order and merchant information -->
|
54 |
+
<span id="gts-o-id"><?php echo $this->getOrderIncrementId() ?></span>
|
55 |
+
<span id="gts-o-domain"><?php echo $this->getOrderDomain() ?></span>
|
56 |
+
<span id="gts-o-email"><?php echo $this->getCustomerEmail() ?></span>
|
57 |
+
<span id="gts-o-country"><?php echo $this->getCustomerCountry() ?></span>
|
58 |
+
<span id="gts-o-currency"><?php echo $this->getCurrencyCode() ?></span>
|
59 |
+
<span id="gts-o-total"><?php echo $this->getOrderTotal() ?></span>
|
60 |
+
<span id="gts-o-discounts"><?php echo $this->getOrderDiscount() ?></span>
|
61 |
+
<span id="gts-o-shipping-total"><?php echo $this->getOrderShipping() ?></span>
|
62 |
+
<span id="gts-o-tax-total"><?php echo $this->getOrderTax() ?></span>
|
63 |
+
<span id="gts-o-est-ship-date"><?php echo $this->getOrderShipDate() ?></span>
|
64 |
+
<span id="gts-o-has-preorder"><?php echo $this->hasBackorderPreorder() ?></span>
|
65 |
+
<span id="gts-o-has-digital"><?php echo $this->hasDigitalGoods() ?></span>
|
66 |
+
<!-- end order and merchant information -->
|
67 |
+
|
68 |
+
<?php foreach ($this->getItemsInformation() as $ii => $item) : ?>
|
69 |
+
<!-- start repeated item specific information -->
|
70 |
+
<span class="gts-item">
|
71 |
+
<span class="gts-i-name"><?php echo $item['name']; ?></span>
|
72 |
+
<span class="gts-i-price"><?php echo $item['price']; ?></span>
|
73 |
+
<span class="gts-i-quantity"><?php echo $item['qty']; ?></span>
|
74 |
+
<?php if (isset($item['gs'])) : ?>
|
75 |
+
<span class="gts-i-prodsearch-id"><?php echo $item['gs']['id'] ?></span>
|
76 |
+
<span class="gts-i-prodsearch-store-id"><?php echo $item['gs']['account_id'] ?></span>
|
77 |
+
<span class="gts-i-prodsearch-country"><?php echo $item['gs']['country'] ?></span>
|
78 |
+
<span class="gts-i-prodsearch-language"><?php echo $item['gs']['language'] ?></span>
|
79 |
+
<?php endif; ?>
|
80 |
+
</span>
|
81 |
+
<!-- end repeated item specific information -->
|
82 |
+
<?php endforeach; ?>
|
83 |
+
</div>
|
84 |
+
<!-- END Trusted Stores -->
|
app/design/frontend/base/default/layout/googletrustedstore.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package base_default
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
26 |
+
*/
|
27 |
+
|
28 |
+
* Google Trusted Store extension layout
|
29 |
+
-->
|
30 |
+
<layout version="0.1.0">
|
31 |
+
<default>
|
32 |
+
<reference name="after_body_start">
|
33 |
+
<block type="googletrustedstore/badge" name="google_trustedstore_badge" template="googletrustedstore/badge.phtml"/>
|
34 |
+
</reference>
|
35 |
+
</default>
|
36 |
+
<checkout_onepage_success>
|
37 |
+
<reference name="content">
|
38 |
+
<block type="googletrustedstore/orderConfirmation_Onepage" name="googletrustedstore.onepage.success" template="googletrustedstore/order_confirmation.phtml"/>
|
39 |
+
</reference>
|
40 |
+
</checkout_onepage_success>
|
41 |
+
<checkout_multishipping_success>
|
42 |
+
<reference name="content">
|
43 |
+
<block type="googletrustedstore/orderConfirmation_Multishipping" name="googletrustedstore.multishipping.success">
|
44 |
+
<block type="googletrustedstore/orderConfirmation_Onepage" name="googletrustedstore.item.success" template="googletrustedstore/order_confirmation.phtml"/>
|
45 |
+
</block>
|
46 |
+
</reference>
|
47 |
+
</checkout_multishipping_success>
|
48 |
+
</layout>
|
app/design/frontend/base/default/template/googletrustedstore/badge.phtml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package js
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Template to add Google provided JavaScript code on each page
|
29 |
+
*/
|
30 |
+
?>
|
31 |
+
<!-- BEGIN: Google Trusted Store -->
|
32 |
+
<script type="text/javascript">
|
33 |
+
//<![CDATA[
|
34 |
+
var gts = gts || [];
|
35 |
+
|
36 |
+
gts.push(["id", "<?php echo $this->getAccountId(); // there is only digits, validation in config ?>"]);
|
37 |
+
<?php if ($this->getGoogleShoppingAccountId()): ?>
|
38 |
+
gts.push(["google_base_subaccount_id", "<?php echo $this->getGoogleShoppingAccountId() // could be only digits ?>"]);
|
39 |
+
<?php endif; ?>
|
40 |
+
<?php if ($this->hasGoogleShoppingItem()) : ?>
|
41 |
+
gts.push(["google_base_offer_id", <?php echo Mage::helper('core')->jsonEncode($this->getGoogleShoppingItemId()) ?>]);
|
42 |
+
gts.push(["google_base_country", "<?php echo $this->getGoogleShoppingCountry() // ISO code from config ?>"]);
|
43 |
+
gts.push(["google_base_language", "<?php echo $this->getGoogleShoppingLanguage() // ISO code from config ?>"]);
|
44 |
+
<?php endif; ?>
|
45 |
+
|
46 |
+
(function() {
|
47 |
+
var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
|
48 |
+
var gts = document.createElement("script");
|
49 |
+
gts.type = "text/javascript";
|
50 |
+
gts.async = true;
|
51 |
+
gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
|
52 |
+
var s = document.getElementsByTagName("script")[0];
|
53 |
+
s.parentNode.insertBefore(gts, s);
|
54 |
+
})();
|
55 |
+
//]]>
|
56 |
+
</script>
|
57 |
+
<!-- END: Google Trusted Store -->
|
app/design/frontend/base/default/template/googletrustedstore/order_confirmation.phtml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package js
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Template to add Google provided JavaScript code on success order page
|
29 |
+
*/
|
30 |
+
?>
|
31 |
+
<?php if ($this->getOrderIncrementId()) : ?>
|
32 |
+
<!-- START Trusted Stores Order -->
|
33 |
+
<div id="gts-order" style="display:none;">
|
34 |
+
|
35 |
+
<!-- start order and merchant information -->
|
36 |
+
<span id="gts-o-id"><?php echo $this->getOrderIncrementId() ?></span>
|
37 |
+
<span id="gts-o-domain"><?php echo $this->getOrderDomain() ?></span>
|
38 |
+
<span id="gts-o-email"><?php echo $this->getCustomerEmail() ?></span>
|
39 |
+
<span id="gts-o-country"><?php echo $this->getCustomerCountry() ?></span>
|
40 |
+
<span id="gts-o-currency"><?php echo $this->getCurrencyCode() ?></span>
|
41 |
+
<span id="gts-o-total"><?php echo $this->getOrderTotal() ?></span>
|
42 |
+
<span id="gts-o-discounts"><?php echo $this->getOrderDiscount() ?></span>
|
43 |
+
<span id="gts-o-shipping-total"><?php echo $this->getOrderShipping() ?></span>
|
44 |
+
<span id="gts-o-tax-total"><?php echo $this->getOrderTax() ?></span>
|
45 |
+
<span id="gts-o-est-ship-date"><?php echo $this->getOrderShipDate() ?></span>
|
46 |
+
<span id="gts-o-has-preorder"><?php echo $this->hasBackorderPreorder() ?></span>
|
47 |
+
<span id="gts-o-has-digital"><?php echo $this->hasDigitalGoods() ?></span>
|
48 |
+
<!-- end order and merchant information -->
|
49 |
+
|
50 |
+
<?php foreach ($this->getItemsInformation() as $ii => $item) : ?>
|
51 |
+
<!-- start repeated item specific information -->
|
52 |
+
<span class="gts-item">
|
53 |
+
<span class="gts-i-name"><?php echo $item['name'] ?></span>
|
54 |
+
<span class="gts-i-price"><?php echo $item['price'] ?></span>
|
55 |
+
<span class="gts-i-quantity"><?php echo $item['qty'] ?></span>
|
56 |
+
<?php if (isset($item['gs'])) : ?>
|
57 |
+
<span class="gts-i-prodsearch-id"><?php echo $item['gs']['id'] ?></span>
|
58 |
+
<span class="gts-i-prodsearch-store-id"><?php echo $item['gs']['account_id'] ?></span>
|
59 |
+
<span class="gts-i-prodsearch-country"><?php echo $item['gs']['country'] ?></span>
|
60 |
+
<span class="gts-i-prodsearch-language"><?php echo $item['gs']['language'] ?></span>
|
61 |
+
<?php endif; ?>
|
62 |
+
</span>
|
63 |
+
<!-- end repeated item specific information -->
|
64 |
+
<?php endforeach; ?>
|
65 |
+
</div>
|
66 |
+
<!-- END Trusted Stores -->
|
67 |
+
<?php endif; ?>
|
app/etc/modules/Mage_GoogleTrustedStore.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_GoogleTrustedStore
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Mage_GoogleTrustedStore>
|
31 |
+
<active>true</active>
|
32 |
+
<codePool>core</codePool>
|
33 |
+
<depends>
|
34 |
+
<Mage_Adminhtml/>
|
35 |
+
<Mage_Checkout/>
|
36 |
+
</depends>
|
37 |
+
</Mage_GoogleTrustedStore>
|
38 |
+
</modules>
|
39 |
+
</config>
|
app/locale/en_US/Mage_GoogleTrustedStore.csv
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Are you sure to cancel order?","Are you sure to cancel order?"
|
2 |
+
"Are you sure? This order will be canceled and a new one will be created instead.","Are you sure? This order will be canceled and a new one will be created instead."
|
3 |
+
"Buyer Canceled","Buyer Canceled"
|
4 |
+
"Cancel","Cancel"
|
5 |
+
"Cancellation Feed Filename","Cancellation Feed Filename"
|
6 |
+
"Cancellation Reason","Cancellation Reason"
|
7 |
+
"Default Order Cancellation Reason","Default Order Cancellation Reason"
|
8 |
+
"Duplicate Invalid","Duplicate Invalid"
|
9 |
+
"Enter email and press <em>Subscribe</em> button.","Enter email and press <em>Subscribe</em> button."
|
10 |
+
"Estimated Ship Date","Estimated Ship Date"
|
11 |
+
"Fraud Fake","Fraud Fake"
|
12 |
+
"FTP Password","FTP Password"
|
13 |
+
"FTP Username","FTP Username"
|
14 |
+
"Google Shopping Account ID","Google Shopping Account ID"
|
15 |
+
"Google Trusted Store","Google Trusted Store"
|
16 |
+
"Google Trusted Store Merchant ID","Google Trusted Store Merchant ID"
|
17 |
+
"Google Trusted Store Program","Google Trusted Store Program"
|
18 |
+
"Incorrect email for subscription.","Incorrect email for subscription."
|
19 |
+
"Merchant Canceled","Merchant Canceled"
|
20 |
+
"OK","OK"
|
21 |
+
"Order was canceled because of next reason: %s","Order was canceled because of next reason: %s"
|
22 |
+
"Please use only letters (a-z or A-Z), numbers (0-9), underscore (_) or dot (.) in feed filename field. No spaces or other characters are allowed.","Please use only letters (a-z or A-Z), numbers (0-9), underscore (_) or dot (.) in feed filename field. No spaces or other characters are allowed."
|
23 |
+
"Shipment Feed Filename","Shipment Feed Filename"
|
24 |
+
"Subscribe","Subscribe"
|
25 |
+
"Subscribe for updates","Subscribe for updates"
|
26 |
+
"Subscription request has been sent to %s.","Subscription request has been sent to %s."
|
27 |
+
"The estimated days count from order created date, on which you will ship the order; this is not the estimated delivery date.","The estimated days count from order created date, on which you will ship the order; this is not the estimated delivery date."
|
28 |
+
"The same as you entered in Google Merchant Center.","The same as you entered in Google Merchant Center."
|
29 |
+
"Use this field to enter your Google Shopping Account ID if GoogleShopping module is unavailable.","Use this field to enter your Google Shopping Account ID if GoogleShopping module is unavailable."
|
30 |
+
"Used if origin of cancellation is outside of admin.","Used if origin of cancellation is outside of admin."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mage_GoogleTrustedStore</name>
|
4 |
+
<version>1.0.6</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Magento Integration with the Google Trusted Stores Program.</summary>
|
10 |
+
<description>This extension will insert the necessary javascript code on each page, as well as aggregate and send cancellation and shipment information to Google FTP via cron scheduling.</description>
|
11 |
+
<notes>Fixed some minor bugs.</notes>
|
12 |
+
<authors><author><name>Magento</name><user>Magento</user><email>Magento-GTS-Support@magento.com</email></author></authors>
|
13 |
+
<date>2012-08-28</date>
|
14 |
+
<time>17:29:57</time>
|
15 |
+
<contents><target name="magecore"><dir name="Mage"><dir name="GoogleTrustedStore"><dir name="Block"><dir name="Adminhtml"><file name="OrderCancellationConfirmation.php" hash="8c61ad65225d39455e2afacddce44f85"/><file name="OrderCreatedConfirmation.php" hash="a90d902658a347a07a15201346a3e656"/><dir name="System"><dir name="Config"><file name="GoogleShoppingAccountId.php" hash="d0409611c1d455c253a2f5631d44ce54"/><file name="Subscribe.php" hash="e8f0b933730328caa424e31481f7cd55"/></dir></dir></dir><file name="Badge.php" hash="e663999982b85a496961b7baf49778fa"/><dir name="OrderConfirmation"><file name="Multishipping.php" hash="0f3d584ddb4b79f0983e74074e135c81"/><file name="Onepage.php" hash="250e1e1bd036287fc26c6f66284dc805"/></dir></dir><dir name="Helper"><file name="Data.php" hash="591c410ace257227bc9b5a4fdcf7863f"/></dir><dir name="Model"><dir name="Backend"><file name="FeedFilename.php" hash="cacf65c037a240eac59acc1711e35c4d"/><file name="Subscribe.php" hash="cda3b389e7b9dc4590de31e47b8174d0"/></dir><file name="Config.php" hash="8385badef708b5aa8765603265456320"/><dir name="Feed"><file name="Abstract.php" hash="9a713195a0726b48a75a199a991664fc"/><file name="Cancellation.php" hash="a4120f17b06491616eff2161d3a60917"/><file name="Shipment.php" hash="027e8f707319e4557fc6b6a4ac970e68"/></dir><file name="Feeder.php" hash="1085548b3d843c3721ea1427c8594cd6"/><file name="GoogleShoppingAdapter.php" hash="b1c8025617e7fe123af409cf23c063b3"/><file name="Observer.php" hash="37c237ddb8a305f2ec7aaff26f524092"/><dir name="Source"><file name="OrderCancellationReason.php" hash="07c09c5ffe93e59ec8261fdb29b0804e"/></dir></dir><dir name="etc"><file name="config.xml" hash="09a03970d36cf1a771e756ce9a65b48e"/><file name="system.xml" hash="5bcdb36276e4a99e6f4101ff559be744"/></dir><dir name="sql"><dir name="googletrustedstore_setup"><file name="install-1.6.0.0.php" hash="6d36929809447de9bc13df36fcdacb0b"/><file name="mysql4-install-1.6.0.0.php" hash="d5769dc78fc807ea0b4f1bcfe945bf8b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_GoogleTrustedStore.xml" hash="4026b7592abb323fcd25d7c7d572e63f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="googletrustedstore.xml" hash="ab2192939a8b3eb8d435d268cadb0c32"/></dir><dir name="template"><dir name="googletrustedstore"><file name="cancellation_confirmation_js.phtml" hash="62d45ec3128cf23045ec27e4ad2251dd"/><file name="order_confirmation.phtml" hash="8b26001d9f0bb6783d60fb70e3566f5d"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="googletrustedstore.xml" hash="2c6becbef2f6d8969efee1d87463beb1"/></dir><dir name="template"><dir name="googletrustedstore"><file name="badge.phtml" hash="890a6baa0e211879a099b5db72072e49"/><file name="order_confirmation.phtml" hash="20ffe17f566aec0fc9993504992d1078"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_GoogleTrustedStore.csv" hash="aabfd6e72903e3d2f37c87a1d6d4cca4"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.13</min><max>5.3.100</max></php></required></dependencies>
|
18 |
+
</package>
|