Mage_GoogleTrustedStore - Version 1.0.13

Version Notes

Functionality updates.

Download this release

Release Info

Developer Fontis
Extension Mage_GoogleTrustedStore
Version 1.0.13
Comparing to
See all releases


Code changes from version 1.0.6 to 1.0.13

app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/OrderCreatedConfirmation.php CHANGED
@@ -76,7 +76,8 @@ class Mage_GoogleTrustedStore_Block_Adminhtml_OrderCreatedConfirmation
76
  */
77
  public function getAccountId()
78
  {
79
- return Mage::getSingleton('googletrustedstore/config')->getAccountId();
 
80
  }
81
 
82
  /**
@@ -86,8 +87,11 @@ class Mage_GoogleTrustedStore_Block_Adminhtml_OrderCreatedConfirmation
86
  */
87
  protected function _toHtml()
88
  {
89
- if (Mage::getSingleton('googletrustedstore/config')->isEnabled() && $this->_hasOrder()) {
90
- return parent::_toHtml();
 
 
 
91
  }
92
  }
93
 
76
  */
77
  public function getAccountId()
78
  {
79
+ $store = $this->_getOrder()->getStoreId();
80
+ return Mage::getSingleton('googletrustedstore/config')->getAccountId($store);
81
  }
82
 
83
  /**
87
  */
88
  protected function _toHtml()
89
  {
90
+ if ($this->_hasOrder()) {
91
+ $store = $this->_getOrder()->getStoreId();
92
+ if (Mage::getSingleton('googletrustedstore/config')->isEnabled($store)) {
93
+ return parent::_toHtml();
94
+ }
95
  }
96
  }
97
 
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/Button.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Adminhtml_System_Config_Button
28
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
29
+ {
30
+ /**
31
+ * Remove scope label
32
+ *
33
+ * @param Varien_Data_Form_Element_Abstract $element
34
+ * @return string
35
+ */
36
+ public function render(Varien_Data_Form_Element_Abstract $element)
37
+ {
38
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
39
+ return parent::render($element);
40
+ }
41
+
42
+ /**
43
+ * Generates URL for onclick action
44
+ *
45
+ * @param Varien_Data_Form_Element_Abstract $element
46
+ * @param string $actionName
47
+ * @return string
48
+ */
49
+ protected function _getOnclickUrl(Varien_Data_Form_Element_Abstract $element, $actionName)
50
+ {
51
+ $params = array();
52
+ $configForm = $element->getForm()->getParent();
53
+ if ($configForm->getScope() == 'websites') {
54
+ $params['website_id'] = $configForm->getScopeId();
55
+ } elseif ($configForm->getScope() == 'stores') {
56
+ $params['store_id'] = $configForm->getScopeId();
57
+ }
58
+ return $this->getUrl('*/googletrustedstore_feed/'.$actionName, $params);
59
+ }
60
+ }
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/GenerateFeeds.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Adminhtml_System_Config_GenerateFeeds
28
+ extends Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_Button
29
+ {
30
+ /**
31
+ * Return element html
32
+ *
33
+ * @param Varien_Data_Form_Element_Abstract $element
34
+ * @return string
35
+ */
36
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
37
+ {
38
+ $url = $this->_getOnclickUrl($element,'generate');
39
+ $confirmationMessage = Mage::helper('googletrustedstore')->__('Are you sure to generate feeds now?');
40
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'generate_now',
43
+ 'label' => Mage::helper('googletrustedstore')->__('Generate feeds now'),
44
+ 'onclick' => "if(confirm('".$confirmationMessage."')){setLocation('".$url."');}",
45
+ ));
46
+ return $button->toHtml();
47
+ }
48
+ }
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/UploadFeeds.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Adminhtml_System_Config_UploadFeeds
28
+ extends Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_Button
29
+ {
30
+ /**
31
+ * Return element html
32
+ *
33
+ * @param Varien_Data_Form_Element_Abstract $element
34
+ * @return string
35
+ */
36
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
37
+ {
38
+ $url = $this->_getOnclickUrl($element,'upload');
39
+ $confirmationMessage = Mage::helper('googletrustedstore')->__('Are you sure to upload feeds now?');
40
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'upload_now',
43
+ 'label' => Mage::helper('googletrustedstore')->__('Upload feeds now'),
44
+ 'onclick' => "if(confirm('".$confirmationMessage."')){setLocation('".$url."');}",
45
+ ));
46
+ return $button->toHtml();
47
+ }
48
+ }
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/VerifySettings.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Adminhtml_System_Config_VerifySettings
28
+ extends Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_Button
29
+ {
30
+ /**
31
+ * Return element html
32
+ *
33
+ * @param Varien_Data_Form_Element_Abstract $element
34
+ * @return string
35
+ */
36
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
37
+ {
38
+ $url = $this->_getOnclickUrl($element,'verify');
39
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
40
+ ->setData(array(
41
+ 'id' => 'gts_verify',
42
+ 'label' => Mage::helper('googletrustedstore')->__('Verify Settings'),
43
+ 'onclick' => "setLocation('".$url."')",
44
+ ));
45
+ $script = $this->getLayout()
46
+ ->createBlock('core/template')
47
+ ->setTemplate('googletrustedstore/settings_js.phtml')
48
+ ->toHtml();
49
+ return $script.$button->toHtml();
50
+ }
51
+ }
app/code/core/Mage/GoogleTrustedStore/Block/Badge.php CHANGED
@@ -38,7 +38,7 @@ class Mage_GoogleTrustedStore_Block_Badge extends Mage_Core_Block_Template
38
  */
39
  public function getAccountId()
40
  {
41
- return Mage::getSingleton('googletrustedstore/config')->getAccountId();
42
  }
43
 
44
  /**
@@ -119,7 +119,7 @@ class Mage_GoogleTrustedStore_Block_Badge extends Mage_Core_Block_Template
119
  */
