Version Notes
Added email notification.
Fixed some issues
Download this release
Release Info
Developer | Fontis |
Extension | Mage_GoogleTrustedStore |
Version | 1.0.14 |
Comparing to | |
See all releases |
Code changes from version 1.0.13 to 1.0.14
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/GenerateFeeds.php +1 -1
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/UploadFeeds.php +1 -1
- app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/VerifySettings.php +4 -3
- app/code/core/Mage/GoogleTrustedStore/Helper/Data.php +45 -1
- app/code/core/Mage/GoogleTrustedStore/Model/Backend/FeedFilename.php +2 -2
- app/code/core/Mage/GoogleTrustedStore/Model/Config.php +117 -5
- app/code/core/Mage/GoogleTrustedStore/Model/Feed/Shipment.php +1 -1
- app/code/core/Mage/GoogleTrustedStore/Model/Feeder.php +197 -56
- app/code/core/Mage/GoogleTrustedStore/Model/Observer.php +1 -1
- app/code/core/Mage/GoogleTrustedStore/controllers/Adminhtml/Googletrustedstore/FeedController.php +36 -0
- app/code/core/Mage/GoogleTrustedStore/etc/config.xml +4 -3
- app/code/core/Mage/GoogleTrustedStore/etc/system.xml +33 -13
- app/design/adminhtml/default/default/template/googletrustedstore/settings_js.phtml +18 -1
- app/locale/en_US/Mage_GoogleTrustedStore.csv +15 -3
- package.xml +7 -6
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/GenerateFeeds.php
CHANGED
@@ -36,7 +36,7 @@ class Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_GenerateFeeds
|
|
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
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
'id' => 'generate_now',
|
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 you want to generate the feeds?');
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
'id' => 'generate_now',
|
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/UploadFeeds.php
CHANGED
@@ -36,7 +36,7 @@ class Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_UploadFeeds
|
|
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
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
'id' => 'upload_now',
|
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 you want to upload the feeds?');
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
'id' => 'upload_now',
|
app/code/core/Mage/GoogleTrustedStore/Block/Adminhtml/System/Config/VerifySettings.php
CHANGED
@@ -28,19 +28,20 @@ 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,'
|
39 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
40 |
->setData(array(
|
41 |
'id' => 'gts_verify',
|
42 |
'label' => Mage::helper('googletrustedstore')->__('Verify Settings'),
|
43 |
-
'onclick' => "
|
44 |
));
|
45 |
$script = $this->getLayout()
|
46 |
->createBlock('core/template')
|
28 |
extends Mage_GoogleTrustedStore_Block_Adminhtml_System_Config_Button
|
29 |
{
|
30 |
/**
|
31 |
+
* Return element html and configuration for the verify settings button
|
32 |
+
* Loadsgoogletrustedstore/settings_js.phtml
|
33 |
*
|
34 |
* @param Varien_Data_Form_Element_Abstract $element
|
35 |
* @return string
|
36 |
*/
|
37 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
38 |
{
|
39 |
+
$url = $this->_getOnclickUrl($element,'verifyConfig');
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
'id' => 'gts_verify',
|
43 |
'label' => Mage::helper('googletrustedstore')->__('Verify Settings'),
|
44 |
+
'onclick' => "verifyGoogleTrustedStoresSettings('{$url}')",
|
45 |
));
|
46 |
$script = $this->getLayout()
|
47 |
->createBlock('core/template')
|
app/code/core/Mage/GoogleTrustedStore/Helper/Data.php
CHANGED
@@ -47,4 +47,48 @@ class Mage_GoogleTrustedStore_Helper_Data extends Mage_Core_Helper_Abstract
|
|
47 |
->setBodyText('')
|
48 |
->send();
|
49 |
}
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
->setBodyText('')
|
48 |
->send();
|
49 |
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param $store
|
53 |
+
* @param $items
|
54 |
+
* @param $tplSuccess
|
55 |
+
* @param $tplError
|
56 |
+
* @return $this
|
57 |
+
*/
|
58 |
+
public function sendFeedNotification($store, $items, $tplSuccess, $tplError)
|
59 |
+
{
|
60 |
+
$body = '';
|
61 |
+
$hasError = false;
|
62 |
+
$allowedKeys = array('entity_name', 'store_name', 'error_message');
|
63 |
+
foreach($items as $item) {
|
64 |
+
if ($item['successfully']) {
|
65 |
+
$itemMsg = $this->__($tplSuccess);
|
66 |
+
} else {
|
67 |
+
$itemMsg = $this->__($tplError);
|
68 |
+
$hasError = true;
|
69 |
+
}
|
70 |
+
foreach($allowedKeys as $key) {
|
71 |
+
$value = isset($item[$key]) ? $item[$key] : '';
|
72 |
+
$itemMsg = str_replace("{{$key}}", $value, $itemMsg);
|
73 |
+
}
|
74 |
+
$body .= $itemMsg . PHP_EOL;
|
75 |
+
}
|
76 |
+
|
77 |
+
$email = $this->_getConfig()->getNotificationRecipientEmail($store);
|
78 |
+
$subject = $this->_getConfig()->getNotificationSubject();
|
79 |
+
$subject.= $hasError ? $this->__('Failure') : $this->__('Success');
|
80 |
+
|
81 |
+
$mail = new Zend_Mail();
|
82 |
+
$mail->setFrom($this->_getConfig()->getDefaultSenderEmail(), $this->_getConfig()->getDefaultSenderName());
|
83 |
+
$mail->addTo($email);
|
84 |
+
$mail->setSubject($subject);
|
85 |
+
$mail->setBodyHtml(nl2br($body));
|
86 |
+
|
87 |
+
try {
|
88 |
+
$mail->send();
|
89 |
+
} catch(Exception $e) {
|
90 |
+
Mage::logException($e);
|
91 |
+
}
|
92 |
+
return $this;
|
93 |
+
}
|
94 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Backend/FeedFilename.php
CHANGED
@@ -27,12 +27,12 @@
|
|
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 (
|
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 |
));
|
27 |
class Mage_GoogleTrustedStore_Model_Backend_FeedFilename extends Mage_Core_Model_Config_Data
|
28 |
{
|
29 |
/**
|
30 |
+
* Validates value before saving. The values must not contain non-word characters, except for a period (.)
|
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 |
));
|
app/code/core/Mage/GoogleTrustedStore/Model/Config.php
CHANGED
@@ -46,6 +46,18 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
46 |
const XML_PATH_GOOGLE_SHOPPING_ACCOUNT_ID = 'google/trustedstore/google_shopping_account_id';
|
47 |
const XML_GOOGLE_GROUP_EMAIL = 'global/googletrustedstore/google_group_email';
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
const CARRIER_CODE_OTHER = 'Other';
|
50 |
const CARRIER_NAME_OTHER = 'OTHER';
|
51 |
/**
|
@@ -190,7 +202,7 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
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 |
}
|
@@ -205,7 +217,7 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
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 |
|
@@ -271,7 +283,7 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
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)
|
@@ -330,7 +342,7 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
-
* Returns email for
|
334 |
*
|
335 |
* @return string
|
336 |
*/
|
@@ -346,4 +358,104 @@ class Mage_GoogleTrustedStore_Model_Config
|
|
346 |
|
347 |
return $name . '+subscribe@' . $domain;
|
348 |
}
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
const XML_PATH_GOOGLE_SHOPPING_ACCOUNT_ID = 'google/trustedstore/google_shopping_account_id';
|
47 |
const XML_GOOGLE_GROUP_EMAIL = 'global/googletrustedstore/google_group_email';
|
48 |
|
49 |
+
const XML_PATH_NOTIFICATION_ENABLED = 'google/trustedstore/notification_enabled';
|
50 |
+
const XML_PATH_NOTIFICATION_EMAIL = 'google/trustedstore/notification_recipient_email';
|
51 |
+
|
52 |
+
const XML_PATH_DEFAULT_SENDER_NAME = 'trans_email/ident_general/name';
|
53 |
+
const XML_PATH_DEFAULT_SENDER_EMAIL= 'trans_email/ident_general/email';
|
54 |
+
|
55 |
+
const XML_PATH_NOTIFICATION_SUBJECT = 'Google Trusted Stores Magento Extension Notification:';
|
56 |
+
const XML_PATH_NOTIFICATION_SUCCESS_MESSAGE_GENERATE = '{entity_name} export file has been successfully generated';
|
57 |
+
const XML_PATH_NOTIFICATION_ERROR_MESSAGE_GENERATE = '{entity_name} export file generation failure: {error_message}';
|
58 |
+
const XML_PATH_NOTIFICATION_SUCCESS_MESSAGE_UPLOAD = '{entity_name} export file has been successfully uploaded';
|
59 |
+
const XML_PATH_NOTIFICATION_ERROR_MESSAGE_UPLOAD = '{entity_name} export file upload failure: {error_message}';
|
60 |
+
|
61 |
const CARRIER_CODE_OTHER = 'Other';
|
62 |
const CARRIER_NAME_OTHER = 'OTHER';
|
63 |
/**
|
202 |
$dir = Mage::getBaseDir('tmp') . DIRECTORY_SEPARATOR . $store->getCode();
|
203 |
if (!file_exists($dir)) {
|
204 |
mkdir($dir,0777);
|
205 |
+
}
|
206 |
if (!is_dir($dir) || !is_writable($dir)) {
|
207 |
throw new Varien_Exception('Unable to find writable feed catalog');
|
208 |
}
|
217 |
* @return string
|
218 |
*/
|
219 |
public function getFtpShipmentFileName(Mage_Core_Model_Store $store)
|
220 |
+
{
|
221 |
return $this->_getFeedDir($store) . DIRECTORY_SEPARATOR . $this->getFtpShipmentTargetFileName($store);
|
222 |
}
|
223 |
|
283 |
$scope = $store ? 'stores' : 'default';
|
284 |
$scopeId = $store ? $store->getId() : 0;
|
285 |
$path = self::XML_PATH_LAST_TIME_GENERATED_DATE;
|
286 |
+
|
287 |
$configDataCollection = Mage::getModel('core/config_data')
|
288 |
->getCollection()
|
289 |
->addFieldToFilter('scope', $scope)
|
342 |
}
|
343 |
|
344 |
/**
|
345 |
+
* Returns email for subscription to group
|
346 |
*
|
347 |
* @return string
|
348 |
*/
|
358 |
|
359 |
return $name . '+subscribe@' . $domain;
|
360 |
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Check if Returns/Shipments email notification is enabled in admin panel or not
|
364 |
+
*
|
365 |
+
* @param $store
|
366 |
+
* @return boolean
|
367 |
+
*/
|
368 |
+
public function isNotificationEnabled($store = null)
|
369 |
+
{
|
370 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_NOTIFICATION_ENABLED, $store);
|
371 |
+
}
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Get Returns/Shipments email for notification
|
375 |
+
*
|
376 |
+
* @param $store
|
377 |
+
* @return string
|
378 |
+
*/
|
379 |
+
public function getNotificationRecipientEmail($store = null)
|
380 |
+
{
|
381 |
+
$email = Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_EMAIL, $store);
|
382 |
+
if (!$email) {
|
383 |
+
throw new RuntimeException(
|
384 |
+
'Structure of config is incorrect; cannot get item by path ' . self::XML_PATH_NOTIFICATION_EMAIL
|
385 |
+
);
|
386 |
+
}
|
387 |
+
return $email;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Get Notification subject for generate operation
|
392 |
+
*
|
393 |
+
* @return string
|
394 |
+
*/
|
395 |
+
public function getNotificationSubject()
|
396 |
+
{
|
397 |
+
return self::XML_PATH_NOTIFICATION_SUBJECT;
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Get Notification success message for generate operation
|
402 |
+
*
|
403 |
+
* @return string
|
404 |
+
*/
|
405 |
+
public function getNotificationSuccessMessageGenerate()
|
406 |
+
{
|
407 |
+
return self::XML_PATH_NOTIFICATION_SUCCESS_MESSAGE_GENERATE;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Get Notification error message for generate operation
|
412 |
+
*
|
413 |
+
* @return string
|
414 |
+
*/
|
415 |
+
public function getNotificationErrorMessageGenerate()
|
416 |
+
{
|
417 |
+
return self::XML_PATH_NOTIFICATION_ERROR_MESSAGE_GENERATE;
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Get Notification success message for upload operation
|
422 |
+
*
|
423 |
+
* @return string
|
424 |
+
*/
|
425 |
+
public function getNotificationSuccessMessageUpload()
|
426 |
+
{
|
427 |
+
return self::XML_PATH_NOTIFICATION_SUCCESS_MESSAGE_UPLOAD;
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Get Notification error message for upload operation
|
432 |
+
*
|
433 |
+
* @return string
|
434 |
+
*/
|
435 |
+
public function getNotificationErrorMessageUpload()
|
436 |
+
{
|
437 |
+
return self::XML_PATH_NOTIFICATION_ERROR_MESSAGE_UPLOAD;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Get System Default Sender Email address
|
442 |
+
*
|
443 |
+
* @param $store
|
444 |
+
* @return string
|
445 |
+
*/
|
446 |
+
public function getDefaultSenderEmail($store = null)
|
447 |
+
{
|
448 |
+
return Mage::getStoreConfig(self::XML_PATH_DEFAULT_SENDER_EMAIL, $store);
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Get System Default Sender name
|
453 |
+
*
|
454 |
+
* @param $store
|
455 |
+
* @return string
|
456 |
+
*/
|
457 |
+
public function getDefaultSenderName($store = null)
|
458 |
+
{
|
459 |
+
return Mage::getStoreConfig(self::XML_PATH_DEFAULT_SENDER_NAME, $store);
|
460 |
+
}
|
461 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Feed/Shipment.php
CHANGED
@@ -79,7 +79,7 @@ class Mage_GoogleTrustedStore_Model_Feed_Shipment extends Mage_GoogleTrustedStor
|
|
79 |
: '';
|
80 |
$this->_addRow(array(
|
81 |
$shipment->getOrder()->getIncrementId(),
|
82 |
-
$track ? $track->getNumber() : '',
|
83 |
$carrierCode,
|
84 |
$otherCarrierName,
|
85 |
$shipment->getCreatedAtDate()->toString('yyyy-MM-dd'),
|
79 |
: '';
|
80 |
$this->_addRow(array(
|
81 |
$shipment->getOrder()->getIncrementId(),
|
82 |
+
trim($track ? $track->getNumber() : ''),
|
83 |
$carrierCode,
|
84 |
$otherCarrierName,
|
85 |
$shipment->getCreatedAtDate()->toString('yyyy-MM-dd'),
|
app/code/core/Mage/GoogleTrustedStore/Model/Feeder.php
CHANGED
@@ -28,33 +28,78 @@ class Mage_GoogleTrustedStore_Model_Feeder
|
|
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 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
*
|
@@ -117,44 +162,120 @@ class Mage_GoogleTrustedStore_Model_Feeder
|
|
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 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
$
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
}
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
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)
|
@@ -216,34 +337,54 @@ class Mage_GoogleTrustedStore_Model_Feeder
|
|
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
|
225 |
{
|
226 |
$ftp = new Varien_Io_Ftp;
|
227 |
$fs = new Varien_Io_File;
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
if (false === $result) {
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
-
|
|
|
|
|
243 |
}
|
244 |
}
|
245 |
|
246 |
$ftp->close();
|
|
|
|
|
|
|
247 |
return $uploadedFiles;
|
248 |
}
|
249 |
|
@@ -256,4 +397,4 @@ class Mage_GoogleTrustedStore_Model_Feeder
|
|
256 |
{
|
257 |
return Mage::getSingleton('googletrustedstore/config');
|
258 |
}
|
259 |
-
}
|
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 |
+
if (!$stores) {
|
38 |
+
$stores = Mage::app()->getStores();
|
39 |
+
}
|
40 |
+
|
41 |
+
$helper = Mage::helper('googletrustedstore');
|
42 |
+
foreach ($stores as $store) {
|
43 |
+
if ($this->_getConfig()->isEnabled($store)) {
|
44 |
+
$result = $messages = array();
|
45 |
+
try {
|
46 |
+
$shipmentFeed = array(
|
47 |
+
'entity_name' => $helper->__('Shipment'),
|
48 |
+
'store_name' => $store->getName(),
|
49 |
+
'successfully' => true
|
50 |
+
);
|
51 |
$this->_generateShipmentFeed($store);
|
52 |
+
} catch (RuntimeException $e) {
|
53 |
+
$message = 'GoogleTrustedStore: ' . $e->getMessage();
|
54 |
+
$messages[] = $message;
|
55 |
+
Mage::log($message);
|
56 |
+
|
57 |
+
$shipmentFeed['successfully'] = false;
|
58 |
+
$shipmentFeed['error_message'] = $e->getMessage();
|
59 |
+
}
|
60 |
+
$result[] = $shipmentFeed;
|
61 |
+
|
62 |
+
try {
|
63 |
+
$cancellationFeed = array(
|
64 |
+
'entity_name' => $helper->__('Cancellation'),
|
65 |
+
'store_name' => $store->getName(),
|
66 |
+
'successfully' => true
|
67 |
+
);
|
68 |
$this->_generateCancellationFeed($store);
|
69 |
+
} catch (RuntimeException $e) {
|
70 |
+
$message = 'GoogleTrustedStore: ' . $e->getMessage();
|
71 |
+
$messages[] = $message;
|
72 |
+
Mage::log($message);
|
73 |
+
|
74 |
+
$cancellationFeed['successfully'] = false;
|
75 |
+
$cancellationFeed['error_message'] = $e->getMessage();
|
76 |
+
}
|
77 |
+
$result[] = $cancellationFeed;
|
78 |
+
|
79 |
+
if ($this->_getConfig()->isNotificationEnabled($store)) {
|
80 |
+
$helper->sendFeedNotification($store, $result,
|
81 |
+
$this->_getConfig()->getNotificationSuccessMessageGenerate(),
|
82 |
+
$this->_getConfig()->getNotificationErrorMessageGenerate()
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($manual && !empty($messages)) {
|
87 |
+
throw new Exception(nl2br(implode(PHP_EOL, $messages)));
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
+
$this->_getConfig()->setLastTimeGenerated(null, $store);
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Generates all feeds for shipment and cancellation
|
96 |
+
*
|
97 |
+
*/
|
98 |
+
public function generateFeedsAll()
|
99 |
+
{
|
100 |
+
$this->generateFeeds();
|
101 |
+
}
|
102 |
+
|
103 |
/**
|
104 |
* Generates feed for shipment and save it in temporary directory
|
105 |
*
|
162 |
|
163 |
/**
|
164 |
* Upload feeds (shipment/cancelled orders) to Google
|
165 |
+
*
|
166 |
* @param mixed $stores
|
167 |
* @param bool $manual
|
168 |
*/
|
169 |
public function uploadFeeds($stores = null, $manual = null)
|
170 |
{
|
171 |
+
if (!$stores) {
|
172 |
+
$stores = Mage::app()->getStores();
|
173 |
+
}
|
174 |
+
|
175 |
+
$uploadedFilesNum = 0;
|
176 |
+
$helper = Mage::helper('googletrustedstore');
|
177 |
+
foreach ($stores as $store) {
|
178 |
+
$feedFiles = array();
|
179 |
+
if ($this->_getConfig()->isEnabled($store)) {
|
180 |
+
$feedFiles[] = array(
|
181 |
+
'entity_name' => $helper->__('Shipment'),
|
182 |
+
'store_name' => $store->getName(),
|
183 |
+
'successfully'=> false,
|
184 |
+
'local' => $this->_getConfig()->getFtpShipmentFileName($store),
|
185 |
+
'remote' => $this->_getConfig()->getFtpShipmentTargetFileName($store),
|
186 |
+
);
|
187 |
+
$feedFiles[] = array(
|
188 |
+
'entity_name' => $helper->__('Cancellation'),
|
189 |
+
'store_name' => $store->getName(),
|
190 |
+
'successfully'=> false,
|
191 |
+
'local' => $this->_getConfig()->getFtpCancellationFileName($store),
|
192 |
+
'remote' => $this->_getConfig()->getFtpCancellationTargetFileName($store),
|
193 |
+
);
|
194 |
+
|
195 |
+
$message = '';
|
196 |
+
try {
|
197 |
+
$uploadedFilesNum += count($this->_uploadFiles($feedFiles, $store));
|
198 |
+
} catch (Varien_Io_Exception $e) {
|
199 |
+
$message = Mage::helper('googletrustedstore')->__('GoogleTrustedStore FTP upload error:') .
|
200 |
+
' ' . $e->getMessage();
|
201 |
+
Mage::log($message);
|
202 |
+
}
|
203 |
+
|
204 |
+
if ($this->_getConfig()->isNotificationEnabled($store)) {
|
205 |
+
$helper->sendFeedNotification($store, $feedFiles,
|
206 |
+
$this->_getConfig()->getNotificationSuccessMessageUpload(),
|
207 |
+
$this->_getConfig()->getNotificationErrorMessageUpload()
|
208 |
+
);
|
209 |
+
}
|
210 |
+
|
211 |
+
if ($manual && $message) {
|
212 |
+
throw new Exception($message);
|
213 |
}
|
214 |
}
|
215 |
+
}
|
216 |
+
|
217 |
+
if (!$uploadedFilesNum) {
|
218 |
+
throw new Exception(Mage::helper('googletrustedstore')
|
219 |
+
->__('Feed is not sent. Please generate the feed prior to sending'));
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Upload all feeds (shipment/cancelled orders) to Google
|
225 |
+
*/
|
226 |
+
public function uploadFeedsAll()
|
227 |
+
{
|
228 |
+
$this->uploadFeeds();
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* This method is used to verify the configuration only for the current store. This method
|
233 |
+
* will attempt to log in via FTP
|
234 |
+
*
|
235 |
+
* @param string $user
|
236 |
+
* @param string $password
|
237 |
+
* @param bool $passive
|
238 |
+
* @param int $store
|
239 |
+
*/
|
240 |
+
|
241 |
+
public function verifyConfigurationSettings($user, $password, $passive, $store)
|
242 |
+
{
|
243 |
+
$ftp = new Varien_Io_Ftp;
|
244 |
+
// Check if the system can be authenticated against. Only the host name is taken from
|
245 |
+
// configuration.
|
246 |
+
if (preg_match('/^\*+$/', $password)) {
|
247 |
+
$password = $this->_getConfig()->getFtpPassword($store);
|
248 |
+
}
|
249 |
+
|
250 |
+
$ftp->open(array(
|
251 |
+
'host' => $this->_getConfig()->getFtpHostName(),
|
252 |
+
'user' => $user,
|
253 |
+
'password' => $password,
|
254 |
+
'passive' => $passive,
|
255 |
+
));
|
256 |
+
$ftp->close();
|
257 |
+
|
258 |
+
// Get the shipment and cancel file locations for the current store
|
259 |
+
$shipmentFile = $this->_getConfig()->getFtpShipmentFileName(Mage::app()->getStore($store));
|
260 |
+
$cancelFile = $this->_getConfig()->getFtpCancellationFileName(Mage::app()->getStore($store));
|
261 |
+
|
262 |
+
// Check to see that the shipment and cancel file locations are writable.
|
263 |
+
$this->_checkFileWritable($shipmentFile);
|
264 |
+
$this->_checkFileWritable($cancelFile);
|
265 |
+
|
266 |
+
// Load the cron schedule. If there are items here it means that cron has been installed
|
267 |
+
// and run at least once.
|
268 |
+
$cronScheduleItems = Mage::getResourceModel('cron/schedule_collection');
|
269 |
+
if (!$cronScheduleItems->count()) {
|
270 |
+
throw new Exception(
|
271 |
+
Mage::helper('googletrustedstore')->__('Cron warning: Possibly cron job is not installed'));
|
272 |
}
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
* Verify general settings for feed generation/upload
|
277 |
*
|
278 |
+
* @deprecated in favor of verifyConfigurationSettings
|
279 |
* @param mixed $stores
|
280 |
*/
|
281 |
public function verifySettings($stores = null)
|
337 |
/**
|
338 |
* Upload file by file map to Google FTP server and delete it from local file system
|
339 |
*
|
340 |
+
* @param array $fileNameMap array(array('local' => 'local file name', 'remote' => 'remote file name'), ...)
|
341 |
* @param mixed $store
|
342 |
*
|
343 |
* @throws Varien_Io_Exception If FTP related error occurred
|
344 |
*/
|
345 |
+
protected function _uploadFiles(array &$fileNameMap, $store)
|
346 |
{
|
347 |
$ftp = new Varien_Io_Ftp;
|
348 |
$fs = new Varien_Io_File;
|
349 |
+
|
350 |
+
try {
|
351 |
+
$ftp->open(array(
|
352 |
+
'host' => $host = $this->_getConfig()->getFtpHostName(),
|
353 |
+
'user' => $this->_getConfig()->getFtpUserName($store),
|
354 |
+
'password' => $this->_getConfig()->getFtpPassword($store),
|
355 |
+
'passive' => $this->_getConfig()->getFtpMode($store),
|
356 |
+
));
|
357 |
+
} catch (Exception $e) {
|
358 |
+
foreach ($fileNameMap as &$item) {
|
359 |
+
$item['error_message'] = $e->getMessage();
|
360 |
+
}
|
361 |
+
throw $e;
|
362 |
+
}
|
363 |
+
|
364 |
+
$uploadedFiles = array();
|
365 |
+
$exceptions = array();
|
366 |
+
foreach ($fileNameMap as &$item) {
|
367 |
+
if ($fs->fileExists($item['local'])) {
|
368 |
+
$result = $ftp->write($item['remote'], $item['local']);
|
369 |
if (false === $result) {
|
370 |
+
$item['error_message'] =
|
371 |
+
Mage::helper('googletrustedstore')->__("Unable to upload '%s' to '%s' on server %s", $item['local'], $item['remote'], $host);
|
372 |
+
$exceptions[] = $item['error_message'];
|
373 |
+
} else {
|
374 |
+
$uploadedFiles[] = $item['local'];
|
375 |
+
$fs->rm($item['local']);
|
376 |
+
$item['successfully'] = true;
|
377 |
}
|
378 |
+
} else {
|
379 |
+
$item['error_message'] =
|
380 |
+
Mage::helper('googletrustedstore')->__("The '%s' file does not exist on Magento server", $item['local']);
|
381 |
}
|
382 |
}
|
383 |
|
384 |
$ftp->close();
|
385 |
+
if (!empty($exceptions)) {
|
386 |
+
throw new Varien_Io_Exception(implode(PHP_EOL, $exceptions));
|
387 |
+
}
|
388 |
return $uploadedFiles;
|
389 |
}
|
390 |
|
397 |
{
|
398 |
return Mage::getSingleton('googletrustedstore/config');
|
399 |
}
|
400 |
+
}
|
app/code/core/Mage/GoogleTrustedStore/Model/Observer.php
CHANGED
@@ -159,7 +159,7 @@ 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 |
-
if (
|
163 |
return $this;
|
164 |
}
|
165 |
$source = Mage::getSingleton('googletrustedstore/source_orderCancellationReason');
|
159 |
$block = $observer->getBlock();
|
160 |
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract) {
|
161 |
$item = $block->getItem('cancel_order');
|
162 |
+
if (!$item instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Item) {
|
163 |
return $this;
|
164 |
}
|
165 |
$source = Mage::getSingleton('googletrustedstore/source_orderCancellationReason');
|
app/code/core/Mage/GoogleTrustedStore/controllers/Adminhtml/Googletrustedstore/FeedController.php
CHANGED
@@ -62,6 +62,8 @@ class Mage_GoogleTrustedStore_Adminhtml_Googletrustedstore_FeedController extend
|
|
62 |
|
63 |
/**
|
64 |
* Verify settings
|
|
|
|
|
65 |
*/
|
66 |
public function verifyAction()
|
67 |
{
|
@@ -77,6 +79,40 @@ class Mage_GoogleTrustedStore_Adminhtml_Googletrustedstore_FeedController extend
|
|
77 |
$this->_redirect('*/system_config/edit', $this->_getRedirectParams());
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
/**
|
81 |
* Returns store list
|
82 |
*
|
62 |
|
63 |
/**
|
64 |
* Verify settings
|
65 |
+
*
|
66 |
+
* @deprecated in favor of verifyconfigAction
|
67 |
*/
|
68 |
public function verifyAction()
|
69 |
{
|
79 |
$this->_redirect('*/system_config/edit', $this->_getRedirectParams());
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* This method will test the configuration provided by the Adminhtml System Configuration
|
84 |
+
* for the GoogleTrustedStore module.
|
85 |
+
*
|
86 |
+
* This method deprecates verifyAction().
|
87 |
+
*/
|
88 |
+
|
89 |
+
public function verifyConfigAction()
|
90 |
+
{
|
91 |
+
|
92 |
+
try {
|
93 |
+
$storeId = $this->getRequest()->getParam('store_id', Mage::app()->getDefaultStoreView()->getId());
|
94 |
+
Mage::getModel('googletrustedstore/feeder')->verifyConfigurationSettings(
|
95 |
+
$this->getRequest()->getPost('user'),
|
96 |
+
$this->getRequest()->getPost('password'),
|
97 |
+
$this->getRequest()->getPost('passive'),
|
98 |
+
$storeId
|
99 |
+
);
|
100 |
+
|
101 |
+
$this->getResponse()->setBody(
|
102 |
+
Mage::helper('googletrustedstore')->__(
|
103 |
+
'Settings are valid: FTP Credentials, file system permissions, cron settings.'
|
104 |
+
)
|
105 |
+
);
|
106 |
+
}
|
107 |
+
catch (Exception $e) {
|
108 |
+
$this->getResponse()->setBody(
|
109 |
+
Mage::helper('googletrustedstore')->__(
|
110 |
+
$e->getMessage()
|
111 |
+
)
|
112 |
+
);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
/**
|
117 |
* Returns store list
|
118 |
*
|
app/code/core/Mage/GoogleTrustedStore/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_GoogleTrustedStore>
|
31 |
-
<version>1.6.
|
32 |
</Mage_GoogleTrustedStore>
|
33 |
</modules>
|
34 |
<global>
|
@@ -83,6 +83,7 @@
|
|
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>
|
@@ -187,7 +188,7 @@
|
|
187 |
<cron_expr>0 2 * * *</cron_expr>
|
188 |
</schedule>
|
189 |
<run>
|
190 |
-
<model>googletrustedstore/feeder::
|
191 |
</run>
|
192 |
</googletrustedstore_generate_feeds>
|
193 |
<googletrustedstore_upload_feeds>
|
@@ -195,7 +196,7 @@
|
|
195 |
<cron_expr>0 5 * * *</cron_expr>
|
196 |
</schedule>
|
197 |
<run>
|
198 |
-
<model>googletrustedstore/feeder::
|
199 |
</run>
|
200 |
</googletrustedstore_upload_feeds>
|
201 |
</jobs>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_GoogleTrustedStore>
|
31 |
+
<version>1.6.1.0</version>
|
32 |
</Mage_GoogleTrustedStore>
|
33 |
</modules>
|
34 |
<global>
|
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 |
+
<notification_enabled>0</notification_enabled>
|
87 |
</trustedstore>
|
88 |
</google>
|
89 |
</default>
|
188 |
<cron_expr>0 2 * * *</cron_expr>
|
189 |
</schedule>
|
190 |
<run>
|
191 |
+
<model>googletrustedstore/feeder::generateFeedsAll</model>
|
192 |
</run>
|
193 |
</googletrustedstore_generate_feeds>
|
194 |
<googletrustedstore_upload_feeds>
|
196 |
<cron_expr>0 5 * * *</cron_expr>
|
197 |
</schedule>
|
198 |
<run>
|
199 |
+
<model>googletrustedstore/feeder::uploadFeedsAll</model>
|
200 |
</run>
|
201 |
</googletrustedstore_upload_feeds>
|
202 |
</jobs>
|
app/code/core/Mage/GoogleTrustedStore/etc/system.xml
CHANGED
@@ -56,7 +56,7 @@
|
|
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>
|
61 |
<label>Default Order Cancellation Reason</label>
|
62 |
<comment><![CDATA[Used if origin of cancellation is outside of admin.]]></comment>
|
@@ -67,7 +67,7 @@
|
|
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>
|
@@ -78,7 +78,7 @@
|
|
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>
|
83 |
<label>FTP Username</label>
|
84 |
<frontend_type>text</frontend_type>
|
@@ -89,7 +89,7 @@
|
|
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>
|
94 |
<label>FTP Password</label>
|
95 |
<frontend_type>obscure</frontend_type>
|
@@ -101,7 +101,7 @@
|
|
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>
|
@@ -112,7 +112,7 @@
|
|
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>
|
118 |
<frontend_type>text</frontend_type>
|
@@ -124,7 +124,7 @@
|
|
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>
|
129 |
<label>Shipment Feed Filename</label>
|
130 |
<frontend_type>text</frontend_type>
|
@@ -136,16 +136,16 @@
|
|
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.
|
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>
|
@@ -154,7 +154,7 @@
|
|
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>
|
@@ -163,7 +163,7 @@
|
|
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>
|
@@ -175,7 +175,7 @@
|
|
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>
|
180 |
<frontend_type>label</frontend_type>
|
181 |
<frontend_model>googletrustedstore/adminhtml_system_config_subscribe</frontend_model>
|
@@ -186,6 +186,26 @@
|
|
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>
|
191 |
</groups>
|
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 comment">
|
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>
|
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 comment">
|
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>
|
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 comment">
|
82 |
<depends><enabled>1</enabled></depends>
|
83 |
<label>FTP Username</label>
|
84 |
<frontend_type>text</frontend_type>
|
89 |
<show_in_website>1</show_in_website>
|
90 |
<show_in_store>1</show_in_store>
|
91 |
</ftp_username>
|
92 |
+
<ftp_password translate="label comment">
|
93 |
<depends><enabled>1</enabled></depends>
|
94 |
<label>FTP Password</label>
|
95 |
<frontend_type>obscure</frontend_type>
|
101 |
<show_in_website>1</show_in_website>
|
102 |
<show_in_store>1</show_in_store>
|
103 |
</ftp_password>
|
104 |
+
<ftp_mode translate="label comment">
|
105 |
<depends><enabled>1</enabled></depends>
|
106 |
<label>FTP mode</label>
|
107 |
<frontend_type>select</frontend_type>
|
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 comment">
|
116 |
<depends><enabled>1</enabled></depends>
|
117 |
<label>Cancellation Feed Filename</label>
|
118 |
<frontend_type>text</frontend_type>
|
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 comment">
|
128 |
<depends><enabled>1</enabled></depends>
|
129 |
<label>Shipment Feed Filename</label>
|
130 |
<frontend_type>text</frontend_type>
|
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 comment">
|
140 |
<frontend_type>button</frontend_type>
|
141 |
+
<comment><![CDATA[Verify your settings: directory permissions, ftp credentials, cron setup.]]></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 comment">
|
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>
|
154 |
<show_in_website>1</show_in_website>
|
155 |
<show_in_store>1</show_in_store>
|
156 |
</generate_now>
|
157 |
+
<upload_now translate="label comment">
|
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>
|
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 comment">
|
167 |
<depends><enabled>1</enabled></depends>
|
168 |
<label>Google Shopping Account ID</label>
|
169 |
<frontend_type>text</frontend_type>
|
175 |
<validate>validate-digits</validate>
|
176 |
<sort_order>65</sort_order>
|
177 |
</google_shopping_account_id>
|
178 |
+
<subscription_for_updates translate="label comment">
|
179 |
<label>Subscribe for updates</label>
|
180 |
<frontend_type>label</frontend_type>
|
181 |
<frontend_model>googletrustedstore/adminhtml_system_config_subscribe</frontend_model>
|
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 |
+
<notification_enabled translate="label">
|
190 |
+
<label>Email Notification Enabled</label>
|
191 |
+
<frontend_type>select</frontend_type>
|
192 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
193 |
+
<sort_order>75</sort_order>
|
194 |
+
<show_in_default>1</show_in_default>
|
195 |
+
<show_in_website>1</show_in_website>
|
196 |
+
<show_in_store>1</show_in_store>
|
197 |
+
<depends><enabled>1</enabled></depends>
|
198 |
+
</notification_enabled>
|
199 |
+
<notification_recipient_email translate="label comment">
|
200 |
+
<label>Notification Recipient Email</label>
|
201 |
+
<frontend_type>text</frontend_type>
|
202 |
+
<validate>validate-email required-entry</validate>
|
203 |
+
<sort_order>80</sort_order>
|
204 |
+
<show_in_default>1</show_in_default>
|
205 |
+
<show_in_website>1</show_in_website>
|
206 |
+
<show_in_store>1</show_in_store>
|
207 |
+
<depends><enabled>1</enabled><notification_enabled>1</notification_enabled></depends>
|
208 |
+
</notification_recipient_email>
|
209 |
</fields>
|
210 |
</trustedstore>
|
211 |
</groups>
|
app/design/adminhtml/default/default/template/googletrustedstore/settings_js.phtml
CHANGED
@@ -42,13 +42,30 @@ Event.observe(document, 'dom:loaded', function(){
|
|
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">
|
42 |
for (var k = 0; k < settingIds.length; k++) {
|
43 |
$(settingIds[k]).addClassName('gts-warning');
|
44 |
}
|
45 |
+
alert('<?php echo $this->__('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 |
+
function verifyGoogleTrustedStoresSettings(url)
|
53 |
+
{
|
54 |
+
new Ajax.Request(url, {
|
55 |
+
parameters: {
|
56 |
+
user: $$('#google_trustedstore_ftp_username')[0].value,
|
57 |
+
password: $$('#google_trustedstore_ftp_password')[0].value,
|
58 |
+
passive: $$('#google_trustedstore_ftp_mode')[0].value,
|
59 |
+
},
|
60 |
+
onSuccess: function(response) {
|
61 |
+
alert(response.responseText);
|
62 |
+
},
|
63 |
+
onError: function() {
|
64 |
+
alert('<?php echo $this->__('There was an internal error verifying the FTP setting'); ?>');
|
65 |
+
}
|
66 |
+
});
|
67 |
+
}
|
68 |
+
|
69 |
//]]>
|
70 |
</script>
|
71 |
<style type="text/css">
|
app/locale/en_US/Mage_GoogleTrustedStore.csv
CHANGED
@@ -31,11 +31,23 @@
|
|
31 |
"FTP mode","FTP mode"
|
32 |
"Active","Active"
|
33 |
"Passive","Passive"
|
34 |
-
"Are you sure to generate feeds
|
35 |
-
"Are you sure to upload feeds
|
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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
"FTP mode","FTP mode"
|
32 |
"Active","Active"
|
33 |
"Passive","Passive"
|
34 |
+
"Are you sure you want to generate the feeds?","Are you sure you want to generate the feeds?"
|
35 |
+
"Are you sure you want to upload the feeds?","Are you sure you want to upload the feeds?"
|
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"
|
42 |
+
"Email Notification Enabled","Email Notification Enabled"
|
43 |
+
"Notification Recipient Email","Notification Recipient Email"
|
44 |
+
"Shipment","Shipment"
|
45 |
+
"Cancellation","Cancellation"
|
46 |
+
"Failure","Failure"
|
47 |
+
"Success","Success"
|
48 |
+
"The '%s' file does not exist on Magento server","The '%s' file does not exist on Magento server"
|
49 |
+
"Google Trusted Stores Magento Extension Notification:","Google Trusted Stores Magento Extension Notification:"
|
50 |
+
"{entity_name} export file has been successfully generated","{entity_name} export file has been successfully generated"
|
51 |
+
"{entity_name} export file generation failure: {error_message}","{entity_name} export file generation failure: {error_message}"
|
52 |
+
"{entity_name} export file has been successfully uploaded","{entity_name} export file has been successfully uploaded"
|
53 |
+
"{entity_name} export file upload failure: {error_message}","{entity_name} export file upload failure: {error_message}"
|
package.xml
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_GoogleTrustedStore</name>
|
4 |
-
<version>1.0.
|
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>
|
|
|
12 |
<authors><author><name>Magento</name><user>Magento</user><email>Magento-GTS-Support@magento.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<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="
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.2.13</min><max>5.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_GoogleTrustedStore</name>
|
4 |
+
<version>1.0.14</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>Added email notification.
|
12 |
+
Fixed some issues</notes>
|
13 |
<authors><author><name>Magento</name><user>Magento</user><email>Magento-GTS-Support@magento.com</email></author></authors>
|
14 |
+
<date>2014-03-24</date>
|
15 |
+
<time>17:04:44</time>
|
16 |
+
<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="5d4a5b341365b790fbae6eb13b3606c1"/><file name="GoogleShoppingAccountId.php" hash="d0409611c1d455c253a2f5631d44ce54"/><file name="Subscribe.php" hash="e8f0b933730328caa424e31481f7cd55"/><file name="UploadFeeds.php" hash="62d3f28ef28f7a1ebba715049c250118"/><file name="VerifySettings.php" hash="e5cf0360b9f501eaceff65c0b943703c"/></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="34fb100d35d0a4471ab927c7d116f538"/></dir><dir name="Model"><dir name="Backend"><file name="FeedFilename.php" hash="8aa2d4954a112ae5298f323229159905"/><file name="Subscribe.php" hash="cda3b389e7b9dc4590de31e47b8174d0"/></dir><file name="Config.php" hash="2f05b84147044829a95d463053e72194"/><dir name="Feed"><file name="Abstract.php" hash="9a713195a0726b48a75a199a991664fc"/><file name="Cancellation.php" hash="a4120f17b06491616eff2161d3a60917"/><file name="Shipment.php" hash="3dc7d9123d25eda82bfa4cda6c6f0d57"/></dir><file name="Feeder.php" hash="107b4a838abd4bdac208504107f86497"/><file name="GoogleShoppingAdapter.php" hash="b1c8025617e7fe123af409cf23c063b3"/><file name="Observer.php" hash="f1e2606fe2b771b65ca6546265b8b5cb"/><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="c85f814948dadebcc1c7064b04773620"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="47d4a0137c6ae0cf1468723a3f790b83"/><file name="system.xml" hash="5286ade21f56e56085bdb6c73839cb16"/></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="c1e9da03d1517b3d1ecb1aaa2dd3273d"/></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="8d98e35657ff3eb466f0286bcf2473be"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.2.13</min><max>5.5.9</max></php></required></dependencies>
|
19 |
</package>
|