Version Notes
MyBuys Website Code & Data Feed Integration
Download this release
Release Info
Developer | MyBuys Sandbox |
Extension | MyBuys_Personalization_Extension |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.1.0
- app/code/community/Mybuys/Connector/Helper/Data.php +178 -10
- app/code/community/Mybuys/Connector/Helper/SftpConnection.php +9 -9
- app/code/community/Mybuys/Connector/Helper/Tsvfile.php +7 -4
- app/code/community/Mybuys/Connector/Model/Feed/Base.php +27 -23
- app/code/community/Mybuys/Connector/Model/Feed/Email/Optin.php +1 -2
- app/code/community/Mybuys/Connector/Model/Feed/Email/Optout.php +1 -2
- app/code/community/Mybuys/Connector/Model/Feed/Product.php +1 -1
- app/code/community/Mybuys/Connector/Model/Feed/Transaction.php +12 -8
- app/code/community/Mybuys/Connector/Model/Generatefeeds.php +1 -1
- app/code/community/Mybuys/Connector/Model/Job.php +23 -23
- app/code/community/Mybuys/Connector/Model/Layout.php +57 -0
- app/code/community/Mybuys/Connector/Model/Observer.php +22 -22
- app/code/community/Mybuys/Connector/Model/System/Config/LogOptions.php +16 -0
- app/code/community/Mybuys/Connector/Model/Transferfeeds.php +16 -16
- app/code/community/Mybuys/Connector/etc/config.xml +10 -2
- app/code/community/Mybuys/Connector/etc/system.xml +81 -17
- app/design/frontend/base/default/layout/mybuys/websitecode.xml +12 -17
- app/design/frontend/base/default/layout/mybuys/websitecode_sort.xml +111 -0
- app/design/frontend/base/default/template/mybuys/websitecode/header.phtml +9 -9
- app/design/frontend/base/default/template/mybuys/websitecode/params/cat_high_level.phtml +0 -19
- app/design/frontend/base/default/template/mybuys/websitecode/params/cat_leaf.phtml +0 -20
- app/design/frontend/base/default/template/mybuys/websitecode/params/category.phtml +25 -0
- app/design/frontend/base/default/template/mybuys/websitecode/params/wishlist.phtml +0 -5
- app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_cat_high.phtml +0 -7
- app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_cat_leaf.phtml +0 -7
- app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_category.phtml +16 -0
- app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_wishlist.phtml +0 -7
- app/design/frontend/base/default/template/mybuys/websitecode/test/default.phtml +4 -0
- app/design/frontend/base/default/template/mybuys/websitecode/test/high.phtml +4 -0
- app/design/frontend/base/default/template/mybuys/websitecode/test/leaf.phtml +4 -0
- app/etc/modules/Mybuys_Connector.xml +2 -2
- package.xml +6 -6
app/code/community/Mybuys/Connector/Helper/Data.php
CHANGED
@@ -13,22 +13,30 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
13 |
/**
|
14 |
* Constants
|
15 |
*/
|
16 |
-
const LOG_FILE
|
|
|
17 |
/*
|
18 |
* Example of how logging should be done in this extension:
|
19 |
-
* Mage::log($message, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
20 |
*/
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
public function sendErrorEmail($websiteId, $error)
|
23 |
{
|
24 |
try {
|
25 |
// Get recipients
|
26 |
$recipients = explode(',', Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/notification/emails'));
|
27 |
if (!count($recipients)) {
|
28 |
-
|
29 |
return;
|
30 |
}
|
31 |
-
|
32 |
// Create Zend_Mail
|
33 |
$mail = new Zend_Mail();
|
34 |
|
@@ -38,7 +46,9 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
38 |
}
|
39 |
|
40 |
// Subject
|
41 |
-
$
|
|
|
|
|
42 |
|
43 |
// Body
|
44 |
$sBody = 'Timestamp: ' . Mage::getSingleton('core/date')->gmtDate() . "\n\n";
|
@@ -46,16 +56,74 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
46 |
$mail->setBodyText($sBody);
|
47 |
|
48 |
// From
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
// Send
|
52 |
$mail->send();
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
catch(Exception $e) {
|
55 |
// Log exception
|
56 |
Mage::logException($e);
|
57 |
-
Mage::log('Failed to send error email, error: ', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
58 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
59 |
}
|
60 |
}
|
61 |
|
@@ -63,7 +131,7 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
63 |
* Validate feed configuration settings for one website or all websites
|
64 |
*
|
65 |
*/
|
66 |
-
public function validateFeedConfiguration($websiteId)
|
67 |
{
|
68 |
// Check input params
|
69 |
$websites = array();
|
@@ -107,7 +175,7 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
107 |
{
|
108 |
// Log
|
109 |
Mage::logException($e);
|
110 |
-
|
111 |
// Throw proper error message
|
112 |
Mage::throwException('Error looking up feed transfer connectivity parameters for website id: ' . $curWebsiteId);
|
113 |
}
|
@@ -133,5 +201,105 @@ class Mybuys_Connector_Helper_Data extends Mage_Core_Helper_Abstract
|
|
133 |
}
|
134 |
}
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
13 |
/**
|
14 |
* Constants
|
15 |
*/
|
16 |
+
const LOG_FILE = 'mybuys.log';
|
17 |
+
const TAIL_SIZE = 5000;
|
18 |
/*
|
19 |
* Example of how logging should be done in this extension:
|
20 |
+
* Mage::helper('mybuys')->log($message, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
21 |
*/
|
22 |
|
23 |
+
public function log ($message, $level=null,$file=null,$force=false ) {
|
24 |
+
$force = $force ||
|
25 |
+
(Mage::getStoreConfig('mybuys_datafeeds/advanced/force_logging')!=="disabled");
|
26 |
+
Mage::log($message,$level,$file,$force);
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
public function sendErrorEmail($websiteId, $error)
|
31 |
{
|
32 |
try {
|
33 |
// Get recipients
|
34 |
$recipients = explode(',', Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/notification/emails'));
|
35 |
if (!count($recipients)) {
|
36 |
+
Mage::helper('mybuys')->log('No recipients for error email', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
37 |
return;
|
38 |
}
|
39 |
+
|
40 |
// Create Zend_Mail
|
41 |
$mail = new Zend_Mail();
|
42 |
|
46 |
}
|
47 |
|
48 |
// Subject
|
49 |
+
$clientId= Mage::app()->getWebsite($websiteId)->getConfig('mybuys_websitecode/general/identifier');
|
50 |
+
$mail->setSubject('MyBuys Magento Extension Error Notification for Client ID '. $clientId .
|
51 |
+
' - ' . Mage::getSingleton('core/date')->gmtDate());
|
52 |
|
53 |
// Body
|
54 |
$sBody = 'Timestamp: ' . Mage::getSingleton('core/date')->gmtDate() . "\n\n";
|
56 |
$mail->setBodyText($sBody);
|
57 |
|
58 |
// From
|
59 |
+
$from = Mage::app()->getWebsite($websiteId)->getConfig('trans_email/ident_general/email')!="" ?
|
60 |
+
Mage::app()->getWebsite($websiteId)->getConfig('trans_email/ident_general/email'):
|
61 |
+
Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/notification/sendlog');
|
62 |
+
$mail->setFrom($from);
|
63 |
+
|
64 |
+
$sendLogOption = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/notification/sendlog');
|
65 |
+
|
66 |
+
$logFilePath = Mage::getBaseDir('log') . DS . Mybuys_Connector_Helper_Data::LOG_FILE;
|
67 |
+
|
68 |
+
switch ($sendLogOption) {
|
69 |
+
case 'none': {
|
70 |
+
break;
|
71 |
+
}
|
72 |
+
|
73 |
+
case 'link': {
|
74 |
+
//get secure link to log
|
75 |
+
$logFileUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB,true) ."var/log/". Mybuys_Connector_Helper_Data::LOG_FILE;
|
76 |
+
$sBody .= "Link to log file = ".$logFileUrl . "\n";
|
77 |
+
$sBody .= "*Note: You must allow access to the mybuys.log file located in /var/log/ through the .htaccess file for this directory. \n";
|
78 |
+
$mail->setBodyText($sBody);
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
|
82 |
+
case 'partial': {
|
83 |
+
$buffer=$this->tail($logFilePath,Mybuys_Connector_Helper_Data::TAIL_SIZE,4096);
|
84 |
+
$tmpFileName = Mage::getBaseDir('var') . DS . Mybuys_Connector_Model_Generatefeeds::MBUYS_FEED_PATH . DS . "mybuys_tail.log";
|
85 |
+
$tmpZipFile = Mage::getBaseDir('var') . DS . Mybuys_Connector_Model_Generatefeeds::MBUYS_FEED_PATH . DS . "mybuyslog.zip";
|
86 |
+
$tmpFile = fopen($tmpFileName,"w");
|
87 |
+
fwrite($tmpFile,$buffer);
|
88 |
+
fclose($tmpFile);
|
89 |
+
$this->createZip(array($tmpFileName),$tmpZipFile);
|
90 |
+
|
91 |
+
$at = new Zend_Mime_Part(file_get_contents($tmpZipFile));
|
92 |
+
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
|
93 |
+
$at->encoding = Zend_Mime::ENCODING_BASE64;
|
94 |
+
$at->filename = 'MyBuysLog.zip';
|
95 |
+
$at->type = 'application/zip';
|
96 |
+
$mail->addAttachment($at);
|
97 |
+
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
|
101 |
+
case 'zipped' : {
|
102 |
+
$tmpZipFile = Mage::getBaseDir('var') . DS . Mybuys_Connector_Model_Generatefeeds::MBUYS_FEED_PATH . DS . "mybuyslog-".time().".zip";
|
103 |
+
$this->createZip(array($logFilePath),$tmpZipFile);
|
104 |
+
|
105 |
+
$at = new Zend_Mime_Part(file_get_contents($tmpZipFile));
|
106 |
+
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
|
107 |
+
$at->encoding = Zend_Mime::ENCODING_BASE64;
|
108 |
+
$at->filename = 'MyBuysLog.zip';
|
109 |
+
$at->type = 'application/zip';
|
110 |
+
$mail->addAttachment($at);
|
111 |
+
break;
|
112 |
+
}
|
113 |
+
}
|
114 |
|
115 |
// Send
|
116 |
$mail->send();
|
117 |
+
|
118 |
+
//clean up any tmp files
|
119 |
+
if (isset($tmpFileName)) unlink($tmpZipFile);
|
120 |
+
if (isset($tmpFileName)) unlink($tmpFileName);
|
121 |
}
|
122 |
catch(Exception $e) {
|
123 |
// Log exception
|
124 |
Mage::logException($e);
|
125 |
+
Mage::helper('mybuys')->log('Failed to send error email, error: ', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
126 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
127 |
}
|
128 |
}
|
129 |
|
131 |
* Validate feed configuration settings for one website or all websites
|
132 |
*
|
133 |
*/
|
134 |
+
public function validateFeedConfiguration($websiteId=null)
|
135 |
{
|
136 |
// Check input params
|
137 |
$websites = array();
|
175 |
{
|
176 |
// Log
|
177 |
Mage::logException($e);
|
178 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
179 |
// Throw proper error message
|
180 |
Mage::throwException('Error looking up feed transfer connectivity parameters for website id: ' . $curWebsiteId);
|
181 |
}
|
201 |
}
|
202 |
}
|
203 |
|
204 |
+
//from http://www.geekality.net/2011/05/28/php-tail-tackling-large-files/
|
205 |
+
private function tail($filename, $lines = 10, $buffer = 4096)
|
206 |
+
{
|
207 |
+
// Open the file
|
208 |
+
$f = fopen($filename, "rb");
|
209 |
+
|
210 |
+
// Jump to last character
|
211 |
+
fseek($f, -1, SEEK_END);
|
212 |
+
|
213 |
+
// Read it and adjust line number if necessary
|
214 |
+
// (Otherwise the result would be wrong if file doesn't end with a blank line)
|
215 |
+
if(fread($f, 1) != "\n") $lines -= 1;
|
216 |
+
|
217 |
+
// Start reading
|
218 |
+
$output = '';
|
219 |
+
$chunk = '';
|
220 |
+
|
221 |
+
// While we would like more
|
222 |
+
while(ftell($f) > 0 && $lines >= 0)
|
223 |
+
{
|
224 |
+
// Figure out how far back we should jump
|
225 |
+
$seek = min(ftell($f), $buffer);
|
226 |
+
|
227 |
+
// Do the jump (backwards, relative to where we are)
|
228 |
+
fseek($f, -$seek, SEEK_CUR);
|
229 |
+
|
230 |
+
// Read a chunk and prepend it to our output
|
231 |
+
$output = ($chunk = fread($f, $seek)).$output;
|
232 |
+
|
233 |
+
// Jump back to where we started reading
|
234 |
+
fseek($f, -mb_strlen($chunk, '8bit'), SEEK_CUR);
|
235 |
+
|
236 |
+
// Decrease our line counter
|
237 |
+
$lines -= substr_count($chunk, "\n");
|
238 |
+
}
|
239 |
+
|
240 |
+
// While we have too many lines
|
241 |
+
// (Because of buffer size we might have read too many)
|
242 |
+
while($lines++ < 0)
|
243 |
+
{
|
244 |
+
// Find first newline and remove all text before that
|
245 |
+
$output = substr($output, strpos($output, "\n") + 1);
|
246 |
+
}
|
247 |
+
|
248 |
+
// Close file and return
|
249 |
+
fclose($f);
|
250 |
+
return $output;
|
251 |
+
}
|
252 |
+
|
253 |
+
//http://davidwalsh.name/create-zip-php
|
254 |
+
/* creates a compressed zip file */
|
255 |
+
function createZip($files = array(), $destination = '', $overwrite = false)
|
256 |
+
{
|
257 |
+
//if the zip file already exists and overwrite is false, return false
|
258 |
+
if (file_exists($destination) && !$overwrite) {
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
//vars
|
262 |
+
$valid_files = array();
|
263 |
+
//if files were passed in...
|
264 |
+
if (is_array($files)) {
|
265 |
+
//cycle through each file
|
266 |
+
foreach ($files as $file) {
|
267 |
+
//make sure the file exists
|
268 |
+
if (file_exists($file)) {
|
269 |
+
$valid_files[] = $file;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
273 |
+
//if we have good files...
|
274 |
+
if (count($valid_files)) {
|
275 |
+
//create the archive
|
276 |
+
$zip = new ZipArchive();
|
277 |
+
if ($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
|
278 |
+
return false;
|
279 |
+
}
|
280 |
+
//add the files
|
281 |
+
foreach ($valid_files as $file) {
|
282 |
+
$zip->addFile($file, basename($file));
|
283 |
+
}
|
284 |
+
//debug
|
285 |
+
//echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;
|
286 |
+
//close the zip -- done!
|
287 |
+
|
288 |
+
$zip->close();
|
289 |
+
|
290 |
+
//check to make sure the file exists
|
291 |
+
return file_exists($destination);
|
292 |
+
} else {
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* True if the version of Magento currently being run is Enterprise Edition
|
299 |
+
*/
|
300 |
+
public function isMageEnterprise() {
|
301 |
+
return Mage::getConfig ()->getModuleConfig ( 'Enterprise_Enterprise' ) && Mage::getConfig ()->getModuleConfig ( 'Enterprise_AdminGws' ) && Mage::getConfig ()->getModuleConfig ( 'Enterprise_Checkout' ) && Mage::getConfig ()->getModuleConfig ( 'Enterprise_Customer' );
|
302 |
+
}
|
303 |
+
|
304 |
}
|
305 |
|
app/code/community/Mybuys/Connector/Helper/SftpConnection.php
CHANGED
@@ -80,9 +80,9 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
80 |
{
|
81 |
// Log
|
82 |
Mage::logException($e);
|
83 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
84 |
if ($this->_oConnection->getLastSFTPError())
|
85 |
-
Mage::log("SFTP reported error is ". $this->_oConnection->getLastSFTPError(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
86 |
}
|
87 |
return false;
|
88 |
}
|
@@ -109,7 +109,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
109 |
{
|
110 |
// Log
|
111 |
Mage::logException($e);
|
112 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
113 |
}
|
114 |
|
115 |
return false;
|
@@ -145,7 +145,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
145 |
{
|
146 |
// Log
|
147 |
Mage::logException($e);
|
148 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
149 |
}
|
150 |
|
151 |
return false;
|
@@ -172,7 +172,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
172 |
{
|
173 |
// Log
|
174 |
Mage::logException($e);
|
175 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
176 |
}
|
177 |
|
178 |
return false;
|
@@ -199,7 +199,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
199 |
{
|
200 |
// Log
|
201 |
Mage::logException($e);
|
202 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
203 |
}
|
204 |
|
205 |
return false;
|
@@ -227,7 +227,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
227 |
|
228 |
// Check success and log errors
|
229 |
if(!$bSuccess) {
|
230 |
-
Mage::log('SFTP Error: ' . $this->_oConnection->getLastSFTPError(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
231 |
}
|
232 |
|
233 |
// Return success
|
@@ -237,7 +237,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
237 |
{
|
238 |
// Log
|
239 |
Mage::logException($e);
|
240 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
241 |
}
|
242 |
|
243 |
return false;
|
@@ -263,7 +263,7 @@ class Mybuys_Connector_Helper_SftpConnection extends Mage_Core_Helper_Abstract
|
|
263 |
{
|
264 |
// Log
|
265 |
Mage::logException($e);
|
266 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
267 |
}
|
268 |
|
269 |
return false;
|
80 |
{
|
81 |
// Log
|
82 |
Mage::logException($e);
|
83 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
84 |
if ($this->_oConnection->getLastSFTPError())
|
85 |
+
Mage::helper('mybuys')->log("SFTP reported error is ". $this->_oConnection->getLastSFTPError(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
86 |
}
|
87 |
return false;
|
88 |
}
|
109 |
{
|
110 |
// Log
|
111 |
Mage::logException($e);
|
112 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
113 |
}
|
114 |
|
115 |
return false;
|
145 |
{
|
146 |
// Log
|
147 |
Mage::logException($e);
|
148 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
149 |
}
|
150 |
|
151 |
return false;
|
172 |
{
|
173 |
// Log
|
174 |
Mage::logException($e);
|
175 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
176 |
}
|
177 |
|
178 |
return false;
|
199 |
{
|
200 |
// Log
|
201 |
Mage::logException($e);
|
202 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
203 |
}
|
204 |
|
205 |
return false;
|
227 |
|
228 |
// Check success and log errors
|
229 |
if(!$bSuccess) {
|
230 |
+
Mage::helper('mybuys')->log('SFTP Error: ' . $this->_oConnection->getLastSFTPError(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
231 |
}
|
232 |
|
233 |
// Return success
|
237 |
{
|
238 |
// Log
|
239 |
Mage::logException($e);
|
240 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
241 |
}
|
242 |
|
243 |
return false;
|
263 |
{
|
264 |
// Log
|
265 |
Mage::logException($e);
|
266 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
267 |
}
|
268 |
|
269 |
return false;
|
app/code/community/Mybuys/Connector/Helper/Tsvfile.php
CHANGED
@@ -109,10 +109,13 @@ class Mybuys_Connector_Helper_Tsvfile extends Mage_Core_Helper_Abstract
|
|
109 |
{
|
110 |
// Filter and order rowValues based on column headers
|
111 |
$selectedRowValues = array();
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
116 |
// Convert values to utf8
|
117 |
$convertedRowValues = $this->encodeFields($selectedRowValues);
|
118 |
// Build row string with delimiters & termination
|
109 |
{
|
110 |
// Filter and order rowValues based on column headers
|
111 |
$selectedRowValues = array();
|
112 |
+
foreach($this->_columnHeaders as $columnHeader) {
|
113 |
+
if (array_key_exists($columnHeader, $rowValues)){
|
114 |
+
$selectedRowValues[] = $rowValues[$columnHeader];
|
115 |
+
} else {
|
116 |
+
$selectedRowValues[] = "";
|
117 |
+
}
|
118 |
+
}
|
119 |
// Convert values to utf8
|
120 |
$convertedRowValues = $this->encodeFields($selectedRowValues);
|
121 |
// Build row string with delimiters & termination
|
app/code/community/Mybuys/Connector/Model/Feed/Base.php
CHANGED
@@ -39,7 +39,7 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
39 |
}
|
40 |
|
41 |
// Feed file name key
|
42 |
-
// This must be
|
43 |
public function getFileNameKey()
|
44 |
{
|
45 |
return '';
|
@@ -88,7 +88,7 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
88 |
protected function addCustomAttributes($collection, $customAttribs, &$fieldMap)
|
89 |
{
|
90 |
// Log
|
91 |
-
Mage::log("Adding custom attributes include in query: {$customAttribs}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
92 |
// Check if we have any custom attribs
|
93 |
if (strlen(trim($customAttribs)) > 0) {
|
94 |
// Iterate custom attribs
|
@@ -103,12 +103,12 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
103 |
Mage::throwException("Attribte not found: {$curAttrib}");
|
104 |
}
|
105 |
// Log
|
106 |
-
Mage::log("Adding attribute to query: {$curAttrib}", Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
107 |
|
108 |
if ($_attribute->getFrontendInput()=="select" || $_attribute->getFrontendInput()=="multiselect") {
|
109 |
// attribute is a select of multi-select input and attribute id to value translation is needed
|
110 |
// Log
|
111 |
-
Mage::log("Note - Attribute needs translation", Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
112 |
$this->_optionValueMap['custom_' . $curAttrib]=true;
|
113 |
}
|
114 |
// Add attribute to select
|
@@ -137,11 +137,11 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
137 |
public function generate($websiteId, $exportPath, $bBaselineFile, $throttle, &$minEntityId, &$bDone)
|
138 |
{
|
139 |
// Log
|
140 |
-
Mage::log('Generating ' . $this->getFileNameKey() . ' data feed for website with Id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
141 |
-
Mage::log("Export path: {$exportPath}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
142 |
-
Mage::log("Baseline feed: {$bBaselineFile}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
143 |
-
Mage::log("Throttle: {$throttle}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
144 |
-
Mage::log("Min entity_id: {$minEntityId}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
145 |
|
146 |
// initialize done flag
|
147 |
$bDone = false;
|
@@ -164,7 +164,7 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
164 |
// Generating baseline file, use simple file name
|
165 |
$filename = $exportPath . DS . $this->getFileNameKey() . '-websiteid-' . $websiteId . '-' . $websitecode . '-' . 'baseline.tsv';
|
166 |
}
|
167 |
-
Mage::log("Output Filenane: {$filename}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
168 |
|
169 |
// build collection
|
170 |
$collection = $this->getFeedCollection($websiteId);
|
@@ -179,9 +179,6 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
179 |
$collection = $this->addIncrementalFilter($collection, $incrementalDate);
|
180 |
}
|
181 |
|
182 |
-
//Mage::log(ucfirst($this->getFileNameKey()) . " feed query", Zend_Log::INFO, "mybuys_query.log");
|
183 |
-
//Mage::log($collection->getSelect()->__toString(), Zend_Log::INFO, "mybuys_query.log");
|
184 |
-
|
185 |
// Get column headers from field map provided by derived class
|
186 |
$headerColumns = array_values($this->getFieldMap());
|
187 |
|
@@ -199,13 +196,13 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
199 |
|
200 |
// Check success opening file
|
201 |
if (!$bSuccess) {
|
202 |
-
Mage::log('Failed to open data feed file:' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
203 |
return false;
|
204 |
}
|
205 |
|
206 |
|
207 |
//get all the attribute values for this website
|
208 |
-
Mage::log('Initializing attribute values', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
209 |
$this->_initAttributeSets();
|
210 |
|
211 |
// Iterate data rows and output to file
|
@@ -214,26 +211,34 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
214 |
// Put data into assoc array by column headers
|
215 |
$curRowData = $curRow->getData();
|
216 |
$rowValues = array();
|
217 |
-
|
218 |
foreach ($this->getFieldMap() as $mapKey => $mapValue) {
|
219 |
-
//if the attribute is a select or multiselect then we need to translate the
|
220 |
// option id value into the display value
|
221 |
-
if ($this->_optionValueMap
|
222 |
$items = explode(",",$curRowData[$mapKey]);
|
223 |
$attrList=array();
|
224 |
foreach ($items as $item) {
|
225 |
-
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
$rowValues[$mapValue] = implode(",", $attrList);
|
228 |
} else {
|
229 |
-
$
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
}
|
232 |
|
233 |
// Output this row
|
234 |
$bSuccess = $file->writeRow($rowValues);
|
235 |
if (!$bSuccess) {
|
236 |
-
Mage::log('Failed to write to data feed file: ' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
237 |
$file->close();
|
238 |
return false;
|
239 |
}
|
@@ -251,10 +256,9 @@ class Mybuys_Connector_Model_Feed_Base extends Mage_Core_Model_Abstract
|
|
251 |
// Close file
|
252 |
$bSuccess = $file->close();
|
253 |
if (!$bSuccess) {
|
254 |
-
Mage::log('Failed to close data feed file: ' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
255 |
return false;
|
256 |
}
|
257 |
}
|
258 |
|
259 |
}
|
260 |
-
|
39 |
}
|
40 |
|
41 |
// Feed file name key
|
42 |
+
// This must be overridden by derived classes
|
43 |
public function getFileNameKey()
|
44 |
{
|
45 |
return '';
|
88 |
protected function addCustomAttributes($collection, $customAttribs, &$fieldMap)
|
89 |
{
|
90 |
// Log
|
91 |
+
Mage::helper('mybuys')->log("Adding custom attributes include in query: {$customAttribs}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
92 |
// Check if we have any custom attribs
|
93 |
if (strlen(trim($customAttribs)) > 0) {
|
94 |
// Iterate custom attribs
|
103 |
Mage::throwException("Attribte not found: {$curAttrib}");
|
104 |
}
|
105 |
// Log
|
106 |
+
Mage::helper('mybuys')->log("Adding attribute to query: {$curAttrib}", Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
107 |
|
108 |
if ($_attribute->getFrontendInput()=="select" || $_attribute->getFrontendInput()=="multiselect") {
|
109 |
// attribute is a select of multi-select input and attribute id to value translation is needed
|
110 |
// Log
|
111 |
+
Mage::helper('mybuys')->log("Note - Attribute needs translation", Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
112 |
$this->_optionValueMap['custom_' . $curAttrib]=true;
|
113 |
}
|
114 |
// Add attribute to select
|
137 |
public function generate($websiteId, $exportPath, $bBaselineFile, $throttle, &$minEntityId, &$bDone)
|
138 |
{
|
139 |
// Log
|
140 |
+
Mage::helper('mybuys')->log('Generating ' . $this->getFileNameKey() . ' data feed for website with Id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
141 |
+
Mage::helper('mybuys')->log("Export path: {$exportPath}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
142 |
+
Mage::helper('mybuys')->log("Baseline feed: {$bBaselineFile}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
143 |
+
Mage::helper('mybuys')->log("Throttle: {$throttle}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
144 |
+
Mage::helper('mybuys')->log("Min entity_id: {$minEntityId}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
145 |
|
146 |
// initialize done flag
|
147 |
$bDone = false;
|
164 |
// Generating baseline file, use simple file name
|
165 |
$filename = $exportPath . DS . $this->getFileNameKey() . '-websiteid-' . $websiteId . '-' . $websitecode . '-' . 'baseline.tsv';
|
166 |
}
|
167 |
+
Mage::helper('mybuys')->log("Output Filenane: {$filename}", Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
168 |
|
169 |
// build collection
|
170 |
$collection = $this->getFeedCollection($websiteId);
|
179 |
$collection = $this->addIncrementalFilter($collection, $incrementalDate);
|
180 |
}
|
181 |
|
|
|
|
|
|
|
182 |
// Get column headers from field map provided by derived class
|
183 |
$headerColumns = array_values($this->getFieldMap());
|
184 |
|
196 |
|
197 |
// Check success opening file
|
198 |
if (!$bSuccess) {
|
199 |
+
Mage::helper('mybuys')->log('Failed to open data feed file:' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
200 |
return false;
|
201 |
}
|
202 |
|
203 |
|
204 |
//get all the attribute values for this website
|
205 |
+
Mage::helper('mybuys')->log('Initializing attribute values', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
206 |
$this->_initAttributeSets();
|
207 |
|
208 |
// Iterate data rows and output to file
|
211 |
// Put data into assoc array by column headers
|
212 |
$curRowData = $curRow->getData();
|
213 |
$rowValues = array();
|
214 |
+
|
215 |
foreach ($this->getFieldMap() as $mapKey => $mapValue) {
|
216 |
+
//if the attribute is a select or multiselect then we need to translate the
|
217 |
// option id value into the display value
|
218 |
+
if (array_key_exists ($mapKey, $this->_optionValueMap)) {
|
219 |
$items = explode(",",$curRowData[$mapKey]);
|
220 |
$attrList=array();
|
221 |
foreach ($items as $item) {
|
222 |
+
if (array_key_exists($item,$this->_attrSetIdToName )) {
|
223 |
+
$attrList[]=$this->_attrSetIdToName[$item];
|
224 |
+
} else {
|
225 |
+
$attrList[]="";
|
226 |
+
}
|
227 |
}
|
228 |
$rowValues[$mapValue] = implode(",", $attrList);
|
229 |
} else {
|
230 |
+
if (array_key_exists($mapKey,$curRowData )) {
|
231 |
+
$rowValues[$mapValue] = $curRowData[$mapKey];
|
232 |
+
} else {
|
233 |
+
$rowValues[$mapValue] ="";
|
234 |
+
}
|
235 |
}
|
236 |
}
|
237 |
|
238 |
// Output this row
|
239 |
$bSuccess = $file->writeRow($rowValues);
|
240 |
if (!$bSuccess) {
|
241 |
+
Mage::helper('mybuys')->log('Failed to write to data feed file: ' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
242 |
$file->close();
|
243 |
return false;
|
244 |
}
|
256 |
// Close file
|
257 |
$bSuccess = $file->close();
|
258 |
if (!$bSuccess) {
|
259 |
+
Mage::helper('mybuys')->log('Failed to close data feed file: ' . $filename, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
260 |
return false;
|
261 |
}
|
262 |
}
|
263 |
|
264 |
}
|
|
app/code/community/Mybuys/Connector/Model/Feed/Email/Optin.php
CHANGED
@@ -16,7 +16,6 @@ class Mybuys_Connector_Model_Feed_Email_Optin extends Mybuys_Connector_Model_Fee
|
|
16 |
{
|
17 |
return array(
|
18 |
'subscriber_email' => 'Email Address',
|
19 |
-
'change_status_at' => 'Opt-In Date',
|
20 |
);
|
21 |
}
|
22 |
|
@@ -31,7 +30,7 @@ class Mybuys_Connector_Model_Feed_Email_Optin extends Mybuys_Connector_Model_Fee
|
|
31 |
*
|
32 |
* @param int|string $websiteId Which website to query for collection
|
33 |
*/
|
34 |
-
public function
|
35 |
{
|
36 |
// Create collection
|
37 |
$collection = Mage::getResourceModel('newsletter/subscriber_collection');
|
16 |
{
|
17 |
return array(
|
18 |
'subscriber_email' => 'Email Address',
|
|
|
19 |
);
|
20 |
}
|
21 |
|
30 |
*
|
31 |
* @param int|string $websiteId Which website to query for collection
|
32 |
*/
|
33 |
+
public function getFeedCollection($websiteId)
|
34 |
{
|
35 |
// Create collection
|
36 |
$collection = Mage::getResourceModel('newsletter/subscriber_collection');
|
app/code/community/Mybuys/Connector/Model/Feed/Email/Optout.php
CHANGED
@@ -16,7 +16,6 @@ class Mybuys_Connector_Model_Feed_Email_Optout extends Mybuys_Connector_Model_Fe
|
|
16 |
{
|
17 |
return array(
|
18 |
'subscriber_email' => 'Email Address',
|
19 |
-
'change_status_at' => 'Opt-Out Date',
|
20 |
);
|
21 |
}
|
22 |
|
@@ -31,7 +30,7 @@ class Mybuys_Connector_Model_Feed_Email_Optout extends Mybuys_Connector_Model_Fe
|
|
31 |
*
|
32 |
* @param int|string $websiteId Which website to query for collection
|
33 |
*/
|
34 |
-
public function
|
35 |
{
|
36 |
// Create collection
|
37 |
$collection = Mage::getResourceModel('newsletter/subscriber_collection');
|
16 |
{
|
17 |
return array(
|
18 |
'subscriber_email' => 'Email Address',
|
|
|
19 |
);
|
20 |
}
|
21 |
|
30 |
*
|
31 |
* @param int|string $websiteId Which website to query for collection
|
32 |
*/
|
33 |
+
public function getFeedCollection($websiteId)
|
34 |
{
|
35 |
// Create collection
|
36 |
$collection = Mage::getResourceModel('newsletter/subscriber_collection');
|
app/code/community/Mybuys/Connector/Model/Feed/Product.php
CHANGED
@@ -192,7 +192,7 @@ class Mybuys_Connector_Model_Feed_Product extends Mybuys_Connector_Model_Feed_Ba
|
|
192 |
*/
|
193 |
protected function addIncrementalFilter($collection, $incrementalDate = NULL)
|
194 |
{
|
195 |
-
Mage::log('Adding incremental filters to product feed', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
196 |
// daily feeds do not include out of stock items Filter on in_stock
|
197 |
$collection->
|
198 |
addAttributeToFilter('is_in_stock', 1);
|
192 |
*/
|
193 |
protected function addIncrementalFilter($collection, $incrementalDate = NULL)
|
194 |
{
|
195 |
+
Mage::helper('mybuys')->log('Adding incremental filters to product feed', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
196 |
// daily feeds do not include out of stock items Filter on in_stock
|
197 |
$collection->
|
198 |
addAttributeToFilter('is_in_stock', 1);
|
app/code/community/Mybuys/Connector/Model/Feed/Transaction.php
CHANGED
@@ -102,6 +102,10 @@ class Mybuys_Connector_Model_Feed_Transaction extends Mybuys_Connector_Model_Fee
|
|
102 |
$collection->getSelect()
|
103 |
->order('main_table.item_id');
|
104 |
|
|
|
|
|
|
|
|
|
105 |
// Return collection
|
106 |
return $collection;
|
107 |
}
|
@@ -111,16 +115,16 @@ class Mybuys_Connector_Model_Feed_Transaction extends Mybuys_Connector_Model_Fee
|
|
111 |
*
|
112 |
* $collection Collection of data which will be spit out as feed
|
113 |
*/
|
114 |
-
protected function addIncrementalFilter($collection, $incrementalDate)
|
115 |
{
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$collection->getSelect()
|
122 |
-
->where("date(main_table.created_at) between '" . $dateStart . "' AND '" . $dateEnd . "'");
|
123 |
-
|
124 |
return $collection;
|
125 |
}
|
126 |
|
102 |
$collection->getSelect()
|
103 |
->order('main_table.item_id');
|
104 |
|
105 |
+
//fix problems with some installs returning multiple identical rows
|
106 |
+
$collection->getSelect()
|
107 |
+
->distinct();
|
108 |
+
|
109 |
// Return collection
|
110 |
return $collection;
|
111 |
}
|
115 |
*
|
116 |
* $collection Collection of data which will be spit out as feed
|
117 |
*/
|
118 |
+
protected function addIncrementalFilter($collection, $incrementalDate=Null)
|
119 |
{
|
120 |
+
if (strtotime($incrementalDate)) { // if a valid date string
|
121 |
+
// convert given date into GMT (Magento) time
|
122 |
+
$dateStart = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($incrementalDate . "00:00:00")));
|
123 |
+
$dateEnd = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($incrementalDate . "23:59:59")));
|
124 |
|
125 |
+
$collection->getSelect()
|
126 |
+
->where("date(main_table.created_at) between '" . $dateStart . "' AND '" . $dateEnd . "'");
|
127 |
+
}
|
|
|
|
|
|
|
|
|
128 |
return $collection;
|
129 |
}
|
130 |
|
app/code/community/Mybuys/Connector/Model/Generatefeeds.php
CHANGED
@@ -49,7 +49,7 @@ class Mybuys_Connector_Model_Generatefeeds
|
|
49 |
public function generateForWebsite($websiteId, $bBaselineFile, $feedType, &$minEntityId, &$bDone)
|
50 |
{
|
51 |
// Log mem usage
|
52 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
53 |
|
54 |
// Check data feeds enabled
|
55 |
// Check feed of this type if config is enabled
|
49 |
public function generateForWebsite($websiteId, $bBaselineFile, $feedType, &$minEntityId, &$bDone)
|
50 |
{
|
51 |
// Log mem usage
|
52 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
53 |
|
54 |
// Check data feeds enabled
|
55 |
// Check feed of this type if config is enabled
|
app/code/community/Mybuys/Connector/Model/Job.php
CHANGED
@@ -55,7 +55,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
55 |
public static function getNextJobFromQueue()
|
56 |
{
|
57 |
// Log
|
58 |
-
Mage::log('Getting next job from the queue.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
59 |
|
60 |
// Create collection
|
61 |
$collection = Mage::getResourceModel('mybuys/job_collection');
|
@@ -73,7 +73,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
73 |
// Get next job and mark it as running
|
74 |
foreach ($collection as $job) {
|
75 |
// Log
|
76 |
-
Mage::log('Found job id: ' . $job->getJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
77 |
// Set status and return job
|
78 |
$job->setStatus(Mybuys_Connector_Model_Job::STATUS_RUNNING);
|
79 |
$job->setStartedAt(Mage::getSingleton('core/date')->gmtDate());
|
@@ -82,7 +82,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
82 |
}
|
83 |
|
84 |
// Log
|
85 |
-
Mage::log('No jobs found.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
86 |
// Otherwise return false
|
87 |
return false;
|
88 |
|
@@ -95,7 +95,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
95 |
public static function createJob($dependentOnJobId, $websiteId, $type, $feedType)
|
96 |
{
|
97 |
// Log
|
98 |
-
Mage::log('Scheduling new job.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
99 |
// Create new job object and init fields
|
100 |
$newJob = Mage::getModel('mybuys/job');
|
101 |
$newJob->setDependentOnJobId($dependentOnJobId);
|
@@ -116,7 +116,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
116 |
public static function cleanupJobQueue()
|
117 |
{
|
118 |
// Log
|
119 |
-
Mage::log('Cleaning up the job queue.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
120 |
|
121 |
// Iterate websites and check configuration
|
122 |
$websites = Mage::app()->getWebsites(false, true);
|
@@ -128,7 +128,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
128 |
$maxAgeDays = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/advanced/max_job_age');
|
129 |
|
130 |
// log
|
131 |
-
Mage::log('Max job age (for website id: ' . $websiteId . ') in days: ' . $maxAgeDays, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
132 |
|
133 |
// Retrieve the write connection
|
134 |
$resource = Mage::getSingleton('core/resource');
|
@@ -193,14 +193,14 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
193 |
// Lookup configured time
|
194 |
$configTime = trim(Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/schedule/dailyfeedtime'));
|
195 |
// Log
|
196 |
-
Mage::log('Daily feed time configuration (for website id ' . $websiteId . '): "' . $configTime . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
197 |
|
198 |
// Lookup configured timezone
|
199 |
$timezone = Mage::app()->getWebsite($websiteId)->getConfig('general/locale/timezone');
|
200 |
// Get current time
|
201 |
$curDateTime = new DateTime("now", new DateTimeZone($timezone));
|
202 |
// Log
|
203 |
-
Mage::log('Current time: "' . $curDateTime->format('H:i:s') . '" timezone: "' . $curDateTime->getTimezone()->getName() . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
204 |
|
205 |
// Create time object from configured time
|
206 |
$configDateTime = new DateTime("now", new DateTimeZone($timezone));
|
@@ -209,7 +209,7 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
209 |
intval(substr($configTime, 3, 2)),
|
210 |
intval(substr($configTime, 6, 2)));
|
211 |
// Log
|
212 |
-
Mage::log('Configured time: "' . $configDateTime->format('H:i:s') . '" timezone: "' . $configDateTime->getTimezone()->getName() . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
213 |
|
214 |
// Do time diff
|
215 |
$minutes = floor(($curDateTime->format('U') - $configDateTime->format('U')) / 60);
|
@@ -248,8 +248,8 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
248 |
public static function scheduleJobs($websiteId, $bBaselineFile)
|
249 |
{
|
250 |
// Log
|
251 |
-
Mage::log('Scheduling jobs for website: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
252 |
-
Mage::log('All feeds for website set to: ' . Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled'), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
253 |
|
254 |
// Local to hold last job id
|
255 |
$lastJobId = null;
|
@@ -291,20 +291,20 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
291 |
{
|
292 |
try {
|
293 |
// Log
|
294 |
-
Mage::log('Running job: ' . $this->getJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
295 |
-
Mage::log('Website Id: ' . $this->getWebsiteId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
296 |
-
Mage::log('Dependent On Job Id: ' . $this->getDependentOnJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
297 |
-
Mage::log('Min Entity Id: ' . $this->getMinEntityId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
298 |
-
Mage::log('Type: ' . $this->getType(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
299 |
-
Mage::log('Feed Type: ' . $this->getFeedType(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
300 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
301 |
|
302 |
// Execute the job
|
303 |
$this->executeJob();
|
304 |
|
305 |
// Log
|
306 |
-
Mage::log('Job completed successfully.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
307 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
308 |
} catch (Exception $e) {
|
309 |
// Fail this job
|
310 |
$this->setStatus(Mybuys_Connector_Model_Job::STATUS_ERROR);
|
@@ -313,9 +313,9 @@ class Mybuys_Connector_Model_Job extends Mage_Core_Model_Abstract
|
|
313 |
$this->save();
|
314 |
// Log exception
|
315 |
Mage::logException($e);
|
316 |
-
Mage::log('Job failed with error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
317 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
318 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
319 |
// Send error email
|
320 |
Mage::helper('mybuys')->sendErrorEmail($this->getWebsiteId(), $e->getMessage());
|
321 |
}
|
55 |
public static function getNextJobFromQueue()
|
56 |
{
|
57 |
// Log
|
58 |
+
Mage::helper('mybuys')->log('Getting next job from the queue.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
59 |
|
60 |
// Create collection
|
61 |
$collection = Mage::getResourceModel('mybuys/job_collection');
|
73 |
// Get next job and mark it as running
|
74 |
foreach ($collection as $job) {
|
75 |
// Log
|
76 |
+
Mage::helper('mybuys')->log('Found job id: ' . $job->getJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
77 |
// Set status and return job
|
78 |
$job->setStatus(Mybuys_Connector_Model_Job::STATUS_RUNNING);
|
79 |
$job->setStartedAt(Mage::getSingleton('core/date')->gmtDate());
|
82 |
}
|
83 |
|
84 |
// Log
|
85 |
+
Mage::helper('mybuys')->log('No jobs found.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
86 |
// Otherwise return false
|
87 |
return false;
|
88 |
|
95 |
public static function createJob($dependentOnJobId, $websiteId, $type, $feedType)
|
96 |
{
|
97 |
// Log
|
98 |
+
Mage::helper('mybuys')->log('Scheduling new job.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
99 |
// Create new job object and init fields
|
100 |
$newJob = Mage::getModel('mybuys/job');
|
101 |
$newJob->setDependentOnJobId($dependentOnJobId);
|
116 |
public static function cleanupJobQueue()
|
117 |
{
|
118 |
// Log
|
119 |
+
Mage::helper('mybuys')->log('Cleaning up the job queue.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
120 |
|
121 |
// Iterate websites and check configuration
|
122 |
$websites = Mage::app()->getWebsites(false, true);
|
128 |
$maxAgeDays = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/advanced/max_job_age');
|
129 |
|
130 |
// log
|
131 |
+
Mage::helper('mybuys')->log('Max job age (for website id: ' . $websiteId . ') in days: ' . $maxAgeDays, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
132 |
|
133 |
// Retrieve the write connection
|
134 |
$resource = Mage::getSingleton('core/resource');
|
193 |
// Lookup configured time
|
194 |
$configTime = trim(Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/schedule/dailyfeedtime'));
|
195 |
// Log
|
196 |
+
Mage::helper('mybuys')->log('Daily feed time configuration (for website id ' . $websiteId . '): "' . $configTime . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
197 |
|
198 |
// Lookup configured timezone
|
199 |
$timezone = Mage::app()->getWebsite($websiteId)->getConfig('general/locale/timezone');
|
200 |
// Get current time
|
201 |
$curDateTime = new DateTime("now", new DateTimeZone($timezone));
|
202 |
// Log
|
203 |
+
Mage::helper('mybuys')->log('Current time: "' . $curDateTime->format('H:i:s') . '" timezone: "' . $curDateTime->getTimezone()->getName() . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
204 |
|
205 |
// Create time object from configured time
|
206 |
$configDateTime = new DateTime("now", new DateTimeZone($timezone));
|
209 |
intval(substr($configTime, 3, 2)),
|
210 |
intval(substr($configTime, 6, 2)));
|
211 |
// Log
|
212 |
+
Mage::helper('mybuys')->log('Configured time: "' . $configDateTime->format('H:i:s') . '" timezone: "' . $configDateTime->getTimezone()->getName() . '"', Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
213 |
|
214 |
// Do time diff
|
215 |
$minutes = floor(($curDateTime->format('U') - $configDateTime->format('U')) / 60);
|
248 |
public static function scheduleJobs($websiteId, $bBaselineFile)
|
249 |
{
|
250 |
// Log
|
251 |
+
Mage::helper('mybuys')->log('Scheduling jobs for website: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
252 |
+
Mage::helper('mybuys')->log('All feeds for website set to: ' . Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled'), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
253 |
|
254 |
// Local to hold last job id
|
255 |
$lastJobId = null;
|
291 |
{
|
292 |
try {
|
293 |
// Log
|
294 |
+
Mage::helper('mybuys')->log('Running job: ' . $this->getJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
295 |
+
Mage::helper('mybuys')->log('Website Id: ' . $this->getWebsiteId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
296 |
+
Mage::helper('mybuys')->log('Dependent On Job Id: ' . $this->getDependentOnJobId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
297 |
+
Mage::helper('mybuys')->log('Min Entity Id: ' . $this->getMinEntityId(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
298 |
+
Mage::helper('mybuys')->log('Type: ' . $this->getType(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
299 |
+
Mage::helper('mybuys')->log('Feed Type: ' . $this->getFeedType(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
300 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
301 |
|
302 |
// Execute the job
|
303 |
$this->executeJob();
|
304 |
|
305 |
// Log
|
306 |
+
Mage::helper('mybuys')->log('Job completed successfully.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
307 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
308 |
} catch (Exception $e) {
|
309 |
// Fail this job
|
310 |
$this->setStatus(Mybuys_Connector_Model_Job::STATUS_ERROR);
|
313 |
$this->save();
|
314 |
// Log exception
|
315 |
Mage::logException($e);
|
316 |
+
Mage::helper('mybuys')->log('Job failed with error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
317 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
318 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
319 |
// Send error email
|
320 |
Mage::helper('mybuys')->sendErrorEmail($this->getWebsiteId(), $e->getMessage());
|
321 |
}
|
app/code/community/Mybuys/Connector/Model/Layout.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Core
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Layout model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Core
|
33 |
+
*/
|
34 |
+
class Mybuys_Connector_Model_Layout extends Mage_Core_Model_Layout
|
35 |
+
{
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Add block object to layout based on xml node data
|
39 |
+
*
|
40 |
+
* @param Varien_Simplexml_Element $node
|
41 |
+
* @param Varien_Simplexml_Element $parent
|
42 |
+
* @return Mage_Core_Model_Layout
|
43 |
+
*/
|
44 |
+
protected function _generateBlock($node, $parent)
|
45 |
+
{
|
46 |
+
// Check for enterprise version to determine if we should render the targetrule blocks
|
47 |
+
$ee = Mage::helper('mybuys')->isMageEnterprise();
|
48 |
+
$myBuysBlockName = (string)$node['name'];
|
49 |
+
// If CE, then do not add these blocks
|
50 |
+
if(!$ee && ($myBuysBlockName == "mybuys_targetrule_related" || $myBuysBlockName == "mybuys_targetrule_upsell")) {
|
51 |
+
return $this;
|
52 |
+
} else {
|
53 |
+
// For all others, call the parent
|
54 |
+
parent:: _generateBlock($node, $parent);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Mybuys/Connector/Model/Observer.php
CHANGED
@@ -20,41 +20,41 @@ class Mybuys_Connector_Model_Observer
|
|
20 |
{
|
21 |
try {
|
22 |
// Log
|
23 |
-
Mage::log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
24 |
-
Mage::log('Data feeds cron process started...', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
25 |
-
Mage::log('Is Single Store Mode: ' . Mage::app()->isSingleStoreMode(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
26 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
27 |
-
Mage::log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
28 |
|
29 |
// Cleanup queue
|
30 |
$this->cleanupJobQueue();
|
31 |
|
32 |
// Log mem usage
|
33 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
34 |
|
35 |
// Schedule daily feed jobs for all websites
|
36 |
$this->scheduleJobs();
|
37 |
|
38 |
// Log mem usage
|
39 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
40 |
|
41 |
// Run 1 job
|
42 |
$this->runJob();
|
43 |
|
44 |
// Log
|
45 |
-
Mage::log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
46 |
-
Mage::log('Daily feeds cron process completed successfully.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
47 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
48 |
-
Mage::log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
49 |
}
|
50 |
catch(Exception $e) {
|
51 |
// Log exception
|
52 |
Mage::logException($e);
|
53 |
-
Mage::log('**********************************************************', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
54 |
-
Mage::log('Data feeds cron process failed with error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
55 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
56 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
57 |
-
Mage::log('**********************************************************', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
58 |
}
|
59 |
|
60 |
return $this;
|
@@ -73,8 +73,8 @@ class Mybuys_Connector_Model_Observer
|
|
73 |
catch(Exception $e) {
|
74 |
// Log exception
|
75 |
Mage::logException($e);
|
76 |
-
Mage::log('Failed to cleaup job queue, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
77 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
78 |
throw $e;
|
79 |
}
|
80 |
}
|
@@ -92,8 +92,8 @@ class Mybuys_Connector_Model_Observer
|
|
92 |
catch(Exception $e) {
|
93 |
// Log exception
|
94 |
Mage::logException($e);
|
95 |
-
Mage::log('Failed to schedule daily jobs, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
96 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
97 |
throw $e;
|
98 |
}
|
99 |
}
|
@@ -114,8 +114,8 @@ class Mybuys_Connector_Model_Observer
|
|
114 |
catch(Exception $e) {
|
115 |
// Log exception
|
116 |
Mage::logException($e);
|
117 |
-
Mage::log('Failed to run job, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
118 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
119 |
throw $e;
|
120 |
}
|
121 |
}
|
20 |
{
|
21 |
try {
|
22 |
// Log
|
23 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
24 |
+
Mage::helper('mybuys')->log('Data feeds cron process started...', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
25 |
+
Mage::helper('mybuys')->log('Is Single Store Mode: ' . Mage::app()->isSingleStoreMode(), Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
26 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
27 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
28 |
|
29 |
// Cleanup queue
|
30 |
$this->cleanupJobQueue();
|
31 |
|
32 |
// Log mem usage
|
33 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
34 |
|
35 |
// Schedule daily feed jobs for all websites
|
36 |
$this->scheduleJobs();
|
37 |
|
38 |
// Log mem usage
|
39 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
40 |
|
41 |
// Run 1 job
|
42 |
$this->runJob();
|
43 |
|
44 |
// Log
|
45 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
46 |
+
Mage::helper('mybuys')->log('Daily feeds cron process completed successfully.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
47 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
48 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
49 |
}
|
50 |
catch(Exception $e) {
|
51 |
// Log exception
|
52 |
Mage::logException($e);
|
53 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
54 |
+
Mage::helper('mybuys')->log('Data feeds cron process failed with error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
55 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
56 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
57 |
+
Mage::helper('mybuys')->log('**********************************************************', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
58 |
}
|
59 |
|
60 |
return $this;
|
73 |
catch(Exception $e) {
|
74 |
// Log exception
|
75 |
Mage::logException($e);
|
76 |
+
Mage::helper('mybuys')->log('Failed to cleaup job queue, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
77 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
78 |
throw $e;
|
79 |
}
|
80 |
}
|
92 |
catch(Exception $e) {
|
93 |
// Log exception
|
94 |
Mage::logException($e);
|
95 |
+
Mage::helper('mybuys')->log('Failed to schedule daily jobs, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
96 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
97 |
throw $e;
|
98 |
}
|
99 |
}
|
114 |
catch(Exception $e) {
|
115 |
// Log exception
|
116 |
Mage::logException($e);
|
117 |
+
Mage::helper('mybuys')->log('Failed to run job, error:', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
118 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
119 |
throw $e;
|
120 |
}
|
121 |
}
|
app/code/community/Mybuys/Connector/Model/System/Config/LogOptions.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
*/
|
4 |
+
class Mybuys_Connector_Model_System_Config_LogOptions
|
5 |
+
{
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
return array(
|
9 |
+
array('value'=>'partial', 'label'=>Mage::helper('adminhtml')->__('Send Last 5000 Lines (zipped)')),
|
10 |
+
array('value'=>'link', 'label'=>Mage::helper('adminhtml')->__('Send Link to Log File')),
|
11 |
+
//array('value'=>'', 'label'=>''),
|
12 |
+
//array('value'=>'none', 'label'=>Mage::helper('adminhtml')->__('Do Not Send Log Data')),
|
13 |
+
//array('value'=>'zipped', 'label'=>Mage::helper('adminhtml')->__('Send Entire Log File (zipped)')),
|
14 |
+
);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Mybuys/Connector/Model/Transferfeeds.php
CHANGED
@@ -22,8 +22,8 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
22 |
{
|
23 |
try {
|
24 |
// Log
|
25 |
-
Mage::log('Transferring data feeds for website with Id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
26 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
27 |
|
28 |
// Check data feeds enabled
|
29 |
if(Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled') != 'enabled') {
|
@@ -37,11 +37,11 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
37 |
Mage::throwException('Transfer file list failed!');
|
38 |
}
|
39 |
|
40 |
-
Mage::log('Sucessfully transferred data feeds for website.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
41 |
}
|
42 |
catch(Exception $e) {
|
43 |
-
Mage::log('Failed to transfer data feeds for website.', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
44 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
45 |
// Rethrow
|
46 |
throw $e;
|
47 |
}
|
@@ -59,7 +59,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
59 |
$feedPath = Mage::getConfig()->getVarDir() . DS . Mybuys_Connector_Model_Generatefeeds::MBUYS_FEED_PATH;
|
60 |
|
61 |
// Log
|
62 |
-
Mage::log('Searching for feed files for website id: ' . $websiteId . ' here: ' . $feedPath, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
63 |
|
64 |
// Create websiteid match string
|
65 |
$websiteIdMatchString = '-websiteid-' . $websiteId;
|
@@ -92,7 +92,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
92 |
closedir($dh);
|
93 |
|
94 |
// Log
|
95 |
-
Mage::log('Found ' . count($fileList) . ' feed files for website id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
96 |
|
97 |
return $fileList;
|
98 |
}
|
@@ -107,7 +107,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
107 |
protected function transferFileList($websiteId, array $fileList)
|
108 |
{
|
109 |
// Log
|
110 |
-
Mage::log('Transferring ' . count($fileList) . ' files for website id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
111 |
|
112 |
// Assemble SFTP crednetials
|
113 |
try {
|
@@ -123,7 +123,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
123 |
{
|
124 |
// Log
|
125 |
Mage::logException($e);
|
126 |
-
Mage::log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
127 |
return false;
|
128 |
}
|
129 |
|
@@ -134,7 +134,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
134 |
/* @var $file Mybuys_Connector_Helper_SftpConnection */
|
135 |
$bSuccess = $connection->connect($sftpHost, $sftpPort, $sftpUser, $sftpPassword);
|
136 |
if(!$bSuccess) {
|
137 |
-
Mage::log('Failed to connect to MyBuys!', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
138 |
return false;
|
139 |
}
|
140 |
|
@@ -142,7 +142,7 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
142 |
$sftpFolder = self::SFTP_FOLDER;
|
143 |
$bSuccess = $connection->changeDir($sftpFolder);
|
144 |
if(!$bSuccess) {
|
145 |
-
Mage::log('Failed to change folders to: ' . $sftpFolder, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
146 |
return false;
|
147 |
}
|
148 |
|
@@ -150,12 +150,12 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
150 |
$bTransferSucceeded = true;
|
151 |
foreach($fileList as $curFile) {
|
152 |
// Log
|
153 |
-
Mage::log('Transferring file: ' . $curFile, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
154 |
-
Mage::log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
155 |
// Transfer file
|
156 |
$bSuccess = $connection->putAndDeleteFile($curFile);
|
157 |
if(!$bSuccess) {
|
158 |
-
Mage::log('Failed to transfer and delete file: ' . $curFile, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
159 |
$bTransferSucceeded = false;
|
160 |
}
|
161 |
}
|
@@ -165,11 +165,11 @@ class Mybuys_Connector_Model_Transferfeeds
|
|
165 |
|
166 |
// Check results
|
167 |
if(!$bTransferSucceeded) {
|
168 |
-
Mage::log('Some file transfers failed!', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
169 |
return false;
|
170 |
}
|
171 |
else {
|
172 |
-
Mage::log('Successfully transferred all files.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
173 |
return true;
|
174 |
}
|
175 |
|
22 |
{
|
23 |
try {
|
24 |
// Log
|
25 |
+
Mage::helper('mybuys')->log('Transferring data feeds for website with Id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
26 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
27 |
|
28 |
// Check data feeds enabled
|
29 |
if(Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled') != 'enabled') {
|
37 |
Mage::throwException('Transfer file list failed!');
|
38 |
}
|
39 |
|
40 |
+
Mage::helper('mybuys')->log('Sucessfully transferred data feeds for website.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
41 |
}
|
42 |
catch(Exception $e) {
|
43 |
+
Mage::helper('mybuys')->log('Failed to transfer data feeds for website.', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
44 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
45 |
// Rethrow
|
46 |
throw $e;
|
47 |
}
|
59 |
$feedPath = Mage::getConfig()->getVarDir() . DS . Mybuys_Connector_Model_Generatefeeds::MBUYS_FEED_PATH;
|
60 |
|
61 |
// Log
|
62 |
+
Mage::helper('mybuys')->log('Searching for feed files for website id: ' . $websiteId . ' here: ' . $feedPath, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
63 |
|
64 |
// Create websiteid match string
|
65 |
$websiteIdMatchString = '-websiteid-' . $websiteId;
|
92 |
closedir($dh);
|
93 |
|
94 |
// Log
|
95 |
+
Mage::helper('mybuys')->log('Found ' . count($fileList) . ' feed files for website id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
96 |
|
97 |
return $fileList;
|
98 |
}
|
107 |
protected function transferFileList($websiteId, array $fileList)
|
108 |
{
|
109 |
// Log
|
110 |
+
Mage::helper('mybuys')->log('Transferring ' . count($fileList) . ' files for website id: ' . $websiteId, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
111 |
|
112 |
// Assemble SFTP crednetials
|
113 |
try {
|
123 |
{
|
124 |
// Log
|
125 |
Mage::logException($e);
|
126 |
+
Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
127 |
return false;
|
128 |
}
|
129 |
|
134 |
/* @var $file Mybuys_Connector_Helper_SftpConnection */
|
135 |
$bSuccess = $connection->connect($sftpHost, $sftpPort, $sftpUser, $sftpPassword);
|
136 |
if(!$bSuccess) {
|
137 |
+
Mage::helper('mybuys')->log('Failed to connect to MyBuys!', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
138 |
return false;
|
139 |
}
|
140 |
|
142 |
$sftpFolder = self::SFTP_FOLDER;
|
143 |
$bSuccess = $connection->changeDir($sftpFolder);
|
144 |
if(!$bSuccess) {
|
145 |
+
Mage::helper('mybuys')->log('Failed to change folders to: ' . $sftpFolder, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
146 |
return false;
|
147 |
}
|
148 |
|
150 |
$bTransferSucceeded = true;
|
151 |
foreach($fileList as $curFile) {
|
152 |
// Log
|
153 |
+
Mage::helper('mybuys')->log('Transferring file: ' . $curFile, Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
154 |
+
Mage::helper('mybuys')->log('Memory usage: ' . memory_get_usage(), Zend_Log::DEBUG, Mybuys_Connector_Helper_Data::LOG_FILE);
|
155 |
// Transfer file
|
156 |
$bSuccess = $connection->putAndDeleteFile($curFile);
|
157 |
if(!$bSuccess) {
|
158 |
+
Mage::helper('mybuys')->log('Failed to transfer and delete file: ' . $curFile, Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
159 |
$bTransferSucceeded = false;
|
160 |
}
|
161 |
}
|
165 |
|
166 |
// Check results
|
167 |
if(!$bTransferSucceeded) {
|
168 |
+
Mage::helper('mybuys')->log('Some file transfers failed!', Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE);
|
169 |
return false;
|
170 |
}
|
171 |
else {
|
172 |
+
Mage::helper('mybuys')->log('Successfully transferred all files.', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
|
173 |
return true;
|
174 |
}
|
175 |
|
app/code/community/Mybuys/Connector/etc/config.xml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
|
14 |
<modules>
|
15 |
<Mybuys_Connector>
|
16 |
-
<version>1.0
|
17 |
</Mybuys_Connector>
|
18 |
</modules>
|
19 |
|
@@ -34,6 +34,11 @@
|
|
34 |
<class>Mybuys_Connector_Model</class>
|
35 |
<resourceModel>mybuys_mysql4</resourceModel>
|
36 |
</mybuys>
|
|
|
|
|
|
|
|
|
|
|
37 |
<mybuys_mysql4>
|
38 |
<class>Mybuys_Connector_Model_Mysql4</class>
|
39 |
<entities>
|
@@ -166,6 +171,9 @@
|
|
166 |
<checkout>disabled</checkout>
|
167 |
<order_confirmation>disabled</order_confirmation>
|
168 |
</recommendation>
|
|
|
|
|
|
|
169 |
</mybuys_websitecode>
|
170 |
</default>
|
171 |
-
</config>
|
13 |
|
14 |
<modules>
|
15 |
<Mybuys_Connector>
|
16 |
+
<version>1.1.0</version>
|
17 |
</Mybuys_Connector>
|
18 |
</modules>
|
19 |
|
34 |
<class>Mybuys_Connector_Model</class>
|
35 |
<resourceModel>mybuys_mysql4</resourceModel>
|
36 |
</mybuys>
|
37 |
+
<core>
|
38 |
+
<rewrite>
|
39 |
+
<layout>Mybuys_Connector_Model_Layout</layout>
|
40 |
+
</rewrite>
|
41 |
+
</core>
|
42 |
<mybuys_mysql4>
|
43 |
<class>Mybuys_Connector_Model_Mysql4</class>
|
44 |
<entities>
|
171 |
<checkout>disabled</checkout>
|
172 |
<order_confirmation>disabled</order_confirmation>
|
173 |
</recommendation>
|
174 |
+
<notification>
|
175 |
+
<sendlog>none</sendlog>
|
176 |
+
</notification>
|
177 |
</mybuys_websitecode>
|
178 |
</default>
|
179 |
+
</config>
|
app/code/community/Mybuys/Connector/etc/system.xml
CHANGED
@@ -123,6 +123,46 @@
|
|
123 |
<show_in_website>1</show_in_website>
|
124 |
<show_in_store>1</show_in_store>
|
125 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
<emails translate="label">
|
127 |
<label>Email Error Notifications</label>
|
128 |
<frontend_type>text</frontend_type>
|
@@ -132,8 +172,20 @@
|
|
132 |
<show_in_store>0</show_in_store>
|
133 |
<comment>Enter a list of email addresses separated by commas. (user1@domain.com,user2@domain.com,user3@otherdomain.com)</comment>
|
134 |
</emails>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</fields>
|
136 |
</notification>
|
|
|
137 |
<feedsenabled translate="label">
|
138 |
<label>Data Feeds</label>
|
139 |
<frontend_type>text</frontend_type>
|
@@ -247,7 +299,7 @@
|
|
247 |
<label>Advanced Feed Configuration</label>
|
248 |
<frontend_type>text</frontend_type>
|
249 |
<sort_order>9</sort_order>
|
250 |
-
<show_in_default>
|
251 |
<show_in_website>1</show_in_website>
|
252 |
<show_in_store>0</show_in_store>
|
253 |
<fields>
|
@@ -269,8 +321,32 @@
|
|
269 |
<show_in_store>0</show_in_store>
|
270 |
<comment>Feed generation record count throttle parameter. Only this many records will be exported in a single job run. (0 = No throttling)</comment>
|
271 |
</throttle>
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
</groups>
|
275 |
</mybuys_datafeeds>
|
276 |
|
@@ -380,7 +456,7 @@
|
|
380 |
<show_in_store>1</show_in_store>
|
381 |
<comment>Enable/disable product detail recommendations</comment>
|
382 |
</product_detail>
|
383 |
-
|
384 |
<label>Product Review</label>
|
385 |
<frontend_type>select</frontend_type>
|
386 |
<source_model>mybuys/system_config_enableToggle</source_model>
|
@@ -389,7 +465,7 @@
|
|
389 |
<show_in_website>1</show_in_website>
|
390 |
<show_in_store>1</show_in_store>
|
391 |
<comment>Enable/disable product detail recommendations</comment>
|
392 |
-
|
393 |
<search_results translate="label">
|
394 |
<label>Search Result</label>
|
395 |
<frontend_type>select</frontend_type>
|
@@ -410,18 +486,6 @@
|
|
410 |
<show_in_store>1</show_in_store>
|
411 |
<comment>Enable/disable add-to-cart recommendations</comment>
|
412 |
</add_to_cart>
|
413 |
-
<!--
|
414 |
-
<wishlist translate="label">
|
415 |
-
<label>Wishlist</label>
|
416 |
-
<frontend_type>select</frontend_type>
|
417 |
-
<source_model>mybuys/system_config_enableToggle</source_model>
|
418 |
-
<sort_order>8</sort_order>
|
419 |
-
<show_in_default>1</show_in_default>
|
420 |
-
<show_in_website>1</show_in_website>
|
421 |
-
<show_in_store>1</show_in_store>
|
422 |
-
<comment>Enable/disable wishlist recommendations</comment>
|
423 |
-
</wishlist>
|
424 |
-
-->
|
425 |
<checkout translate="label">
|
426 |
<label>Shopping Cart and Checkout</label>
|
427 |
<frontend_type>select</frontend_type>
|
123 |
<show_in_website>1</show_in_website>
|
124 |
<show_in_store>1</show_in_store>
|
125 |
<fields>
|
126 |
+
<sendlog translate="label">
|
127 |
+
<label>Send Log File</label>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>mybuys/system_config_logOptions</source_model>
|
130 |
+
<sort_order>2</sort_order>
|
131 |
+
<show_in_default>0</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<comment>
|
135 |
+
<![CDATA[
|
136 |
+
<script type="text/javascript">
|
137 |
+
document.observe("dom:loaded", function() {
|
138 |
+
// initially set display for the note
|
139 |
+
var a = document.getElementById("mybuys_datafeeds_notification_sendlog");
|
140 |
+
var selectedValue = a.options[a.selectedIndex].value;
|
141 |
+
$$('#mybuys_log_hint').each(function(s) {
|
142 |
+
if(selectedValue == 'link'){
|
143 |
+
$('mybuys_log_hint').show();
|
144 |
+
} else {
|
145 |
+
$('mybuys_log_hint').hide();
|
146 |
+
}
|
147 |
+
});
|
148 |
+
});
|
149 |
+
Event.observe('mybuys_datafeeds_notification_sendlog', 'change', function(){
|
150 |
+
var e = document.getElementById("mybuys_datafeeds_notification_sendlog");
|
151 |
+
var selectedValue = e.options[e.selectedIndex].value;
|
152 |
+
$$('#mybuys_log_hint').each(function(s) {
|
153 |
+
if(selectedValue == 'link'){
|
154 |
+
$('mybuys_log_hint').show();
|
155 |
+
} else {
|
156 |
+
$('mybuys_log_hint').hide();
|
157 |
+
}
|
158 |
+
});
|
159 |
+
});
|
160 |
+
</script>
|
161 |
+
Select an option for sending log information with error notification<br />
|
162 |
+
<span id="mybuys_log_hint" style="padding:0;font-size:11px;display:none;">*Note: You must allow access to the mybuys.log file located in /var/log/ through the .htaccess file for this directory.</span>
|
163 |
+
]]>
|
164 |
+
</comment>
|
165 |
+
</sendlog>
|
166 |
<emails translate="label">
|
167 |
<label>Email Error Notifications</label>
|
168 |
<frontend_type>text</frontend_type>
|
172 |
<show_in_store>0</show_in_store>
|
173 |
<comment>Enter a list of email addresses separated by commas. (user1@domain.com,user2@domain.com,user3@otherdomain.com)</comment>
|
174 |
</emails>
|
175 |
+
<!--
|
176 |
+
<log_email_identity translate="label">
|
177 |
+
<label>Email Sender</label>
|
178 |
+
<frontend_type>select</frontend_type>
|
179 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
180 |
+
<sort_order>20</sort_order>
|
181 |
+
<show_in_default>0</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>0</show_in_store>
|
184 |
+
</log_email_identity>
|
185 |
+
-->
|
186 |
</fields>
|
187 |
</notification>
|
188 |
+
|
189 |
<feedsenabled translate="label">
|
190 |
<label>Data Feeds</label>
|
191 |
<frontend_type>text</frontend_type>
|
299 |
<label>Advanced Feed Configuration</label>
|
300 |
<frontend_type>text</frontend_type>
|
301 |
<sort_order>9</sort_order>
|
302 |
+
<show_in_default>1</show_in_default>
|
303 |
<show_in_website>1</show_in_website>
|
304 |
<show_in_store>0</show_in_store>
|
305 |
<fields>
|
321 |
<show_in_store>0</show_in_store>
|
322 |
<comment>Feed generation record count throttle parameter. Only this many records will be exported in a single job run. (0 = No throttling)</comment>
|
323 |
</throttle>
|
324 |
+
<force_logging translate="label">
|
325 |
+
<label>Force Logging</label>
|
326 |
+
<frontend_type>select</frontend_type>
|
327 |
+
<source_model>mybuys/system_config_enableToggle</source_model>
|
328 |
+
<sort_order>3</sort_order>
|
329 |
+
<show_in_default>1</show_in_default>
|
330 |
+
<show_in_website>0</show_in_website>
|
331 |
+
<show_in_store>0</show_in_store>
|
332 |
+
<comment>Enable MyBuys logging even if Magento logging is disabled</comment>
|
333 |
+
</force_logging>
|
334 |
+
<notice translate="label">
|
335 |
+
<frontend_type>Text</frontend_type>
|
336 |
+
<frontend_model>mybuys/adminhtml_system_config_commentText</frontend_model> <!-- render comment as text -->
|
337 |
+
<comment><![CDATA[
|
338 |
+
To configure <b>Forced Logging</b>, please select the <b>Default Config</b> scope from the <i>Current Configuration Scope</i> dropdown
|
339 |
+
<br/><br/>]]>
|
340 |
+
</comment>
|
341 |
+
<sort_order>99</sort_order>
|
342 |
+
<show_in_default>0</show_in_default>
|
343 |
+
<show_in_website>1</show_in_website>
|
344 |
+
<show_in_store>1</show_in_store>
|
345 |
+
</notice>
|
346 |
+
|
347 |
+
</fields>
|
348 |
+
</advanced>
|
349 |
+
|
350 |
</groups>
|
351 |
</mybuys_datafeeds>
|
352 |
|
456 |
<show_in_store>1</show_in_store>
|
457 |
<comment>Enable/disable product detail recommendations</comment>
|
458 |
</product_detail>
|
459 |
+
<product_review translate="label">
|
460 |
<label>Product Review</label>
|
461 |
<frontend_type>select</frontend_type>
|
462 |
<source_model>mybuys/system_config_enableToggle</source_model>
|
465 |
<show_in_website>1</show_in_website>
|
466 |
<show_in_store>1</show_in_store>
|
467 |
<comment>Enable/disable product detail recommendations</comment>
|
468 |
+
</product_review>
|
469 |
<search_results translate="label">
|
470 |
<label>Search Result</label>
|
471 |
<frontend_type>select</frontend_type>
|
486 |
<show_in_store>1</show_in_store>
|
487 |
<comment>Enable/disable add-to-cart recommendations</comment>
|
488 |
</add_to_cart>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
<checkout translate="label">
|
490 |
<label>Shopping Cart and Checkout</label>
|
491 |
<frontend_type>select</frontend_type>
|
app/design/frontend/base/default/layout/mybuys/websitecode.xml
CHANGED
@@ -20,23 +20,16 @@
|
|
20 |
</reference>
|
21 |
</cms_index_index>
|
22 |
|
23 |
-
<!-- HIGH LEVEL CATEGORY -->
|
24 |
-
<catalog_category_layered translate="label">
|
25 |
-
<reference name="content">
|
26 |
-
<block type="catalog/product_list" name="mybuys_category_high" before="-" template="mybuys/websitecode/params/cat_high_level.phtml" />
|
27 |
-
<block type="mybuys/zone" name="mybuys_recomendationzone_high" after="category.products" template="mybuys/websitecode/recomendationzone/zone_cat_high.phtml" />
|
28 |
-
</reference>
|
29 |
-
</catalog_category_layered>
|
30 |
|
31 |
-
<!--
|
32 |
-
|
33 |
-
|
34 |
-
<
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
</reference>
|
39 |
-
|
40 |
|
41 |
<!-- PRODUCT VIEW -->
|
42 |
<catalog_product_view translate="label">
|
@@ -62,8 +55,10 @@
|
|
62 |
<!-- SEARCH RESULT -->
|
63 |
<catalogsearch_result_index translate="label">
|
64 |
<reference name="content">
|
65 |
-
<block type="
|
66 |
-
|
|
|
|
|
67 |
</reference>
|
68 |
</catalogsearch_result_index>
|
69 |
|
20 |
</reference>
|
21 |
</cms_index_index>
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
<!-- GENERAL CATEGORY -->
|
25 |
+
<catalog_category_view translate="label">
|
26 |
+
<reference name="content">
|
27 |
+
<block type="core/text_list" name="mybuys_cat_block_general" after="category.products">
|
28 |
+
<block type="catalog/product_list" name="mybuys_category" before="-" template="mybuys/websitecode/params/category.phtml" />
|
29 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="mybuys_category" template="mybuys/websitecode/recomendationzone/zone_category.phtml" />
|
30 |
+
</block>
|
31 |
</reference>
|
32 |
+
</catalog_category_view>
|
33 |
|
34 |
<!-- PRODUCT VIEW -->
|
35 |
<catalog_product_view translate="label">
|
55 |
<!-- SEARCH RESULT -->
|
56 |
<catalogsearch_result_index translate="label">
|
57 |
<reference name="content">
|
58 |
+
<block type="core/text_list" name="mybuys_cat_block_leaf" after="category.products">
|
59 |
+
<block type="catalog/product_list" name="mybuys_search" before="-" template="mybuys/websitecode/params/search.phtml" />
|
60 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="mybuys_search" template="mybuys/websitecode/recomendationzone/zone_search_result.phtml" />
|
61 |
+
</block>
|
62 |
</reference>
|
63 |
</catalogsearch_result_index>
|
64 |
|
app/design/frontend/base/default/layout/mybuys/websitecode_sort.xml
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<!-- DEFAULT -->
|
5 |
+
<default>
|
6 |
+
<reference name="head">
|
7 |
+
<block type="core/template" name="mybuys_head_links" before="-" template="mybuys/websitecode/header.phtml"/>
|
8 |
+
<action method="addCss"><stylesheet>css/recommendation_zone.css</stylesheet></action>
|
9 |
+
</reference>
|
10 |
+
<reference name="before_body_end">
|
11 |
+
<block type="core/template" name="mybuys_init" after="-" template="mybuys/websitecode/init.phtml"/>
|
12 |
+
</reference>
|
13 |
+
</default>
|
14 |
+
|
15 |
+
<!-- HOME PAGE -->
|
16 |
+
<cms_index_index>
|
17 |
+
<reference name="content">
|
18 |
+
<block type="core/template" name="mybuys_home" before="-" template="mybuys/websitecode/params/home.phtml" />
|
19 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_home.phtml" />
|
20 |
+
</reference>
|
21 |
+
</cms_index_index>
|
22 |
+
|
23 |
+
<!-- HIGH LEVEL CATEGORY -->
|
24 |
+
<catalog_category_layered translate="label">
|
25 |
+
<reference name="content">
|
26 |
+
<block type="core/text_list" name="mybuys_cat_block_high" after="category.products">
|
27 |
+
<block type="catalog/product_list" name="mybuys_category_high" before="-" template="mybuys/websitecode/params/cat_high_level.phtml">
|
28 |
+
<action method="setDefaultDirection"><value>desc</value></action>
|
29 |
+
</block>
|
30 |
+
|
31 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone_high" after="mybuys_category_high" template="mybuys/websitecode/recomendationzone/zone_cat_high.phtml" />
|
32 |
+
</block>
|
33 |
+
</reference>
|
34 |
+
</catalog_category_layered>
|
35 |
+
|
36 |
+
<!-- LEAF CATEGORY -->
|
37 |
+
<catalog_category_layered_nochildren translate="label">
|
38 |
+
<reference name="content">
|
39 |
+
<remove name="mybuys_cat_block_high"/>
|
40 |
+
<block type="core/text_list" name="mybuys_cat_block_leaf" after="category.products">
|
41 |
+
<block type="catalog/product_list" name="mybuys_category_leaf" before="-" template="mybuys/websitecode/params/cat_leaf.phtml">
|
42 |
+
<action method="setDefaultDirection"><value>desc</value></action>
|
43 |
+
</block>
|
44 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone_leaf" after="mybuys_category_leaf" template="mybuys/websitecode/recomendationzone/zone_cat_leaf.phtml" />
|
45 |
+
</block>
|
46 |
+
</reference>
|
47 |
+
</catalog_category_layered_nochildren>
|
48 |
+
|
49 |
+
<!-- PRODUCT VIEW -->
|
50 |
+
<catalog_product_view translate="label">
|
51 |
+
<reference name="content">
|
52 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_product_detail.phtml" />
|
53 |
+
<block type="enterprise_targetrule/catalog_product_list_related" name="mybuys_targetrule_related" before="-" template="mybuys/websitecode/params/target_rule_related.phtml" />
|
54 |
+
<block type="enterprise_targetrule/catalog_product_list_upsell" name="mybuys_targetrule_upsell" before="-" template="mybuys/websitecode/params/target_rule_upsell.phtml" />
|
55 |
+
<block type="mybuys/category" name="mybuys_product_view" before="-" template="mybuys/websitecode/params/product.phtml" />
|
56 |
+
</reference>
|
57 |
+
<reference name="product.info.addto">
|
58 |
+
<action method="setTemplate"><template>mybuys/websitecode/button.phtml</template></action>
|
59 |
+
</reference>
|
60 |
+
</catalog_product_view>
|
61 |
+
|
62 |
+
<!-- PRODUCT REVIEW -->
|
63 |
+
<review_product_list translate="label">
|
64 |
+
<reference name="content">
|
65 |
+
<block type="mybuys/category" name="mybuys_product_review" before="-" template="mybuys/websitecode/params/product_review.phtml" />
|
66 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_product_review.phtml" />
|
67 |
+
</reference>
|
68 |
+
</review_product_list>
|
69 |
+
|
70 |
+
<!-- SEARCH RESULT -->
|
71 |
+
<catalogsearch_result_index translate="label">
|
72 |
+
<reference name="content">
|
73 |
+
<block type="catalog/product_list" name="mybuys_search" before="-" template="mybuys/websitecode/params/search.phtml">
|
74 |
+
<action method="setDefaultDirection"><value>desc</value></action>
|
75 |
+
</block>
|
76 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_search_result.phtml" />
|
77 |
+
</reference>
|
78 |
+
</catalogsearch_result_index>
|
79 |
+
|
80 |
+
<!-- SHOPPING CART -->
|
81 |
+
<checkout_cart_index translate="label">
|
82 |
+
<reference name="content">
|
83 |
+
<block type="mybuys/category" name="mybuys_cart" before="-" template="mybuys/websitecode/params/checkout.phtml" />
|
84 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_checkout.phtml" />
|
85 |
+
</reference>
|
86 |
+
</checkout_cart_index>
|
87 |
+
|
88 |
+
<!-- WISHLIST -->
|
89 |
+
<wishlist_index_index translate="label">
|
90 |
+
<reference name="content">
|
91 |
+
<block type="core/template" name="mybuys_wishlist" before="-" template="mybuys/websitecode/params/wishlist.phtml" />
|
92 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_wishlist.phtml" />
|
93 |
+
</reference>
|
94 |
+
</wishlist_index_index>
|
95 |
+
|
96 |
+
<!-- CHECKOUT ONEPAGE -->
|
97 |
+
<checkout_onepage_index translate="label">
|
98 |
+
<reference name="content">
|
99 |
+
<block type="mybuys/category" name="mybuys_checkout" after="-" template="mybuys/websitecode/params/checkout.phtml" />
|
100 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_checkout.phtml" />
|
101 |
+
</reference>
|
102 |
+
</checkout_onepage_index>
|
103 |
+
|
104 |
+
<!-- CHECKOUT ONEPAGE SUCCESS -->
|
105 |
+
<checkout_onepage_success translate="label">
|
106 |
+
<reference name="content">
|
107 |
+
<block type="mybuys/category" name="mybuys_success" after="-" template="mybuys/websitecode/params/confirmation.phtml" />
|
108 |
+
<block type="mybuys/zone" name="mybuys_recomendationzone" after="-" template="mybuys/websitecode/recomendationzone/zone_order_confirmation.phtml" />
|
109 |
+
</reference>
|
110 |
+
</checkout_onepage_success>
|
111 |
+
</layout>
|
app/design/frontend/base/default/template/mybuys/websitecode/header.phtml
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
-
<?php if (Mage::app()->getStore()->isCurrentlySecure()) : ?>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
<?php else : ?>
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
<?php endif; ?>
|
11 |
<?php endif; ?>
|
1 |
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
+
<?php if (Mage::app()->getStore()->isCurrentlySecure()) : ?>
|
3 |
+
<link href="https://t.p.mybuys.com/clients/<?php echo Mage::getStoreConfig('mybuys_websitecode/general/identifier'); ?>/css/styles.css" type="text/css" rel="stylesheet" id="mybuysstyles" />
|
4 |
+
<script type="text/javascript" src="https://t.p.mybuys.com/js/mybuys4.js"></script>
|
5 |
+
<script type="text/javascript" src="https://t.p.mybuys.com/clients/<?php echo Mage::getStoreConfig('mybuys_websitecode/general/identifier'); ?>/js/setup.js"></script>
|
6 |
+
<?php else : ?>
|
7 |
+
<link href="https://t.p.mybuys.com/clients/<?php echo Mage::getStoreConfig('mybuys_websitecode/general/identifier'); ?>/css/styles.css" type="text/css" rel="stylesheet" id="mybuysstyles" />
|
8 |
+
<script type="text/javascript" src="http://t.p.mybuys.com/js/mybuys4.js"></script>
|
9 |
+
<script type="text/javascript" src="http://t.p.mybuys.com/clients/<?php echo Mage::getStoreConfig('mybuys_websitecode/general/identifier'); ?>/js/setup.js"></script>
|
10 |
+
<?php endif; ?>
|
11 |
<?php endif; ?>
|
app/design/frontend/base/default/template/mybuys/websitecode/params/cat_high_level.phtml
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
-
<?php $collection = $this->getLoadedProductCollection(); ?>
|
3 |
-
<?php $catId = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getId(); ?>
|
4 |
-
<script type="text/javascript">
|
5 |
-
mybuys.setPageType("HIGH_LEVEL_CATEGORY");
|
6 |
-
mybuys.set("categoryid","<?php echo $catId; ?>");
|
7 |
-
</script>
|
8 |
-
|
9 |
-
<?php if(Mage::getStoreConfig('mybuys_websitecode/recommendation/recommendation') && Mage::getStoreConfig('mybuys_websitecode/recommendation/cat_high') && count($collection)>0 ) : ?>
|
10 |
-
<script type="text/javascript">
|
11 |
-
<?php
|
12 |
-
foreach ($collection as $product)
|
13 |
-
{
|
14 |
-
echo 'mybuys.addItemPresentOnPage("'.$product->getId().'");';
|
15 |
-
}
|
16 |
-
?>
|
17 |
-
</script>
|
18 |
-
<?php endif; ?>
|
19 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/params/cat_leaf.phtml
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
-
<?php $collection = $this->getLoadedProductCollection(); ?>
|
3 |
-
<?php $catId = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getId(); ?>
|
4 |
-
|
5 |
-
<script type="text/javascript">
|
6 |
-
mybuys.setPageType("CATEGORY");
|
7 |
-
mybuys.set("categoryid","<?php echo $catId; ?>");
|
8 |
-
</script>
|
9 |
-
|
10 |
-
<?php if(Mage::getStoreConfig('mybuys_websitecode/recommendation/recommendation') && Mage::getStoreConfig('mybuys_websitecode/recommendation/cat_leaf') && count($collection)>0 ) : ?>
|
11 |
-
<script type="text/javascript">
|
12 |
-
<?php
|
13 |
-
foreach ($collection as $product)
|
14 |
-
{
|
15 |
-
echo 'mybuys.addItemPresentOnPage("'.$product->getId().'");';
|
16 |
-
}
|
17 |
-
?>
|
18 |
-
</script>
|
19 |
-
<?php endif; ?>
|
20 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/params/category.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
+
<?php $collection = $this->getLoadedProductCollection(); ?>
|
3 |
+
<?php $catId = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getId(); ?>
|
4 |
+
<?php $catLevel = Mage::registry('current_category')->getLevel(); ?>
|
5 |
+
<?php $catTitle = ($catLevel <= 2) ? "HIGH_LEVEL_CATEGORY" : "CATEGORY"; ?>
|
6 |
+
<?php $zoneEnabled = ($catLevel <= 2) ?
|
7 |
+
Mage::getStoreConfig('mybuys_websitecode/recommendation/cat_high') :
|
8 |
+
Mage::getStoreConfig('mybuys_websitecode/recommendation/cat_leaf'); ?>
|
9 |
+
|
10 |
+
<script type="text/javascript">
|
11 |
+
mybuys.setPageType("<?php echo $catTitle?>");
|
12 |
+
mybuys.set("categoryid", "<?php echo $catId; ?>");
|
13 |
+
</script>
|
14 |
+
|
15 |
+
<?php if (Mage::getStoreConfig('mybuys_websitecode/recommendation/recommendation') && $zoneEnabled && count($collection) > 0) : ?>
|
16 |
+
<script type="text/javascript">
|
17 |
+
<?php
|
18 |
+
foreach ($collection as $product)
|
19 |
+
{
|
20 |
+
echo 'mybuys.addItemPresentOnPage("'.$product->getId().'");';
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
</script>
|
24 |
+
<?php endif; ?>
|
25 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/mybuys/websitecode/params/wishlist.phtml
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php if (Mage::getStoreConfig('mybuys_websitecode/general/website_code') == 'enabled') : ?>
|
2 |
-
<script type="text/javascript">
|
3 |
-
mybuys.setPageType("MY_PAGE");
|
4 |
-
</script>
|
5 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_cat_high.phtml
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php if($this->zonesEnabled() && $this->getZoneStatus('cat_high')) : ?>
|
2 |
-
<div id="recommendation-zone-wrapper">
|
3 |
-
<!-- MyBuys Web Recommendation Zone -->
|
4 |
-
<div mybuyszone="1"></div>
|
5 |
-
<!-- End MyBuys Web Recommendation Zone -->
|
6 |
-
</div>
|
7 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_cat_leaf.phtml
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php if($this->zonesEnabled() && $this->getZoneStatus('cat_leaf')) : ?>
|
2 |
-
<div id="recommendation-zone-wrapper">
|
3 |
-
<!-- MyBuys Web Recommendation Zone -->
|
4 |
-
<div mybuyszone="1"></div>
|
5 |
-
<!-- End MyBuys Web Recommendation Zone -->
|
6 |
-
</div>
|
7 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_category.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ($this->zonesEnabled()) {
|
3 |
+
$catLevel = Mage::registry('current_category')->getLevel();
|
4 |
+
if (($catLevel <= 2 && $this->getZoneStatus('cat_high')) ||
|
5 |
+
($catLevel > 2 && $this->getZoneStatus('cat_leaf'))
|
6 |
+
) { //high level category and enabled
|
7 |
+
?>
|
8 |
+
<div id="recommendation-zone-wrapper">
|
9 |
+
<!-- MyBuys Web Recommendation Zone -->
|
10 |
+
<div mybuyszone="1"></div>
|
11 |
+
<!-- End MyBuys Web Recommendation Zone -->
|
12 |
+
</div>
|
13 |
+
<?php
|
14 |
+
}
|
15 |
+
}
|
16 |
+
?>
|
app/design/frontend/base/default/template/mybuys/websitecode/recomendationzone/zone_wishlist.phtml
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php if($this->zonesEnabled() && $this->getZoneStatus('wishlist')) : ?>
|
2 |
-
<div id="recommendation-zone-wrapper">
|
3 |
-
<!-- MyBuys Web Recommendation Zone -->
|
4 |
-
<div mybuyszone="1"></div>
|
5 |
-
<!-- End MyBuys Web Recommendation Zone -->
|
6 |
-
</div>
|
7 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mybuys/websitecode/test/default.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<hr>
|
2 |
+
default at level
|
3 |
+
<?php echo Mage::registry('current_category')->getLevel()?>
|
4 |
+
<hr>
|
app/design/frontend/base/default/template/mybuys/websitecode/test/high.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<hr>
|
2 |
+
high at level
|
3 |
+
<?php echo Mage::registry('current_category')->getLevel()?>
|
4 |
+
<hr>
|
app/design/frontend/base/default/template/mybuys/websitecode/test/leaf.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<hr>
|
2 |
+
leaf at level
|
3 |
+
<?php echo Mage::registry('current_category')->getLevel()?>
|
4 |
+
<hr>
|
app/etc/modules/Mybuys_Connector.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Mybuys_Connector>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
<version>1.0
|
8 |
</Mybuys_Connector>
|
9 |
</modules>
|
10 |
-
</config>
|
4 |
<Mybuys_Connector>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
<version>1.1.0</version>
|
8 |
</Mybuys_Connector>
|
9 |
</modules>
|
10 |
+
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MyBuys_Personalization_Extension</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
-
<license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>MyBuys Website Code & Data Feed Integration</summary>
|
10 |
<description>MyBuys Website Code & Data Feed Integration</description>
|
11 |
<notes>MyBuys Website Code & Data Feed Integration</notes>
|
12 |
-
<authors><author><name>Greg Croasdill</name><user>groggu</user><email>gregc@human-element.com</email></author></authors>
|
13 |
-
<date>2013-
|
14 |
-
<time>17:
|
15 |
-
<contents><target name="magecommunity"><dir name="Mybuys"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="Export"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="4056faae479f352288851a8fc1eb447b"/></dir></dir><file name="Grid.php" hash="5f520715c3cfa6bf87ab2b463098a30b"/></dir><file name="Export.php" hash="1f06f862f7566bc8c165daf7f0facbc7"/><dir name="Job"><file name="Grid.php" hash="13e933e78627574e5ed1bb5bdb64a746"/></dir><file name="Job.php" hash="d13d344495fa89bdcff21a5f0f53b862"/><dir name="System"><dir name="Config"><file name="CommentText.php" hash="db2cc6c36627fee8064b7b7a59d8957a"/><file name="Date.php" hash="2dc607fa0895ba8b88c2dff7805f96b1"/><dir name="Form"><dir name="Field"><file name="Date.php" hash="302347c855b30cc11045d3de9ba137aa"/></dir></dir></dir></dir></dir><file name="Category.php" hash="79cb522bd8edfc6b03e01ba60363c9f2"/><file name="Zone.php" hash="786209aa1dbe54a837336e332ede80c2"/></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MyBuys_Personalization_Extension</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>MyBuys Website Code & Data Feed Integration</summary>
|
10 |
<description>MyBuys Website Code & Data Feed Integration</description>
|
11 |
<notes>MyBuys Website Code & Data Feed Integration</notes>
|
12 |
+
<authors><author><name>MyBuys Sandbox</name><user>mybuys</user><email>rbrant@mybuys.com</email></author><author><name>Greg Croasdill</name><user>groggu</user><email>gregc@human-element.com</email></author></authors>
|
13 |
+
<date>2013-12-23</date>
|
14 |
+
<time>21:17:19</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Mybuys"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="Export"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="4056faae479f352288851a8fc1eb447b"/></dir></dir><file name="Grid.php" hash="5f520715c3cfa6bf87ab2b463098a30b"/></dir><file name="Export.php" hash="1f06f862f7566bc8c165daf7f0facbc7"/><dir name="Job"><file name="Grid.php" hash="13e933e78627574e5ed1bb5bdb64a746"/></dir><file name="Job.php" hash="d13d344495fa89bdcff21a5f0f53b862"/><dir name="System"><dir name="Config"><file name="CommentText.php" hash="db2cc6c36627fee8064b7b7a59d8957a"/><file name="Date.php" hash="2dc607fa0895ba8b88c2dff7805f96b1"/><dir name="Form"><dir name="Field"><file name="Date.php" hash="302347c855b30cc11045d3de9ba137aa"/></dir></dir></dir></dir></dir><file name="Category.php" hash="79cb522bd8edfc6b03e01ba60363c9f2"/><file name="Zone.php" hash="786209aa1dbe54a837336e332ede80c2"/></dir><dir name="Helper"><file name="Data.php" hash="14774903860a5299ab1911f27e5092e9"/><file name="SftpConnection.php" hash="9f7c9e0625f20ffcb9515d154bb17471"/><file name="Tsvfile.php" hash="7c44ce8e73fc425c26f83d028e9c4c47"/></dir><dir name="Model"><dir name="Feed"><file name="Base.php" hash="dc55eef03543ea46309873741508dbec"/><file name="Category.php" hash="e77711c3264c8adf940d7cd818bd155a"/><file name="Crosssell.php" hash="6326f873bd6f8101e1761528a04c1e2e"/><dir name="Email"><file name="Optin.php" hash="8fa62172ac22c229492a8d14d9c82192"/><file name="Optout.php" hash="c6604d73ebfb55f1a7e3083e9941fe19"/></dir><file name="Product.php" hash="b1941b6372101be40a6f50e2ea9b5730"/><file name="Rating.php" hash="afa2525e2e6445b8be37cb8ed1e8cd7b"/><file name="Sku.php" hash="0fc043ea0a096484da9a08d5d27243ee"/><file name="Transaction.php" hash="54b5ebee95e7b1bf7106d1a724298cfd"/></dir><file name="Generatefeeds.php" hash="195d222ae5828e0126af18e5d57a3fca"/><file name="Job.php" hash="3843e67eba2b9c3b99204b94380f1f4a"/><file name="Layout.php" hash="33314a96c23ec236134335107afcb432"/><dir name="Mysql4"><dir name="Job"><file name="Collection.php" hash="9990fbd66abbfc6ceaa621178fb4e660"/></dir><file name="Job.php" hash="9701e2bd09c20230d72bd4f2ada0644d"/></dir><file name="Observer.php" hash="9fd630da7e42d9fc9bb50a7a5213e70f"/><dir name="System"><dir name="Config"><file name="EnableToggle.php" hash="abefbe5e7e238cb8f30c10e9a7ab41f7"/><file name="LogOptions.php" hash="279646a61f4bf0d88639e197a04a8357"/><file name="ProductAttributes.php" hash="cf51c552ec604cf97832e43a38341e35"/></dir><dir name="Validate"><file name="ProductAttributes.php" hash="4c6720eb5358df9ceb0ba2aca828a76a"/></dir></dir><file name="Transferfeeds.php" hash="486566ec325d6684c88a04674582dc75"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="3510e2bddcec137a8a70c4cb2630d5dd"/><file name="JobController.php" hash="ec8f487f0f6d5c24e55cd97ebcc6019e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4be070d4ce9036999d45688d10e7ce1b"/><file name="config.xml" hash="a803a102853f14136af276473d3fed40"/><file name="system.xml" hash="bfc1bf69d1a63f0f1029f9b86a30d865"/></dir><dir name="sql"><dir name="mybuys_setup"><file name="mysql4-install-0.1.0.php" hash="b6bac0c8b7114d2ea82ec475b04f79cf"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mybuys_Connector.xml" hash="14aec0d955d540ed48d2d4094c352ea6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="recommendation_zone.css" hash="95918555ee7ccbc6e40743891eafe394"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mybuys.xml" hash="3f89770cb6104ae758199745a621c933"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="mybuys"><file name="websitecode.xml" hash="f8ea5dddedea470d5e32e53f3846dd1d"/><file name="websitecode_sort.xml" hash="1b8e661cc249cfd29dde10e7131c68f2"/></dir></dir><dir name="template"><dir name="mybuys"><dir name="websitecode"><file name="button.phtml" hash="ba0c05073295c03e68a6a66da14e366d"/><file name="header.phtml" hash="53e93d529e97c9b1e4ed3e8fe0391975"/><file name="init.phtml" hash="8ee89b0e9c240e4ebd31b83aa344b564"/><dir name="params"><file name="category.phtml" hash="95867c942c6b279526304e68b5eaa216"/><file name="checkout.phtml" hash="3cd6fdd56a123d926e98e660c19e33c7"/><file name="confirmation.phtml" hash="a79f164398e53cc907ccf322b7653e83"/><file name="home.phtml" hash="c4d8335c1f22dbf0cca4b5dab1a08a07"/><file name="product.phtml" hash="0b599ca72c82820901ce52bc74545f64"/><file name="product_review.phtml" hash="0e60d20e757f6e2ad2edbb39d5e1bc3e"/><file name="search.phtml" hash="be7b8cb51dfe49b31a9fafc0483b4805"/><file name="target_rule_related.phtml" hash="542669310cbd16d70d477b25fd014129"/><file name="target_rule_upsell.phtml" hash="6e2d929139d38d18e30bf9976cb91080"/></dir><dir name="recomendationzone"><file name="zone_add_to_cart.phtml" hash="b1e2751108e0d6e8133cdbeaced2a255"/><file name="zone_category.phtml" hash="4d98265d3ad509d4a1f56fde5b6868a2"/><file name="zone_checkout.phtml" hash="9c358c3d1357c976da67716ef4c5c5f6"/><file name="zone_home.phtml" hash="8694c9ceab4321800fff8859333aaee1"/><file name="zone_order_confirmation.phtml" hash="1634f70d7913bfb45a5f13d412804295"/><file name="zone_product_detail.phtml" hash="858aac3194c854a0dd71908e3702cd21"/><file name="zone_product_review.phtml" hash="6c5a12fd9ee2d9e0e48816517e9205dd"/><file name="zone_search_result.phtml" hash="5dc464f4cd9e0d16ccf7415dfa0dfe3a"/></dir><dir name="test"><file name="default.phtml" hash="a04d6966c08efb5ae1fd39e7e86303ca"/><file name="high.phtml" hash="8643ca34830041d3ff1676cb0e71805e"/><file name="leaf.phtml" hash="b19d8c382edb4bf934470872ac63304b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|