120
  protected function _toHtml()
121
  {
122
- if (Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
123
  return parent::_toHtml();
124
  }
125
  }
38
  */
39
  public function getAccountId()
40
  {
41
+ return Mage::getSingleton('googletrustedstore/config')->getAccountId(Mage::app()->getStore());
42
  }
43
 
44
  /**
119
  */
120
  protected function _toHtml()
121
  {
122
+ if (Mage::getSingleton('googletrustedstore/config')->isEnabled(Mage::app()->getStore())) {
123
  return parent::_toHtml();
124
  }
125
  }
app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Multishipping.php CHANGED
@@ -52,7 +52,7 @@ class Mage_GoogleTrustedStore_Block_OrderConfirmation_Multishipping extends Mage
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
52
  protected function _toHtml()
53
  {
54
  $html = '';
55
+ if (Mage::getSingleton('googletrustedstore/config')->isEnabled(Mage::app()->getStore())) {
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
app/code/core/Mage/GoogleTrustedStore/Block/OrderConfirmation/Onepage.php CHANGED
@@ -212,9 +212,12 @@ class Mage_GoogleTrustedStore_Block_OrderConfirmation_Onepage extends Mage_Core_
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
 
@@ -304,7 +307,7 @@ class Mage_GoogleTrustedStore_Block_OrderConfirmation_Onepage extends Mage_Core_
304
  */
305
  protected function _toHtml()
306
  {
307
- if (Mage::getSingleton('googletrustedstore/config')->isEnabled()) {
308
  return parent::_toHtml();
309
  }
310
  }
212
  */
213
  public function getOrderShipDate()
214
  {
215
+ $order = $this->_getOrder();
216
  return $this->_getOrder()
217
  ->getCreatedAtDate()
218
+ ->addDay(
219
+ Mage::getSingleton('googletrustedstore/config')->getEstimatedShippingPeriod($order->getStoreId())
220
+ )
221
  ->toString('yyyy-MM-dd');
222
  }
223
 
307
  */
308
  protected function _toHtml()
309
  {
310
+ if (Mage::getSingleton('googletrustedstore/config')->isEnabled(Mage::app()->getStore())) {
311
  return parent::_toHtml();
312
  }
313
  }
app/code/core/Mage/GoogleTrustedStore/Model/Config.php CHANGED
@@ -39,6 +39,7 @@ class Mage_GoogleTrustedStore_Model_Config
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';
@@ -49,22 +50,24 @@ class Mage_GoogleTrustedStore_Model_Config
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
  /**
@@ -123,12 +126,13 @@ class Mage_GoogleTrustedStore_Model_Config
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
  /**
@@ -143,72 +147,110 @@ class Mage_GoogleTrustedStore_Model_Config
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)
@@ -219,18 +261,36 @@ class Mage_GoogleTrustedStore_Model_Config
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
  /**
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_FTP_MODE = 'google/trustedstore/ftp_mode';
43
  const XML_PATH_SHIPMENT_FEED_FILENAME = 'google/trustedstore/shipment_feed_filename';
44
  const XML_PATH_CANCELLATION_FEED_FILENAME ='google/trustedstore/cancellation_feed_filename';
45
  const XML_PATH_CARRIERS = 'global/googletrustedstore/carriers';
50
  const CARRIER_NAME_OTHER = 'OTHER';
51
  /**
52
  * Check if extension is enabled in admin panel or not
53
+ * @param mixed $store
54
  *
55
  * @return boolean
56
  */
57
+ public function isEnabled($store = null)
58
  {
59
+ return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
60
  }
61
 
62
  /**
63
  * Returns ID of Google trusted stores account
64
+ * @param mixed $store
65
  *
66
  * @return string
67
  */
68
+ public function getAccountId($store = null)
69
  {
70
+ return Mage::getStoreConfig(self::XML_PATH_ACCOUNT_ID, $store);
71
  }
72
 
73
  /**
126
 
127
  /**
128
  * Returns estimated shipping period in days
129
+ * @param mixed $store
130
  *
131
  * @return integer
132
  */
133
+ public function getEstimatedShippingPeriod($store = null)
134
  {
135
+ return Mage::getStoreConfig(self::XML_PATH_ESTIMATED_SHIP_DATE, $store);
136
  }
137
 
138
  /**
147
 
148
  /**
149
  * Returns FTP user name of Google trusted stores account
150
+ * @param mixed $store
151
  *
152
  * @return string
153
  */
154
+ public function getFtpUserName($store = null)
155
  {
156
+ return Mage::getStoreConfig(self::XML_PATH_FTP_USERNAME, $store);
157
  }
158
 
159
  /**
160
  * Returns FTP user name of Google trusted stores account
161
+ * @param mixed $store
162
  *
163
  * @return string
164
  */
165
+ public function getFtpPassword($store = null)
166
  {
167
+ return Mage::helper('core')->decrypt(Mage::getStoreConfig(self::XML_PATH_FTP_PASSWORD, $store));
168
  }
169
 
170
  /**
171
+ * Returns FTP mode
172
+ * @param mixed $store
173
+ *
174
+ * @return integer
175
+ */
176
+ public function getFtpMode($store = null)
177
+ {
178
+ return Mage::getStoreConfig(self::XML_PATH_FTP_MODE, $store);
179
+ }
180
+
181
+ /**
182
+ * Returns dir for feed file storage
183
+ * @param Mage_Core_Model_Store $store
184
  *
185
  * @return string
186
  */
187
+ protected function _getFeedDir($store)
188
  {
189
+ if (Mage::getBaseDir('tmp')) {
190
+ $dir = Mage::getBaseDir('tmp') . DIRECTORY_SEPARATOR . $store->getCode();
191
+ if (!file_exists($dir)) {
192
+ mkdir($dir,0777);
193
+ }
194
+ if (!is_dir($dir) || !is_writable($dir)) {
195
+ throw new Varien_Exception('Unable to find writable feed catalog');
196
+ }
197
+ }
198
+ return $dir;
199
+ }
200
+
201
+ /**
202
+ * Returns full local path to feed
203
+ * @param Mage_Core_Model_Store $store
204
+ *
205
+ * @return string
206
+ */
207
+ public function getFtpShipmentFileName(Mage_Core_Model_Store $store)
208
+ {
209
+ return $this->_getFeedDir($store) . DIRECTORY_SEPARATOR . $this->getFtpShipmentTargetFileName($store);
210
  }
211
 
212
  /**
213
  * Get FTP shipment target file name
214
+ * @param Mage_Core_Model_Store $store
215
  *
216
  * @return string
217
  */
218
+ public function getFtpShipmentTargetFileName(Mage_Core_Model_Store $store)
219
  {
220
+ return Mage::getStoreConfig(self::XML_PATH_SHIPMENT_FEED_FILENAME, $store);
221
  }
222
 
223
  /**
224
  * Get FTP cancellation file name
225
+ * @param Mage_Core_Model_Store $store
226
  *
227
  * @return string
228
  */
229
+ public function getFtpCancellationFileName(Mage_Core_Model_Store $store)
230
  {
231
+ return $this->_getFeedDir($store) . DIRECTORY_SEPARATOR . $this->getFtpCancellationTargetFileName($store);
232
  }
233
 
234
  /**
235
  * Get FTP cancellation target file name
236
+ * @param Mage_Core_Model_Store $store
237
  *
238
  * @return string
239
  */
240
+ public function getFtpCancellationTargetFileName(Mage_Core_Model_Store $store)
241
  {
242
+ return Mage::getStoreConfig(self::XML_PATH_CANCELLATION_FEED_FILENAME, $store);
243
  }
244
 
245
  /**
246
  * Get last time when files were generated
247
+ * @param mixed $store
248
  *
249
  * @return Zend_Date
250
  */
251
+ public function getLastTimeGenerated($store = null)
252
  {
253
+ $dateString = Mage::getStoreConfig(self::XML_PATH_LAST_TIME_GENERATED_DATE, $store);
254
 
255
  return $dateString
256
  ? new Zend_Date($dateString, Zend_Date::ISO_8601)
261
  * Set last time when files were generated
262
  *
263
  * @param Zend_Date $lastTime
264
+ * @param Mage_Core_Model_Store $store
265
  */
266
+ public function setLastTimeGenerated(Zend_Date $lastTime = null, $store)
267
  {
268
  if (!$lastTime) {
269
  $lastTime = Zend_Date::now();
270
  }
271
+ $scope = $store ? 'stores' : 'default';
272
+ $scopeId = $store ? $store->getId() : 0;
273
+ $path = self::XML_PATH_LAST_TIME_GENERATED_DATE;
274
+
275
+ $configDataCollection = Mage::getModel('core/config_data')
276
+ ->getCollection()
277
+ ->addFieldToFilter('scope', $scope)
278
+ ->addFieldToFilter('scope_id', $scopeId)
279
+ ->addFieldToFilter('path', array('eq' => $path))
280
+ ->load();
281
+ if (count($configDataCollection)) {
282
+ $configDataCollection->getFirstItem()
283
+ ->setValue($lastTime->toString(Zend_Date::ISO_8601))
284
+ ->save();
285
+ } else {
286
+ Mage::getModel('core/config_data')
287
+ ->setPath(self::XML_PATH_LAST_TIME_GENERATED_DATE) // in case new record
288
+ ->setValue($lastTime->toString(Zend_Date::ISO_8601))
289
+ ->setScope($scope)
290
+ ->setScopeId($scopeId)
291
+ ->save();
292
+ }
293
+ $store->resetConfig();
294
  }
295
 
296
  /**
app/code/core/Mage/GoogleTrustedStore/Model/Feeder.php CHANGED
@@ -28,51 +28,71 @@ 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
 
@@ -85,58 +105,146 @@ class Mage_GoogleTrustedStore_Model_Feeder
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
  /**
28
  {
29
  /**
30
  * Generates feeds for shipment and cancellation
31
+ *
32
+ * @param mixed $store
33
+ * @param bool $manual
34
  */
35
+ public function generateFeeds($stores = null, $manual = null)
36
  {
 
 
 
37
  try {
38
+ if (!$stores) {
39
+ $stores = Mage::app()->getStores();
40
+ }
41
+ foreach ($stores as $store) {
42
+ $feedFiles = array();
43
+ if ($this->_getConfig()->isEnabled($store)) {
44
+ $this->_generateShipmentFeed($store);
45
+ $this->_generateCancellationFeed($store);
46
+ }
47
+ $this->_getConfig()->setLastTimeGenerated(null, $store);
48
+ }
49
  } catch (RuntimeException $e) {
50
+ $message = 'GoogleTrustedStore: ' . $e->getMessage();
51
+ Mage::log($message);
52
+ if ($manual) {
53
+ throw new Exception($message);
54
+ }
55
  }
56
  }
57
 
58
  /**
59
  * Generates feed for shipment and save it in temporary directory
60
+ *
61
+ * @param mixed $store
62
  */
63
+ protected function _generateShipmentFeed($store)
64
  {
65
+ $fromDate = $this->_getConfig()->getLastTimeGenerated($store);
66
 
67
  $shipments = Mage::getResourceModel('sales/order_shipment_collection')
68
  ->addFieldToFilter('created_at', array('from' => $fromDate->toString(Zend_Date::ISO_8601)));
69
+ if ($store) {
70
+ $shipments->addFieldToFilter('store_id', array('eq' => $store->getId()));
71
+ }
72
  $this->_saveFeedToFile(
73
  Mage::getModel('googletrustedstore/feed_shipment', $shipments),
74
+ $this->_getConfig()->getFtpShipmentFileName($store)
75
  );
76
  }
77
 
78
  /**
79
  * Generates feed for canceled orders and saves it in temporary directory
80
+ *
81
+ * @param mixed $store
82
  */
83
+ protected function _generateCancellationFeed($store)
84
  {
85
+ $fromDate = $this->_getConfig()->getLastTimeGenerated($store);
86
 
87
  $orders = Mage::getResourceModel('sales/order_collection')
88
  ->addFieldToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_CANCELED))
89
  ->addFieldToFilter('updated_at', array('from' => $fromDate->toString(Zend_Date::ISO_8601)));
90
+ if ($store) {
91
+ $orders->addFieldToFilter('store_id', array('eq' => $store->getId()));
92
+ }
93
  $this->_saveFeedToFile(
94
  Mage::getModel('googletrustedstore/feed_cancellation', $orders),
95
+ $this->_getConfig()->getFtpCancellationFileName($store)
96
  );
97
  }
98
 
105
  */
106
  protected function _saveFeedToFile(Mage_GoogleTrustedStore_Model_Feed_Abstract $feed, $fileName)
107
  {
108
+ if (!file_exists($fileName)) {
109
+ touch($fileName);
110
+ chmod($fileName,0766);
111
+ }
112
+ $append = file_exists($fileName) && filesize($fileName);
113
  if (false === @file_put_contents($fileName, $feed->toString(!$append), $append ? FILE_APPEND : 0)) {
114
+ throw new RuntimeException(Mage::helper('googletrustedstore')->__("Unable to write feed to file '%s'.", $fileName));
115
  }
116
  }
117
 
118
  /**
119
  * Upload feeds (shipment/cancelled orders) to Google
120
+ *
121
+ * @param mixed $stores
122
+ * @param bool $manual
123
  */
124
+ public function uploadFeeds($stores = null, $manual = null)
125
  {
 
 
 
126
  try {
127
+ if (!$stores) {
128
+ $stores = Mage::app()->getStores();
129
+ }
130
+ $uploadedFilesNum = 0;
131
+ foreach ($stores as $store) {
132
+ $feedFiles = array();
133
+ if ($this->_getConfig()->isEnabled($store)) {
134
+ $feedFiles[$this->_getConfig()->getFtpShipmentFileName($store)] =
135
+ $this->_getConfig()->getFtpShipmentTargetFileName($store);
136
+ $feedFiles[$this->_getConfig()->getFtpCancellationFileName($store)] =
137
+ $this->_getConfig()->getFtpCancellationTargetFileName($store);
138
+ $uploadedFilesNum += count($this->_uploadFiles($feedFiles,$store));
139
+ }
140
+ }
141
+ if (!$uploadedFilesNum) {
142
+ throw new Exception(Mage::helper('googletrustedstore')
143
+ ->__('Feed is not sent. Please generate the feed prior to sending'));
144
+ }
145
  } catch (Varien_Io_Exception $e) {
146
+ $message = Mage::helper('googletrustedstore')->__('GoogleTrustedStore FTP upload error:') .
147
+ ' ' . $e->getMessage();
148
+ Mage::log($message);
149
+ if ($manual) {
150
+ throw new Exception($message);
151
+ }
152
  }
153
  }
154
 
155
+ /**
156
+ * Verify general settings for feed generation/upload
157
+ *
158
+ * @param mixed $stores
159
+ */
160
+ public function verifySettings($stores = null)
161
+ {
162
+ if (!$stores) {
163
+ $stores = Mage::app()->getStores();
164
+ }
165
+ //ftp
166
+ try {
167
+ foreach ($stores as $store) {
168
+ $ftp = new Varien_Io_Ftp;
169
+ $ftp->open(array(
170
+ 'host' => $host = $this->_getConfig()->getFtpHostName(),
171
+ 'user' => $this->_getConfig()->getFtpUserName($store),
172
+ 'password' => $this->_getConfig()->getFtpPassword($store),
173
+ 'passive' => $this->_getConfig()->getFtpMode($store),
174
+ ));
175
+ $ftp->close();
176
+ }
177
+ } catch (Varien_Io_Exception $e) {
178
+ throw new Varien_Io_Exception(
179
+ Mage::helper('googletrustedstore')->__('FTP error: ') . $e->getMessage());
180
+ }
181
+ //directory permissions
182
+ try {
183
+ Mage::getBaseDir('tmp');
184
+ } catch (Mage_Core_Exception $e) {
185
+ throw new Mage_Core_Exception(
186
+ Mage::helper('googletrustedstore')->__('Filesystem error: ') . $e->getMessage());
187
+ }
188
+ // file permissions
189
+ foreach ($stores as $store) {
190
+ $shipmentFile = $this->_getConfig()->getFtpShipmentFileName($store);
191
+ $this->_checkFileWritable($shipmentFile);
192
+ $cancelFile = $this->_getConfig()->getFtpCancellationFileName($store);
193
+ $this->_checkFileWritable($cancelFile);
194
+ }
195
+ //cron
196
+ $cronScheduleItems = Mage::getResourceModel('cron/schedule_collection');
197
+ if (!$cronScheduleItems->count()) {
198
+ throw new Exception(
199
+ Mage::helper('googletrustedstore')->__('Cron warning: Possibly cron job is not installed'));
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Check file permissions for writing
205
+ *
206
+ * @param string $filename absolute path to file
207
+ * @throws Exception if file is not writable
208
+ */
209
+ protected function _checkFileWritable($filename)
210
+ {
211
+ if (file_exists($filename) && !is_writable($filename)) {
212
+ throw new Exception(Mage::helper('googletrustedstore')->__("Filesystem error: feed file '%s' is not writable", $filename));
213
+ }
214
+ }
215
+
216
  /**
217
  * Upload file by file map to Google FTP server and delete it from local file system
218
  *
219
  * @param array $fileNameMap array('local file name' => 'remote file name', ...)
220
+ * @param mixed $store
221
+ *
222
  * @throws Varien_Io_Exception If FTP related error occurred
223
  */
224
+ protected function _uploadFiles(array $fileNameMap, $store)
225
  {
226
  $ftp = new Varien_Io_Ftp;
227
  $fs = new Varien_Io_File;
 
228
  $result = $ftp->open(array(
229
  'host' => $host = $this->_getConfig()->getFtpHostName(),
230
+ 'user' => $this->_getConfig()->getFtpUserName($store),
231
+ 'password' => $this->_getConfig()->getFtpPassword($store),
232
+ 'passive' => $this->_getConfig()->getFtpMode($store),
233
  ));
234
+ $uploadedFiles = array();
235
  foreach ($fileNameMap as $localFileName => $targetFileName) {
236
  if ($fs->fileExists($localFileName)) {
237
+ $uploadedFiles[] = $localFileName;
238
  $result = $ftp->write($targetFileName, $localFileName);
239
  if (false === $result) {
240
+ throw new Varien_Io_Exception(Mage::helper('googletrustedstore')->__("Unable to upload '%s' to '%s' on server %s", $localFileName, $targetFileName, $host));
241
  }
242
  $fs->rm($localFileName);
243
  }
244
  }
245
 
246
  $ftp->close();
247
+ return $uploadedFiles;
248
  }
249
 
250
  /**
app/code/core/Mage/GoogleTrustedStore/Model/Observer.php CHANGED
@@ -47,8 +47,8 @@ class Mage_GoogleTrustedStore_Model_Observer
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) {
@@ -159,6 +159,9 @@ class Mage_GoogleTrustedStore_Model_Observer
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(
@@ -190,4 +193,98 @@ class Mage_GoogleTrustedStore_Model_Observer
190
 
191
  return $reason;
192
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
47
  public function addCancellationReasonToOrder(Varien_Event_Observer $observer)
48
  {
49
  $reasonCode = $this->_getCancellationReason();
50
+ $order = $observer->getEvent()->getDataObject();
51
+ if ($reasonCode && $this->_getConfig()->isEnabled($order->getStoreId())) {
52
  if ($order && $order->isCanceled()) {
53
  $origState = $order->getOrigData('state');
54
  if ($origState != Mage_Sales_Model_Order::STATE_CANCELED) {
159
  $block = $observer->getBlock();
160
  if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract) {
161
  $item = $block->getItem('cancel_order');
162
+ if (!is_object($item)) {
163
+ return $this;
164
+ }
165
  $source = Mage::getSingleton('googletrustedstore/source_orderCancellationReason');
166
  $item->setAdditionalActionBlock(
167
  array(
193
 
194
  return $reason;
195
  }
196
+
197
+ /**
198
+ * Saves current GTS config in the registry
199
+ *
200
+ * @param Varien_Event_Observer $observer
201
+ * @return Mage_GoogleTrustedStore_Model_Observer
202
+ */
203
+ public function saveOldSettings(Varien_Event_Observer $observer)
204
+ {
205
+ $request = $observer
206
+ ->getEvent()
207
+ ->getControllerAction()
208
+ ->getRequest();
209
+ $stores = Mage::app()->getStores();
210
+ $currentConfig = array();
211
+ $section = $request->getParam('section');
212
+ if ($section == 'google') {
213
+ foreach ($stores as $store) {
214
+ $currentConfig[$store->getCode()] = $this->_getFeedConfig($store);
215
+ }
216
+ Mage::register('googletrustedstore_config',$currentConfig);
217
+ }
218
+ return $this;
219
+ }
220
+
221
+ /**
222
+ * Verifies FTP User/password, Filenames are the same as in those other scopes with the same Merchant ID
223
+ *
224
+ * @param Varien_Event_Observer $observer
225
+ * @return Mage_GoogleTrustedStore_Model_Observer
226
+ */
227
+ public function verifySettings(Varien_Event_Observer $observer)
228
+ {
229
+ $store = $observer->getEvent()->getStore();
230
+ $website = $observer->getEvent()->getWebsite();
231
+ if ($oldConfig = Mage::registry('googletrustedstore_config')) {
232
+ $stores = array();
233
+ if ($store) {
234
+ $stores[] = Mage::app()->getStore($store);
235
+ } elseif ($website) {
236
+ $stores = Mage::app()->getWebsite($website)->getStores();
237
+ } else {
238
+ $stores = Mage::app()->getStores();
239
+ }
240
+ $settingsIssueFound = false;
241
+ foreach ($stores as $store) {
242
+ $storeOldFeedConfig = $oldConfig[$store->getCode()];
243
+ $storeCurrentFeedConfig = $this->_getFeedConfig($store);
244
+ $changedConfig = array_diff_assoc($storeOldFeedConfig, $storeCurrentFeedConfig);
245
+ if (!empty($changedConfig)) {
246
+ foreach (Mage::app()->getStores() as $s) {
247
+ if ($s->getCode() != $store->getCode()) {
248
+ $sConfig = $this->_getFeedConfig($s);
249
+ if ($sConfig['id'] == $storeCurrentFeedConfig['id'] &&
250
+ array_diff_assoc($storeCurrentFeedConfig, $sConfig)) {
251
+ Mage::getSingleton('adminhtml/session')
252
+ ->addNotice(Mage::helper('googletrustedstore')
253
+ ->__('One or more of your Google Trusted Stores settings below do not match the account settings in other scopes. Please verify that FTP username, password, Cancel file name, and Shipment file name are the same within a given Google Trusted Store Merchant ID.'));
254
+ return $this;
255
+ }
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
261
+ return $this;
262
+ }
263
+
264
+ /**
265
+ * Returns feed config
266
+ *
267
+ * @param mixed $store
268
+ * @return array
269
+ */
270
+ protected function _getFeedConfig($store)
271
+ {
272
+ return array(
273
+ 'id' => $this->_getConfig()->getAccountId($store),
274
+ 'user' => $this->_getConfig()->getFtpUserName($store),
275
+ 'password' => $this->_getConfig()->getFtpPassword($store),
276
+ 'shipment' => $this->_getConfig()->getFtpShipmentTargetFileName($store),
277
+ 'cancellation' => $this->_getConfig()->getFtpCancellationTargetFileName($store)
278
+ );
279
+ }
280
+
281
+ /**
282
+ * Returns GTS config model
283
+ *
284
+ * @return Mage_GoogleTrustedStore_Model_Config
285
+ */
286
+ protected function _getConfig()
287
+ {
288
+ return Mage::getSingleton('googletrustedstore/config');
289
+ }
290
  }
app/code/core/Mage/GoogleTrustedStore/Model/Source/FtpMode.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_FtpMode
28
+ {
29
+ private $_options;
30
+ /**
31
+ * Prepares array value=>label for available ftp modes
32
+ *
33
+ * @return array
34
+ */
35
+ public function toOptionArray()
36
+ {
37
+ if (!is_array($this->_options)) {
38
+ $this->_options = array(
39
+ array('value' => 0, 'label' => Mage::helper('googletrustedstore')->__('Active')),
40
+ array('value' => 1, 'label' => Mage::helper('googletrustedstore')->__('Passive')),
41
+ );
42
+ }
43
+ return $this->_options;
44
+ }
45
+ }
app/code/core/Mage/GoogleTrustedStore/controllers/Adminhtml/Googletrustedstore/FeedController.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Adminhtml_Googletrustedstore_FeedController extends Mage_Adminhtml_Controller_Action
28
+ {
29
+ /**
30
+ * Generate feed files
31
+ */
32
+ public function generateAction()
33
+ {
34
+ $session = $this->_getSession();
35
+
36
+ try {
37
+ Mage::getModel('googletrustedstore/feeder')->generateFeeds($this->_getStores(), true);
38
+ $session->addSuccess(Mage::helper('googletrustedstore')->__('Feed files have been created.'));
39
+ }
40
+ catch (Exception $e) {
41
+ $session->addError($e->getMessage());
42
+ }
43
+ $this->_redirect('*/system_config/edit', $this->_getRedirectParams());
44
+ }
45
+
46
+ /**
47
+ * Upload feed files
48
+ */
49
+ public function uploadAction()
50
+ {
51
+ $session = $this->_getSession();
52
+
53
+ try {
54
+ Mage::getModel('googletrustedstore/feeder')->uploadFeeds($this->_getStores(), true);
55
+ $session->addSuccess(Mage::helper('googletrustedstore')->__('Feed files have been uploaded.'));
56
+ }
57
+ catch (Exception $e) {
58
+ $session->addError($e->getMessage());
59
+ }
60
+ $this->_redirect('*/system_config/edit', $this->_getRedirectParams());
61
+ }
62
+
63
+ /**
64
+ * Verify settings
65
+ */
66
+ public function verifyAction()
67
+ {
68
+ $session = $this->_getSession();
69
+ try {
70
+ Mage::getModel('googletrustedstore/feeder')->verifySettings($this->_getStores());
71
+ $session->addSuccess(Mage::helper('googletrustedstore')
72
+ ->__('Settings are valid: FTP Credentials, file system permissions, cron settings.'));
73
+ }
74
+ catch (Exception $e) {
75
+ $session->addError($e->getMessage());
76
+ }
77
+ $this->_redirect('*/system_config/edit', $this->_getRedirectParams());
78
+ }
79
+
80
+ /**
81
+ * Returns store list
82
+ *
83
+ * @return array
84
+ */
85
+ protected function _getStores()
86
+ {
87
+ $stores = null;
88
+ if ($store = $this->_getStore()) {
89
+ $stores = array($store);
90
+ } elseif ($website = $this->_getWebsite()) {
91
+ $stores = $website->getStores();
92
+ }
93
+ return $stores;
94
+ }
95
+
96
+ /**
97
+ * Returns website or null
98
+ *
99
+ * @return mixed
100
+ */
101
+ protected function _getWebsite()
102
+ {
103
+ $website = null;
104
+ $websiteId = $this->getRequest()->getParam('website_id');
105
+ if ($websiteId) {
106
+ $website = Mage::app()->getWebsite($websiteId);
107
+ }
108
+ return $website;
109
+ }
110
+
111
+ /**
112
+ * Returns store or null
113
+ *
114
+ * @return mixed
115
+ */
116
+ protected function _getStore()
117
+ {
118
+ $store = null;
119
+ $storeId = $this->getRequest()->getParam('store_id');
120
+ if ($storeId) {
121
+ $store = Mage::app()->getStore($storeId);
122
+ }
123
+ return $store;
124
+ }
125
+
126
+ /**
127
+ * Returns redirect params
128
+ *
129
+ * @return array
130
+ */
131
+ protected function _getRedirectParams()
132
+ {
133
+ $params = array('section' => 'google');
134
+ if ($website = $this->_getWebsite()) {
135
+ $params['website'] = $website->getCode();
136
+ }
137
+ if ($store = $this->_getStore()) {
138
+ $params['store'] = $store->getCode();
139
+ }
140
+ return $params;
141
+ }
142
+
143
+ /**
144
+ * Returns session
145
+ *
146
+ * @return Mage_Adminhtml_Model_Session
147
+ */
148
+ protected function _getSession()
149
+ {
150
+ return Mage::getSingleton('adminhtml/session');
151
+ }
152
+ }
app/code/core/Mage/GoogleTrustedStore/etc/config.xml CHANGED
@@ -82,6 +82,7 @@
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>
@@ -108,11 +109,11 @@
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>
@@ -159,6 +160,24 @@
159
  </googletrustedstore>
160
  </observers>
161
  </controller_action_predispatch_adminhtml_sales_order_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  </events>
163
  </adminhtml>
164
  <crontab>
@@ -181,4 +200,15 @@
181
  </googletrustedstore_upload_feeds>
182
  </jobs>
183
  </crontab>
 
 
 
 
 
 
 
 
 
 
 
184
  </config>
82
  <enabled>1</enabled>
83
  <default_order_cancellation_reason>BuyerCanceled</default_order_cancellation_reason>
84
  <estimated_ship_date>3</estimated_ship_date>
85
+ <ftp_mode>1</ftp_mode>
86
  </trustedstore>
87
  </google>
88
  </default>
109
  <adminhtml>
110
  <translate>
111
  <modules>
112
+ <Mage_GoogleTrustedStore>
113
  <files>
114
  <default>Mage_GoogleTrustedStore.csv</default>
115
  </files>
116
+ </Mage_GoogleTrustedStore>
117
  </modules>
118
  </translate>
119
  <layout>
160
  </googletrustedstore>
161
  </observers>
162
  </controller_action_predispatch_adminhtml_sales_order_index>
163
+ <controller_action_predispatch_adminhtml_system_config_save>
164
+ <observers>
165
+ <googletrustedstore>
166
+ <type>model</type>
167
+ <class>googletrustedstore/observer</class>
168
+ <method>saveOldSettings</method>
169
+ </googletrustedstore>
170
+ </observers>
171
+ </controller_action_predispatch_adminhtml_system_config_save>
172
+ <admin_system_config_changed_section_google>
173
+ <observers>
174
+ <googletrustedstore>
175
+ <type>model</type>
176
+ <class>googletrustedstore/observer</class>
177
+ <method>verifySettings</method>
178
+ </googletrustedstore>
179
+ </observers>
180
+ </admin_system_config_changed_section_google>
181
  </events>
182
  </adminhtml>
183
  <crontab>
200
  </googletrustedstore_upload_feeds>
201
  </jobs>
202
  </crontab>
203
+ <admin>
204
+ <routers>
205
+ <adminhtml>
206
+ <args>
207
+ <modules>
208
+ <Mage_GoogleTrustedStore before="Mage_Adminhtml">Mage_GoogleTrustedStore_Adminhtml</Mage_GoogleTrustedStore>
209
+ </modules>
210
+ </args>
211
+ </adminhtml>
212
+ </routers>
213
+ </admin>
214
  </config>
app/code/core/Mage/GoogleTrustedStore/etc/system.xml CHANGED
@@ -35,7 +35,7 @@
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>
@@ -43,8 +43,8 @@
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>
@@ -53,8 +53,8 @@
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>
@@ -75,8 +75,8 @@
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>
@@ -86,8 +86,8 @@
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>
@@ -98,9 +98,20 @@
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>
@@ -108,10 +119,10 @@
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>
@@ -120,22 +131,49 @@
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>
@@ -146,7 +184,7 @@
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>
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>1</show_in_store>
39
  <fields>
40
  <enabled translate="label">
41
  <label>Google Trusted Store Program</label>
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>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
  </enabled>
49
  <account_id translate="label">
50
  <depends><enabled>1</enabled></depends>
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>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
  </account_id>
59
  <default_order_cancellation_reason translate="label">
60
  <depends><enabled>1</enabled></depends>
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>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
  </estimated_ship_date>
81
  <ftp_username translate="label">
82
  <depends><enabled>1</enabled></depends>
86
  <validate>required-entry</validate>
87
  <sort_order>25</sort_order>
88
  <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
  </ftp_username>
92
  <ftp_password translate="label">
93
  <depends><enabled>1</enabled></depends>
98
  <validate>required-entry</validate>
99
  <sort_order>30</sort_order>
100
  <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
  </ftp_password>
104
+ <ftp_mode translate="label">
105
+ <depends><enabled>1</enabled></depends>
106
+ <label>FTP mode</label>
107
+ <frontend_type>select</frontend_type>
108
+ <comment><![CDATA[Passive mode is recommended.]]></comment>
109
+ <source_model>googletrustedstore/source_ftpMode</source_model>
110
+ <sort_order>35</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ </ftp_mode>
115
  <cancellation_feed_filename translate="label">
116
  <depends><enabled>1</enabled></depends>
117
  <label>Cancellation Feed Filename</label>
119
  <backend_model>googletrustedstore/backend_feedFilename</backend_model>
120
  <comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
121
  <validate>required-entry</validate>
122
+ <sort_order>40</sort_order>
123
  <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
  </cancellation_feed_filename>
127
  <shipment_feed_filename translate="label">
128
  <depends><enabled>1</enabled></depends>
131
  <backend_model>googletrustedstore/backend_feedFilename</backend_model>
132
  <comment><![CDATA[The same as you entered in Google Merchant Center.]]></comment>
133
  <validate>required-entry</validate>
134
+ <sort_order>45</sort_order>
135
  <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
  </shipment_feed_filename>
139
+ <verify_settings translate="label">
140
+ <frontend_type>button</frontend_type>
141
+ <comment><![CDATA[Verify your settings: directory permissions, ftp credentials, cron setup. Save any configuration changes before executing.]]></comment>
142
+ <frontend_model>googletrustedstore/adminhtml_system_config_verifySettings</frontend_model>
143
+ <sort_order>50</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ </verify_settings>
148
+ <generate_now translate="label">
149
+ <frontend_type>button</frontend_type>
150
+ <comment><![CDATA[Use this to generate feed files now. Save any configuration changes before executing.]]></comment>
151
+ <frontend_model>googletrustedstore/adminhtml_system_config_generateFeeds</frontend_model>
152
+ <sort_order>55</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </generate_now>
157
+ <upload_now translate="label">
158
+ <frontend_type>button</frontend_type>
159
+ <comment><![CDATA[Use this to perform upload now. Save any configuration changes before executing.]]></comment>
160
+ <frontend_model>googletrustedstore/adminhtml_system_config_uploadFeeds</frontend_model>
161
+ <sort_order>60</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>1</show_in_website>
164
+ <show_in_store>1</show_in_store>
165
+ </upload_now>
166
  <google_shopping_account_id translate="label">
167
  <depends><enabled>1</enabled></depends>
168
  <label>Google Shopping Account ID</label>
169
  <frontend_type>text</frontend_type>
170
  <frontend_model>googletrustedstore/adminhtml_system_config_googleShoppingAccountId</frontend_model>
171
  <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
  <comment><![CDATA[Use this field to enter your Google Shopping Account ID if GoogleShopping module is unavailable.]]></comment>
175
  <validate>validate-digits</validate>
176
+ <sort_order>65</sort_order>
177
  </google_shopping_account_id>
178
  <subscription_for_updates translate="label">
179
  <label>Subscribe for updates</label>
184
  <show_in_website>0</show_in_website>
185
  <show_in_store>0</show_in_store>
186
  <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>
187
+ <sort_order>70</sort_order>
188
  </subscription_for_updates>
189
  </fields>
190
  </trustedstore>
app/design/adminhtml/default/default/template/googletrustedstore/settings_js.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <script type="text/javascript">
29
+ //<![CDATA[
30
+ var gtsNotificationDone = false;
31
+ var settingIds = new Array(
32
+ 'google_trustedstore_account_id',
33
+ 'google_trustedstore_ftp_username',
34
+ 'google_trustedstore_ftp_password',
35
+ 'google_trustedstore_cancellation_feed_filename',
36
+ 'google_trustedstore_shipment_feed_filename'
37
+ );
38
+ Event.observe(document, 'dom:loaded', function(){
39
+ for (var i = 0; i < settingIds.length; i++) {
40
+ $(settingIds[i]).observe('change', function() {
41
+ if (!gtsNotificationDone) {
42
+ for (var k = 0; k < settingIds.length; k++) {
43
+ $(settingIds[k]).addClassName('gts-warning');
44
+ }
45
+ alert('Please verify that FTP username, password, Cancellation Feed file name, and Shipment Feed file name are the same within a given Google Trusted Store Merchant ID');
46
+ }
47
+ gtsNotificationDone = true;
48
+ });
49
+ }
50
+ })
51
+
52
+ //]]>
53
+ </script>
54
+ <style type="text/css">
55
+ .gts-warning {border: 1px solid red !important;}
56
+ </style>
app/locale/en_US/Mage_GoogleTrustedStore.csv CHANGED
@@ -1,30 +1,41 @@
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."
 
 
 
 
 
 
 
 
 
 
 
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."
31
+ "FTP mode","FTP mode"
32
+ "Active","Active"
33
+ "Passive","Passive"
34
+ "Are you sure to generate feeds now?","Are you sure to generate feeds now?"
35
+ "Are you sure to upload feeds now?","Are you sure to upload feeds now?"
36
+ "Feed files have been created.","Feed files have been created."
37
+ "Feed files have been uploaded.","Feed files have been uploaded."
38
+ "Settings seem to be correct.","Settings seem to be correct."
39
+ "Generate feeds now","Generate feeds now"
40
+ "Upload feeds now","Upload feeds now"
41
+ "Verify Settings","Verify Settings"
package.xml CHANGED
@@ -1,18 +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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_GoogleTrustedStore</name>
4
+ <version>1.0.13</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>Functionality updates.</notes>
12
  <authors><author><name>Magento</name><user>Magento</user><email>Magento-GTS-Support@magento.com</email></author></authors>
13
+ <date>2013-03-14</date>
14
+ <time>13:59:46</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="8e09b7a5caa9e870f27288fa5cd969c7"/><dir name="System"><dir name="Config"><file name="Button.php" hash="9a875e50fe02d6b3a5ba62580c6ed7eb"/><file name="GenerateFeeds.php" hash="966ee6bd5177ba37e773ef4e0c7adc44"/><file name="GoogleShoppingAccountId.php" hash="d0409611c1d455c253a2f5631d44ce54"/><file name="Subscribe.php" hash="e8f0b933730328caa424e31481f7cd55"/><file name="UploadFeeds.php" hash="0eb7d2f9215f61da18cdf4dd53a7da3e"/><file name="VerifySettings.php" hash="0e4f4f07aa281a094d65a1f6bb6bf6a4"/></dir></dir></dir><file name="Badge.php" hash="99049248aebab1d4fef803c7cd084bf1"/><dir name="OrderConfirmation"><file name="Multishipping.php" hash="d85d6dfc3ac3475018c82b5bbe41f66b"/><file name="Onepage.php" hash="1f926c3ee29b3f792992d9d2fdfbe885"/></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="d435195a766923031812c7fd8252bfc1"/><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="f8d80b87aa1d3548e61671dd2a5863fe"/><file name="GoogleShoppingAdapter.php" hash="b1c8025617e7fe123af409cf23c063b3"/><file name="Observer.php" hash="338ae0ca2008d281e7382f739a97bedb"/><dir name="Source"><file name="FtpMode.php" hash="328c595c332d6e7913caa641d33a1bf2"/><file name="OrderCancellationReason.php" hash="07c09c5ffe93e59ec8261fdb29b0804e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Googletrustedstore"><file name="FeedController.php" hash="a3d6b76a7d63d3edb976d6810f8eca8d"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="bcacb320952b42cfe5ba8a3d959198a5"/><file name="system.xml" hash="22e8bdde37b2cfd8245f967896d50879"/></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"/><file name="settings_js.phtml" hash="a4038f11eaec43b78d438278e4678e3c"/></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="42eed1314a9b4ca705be1020f83467a6"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.13</min><max>5.3.100</max></php></required></dependencies>
18
  </package>