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.1.2 |
Comparing to | |
See all releases |
Code changes from version 6.1.1.3 to 6.1.2
- app/code/local/Bazaarvoice/Connector/Block/Roi/Beacon.php +1 -1
- app/code/local/Bazaarvoice/Connector/Helper/Data.php +17 -15
- app/code/local/Bazaarvoice/Connector/Model/ExportProductFeed.php +32 -35
- app/code/local/Bazaarvoice/Connector/Model/ExportPurchaseFeed.php +157 -117
- app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Category.php +1 -1
- app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Product.php +39 -23
- app/code/local/Bazaarvoice/Connector/Model/RetrieveInlineRatingsFeed.php +8 -8
- app/code/local/Bazaarvoice/Connector/Model/RetrieveSmartSEOPackage.php +11 -11
- app/code/local/Bazaarvoice/Connector/etc/config.xml +1 -1
- app/code/local/Bazaarvoice/Connector/sql/bazaarvoice_setup/mysql4-install-0.1.0.php +1 -1
- package.xml +4 -4
app/code/local/Bazaarvoice/Connector/Block/Roi/Beacon.php
CHANGED
@@ -89,7 +89,7 @@ class Bazaarvoice_Connector_Block_Roi_Beacon extends Mage_Core_Block_Template
|
|
89 |
$orderDetails['partnerSource'] = 'Magento Extension r' . Mage::helper('bazaarvoice')->getExtensionVersion();
|
90 |
}
|
91 |
}
|
92 |
-
Mage::log($orderDetails);
|
93 |
$orderDetailsJson = Mage::helper('core')->jsonEncode($orderDetails);
|
94 |
return urldecode(stripslashes($orderDetailsJson));
|
95 |
}
|
89 |
$orderDetails['partnerSource'] = 'Magento Extension r' . Mage::helper('bazaarvoice')->getExtensionVersion();
|
90 |
}
|
91 |
}
|
92 |
+
Mage::log($orderDetails, Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
93 |
$orderDetailsJson = Mage::helper('core')->jsonEncode($orderDetails);
|
94 |
return urldecode(stripslashes($orderDetailsJson));
|
95 |
}
|
app/code/local/Bazaarvoice/Connector/Helper/Data.php
CHANGED
@@ -6,6 +6,8 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
6 |
const BV_SUBJECT_TYPE = 'bvSubjectType';
|
7 |
const BV_EXTERNAL_SUBJECT_NAME = 'bvExternalSubjectName';
|
8 |
const BV_EXTERNAL_SUBJECT_ID = 'bvExternalSubjectID';
|
|
|
|
|
9 |
|
10 |
const CONST_SMARTSEO_BVRRP = 'bvrrp';
|
11 |
const CONST_SMARTSEO_BVQAP = 'bvqap';
|
@@ -139,7 +141,7 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
139 |
*/
|
140 |
public function downloadFile($localFilePath, $localFileName, $remoteFile, $store = null)
|
141 |
{
|
142 |
-
Mage::log(' BV - starting download from Bazaarvoice server');
|
143 |
|
144 |
// Create the directory if it doesn't already exist.
|
145 |
$ioObject = new Varien_Io_File();
|
@@ -149,27 +151,27 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
149 |
}
|
150 |
} catch (Exception $e) {
|
151 |
// Most likely not enough permissions.
|
152 |
-
Mage::log(" BV - failed attempting to create local directory '".$localFilePath."' to download feed. Error trace follows: " . $e->getTraceAsString());
|
153 |
return false;
|
154 |
}
|
155 |
|
156 |
// Make sure directory is writable
|
157 |
if (!$ioObject->isWriteable($localFilePath)) {
|
158 |
-
Mage::log(" BV - local directory '".$localFilePath."' is not writable.");
|
159 |
return false;
|
160 |
}
|
161 |
|
162 |
// Establish a connection to the FTP host
|
163 |
-
Mage::log(' BV - beginning file download');
|
164 |
$connection = ftp_connect($this->getSFTPHost());
|
165 |
$ftpUser = strtolower(Mage::getStoreConfig('bazaarvoice/general/client_name', $store));
|
166 |
$ftpPw = Mage::getStoreConfig('bazaarvoice/general/ftp_password', $store);
|
167 |
-
Mage::log(' BV - connecting with ftp user: ' . $ftpUser);
|
168 |
-
//Mage::log(' BV - connecting with ftp pw: ' . $ftpPw);
|
169 |
$login = ftp_login($connection, $ftpUser, $ftpPw);
|
170 |
ftp_pasv($connection, true);
|
171 |
if (!$connection || !$login) {
|
172 |
-
Mage::log(' BV - FTP connection attempt failed!');
|
173 |
return false;
|
174 |
}
|
175 |
|
@@ -182,12 +184,12 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
182 |
// Download the file
|
183 |
ftp_get($connection, $localFilePath . DS . $localFileName, $remoteFile, FTP_BINARY);
|
184 |
} catch (Exception $ex) {
|
185 |
-
Mage::log(' BV - Exception downloading file: ' . $ex->getTraceAsString());
|
186 |
}
|
187 |
|
188 |
// Validate file was downloaded
|
189 |
if (!$ioObject->fileExists($localFilePath . DS . $localFileName, true)) {
|
190 |
-
Mage::log(" BV - unable to download file '" . $localFilePath . DS . $localFileName . "'");
|
191 |
return false;
|
192 |
}
|
193 |
|
@@ -197,24 +199,24 @@ class Bazaarvoice_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
197 |
|
198 |
public function uploadFile($localFileName, $remoteFile, $store)
|
199 |
{
|
200 |
-
Mage::log(' BV - starting upload to Bazaarvoice server');
|
201 |
|
202 |
//$ftpHost = $this->getSFTPHost($store);
|
203 |
$ftpUser = strtolower(Mage::getStoreConfig('bazaarvoice/general/client_name', $store->getId()));
|
204 |
$ftpPw = Mage::getStoreConfig('bazaarvoice/general/ftp_password', $store->getId());
|
205 |
-
//Mage::log(' BV - connecting to host: ' . $ftpHost);
|
206 |
-
Mage::log(' BV - connecting with ftp user: ' . $ftpUser);
|
207 |
-
//Mage::log(' BV - connecting with ftp pw: ' . $ftpPw);
|
208 |
|
209 |
$connection = ftp_connect($this->getSFTPHost($store));
|
210 |
if (!$connection) {
|
211 |
-
Mage::log(' BV - FTP connection attempt failed!');
|
212 |
return false;
|
213 |
}
|
214 |
$login = ftp_login($connection, $ftpUser, $ftpPw);
|
215 |
ftp_pasv($connection, true);
|
216 |
if (!$connection || !$login) {
|
217 |
-
Mage::log(' BV - FTP connection attempt failed!');
|
218 |
return false;
|
219 |
}
|
220 |
|
6 |
const BV_SUBJECT_TYPE = 'bvSubjectType';
|
7 |
const BV_EXTERNAL_SUBJECT_NAME = 'bvExternalSubjectName';
|
8 |
const BV_EXTERNAL_SUBJECT_ID = 'bvExternalSubjectID';
|
9 |
+
|
10 |
+
const LOG_FILE = 'bazaarvoice.log';
|
11 |
|
12 |
const CONST_SMARTSEO_BVRRP = 'bvrrp';
|
13 |
const CONST_SMARTSEO_BVQAP = 'bvqap';
|
141 |
*/
|
142 |
public function downloadFile($localFilePath, $localFileName, $remoteFile, $store = null)
|
143 |
{
|
144 |
+
Mage::log(' BV - starting download from Bazaarvoice server', Zend_Log::DEBUG, self::LOG_FILE);
|
145 |
|
146 |
// Create the directory if it doesn't already exist.
|
147 |
$ioObject = new Varien_Io_File();
|
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::DEBUG, self::LOG_FILE);
|
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::DEBUG, self::LOG_FILE);
|
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 |
|
184 |
// Download the file
|
185 |
ftp_get($connection, $localFilePath . DS . $localFileName, $remoteFile, FTP_BINARY);
|
186 |
} catch (Exception $ex) {
|
187 |
+
Mage::log(' BV - Exception downloading file: ' . $ex->getTraceAsString(), Zend_Log::DEBUG, self::LOG_FILE);
|
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::DEBUG, self::LOG_FILE);
|
193 |
return false;
|
194 |
}
|
195 |
|
199 |
|
200 |
public function uploadFile($localFileName, $remoteFile, $store)
|
201 |
{
|
202 |
+
Mage::log(' BV - starting upload to Bazaarvoice server', Zend_Log::DEBUG, self::LOG_FILE);
|
203 |
|
204 |
//$ftpHost = $this->getSFTPHost($store);
|
205 |
$ftpUser = strtolower(Mage::getStoreConfig('bazaarvoice/general/client_name', $store->getId()));
|
206 |
$ftpPw = Mage::getStoreConfig('bazaarvoice/general/ftp_password', $store->getId());
|
207 |
+
//Mage::log(' BV - connecting to host: ' . $ftpHost, Zend_Log::DEBUG, self::LOG_FILE);
|
208 |
+
Mage::log(' BV - connecting with ftp user: ' . $ftpUser, Zend_Log::DEBUG, self::LOG_FILE);
|
209 |
+
//Mage::log(' BV - connecting with ftp pw: ' . $ftpPw, Zend_Log::DEBUG, self::LOG_FILE);
|
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 |
|
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 Bazaarvoice product feed generation');
|
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 Bazaarvoice product feed generation');
|
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...');
|
89 |
// Iterate through all websites in this instance
|
90 |
// (Not the 'admin' store view, which represents admin panel)
|
91 |
$websites = Mage::app()->getWebsites(false);
|
@@ -97,8 +97,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
97 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $website->getDefaultGroup()->getDefaultStoreId()) === '1'
|
98 |
) {
|
99 |
if (count($website->getStores()) > 0) {
|
100 |
-
Mage::log(' BV - Exporting product feed for website: ' . $website->getName(),
|
101 |
-
Zend_Log::INFO);
|
102 |
$this->exportDailyProductFeedForWebsite($website);
|
103 |
}
|
104 |
else {
|
@@ -106,13 +105,12 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
106 |
}
|
107 |
}
|
108 |
else {
|
109 |
-
Mage::log(' BV - Product feed disabled for website: ' . $website->getName(), Zend_Log::INFO);
|
110 |
}
|
111 |
}
|
112 |
catch (Exception $e) {
|
113 |
-
Mage::log(' BV - Failed to export daily product feed for website: ' . $website->getName(),
|
114 |
-
|
115 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
116 |
Mage::logException($e);
|
117 |
// Continue processing other websites
|
118 |
}
|
@@ -125,7 +123,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
125 |
public function exportDailyProductFeedByGroup()
|
126 |
{
|
127 |
// Log
|
128 |
-
Mage::log('Exporting product feed file for each store group...');
|
129 |
// Iterate through all stores / groups in this instance
|
130 |
// (Not the 'admin' store view, which represents admin panel)
|
131 |
$groups = Mage::app()->getGroups(false);
|
@@ -136,7 +134,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
136 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1'
|
137 |
) {
|
138 |
if (count($group->getStores()) > 0) {
|
139 |
-
Mage::log(' BV - Exporting product feed for store group: ' . $group->getName(), Zend_Log::INFO);
|
140 |
$this->exportDailyProductFeedForStoreGroup($group);
|
141 |
}
|
142 |
else {
|
@@ -144,13 +142,12 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
144 |
}
|
145 |
}
|
146 |
else {
|
147 |
-
Mage::log(' BV - Product feed disabled for store group: ' . $group->getName(), Zend_Log::INFO);
|
148 |
}
|
149 |
}
|
150 |
catch (Exception $e) {
|
151 |
-
Mage::log(' BV - Failed to export daily product feed for store group: ' . $group->getName(),
|
152 |
-
|
153 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
154 |
Mage::logException($e);
|
155 |
// Continue processing other store groups
|
156 |
}
|
@@ -163,7 +160,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
163 |
private function exportDailyProductFeedByStore()
|
164 |
{
|
165 |
// Log
|
166 |
-
Mage::log('Exporting product feed file for each store / store view...');
|
167 |
// Iterate through all stores / groups in this instance
|
168 |
// (Not the 'admin' store view, which represents admin panel)
|
169 |
$stores = Mage::app()->getStores(false);
|
@@ -173,16 +170,16 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
173 |
if (Mage::getStoreConfig('bazaarvoice/feeds/enable_product_feed', $store->getId()) === '1'
|
174 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $store->getId()) === '1'
|
175 |
) {
|
176 |
-
Mage::log(' BV - Exporting product feed for store: ' . $store->getCode(), Zend_Log::INFO);
|
177 |
$this->exportDailyProductFeedForStore($store);
|
178 |
}
|
179 |
else {
|
180 |
-
Mage::log(' BV - Product feed disabled for store: ' . $store->getCode(), Zend_Log::INFO);
|
181 |
}
|
182 |
}
|
183 |
catch (Exception $e) {
|
184 |
-
Mage::log(' BV - Failed to export daily product feed for store: ' . $store->getCode(), Zend_Log::ERR);
|
185 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
186 |
Mage::logException($e);
|
187 |
// Continue processing other store groups
|
188 |
}
|
@@ -216,14 +213,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
216 |
// Create varien io object and write local feed file
|
217 |
/* @var $ioObject Varien_Io_File */
|
218 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
219 |
-
Mage::log(' BV - processing all brands');
|
220 |
$brandModel->processBrandsForWebsite($ioObject, $website);
|
221 |
-
Mage::log(' BV - completed brands, beginning categories');
|
222 |
$categoryModel->processCategoriesForWebsite($ioObject, $website);
|
223 |
-
Mage::log(' BV - completed categories, beginning products');
|
224 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
225 |
$productModel->processProductsForWebsite($ioObject, $website);
|
226 |
-
Mage::log(' BV - completed processing all products');
|
227 |
$this->closeAndFinishWritingFile($ioObject);
|
228 |
|
229 |
// Upload feed
|
@@ -258,14 +255,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
258 |
// Create varien io object and write local feed file
|
259 |
/* @var $ioObject Varien_Io_File */
|
260 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
261 |
-
Mage::log(' BV - processing all brands');
|
262 |
$brandModel->processBrandsForGroup($ioObject, $group);
|
263 |
-
Mage::log(' BV - completed brands, beginning categories');
|
264 |
$categoryModel->processCategoriesForGroup($ioObject, $group);
|
265 |
-
Mage::log(' BV - completed categories, beginning products');
|
266 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
267 |
$productModel->processProductsForGroup($ioObject, $group);
|
268 |
-
Mage::log(' BV - completed processing all products');
|
269 |
$this->closeAndFinishWritingFile($ioObject);
|
270 |
|
271 |
// Upload feed
|
@@ -299,14 +296,14 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
299 |
// Create varien io object and write local feed file
|
300 |
/* @var $ioObject Varien_Io_File */
|
301 |
$ioObject = $this->createAndStartWritingFile($productFeedFileName, $clientName);
|
302 |
-
Mage::log(' BV - processing all brands');
|
303 |
$brandModel->processBrandsForStore($ioObject, $store);
|
304 |
-
Mage::log(' BV - completed brands, beginning categories');
|
305 |
$categoryModel->processCategoriesForStore($ioObject, $store);
|
306 |
-
Mage::log(' BV - completed categories, beginning products');
|
307 |
$productModel->setCategoryIdList($categoryModel->getCategoryIdList());
|
308 |
$productModel->processProductsForStore($ioObject, $store);
|
309 |
-
Mage::log(' BV - completed processing all products');
|
310 |
$this->closeAndFinishWritingFile($ioObject);
|
311 |
|
312 |
// Upload feed
|
@@ -331,10 +328,10 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
331 |
$upload = $bvHelper->uploadFile($sourceFile, $destinationFile, $store);
|
332 |
|
333 |
if (!$upload) {
|
334 |
-
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $productFeedFileName . ']');
|
335 |
}
|
336 |
else {
|
337 |
-
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $productFeedFileName . ']');
|
338 |
$ioObject = new Varien_Io_File();
|
339 |
$ioObject->rm($productFeedFileName);
|
340 |
}
|
@@ -361,7 +358,7 @@ class Bazaarvoice_Connector_Model_ExportProductFeed extends Mage_Core_Model_Abst
|
|
361 |
}
|
362 |
|
363 |
if (!$ioObject->streamOpen(basename($productFeedFileName))) {
|
364 |
-
Mage::throwException('Failed to open local feed file for writing: ' . $productFeedFileName);
|
365 |
}
|
366 |
|
367 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
|
61 |
public function exportDailyProductFeed()
|
62 |
{
|
63 |
// Log
|
64 |
+
Mage::log('Start Bazaarvoice product feed generation', Zend_Log::DEBUG, 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('End Bazaarvoice product feed generation', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
80 |
}
|
81 |
|
82 |
/**
|
85 |
private function exportDailyProductFeedByWebsite()
|
86 |
{
|
87 |
// Log
|
88 |
+
Mage::log('Exporting product feed file for each website...', Zend_Log::DEBUG, 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);
|
97 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $website->getDefaultGroup()->getDefaultStoreId()) === '1'
|
98 |
) {
|
99 |
if (count($website->getStores()) > 0) {
|
100 |
+
Mage::log(' BV - Exporting product feed for website: ' . $website->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
|
|
101 |
$this->exportDailyProductFeedForWebsite($website);
|
102 |
}
|
103 |
else {
|
105 |
}
|
106 |
}
|
107 |
else {
|
108 |
+
Mage::log(' BV - Product feed disabled for website: ' . $website->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
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('Exporting product feed file for each store group...', Zend_Log::DEBUG, 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);
|
134 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1'
|
135 |
) {
|
136 |
if (count($group->getStores()) > 0) {
|
137 |
+
Mage::log(' BV - Exporting product feed for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
138 |
$this->exportDailyProductFeedForStoreGroup($group);
|
139 |
}
|
140 |
else {
|
142 |
}
|
143 |
}
|
144 |
else {
|
145 |
+
Mage::log(' BV - Product feed disabled for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
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('Exporting product feed file for each store / store view...', Zend_Log::DEBUG, 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);
|
170 |
if (Mage::getStoreConfig('bazaarvoice/feeds/enable_product_feed', $store->getId()) === '1'
|
171 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $store->getId()) === '1'
|
172 |
) {
|
173 |
+
Mage::log(' BV - Exporting product feed for store: ' . $store->getCode(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
174 |
$this->exportDailyProductFeedForStore($store);
|
175 |
}
|
176 |
else {
|
177 |
+
Mage::log(' BV - Product feed disabled for store: ' . $store->getCode(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
217 |
$brandModel->processBrandsForWebsite($ioObject, $website);
|
218 |
+
Mage::log(' BV - completed brands, beginning categories', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
219 |
$categoryModel->processCategoriesForWebsite($ioObject, $website);
|
220 |
+
Mage::log(' BV - completed categories, beginning products', Zend_Log::DEBUG, 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::DEBUG, 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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
259 |
$brandModel->processBrandsForGroup($ioObject, $group);
|
260 |
+
Mage::log(' BV - completed brands, beginning categories', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
261 |
$categoryModel->processCategoriesForGroup($ioObject, $group);
|
262 |
+
Mage::log(' BV - completed categories, beginning products', Zend_Log::DEBUG, 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::DEBUG, 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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
300 |
$brandModel->processBrandsForStore($ioObject, $store);
|
301 |
+
Mage::log(' BV - completed brands, beginning categories', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
302 |
$categoryModel->processCategoriesForStore($ioObject, $store);
|
303 |
+
Mage::log(' BV - completed categories, beginning products', Zend_Log::DEBUG, 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::DEBUG, 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(' Bazaarvoice FTP upload failed! [filename = ' . $productFeedFileName . ']', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
332 |
}
|
333 |
else {
|
334 |
+
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $productFeedFileName . ']', Zend_Log::DEBUG, 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::DEBUG, 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 Bazaarvoice purchase feed generation');
|
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 Bazaarvoice purchase feed generation');
|
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...');
|
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);
|
@@ -52,7 +52,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
52 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $website->getDefaultGroup()->getDefaultStoreId()) === '1'
|
53 |
) {
|
54 |
if (count($website->getStores()) > 0) {
|
55 |
-
Mage::log(' BV - Exporting purchase feed for website: ' . $website->getName(), Zend_Log::INFO);
|
56 |
$this->exportPurchaseFeedForWebsite($website);
|
57 |
}
|
58 |
else {
|
@@ -60,12 +60,12 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
60 |
}
|
61 |
}
|
62 |
else {
|
63 |
-
Mage::log(' BV - Purchase feed disabled for website: ' . $website->getName(), Zend_Log::INFO);
|
64 |
}
|
65 |
}
|
66 |
catch (Exception $e) {
|
67 |
-
Mage::log(' BV - Failed to export daily purchase feed for website: ' . $website->getName(), Zend_Log::ERR);
|
68 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
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...');
|
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);
|
@@ -89,7 +89,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
89 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1'
|
90 |
) {
|
91 |
if (count($group->getStores()) > 0) {
|
92 |
-
Mage::log(' BV - Exporting purchase feed for store group: ' . $group->getName(), Zend_Log::INFO);
|
93 |
$this->exportPurchaseFeedForStoreGroup($group);
|
94 |
}
|
95 |
else {
|
@@ -97,12 +97,12 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
97 |
}
|
98 |
}
|
99 |
else {
|
100 |
-
Mage::log(' BV - Purchase feed disabled for store group: ' . $group->getName(), Zend_Log::INFO);
|
101 |
}
|
102 |
}
|
103 |
catch (Exception $e) {
|
104 |
-
Mage::log(' BV - Failed to export daily purchase feed for store group: ' . $group->getName(), Zend_Log::ERR);
|
105 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
106 |
Mage::logException($e);
|
107 |
// Continue processing other store groups
|
108 |
}
|
@@ -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...');
|
119 |
// Iterate through all stores in this instance
|
120 |
// (Not the 'admin' store view, which represents admin panel)
|
121 |
$stores = Mage::app()->getStores(false);
|
@@ -125,16 +125,16 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
125 |
if (Mage::getStoreConfig('bazaarvoice/feeds/enable_purchase_feed', $store->getId()) === '1'
|
126 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $store->getId()) === '1'
|
127 |
) {
|
128 |
-
Mage::log(' BV - Exporting purchase feed for: ' . $store->getCode(), Zend_Log::INFO);
|
129 |
$this->exportPurchaseFeedForStore($store);
|
130 |
}
|
131 |
else {
|
132 |
-
Mage::log(' BV - Purchase feed disabled for store: ' . $store->getCode(), Zend_Log::INFO);
|
133 |
}
|
134 |
}
|
135 |
catch (Exception $e) {
|
136 |
-
Mage::log(' BV - Failed to export daily purchase feed for store: ' . $store->getCode(), Zend_Log::ERR);
|
137 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
138 |
Mage::logException($e);
|
139 |
// Continue processing other stores
|
140 |
}
|
@@ -168,16 +168,17 @@ 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');
|
172 |
-
$
|
173 |
-
|
|
|
174 |
|
175 |
$ioObject->streamWrite("</Feed>\n");
|
176 |
$ioObject->streamClose();
|
177 |
|
178 |
// Don't bother uploading if there are no orders in the feed
|
179 |
$upload = false;
|
180 |
-
if ($
|
181 |
/*
|
182 |
* Hard code path and file name
|
183 |
* Former config setting defaults:
|
@@ -191,10 +192,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
191 |
}
|
192 |
|
193 |
if (!$upload) {
|
194 |
-
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']');
|
195 |
}
|
196 |
else {
|
197 |
-
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']');
|
198 |
$ioObject->rm($purchaseFeedFileName);
|
199 |
}
|
200 |
|
@@ -229,16 +230,17 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
229 |
|
230 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
231 |
|
232 |
-
Mage::log(' BV - processing all orders');
|
233 |
-
$
|
234 |
-
|
|
|
235 |
|
236 |
$ioObject->streamWrite("</Feed>\n");
|
237 |
$ioObject->streamClose();
|
238 |
|
239 |
// Don't bother uploading if there are no orders in the feed
|
240 |
$upload = false;
|
241 |
-
if ($
|
242 |
/*
|
243 |
* Hard code path and file name
|
244 |
* Former config setting defaults:
|
@@ -252,10 +254,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
252 |
}
|
253 |
|
254 |
if (!$upload) {
|
255 |
-
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']');
|
256 |
}
|
257 |
else {
|
258 |
-
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']');
|
259 |
$ioObject->rm($purchaseFeedFileName);
|
260 |
}
|
261 |
|
@@ -289,16 +291,17 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
289 |
|
290 |
$ioObject->streamWrite("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Feed xmlns=\"http://www.bazaarvoice.com/xs/PRR/PostPurchaseFeed/4.9\">\n");
|
291 |
|
292 |
-
Mage::log(" BV - processing all orders");
|
293 |
-
$
|
294 |
-
|
|
|
295 |
|
296 |
$ioObject->streamWrite("</Feed>\n");
|
297 |
$ioObject->streamClose();
|
298 |
|
299 |
// Don't bother uploading if there are no orders in the feed
|
300 |
$upload = false;
|
301 |
-
if ($
|
302 |
/*
|
303 |
* Hard code path and file name
|
304 |
* Former config setting defaults:
|
@@ -312,10 +315,10 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
312 |
}
|
313 |
|
314 |
if (!$upload) {
|
315 |
-
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']');
|
316 |
}
|
317 |
else {
|
318 |
-
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']');
|
319 |
$ioObject->rm($purchaseFeedFileName);
|
320 |
}
|
321 |
|
@@ -347,13 +350,19 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
347 |
));
|
348 |
// Only orders created within our look-back window
|
349 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
350 |
-
//
|
351 |
-
$orders->addFieldToFilter(
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
353 |
// Write orders to file
|
354 |
-
$
|
355 |
|
356 |
-
return $
|
357 |
}
|
358 |
|
359 |
/**
|
@@ -381,13 +390,19 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
381 |
));
|
382 |
// Only orders created within our look-back window
|
383 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
384 |
-
//
|
385 |
-
$orders->addFieldToFilter(
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
|
387 |
// Write orders to file
|
388 |
-
$
|
389 |
|
390 |
-
return $
|
391 |
}
|
392 |
|
393 |
/**
|
@@ -412,13 +427,18 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
412 |
));
|
413 |
// Only orders created within our look-back window
|
414 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
415 |
-
//
|
416 |
-
$orders->addFieldToFilter(
|
417 |
-
|
|
|
|
|
|
|
|
|
|
|
418 |
// Write orders to file
|
419 |
-
$
|
420 |
|
421 |
-
return $
|
422 |
}
|
423 |
|
424 |
/**
|
@@ -444,78 +464,98 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
444 |
. ", NumDaysLookback: " . self::NUM_DAYS_LOOKBACK
|
445 |
. ", NumDaysLookbackStartDate: " . $this->getNumDaysLookbackStartDate()
|
446 |
. ", DelayDaysSinceEvent: " . $delayDaysSinceEvent
|
447 |
-
. ', DelayDaysThreshold: ' . date('c', $this->getDelayDaysThresholdTimestamp($delayDaysSinceEvent)) . '}');
|
448 |
-
|
449 |
-
$
|
450 |
-
|
451 |
foreach ($orders->getAllIds() as $orderId) {
|
452 |
-
|
453 |
-
/* @var $order Mage_Sales_Model_Order */
|
454 |
$order = $orderModel->load($orderId);
|
455 |
-
$store = $order->getStore();
|
456 |
-
|
457 |
if (!$this->shouldIncludeOrder($order, $triggeringEvent, $delayDaysSinceEvent)) {
|
458 |
continue;
|
459 |
}
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
// if families are enabled, get all items
|
472 |
-
if(Mage::getStoreConfig('bazaarvoice/feeds/families')){
|
473 |
-
$items = $order->getAllItems();
|
474 |
-
} else {
|
475 |
-
$items = $order->getAllVisibleItems();
|
476 |
-
}
|
477 |
-
/* @var $item Mage_Sales_Model_Order_Item */
|
478 |
-
foreach ($items as $item) {
|
479 |
-
// skip configurable items if families are enabled
|
480 |
-
if(Mage::getStoreConfig('bazaarvoice/feeds/families') && $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) continue;
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
}
|
503 |
|
504 |
-
$
|
505 |
-
|
506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
}
|
509 |
-
$ioObject->streamWrite(" </Products>\n");
|
510 |
-
$ioObject->streamWrite("</Interaction>\n");
|
511 |
-
|
512 |
-
$order->setData(self::ALREADY_SENT_IN_FEED_FLAG, 1);
|
513 |
-
$order->save();
|
514 |
-
$order->reset(); // Forces a reload of various collections that the object caches internally so that the next time we load from the orderModel, we'll get a completely new object.
|
515 |
|
516 |
}
|
|
|
517 |
|
518 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
}
|
520 |
|
521 |
private function orderToString(Mage_Sales_Model_Order $order)
|
@@ -558,20 +598,20 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
558 |
{
|
559 |
// Have we already included this order in a previous feed?
|
560 |
if ($order->getData(self::ALREADY_SENT_IN_FEED_FLAG) === '1') {
|
561 |
-
Mage::log(' BV - Skipping Order. Already included in previous feed. ' . $this->orderToString($order));
|
562 |
return false;
|
563 |
}
|
564 |
|
565 |
// Is the order canceled?
|
566 |
if ($order->isCanceled()) {
|
567 |
-
Mage::log(' BV - Skipping Order. Canceled state. ' . $this->orderToString($order));
|
568 |
return false;
|
569 |
}
|
570 |
|
571 |
// Ensure that we can get the store for the order
|
572 |
$store = $order->getStore();
|
573 |
if (is_null($store)) {
|
574 |
-
Mage::log(' BV - Skipping Order. Could not find store for order. ' . $this->orderToString($order));
|
575 |
return false;
|
576 |
}
|
577 |
|
@@ -582,7 +622,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
582 |
|
583 |
// Is the order completely shipped?
|
584 |
if (!$this->hasOrderCompletelyShipped($order)) {
|
585 |
-
Mage::log(' BV - Skipping Order. Not completely shipped. ' . $this->orderToString($order));
|
586 |
return false;
|
587 |
}
|
588 |
|
@@ -591,7 +631,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
591 |
if ($latestItemShipDateTimestamp > $thresholdTimestamp) {
|
592 |
// Latest ship date for the fully shipped order is still within the delay period
|
593 |
Mage::log(' BV - Skipping Order. Ship date not outside the threshold of ' . date('c', $thresholdTimestamp) . '. ' .
|
594 |
-
$this->orderToString($order));
|
595 |
return false;
|
596 |
}
|
597 |
}
|
@@ -603,7 +643,7 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
603 |
// Order placement date is still within the delay period
|
604 |
Mage::log(' BV - Skipping Order. Order date not outside the threshold of ' . date('c', $thresholdTimestamp) .
|
605 |
'. ' .
|
606 |
-
$this->orderToString($order));
|
607 |
return false;
|
608 |
}
|
609 |
}
|
@@ -614,19 +654,19 @@ class Bazaarvoice_Connector_Model_ExportPurchaseFeed extends Mage_Core_Model_Abs
|
|
614 |
|
615 |
// Do we have what basically looks like a legit email address?
|
616 |
if (!preg_match('/@/', $order->getCustomerEmail())) {
|
617 |
-
Mage::log(' BV - Skipping Order. No valid email address. ' . $this->orderToString($order));
|
618 |
return false;
|
619 |
}
|
620 |
|
621 |
// Does the order have any items?
|
622 |
if (count($order->getAllItems()) < 1) {
|
623 |
-
Mage::log(' BV - Skipping Order. No items in this order. ' . $this->orderToString($order));
|
624 |
return false;
|
625 |
}
|
626 |
|
627 |
|
628 |
if (self::DEBUG_OUTPUT) {
|
629 |
-
Mage::log(' BV - Including Order. ' . $this->orderToString($order));
|
630 |
}
|
631 |
return true;
|
632 |
}
|
17 |
public function exportPurchaseFeed()
|
18 |
{
|
19 |
// Log
|
20 |
+
Mage::log('Start Bazaarvoice purchase feed generation', Zend_Log::DEBUG, 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('End Bazaarvoice purchase feed generation', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
36 |
}
|
37 |
|
38 |
/**
|
41 |
public function exportPurchaseFeedByWebsite()
|
42 |
{
|
43 |
// Log
|
44 |
+
Mage::log('Exporting purchase feed file for each website...', Zend_Log::DEBUG, 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);
|
52 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $website->getDefaultGroup()->getDefaultStoreId()) === '1'
|
53 |
) {
|
54 |
if (count($website->getStores()) > 0) {
|
55 |
+
Mage::log(' BV - Exporting purchase feed for website: ' . $website->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
56 |
$this->exportPurchaseFeedForWebsite($website);
|
57 |
}
|
58 |
else {
|
60 |
}
|
61 |
}
|
62 |
else {
|
63 |
+
Mage::log(' BV - Purchase feed disabled for website: ' . $website->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
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('Exporting purchase feed file for each store group...', Zend_Log::DEBUG, 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);
|
89 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1'
|
90 |
) {
|
91 |
if (count($group->getStores()) > 0) {
|
92 |
+
Mage::log(' BV - Exporting purchase feed for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
93 |
$this->exportPurchaseFeedForStoreGroup($group);
|
94 |
}
|
95 |
else {
|
97 |
}
|
98 |
}
|
99 |
else {
|
100 |
+
Mage::log(' BV - Purchase feed disabled for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
101 |
}
|
102 |
}
|
103 |
catch (Exception $e) {
|
104 |
+
Mage::log(' BV - Failed to export daily purchase feed for store group: ' . $group->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
105 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
106 |
Mage::logException($e);
|
107 |
// Continue processing other store groups
|
108 |
}
|
115 |
public function exportPurchaseFeedByStore()
|
116 |
{
|
117 |
// Log
|
118 |
+
Mage::log('Exporting purchase feed file for each store...', Zend_Log::DEBUG, 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);
|
125 |
if (Mage::getStoreConfig('bazaarvoice/feeds/enable_purchase_feed', $store->getId()) === '1'
|
126 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $store->getId()) === '1'
|
127 |
) {
|
128 |
+
Mage::log(' BV - Exporting purchase feed for: ' . $store->getCode(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
129 |
$this->exportPurchaseFeedForStore($store);
|
130 |
}
|
131 |
else {
|
132 |
+
Mage::log(' BV - Purchase feed disabled for store: ' . $store->getCode(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
133 |
}
|
134 |
}
|
135 |
catch (Exception $e) {
|
136 |
+
Mage::log(' BV - Failed to export daily purchase feed for store: ' . $store->getCode(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
137 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
138 |
Mage::logException($e);
|
139 |
// Continue processing other stores
|
140 |
}
|
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::DEBUG, 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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
175 |
|
176 |
$ioObject->streamWrite("</Feed>\n");
|
177 |
$ioObject->streamClose();
|
178 |
|
179 |
// Don't bother uploading if there are no orders in the feed
|
180 |
$upload = false;
|
181 |
+
if (count($ordersExported) > 0) {
|
182 |
/*
|
183 |
* Hard code path and file name
|
184 |
* Former config setting defaults:
|
192 |
}
|
193 |
|
194 |
if (!$upload) {
|
195 |
+
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
196 |
}
|
197 |
else {
|
198 |
+
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, 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::DEBUG, 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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
237 |
|
238 |
$ioObject->streamWrite("</Feed>\n");
|
239 |
$ioObject->streamClose();
|
240 |
|
241 |
// Don't bother uploading if there are no orders in the feed
|
242 |
$upload = false;
|
243 |
+
if (count($ordersExported) > 0) {
|
244 |
/*
|
245 |
* Hard code path and file name
|
246 |
* Former config setting defaults:
|
254 |
}
|
255 |
|
256 |
if (!$upload) {
|
257 |
+
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
258 |
}
|
259 |
else {
|
260 |
+
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, 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::DEBUG, 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::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
298 |
|
299 |
$ioObject->streamWrite("</Feed>\n");
|
300 |
$ioObject->streamClose();
|
301 |
|
302 |
// Don't bother uploading if there are no orders in the feed
|
303 |
$upload = false;
|
304 |
+
if (count($ordersExported) > 0) {
|
305 |
/*
|
306 |
* Hard code path and file name
|
307 |
* Former config setting defaults:
|
315 |
}
|
316 |
|
317 |
if (!$upload) {
|
318 |
+
Mage::log(' Bazaarvoice FTP upload failed! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
319 |
}
|
320 |
else {
|
321 |
+
Mage::log(' Bazaarvoice FTP upload success! [filename = ' . $purchaseFeedFileName . ']', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
322 |
$ioObject->rm($purchaseFeedFileName);
|
323 |
}
|
324 |
|
350 |
));
|
351 |
// Only orders created within our look-back window
|
352 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
353 |
+
// Include only orders that have not been sent or have errored out
|
354 |
+
$orders->addFieldToFilter(
|
355 |
+
array(self::ALREADY_SENT_IN_FEED_FLAG, self::ALREADY_SENT_IN_FEED_FLAG),
|
356 |
+
array(
|
357 |
+
array('neq' => 1),
|
358 |
+
array('null' => 'null')
|
359 |
+
)
|
360 |
+
);
|
361 |
|
362 |
// Write orders to file
|
363 |
+
$ordersExported = $this->writeOrdersToFile($ioObject, $orders);
|
364 |
|
365 |
+
return $ordersExported;
|
366 |
}
|
367 |
|
368 |
/**
|
390 |
));
|
391 |
// Only orders created within our look-back window
|
392 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
393 |
+
// Include only orders that have not been sent or have errored out
|
394 |
+
$orders->addFieldToFilter(
|
395 |
+
array(self::ALREADY_SENT_IN_FEED_FLAG, self::ALREADY_SENT_IN_FEED_FLAG),
|
396 |
+
array(
|
397 |
+
array('neq' => 1),
|
398 |
+
array('null' => 'null')
|
399 |
+
)
|
400 |
+
);
|
401 |
|
402 |
// Write orders to file
|
403 |
+
$ordersExported = $this->writeOrdersToFile($ioObject, $orders);
|
404 |
|
405 |
+
return $ordersExported;
|
406 |
}
|
407 |
|
408 |
/**
|
427 |
));
|
428 |
// Only orders created within our look-back window
|
429 |
$orders->addFieldToFilter('created_at', array('gteq' => $this->getNumDaysLookbackStartDate()));
|
430 |
+
// Include only orders that have not been sent or have errored out
|
431 |
+
$orders->addFieldToFilter(
|
432 |
+
array(self::ALREADY_SENT_IN_FEED_FLAG, self::ALREADY_SENT_IN_FEED_FLAG),
|
433 |
+
array(
|
434 |
+
array('neq' => 1),
|
435 |
+
array('null' => 'null')
|
436 |
+
)
|
437 |
+
);
|
438 |
// Write orders to file
|
439 |
+
$ordersExported = $this->writeOrdersToFile($ioObject, $orders);
|
440 |
|
441 |
+
return $ordersExported;
|
442 |
}
|
443 |
|
444 |
/**
|
464 |
. ", NumDaysLookback: " . self::NUM_DAYS_LOOKBACK
|
465 |
. ", NumDaysLookbackStartDate: " . $this->getNumDaysLookbackStartDate()
|
466 |
. ", DelayDaysSinceEvent: " . $delayDaysSinceEvent
|
467 |
+
. ', DelayDaysThreshold: ' . date('c', $this->getDelayDaysThresholdTimestamp($delayDaysSinceEvent)) . '}', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
468 |
+
|
469 |
+
$ordersToExport = array();
|
|
|
470 |
foreach ($orders->getAllIds() as $orderId) {
|
|
|
|
|
471 |
$order = $orderModel->load($orderId);
|
|
|
|
|
472 |
if (!$this->shouldIncludeOrder($order, $triggeringEvent, $delayDaysSinceEvent)) {
|
473 |
continue;
|
474 |
}
|
475 |
+
$ordersToExport[] = $orderId;
|
476 |
+
}
|
477 |
+
Mage::log(" BV - Found " . count($ordersToExport) . " orders to export.", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
478 |
+
|
479 |
+
$exportedOrders = array(); // Keep track of how many orders we include in the feed
|
480 |
+
|
481 |
+
foreach ($ordersToExport as $orderId) {
|
482 |
+
try{
|
483 |
+
/* @var $order Mage_Sales_Model_Order */
|
484 |
+
$order = $orderModel->load($orderId);
|
485 |
+
$store = $order->getStore();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
|
487 |
+
|
488 |
+
$orderXml = '';
|
489 |
+
|
490 |
+
$orderXml .= "<Interaction>\n";
|
491 |
+
$orderXml .= ' <EmailAddress>' . $order->getCustomerEmail() . "</EmailAddress>\n";
|
492 |
+
$orderXml .= ' <Locale>' . $store->getConfig('bazaarvoice/general/locale') . "</Locale>\n";
|
493 |
+
$orderXml .= ' <UserName>' . $order->getCustomerName() . "</UserName>\n";
|
494 |
+
$orderXml .= ' <UserID>' . $order->getCustomerId() . "</UserID>\n";
|
495 |
+
$orderXml .= ' <TransactionDate>' . $this->getTriggeringEventDate($order, $triggeringEvent) . "</TransactionDate>\n";
|
496 |
+
$orderXml .= " <Products>\n";
|
497 |
+
// if families are enabled, get all items
|
498 |
+
if(Mage::getStoreConfig('bazaarvoice/feeds/families')){
|
499 |
+
$items = $order->getAllItems();
|
500 |
+
} else {
|
501 |
+
$items = $order->getAllVisibleItems();
|
502 |
+
}
|
503 |
+
/* @var $item Mage_Sales_Model_Order_Item */
|
504 |
+
foreach ($items as $item) {
|
505 |
+
// skip configurable items if families are enabled
|
506 |
+
if(Mage::getStoreConfig('bazaarvoice/feeds/families') && $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) continue;
|
|
|
507 |
|
508 |
+
$product = $bvHelper->getReviewableProductFromOrderItem($item);
|
509 |
+
if (!is_null($product)) {
|
510 |
+
$productXml = '';
|
511 |
+
$productXml .= " <Product>\n";
|
512 |
+
$productXml .= ' <ExternalId>' . $bvHelper->getProductId($product) .
|
513 |
+
"</ExternalId>\n";
|
514 |
+
$productXml .= ' <Name>' . htmlspecialchars($product->getName(), ENT_QUOTES, 'UTF-8') . "</Name>\n";
|
515 |
+
|
516 |
+
$imageUrl = $product->getImageUrl();
|
517 |
+
$originalPrice = $item->getOriginalPrice();
|
518 |
+
if(Mage::getStoreConfig('bazaarvoice/feeds/families') && $item->getParentItem()) {
|
519 |
+
$parentItem = $item->getParentItem();
|
520 |
+
$parent = Mage::getModel('catalog/product')->load($parentItem->getProductId());
|
521 |
+
|
522 |
+
if(strpos($imageUrl, "placeholder/image.jpg")){
|
523 |
+
// if product families are enabled and product has no image, use configurable image
|
524 |
+
$imageUrl = $parent->getImageUrl();
|
525 |
+
}
|
526 |
+
// also get price from parent item
|
527 |
+
$originalPrice = $parentItem->getOriginalPrice();
|
528 |
+
}
|
529 |
+
|
530 |
+
$productXml .= ' <ImageUrl>' . $imageUrl . "</ImageUrl>\n";
|
531 |
+
$productXml .= ' <Price>' . number_format((float)$originalPrice, 2) . "</Price>\n";
|
532 |
+
$productXml .= " </Product>\n";
|
533 |
+
|
534 |
+
$orderXml .= $productXml;
|
535 |
+
}
|
536 |
}
|
537 |
+
$orderXml .= " </Products>\n";
|
538 |
+
$orderXml .= "</Interaction>\n";
|
539 |
+
$ioObject->streamWrite($orderXml);
|
540 |
+
$exportedOrders[] = $orderId;
|
541 |
+
} Catch (Exception $e) {
|
542 |
+
$this->flagOrders(array($orderId), 2);
|
543 |
+
Mage::log($e->getMessage()."\n".$e->getTraceAsString());
|
544 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
|
546 |
}
|
547 |
+
Mage::log(" BV - Exported " . count($exportedOrders) . " orders.", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
548 |
|
549 |
+
return $exportedOrders;
|
550 |
+
}
|
551 |
+
|
552 |
+
private function flagOrders($orders, $flag)
|
553 |
+
{
|
554 |
+
if(count($orders)){
|
555 |
+
$resource = Mage::getSingleton('core/resource');
|
556 |
+
$writeConnection = $resource->getConnection('core_write');
|
557 |
+
$writeConnection->query("UPDATE `" . $resource->getTableName('sales/order') . "` SET `" . self::ALREADY_SENT_IN_FEED_FLAG . "` = " . $flag . " WHERE `entity_id` IN(" . implode(',', $orders) . ");");
|
558 |
+
}
|
559 |
}
|
560 |
|
561 |
private function orderToString(Mage_Sales_Model_Order $order)
|
598 |
{
|
599 |
// Have we already included this order in a previous feed?
|
600 |
if ($order->getData(self::ALREADY_SENT_IN_FEED_FLAG) === '1') {
|
601 |
+
Mage::log(' BV - Skipping Order. Already included in previous feed. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
602 |
return false;
|
603 |
}
|
604 |
|
605 |
// Is the order canceled?
|
606 |
if ($order->isCanceled()) {
|
607 |
+
Mage::log(' BV - Skipping Order. Canceled state. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
608 |
return false;
|
609 |
}
|
610 |
|
611 |
// Ensure that we can get the store for the order
|
612 |
$store = $order->getStore();
|
613 |
if (is_null($store)) {
|
614 |
+
Mage::log(' BV - Skipping Order. Could not find store for order. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
615 |
return false;
|
616 |
}
|
617 |
|
622 |
|
623 |
// Is the order completely shipped?
|
624 |
if (!$this->hasOrderCompletelyShipped($order)) {
|
625 |
+
Mage::log(' BV - Skipping Order. Not completely shipped. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
626 |
return false;
|
627 |
}
|
628 |
|
631 |
if ($latestItemShipDateTimestamp > $thresholdTimestamp) {
|
632 |
// Latest ship date for the fully shipped order is still within the delay period
|
633 |
Mage::log(' BV - Skipping Order. Ship date not outside the threshold of ' . date('c', $thresholdTimestamp) . '. ' .
|
634 |
+
$this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
635 |
return false;
|
636 |
}
|
637 |
}
|
643 |
// Order placement date is still within the delay period
|
644 |
Mage::log(' BV - Skipping Order. Order date not outside the threshold of ' . date('c', $thresholdTimestamp) .
|
645 |
'. ' .
|
646 |
+
$this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
647 |
return false;
|
648 |
}
|
649 |
}
|
654 |
|
655 |
// Do we have what basically looks like a legit email address?
|
656 |
if (!preg_match('/@/', $order->getCustomerEmail())) {
|
657 |
+
Mage::log(' BV - Skipping Order. No valid email address. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
658 |
return false;
|
659 |
}
|
660 |
|
661 |
// Does the order have any items?
|
662 |
if (count($order->getAllItems()) < 1) {
|
663 |
+
Mage::log(' BV - Skipping Order. No items in this order. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
664 |
return false;
|
665 |
}
|
666 |
|
667 |
|
668 |
if (self::DEBUG_OUTPUT) {
|
669 |
+
Mage::log(' BV - Including Order. ' . $this->orderToString($order), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
670 |
}
|
671 |
return true;
|
672 |
}
|
app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Category.php
CHANGED
@@ -284,7 +284,7 @@ class Bazaarvoice_Connector_Model_ProductFeed_Category extends Mage_Core_Model_A
|
|
284 |
$rewrite->loadByIdPath($idPath);
|
285 |
|
286 |
if ($rewrite->getId()) {
|
287 |
-
Mage::log('request path: ' . $rewrite->getRequestPath());
|
288 |
$category->setData('url', $urlInstance->getDirectUrl($rewrite->getRequestPath()));
|
289 |
Varien_Profiler::stop('REWRITE: '.__METHOD__);
|
290 |
return $category->getData('url');
|
284 |
$rewrite->loadByIdPath($idPath);
|
285 |
|
286 |
if ($rewrite->getId()) {
|
287 |
+
Mage::log('request path: ' . $rewrite->getRequestPath(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
288 |
$category->setData('url', $urlInstance->getDirectUrl($rewrite->getRequestPath()));
|
289 |
Varien_Profiler::stop('REWRITE: '.__METHOD__);
|
290 |
return $category->getData('url');
|
app/code/local/Bazaarvoice/Connector/Model/ProductFeed/Product.php
CHANGED
@@ -256,6 +256,28 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
256 |
// Generate product external ID from SKU, this is the same for all groups / stores / views
|
257 |
$productExternalId = $bvHelper->getProductId($productDefault);
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
$ioObject->streamWrite("<Product>\n" .
|
260 |
' <ExternalId>' . $productExternalId . "</ExternalId>\n" .
|
261 |
' <Name><![CDATA[' . htmlspecialchars($productDefault->getName(), ENT_QUOTES, 'UTF-8') . "]]></Name>\n" .
|
@@ -267,18 +289,6 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
267 |
$ioObject->streamWrite(' <BrandExternalId>' . $brandId . "</BrandExternalId>\n");
|
268 |
}
|
269 |
|
270 |
-
/* Make sure that CategoryExternalId is one written to Category section */
|
271 |
-
if($productDefault->getData("product_families") && $productDefault->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE){
|
272 |
-
// if families are enabled and product is not visible, use parent categories
|
273 |
-
$parentId = array_pop($productDefault->getData("product_families"));
|
274 |
-
$parentProduct = $bvHelper->getProductFromProductExternalId($parentId);
|
275 |
-
$parentCategories = $parentProduct->getCategoryIds();
|
276 |
-
Mage::log("Product ".$productDefault->getSku()." using parent categories from ".$parentProduct->getSku());
|
277 |
-
} else {
|
278 |
-
// normal behavior
|
279 |
-
$parentCategories = $productDefault->getCategoryIds();
|
280 |
-
Mage::log("Product ".$productDefault->getSku()." using its own categories");
|
281 |
-
}
|
282 |
if (!is_null($parentCategories) && count($parentCategories) > 0) {
|
283 |
foreach ($parentCategories as $parentCategoryId) {
|
284 |
$parentCategory = Mage::getModel('catalog/category')->setStoreId($productDefault->getStoreId())->load($parentCategoryId);
|
@@ -289,13 +299,14 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
289 |
"</CategoryExternalId>\n");
|
290 |
break;
|
291 |
} else {
|
292 |
-
Mage::log("
|
293 |
}
|
294 |
}
|
295 |
}
|
296 |
}
|
297 |
|
298 |
-
|
|
|
299 |
if($upcAttribute && $productDefault->getData($upcAttribute)) {
|
300 |
$ioObject->streamWrite(' <UPCs><UPC>' . $productDefault->getData($upcAttribute) . "</UPC></UPCs>\n");
|
301 |
}
|
@@ -381,9 +392,9 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
381 |
}
|
382 |
}
|
383 |
catch (Exception $e) {
|
384 |
-
Mage::log('Failed to get families for product sku: ' . $product->getSku());
|
385 |
-
Mage::log($e->getMessage()."\n".$e->getTraceAsString());
|
386 |
-
Mage::log('Continuing generating feed.');
|
387 |
}
|
388 |
return $families;
|
389 |
}
|
@@ -403,8 +414,11 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
403 |
$parents = $product->getData("product_families");
|
404 |
$parentId = array_pop($parents);
|
405 |
$parent = Mage::helper("bazaarvoice")->getProductFromProductExternalId($parentId);
|
406 |
-
|
407 |
-
|
|
|
|
|
|
|
408 |
}
|
409 |
if(strpos($defaultStoreImageUrl, 'no_selection'))
|
410 |
$defaultStoreImageUrl = Mage::helper('catalog/image')->init($product, 'image');
|
@@ -419,8 +433,8 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
419 |
return $imageUrl;
|
420 |
}
|
421 |
catch (Exception $e) {
|
422 |
-
Mage::log('Failed to get image URL for product sku: ' . $product->getSku());
|
423 |
-
Mage::log('Continuing generating feed.');
|
424 |
|
425 |
return '';
|
426 |
}
|
@@ -434,8 +448,10 @@ class Bazaarvoice_Connector_Model_ProductFeed_Product extends Mage_Core_Model_Ab
|
|
434 |
$parents = $product->getData("product_families");
|
435 |
$parentId = array_pop($parents);
|
436 |
$parent = Mage::helper("bazaarvoice")->getProductFromProductExternalId($parentId);
|
437 |
-
|
438 |
-
|
|
|
|
|
439 |
} else {
|
440 |
// otherwise use default
|
441 |
$productUrl = $product->getProductUrl(false);
|
256 |
// Generate product external ID from SKU, this is the same for all groups / stores / views
|
257 |
$productExternalId = $bvHelper->getProductId($productDefault);
|
258 |
|
259 |
+
/* Make sure that CategoryExternalId is one written to Category section */
|
260 |
+
if($productDefault->getData("product_families") && $productDefault->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE){
|
261 |
+
// if families are enabled and product is not visible, use parent categories
|
262 |
+
$parentId = array_pop($productDefault->getData("product_families"));
|
263 |
+
$parentProduct = $bvHelper->getProductFromProductExternalId($parentId);
|
264 |
+
|
265 |
+
// skip product if parent is disabled
|
266 |
+
if($parentProduct->getVisiblity() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE || $parentProduct->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
|
267 |
+
Mage::log(" 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);
|
268 |
+
return true;
|
269 |
+
}
|
270 |
+
|
271 |
+
if (!is_null($parentProduct->getCategoryIds())){
|
272 |
+
$parentCategories = $parentProduct->getCategoryIds();
|
273 |
+
Mage::log(" Product ".$productDefault->getSku()." using parent categories from ".$parentProduct->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
274 |
+
}
|
275 |
+
} else {
|
276 |
+
// normal behavior
|
277 |
+
$parentCategories = $productDefault->getCategoryIds();
|
278 |
+
Mage::log(" Product ".$productDefault->getSku()." using its own categories", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
279 |
+
}
|
280 |
+
|
281 |
$ioObject->streamWrite("<Product>\n" .
|
282 |
' <ExternalId>' . $productExternalId . "</ExternalId>\n" .
|
283 |
' <Name><![CDATA[' . htmlspecialchars($productDefault->getName(), ENT_QUOTES, 'UTF-8') . "]]></Name>\n" .
|
289 |
$ioObject->streamWrite(' <BrandExternalId>' . $brandId . "</BrandExternalId>\n");
|
290 |
}
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
if (!is_null($parentCategories) && count($parentCategories) > 0) {
|
293 |
foreach ($parentCategories as $parentCategoryId) {
|
294 |
$parentCategory = Mage::getModel('catalog/category')->setStoreId($productDefault->getStoreId())->load($parentCategoryId);
|
299 |
"</CategoryExternalId>\n");
|
300 |
break;
|
301 |
} else {
|
302 |
+
Mage::log(" Category $categoryExternalId not found", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
303 |
}
|
304 |
}
|
305 |
}
|
306 |
}
|
307 |
|
308 |
+
//$upcAttribute = Mage::getStoreConfig("bazaarvoice/bv_config/product_feed_upc_attribute_code");
|
309 |
+
$upcAttribute = 'upc_code';
|
310 |
if($upcAttribute && $productDefault->getData($upcAttribute)) {
|
311 |
$ioObject->streamWrite(' <UPCs><UPC>' . $productDefault->getData($upcAttribute) . "</UPC></UPCs>\n");
|
312 |
}
|
392 |
}
|
393 |
}
|
394 |
catch (Exception $e) {
|
395 |
+
Mage::log('Failed to get families for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
396 |
+
Mage::log($e->getMessage()."\n".$e->getTraceAsString(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
397 |
+
Mage::log('Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
398 |
}
|
399 |
return $families;
|
400 |
}
|
414 |
$parents = $product->getData("product_families");
|
415 |
$parentId = array_pop($parents);
|
416 |
$parent = Mage::helper("bazaarvoice")->getProductFromProductExternalId($parentId);
|
417 |
+
if (is_object($parent)){
|
418 |
+
$parent = Mage::getModel('catalog/product')->load($parent->getId());
|
419 |
+
$parent->setStore($storeId);
|
420 |
+
$defaultStoreImageUrl = Mage::getModel('catalog/product_media_config')->getMediaUrl($parent->getImage());
|
421 |
+
}
|
422 |
}
|
423 |
if(strpos($defaultStoreImageUrl, 'no_selection'))
|
424 |
$defaultStoreImageUrl = Mage::helper('catalog/image')->init($product, 'image');
|
433 |
return $imageUrl;
|
434 |
}
|
435 |
catch (Exception $e) {
|
436 |
+
Mage::log('Failed to get image URL for product sku: ' . $product->getSku(), Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
437 |
+
Mage::log('Continuing generating feed.', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
438 |
|
439 |
return '';
|
440 |
}
|
448 |
$parents = $product->getData("product_families");
|
449 |
$parentId = array_pop($parents);
|
450 |
$parent = Mage::helper("bazaarvoice")->getProductFromProductExternalId($parentId);
|
451 |
+
if (is_object($parent)){
|
452 |
+
$parent->setStoreId($product->getStoreId());
|
453 |
+
$productUrl = $parent->getProductUrl(false);
|
454 |
+
}
|
455 |
} else {
|
456 |
// otherwise use default
|
457 |
$productUrl = $product->getProductUrl(false);
|
app/code/local/Bazaarvoice/Connector/Model/RetrieveInlineRatingsFeed.php
CHANGED
@@ -17,7 +17,7 @@ class Bazaarvoice_Connector_Model_RetrieveInlineRatingsFeed extends Mage_Core_Mo
|
|
17 |
public function retrieveInlineRatingsFeed()
|
18 |
{
|
19 |
// Log
|
20 |
-
Mage::log('Start Bazaarvoice Inline Ratings feed import');
|
21 |
// Iterate through all stores / groups in this instance
|
22 |
// (Not the 'admin' store view, which represents admin panel)
|
23 |
$groups = Mage::app()->getGroups(false);
|
@@ -26,7 +26,7 @@ class Bazaarvoice_Connector_Model_RetrieveInlineRatingsFeed extends Mage_Core_Mo
|
|
26 |
try {
|
27 |
if (self::INLINE_RATINGS_FEED_ENABLED && Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1') {
|
28 |
if(count($group->getStores()) > 0) {
|
29 |
-
Mage::log(' BV - Importing Inline Ratings feed for store group: ' . $group->getName(), Zend_Log::INFO);
|
30 |
$this->retrieveInlineRatingsFeedForStoreGroup($group);
|
31 |
}
|
32 |
else {
|
@@ -34,17 +34,17 @@ class Bazaarvoice_Connector_Model_RetrieveInlineRatingsFeed extends Mage_Core_Mo
|
|
34 |
}
|
35 |
}
|
36 |
else {
|
37 |
-
Mage::log(' BV - Inline Ratings feed disabled for store group: ' . $group->getName(), Zend_Log::INFO);
|
38 |
}
|
39 |
} catch (Exception $e) {
|
40 |
-
Mage::log(' BV - Failed to import Inline Ratings feed for store group: ' . $group->getName(), Zend_Log::ERR);
|
41 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
42 |
Mage::logException($e);
|
43 |
// Continue processing other store groups
|
44 |
}
|
45 |
}
|
46 |
// Log
|
47 |
-
Mage::log('End Bazaarvoice Inline Ratings feed import');
|
48 |
}
|
49 |
|
50 |
/**
|
@@ -151,9 +151,9 @@ class Bazaarvoice_Connector_Model_RetrieveInlineRatingsFeed extends Mage_Core_Mo
|
|
151 |
$product->getResource()->saveAttribute($product, 'bv_review_count');
|
152 |
$product->getResource()->saveAttribute($product, 'bv_rating_range');
|
153 |
|
154 |
-
Mage::log(' BV - InlineRating for product ' . $bvProductExternalId . ' = {' . $productAverageRating . ', ' . $productReviewCount . ', ' . $productRatingRange . '}');
|
155 |
} else {
|
156 |
-
Mage::log(" BV - Could not find product for ExternalID '" . $bvProductExternalId . "'");
|
157 |
}
|
158 |
}
|
159 |
|
17 |
public function retrieveInlineRatingsFeed()
|
18 |
{
|
19 |
// Log
|
20 |
+
Mage::log('Start Bazaarvoice Inline Ratings feed import', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
21 |
// Iterate through all stores / groups in this instance
|
22 |
// (Not the 'admin' store view, which represents admin panel)
|
23 |
$groups = Mage::app()->getGroups(false);
|
26 |
try {
|
27 |
if (self::INLINE_RATINGS_FEED_ENABLED && Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1') {
|
28 |
if(count($group->getStores()) > 0) {
|
29 |
+
Mage::log(' BV - Importing Inline Ratings feed for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
30 |
$this->retrieveInlineRatingsFeedForStoreGroup($group);
|
31 |
}
|
32 |
else {
|
34 |
}
|
35 |
}
|
36 |
else {
|
37 |
+
Mage::log(' BV - Inline Ratings feed disabled for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
38 |
}
|
39 |
} catch (Exception $e) {
|
40 |
+
Mage::log(' BV - Failed to import Inline Ratings feed for store group: ' . $group->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
41 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
42 |
Mage::logException($e);
|
43 |
// Continue processing other store groups
|
44 |
}
|
45 |
}
|
46 |
// Log
|
47 |
+
Mage::log('End Bazaarvoice Inline Ratings feed import', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
48 |
}
|
49 |
|
50 |
/**
|
151 |
$product->getResource()->saveAttribute($product, 'bv_review_count');
|
152 |
$product->getResource()->saveAttribute($product, 'bv_rating_range');
|
153 |
|
154 |
+
Mage::log(' BV - InlineRating for product ' . $bvProductExternalId . ' = {' . $productAverageRating . ', ' . $productReviewCount . ', ' . $productRatingRange . '}', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
155 |
} else {
|
156 |
+
Mage::log(" BV - Could not find product for ExternalID '" . $bvProductExternalId . "'", Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
157 |
}
|
158 |
}
|
159 |
|
app/code/local/Bazaarvoice/Connector/Model/RetrieveSmartSEOPackage.php
CHANGED
@@ -12,10 +12,10 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
12 |
public function retrieveSmartSEOPackage()
|
13 |
{
|
14 |
// Disable smart SEO feed for now
|
15 |
-
Mage::log('Smart SEO feed import is not enabled!');
|
16 |
return;
|
17 |
// Log
|
18 |
-
Mage::log('Start Bazaarvoice Smart SEO feed import');
|
19 |
// Iterate through all stores / groups in this instance
|
20 |
// (Not the 'admin' store view, which represents admin panel)
|
21 |
$groups = Mage::app()->getGroups(false);
|
@@ -25,7 +25,7 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
25 |
if (Mage::getStoreConfig('bazaarvoice/SmartSEOFeed/EnableSmartSEO', $group->getDefaultStoreId()) === '1'
|
26 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1') {
|
27 |
if(count($group->getStores()) > 0) {
|
28 |
-
Mage::log(' BV - Importing Smart SEO feed for store group: ' . $group->getName(), Zend_Log::INFO);
|
29 |
$this->retrieveSmartSEOPackageForStoreGroup($group);
|
30 |
}
|
31 |
else {
|
@@ -33,17 +33,17 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
33 |
}
|
34 |
}
|
35 |
else {
|
36 |
-
Mage::log(' BV - Smart SEO feed disabled for store group: ' . $group->getName(), Zend_Log::INFO);
|
37 |
}
|
38 |
} catch (Exception $e) {
|
39 |
-
Mage::log(' BV - Failed to import Smart SEO feed for store group: ' . $group->getName(), Zend_Log::ERR);
|
40 |
-
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR);
|
41 |
Mage::logException($e);
|
42 |
// Continue processing other store groups
|
43 |
}
|
44 |
}
|
45 |
// Log
|
46 |
-
Mage::log('End Bazaarvoice Smart SEO feed import');
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -66,7 +66,7 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
66 |
$desiredExt = '.tar.gz';
|
67 |
if (substr_compare($remoteFile, $desiredExt, -strlen($desiredExt), strlen($desiredExt)) !== 0) {
|
68 |
$msg = 'BV - Unable to retrieve and process a .zip SmartSEO feed. Only .tar.gz SmartSEO feeds can be processed by this extension';
|
69 |
-
Mage::log($msg);
|
70 |
Mage::throwException($msg);
|
71 |
}
|
72 |
|
@@ -87,7 +87,7 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
87 |
$subject = 'Bazaarvoice SmartSEO Content Unavailable';
|
88 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server and there were no pre-existing SmartSEO files already in your Magento store.';
|
89 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
90 |
-
Mage::log($msg);
|
91 |
Mage::throwException($msg);
|
92 |
}
|
93 |
|
@@ -103,14 +103,14 @@ class Bazaarvoice_Connector_Model_RetrieveSmartSEOPackage extends Mage_Core_Mode
|
|
103 |
$subject = 'Bazaarvoice SmartSEO Content Unavailable';
|
104 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server and the existing SmartSEO files that are already in the Magento store have expired.';
|
105 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
106 |
-
Mage::log($msg);
|
107 |
Mage::throwException($msg);
|
108 |
} else {
|
109 |
// Couldn't download the file, but the old files that we already have are still usable
|
110 |
$subject = "Bazaarvoice SmartSEO Content Couldn't be Updated";
|
111 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server. The existing files will continue to be used.';
|
112 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
113 |
-
Mage::log($msg);
|
114 |
Mage::throwException($msg);
|
115 |
}
|
116 |
|
12 |
public function retrieveSmartSEOPackage()
|
13 |
{
|
14 |
// Disable smart SEO feed for now
|
15 |
+
Mage::log('Smart SEO feed import is not enabled!', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
16 |
return;
|
17 |
// Log
|
18 |
+
Mage::log('Start Bazaarvoice Smart SEO feed import', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
19 |
// Iterate through all stores / groups in this instance
|
20 |
// (Not the 'admin' store view, which represents admin panel)
|
21 |
$groups = Mage::app()->getGroups(false);
|
25 |
if (Mage::getStoreConfig('bazaarvoice/SmartSEOFeed/EnableSmartSEO', $group->getDefaultStoreId()) === '1'
|
26 |
&& Mage::getStoreConfig('bazaarvoice/general/enable_bv', $group->getDefaultStoreId()) === '1') {
|
27 |
if(count($group->getStores()) > 0) {
|
28 |
+
Mage::log(' BV - Importing Smart SEO feed for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
29 |
$this->retrieveSmartSEOPackageForStoreGroup($group);
|
30 |
}
|
31 |
else {
|
33 |
}
|
34 |
}
|
35 |
else {
|
36 |
+
Mage::log(' BV - Smart SEO feed disabled for store group: ' . $group->getName(), Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
37 |
}
|
38 |
} catch (Exception $e) {
|
39 |
+
Mage::log(' BV - Failed to import Smart SEO feed for store group: ' . $group->getName(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
40 |
+
Mage::log(' BV - Error message: ' . $e->getMessage(), Zend_Log::ERR, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
41 |
Mage::logException($e);
|
42 |
// Continue processing other store groups
|
43 |
}
|
44 |
}
|
45 |
// Log
|
46 |
+
Mage::log('End Bazaarvoice Smart SEO feed import', Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
47 |
}
|
48 |
|
49 |
/**
|
66 |
$desiredExt = '.tar.gz';
|
67 |
if (substr_compare($remoteFile, $desiredExt, -strlen($desiredExt), strlen($desiredExt)) !== 0) {
|
68 |
$msg = 'BV - Unable to retrieve and process a .zip SmartSEO feed. Only .tar.gz SmartSEO feeds can be processed by this extension';
|
69 |
+
Mage::log($msg, Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
70 |
Mage::throwException($msg);
|
71 |
}
|
72 |
|
87 |
$subject = 'Bazaarvoice SmartSEO Content Unavailable';
|
88 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server and there were no pre-existing SmartSEO files already in your Magento store.';
|
89 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
90 |
+
Mage::log($msg, Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
91 |
Mage::throwException($msg);
|
92 |
}
|
93 |
|
103 |
$subject = 'Bazaarvoice SmartSEO Content Unavailable';
|
104 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server and the existing SmartSEO files that are already in the Magento store have expired.';
|
105 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
106 |
+
Mage::log($msg, Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
107 |
Mage::throwException($msg);
|
108 |
} else {
|
109 |
// Couldn't download the file, but the old files that we already have are still usable
|
110 |
$subject = "Bazaarvoice SmartSEO Content Couldn't be Updated";
|
111 |
$msg = 'The Bazaarvoice extension in your Magento store was unable to download new SmartSEO files from the Bazaarvoice server. The existing files will continue to be used.';
|
112 |
Mage::helper('bazaarvoice')->sendNotificationEmail($subject, $msg);
|
113 |
+
Mage::log($msg, Zend_Log::DEBUG, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
114 |
Mage::throwException($msg);
|
115 |
}
|
116 |
|
app/code/local/Bazaarvoice/Connector/etc/config.xml
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<config>
|
9 |
<modules>
|
10 |
<Bazaarvoice_Connector>
|
11 |
-
<version>6.1.
|
12 |
<depends>
|
13 |
<!-- no dependencies -->
|
14 |
</depends>
|
8 |
<config>
|
9 |
<modules>
|
10 |
<Bazaarvoice_Connector>
|
11 |
+
<version>6.1.2</version>
|
12 |
<depends>
|
13 |
<!-- no dependencies -->
|
14 |
</depends>
|
app/code/local/Bazaarvoice/Connector/sql/bazaarvoice_setup/mysql4-install-0.1.0.php
CHANGED
@@ -9,7 +9,7 @@ $installer->startSetup();
|
|
9 |
* As this is a flat table, it adds the column to the table (SALES_FLAT_ORDER).
|
10 |
**/
|
11 |
|
12 |
-
Mage::log("BV: Installing v0.1.0");
|
13 |
$installer->addAttribute('order', Bazaarvoice_Connector_Model_ExportPurchaseFeed::ALREADY_SENT_IN_FEED_FLAG, array('type'=>'int'));
|
14 |
|
15 |
$installer->endSetup();
|
9 |
* As this is a flat table, it adds the column to the table (SALES_FLAT_ORDER).
|
10 |
**/
|
11 |
|
12 |
+
Mage::log("BV: Installing v0.1.0", Zend_Log::INFO, Bazaarvoice_Connector_Helper_Data::LOG_FILE);
|
13 |
$installer->addAttribute('order', Bazaarvoice_Connector_Model_ExportPurchaseFeed::ALREADY_SENT_IN_FEED_FLAG, array('type'=>'int'));
|
14 |
|
15 |
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bazaarvoice_Connector</name>
|
4 |
-
<version>6.1.
|
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-06-
|
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="
|
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.1.2</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-06-17</date>
|
14 |
+
<time>14:26:38</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="5cfafc5ec48701db0fc9775b80f9b6a1"/></dir><file name="Submissioncontainer.php" hash="23d04ee9ece011d107bb8b914653a24d"/></dir><dir name="Helper"><file name="Data.php" hash="ccc1e8c97237694af586d9854f70fa88"/></dir><dir name="Model"><file name="ExportProductFeed.php" hash="7d6f5cf0b9de32d7adf93d1d94a3d05f"/><file name="ExportPurchaseFeed.php" hash="6c89b9205e45151552267913264531e6"/><dir name="Mysql4"><file name="Setup.php" hash="884c886c1e9fa395f05e7872ba6478a2"/></dir><dir name="ProductFeed"><file name="Brand.php" hash="b2ab72e79d7e3afe23b38bc3b64ba115"/><file name="Category.php" hash="4a496f6d209a54c4fe6568a80a8abb33"/><file name="Product.php" hash="ab0187f4c2a44027ea280f5d84294326"/></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="860c8628c9622f2b6907a5b93a8eabe3"/><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="1d15f0db486bc571c8f6f7e440a74feb"/></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>
|