Version Notes
Plugin corresponds to version 6.0.2 of the Bazaarvoice platform
Download this release
Release Info
Developer | BV DTS |
Extension | Bazaarvoice_Connector |
Version | 6.2.0 |
Comparing to | |
See all releases |
Code changes from version 6.1.2.4 to 6.2.0
- app/code/local/Bazaarvoice/Connector/Helper/Data.php +34 -48
- app/code/local/Bazaarvoice/Connector/Helper/Sftp.php +167 -0
- app/code/local/Bazaarvoice/Connector/Helper/SftpConnection.php +305 -0
- app/code/local/Bazaarvoice/Connector/Model/ExportProductFeed.php +26 -26
- app/code/local/Bazaarvoice/Connector/Model/ExportPurchaseFeed.php +22 -22
- app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Product.php +9 -9
- app/code/local/Bazaarvoice/Connector/etc/config.xml +1 -1
- package.xml +4 -4
app/code/local/Bazaarvoice/Connector/Helper/Data.php
CHANGED
@@ -127,6 +127,20 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
127 |
public function reconstructRawId($externalId) {
|
128 |
return preg_replace_callback('/_bv(\d*)_/s', create_function('$match','return chr($match[1]);'), $externalId);
|
129 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
/**
|
132 |
* Connects to Bazaarvoice SFTP server and retrieves remote file to a local directory.
|
@@ -141,7 +155,7 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
141 |
*/
|
142 |
public function downloadFile($localFilePath, $localFileName, $remoteFile, $store = null)
|
143 |
{
|
144 |
-
Mage::log(' BV - starting download from Bazaarvoice server', Zend_Log::
|
145 |
|
146 |
// Create the directory if it doesn't already exist.
|
147 |
$ioObject = new Varien_Io_File();
|
@@ -151,45 +165,32 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
151 |
}
|
152 |
} catch (Exception $e) {
|
153 |
// Most likely not enough permissions.
|
154 |
-
Mage::log(" BV - failed attempting to create local directory '".$localFilePath."' to download feed. Error trace follows: " . $e->getTraceAsString(), Zend_Log::
|
155 |
return false;
|
156 |
}
|
157 |
|
158 |
// Make sure directory is writable
|
159 |
if (!$ioObject->isWriteable($localFilePath)) {
|
160 |
-
Mage::log(" BV - local directory '".$localFilePath."' is not writable.", Zend_Log::
|
161 |
-
return false;
|
162 |
-
}
|
163 |
-
|
164 |
-
// Establish a connection to the FTP host
|
165 |
-
Mage::log(' BV - beginning file download', Zend_Log::DEBUG, self::LOG_FILE);
|
166 |
-
$connection = ftp_connect($this->getSFTPHost());
|
167 |
-
$ftpUser = strtolower(Mage::getStoreConfig('bazaarvoice/general/client_name', $store));
|
168 |
-
$ftpPw = Mage::getStoreConfig('bazaarvoice/general/ftp_password', $store);
|
169 |
-
Mage::log(' BV - connecting with ftp user: ' . $ftpUser, Zend_Log::DEBUG, self::LOG_FILE);
|
170 |
-
//Mage::log(' BV - connecting with ftp pw: ' . $ftpPw, Zend_Log::DEBUG, self::LOG_FILE);
|
171 |
-
$login = ftp_login($connection, $ftpUser, $ftpPw);
|
172 |
-
ftp_pasv($connection, true);
|
173 |
-
if (!$connection || !$login) {
|
174 |
-
Mage::log(' BV - FTP connection attempt failed!', Zend_Log::DEBUG, self::LOG_FILE);
|
175 |
return false;
|
176 |
}
|
177 |
|
178 |
// Remove the local file if it already exists
|
179 |
if (file_exists($localFilePath . DS . $localFileName)) {
|
180 |
-
|
181 |
}
|
182 |
-
|
183 |
try {
|
|
|
184 |
// Download the file
|
185 |
-
|
186 |
} catch (Exception $ex) {
|
187 |
-
Mage::log(' BV - Exception downloading file: ' . $ex->getTraceAsString(), Zend_Log::
|
188 |
}
|
189 |
|
190 |
// Validate file was downloaded
|
191 |
if (!$ioObject->fileExists($localFilePath . DS . $localFileName, true)) {
|
192 |
-
Mage::log(" BV - unable to download file '" . $localFilePath . DS . $localFileName . "'", Zend_Log::
|
193 |
return false;
|
194 |
}
|
195 |
|
@@ -199,32 +200,17 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
199 |
|
200 |
public function uploadFile($localFileName, $remoteFile, $store)
|
201 |
{
|
202 |
-
Mage::log(' BV - starting upload to Bazaarvoice server', Zend_Log::
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
$connection = ftp_connect($this->getSFTPHost($store));
|
212 |
-
if (!$connection) {
|
213 |
-
Mage::log(' BV - FTP connection attempt failed!', Zend_Log::DEBUG, self::LOG_FILE);
|
214 |
-
return false;
|
215 |
-
}
|
216 |
-
$login = ftp_login($connection, $ftpUser, $ftpPw);
|
217 |
-
ftp_pasv($connection, true);
|
218 |
-
if (!$connection || !$login) {
|
219 |
-
Mage::log(' BV - FTP connection attempt failed!', Zend_Log::DEBUG, self::LOG_FILE);
|
220 |
-
return false;
|
221 |
}
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
ftp_close($connection);
|
226 |
-
|
227 |
-
return $upload;
|
228 |
}
|
229 |
|
230 |
public function getSmartSEOContent($bvProduct, $bvSubjectArr, $pageFormat)
|
@@ -373,10 +359,10 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
373 |
$sftpHost = $ftpHostOverride;
|
374 |
}
|
375 |
else if ($environment == 'staging') {
|
376 |
-
$sftpHost = '
|
377 |
}
|
378 |
else {
|
379 |
-
$sftpHost = '
|
380 |
}
|
381 |
return $sftpHost;
|
382 |
}
|
127 |
public function reconstructRawId($externalId) {
|
128 |
return preg_replace_callback('/_bv(\d*)_/s', create_function('$match','return chr($match[1]);'), $externalId);
|
129 |
}
|
130 |
+
|
131 |
+
/* general sftp connection call */
|
132 |
+
public function connectSFTP($store = null) {
|
133 |
+
// Get credentials for SFTP Connection
|
134 |
+
$sftpHost = $this->getSFTPHost();
|
135 |
+
$sftpUser = strtolower(Mage::getStoreConfig('bazaarvoice/general/client_name', $store));
|
136 |
+
$sftpPw = Mage::getStoreConfig('bazaarvoice/general/ftp_password', $store);
|
137 |
+
$sftp = Mage::helper('bazaarvoice/sftpConnection');
|
138 |
+
|
139 |
+
if (!$sftp->connect($sftpHost, 22, $sftpUser, $sftpPw)) {
|
140 |
+
Mage::throwException(' BV - SFTP connection attempt failed!', Zend_Log::ERR, self::LOG_FILE);
|
141 |
+
}
|
142 |
+
return $sftp;
|
143 |
+
}
|
144 |
|
145 |
/**
|
146 |
* Connects to Bazaarvoice SFTP server and retrieves remote file to a local directory.
|
155 |
*/
|
156 |
public function downloadFile($localFilePath, $localFileName, $remoteFile, $store = null)
|
157 |
{
|
158 |
+
Mage::log(' BV - starting download from Bazaarvoice server', Zend_Log::INFO, self::LOG_FILE);
|
159 |
|
160 |
// Create the directory if it doesn't already exist.
|
161 |
$ioObject = new Varien_Io_File();
|
165 |
}
|
166 |
} catch (Exception $e) {
|
167 |
// Most likely not enough permissions.
|
168 |
+
Mage::log(" BV - failed attempting to create local directory '".$localFilePath."' to download feed. Error trace follows: " . $e->getTraceAsString(), Zend_Log::ERR, self::LOG_FILE);
|
169 |
return false;
|
170 |
}
|
171 |
|
172 |
// Make sure directory is writable
|
173 |
if (!$ioObject->isWriteable($localFilePath)) {
|
174 |
+
Mage::log(" BV - local directory '".$localFilePath."' is not writable.", Zend_Log::ERR, self::LOG_FILE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
return false;
|
176 |
}
|
177 |
|
178 |
// Remove the local file if it already exists
|
179 |
if (file_exists($localFilePath . DS . $localFileName)) {
|
180 |
+
$ioObject->rm($localFilePath . DS . $localFileName);
|
181 |
}
|
182 |
+
|
183 |
try {
|
184 |
+
$sftp = $this->connectSFTP($store);
|
185 |
// Download the file
|
186 |
+
$sftp->getFile($remoteFile, $localFilePath . DS . $localFileName);
|
187 |
} catch (Exception $ex) {
|
188 |
+
Mage::log(' BV - Exception downloading file: ' . $ex->getTraceAsString(), Zend_Log::ERR, self::LOG_FILE);
|
189 |
}
|
190 |
|
191 |
// Validate file was downloaded
|
192 |
if (!$ioObject->fileExists($localFilePath . DS . $localFileName, true)) {
|
193 |
+
Mage::log(" BV - unable to download file '" . $localFilePath . DS . $localFileName . "'", Zend_Log::ERR, self::LOG_FILE);
|
194 |
return false;
|
195 |
}
|
196 |
|
200 |
|
201 |
public function uploadFile($localFileName, $remoteFile, $store)
|
202 |
{
|
203 |
+
Mage::log(' BV - starting upload to Bazaarvoice server', Zend_Log::INFO, self::LOG_FILE);
|
204 |
+
|
205 |
+
try {
|
206 |
+
$sftp = $this->connectSFTP($store);
|
207 |
+
// Download the file
|
208 |
+
$sftp->putAndDeleteFile($localFileName, $remoteFile);
|
209 |
+
} catch (Exception $ex) {
|
210 |
+
Mage::log(' BV - Exception uploading file: ' . $ex->getTraceAsString(), Zend_Log::ERR, self::LOG_FILE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
|
213 |
+
return true;
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
public function getSmartSEOContent($bvProduct, $bvSubjectArr, $pageFormat)
|
359 |
$sftpHost = $ftpHostOverride;
|
360 |
}
|
361 |
else if ($environment == 'staging') {
|
362 |
+
$sftpHost = 'sftp-stg.bazaarvoice.com';
|
363 |
}
|
364 |
else {
|
365 |
+
$sftpHost = 'sftp.bazaarvoice.com';
|
366 |
}
|
367 |
return $sftpHost;
|
368 |
}
|
app/code/local/Bazaarvoice/Connector/Helper/Sftp.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to commercial source code license
|
6 |
+
* of StoreFront Consulting, Inc.
|
7 |
+
*
|
8 |
+
* @copyright (C)Copyright 2015 StoreFront Consulting, Inc (http://www.StoreFrontConsulting.com/)
|
9 |
+
* @package Bazaarvoice_Connector
|
10 |
+
* @author Dennis Rogers <dennis@storefrontconsulting.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
require_once('phpseclib/Net/SFTP.php');
|
14 |
+
|
15 |
+
class Bazaarvoice_Connector_Helper_Sftp extends Net_SFTP
|
16 |
+
{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Downloads a file from the SFTP server.
|
20 |
+
*
|
21 |
+
* Returns a string containing the contents of $remoteFile if $localFile is left undefined or a boolean false if
|
22 |
+
* the operation was unsuccessful. If $localFile is defined, returns true or false depending on the success of the
|
23 |
+
* operation
|
24 |
+
*
|
25 |
+
* @param String $remoteFile
|
26 |
+
* @param optional String $localFile
|
27 |
+
* @return Mixed
|
28 |
+
* @access public
|
29 |
+
*/
|
30 |
+
function get($remoteFile, $localFile = false)
|
31 |
+
{
|
32 |
+
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
33 |
+
$this->sftp_errors[] = "No bitmap and Mask Login";
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
$remoteFile = $this->_realpath($remoteFile);
|
38 |
+
if ($remoteFile === false) {
|
39 |
+
$this->sftp_errors[] = "Remote file not found";
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
$packet = pack('Na*N2', strlen($remoteFile), $remoteFile, NET_SFTP_OPEN_READ, 0);
|
44 |
+
if (!$this->_send_sftp_packet(NET_SFTP_OPEN, $packet)) {
|
45 |
+
$this->sftp_errors[] = "Cannot send SFTP Open";
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
$response = $this->_get_sftp_packet();
|
50 |
+
switch ($this->packet_type) {
|
51 |
+
case NET_SFTP_HANDLE:
|
52 |
+
$handle = substr($response, 4);
|
53 |
+
break;
|
54 |
+
case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
55 |
+
extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8)));
|
56 |
+
$this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length);
|
57 |
+
return false;
|
58 |
+
default:
|
59 |
+
user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS', E_USER_NOTICE);
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$packet = pack('Na*', strlen($handle), $handle);
|
64 |
+
if (!$this->_send_sftp_packet(NET_SFTP_FSTAT, $packet)) {
|
65 |
+
$this->sftp_errors[] = "Cannot send FSTAT";
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
$response = $this->_get_sftp_packet();
|
70 |
+
switch ($this->packet_type) {
|
71 |
+
case NET_SFTP_ATTRS:
|
72 |
+
$attrs = $this->_parseAttributes($response);
|
73 |
+
break;
|
74 |
+
case NET_SFTP_STATUS:
|
75 |
+
extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8)));
|
76 |
+
$this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length);
|
77 |
+
return false;
|
78 |
+
default:
|
79 |
+
user_error('Expected SSH_FXP_ATTRS or SSH_FXP_STATUS', E_USER_NOTICE);
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
|
83 |
+
if ($localFile !== false) {
|
84 |
+
$filePointer = fopen($localFile, 'wb');
|
85 |
+
if (!$filePointer) {
|
86 |
+
$this->sftp_errors[] = "Cannot write local file";
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
} else {
|
90 |
+
$content = '';
|
91 |
+
}
|
92 |
+
|
93 |
+
$log = 0;
|
94 |
+
$read = 0;
|
95 |
+
while ($read < $attrs['size']) {
|
96 |
+
$packet = pack('Na*N3', strlen($handle), $handle, 0, $read, 1 << 20);
|
97 |
+
if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet)) {
|
98 |
+
$this->sftp_errors[] = "Cannot send read packet";
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
$response = $this->_get_sftp_packet();
|
103 |
+
switch ($this->packet_type) {
|
104 |
+
case NET_SFTP_DATA:
|
105 |
+
$temp = substr($response, 4);
|
106 |
+
$read+= strlen($temp);
|
107 |
+
if ($localFile === false) {
|
108 |
+
$content.= $temp;
|
109 |
+
} else {
|
110 |
+
fputs($filePointer, $temp);
|
111 |
+
}
|
112 |
+
break;
|
113 |
+
case NET_SFTP_STATUS:
|
114 |
+
extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8)));
|
115 |
+
$this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length);
|
116 |
+
break 2;
|
117 |
+
default:
|
118 |
+
user_error('Expected SSH_FXP_DATA or SSH_FXP_STATUS', E_USER_NOTICE);
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
if ($log++ % 50 == 0) {
|
122 |
+
$bytesIn = $this->formatBytes($read);
|
123 |
+
$bytesTotal = $this->formatBytes($attrs['size']);
|
124 |
+
Mage::log(" BVSFTP - Retrieved $bytesIn of $bytesTotal.", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) {
|
129 |
+
return false;
|
130 |
+
}
|
131 |
+
|
132 |
+
$response = $this->_get_sftp_packet();
|
133 |
+
if ($this->packet_type != NET_SFTP_STATUS) {
|
134 |
+
user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE);
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
extract(unpack('Nstatus', $this->_string_shift($response, 4)));
|
139 |
+
if ($status != NET_SFTP_STATUS_OK) {
|
140 |
+
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
141 |
+
$this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length);
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
if (isset($content)) {
|
146 |
+
return $content;
|
147 |
+
}
|
148 |
+
|
149 |
+
fclose($filePointer);
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
|
153 |
+
public function formatBytes($bytes, $precision = 2)
|
154 |
+
{
|
155 |
+
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
156 |
+
|
157 |
+
$bytes = max($bytes, 0);
|
158 |
+
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
159 |
+
$pow = min($pow, count($units) - 1);
|
160 |
+
|
161 |
+
// Uncomment one of the following alternatives
|
162 |
+
$bytes /= pow(1024, $pow);
|
163 |
+
|
164 |
+
return round($bytes, $precision) . ' ' . $units[$pow];
|
165 |
+
}
|
166 |
+
|
167 |
+
}
|
app/code/local/Bazaarvoice/Connector/Helper/SftpConnection.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to commercial source code license
|
6 |
+
* of StoreFront Consulting, Inc.
|
7 |
+
*
|
8 |
+
* @copyright (C)Copyright 2015 StoreFront Consulting, Inc (http://www.StoreFrontConsulting.com/)
|
9 |
+
* @package Bazaarvoice_Connector
|
10 |
+
* @author Dennis Rogers <dennis@storefrontconsulting.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Includes
|
14 |
+
require_once('phpseclib/Net/SFTP.php');
|
15 |
+
|
16 |
+
class Bazaarvoice_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Constants
|
20 |
+
*
|
21 |
+
* Hardcode timeout value
|
22 |
+
*/
|
23 |
+
const SFTP_TIMEOUT = 20;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Connection handle
|
27 |
+
*/
|
28 |
+
private $_oConnection = null;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Connect
|
32 |
+
* @return boolean
|
33 |
+
*/
|
34 |
+
public function connect($host, $port, $user, $pass)
|
35 |
+
{
|
36 |
+
try {
|
37 |
+
// Close
|
38 |
+
if (isset($this->_oConnection)) {
|
39 |
+
$this->close();
|
40 |
+
}
|
41 |
+
|
42 |
+
// Get config values
|
43 |
+
$server = $host;
|
44 |
+
$server = ($server ? trim($server) : '');
|
45 |
+
$port = $port;
|
46 |
+
$port = ($port ? trim($port) : '');
|
47 |
+
$username = $user;
|
48 |
+
$username = ($username ? trim($username) : '');
|
49 |
+
$password = $pass;
|
50 |
+
$password = ($password ? trim($password) : '');
|
51 |
+
|
52 |
+
// Log
|
53 |
+
Mage::log(' BVSFTP - Host: ' . $server, Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
54 |
+
Mage::log(' BVSFTP - Username: ' . $username, Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
55 |
+
// Mage::log('Password: ' . $password, Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
56 |
+
|
57 |
+
// Check credentials
|
58 |
+
if (!strlen($server)) {
|
59 |
+
Mage::throwException('Invalid host: ' . $server);
|
60 |
+
}
|
61 |
+
if (!strlen($port)) {
|
62 |
+
Mage::throwException('Invalid port: ' . $port);
|
63 |
+
}
|
64 |
+
if (!strlen($username)) {
|
65 |
+
Mage::throwException('Invalid user: ' . $username);
|
66 |
+
}
|
67 |
+
if (!strlen($password)) {
|
68 |
+
Mage::throwException('Invalid password: ' . $password);
|
69 |
+
}
|
70 |
+
|
71 |
+
// -- Open connection
|
72 |
+
$this->_oConnection = new Bazaarvoice_Connector_Helper_Sftp($server, $port, self::SFTP_TIMEOUT);
|
73 |
+
if (!$this->_oConnection->login($username, $password)) {
|
74 |
+
Mage::throwException(sprintf(__('Unable to open SFTP connection as %s@%s', $username, $server)));
|
75 |
+
}
|
76 |
+
|
77 |
+
return true;
|
78 |
+
}
|
79 |
+
catch (Exception $e) {
|
80 |
+
// Log
|
81 |
+
Mage::logException($e);
|
82 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
83 |
+
Mage::getSingleton('adminhtml/session')->addError('Could not connect to FTP server');
|
84 |
+
}
|
85 |
+
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Close
|
91 |
+
* @return boolean
|
92 |
+
*/
|
93 |
+
public function close()
|
94 |
+
{
|
95 |
+
try {
|
96 |
+
// Close connection
|
97 |
+
if (isset($this->_oConnection)) {
|
98 |
+
$res = $this->_oConnection->disconnect();
|
99 |
+
unset($this->_oConnection);
|
100 |
+
|
101 |
+
return $res;
|
102 |
+
}
|
103 |
+
else {
|
104 |
+
Mage::throwException('Connection not open!');
|
105 |
+
}
|
106 |
+
}
|
107 |
+
catch (Exception $e) {
|
108 |
+
// Log
|
109 |
+
Mage::logException($e);
|
110 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
111 |
+
}
|
112 |
+
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Is connected
|
118 |
+
* @return boolean
|
119 |
+
*/
|
120 |
+
public function isConnected()
|
121 |
+
{
|
122 |
+
return (isset($this->_oConnection));
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Change directory
|
127 |
+
* @param string directory
|
128 |
+
* @return boolean
|
129 |
+
*/
|
130 |
+
public function changeDir($dir)
|
131 |
+
{
|
132 |
+
try {
|
133 |
+
// Close connection
|
134 |
+
if (!$this->isConnected()) {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
// Get filename
|
139 |
+
return $this->_oConnection->chdir($dir);
|
140 |
+
}
|
141 |
+
catch (Exception $e) {
|
142 |
+
// Log
|
143 |
+
Mage::logException($e);
|
144 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
145 |
+
}
|
146 |
+
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Make directory
|
152 |
+
* @param string directory
|
153 |
+
* @return boolean
|
154 |
+
*/
|
155 |
+
public function makeDir($dir)
|
156 |
+
{
|
157 |
+
try {
|
158 |
+
// Close connection
|
159 |
+
if (!$this->isConnected()) {
|
160 |
+
return false;
|
161 |
+
}
|
162 |
+
|
163 |
+
// Get filename
|
164 |
+
return $this->_oConnection->mkdir($dir);
|
165 |
+
}
|
166 |
+
catch (Exception $e) {
|
167 |
+
// Log
|
168 |
+
Mage::logException($e);
|
169 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
170 |
+
}
|
171 |
+
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* List files
|
177 |
+
* @param string directory
|
178 |
+
* @return array
|
179 |
+
*/
|
180 |
+
public function listFiles($dir = '.')
|
181 |
+
{
|
182 |
+
try {
|
183 |
+
// Close connection
|
184 |
+
if (!$this->isConnected()) {
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
// Get filename
|
189 |
+
return $this->_oConnection->nlist($dir);
|
190 |
+
}
|
191 |
+
catch (Exception $e) {
|
192 |
+
// Log
|
193 |
+
Mage::logException($e);
|
194 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
195 |
+
}
|
196 |
+
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Transfer file
|
202 |
+
* @param string Local file path
|
203 |
+
* @return boolean
|
204 |
+
*/
|
205 |
+
public function getFile($remoteFilePath, $localFilePath)
|
206 |
+
{
|
207 |
+
Mage::log(" BVSFTP - Get remote file $remoteFilePath => $localFilePath", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
208 |
+
try {
|
209 |
+
// Close connection
|
210 |
+
if (!$this->isConnected()) {
|
211 |
+
return false;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Get filename
|
215 |
+
$filename = basename($remoteFilePath);
|
216 |
+
|
217 |
+
if(dirname($remoteFilePath))
|
218 |
+
$this->changeDir(dirname($remoteFilePath));
|
219 |
+
|
220 |
+
// Transfer
|
221 |
+
$success = $this->_oConnection->get($filename, $localFilePath);
|
222 |
+
|
223 |
+
// Check success and log errors
|
224 |
+
if (!$success) {
|
225 |
+
Mage::log(' BVSFTP - Error: ' .
|
226 |
+
$this->_oConnection->getLastSFTPError(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
227 |
+
}
|
228 |
+
|
229 |
+
// Return success
|
230 |
+
return $success;
|
231 |
+
}
|
232 |
+
catch (Exception $e) {
|
233 |
+
// Log
|
234 |
+
Mage::logException($e);
|
235 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
236 |
+
}
|
237 |
+
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Transfer file
|
243 |
+
* @param string Local file path
|
244 |
+
* @return boolean
|
245 |
+
*/
|
246 |
+
public function putFile($localFilePath, $remoteFile = '')
|
247 |
+
{
|
248 |
+
if(!$remoteFile)
|
249 |
+
$remoteFile = basename($localFilePath);
|
250 |
+
|
251 |
+
Mage::log(" BVSFTP - Put local file $localFilePath as $remoteFile", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
252 |
+
try {
|
253 |
+
// Close connection
|
254 |
+
if (!$this->isConnected()) {
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
|
258 |
+
if(dirname($remoteFile))
|
259 |
+
$this->changeDir(dirname($remoteFile));
|
260 |
+
|
261 |
+
// Transfer
|
262 |
+
$success = $this->_oConnection->put($remoteFile, $localFilePath, NET_SFTP_LOCAL_FILE);
|
263 |
+
|
264 |
+
// Check success and log errors
|
265 |
+
if (!$success) {
|
266 |
+
Mage::log(' BVSFTP - '.$this->_oConnection->getLastSFTPError(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
267 |
+
}
|
268 |
+
|
269 |
+
// Return success
|
270 |
+
return $success;
|
271 |
+
}
|
272 |
+
catch (Exception $e) {
|
273 |
+
// Log
|
274 |
+
Mage::logException($e);
|
275 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
276 |
+
}
|
277 |
+
|
278 |
+
return false;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Transfer file and delete when successful as one atomic operation
|
283 |
+
* @param string Local file path
|
284 |
+
* @return boolean
|
285 |
+
*/
|
286 |
+
public function putAndDeleteFile($localFilePath, $remoteFile = '')
|
287 |
+
{
|
288 |
+
try {
|
289 |
+
$success = $this->putFile($localFilePath, $remoteFile);
|
290 |
+
if ($success) {
|
291 |
+
$io = new Varien_Io_File();
|
292 |
+
$io->rm($localFilePath);
|
293 |
+
}
|
294 |
+
|
295 |
+
return $success;
|
296 |
+
}
|
297 |
+
catch (Exception $e) {
|
298 |
+
// Log
|
299 |
+
Mage::logException($e);
|
300 |
+
Mage::log(' BVSFTP - '.$e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
301 |
+
}
|
302 |
+
|
303 |
+
return false;
|
304 |
+
}
|
305 |
+
}
|
app/code/local/Bazaarvoice/Connector/Model/ExportProductFeed.php
CHANGED
@@ -61,7 +61,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
61 |
public function exportDailyProductFeed()
|
62 |
{
|
63 |
// Log
|
64 |
-
Mage::log('Start
|
65 |
// Check global setting to see what at which scope / level we should generate feeds
|
66 |
$feedGenScope = Mage::getStoreConfig('bazaarvoice/feeds/generation_scope');
|
67 |
switch ($feedGenScope) {
|
@@ -76,7 +76,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
76 |
break;
|
77 |
}
|
78 |
// Log
|
79 |
-
Mage::log('End
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -85,7 +85,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
85 |
private function exportDailyProductFeedByWebsite()
|
86 |
{
|
87 |
// Log
|
88 |
-
Mage::log('Exporting product feed file for each website...', Zend_Log::
|
89 |
// Iterate through all websites in this instance
|
90 |
// (Not the 'admin' store view, which represents admin panel)
|
91 |
$websites = Mage::app()->getWebsites(false);
|
@@ -109,8 +109,8 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
109 |
}
|
110 |
}
|
111 |
catch (Exception $e) {
|
112 |
-
Mage::log('
|
113 |
-
Mage::log('
|
114 |
Mage::logException($e);
|
115 |
// Continue processing other websites
|
116 |
}
|
@@ -123,7 +123,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
123 |
public function exportDailyProductFeedByGroup()
|
124 |
{
|
125 |
// Log
|
126 |
-
Mage::log('Exporting product feed file for each store group...', Zend_Log::
|
127 |
// Iterate through all stores / groups in this instance
|
128 |
// (Not the 'admin' store view, which represents admin panel)
|
129 |
$groups = Mage::app()->getGroups(false);
|
@@ -146,8 +146,8 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
146 |
}
|
147 |
}
|
148 |
catch (Exception $e) {
|
149 |
-
Mage::log('
|
150 |
-
Mage::log('
|
151 |
Mage::logException($e);
|
152 |
// Continue processing other store groups
|
153 |
}
|
@@ -160,7 +160,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
160 |
private function exportDailyProductFeedByStore()
|
161 |
{
|
162 |
// Log
|
163 |
-
Mage::log('Exporting product feed file for each store / store view...', Zend_Log::
|
164 |
// Iterate through all stores / groups in this instance
|
165 |
// (Not the 'admin' store view, which represents admin panel)
|
166 |
$stores = Mage::app()->getStores(false);
|
@@ -178,8 +178,8 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
178 |
}
|
179 |
}
|
180 |
catch (Exception $e) {
|
181 |
-
Mage::log('
|
182 |
-
Mage::log('
|
183 |
Mage::logException($e);
|
184 |
// Continue processing other store groups
|
185 |
}
|
@@ -213,14 +213,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
213 |
// Create varien io object and write local feed file
|
214 |
/* @var $ioObject Varien_Io_File */
|
215 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
216 |
-
Mage::log(' BV -
|
217 |
$brandModel->processBrandsForWebsite($ioObject, $website);
|
218 |
-
Mage::log(' BV -
|
219 |
$categoryModel->processCategoriesForWebsite($ioObject, $website);
|
220 |
-
Mage::log(' BV -
|
221 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
222 |
$productModel->processProductsForWebsite($ioObject, $website);
|
223 |
-
Mage::log(' BV -
|
224 |
$this->closeAndFinishWritingFile($ioObject);
|
225 |
|
226 |
// Upload feed
|
@@ -255,14 +255,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
255 |
// Create varien io object and write local feed file
|
256 |
/* @var $ioObject Varien_Io_File */
|
257 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
258 |
-
Mage::log(' BV -
|
259 |
$brandModel->processBrandsForGroup($ioObject, $group);
|
260 |
-
Mage::log(' BV -
|
261 |
$categoryModel->processCategoriesForGroup($ioObject, $group);
|
262 |
-
Mage::log(' BV -
|
263 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
264 |
$productModel->processProductsForGroup($ioObject, $group);
|
265 |
-
Mage::log(' BV -
|
266 |
$this->closeAndFinishWritingFile($ioObject);
|
267 |
|
268 |
// Upload feed
|
@@ -296,14 +296,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
296 |
// Create varien io object and write local feed file
|
297 |
/* @var $ioObject Varien_Io_File */
|
298 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
299 |
-
Mage::log(' BV -
|
300 |
$brandModel->processBrandsForStore($ioObject, $store);
|
301 |
-
Mage::log(' BV -
|
302 |
$categoryModel->processCategoriesForStore($ioObject, $store);
|
303 |
-
Mage::log(' BV -
|
304 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
305 |
$productModel->processProductsForStore($ioObject, $store);
|
306 |
-
Mage::log(' BV -
|
307 |
$this->closeAndFinishWritingFile($ioObject);
|
308 |
|
309 |
// Upload feed
|
@@ -328,10 +328,10 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
328 |
$upload = $bvHelper->uploadFile($sourceFile, $destinationFile, $store);
|
329 |
|
330 |
if (!$upload) {
|
331 |
-
Mage::log('
|
332 |
}
|
333 |
else {
|
334 |
-
Mage::log('
|
335 |
$ioObject = new Varien_Io_File();
|
336 |
$ioObject->rm($productFeedFileName);
|
337 |
}
|
@@ -358,7 +358,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
358 |
}
|
359 |
|
360 |
if (!$ioObject->streamOpen(basename($productFeedFileName))) {
|
361 |
-
Mage::throwException('Failed to open local feed file for writing: ' . $productFeedFileName, Zend_Log::
|
362 |
}
|
363 |
|
364 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
|
61 |
public function exportDailyProductFeed()
|
62 |
{
|
63 |
// Log
|
64 |
+
Mage::log(' BV - Start product feed generation', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
65 |
// Check global setting to see what at which scope / level we should generate feeds
|
66 |
$feedGenScope = Mage::getStoreConfig('bazaarvoice/feeds/generation_scope');
|
67 |
switch ($feedGenScope) {
|
76 |
break;
|
77 |
}
|
78 |
// Log
|
79 |
+
Mage::log(' BV - End product feed generation', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
80 |
}
|
81 |
|
82 |
/**
|
85 |
private function exportDailyProductFeedByWebsite()
|
86 |
{
|
87 |
// Log
|
88 |
+
Mage::log(' BV - Exporting product feed file for each website...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
89 |
// Iterate through all websites in this instance
|
90 |
// (Not the 'admin' store view, which represents admin panel)
|
91 |
$websites = Mage::app()->getWebsites(false);
|
109 |
}
|
110 |
}
|
111 |
catch (Exception $e) {
|
112 |
+
Mage::log(' BV - Failed to export daily product feed for website: ' . $website->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
113 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
114 |
Mage::logException($e);
|
115 |
// Continue processing other websites
|
116 |
}
|
123 |
public function exportDailyProductFeedByGroup()
|
124 |
{
|
125 |
// Log
|
126 |
+
Mage::log(' BV - Exporting product feed file for each store group...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
127 |
// Iterate through all stores / groups in this instance
|
128 |
// (Not the 'admin' store view, which represents admin panel)
|
129 |
$groups = Mage::app()->getGroups(false);
|
146 |
}
|
147 |
}
|
148 |
catch (Exception $e) {
|
149 |
+
Mage::log(' BV - Failed to export daily product feed for store group: ' . $group->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
150 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
151 |
Mage::logException($e);
|
152 |
// Continue processing other store groups
|
153 |
}
|
160 |
private function exportDailyProductFeedByStore()
|
161 |
{
|
162 |
// Log
|
163 |
+
Mage::log(' BV - Exporting product feed file for each store / store view...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
164 |
// Iterate through all stores / groups in this instance
|
165 |
// (Not the 'admin' store view, which represents admin panel)
|
166 |
$stores = Mage::app()->getStores(false);
|
178 |
}
|
179 |
}
|
180 |
catch (Exception $e) {
|
181 |
+
Mage::log(' BV - Failed to export daily product feed for store: ' . $store->getCode(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
182 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
183 |
Mage::logException($e);
|
184 |
// Continue processing other store groups
|
185 |
}
|
213 |
// Create varien io object and write local feed file
|
214 |
/* @var $ioObject Varien_Io_File */
|
215 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
216 |
+
Mage::log(' BV - Processing all BRANDS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
217 |
$brandModel->processBrandsForWebsite($ioObject, $website);
|
218 |
+
Mage::log(' BV - Completed BRANDS, Beginning CATEGORIES', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
219 |
$categoryModel->processCategoriesForWebsite($ioObject, $website);
|
220 |
+
Mage::log(' BV - Completed CATEGORIES, Beginning PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
221 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
222 |
$productModel->processProductsForWebsite($ioObject, $website);
|
223 |
+
Mage::log(' BV - Completed processing all PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
224 |
$this->closeAndFinishWritingFile($ioObject);
|
225 |
|
226 |
// Upload feed
|
255 |
// Create varien io object and write local feed file
|
256 |
/* @var $ioObject Varien_Io_File */
|
257 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
258 |
+
Mage::log(' BV - Processing all BRANDS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
259 |
$brandModel->processBrandsForGroup($ioObject, $group);
|
260 |
+
Mage::log(' BV - Completed BRANDS, Beginning CATEGORIES', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
261 |
$categoryModel->processCategoriesForGroup($ioObject, $group);
|
262 |
+
Mage::log(' BV - Completed CATEGORIES, Beginning PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
263 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
264 |
$productModel->processProductsForGroup($ioObject, $group);
|
265 |
+
Mage::log(' BV - Completed processing all PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
266 |
$this->closeAndFinishWritingFile($ioObject);
|
267 |
|
268 |
// Upload feed
|
296 |
// Create varien io object and write local feed file
|
297 |
/* @var $ioObject Varien_Io_File */
|
298 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
299 |
+
Mage::log(' BV - Processing all BRANDS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
300 |
$brandModel->processBrandsForStore($ioObject, $store);
|
301 |
+
Mage::log(' BV - Completed BRANDS, Beginning CATEGORIES', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
302 |
$categoryModel->processCategoriesForStore($ioObject, $store);
|
303 |
+
Mage::log(' BV - Completed CATEGORIES, Beginning PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
304 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
305 |
$productModel->processProductsForStore($ioObject, $store);
|
306 |
+
Mage::log(' BV - Completed processing all PRODUCTS', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
307 |
$this->closeAndFinishWritingFile($ioObject);
|
308 |
|
309 |
// Upload feed
|
328 |
$upload = $bvHelper->uploadFile($sourceFile, $destinationFile, $store);
|
329 |
|
330 |
if (!$upload) {
|
331 |
+
Mage::log(' BVSFTP - upload failed! [filename = ' . $productFeedFileName . ']', Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
332 |
}
|
333 |
else {
|
334 |
+
Mage::log(' BVSFTP - upload success! [filename = ' . $productFeedFileName . ']', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
335 |
$ioObject = new Varien_Io_File();
|
336 |
$ioObject->rm($productFeedFileName);
|
337 |
}
|
358 |
}
|
359 |
|
360 |
if (!$ioObject->streamOpen(basename($productFeedFileName))) {
|
361 |
+
Mage::throwException('Failed to open local feed file for writing: ' . $productFeedFileName, Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
362 |
}
|
363 |
|
364 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
|
app/code/local/Bazaarvoice/Connector/Model/ExportPurchaseFeed.php
CHANGED
@@ -17,7 +17,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
17 |
public function exportPurchaseFeed()
|
18 |
{
|
19 |
// Log
|
20 |
-
Mage::log('Start
|
21 |
// Check global setting to see what at which scope / level we should generate feeds
|
22 |
$feedGenScope = Mage::getStoreConfig('bazaarvoice/feeds/generation_scope');
|
23 |
switch ($feedGenScope) {
|
@@ -32,7 +32,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
32 |
break;
|
33 |
}
|
34 |
// Log
|
35 |
-
Mage::log('End
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -41,7 +41,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
41 |
public function exportPurchaseFeedByWebsite()
|
42 |
{
|
43 |
// Log
|
44 |
-
Mage::log('Exporting purchase feed file for each website...', Zend_Log::
|
45 |
// Iterate through all websites in this instance
|
46 |
// (Not the 'admin' website / store / view, which represents admin panel)
|
47 |
$websites = Mage::app()->getWebsites(false);
|
@@ -64,8 +64,8 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
64 |
}
|
65 |
}
|
66 |
catch (Exception $e) {
|
67 |
-
Mage::log('
|
68 |
-
Mage::log('
|
69 |
Mage::logException($e);
|
70 |
// Continue processing other websites
|
71 |
}
|
@@ -78,7 +78,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
78 |
public function exportPurchaseFeedByGroup()
|
79 |
{
|
80 |
// Log
|
81 |
-
Mage::log('Exporting purchase feed file for each store group...', Zend_Log::
|
82 |
// Iterate through all stores / groups in this instance
|
83 |
// (Not the 'admin' store view, which represents admin panel)
|
84 |
$groups = Mage::app()->getGroups(false);
|
@@ -115,7 +115,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
115 |
public function exportPurchaseFeedByStore()
|
116 |
{
|
117 |
// Log
|
118 |
-
Mage::log('Exporting purchase feed file for each store...', Zend_Log::
|
119 |
// Iterate through all stores in this instance
|
120 |
// (Not the 'admin' store view, which represents admin panel)
|
121 |
$stores = Mage::app()->getStores(false);
|
@@ -168,10 +168,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
168 |
|
169 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
170 |
|
171 |
-
Mage::log(' BV - processing all orders', Zend_Log::
|
172 |
$ordersExported = $this->processOrdersForWebsite($ioObject, $website);
|
173 |
$this->flagOrders($ordersExported, 1);
|
174 |
-
Mage::log(' BV - completed processing all orders', Zend_Log::
|
175 |
|
176 |
$ioObject->streamWrite("</Feed>\n");
|
177 |
$ioObject->streamClose();
|
@@ -192,10 +192,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
192 |
}
|
193 |
|
194 |
if (!$upload) {
|
195 |
-
Mage::log('
|
196 |
}
|
197 |
else {
|
198 |
-
Mage::log('
|
199 |
$ioObject->rm($purchaseFeedFileName);
|
200 |
}
|
201 |
|
@@ -230,10 +230,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
230 |
|
231 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
232 |
|
233 |
-
Mage::log(' BV - processing all orders', Zend_Log::
|
234 |
$ordersExported = $this->processOrdersForGroup($ioObject, $group);
|
235 |
$this->flagOrders($ordersExported, 1);
|
236 |
-
Mage::log(' BV - completed processing all orders', Zend_Log::
|
237 |
|
238 |
$ioObject->streamWrite("</Feed>\n");
|
239 |
$ioObject->streamClose();
|
@@ -254,10 +254,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
254 |
}
|
255 |
|
256 |
if (!$upload) {
|
257 |
-
Mage::log('
|
258 |
}
|
259 |
else {
|
260 |
-
Mage::log('
|
261 |
$ioObject->rm($purchaseFeedFileName);
|
262 |
}
|
263 |
|
@@ -291,10 +291,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
291 |
|
292 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
293 |
|
294 |
-
Mage::log(" BV - processing all orders", Zend_Log::
|
295 |
$ordersExported = $this->processOrdersForStore($ioObject, $store);
|
296 |
$this->flagOrders($ordersExported, 1);
|
297 |
-
Mage::log(" BV - completed processing all orders", Zend_Log::
|
298 |
|
299 |
$ioObject->streamWrite("</Feed>\n");
|
300 |
$ioObject->streamClose();
|
@@ -315,10 +315,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
315 |
}
|
316 |
|
317 |
if (!$upload) {
|
318 |
-
Mage::log('
|
319 |
}
|
320 |
else {
|
321 |
-
Mage::log('
|
322 |
$ioObject->rm($purchaseFeedFileName);
|
323 |
}
|
324 |
|
@@ -464,7 +464,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
464 |
. ", NumDaysLookback: " . self::NUM_DAYS_LOOKBACK
|
465 |
. ", NumDaysLookbackStartDate: " . $this->getNumDaysLookbackStartDate()
|
466 |
. ", DelayDaysSinceEvent: " . $delayDaysSinceEvent
|
467 |
-
. ', DelayDaysThreshold: ' . date('c', $this->getDelayDaysThresholdTimestamp($delayDaysSinceEvent)) . '}', Zend_Log::
|
468 |
|
469 |
$ordersToExport = array();
|
470 |
foreach ($orders->getAllIds() as $orderId) {
|
@@ -474,7 +474,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
474 |
}
|
475 |
$ordersToExport[] = $orderId;
|
476 |
}
|
477 |
-
Mage::log(" BV - Found " . count($ordersToExport) . " orders to export.", Zend_Log::
|
478 |
|
479 |
$exportedOrders = array(); // Keep track of how many orders we include in the feed
|
480 |
|
@@ -554,7 +554,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
554 |
}
|
555 |
|
556 |
}
|
557 |
-
Mage::log(" BV - Exported " . count($exportedOrders) . " orders.", Zend_Log::
|
558 |
|
559 |
return $exportedOrders;
|
560 |
}
|
17 |
public function exportPurchaseFeed()
|
18 |
{
|
19 |
// Log
|
20 |
+
Mage::log(' BV - Start purchase feed generation', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
21 |
// Check global setting to see what at which scope / level we should generate feeds
|
22 |
$feedGenScope = Mage::getStoreConfig('bazaarvoice/feeds/generation_scope');
|
23 |
switch ($feedGenScope) {
|
32 |
break;
|
33 |
}
|
34 |
// Log
|
35 |
+
Mage::log(' BV - End purchase feed generation', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
36 |
}
|
37 |
|
38 |
/**
|
41 |
public function exportPurchaseFeedByWebsite()
|
42 |
{
|
43 |
// Log
|
44 |
+
Mage::log(' BV - Exporting purchase feed file for each website...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
45 |
// Iterate through all websites in this instance
|
46 |
// (Not the 'admin' website / store / view, which represents admin panel)
|
47 |
$websites = Mage::app()->getWebsites(false);
|
64 |
}
|
65 |
}
|
66 |
catch (Exception $e) {
|
67 |
+
Mage::log(' BV - Failed to export daily purchase feed for website: ' . $website->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
68 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
69 |
Mage::logException($e);
|
70 |
// Continue processing other websites
|
71 |
}
|
78 |
public function exportPurchaseFeedByGroup()
|
79 |
{
|
80 |
// Log
|
81 |
+
Mage::log(' BV - Exporting purchase feed file for each store group...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
82 |
// Iterate through all stores / groups in this instance
|
83 |
// (Not the 'admin' store view, which represents admin panel)
|
84 |
$groups = Mage::app()->getGroups(false);
|
115 |
public function exportPurchaseFeedByStore()
|
116 |
{
|
117 |
// Log
|
118 |
+
Mage::log(' BV - Exporting purchase feed file for each store...', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
119 |
// Iterate through all stores in this instance
|
120 |
// (Not the 'admin' store view, which represents admin panel)
|
121 |
$stores = Mage::app()->getStores(false);
|
168 |
|
169 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
170 |
|
171 |
+
Mage::log(' BV - processing all orders', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
172 |
$ordersExported = $this->processOrdersForWebsite($ioObject, $website);
|
173 |
$this->flagOrders($ordersExported, 1);
|
174 |
+
Mage::log(' BV - completed processing all orders', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
175 |
|
176 |
$ioObject->streamWrite("</Feed>\n");
|
177 |
$ioObject->streamClose();
|
192 |
}
|
193 |
|
194 |
if (!$upload) {
|
195 |
+
Mage::log(' BVSFTP - upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
196 |
}
|
197 |
else {
|
198 |
+
Mage::log(' BVSFTP - upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
199 |
$ioObject->rm($purchaseFeedFileName);
|
200 |
}
|
201 |
|
230 |
|
231 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
232 |
|
233 |
+
Mage::log(' BV - processing all orders', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
234 |
$ordersExported = $this->processOrdersForGroup($ioObject, $group);
|
235 |
$this->flagOrders($ordersExported, 1);
|
236 |
+
Mage::log(' BV - completed processing all orders', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
237 |
|
238 |
$ioObject->streamWrite("</Feed>\n");
|
239 |
$ioObject->streamClose();
|
254 |
}
|
255 |
|
256 |
if (!$upload) {
|
257 |
+
Mage::log(' BVSFTP - upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
258 |
}
|
259 |
else {
|
260 |
+
Mage::log(' BVSFTP - upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
261 |
$ioObject->rm($purchaseFeedFileName);
|
262 |
}
|
263 |
|
291 |
|
292 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
293 |
|
294 |
+
Mage::log(" BV - processing all orders", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
295 |
$ordersExported = $this->processOrdersForStore($ioObject, $store);
|
296 |
$this->flagOrders($ordersExported, 1);
|
297 |
+
Mage::log(" BV - completed processing all orders", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
298 |
|
299 |
$ioObject->streamWrite("</Feed>\n");
|
300 |
$ioObject->streamClose();
|
315 |
}
|
316 |
|
317 |
if (!$upload) {
|
318 |
+
Mage::log(' BVSFTP - upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
319 |
}
|
320 |
else {
|
321 |
+
Mage::log(' BVSFTP - upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
322 |
$ioObject->rm($purchaseFeedFileName);
|
323 |
}
|
324 |
|
464 |
. ", NumDaysLookback: " . self::NUM_DAYS_LOOKBACK
|
465 |
. ", NumDaysLookbackStartDate: " . $this->getNumDaysLookbackStartDate()
|
466 |
. ", DelayDaysSinceEvent: " . $delayDaysSinceEvent
|
467 |
+
. ', DelayDaysThreshold: ' . date('c', $this->getDelayDaysThresholdTimestamp($delayDaysSinceEvent)) . '}', Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
468 |
|
469 |
$ordersToExport = array();
|
470 |
foreach ($orders->getAllIds() as $orderId) {
|
474 |
}
|
475 |
$ordersToExport[] = $orderId;
|
476 |
}
|
477 |
+
Mage::log(" BV - Found " . count($ordersToExport) . " orders to export.", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
478 |
|
479 |
$exportedOrders = array(); // Keep track of how many orders we include in the feed
|
480 |
|
554 |
}
|
555 |
|
556 |
}
|
557 |
+
Mage::log(" BV - Exported " . count($exportedOrders) . " orders.", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
558 |
|
559 |
return $exportedOrders;
|
560 |
}
|
app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Product.php
CHANGED
@@ -269,23 +269,23 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
269 |
// skip product if parent is disabled
|
270 |
if (is_object($parentProduct)){
|
271 |
if($parentProduct->getVisiblity() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE || $parentProduct->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED || !in_array($website, $parentProduct->getWebsiteIds())) {
|
272 |
-
Mage::log("
|
273 |
return true;
|
274 |
}
|
275 |
|
276 |
if (!is_null($parentProduct->getCategoryIds())){
|
277 |
$parentCategories = $parentProduct->getCategoryIds();
|
278 |
-
Mage::log("
|
279 |
}
|
280 |
}
|
281 |
} else {
|
282 |
-
Mage::log("
|
283 |
return true;
|
284 |
}
|
285 |
} else {
|
286 |
// normal behavior
|
287 |
$parentCategories = $productDefault->getCategoryIds();
|
288 |
-
Mage::log("
|
289 |
}
|
290 |
|
291 |
$ioObject->streamWrite("<Product>\n" .
|
@@ -309,7 +309,7 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
309 |
"</CategoryExternalId>\n");
|
310 |
break;
|
311 |
} else {
|
312 |
-
Mage::log("
|
313 |
}
|
314 |
}
|
315 |
}
|
@@ -401,9 +401,9 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
401 |
}
|
402 |
}
|
403 |
catch (Exception $e) {
|
404 |
-
Mage::log('Failed to get families for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
405 |
Mage::log($e->getMessage()."\n".$e->getTraceAsString(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
406 |
-
Mage::log('Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
407 |
}
|
408 |
return $families;
|
409 |
}
|
@@ -449,8 +449,8 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
449 |
return $imageUrl;
|
450 |
}
|
451 |
catch (Exception $e) {
|
452 |
-
Mage::log('Failed to get image URL for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
453 |
-
Mage::log('Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
454 |
|
455 |
return '';
|
456 |
}
|
269 |
// skip product if parent is disabled
|
270 |
if (is_object($parentProduct)){
|
271 |
if($parentProduct->getVisiblity() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE || $parentProduct->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED || !in_array($website, $parentProduct->getWebsiteIds())) {
|
272 |
+
Mage::log(" BV - Skipping ".$productDefault->getSku()." because it is not visible and its parent product " . $parentProduct->getSku() . " is disabled.", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
273 |
return true;
|
274 |
}
|
275 |
|
276 |
if (!is_null($parentProduct->getCategoryIds())){
|
277 |
$parentCategories = $parentProduct->getCategoryIds();
|
278 |
+
Mage::log(" BV - Product ".$productDefault->getSku()." using parent categories from ".$parentProduct->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
279 |
}
|
280 |
}
|
281 |
} else {
|
282 |
+
Mage::log(" BV - Skipping ".$productDefault->getSku()." because it is not visible and has no parent product.", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
283 |
return true;
|
284 |
}
|
285 |
} else {
|
286 |
// normal behavior
|
287 |
$parentCategories = $productDefault->getCategoryIds();
|
288 |
+
Mage::log(" BV - Product ".$productDefault->getSku()." using its own categories", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
289 |
}
|
290 |
|
291 |
$ioObject->streamWrite("<Product>\n" .
|
309 |
"</CategoryExternalId>\n");
|
310 |
break;
|
311 |
} else {
|
312 |
+
Mage::log(" BV - Category $categoryExternalId not found", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
313 |
}
|
314 |
}
|
315 |
}
|
401 |
}
|
402 |
}
|
403 |
catch (Exception $e) {
|
404 |
+
Mage::log(' BV - Failed to get families for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
405 |
Mage::log($e->getMessage()."\n".$e->getTraceAsString(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
406 |
+
Mage::log(' BV - Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
407 |
}
|
408 |
return $families;
|
409 |
}
|
449 |
return $imageUrl;
|
450 |
}
|
451 |
catch (Exception $e) {
|
452 |
+
Mage::log(' BV - Failed to get image URL for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
453 |
+
Mage::log(' BV - Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
454 |
|
455 |
return '';
|
456 |
}
|
app/code/local/Bazaarvoice/Connector/etc/config.xml
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<config>
|
9 |
<modules>
|
10 |
<Bazaarvoice_Connector>
|
11 |
-
<version>6.
|
12 |
<depends>
|
13 |
<!-- no dependencies -->
|
14 |
</depends>
|
8 |
<config>
|
9 |
<modules>
|
10 |
<Bazaarvoice_Connector>
|
11 |
+
<version>6.2.0</version>
|
12 |
<depends>
|
13 |
<!-- no dependencies -->
|
14 |
</depends>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bazaarvoice_Connector</name>
|
4 |
-
<version>6.
|
5 |
<stability>stable</stability>
|
6 |
<license>Bazaarvoice, Inc.</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>See www.bazaarvoice.com for further details on our offerings</description>
|
11 |
<notes>Plugin corresponds to version 6.0.2 of the Bazaarvoice platform</notes>
|
12 |
<authors><author><name>BV DTS</name><user>bvdts</user><email>dts@bazaarvoice.com</email></author></authors>
|
13 |
-
<date>2015-12-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Bazaarvoice"><dir name="Connector"><dir name="Block"><file name="Bazaarvoice.php" hash="473e92e58fd86c823fb55765ed473414"/><file name="Questions.php" hash="04a7302c66539d17fac4f75b13b2ff2a"/><file name="Ratings.php" hash="6822db584f2ee777beb8d39c662e8465"/><file name="Reviews.php" hash="3eb82792967e70e5fed975521c5b5ceb"/><dir name="Roi"><file name="Beacon.php" hash="388253b41a5e251ee4c435b42304c6ca"/></dir><file name="Submissioncontainer.php" hash="23d04ee9ece011d107bb8b914653a24d"/></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bazaarvoice_Connector</name>
|
4 |
+
<version>6.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Bazaarvoice, Inc.</license>
|
7 |
<channel>community</channel>
|
10 |
<description>See www.bazaarvoice.com for further details on our offerings</description>
|
11 |
<notes>Plugin corresponds to version 6.0.2 of the Bazaarvoice platform</notes>
|
12 |
<authors><author><name>BV DTS</name><user>bvdts</user><email>dts@bazaarvoice.com</email></author></authors>
|
13 |
+
<date>2015-12-18</date>
|
14 |
+
<time>18:54:01</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Bazaarvoice"><dir name="Connector"><dir name="Block"><file name="Bazaarvoice.php" hash="473e92e58fd86c823fb55765ed473414"/><file name="Questions.php" hash="04a7302c66539d17fac4f75b13b2ff2a"/><file name="Ratings.php" hash="6822db584f2ee777beb8d39c662e8465"/><file name="Reviews.php" hash="3eb82792967e70e5fed975521c5b5ceb"/><dir name="Roi"><file name="Beacon.php" hash="388253b41a5e251ee4c435b42304c6ca"/></dir><file name="Submissioncontainer.php" hash="23d04ee9ece011d107bb8b914653a24d"/></dir><dir name="Helper"><file name="Data.php" hash="2887f1dcf71ca7badf18bebffec3dc6c"/><file name="Sftp.php" hash="1c2867bdaaaaa94e14848a07a2b6b688"/><file name="SftpConnection.php" hash="d1ebf3c0d501fc39f9db15b76ccae3e7"/></dir><dir name="Model"><file name="ExportProductFeed.php" hash="015100464ca6aa1e0df8239127c2b20a"/><file name="ExportPurchaseFeed.php" hash="836b92a34272945e5cd70b018870711d"/><dir name="Mysql4"><file name="Setup.php" hash="884c886c1e9fa395f05e7872ba6478a2"/></dir><dir name="ProductFeed"><file name="Brand.php" hash="b2ab72e79d7e3afe23b38bc3b64ba115"/><file name="Category.php" hash="a3f6f51ac7ff3bc93889fd0befc9802e"/><file name="Product.php" hash="9870f90af87896918c1e1c239d074e5b"/></dir><file name="RetrieveInlineRatingsFeed.php" hash="c64ad33753408111e04322ef4b39ef34"/><file name="RetrieveSmartSEOPackage.php" hash="ececf2f31e0b3ca9c2dda4ed6967c8c1"/><dir name="Source"><file name="AuthenticationMethod.php" hash="582d6c76372bac64728e6e4d68f959e4"/><file name="Environment.php" hash="1e575c9adb480df80e4a8a917960bd55"/><file name="FeedGenerationScope.php" hash="b2450e4c0c69b0da328f1d0d7d67012a"/><file name="TriggeringEvent.php" hash="fa47f3a2fcec92d9603f21541c853035"/></dir></dir><dir name="controllers"><file name="FeedController.php" hash="933a1555d97ac2cec8ea52306cf63102"/><file name="IndexController.php" hash="16b9a353153d40ebc32e759112ca6d6f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="39cf8642bfc219709849618519a1c767"/><file name="config.xml" hash="1d10a8baa6f1cc56757f50d670f003f7"/><file name="system.xml" hash="efbc1b4d25f09f93d1bba3c012f77f27"/></dir><dir name="sql"><dir name="bazaarvoice_setup"><file name="mysql4-install-0.1.0.php" hash="2cf37e5f08ae8bb7f8c43d23d9493e58"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bazaarvoice_Connector.xml" hash="c517b52d29fec93a83a8010451368ee1"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="enterprise"><dir name="default"><dir name="template"><dir name="bazaarvoice"><dir name="display"><file name="headerincludes.phtml" hash="0faf96303bfe38e1c4130dfdbaff9c87"/><file name="headerproduct.phtml" hash="b2f48fcb558b33faeb4c6fa0cff7a064"/><dir name="qa"><file name="questions.phtml" hash="b5c186576e9c20cd764860ad08702349"/><file name="questionsummary.phtml" hash="c6044994c1d355730d7e5cfd3a6e3125"/></dir><dir name="rr"><file name="ratings.phtml" hash="56047515b347d0250d44e4e2eb0a923c"/><file name="reviews.phtml" hash="7d2ad8b18910010d22240c9521131290"/><file name="reviewsummary.phtml" hash="75e823088dd75387fc94e6028d8236a5"/></dir></dir><dir name="submit"><file name="roi_beacon.phtml" hash="494b9a44ceb14b1f376611d30ac18645"/><file name="submissioncontainer.phtml" hash="3f3f22b922c1aa5b87f7bbf4fbeea51c"/></dir></dir></dir><dir name="layout"><file name="bazaarvoice.xml" hash="e8d6c4a2ca62a21ddac1cd22e1ee8ad0"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="bazaarvoice_notification.html" hash="9a0e90ac62d926dad4db13719f3c8b73"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="bazaarvoice"><file name="rating-0_0.gif" hash="f50bd3f45f69a753614b2e76f53bdafc"/><file name="rating-1_0.gif" hash="c691e11e3250a18939aec523734d9b67"/><file name="rating-1_1.gif" hash="26377f1337bb6fb9e340292243a6f780"/><file name="rating-1_2.gif" hash="5c51583dc52d901c61d9470d5faeb2a4"/><file name="rating-1_3.gif" hash="3948c716d18ea0389ce9e57c347e7b6d"/><file name="rating-1_4.gif" hash="2211d8586bda467cb8fcc617670b94df"/><file name="rating-1_5.gif" hash="3fa9480c8b86f85749147fa0e8144b05"/><file name="rating-1_6.gif" hash="a577c79e7ea0c6c59ac15251c39de515"/><file name="rating-1_7.gif" hash="b5b52fa267632eda6ba5b3be56319397"/><file name="rating-1_8.gif" hash="205170e1ffbfcc81569286a9e1a88eb5"/><file name="rating-1_9.gif" hash="63709f7b2a2e2f14ae442dbef6513f25"/><file name="rating-2_0.gif" hash="4eec2468b5e41dc03d198ed6fe084a53"/><file name="rating-2_1.gif" hash="155cab7b16f4cfef3e94b99ca297cedc"/><file name="rating-2_2.gif" hash="2e2dc606fd83853bdf90a3beb901cf3e"/><file name="rating-2_3.gif" hash="638632f37a750558722c0bf1a79f2546"/><file name="rating-2_4.gif" hash="6b0a85c21066c6402b9f8914284b999f"/><file name="rating-2_5.gif" hash="c4792dac3b9d5a914a72a4200f931c6e"/><file name="rating-2_6.gif" hash="1c7ac3f4e3721d4779721973cfaaa8db"/><file name="rating-2_7.gif" hash="21b680dce6ffef505532afea7fea1452"/><file name="rating-2_8.gif" hash="136ac6b284d1a2b9452a06eea993c1fa"/><file name="rating-2_9.gif" hash="d13af6920569aa85da6dfb0a139d560a"/><file name="rating-3_0.gif" hash="6b30e597cc23aec52dbd2be978d52351"/><file name="rating-3_1.gif" hash="cb544d168a949100fb5ee117adbd765b"/><file name="rating-3_2.gif" hash="75124c4b4dfc5cbcf5ae3ccfa7bdf906"/><file name="rating-3_3.gif" hash="0693b6a471361957da1dc8ee2e9af5ec"/><file name="rating-3_4.gif" hash="1a6e3cff41a61e1bbed9296badb94392"/><file name="rating-3_5.gif" hash="7f63ecf505414386267fad2e92617a9f"/><file name="rating-3_6.gif" hash="8b9b9ccebc3537cffd2bed75c60eaa9e"/><file name="rating-3_7.gif" hash="7f83f3996a738d1fd6763204cd964376"/><file name="rating-3_8.gif" hash="219a1f2dbd45bcb58a58f460c9491bbf"/><file name="rating-3_9.gif" hash="e4114607ca469db2fd5f87ac21c4f00a"/><file name="rating-4_0.gif" hash="a15541525186bf6911202e0f64daa4a6"/><file name="rating-4_1.gif" hash="818971c067beb397247095f5eedbac29"/><file name="rating-4_2.gif" hash="5b9599176771adfbf8c52c7dfa04e565"/><file name="rating-4_3.gif" hash="18dc68db736819e17ab5cf0d5725d99c"/><file name="rating-4_4.gif" hash="56b124f1a2e599918b462ce29cd1cd96"/><file name="rating-4_5.gif" hash="2044f11b1f7005f66f14219c5fce1020"/><file name="rating-4_6.gif" hash="3166f044e7f73f9b3e75bda4507eaa35"/><file name="rating-4_7.gif" hash="20546d3ebee7a364927e9da9274996a7"/><file name="rating-4_8.gif" hash="9dab0f19785d1592a96c5c295842f308"/><file name="rating-4_9.gif" hash="19a47143b04aceae85def246059fba33"/><file name="rating-5_0.gif" hash="e43b403663785255d2f023ca35566ac3"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Bazaarvoice"><file name="bvseosdk.php" hash="238d2a03d28a980abc71f56c2933e037"/></dir></target><target name="mageweb"><dir name="shell"><file name="bv_export_order_feed.php" hash="309995ede2f85d95a0b91d8845c06ae5"/><file name="bv_export_product_feed.php" hash="1696c363c97bf9943560045b297c98fb"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|