Version Notes
Log out and log in after install to get access to the configuration interface! You will find it in the menu [System -> Configuration -> IREUS Recommendation Engine]
Download this release
Release Info
| Developer | prudsys IREUS Team |
| Extension | IREUS_Recommendation_Engine_Interface |
| Version | 2.2.8 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.7 to 2.2.8
- app/code/community/Netresearch/Ireus/Block/Data.php +96 -53
- app/code/community/Netresearch/Ireus/Model/Observer.php +3 -1
- app/code/community/Netresearch/Ireus/controllers/ExportController.php +11 -1
- app/code/community/Netresearch/Ireus/controllers/ExportController_fast.php +338 -0
- app/code/community/Netresearch/Ireus/controllers/ExportController_final.php +380 -0
- app/code/community/Netresearch/Ireus/controllers/ExportController_noprice.php +397 -0
- app/code/community/Netresearch/Ireus/controllers/ExportController_singlerow.php +417 -0
- app/code/community/Netresearch/Ireus/etc/config.xml +10 -1
- app/code/community/Netresearch/Ireus/etc/system.xml +11 -1
- app/design/frontend/default/default/layout/ireus.xml +4 -9
- lib/Ireus/Controller/Cache.php +1 -1
- lib/Ireus/Controller/Export.php +12 -12
- lib/Ireus/Model/Csv.php +3 -17
- lib/Ireus/View/Client/event.tpl.php +1 -1
- lib/Ireus/View/Client/home.tpl.php +1 -5
- lib/Ireus/View/Client/product.tpl.php +1 -5
- lib/Ireus/View/Client/user.tpl.php +1 -5
- package.xml +11 -14
app/code/community/Netresearch/Ireus/Block/Data.php
CHANGED
|
@@ -22,12 +22,12 @@
|
|
| 22 |
* @author Stephan Hoyer, Germany
|
| 23 |
* @author Silvio Steiger, Germany
|
| 24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*
|
| 26 |
* $Id$
|
| 27 |
*/
|
| 28 |
|
| 29 |
|
| 30 |
-
// Register IREUS PHP Framework
|
| 31 |
require_once('IreusAutoloader.php');
|
| 32 |
IreusAutoloader::getInstance()->register();
|
| 33 |
|
|
@@ -44,18 +44,18 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 44 |
|
| 45 |
/**
|
| 46 |
* returns current product id
|
| 47 |
-
*
|
| 48 |
* @return int
|
| 49 |
*/
|
| 50 |
protected function getProductId()
|
| 51 |
{
|
| 52 |
return Mage::registry('product')->getId();
|
| 53 |
}
|
| 54 |
-
|
| 55 |
-
|
| 56 |
/**
|
| 57 |
* returns debug mode
|
| 58 |
-
*
|
| 59 |
* @return bool
|
| 60 |
*/
|
| 61 |
protected function isDebugMode()
|
|
@@ -63,43 +63,72 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 63 |
return Mage::getStoreConfig('ireus/settings/debug');
|
| 64 |
}
|
| 65 |
|
| 66 |
-
|
| 67 |
/**
|
| 68 |
* returns ireus-customer related Recommendation Engine ID
|
| 69 |
-
*
|
| 70 |
-
* @return string
|
| 71 |
*/
|
| 72 |
protected function getEngineId()
|
| 73 |
{
|
| 74 |
return Mage::getStoreConfig('ireus/settings/re_id');
|
| 75 |
}
|
| 76 |
-
|
| 77 |
-
|
| 78 |
/**
|
| 79 |
* returns current session id
|
| 80 |
-
*
|
| 81 |
* @return string
|
| 82 |
*/
|
| 83 |
protected function getSessionId()
|
| 84 |
{
|
| 85 |
return Mage::getSingleton("customer/session")->getSessionId();
|
| 86 |
}
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
/**
|
| 90 |
* returns current user id
|
| 91 |
-
*
|
| 92 |
* @return string
|
| 93 |
*/
|
| 94 |
protected function getUserId()
|
| 95 |
{
|
| 96 |
return Mage::getSingleton("customer/session")->getCustomer()->getId();
|
| 97 |
-
}
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
/**
|
| 101 |
* returns current category id
|
| 102 |
-
*
|
| 103 |
* @return int
|
| 104 |
*/
|
| 105 |
protected function getCategoryId()
|
|
@@ -107,33 +136,33 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 107 |
return Mage::registry('current_category')->getId();
|
| 108 |
}
|
| 109 |
|
| 110 |
-
|
| 111 |
/**
|
| 112 |
* determines, whether it has been ordered something by current visitor
|
| 113 |
-
*
|
| 114 |
* @return bool
|
| 115 |
*/
|
| 116 |
protected function hasRecentlyOrdered()
|
| 117 |
{
|
| 118 |
$this->latestMultishippingOrderIds = Mage::getSingleton('core/session')->getOrderIds(true);
|
| 119 |
-
|
| 120 |
//Multishipping
|
| 121 |
if(count($this->latestMultishippingOrderIds)) {
|
| 122 |
return true;
|
| 123 |
}
|
| 124 |
-
|
| 125 |
//OnePageCheckout
|
| 126 |
if(Mage::getSingleton('checkout/session')->getLastQuoteId()) {
|
| 127 |
return true;
|
| 128 |
}
|
| 129 |
-
|
| 130 |
return false;
|
| 131 |
}
|
| 132 |
|
| 133 |
-
|
| 134 |
/**
|
| 135 |
* returns last ordered quote
|
| 136 |
-
*
|
| 137 |
* @return Mage_Sales_Quote
|
| 138 |
*/
|
| 139 |
protected function getLatestQuote()
|
|
@@ -146,7 +175,7 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 146 |
return $this->latestQuote;
|
| 147 |
}
|
| 148 |
|
| 149 |
-
|
| 150 |
/**
|
| 151 |
* returns an array of products and theirs ordered qtys like
|
| 152 |
*
|
|
@@ -171,7 +200,19 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 171 |
$items = $this->getLatestQuote()->getAllItems();
|
| 172 |
}
|
| 173 |
foreach($items as $item) {
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
$qtys[] = !is_null($item->getQty()) ? $item->getQty() : $item->getQtyOrdered();
|
| 176 |
}
|
| 177 |
$this->latestOrderedProducts = array('ids' => $ids, 'qtys' => $qtys);
|
|
@@ -179,10 +220,10 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 179 |
return $this->latestOrderedProducts;
|
| 180 |
}
|
| 181 |
|
| 182 |
-
|
| 183 |
/**
|
| 184 |
* returns array of last ordered product ids
|
| 185 |
-
*
|
| 186 |
* @return array
|
| 187 |
*/
|
| 188 |
protected function getLatestOrderedProductIds()
|
|
@@ -191,7 +232,7 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 191 |
return $products['ids'];
|
| 192 |
}
|
| 193 |
|
| 194 |
-
|
| 195 |
/**
|
| 196 |
* returns array of last ordered product qtys
|
| 197 |
*
|
|
@@ -203,10 +244,10 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 203 |
return $products['qtys'];
|
| 204 |
}
|
| 205 |
|
| 206 |
-
|
| 207 |
/**
|
| 208 |
* returns id of latest product added to cart
|
| 209 |
-
*
|
| 210 |
* @return int
|
| 211 |
*/
|
| 212 |
protected function getLatestAddedProductId()
|
|
@@ -218,10 +259,10 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 218 |
return $this->latestAddedProduct;
|
| 219 |
}
|
| 220 |
|
| 221 |
-
|
| 222 |
/**
|
| 223 |
* determines whether the current visitor has puted something to cart
|
| 224 |
-
*
|
| 225 |
* @return bool
|
| 226 |
*/
|
| 227 |
protected function hasRecentlyAddedSomethingToCart()
|
|
@@ -231,11 +272,11 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 231 |
}
|
| 232 |
return isset($this->latestAddedProduct);
|
| 233 |
}
|
| 234 |
-
|
| 235 |
-
|
| 236 |
/**
|
| 237 |
* determines where Ireus should display something on the current page
|
| 238 |
-
*
|
| 239 |
* @return bool
|
| 240 |
*/
|
| 241 |
protected function isActive()
|
|
@@ -243,7 +284,7 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 243 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 244 |
return false;
|
| 245 |
}
|
| 246 |
-
|
| 247 |
switch(Mage::app()->getRequest()->getControllerName())
|
| 248 |
{
|
| 249 |
case 'product': // show product
|
|
@@ -289,10 +330,10 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 289 |
return false;
|
| 290 |
}
|
| 291 |
|
| 292 |
-
|
| 293 |
/**
|
| 294 |
* generates JSON data of parameters needed by Ireus
|
| 295 |
-
*
|
| 296 |
* @return string
|
| 297 |
*/
|
| 298 |
protected function getJsonData()
|
|
@@ -300,11 +341,13 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 300 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 301 |
return "";
|
| 302 |
}
|
| 303 |
-
|
| 304 |
$return = array (
|
| 305 |
'reid' => $this->getEngineId(),
|
| 306 |
'sid' => $this->getSessionId(),
|
| 307 |
-
'uid' => $this->getUserId()
|
|
|
|
|
|
|
| 308 |
);
|
| 309 |
|
| 310 |
if($this->isDebugMode()) {
|
|
@@ -336,12 +379,12 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 336 |
break;
|
| 337 |
case 'cart':
|
| 338 |
if ($this->getNameInLayout() == 'ireus_databasket'
|
| 339 |
-
&& $this->hasRecentlyAddedSomethingToCart()
|
| 340 |
) {
|
| 341 |
$return['pid'] = $this->getLatestAddedProductId();
|
| 342 |
$return['e'] = 'basket';
|
| 343 |
}
|
| 344 |
-
else
|
| 345 |
{
|
| 346 |
$return['cid'] = '';
|
| 347 |
$return['e'] = 'home';
|
|
@@ -354,7 +397,7 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 354 |
$return['cid'] = '';
|
| 355 |
$return['e'] = 'home';
|
| 356 |
}
|
| 357 |
-
else
|
| 358 |
{
|
| 359 |
$return['pids'] = implode(',', $this->getLatestOrderedProductIds());
|
| 360 |
$return['qty'] = implode(',', $this->getLatestOrderedQtys());
|
|
@@ -364,11 +407,11 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 364 |
}
|
| 365 |
return Zend_Json::encode($return);
|
| 366 |
}
|
| 367 |
-
|
| 368 |
-
|
| 369 |
/**
|
| 370 |
* Gets cached data for noscript fallback
|
| 371 |
-
*
|
| 372 |
* @return string
|
| 373 |
*/
|
| 374 |
protected function getCachedRecomms()
|
|
@@ -376,16 +419,16 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 376 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 377 |
return '';
|
| 378 |
}
|
| 379 |
-
|
| 380 |
$sidparam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 381 |
-
|
| 382 |
switch(Mage::app()->getRequest()->getControllerName())
|
| 383 |
{
|
| 384 |
case 'product':
|
| 385 |
$event = 'product';
|
| 386 |
$id = $this->getProductId();
|
| 387 |
break;
|
| 388 |
-
|
| 389 |
case 'category':
|
| 390 |
$event = 'user';
|
| 391 |
$id = $this->getCategoryId();
|
|
@@ -397,12 +440,12 @@ class Netresearch_Ireus_Block_Data extends Mage_Core_Block_Template
|
|
| 397 |
$id = '';
|
| 398 |
break;
|
| 399 |
}
|
| 400 |
-
|
| 401 |
return Ireus_Controller_Cache::getContent(
|
| 402 |
$this->getEngineId(),
|
| 403 |
$this->getSessionId(),
|
| 404 |
-
$event,
|
| 405 |
-
$id,
|
| 406 |
Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus',
|
| 407 |
array(
|
| 408 |
'&'.$sidparam.'=%SID%',
|
| 22 |
* @author Stephan Hoyer, Germany
|
| 23 |
* @author Silvio Steiger, Germany
|
| 24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*
|
| 26 |
* $Id$
|
| 27 |
*/
|
| 28 |
|
| 29 |
|
| 30 |
+
// Register IREUS PHP Framework
|
| 31 |
require_once('IreusAutoloader.php');
|
| 32 |
IreusAutoloader::getInstance()->register();
|
| 33 |
|
| 44 |
|
| 45 |
/**
|
| 46 |
* returns current product id
|
| 47 |
+
*
|
| 48 |
* @return int
|
| 49 |
*/
|
| 50 |
protected function getProductId()
|
| 51 |
{
|
| 52 |
return Mage::registry('product')->getId();
|
| 53 |
}
|
| 54 |
+
|
| 55 |
+
|
| 56 |
/**
|
| 57 |
* returns debug mode
|
| 58 |
+
*
|
| 59 |
* @return bool
|
| 60 |
*/
|
| 61 |
protected function isDebugMode()
|
| 63 |
return Mage::getStoreConfig('ireus/settings/debug');
|
| 64 |
}
|
| 65 |
|
| 66 |
+
|
| 67 |
/**
|
| 68 |
* returns ireus-customer related Recommendation Engine ID
|
| 69 |
+
*
|
| 70 |
+
* @return string
|
| 71 |
*/
|
| 72 |
protected function getEngineId()
|
| 73 |
{
|
| 74 |
return Mage::getStoreConfig('ireus/settings/re_id');
|
| 75 |
}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
/**
|
| 79 |
* returns current session id
|
| 80 |
+
*
|
| 81 |
* @return string
|
| 82 |
*/
|
| 83 |
protected function getSessionId()
|
| 84 |
{
|
| 85 |
return Mage::getSingleton("customer/session")->getSessionId();
|
| 86 |
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* returns if session cookies are enabled
|
| 91 |
+
*
|
| 92 |
+
* @return string
|
| 93 |
+
*/
|
| 94 |
+
protected function getEnableSessionCookies()
|
| 95 |
+
{
|
| 96 |
+
return (Mage::getStoreConfig('ireus/settings/enable_session_cookies') ? true : false);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* returns if user permitted cookies according to the EU cookie law
|
| 102 |
+
*
|
| 103 |
+
* @return string
|
| 104 |
+
*/
|
| 105 |
+
protected function getEnablePersistentCookies()
|
| 106 |
+
{
|
| 107 |
+
if (class_exists('Mage::helper(\'core/cookie\')->isUserNotAllowSaveCookie()')
|
| 108 |
+
) {
|
| 109 |
+
return (Mage::helper('core/cookie')->isUserNotAllowSaveCookie() ? false : true);
|
| 110 |
+
}
|
| 111 |
+
else
|
| 112 |
+
{
|
| 113 |
+
return true;
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
|
| 118 |
/**
|
| 119 |
* returns current user id
|
| 120 |
+
*
|
| 121 |
* @return string
|
| 122 |
*/
|
| 123 |
protected function getUserId()
|
| 124 |
{
|
| 125 |
return Mage::getSingleton("customer/session")->getCustomer()->getId();
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
|
|
|
|
| 129 |
/**
|
| 130 |
* returns current category id
|
| 131 |
+
*
|
| 132 |
* @return int
|
| 133 |
*/
|
| 134 |
protected function getCategoryId()
|
| 136 |
return Mage::registry('current_category')->getId();
|
| 137 |
}
|
| 138 |
|
| 139 |
+
|
| 140 |
/**
|
| 141 |
* determines, whether it has been ordered something by current visitor
|
| 142 |
+
*
|
| 143 |
* @return bool
|
| 144 |
*/
|
| 145 |
protected function hasRecentlyOrdered()
|
| 146 |
{
|
| 147 |
$this->latestMultishippingOrderIds = Mage::getSingleton('core/session')->getOrderIds(true);
|
| 148 |
+
|
| 149 |
//Multishipping
|
| 150 |
if(count($this->latestMultishippingOrderIds)) {
|
| 151 |
return true;
|
| 152 |
}
|
| 153 |
+
|
| 154 |
//OnePageCheckout
|
| 155 |
if(Mage::getSingleton('checkout/session')->getLastQuoteId()) {
|
| 156 |
return true;
|
| 157 |
}
|
| 158 |
+
|
| 159 |
return false;
|
| 160 |
}
|
| 161 |
|
| 162 |
+
|
| 163 |
/**
|
| 164 |
* returns last ordered quote
|
| 165 |
+
*
|
| 166 |
* @return Mage_Sales_Quote
|
| 167 |
*/
|
| 168 |
protected function getLatestQuote()
|
| 175 |
return $this->latestQuote;
|
| 176 |
}
|
| 177 |
|
| 178 |
+
|
| 179 |
/**
|
| 180 |
* returns an array of products and theirs ordered qtys like
|
| 181 |
*
|
| 200 |
$items = $this->getLatestQuote()->getAllItems();
|
| 201 |
}
|
| 202 |
foreach($items as $item) {
|
| 203 |
+
|
| 204 |
+
// Grouped product?
|
| 205 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')
|
| 206 |
+
->getParentIdsByChild($item->getProductId());
|
| 207 |
+
if (isset($parentIds[0])
|
| 208 |
+
) {
|
| 209 |
+
$ids[] = $parentIds[0];
|
| 210 |
+
}
|
| 211 |
+
else
|
| 212 |
+
{
|
| 213 |
+
$ids[] = $item->getProductId();
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
$qtys[] = !is_null($item->getQty()) ? $item->getQty() : $item->getQtyOrdered();
|
| 217 |
}
|
| 218 |
$this->latestOrderedProducts = array('ids' => $ids, 'qtys' => $qtys);
|
| 220 |
return $this->latestOrderedProducts;
|
| 221 |
}
|
| 222 |
|
| 223 |
+
|
| 224 |
/**
|
| 225 |
* returns array of last ordered product ids
|
| 226 |
+
*
|
| 227 |
* @return array
|
| 228 |
*/
|
| 229 |
protected function getLatestOrderedProductIds()
|
| 232 |
return $products['ids'];
|
| 233 |
}
|
| 234 |
|
| 235 |
+
|
| 236 |
/**
|
| 237 |
* returns array of last ordered product qtys
|
| 238 |
*
|
| 244 |
return $products['qtys'];
|
| 245 |
}
|
| 246 |
|
| 247 |
+
|
| 248 |
/**
|
| 249 |
* returns id of latest product added to cart
|
| 250 |
+
*
|
| 251 |
* @return int
|
| 252 |
*/
|
| 253 |
protected function getLatestAddedProductId()
|
| 259 |
return $this->latestAddedProduct;
|
| 260 |
}
|
| 261 |
|
| 262 |
+
|
| 263 |
/**
|
| 264 |
* determines whether the current visitor has puted something to cart
|
| 265 |
+
*
|
| 266 |
* @return bool
|
| 267 |
*/
|
| 268 |
protected function hasRecentlyAddedSomethingToCart()
|
| 272 |
}
|
| 273 |
return isset($this->latestAddedProduct);
|
| 274 |
}
|
| 275 |
+
|
| 276 |
+
|
| 277 |
/**
|
| 278 |
* determines where Ireus should display something on the current page
|
| 279 |
+
*
|
| 280 |
* @return bool
|
| 281 |
*/
|
| 282 |
protected function isActive()
|
| 284 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 285 |
return false;
|
| 286 |
}
|
| 287 |
+
|
| 288 |
switch(Mage::app()->getRequest()->getControllerName())
|
| 289 |
{
|
| 290 |
case 'product': // show product
|
| 330 |
return false;
|
| 331 |
}
|
| 332 |
|
| 333 |
+
|
| 334 |
/**
|
| 335 |
* generates JSON data of parameters needed by Ireus
|
| 336 |
+
*
|
| 337 |
* @return string
|
| 338 |
*/
|
| 339 |
protected function getJsonData()
|
| 341 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 342 |
return "";
|
| 343 |
}
|
| 344 |
+
|
| 345 |
$return = array (
|
| 346 |
'reid' => $this->getEngineId(),
|
| 347 |
'sid' => $this->getSessionId(),
|
| 348 |
+
'uid' => $this->getUserId(),
|
| 349 |
+
'session' => $this->getEnableSessionCookies(),
|
| 350 |
+
'cookie' => $this->getEnablePersistentCookies()
|
| 351 |
);
|
| 352 |
|
| 353 |
if($this->isDebugMode()) {
|
| 379 |
break;
|
| 380 |
case 'cart':
|
| 381 |
if ($this->getNameInLayout() == 'ireus_databasket'
|
| 382 |
+
&& $this->hasRecentlyAddedSomethingToCart()
|
| 383 |
) {
|
| 384 |
$return['pid'] = $this->getLatestAddedProductId();
|
| 385 |
$return['e'] = 'basket';
|
| 386 |
}
|
| 387 |
+
else
|
| 388 |
{
|
| 389 |
$return['cid'] = '';
|
| 390 |
$return['e'] = 'home';
|
| 397 |
$return['cid'] = '';
|
| 398 |
$return['e'] = 'home';
|
| 399 |
}
|
| 400 |
+
else
|
| 401 |
{
|
| 402 |
$return['pids'] = implode(',', $this->getLatestOrderedProductIds());
|
| 403 |
$return['qty'] = implode(',', $this->getLatestOrderedQtys());
|
| 407 |
}
|
| 408 |
return Zend_Json::encode($return);
|
| 409 |
}
|
| 410 |
+
|
| 411 |
+
|
| 412 |
/**
|
| 413 |
* Gets cached data for noscript fallback
|
| 414 |
+
*
|
| 415 |
* @return string
|
| 416 |
*/
|
| 417 |
protected function getCachedRecomms()
|
| 419 |
if(!Mage::getStoreConfig('ireus/settings/active')) {
|
| 420 |
return '';
|
| 421 |
}
|
| 422 |
+
|
| 423 |
$sidparam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 424 |
+
|
| 425 |
switch(Mage::app()->getRequest()->getControllerName())
|
| 426 |
{
|
| 427 |
case 'product':
|
| 428 |
$event = 'product';
|
| 429 |
$id = $this->getProductId();
|
| 430 |
break;
|
| 431 |
+
|
| 432 |
case 'category':
|
| 433 |
$event = 'user';
|
| 434 |
$id = $this->getCategoryId();
|
| 440 |
$id = '';
|
| 441 |
break;
|
| 442 |
}
|
| 443 |
+
|
| 444 |
return Ireus_Controller_Cache::getContent(
|
| 445 |
$this->getEngineId(),
|
| 446 |
$this->getSessionId(),
|
| 447 |
+
$event,
|
| 448 |
+
$id,
|
| 449 |
Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus',
|
| 450 |
array(
|
| 451 |
'&'.$sidparam.'=%SID%',
|
app/code/community/Netresearch/Ireus/Model/Observer.php
CHANGED
|
@@ -33,6 +33,8 @@ class Netresearch_Ireus_Model_Observer
|
|
| 33 |
{
|
| 34 |
Mage::getSingleton('checkout/session')
|
| 35 |
->setData('latestAddedProductsId', $observer['product']->getId());
|
|
|
|
|
|
|
| 36 |
return $this;
|
| 37 |
}
|
| 38 |
-
}
|
| 33 |
{
|
| 34 |
Mage::getSingleton('checkout/session')
|
| 35 |
->setData('latestAddedProductsId', $observer['product']->getId());
|
| 36 |
+
Mage::getSingleton('checkout/session')
|
| 37 |
+
->setData('callBasket', true);
|
| 38 |
return $this;
|
| 39 |
}
|
| 40 |
+
}
|
app/code/community/Netresearch/Ireus/controllers/ExportController.php
CHANGED
|
@@ -59,7 +59,7 @@ class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Acti
|
|
| 59 |
'imageURL' => 'images_url',
|
| 60 |
'netUnitPrice' => 'price',
|
| 61 |
'onlineFlag' => 'is_salable',
|
| 62 |
-
'
|
| 63 |
'strikeOutPrice' => 'special_price'
|
| 64 |
);
|
| 65 |
|
|
@@ -302,6 +302,16 @@ class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Acti
|
|
| 302 |
|
| 303 |
// Add parameters manually
|
| 304 |
$productarray = $product->getData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
$productarray['is_salable'] = $product->isSaleable();
|
| 306 |
|
| 307 |
// Stream result in parts of 10
|
| 59 |
'imageURL' => 'images_url',
|
| 60 |
'netUnitPrice' => 'price',
|
| 61 |
'onlineFlag' => 'is_salable',
|
| 62 |
+
'stock' => 'qty',
|
| 63 |
'strikeOutPrice' => 'special_price'
|
| 64 |
);
|
| 65 |
|
| 302 |
|
| 303 |
// Add parameters manually
|
| 304 |
$productarray = $product->getData();
|
| 305 |
+
if ($product->getTypeId() == 'simple'
|
| 306 |
+
|| $product->getTypeId() == 'virtual'
|
| 307 |
+
|| $product->getTypeId() == 'downloadable'
|
| 308 |
+
) {
|
| 309 |
+
$finalprice = $product->getFinalPrice();
|
| 310 |
+
if ($productarray['price'] != $finalprice
|
| 311 |
+
) {
|
| 312 |
+
$productarray['special_price'] = $finalprice;
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
$productarray['is_salable'] = $product->isSaleable();
|
| 316 |
|
| 317 |
// Stream result in parts of 10
|
app/code/community/Netresearch/Ireus/controllers/ExportController_fast.php
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* IREUS
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0).
|
| 8 |
+
* It is available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
* If you are unable to obtain the license through the world-wide-web,
|
| 11 |
+
* please send an email to support@ireus.net so we can send you a copy.
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade Ireus to newer
|
| 16 |
+
* versions in the future. If you wish to customize Ireus for your
|
| 17 |
+
* needs please refer to http://www.ireus.net for more information.
|
| 18 |
+
*
|
| 19 |
+
* @category IREUS Recommendation Engine
|
| 20 |
+
* @package Ireus
|
| 21 |
+
* @copyright Copyright (c) 2010 prudsys AG (http://www.prudsys.com)
|
| 22 |
+
* @author Stephan Hoyer, Germany
|
| 23 |
+
* @author Silvio Steiger, Germany
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*
|
| 26 |
+
* $Id$
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
// Register IREUS PHP Framework
|
| 31 |
+
require_once('IreusAutoloader.php');
|
| 32 |
+
IreusAutoloader::getInstance()->register();
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Action
|
| 36 |
+
{
|
| 37 |
+
const CONFIG_SECURITY_CODE = 'ireus/settings/security_code';
|
| 38 |
+
const CONFIG_EXPORT_DISABLED_CATEGORIES = 'ireus/settings/export_disabled_categories';
|
| 39 |
+
const CONFIG_IMAGE_WIDTH = 'ireus/settings/image_width';
|
| 40 |
+
const CONFIG_IMAGE_HEIGHT = 'ireus/settings/image_height';
|
| 41 |
+
const PAGE_SIZE = 1;
|
| 42 |
+
|
| 43 |
+
var $_storeId ='admin';
|
| 44 |
+
|
| 45 |
+
var $_ordersColumns = array(
|
| 46 |
+
'tid' => 'order_id',
|
| 47 |
+
'pid' => 'product_id'
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
var $_productsColumns = array(
|
| 51 |
+
'pid' => 'entity_id',
|
| 52 |
+
'sku' => 'sku',
|
| 53 |
+
'name' => 'name',
|
| 54 |
+
'brand' => 'brand',
|
| 55 |
+
'manufacturer' => 'manufacturer',
|
| 56 |
+
'description' => 'short_description',
|
| 57 |
+
'param1' => 'add_to_cart_url',
|
| 58 |
+
'URL' => 'url',
|
| 59 |
+
'imageURL' => 'images_url',
|
| 60 |
+
'netUnitPrice' => 'price',
|
| 61 |
+
'onlineFlag' => 'is_salable',
|
| 62 |
+
'quantity' => 'qty',
|
| 63 |
+
'strikeOutPrice' => 'special_price'
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
static $_sessionId;
|
| 67 |
+
|
| 68 |
+
static $_sessionIdQueryParam;
|
| 69 |
+
|
| 70 |
+
static $_ireusplaceholder = '%SID%';
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Check security code and redirect to 404 if not given or wrong
|
| 75 |
+
*
|
| 76 |
+
* @return Netresearch_Ireus_ExportController
|
| 77 |
+
*/
|
| 78 |
+
public function preDispatch()
|
| 79 |
+
{
|
| 80 |
+
parent::preDispatch();
|
| 81 |
+
$security_code = Mage::App()->getRequest()->getParam('code');
|
| 82 |
+
if(
|
| 83 |
+
is_null($security_code) or
|
| 84 |
+
$security_code != Mage::getStoreConfig(self::CONFIG_SECURITY_CODE)
|
| 85 |
+
) {
|
| 86 |
+
$this->_redirect('noroute');
|
| 87 |
+
$this->setFlag('',self::FLAG_NO_DISPATCH,true);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if ($this->getRequest()->getParam('store')
|
| 91 |
+
) {
|
| 92 |
+
$this->_setActiveStore($this->getRequest()->getParam('store'));
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
$this->_storeId = Mage::App()->getStore()->getCode();
|
| 96 |
+
self::$_sessionId = Mage::getSingleton('core/session')->getSessionId();
|
| 97 |
+
self::$_sessionIdQueryParam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 98 |
+
|
| 99 |
+
return $this;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Output a CSV of all products with their
|
| 105 |
+
* categories and all parent categories,
|
| 106 |
+
*
|
| 107 |
+
* @return null
|
| 108 |
+
*/
|
| 109 |
+
public function categoriesAction()
|
| 110 |
+
{
|
| 111 |
+
// Change maximum execution time
|
| 112 |
+
set_time_limit(0);
|
| 113 |
+
|
| 114 |
+
foreach(Mage::getModel('Catalog/Category')
|
| 115 |
+
->getCollection()
|
| 116 |
+
->addFieldToFilter('is_active', 1)
|
| 117 |
+
->addFieldToFilter('level', array('gt' => 1))
|
| 118 |
+
->addAttributeToSelect('name') as $category
|
| 119 |
+
) {
|
| 120 |
+
if($category->getProductCount()
|
| 121 |
+
) {
|
| 122 |
+
$collection = Mage::getModel('Catalog/Category')
|
| 123 |
+
->getCollection()
|
| 124 |
+
->addFieldToFilter('entity_id', array(
|
| 125 |
+
'in' => $category->getPathIds()))
|
| 126 |
+
->addAttributeToSelect('entity_id')
|
| 127 |
+
->addAttributeToSelect('name');
|
| 128 |
+
|
| 129 |
+
foreach ($category->getProductCollection()
|
| 130 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 131 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 132 |
+
->addAttributeToFilter('status',
|
| 133 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 134 |
+
->addAttributeToFilter('visibility', array('in'=>array(
|
| 135 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 136 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 137 |
+
)))
|
| 138 |
+
->addAttributeToFilter('price', array('gt' => 0)) as $product
|
| 139 |
+
) {
|
| 140 |
+
$productsWithCategories = array();
|
| 141 |
+
$pid = $product->getId();
|
| 142 |
+
foreach ($collection as $currentcategory
|
| 143 |
+
) {
|
| 144 |
+
$cid = $currentcategory->getId();
|
| 145 |
+
$productsWithCategories[$pid.$cid] = array(
|
| 146 |
+
'pid' => $pid,
|
| 147 |
+
'cid' => $cid,
|
| 148 |
+
'cidparent' => $currentcategory->getParentId(),
|
| 149 |
+
'cname' => $currentcategory->getName()
|
| 150 |
+
);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
// Stream output product wise
|
| 154 |
+
echo Ireus_Controller_Export::getInstance()
|
| 155 |
+
->createCategoriesCsv($productsWithCategories);
|
| 156 |
+
flush();
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
exit;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Output a CSV of all orders
|
| 167 |
+
*
|
| 168 |
+
* @return null
|
| 169 |
+
*/
|
| 170 |
+
public function ordersAction()
|
| 171 |
+
{
|
| 172 |
+
// Change maximum execution time
|
| 173 |
+
set_time_limit(0);
|
| 174 |
+
|
| 175 |
+
echo Ireus_Controller_Export::getInstance()
|
| 176 |
+
->setOrderColumns($this->_ordersColumns)
|
| 177 |
+
->exportOrdersCsv(Mage::getModel('Sales/Order_Item')->getCollection()->getData());
|
| 178 |
+
|
| 179 |
+
exit;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* Output a CSV of all products with their attributes
|
| 185 |
+
*
|
| 186 |
+
* @return null
|
| 187 |
+
*/
|
| 188 |
+
public function productsAction()
|
| 189 |
+
{
|
| 190 |
+
// Change maximum execution time
|
| 191 |
+
set_time_limit(0);
|
| 192 |
+
|
| 193 |
+
// Prepare the prudsys IREUS Export Controller
|
| 194 |
+
Ireus_Controller_Export::getInstance()
|
| 195 |
+
->setProductColumns($this->_productsColumns);
|
| 196 |
+
|
| 197 |
+
// Get products from database
|
| 198 |
+
$collection = Mage::getModel('Catalog/Product')
|
| 199 |
+
->getCollection()
|
| 200 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 201 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 202 |
+
->addAttributeToFilter('status',
|
| 203 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 204 |
+
->addAttributeToFilter('price', array('gt' => 0))
|
| 205 |
+
->addAttributeToFilter(
|
| 206 |
+
'visibility',
|
| 207 |
+
array(
|
| 208 |
+
'in' => array(
|
| 209 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 210 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 211 |
+
)
|
| 212 |
+
)
|
| 213 |
+
)
|
| 214 |
+
->addAttributeToSelect('small_image');
|
| 215 |
+
foreach($this->_productsColumns as $key) {
|
| 216 |
+
$collection->addAttributeToSelect($key);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
// Add missing information to the collection
|
| 220 |
+
// which cannot be requested directly from database.
|
| 221 |
+
// Here is the most time wasted
|
| 222 |
+
$products = array();
|
| 223 |
+
foreach ($collection as $product)
|
| 224 |
+
{
|
| 225 |
+
$product_url = $product->getProductUrl();
|
| 226 |
+
//$product->setManufacturer($product->getAttributeText('manufacturer'));
|
| 227 |
+
$product->setUrl(self::setSidPlaceholder($product_url));
|
| 228 |
+
$product->setImagesUrl(Mage::helper('Catalog/Image')
|
| 229 |
+
->init($product,'small_image')->resize(
|
| 230 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_WIDTH),
|
| 231 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_HEIGHT)
|
| 232 |
+
)->__toString());
|
| 233 |
+
$product->setAddToCartUrl(self::getAddToCartUrl($product, $product_url));
|
| 234 |
+
|
| 235 |
+
// Stream result in parts of 10
|
| 236 |
+
$products[] = $product->getData();
|
| 237 |
+
|
| 238 |
+
if (count($products) > 9
|
| 239 |
+
) {
|
| 240 |
+
echo Ireus_Controller_Export::getInstance()
|
| 241 |
+
->createProductsCsv($products);
|
| 242 |
+
flush();
|
| 243 |
+
$products = array();
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Stream remaining items
|
| 248 |
+
if (count($products) > 0
|
| 249 |
+
) {
|
| 250 |
+
echo Ireus_Controller_Export::getInstance()
|
| 251 |
+
->createProductsCsv($products);
|
| 252 |
+
flush();
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// Delete cached recommendations
|
| 256 |
+
Ireus_Controller_Cache::deleteCache(Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus');
|
| 257 |
+
|
| 258 |
+
exit;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* Create "add this product to cart" url
|
| 264 |
+
*
|
| 265 |
+
* @param object $collection
|
| 266 |
+
* @param array $additional
|
| 267 |
+
* @return array
|
| 268 |
+
*/
|
| 269 |
+
protected static function getAddToCartUrl($product, $product_url, $additional = array())
|
| 270 |
+
{
|
| 271 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)
|
| 272 |
+
) {
|
| 273 |
+
$url = $product_url;
|
| 274 |
+
$link = (strpos($url, '?') !== false) ? '&' : '?';
|
| 275 |
+
$result = $url . $link . 'options=cart';
|
| 276 |
+
}
|
| 277 |
+
else
|
| 278 |
+
{
|
| 279 |
+
$result = Mage::helper('checkout/cart')->getAddUrl($product, $additional);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
return self::setSidPlaceholder($result);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
/**
|
| 287 |
+
* Sets SessionID placeholder in urls for dynamic SessionID adjustments done by IREUS
|
| 288 |
+
*
|
| 289 |
+
* @param string $url
|
| 290 |
+
* @return string
|
| 291 |
+
*/
|
| 292 |
+
protected static function setSidPlaceholder ($url)
|
| 293 |
+
{
|
| 294 |
+
if (strpos($url, self::$_sessionId)
|
| 295 |
+
) {
|
| 296 |
+
$url = str_replace(self::$_sessionId, self::$_ireusplaceholder, $url);
|
| 297 |
+
}
|
| 298 |
+
else
|
| 299 |
+
{
|
| 300 |
+
$url .= ((strpos($url, '?') !== false) ? '&' : '?')
|
| 301 |
+
. self::$_sessionIdQueryParam
|
| 302 |
+
. '='
|
| 303 |
+
. self::$_ireusplaceholder;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
return $url;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
/**
|
| 311 |
+
* Sets a different store if needed
|
| 312 |
+
*
|
| 313 |
+
* @param Mixed $storeCode can be either storeId or storeCode of store to set
|
| 314 |
+
* @return Mage_Core_Controller_Front_Action
|
| 315 |
+
*/
|
| 316 |
+
protected function _setActiveStore($storeCode)
|
| 317 |
+
{
|
| 318 |
+
if (!$storeCode
|
| 319 |
+
) {
|
| 320 |
+
$storeCode = $this->_storeCode;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// if storeId is used convert to storeCode
|
| 324 |
+
if (is_numeric($storeCode)) {
|
| 325 |
+
$storeCode = Mage::app()->getStore($storeCode)->getCode();
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
// if current store is ok return
|
| 329 |
+
if (Mage::app()->getStore()->getCode() == $storeCode) {
|
| 330 |
+
return $this;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// set active store
|
| 334 |
+
Mage::app()->setCurrentStore($storeCode);
|
| 335 |
+
|
| 336 |
+
return $this;
|
| 337 |
+
}
|
| 338 |
+
}
|
app/code/community/Netresearch/Ireus/controllers/ExportController_final.php
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* IREUS
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0).
|
| 8 |
+
* It is available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
* If you are unable to obtain the license through the world-wide-web,
|
| 11 |
+
* please send an email to support@ireus.net so we can send you a copy.
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade Ireus to newer
|
| 16 |
+
* versions in the future. If you wish to customize Ireus for your
|
| 17 |
+
* needs please refer to http://www.ireus.net for more information.
|
| 18 |
+
*
|
| 19 |
+
* @category IREUS Recommendation Engine
|
| 20 |
+
* @package Ireus
|
| 21 |
+
* @copyright Copyright (c) 2010 prudsys AG (http://www.prudsys.com)
|
| 22 |
+
* @author Stephan Hoyer, Germany
|
| 23 |
+
* @author Silvio Steiger, Germany
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*
|
| 26 |
+
* $Id$
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
// Register IREUS PHP Framework
|
| 31 |
+
require_once('IreusAutoloader.php');
|
| 32 |
+
IreusAutoloader::getInstance()->register();
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Action
|
| 36 |
+
{
|
| 37 |
+
const CONFIG_SECURITY_CODE = 'ireus/settings/security_code';
|
| 38 |
+
const CONFIG_EXPORT_DISABLED_CATEGORIES = 'ireus/settings/export_disabled_categories';
|
| 39 |
+
const CONFIG_IMAGE_WIDTH = 'ireus/settings/image_width';
|
| 40 |
+
const CONFIG_IMAGE_HEIGHT = 'ireus/settings/image_height';
|
| 41 |
+
const PAGE_SIZE = 500;
|
| 42 |
+
|
| 43 |
+
var $_storeId ='admin';
|
| 44 |
+
|
| 45 |
+
var $_ordersColumns = array(
|
| 46 |
+
'tid' => 'order_id',
|
| 47 |
+
'pid' => 'product_id'
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
var $_productsColumns = array(
|
| 51 |
+
'pid' => 'entity_id',
|
| 52 |
+
'sku' => 'sku',
|
| 53 |
+
'name' => 'name',
|
| 54 |
+
'brand' => 'brand',
|
| 55 |
+
'manufacturer' => 'manufacturer',
|
| 56 |
+
'description' => 'short_description',
|
| 57 |
+
'param1' => 'add_to_cart_url',
|
| 58 |
+
'URL' => 'url',
|
| 59 |
+
'imageURL' => 'images_url',
|
| 60 |
+
'netUnitPrice' => 'price',
|
| 61 |
+
'onlineFlag' => 'is_salable',
|
| 62 |
+
'quantity' => 'qty',
|
| 63 |
+
'strikeOutPrice' => 'special_price'
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
static $_sessionId;
|
| 67 |
+
|
| 68 |
+
static $_sessionIdQueryParam;
|
| 69 |
+
|
| 70 |
+
static $_ireusplaceholder = '%SID%';
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Check security code and redirect to 404 if not given or wrong
|
| 75 |
+
*
|
| 76 |
+
* @return Netresearch_Ireus_ExportController
|
| 77 |
+
*/
|
| 78 |
+
public function preDispatch()
|
| 79 |
+
{
|
| 80 |
+
parent::preDispatch();
|
| 81 |
+
$security_code = Mage::App()->getRequest()->getParam('code');
|
| 82 |
+
if(
|
| 83 |
+
is_null($security_code) or
|
| 84 |
+
$security_code != Mage::getStoreConfig(self::CONFIG_SECURITY_CODE)
|
| 85 |
+
) {
|
| 86 |
+
$this->_redirect('noroute');
|
| 87 |
+
$this->setFlag('',self::FLAG_NO_DISPATCH,true);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if ($this->getRequest()->getParam('store')
|
| 91 |
+
) {
|
| 92 |
+
$this->_setActiveStore($this->getRequest()->getParam('store'));
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
$this->_storeId = Mage::App()->getStore()->getCode();
|
| 96 |
+
self::$_sessionId = Mage::getSingleton('core/session')->getSessionId();
|
| 97 |
+
self::$_sessionIdQueryParam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 98 |
+
|
| 99 |
+
return $this;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Output a CSV of all products with their
|
| 105 |
+
* categories and all parent categories,
|
| 106 |
+
*
|
| 107 |
+
* @return null
|
| 108 |
+
*/
|
| 109 |
+
public function categoriesAction()
|
| 110 |
+
{
|
| 111 |
+
// Change maximum execution time
|
| 112 |
+
set_time_limit(0);
|
| 113 |
+
|
| 114 |
+
$product = Mage::getModel('catalog/product');
|
| 115 |
+
|
| 116 |
+
foreach(Mage::getModel('Catalog/Category')
|
| 117 |
+
->getCollection()
|
| 118 |
+
->addFieldToFilter('is_active', 1)
|
| 119 |
+
->addFieldToFilter('level', array('gt' => 1))
|
| 120 |
+
->addAttributeToSelect('name') as $category
|
| 121 |
+
) {
|
| 122 |
+
if($category->getProductCount()
|
| 123 |
+
) {
|
| 124 |
+
$productcategories = Mage::getModel('Catalog/Category')
|
| 125 |
+
->getCollection()
|
| 126 |
+
->addFieldToFilter('entity_id', array(
|
| 127 |
+
'in' => $category->getPathIds()))
|
| 128 |
+
->addAttributeToSelect('entity_id')
|
| 129 |
+
->addAttributeToSelect('name');
|
| 130 |
+
|
| 131 |
+
$collection = $category->getProductCollection()
|
| 132 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 133 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 134 |
+
->addAttributeToFilter('status',
|
| 135 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 136 |
+
->addAttributeToFilter('visibility', array('in'=>array(
|
| 137 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 138 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 139 |
+
)))
|
| 140 |
+
->addAttributeToFilter('price', array('gt' => 0));
|
| 141 |
+
|
| 142 |
+
Mage::getSingleton('core/resource_iterator')
|
| 143 |
+
->walk(
|
| 144 |
+
$collection->getSelect(),
|
| 145 |
+
array(
|
| 146 |
+
array(
|
| 147 |
+
$this,
|
| 148 |
+
'callbackCategoriesAction'
|
| 149 |
+
)
|
| 150 |
+
),
|
| 151 |
+
array(
|
| 152 |
+
'product' => $product,
|
| 153 |
+
'productcategories' => $productcategories
|
| 154 |
+
)
|
| 155 |
+
);
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
exit;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Callback function for the resource iterator of the categories Action
|
| 165 |
+
*
|
| 166 |
+
* @param array $args
|
| 167 |
+
* @return void
|
| 168 |
+
*/
|
| 169 |
+
public function callbackCategoriesAction ($args)
|
| 170 |
+
{
|
| 171 |
+
$product = $args['product'];
|
| 172 |
+
$productcategories = $args['productcategories'];
|
| 173 |
+
$product->setData($args['row']);
|
| 174 |
+
|
| 175 |
+
$productsWithCategories = array();
|
| 176 |
+
$pid = $product->getId();
|
| 177 |
+
foreach ($productcategories as $currentcategory
|
| 178 |
+
) {
|
| 179 |
+
$cid = $currentcategory->getId();
|
| 180 |
+
$productsWithCategories[$pid.$cid] = array(
|
| 181 |
+
'pid' => $pid,
|
| 182 |
+
'cid' => $cid,
|
| 183 |
+
'cidparent' => $currentcategory->getParentId(),
|
| 184 |
+
'cname' => $currentcategory->getName()
|
| 185 |
+
);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// Stream output product wise
|
| 189 |
+
echo Ireus_Controller_Export::getInstance()
|
| 190 |
+
->createCategoriesCsv($productsWithCategories);
|
| 191 |
+
flush();
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
/**
|
| 196 |
+
* Output a CSV of all orders
|
| 197 |
+
*
|
| 198 |
+
* @return null
|
| 199 |
+
*/
|
| 200 |
+
public function ordersAction()
|
| 201 |
+
{
|
| 202 |
+
// Change maximum execution time
|
| 203 |
+
set_time_limit(0);
|
| 204 |
+
|
| 205 |
+
echo Ireus_Controller_Export::getInstance()
|
| 206 |
+
->setOrderColumns($this->_ordersColumns)
|
| 207 |
+
->exportOrdersCsv(Mage::getModel('Sales/Order_Item')->getCollection()->getData());
|
| 208 |
+
|
| 209 |
+
exit;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
/**
|
| 214 |
+
* Output a CSV of all products with their attributes
|
| 215 |
+
*
|
| 216 |
+
* @return null
|
| 217 |
+
*/
|
| 218 |
+
public function productsAction()
|
| 219 |
+
{
|
| 220 |
+
// Change maximum execution time
|
| 221 |
+
set_time_limit(0);
|
| 222 |
+
|
| 223 |
+
// Prepare the prudsys IREUS Export Controller
|
| 224 |
+
Ireus_Controller_Export::getInstance()
|
| 225 |
+
->setProductColumns($this->_productsColumns);
|
| 226 |
+
|
| 227 |
+
// Get products from database
|
| 228 |
+
$collection = Mage::getModel('Catalog/Product')
|
| 229 |
+
->getCollection()
|
| 230 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 231 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 232 |
+
->addAttributeToFilter('status',
|
| 233 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 234 |
+
->addAttributeToFilter('price', array('gt' => 0))
|
| 235 |
+
->addAttributeToFilter(
|
| 236 |
+
'visibility',
|
| 237 |
+
array(
|
| 238 |
+
'in' => array(
|
| 239 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 240 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 241 |
+
)
|
| 242 |
+
)
|
| 243 |
+
)
|
| 244 |
+
->addAttributeToSelect('small_image');
|
| 245 |
+
foreach($this->_productsColumns as $value
|
| 246 |
+
) {
|
| 247 |
+
$collection->addAttributeToSelect($value);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
// Walk through collection page wise
|
| 251 |
+
$countCollection = clone $collection;
|
| 252 |
+
$count = $countCollection->count();
|
| 253 |
+
unset ($countCollection);
|
| 254 |
+
$i=0;
|
| 255 |
+
do {
|
| 256 |
+
$i++;
|
| 257 |
+
$products = array();
|
| 258 |
+
$pageCollection = clone $collection;
|
| 259 |
+
$pageCollection->setPage($i, self::PAGE_SIZE);
|
| 260 |
+
foreach ($pageCollection as $product
|
| 261 |
+
) {
|
| 262 |
+
$product_url = $product->getProductUrl();
|
| 263 |
+
$product->setManufacturer($product->getAttributeText('manufacturer'));
|
| 264 |
+
$product->setUrl(self::setSidPlaceholder($product_url));
|
| 265 |
+
$product->setImagesUrl(Mage::helper('Catalog/Image')
|
| 266 |
+
->init($product,'small_image')
|
| 267 |
+
->resize(
|
| 268 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_WIDTH),
|
| 269 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_HEIGHT)
|
| 270 |
+
)
|
| 271 |
+
->__toString());
|
| 272 |
+
$product->setAddToCartUrl(self::getAddToCartUrl($product, $product_url));
|
| 273 |
+
|
| 274 |
+
// Stream result in parts of 10
|
| 275 |
+
$products[] = $product->getData();
|
| 276 |
+
if (count($products) > 9
|
| 277 |
+
) {
|
| 278 |
+
echo Ireus_Controller_Export::getInstance()
|
| 279 |
+
->createProductsCsv($products);
|
| 280 |
+
flush();
|
| 281 |
+
$products = array();
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
// Stream remaining items
|
| 286 |
+
if (count($products) > 0
|
| 287 |
+
) {
|
| 288 |
+
echo Ireus_Controller_Export::getInstance()
|
| 289 |
+
->createProductsCsv($products);
|
| 290 |
+
flush();
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
$count -= $pageCollection->count();
|
| 294 |
+
|
| 295 |
+
} while($count > 0);
|
| 296 |
+
|
| 297 |
+
// Delete cached recommendations
|
| 298 |
+
Ireus_Controller_Cache::deleteCache(Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus');
|
| 299 |
+
|
| 300 |
+
exit;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
/**
|
| 305 |
+
* Create "add this product to cart" url
|
| 306 |
+
*
|
| 307 |
+
* @param object $collection
|
| 308 |
+
* @param array $additional
|
| 309 |
+
* @return array
|
| 310 |
+
*/
|
| 311 |
+
protected static function getAddToCartUrl($product, $product_url, $additional = array())
|
| 312 |
+
{
|
| 313 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)
|
| 314 |
+
) {
|
| 315 |
+
$url = $product_url;
|
| 316 |
+
$link = (strpos($url, '?') !== false) ? '&' : '?';
|
| 317 |
+
$result = $url . $link . 'options=cart';
|
| 318 |
+
}
|
| 319 |
+
else
|
| 320 |
+
{
|
| 321 |
+
$result = Mage::helper('checkout/cart')->getAddUrl($product, $additional);
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
return self::setSidPlaceholder($result);
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
/**
|
| 329 |
+
* Sets SessionID placeholder in urls for dynamic SessionID adjustments done by IREUS
|
| 330 |
+
*
|
| 331 |
+
* @param string $url
|
| 332 |
+
* @return string
|
| 333 |
+
*/
|
| 334 |
+
protected static function setSidPlaceholder ($url)
|
| 335 |
+
{
|
| 336 |
+
if (strpos($url, self::$_sessionId)
|
| 337 |
+
) {
|
| 338 |
+
$url = str_replace(self::$_sessionId, self::$_ireusplaceholder, $url);
|
| 339 |
+
}
|
| 340 |
+
else
|
| 341 |
+
{
|
| 342 |
+
$url .= ((strpos($url, '?') !== false) ? '&' : '?')
|
| 343 |
+
. self::$_sessionIdQueryParam
|
| 344 |
+
. '='
|
| 345 |
+
. self::$_ireusplaceholder;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
return $url;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
/**
|
| 353 |
+
* Sets a different store if needed
|
| 354 |
+
*
|
| 355 |
+
* @param Mixed $storeCode can be either storeId or storeCode of store to set
|
| 356 |
+
* @return Mage_Core_Controller_Front_Action
|
| 357 |
+
*/
|
| 358 |
+
protected function _setActiveStore($storeCode)
|
| 359 |
+
{
|
| 360 |
+
if (!$storeCode
|
| 361 |
+
) {
|
| 362 |
+
$storeCode = $this->_storeCode;
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
// if storeId is used convert to storeCode
|
| 366 |
+
if (is_numeric($storeCode)) {
|
| 367 |
+
$storeCode = Mage::app()->getStore($storeCode)->getCode();
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
// if current store is ok return
|
| 371 |
+
if (Mage::app()->getStore()->getCode() == $storeCode) {
|
| 372 |
+
return $this;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
// set active store
|
| 376 |
+
Mage::app()->setCurrentStore($storeCode);
|
| 377 |
+
|
| 378 |
+
return $this;
|
| 379 |
+
}
|
| 380 |
+
}
|
app/code/community/Netresearch/Ireus/controllers/ExportController_noprice.php
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* IREUS
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0).
|
| 8 |
+
* It is available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
* If you are unable to obtain the license through the world-wide-web,
|
| 11 |
+
* please send an email to support@ireus.net so we can send you a copy.
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade Ireus to newer
|
| 16 |
+
* versions in the future. If you wish to customize Ireus for your
|
| 17 |
+
* needs please refer to http://www.ireus.net for more information.
|
| 18 |
+
*
|
| 19 |
+
* @category IREUS Recommendation Engine
|
| 20 |
+
* @package Ireus
|
| 21 |
+
* @copyright Copyright (c) 2010 prudsys AG (http://www.prudsys.com)
|
| 22 |
+
* @author Stephan Hoyer, Germany
|
| 23 |
+
* @author Silvio Steiger, Germany
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*
|
| 26 |
+
* $Id$
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
// Register IREUS PHP Framework
|
| 31 |
+
require_once('IreusAutoloader.php');
|
| 32 |
+
IreusAutoloader::getInstance()->register();
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Action
|
| 36 |
+
{
|
| 37 |
+
const CONFIG_SECURITY_CODE = 'ireus/settings/security_code';
|
| 38 |
+
const CONFIG_EXPORT_DISABLED_CATEGORIES = 'ireus/settings/export_disabled_categories';
|
| 39 |
+
const CONFIG_IMAGE_WIDTH = 'ireus/settings/image_width';
|
| 40 |
+
const CONFIG_IMAGE_HEIGHT = 'ireus/settings/image_height';
|
| 41 |
+
const PAGE_SIZE = 500;
|
| 42 |
+
|
| 43 |
+
var $_storeId ='admin';
|
| 44 |
+
|
| 45 |
+
var $_ordersColumns = array(
|
| 46 |
+
'tid' => 'order_id',
|
| 47 |
+
'pid' => 'product_id'
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
var $_productsColumns = array(
|
| 51 |
+
'pid' => 'entity_id',
|
| 52 |
+
'sku' => 'sku',
|
| 53 |
+
'name' => 'name',
|
| 54 |
+
'brand' => 'brand',
|
| 55 |
+
'manufacturer' => 'manufacturer',
|
| 56 |
+
'description' => 'short_description',
|
| 57 |
+
'param1' => 'add_to_cart_url',
|
| 58 |
+
'URL' => 'url',
|
| 59 |
+
'imageURL' => 'images_url',
|
| 60 |
+
'netUnitPrice' => 'price',
|
| 61 |
+
'onlineFlag' => 'is_salable',
|
| 62 |
+
'quantity' => 'qty',
|
| 63 |
+
'strikeOutPrice' => 'special_price'
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
static $_sessionId;
|
| 67 |
+
|
| 68 |
+
static $_sessionIdQueryParam;
|
| 69 |
+
|
| 70 |
+
static $_ireusplaceholder = '%SID%';
|
| 71 |
+
|
| 72 |
+
var $products = array();
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Check security code and redirect to 404 if not given or wrong
|
| 77 |
+
*
|
| 78 |
+
* @return Netresearch_Ireus_ExportController
|
| 79 |
+
*/
|
| 80 |
+
public function preDispatch()
|
| 81 |
+
{
|
| 82 |
+
parent::preDispatch();
|
| 83 |
+
$security_code = Mage::App()->getRequest()->getParam('code');
|
| 84 |
+
if(
|
| 85 |
+
is_null($security_code) or
|
| 86 |
+
$security_code != Mage::getStoreConfig(self::CONFIG_SECURITY_CODE)
|
| 87 |
+
) {
|
| 88 |
+
$this->_redirect('noroute');
|
| 89 |
+
$this->setFlag('',self::FLAG_NO_DISPATCH,true);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
if ($this->getRequest()->getParam('store')
|
| 93 |
+
) {
|
| 94 |
+
$this->_setActiveStore($this->getRequest()->getParam('store'));
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
$this->_storeId = Mage::App()->getStore()->getCode();
|
| 98 |
+
self::$_sessionId = Mage::getSingleton('core/session')->getSessionId();
|
| 99 |
+
self::$_sessionIdQueryParam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 100 |
+
|
| 101 |
+
return $this;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Output a CSV of all products with their
|
| 107 |
+
* categories and all parent categories,
|
| 108 |
+
*
|
| 109 |
+
* @return null
|
| 110 |
+
*/
|
| 111 |
+
public function categoriesAction()
|
| 112 |
+
{
|
| 113 |
+
// Change maximum execution time
|
| 114 |
+
set_time_limit(0);
|
| 115 |
+
|
| 116 |
+
$product = Mage::getModel('catalog/product');
|
| 117 |
+
|
| 118 |
+
foreach(Mage::getModel('Catalog/Category')
|
| 119 |
+
->getCollection()
|
| 120 |
+
->addFieldToFilter('is_active', 1)
|
| 121 |
+
->addFieldToFilter('level', array('gt' => 1))
|
| 122 |
+
->addAttributeToSelect('name') as $category
|
| 123 |
+
) {
|
| 124 |
+
if($category->getProductCount()
|
| 125 |
+
) {
|
| 126 |
+
$productcategories = Mage::getModel('Catalog/Category')
|
| 127 |
+
->getCollection()
|
| 128 |
+
->addFieldToFilter('entity_id', array(
|
| 129 |
+
'in' => $category->getPathIds()))
|
| 130 |
+
->addAttributeToSelect('entity_id')
|
| 131 |
+
->addAttributeToSelect('name');
|
| 132 |
+
|
| 133 |
+
$collection = $category->getProductCollection()
|
| 134 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 135 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 136 |
+
->addAttributeToFilter('status',
|
| 137 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 138 |
+
->addAttributeToFilter('visibility', array('in'=>array(
|
| 139 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 140 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 141 |
+
)))
|
| 142 |
+
->addAttributeToFilter('price', array('gt' => 0));
|
| 143 |
+
|
| 144 |
+
Mage::getSingleton('core/resource_iterator')
|
| 145 |
+
->walk(
|
| 146 |
+
$collection->getSelect(),
|
| 147 |
+
array(
|
| 148 |
+
array(
|
| 149 |
+
$this,
|
| 150 |
+
'callbackCategoriesAction'
|
| 151 |
+
)
|
| 152 |
+
),
|
| 153 |
+
array(
|
| 154 |
+
'product' => $product,
|
| 155 |
+
'productcategories' => $productcategories
|
| 156 |
+
)
|
| 157 |
+
);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
exit;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Callback function for the resource iterator of the categories Action
|
| 167 |
+
*
|
| 168 |
+
* @param array $args
|
| 169 |
+
* @return void
|
| 170 |
+
*/
|
| 171 |
+
public function callbackCategoriesAction ($args)
|
| 172 |
+
{
|
| 173 |
+
$product = $args['product'];
|
| 174 |
+
$productcategories = $args['productcategories'];
|
| 175 |
+
$product->setData($args['row']);
|
| 176 |
+
|
| 177 |
+
$productsWithCategories = array();
|
| 178 |
+
$pid = $product->getId();
|
| 179 |
+
foreach ($productcategories as $currentcategory
|
| 180 |
+
) {
|
| 181 |
+
$cid = $currentcategory->getId();
|
| 182 |
+
$productsWithCategories[$pid.$cid] = array(
|
| 183 |
+
'pid' => $pid,
|
| 184 |
+
'cid' => $cid,
|
| 185 |
+
'cidparent' => $currentcategory->getParentId(),
|
| 186 |
+
'cname' => $currentcategory->getName()
|
| 187 |
+
);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
// Stream output product wise
|
| 191 |
+
echo Ireus_Controller_Export::getInstance()
|
| 192 |
+
->createCategoriesCsv($productsWithCategories);
|
| 193 |
+
flush();
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* Output a CSV of all orders
|
| 199 |
+
*
|
| 200 |
+
* @return null
|
| 201 |
+
*/
|
| 202 |
+
public function ordersAction()
|
| 203 |
+
{
|
| 204 |
+
// Change maximum execution time
|
| 205 |
+
set_time_limit(0);
|
| 206 |
+
|
| 207 |
+
echo Ireus_Controller_Export::getInstance()
|
| 208 |
+
->setOrderColumns($this->_ordersColumns)
|
| 209 |
+
->exportOrdersCsv(Mage::getModel('Sales/Order_Item')->getCollection()->getData());
|
| 210 |
+
|
| 211 |
+
exit;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
* Output a CSV of all products with their attributes
|
| 217 |
+
*
|
| 218 |
+
* @return null
|
| 219 |
+
*/
|
| 220 |
+
public function productsAction()
|
| 221 |
+
{
|
| 222 |
+
// Change maximum execution time
|
| 223 |
+
set_time_limit(0);
|
| 224 |
+
|
| 225 |
+
// Prepare the prudsys IREUS Export Controller
|
| 226 |
+
Ireus_Controller_Export::getInstance()
|
| 227 |
+
->setProductColumns($this->_productsColumns);
|
| 228 |
+
|
| 229 |
+
$product = Mage::getModel('catalog/product');
|
| 230 |
+
|
| 231 |
+
// Get products from database
|
| 232 |
+
$collection = Mage::getModel('Catalog/Product')
|
| 233 |
+
->getCollection()
|
| 234 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 235 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 236 |
+
->addAttributeToSelect(array('name', 'short_description'), 'inner')
|
| 237 |
+
->addAttributeToSelect(array('special_price', 'manufacturer', 'small_image'), 'left')
|
| 238 |
+
->addAttributeToFilter('status',
|
| 239 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 240 |
+
->addAttributeToFilter('price', array('gt' => 0))
|
| 241 |
+
->addAttributeToFilter(
|
| 242 |
+
'visibility',
|
| 243 |
+
array(
|
| 244 |
+
'in' => array(
|
| 245 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 246 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 247 |
+
)
|
| 248 |
+
)
|
| 249 |
+
)
|
| 250 |
+
->addAttributeToSelect('small_image');
|
| 251 |
+
|
| 252 |
+
Mage::getSingleton('core/resource_iterator')
|
| 253 |
+
->walk(
|
| 254 |
+
$collection->getSelect(),
|
| 255 |
+
array(
|
| 256 |
+
array(
|
| 257 |
+
$this,
|
| 258 |
+
'callbackProductsAction'
|
| 259 |
+
)
|
| 260 |
+
),
|
| 261 |
+
array(
|
| 262 |
+
'product' => $product
|
| 263 |
+
)
|
| 264 |
+
);
|
| 265 |
+
|
| 266 |
+
// Stream remaining items
|
| 267 |
+
if (count($this->products) > 0
|
| 268 |
+
) {
|
| 269 |
+
echo Ireus_Controller_Export::getInstance()
|
| 270 |
+
->createProductsCsv($this->products);
|
| 271 |
+
flush();
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
// Delete cached recommendations
|
| 275 |
+
Ireus_Controller_Cache::deleteCache(Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus');
|
| 276 |
+
|
| 277 |
+
exit;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* Callback function for the resource iterator of the categories Action
|
| 283 |
+
*
|
| 284 |
+
* @param array $args
|
| 285 |
+
* @return void
|
| 286 |
+
*/
|
| 287 |
+
public function callbackProductsAction ($args)
|
| 288 |
+
{
|
| 289 |
+
$product = $args['product'];
|
| 290 |
+
$product->setData($args['row']);
|
| 291 |
+
|
| 292 |
+
$product_url = $product->getProductUrl();
|
| 293 |
+
$product->setUrl(self::setSidPlaceholder($product_url));
|
| 294 |
+
$product->setImagesUrl(Mage::helper('Catalog/Image')
|
| 295 |
+
->init($product, 'small_image')
|
| 296 |
+
->resize(
|
| 297 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_WIDTH),
|
| 298 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_HEIGHT)
|
| 299 |
+
)
|
| 300 |
+
->__toString());
|
| 301 |
+
$product->setAddToCartUrl(self::getAddToCartUrl($product, $product_url));
|
| 302 |
+
|
| 303 |
+
// Add parameters manually
|
| 304 |
+
$productarray = $product->getData();
|
| 305 |
+
$productarray['is_salable'] = $product->isSaleable();
|
| 306 |
+
$productarray['param2'] = $productarray['price'];
|
| 307 |
+
$productarray['price'] = 1;
|
| 308 |
+
|
| 309 |
+
// Stream result in parts of 10
|
| 310 |
+
$this->products[] = $productarray;
|
| 311 |
+
if (count($this->products) > 9
|
| 312 |
+
) {
|
| 313 |
+
echo Ireus_Controller_Export::getInstance()
|
| 314 |
+
->createProductsCsv($this->products);
|
| 315 |
+
flush();
|
| 316 |
+
$this->products = array();
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
/**
|
| 322 |
+
* Create "add this product to cart" url
|
| 323 |
+
*
|
| 324 |
+
* @param object $collection
|
| 325 |
+
* @param array $additional
|
| 326 |
+
* @return array
|
| 327 |
+
*/
|
| 328 |
+
protected static function getAddToCartUrl($product, $product_url, $additional = array())
|
| 329 |
+
{
|
| 330 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)
|
| 331 |
+
) {
|
| 332 |
+
$url = $product_url;
|
| 333 |
+
$link = (strpos($url, '?') !== false) ? '&' : '?';
|
| 334 |
+
$result = $url . $link . 'options=cart';
|
| 335 |
+
}
|
| 336 |
+
else
|
| 337 |
+
{
|
| 338 |
+
$result = Mage::helper('checkout/cart')->getAddUrl($product, $additional);
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
return self::setSidPlaceholder($result);
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
/**
|
| 346 |
+
* Sets SessionID placeholder in urls for dynamic SessionID adjustments done by IREUS
|
| 347 |
+
*
|
| 348 |
+
* @param string $url
|
| 349 |
+
* @return string
|
| 350 |
+
*/
|
| 351 |
+
protected static function setSidPlaceholder ($url)
|
| 352 |
+
{
|
| 353 |
+
if (strpos($url, self::$_sessionId)
|
| 354 |
+
) {
|
| 355 |
+
$url = str_replace(self::$_sessionId, self::$_ireusplaceholder, $url);
|
| 356 |
+
}
|
| 357 |
+
else
|
| 358 |
+
{
|
| 359 |
+
$url .= ((strpos($url, '?') !== false) ? '&' : '?')
|
| 360 |
+
. self::$_sessionIdQueryParam
|
| 361 |
+
. '='
|
| 362 |
+
. self::$_ireusplaceholder;
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
return $url;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
/**
|
| 370 |
+
* Sets a different store if needed
|
| 371 |
+
*
|
| 372 |
+
* @param Mixed $storeCode can be either storeId or storeCode of store to set
|
| 373 |
+
* @return Mage_Core_Controller_Front_Action
|
| 374 |
+
*/
|
| 375 |
+
protected function _setActiveStore($storeCode)
|
| 376 |
+
{
|
| 377 |
+
if (!$storeCode
|
| 378 |
+
) {
|
| 379 |
+
$storeCode = $this->_storeCode;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// if storeId is used convert to storeCode
|
| 383 |
+
if (is_numeric($storeCode)) {
|
| 384 |
+
$storeCode = Mage::app()->getStore($storeCode)->getCode();
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
// if current store is ok return
|
| 388 |
+
if (Mage::app()->getStore()->getCode() == $storeCode) {
|
| 389 |
+
return $this;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// set active store
|
| 393 |
+
Mage::app()->setCurrentStore($storeCode);
|
| 394 |
+
|
| 395 |
+
return $this;
|
| 396 |
+
}
|
| 397 |
+
}
|
app/code/community/Netresearch/Ireus/controllers/ExportController_singlerow.php
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* IREUS
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0).
|
| 8 |
+
* It is available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
* If you are unable to obtain the license through the world-wide-web,
|
| 11 |
+
* please send an email to support@ireus.net so we can send you a copy.
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade Ireus to newer
|
| 16 |
+
* versions in the future. If you wish to customize Ireus for your
|
| 17 |
+
* needs please refer to http://www.ireus.net for more information.
|
| 18 |
+
*
|
| 19 |
+
* @category IREUS Recommendation Engine
|
| 20 |
+
* @package Ireus
|
| 21 |
+
* @copyright Copyright (c) 2010 prudsys AG (http://www.prudsys.com)
|
| 22 |
+
* @author Stephan Hoyer, Germany
|
| 23 |
+
* @author Silvio Steiger, Germany
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*
|
| 26 |
+
* $Id$
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
// Register IREUS PHP Framework
|
| 31 |
+
require_once('IreusAutoloader.php');
|
| 32 |
+
IreusAutoloader::getInstance()->register();
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Netresearch_Ireus_ExportController extends Mage_Core_Controller_Front_Action
|
| 36 |
+
{
|
| 37 |
+
const CONFIG_SECURITY_CODE = 'ireus/settings/security_code';
|
| 38 |
+
const CONFIG_EXPORT_DISABLED_CATEGORIES = 'ireus/settings/export_disabled_categories';
|
| 39 |
+
const CONFIG_IMAGE_WIDTH = 'ireus/settings/image_width';
|
| 40 |
+
const CONFIG_IMAGE_HEIGHT = 'ireus/settings/image_height';
|
| 41 |
+
const PAGE_SIZE = 1;
|
| 42 |
+
|
| 43 |
+
var $_storeId ='admin';
|
| 44 |
+
|
| 45 |
+
var $_ordersColumns = array(
|
| 46 |
+
'tid' => 'order_id',
|
| 47 |
+
'pid' => 'product_id'
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
var $_productsColumns = array(
|
| 51 |
+
'pid' => 'entity_id',
|
| 52 |
+
'sku' => 'sku',
|
| 53 |
+
'name' => 'name',
|
| 54 |
+
'brand' => 'brand',
|
| 55 |
+
'manufacturer' => 'manufacturer',
|
| 56 |
+
'description' => 'short_description',
|
| 57 |
+
'param1' => 'add_to_cart_url',
|
| 58 |
+
'URL' => 'url',
|
| 59 |
+
'imageURL' => 'images_url',
|
| 60 |
+
'netUnitPrice' => 'price',
|
| 61 |
+
'onlineFlag' => 'is_salable',
|
| 62 |
+
'quantity' => 'qty',
|
| 63 |
+
'strikeOutPrice' => 'special_price'
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
static $_sessionId;
|
| 67 |
+
|
| 68 |
+
static $_sessionIdQueryParam;
|
| 69 |
+
|
| 70 |
+
static $_ireusplaceholder = '%SID%';
|
| 71 |
+
|
| 72 |
+
var $products = array();
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Check security code and redirect to 404 if not given or wrong
|
| 77 |
+
*
|
| 78 |
+
* @return Netresearch_Ireus_ExportController
|
| 79 |
+
*/
|
| 80 |
+
public function preDispatch()
|
| 81 |
+
{
|
| 82 |
+
parent::preDispatch();
|
| 83 |
+
$security_code = Mage::App()->getRequest()->getParam('code');
|
| 84 |
+
if(
|
| 85 |
+
is_null($security_code) or
|
| 86 |
+
$security_code != Mage::getStoreConfig(self::CONFIG_SECURITY_CODE)
|
| 87 |
+
) {
|
| 88 |
+
$this->_redirect('noroute');
|
| 89 |
+
$this->setFlag('',self::FLAG_NO_DISPATCH,true);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
if ($this->getRequest()->getParam('store')
|
| 93 |
+
) {
|
| 94 |
+
$this->_setActiveStore($this->getRequest()->getParam('store'));
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
$this->_storeId = Mage::App()->getStore()->getCode();
|
| 98 |
+
self::$_sessionId = Mage::getSingleton('core/session')->getSessionId();
|
| 99 |
+
self::$_sessionIdQueryParam = Mage::getSingleton('core/session')->getSessionIdQueryParam();
|
| 100 |
+
|
| 101 |
+
return $this;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Output a CSV of all products with their
|
| 107 |
+
* categories and all parent categories,
|
| 108 |
+
*
|
| 109 |
+
* @return null
|
| 110 |
+
*/
|
| 111 |
+
public function categoriesAction()
|
| 112 |
+
{
|
| 113 |
+
$iStartTime = microtime(true);
|
| 114 |
+
|
| 115 |
+
// Change maximum execution time
|
| 116 |
+
set_time_limit(0);
|
| 117 |
+
|
| 118 |
+
$product = Mage::getModel('catalog/product');
|
| 119 |
+
|
| 120 |
+
foreach(Mage::getModel('Catalog/Category')
|
| 121 |
+
->getCollection()
|
| 122 |
+
->addFieldToFilter('is_active', 1)
|
| 123 |
+
->addFieldToFilter('level', array('gt' => 1))
|
| 124 |
+
->addAttributeToSelect('name') as $category
|
| 125 |
+
) {
|
| 126 |
+
if($category->getProductCount()
|
| 127 |
+
) {
|
| 128 |
+
$productcategories = Mage::getModel('Catalog/Category')
|
| 129 |
+
->getCollection()
|
| 130 |
+
->addFieldToFilter('entity_id', array(
|
| 131 |
+
'in' => $category->getPathIds()))
|
| 132 |
+
->addAttributeToSelect('entity_id')
|
| 133 |
+
->addAttributeToSelect('name');
|
| 134 |
+
|
| 135 |
+
$collection = $category->getProductCollection()
|
| 136 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 137 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 138 |
+
->addAttributeToFilter('status',
|
| 139 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 140 |
+
->addAttributeToFilter('visibility', array('in'=>array(
|
| 141 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 142 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 143 |
+
)))
|
| 144 |
+
->addAttributeToFilter('price', array('gt' => 0));
|
| 145 |
+
|
| 146 |
+
Mage::getSingleton('core/resource_iterator')
|
| 147 |
+
->walk(
|
| 148 |
+
$collection->getSelect(),
|
| 149 |
+
array(
|
| 150 |
+
array(
|
| 151 |
+
$this,
|
| 152 |
+
'callbackCategoriesAction'
|
| 153 |
+
)
|
| 154 |
+
),
|
| 155 |
+
array(
|
| 156 |
+
'product' => $product,
|
| 157 |
+
'productcategories' => $productcategories
|
| 158 |
+
)
|
| 159 |
+
);
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
$iTotalTime = microtime(true) - $iStartTime;
|
| 164 |
+
echo "Total time: " . sprintf("%02d:%02d:%02.3f", ($iTotalTime/3600), ($iTotalTime/60)%60, $iTotalTime-(floor($iTotalTime/60)*60));
|
| 165 |
+
exit;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Callback function for the resource iterator of the categories Action
|
| 171 |
+
*
|
| 172 |
+
* @param array $args
|
| 173 |
+
* @return void
|
| 174 |
+
*/
|
| 175 |
+
public function callbackCategoriesAction ($args)
|
| 176 |
+
{
|
| 177 |
+
$product = $args['product'];
|
| 178 |
+
$productcategories = $args['productcategories'];
|
| 179 |
+
$product->setData($args['row']);
|
| 180 |
+
|
| 181 |
+
$productsWithCategories = array();
|
| 182 |
+
$pid = $product->getId();
|
| 183 |
+
foreach ($productcategories as $currentcategory
|
| 184 |
+
) {
|
| 185 |
+
$cid = $currentcategory->getId();
|
| 186 |
+
$productsWithCategories[$pid.$cid] = array(
|
| 187 |
+
'pid' => $pid,
|
| 188 |
+
'cid' => $cid,
|
| 189 |
+
'cidparent' => $currentcategory->getParentId(),
|
| 190 |
+
'cname' => $currentcategory->getName()
|
| 191 |
+
);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
// Stream output product wise
|
| 195 |
+
echo Ireus_Controller_Export::getInstance()
|
| 196 |
+
->createCategoriesCsv($productsWithCategories);
|
| 197 |
+
flush();
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* Output a CSV of all orders
|
| 203 |
+
*
|
| 204 |
+
* @return null
|
| 205 |
+
*/
|
| 206 |
+
public function ordersAction()
|
| 207 |
+
{
|
| 208 |
+
// Change maximum execution time
|
| 209 |
+
set_time_limit(0);
|
| 210 |
+
|
| 211 |
+
echo Ireus_Controller_Export::getInstance()
|
| 212 |
+
->setOrderColumns($this->_ordersColumns)
|
| 213 |
+
->exportOrdersCsv(Mage::getModel('Sales/Order_Item')->getCollection()->getData());
|
| 214 |
+
|
| 215 |
+
exit;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Output a CSV of all products with their attributes
|
| 221 |
+
*
|
| 222 |
+
* @return null
|
| 223 |
+
*/
|
| 224 |
+
public function productsAction()
|
| 225 |
+
{
|
| 226 |
+
$iStartTime = microtime(true);
|
| 227 |
+
|
| 228 |
+
// Change maximum execution time
|
| 229 |
+
set_time_limit(0);
|
| 230 |
+
|
| 231 |
+
// Prepare the prudsys IREUS Export Controller
|
| 232 |
+
Ireus_Controller_Export::getInstance()
|
| 233 |
+
->setProductColumns($this->_productsColumns);
|
| 234 |
+
|
| 235 |
+
// Get products from database
|
| 236 |
+
$product = Mage::getModel('catalog/product');
|
| 237 |
+
$collection = Mage::getModel('Catalog/Product')
|
| 238 |
+
->getCollection()
|
| 239 |
+
->joinField('qty', 'cataloginventory/stock_item', '*',
|
| 240 |
+
'product_id=entity_id', '{{table}}.stock_id=1', 'left')
|
| 241 |
+
->addAttributeToFilter('status',
|
| 242 |
+
Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
| 243 |
+
->addAttributeToFilter('price', array('gt' => 0))
|
| 244 |
+
->addAttributeToFilter(
|
| 245 |
+
'visibility',
|
| 246 |
+
array(
|
| 247 |
+
'in' => array(
|
| 248 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 249 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 250 |
+
)
|
| 251 |
+
)
|
| 252 |
+
)
|
| 253 |
+
->addAttributeToSelect('entity_id', true)
|
| 254 |
+
->addAttributeToSelect('sku', true)
|
| 255 |
+
->addAttributeToSelect('name', true)
|
| 256 |
+
->addAttributeToSelect('brand')
|
| 257 |
+
->addAttributeToSelect('manufacturer', true)
|
| 258 |
+
->addAttributeToSelect('short_description', true)
|
| 259 |
+
->addAttributeToSelect('add_to_cart_url')
|
| 260 |
+
->addAttributeToSelect('url')
|
| 261 |
+
->addAttributeToSelect('small_image', true)
|
| 262 |
+
->addAttributeToSelect('price', true)
|
| 263 |
+
->addAttributeToSelect('is_salable')
|
| 264 |
+
->addAttributeToSelect('qty')
|
| 265 |
+
->addAttributeToSelect('special_price', true);
|
| 266 |
+
|
| 267 |
+
Mage::getSingleton('core/resource_iterator')
|
| 268 |
+
->walk(
|
| 269 |
+
$collection->getSelect(),
|
| 270 |
+
array(
|
| 271 |
+
array(
|
| 272 |
+
$this,
|
| 273 |
+
'callbackProductsAction'
|
| 274 |
+
)
|
| 275 |
+
),
|
| 276 |
+
array(
|
| 277 |
+
'product' => $product
|
| 278 |
+
)
|
| 279 |
+
);
|
| 280 |
+
|
| 281 |
+
// Stream remaining items
|
| 282 |
+
if (count($this->products) > 0
|
| 283 |
+
) {
|
| 284 |
+
echo Ireus_Controller_Export::getInstance()
|
| 285 |
+
->createProductsCsv($this->products);
|
| 286 |
+
flush();
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
// Delete cached recommendations
|
| 290 |
+
Ireus_Controller_Cache::deleteCache(Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . 'ireus');
|
| 291 |
+
|
| 292 |
+
$iTotalTime = microtime(true) - $iStartTime;
|
| 293 |
+
echo "Total time: " . sprintf("%02d:%02d:%02.3f", ($iTotalTime/3600), ($iTotalTime/60)%60, $iTotalTime-(floor($iTotalTime/60)*60));
|
| 294 |
+
exit;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
/**
|
| 299 |
+
* Callback function for the resource iterator of the products Action
|
| 300 |
+
*
|
| 301 |
+
* @param array $args
|
| 302 |
+
* @return void
|
| 303 |
+
*/
|
| 304 |
+
public function callbackProductsAction ($args)
|
| 305 |
+
{
|
| 306 |
+
$product = $args['product'];
|
| 307 |
+
$product->setData($args['row']);
|
| 308 |
+
|
| 309 |
+
// Add missing information to the collection
|
| 310 |
+
// which cannot be requested directly from database.
|
| 311 |
+
// Here is the most time wasted
|
| 312 |
+
$product_url = $product->getProductUrl();
|
| 313 |
+
//$product->setManufacturer($product->getAttributeText('manufacturer'));
|
| 314 |
+
$product->setUrl(self::setSidPlaceholder($product_url));
|
| 315 |
+
$product->setData('is_salable', $product->isSalable());
|
| 316 |
+
$product->setImagesUrl(Mage::helper('Catalog/Image')
|
| 317 |
+
->init(
|
| 318 |
+
$product,
|
| 319 |
+
'small_image'
|
| 320 |
+
)
|
| 321 |
+
->resize(
|
| 322 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_WIDTH),
|
| 323 |
+
Mage::getStoreConfig(self::CONFIG_IMAGE_HEIGHT)
|
| 324 |
+
)
|
| 325 |
+
->__toString()
|
| 326 |
+
);
|
| 327 |
+
$product->setAddToCartUrl(self::getAddToCartUrl($product, $product_url));
|
| 328 |
+
|
| 329 |
+
// Stream result in groups of 10
|
| 330 |
+
$this->products[] = $product->getData();
|
| 331 |
+
if (count($this->products) > 9
|
| 332 |
+
) {
|
| 333 |
+
echo Ireus_Controller_Export::getInstance()
|
| 334 |
+
->createProductsCsv($this->products);
|
| 335 |
+
flush();
|
| 336 |
+
$this->products = array();
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
/**
|
| 342 |
+
* Create "add this product to cart" url
|
| 343 |
+
*
|
| 344 |
+
* @param object $collection
|
| 345 |
+
* @param array $additional
|
| 346 |
+
* @return array
|
| 347 |
+
*/
|
| 348 |
+
protected static function getAddToCartUrl($product, $product_url, $additional = array())
|
| 349 |
+
{
|
| 350 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)
|
| 351 |
+
) {
|
| 352 |
+
$url = $product_url;
|
| 353 |
+
$link = (strpos($url, '?') !== false) ? '&' : '?';
|
| 354 |
+
$result = $url . $link . 'options=cart';
|
| 355 |
+
}
|
| 356 |
+
else
|
| 357 |
+
{
|
| 358 |
+
$result = Mage::helper('checkout/cart')->getAddUrl($product, $additional);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
return self::setSidPlaceholder($result);
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
/**
|
| 366 |
+
* Sets SessionID placeholder in urls for dynamic SessionID adjustments done by IREUS
|
| 367 |
+
*
|
| 368 |
+
* @param string $url
|
| 369 |
+
* @return string
|
| 370 |
+
*/
|
| 371 |
+
protected static function setSidPlaceholder ($url)
|
| 372 |
+
{
|
| 373 |
+
if (strpos($url, self::$_sessionId)
|
| 374 |
+
) {
|
| 375 |
+
$url = str_replace(self::$_sessionId, self::$_ireusplaceholder, $url);
|
| 376 |
+
}
|
| 377 |
+
else
|
| 378 |
+
{
|
| 379 |
+
$url .= ((strpos($url, '?') !== false) ? '&' : '?')
|
| 380 |
+
. self::$_sessionIdQueryParam
|
| 381 |
+
. '='
|
| 382 |
+
. self::$_ireusplaceholder;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
return $url;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
/**
|
| 390 |
+
* Sets a different store if needed
|
| 391 |
+
*
|
| 392 |
+
* @param Mixed $storeCode can be either storeId or storeCode of store to set
|
| 393 |
+
* @return Mage_Core_Controller_Front_Action
|
| 394 |
+
*/
|
| 395 |
+
protected function _setActiveStore($storeCode)
|
| 396 |
+
{
|
| 397 |
+
if (!$storeCode
|
| 398 |
+
) {
|
| 399 |
+
$storeCode = $this->_storeCode;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
// if storeId is used convert to storeCode
|
| 403 |
+
if (is_numeric($storeCode)) {
|
| 404 |
+
$storeCode = Mage::app()->getStore($storeCode)->getCode();
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
// if current store is ok return
|
| 408 |
+
if (Mage::app()->getStore()->getCode() == $storeCode) {
|
| 409 |
+
return $this;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
// set active store
|
| 413 |
+
Mage::app()->setCurrentStore($storeCode);
|
| 414 |
+
|
| 415 |
+
return $this;
|
| 416 |
+
}
|
| 417 |
+
}
|
app/code/community/Netresearch/Ireus/etc/config.xml
CHANGED
|
@@ -97,6 +97,15 @@
|
|
| 97 |
</resources>
|
| 98 |
</acl>
|
| 99 |
</adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
<frontend>
|
| 102 |
<routers>
|
|
@@ -136,4 +145,4 @@
|
|
| 136 |
</checkout_cart_add_product_complete>
|
| 137 |
</events>
|
| 138 |
</frontend>
|
| 139 |
-
</config>
|
| 97 |
</resources>
|
| 98 |
</acl>
|
| 99 |
</adminhtml>
|
| 100 |
+
|
| 101 |
+
<default>
|
| 102 |
+
<ireus>
|
| 103 |
+
<settings>
|
| 104 |
+
<enable_session_cookies>1</enable_session_cookies>
|
| 105 |
+
<disable_magento_upsell>1</disable_magento_upsell>
|
| 106 |
+
</settings>
|
| 107 |
+
</ireus>
|
| 108 |
+
</default>
|
| 109 |
|
| 110 |
<frontend>
|
| 111 |
<routers>
|
| 145 |
</checkout_cart_add_product_complete>
|
| 146 |
</events>
|
| 147 |
</frontend>
|
| 148 |
+
</config>
|
app/code/community/Netresearch/Ireus/etc/system.xml
CHANGED
|
@@ -92,11 +92,21 @@
|
|
| 92 |
<show_in_website>1</show_in_website>
|
| 93 |
<show_in_store>1</show_in_store>
|
| 94 |
</image_height>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
<disable_magento_upsell translate="label comment">
|
| 96 |
<label>Disable Magento Upsell:</label>
|
| 97 |
<frontend_type>select</frontend_type>
|
| 98 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 99 |
-
<sort_order>
|
| 100 |
<show_in_default>1</show_in_default>
|
| 101 |
<show_in_website>1</show_in_website>
|
| 102 |
<show_in_store>1</show_in_store>
|
| 92 |
<show_in_website>1</show_in_website>
|
| 93 |
<show_in_store>1</show_in_store>
|
| 94 |
</image_height>
|
| 95 |
+
<enable_session_cookies translate="label comment">
|
| 96 |
+
<label>Enable Session Cookies:</label>
|
| 97 |
+
<frontend_type>select</frontend_type>
|
| 98 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 99 |
+
<comment><![CDATA[Enables IREUS-Session-only-Cookies for session personalization even when the respective user doesn't allow cookies. No user-profiles or persistent cookies will be stored! Enable this if IREUS features are strictly necessary for the service requested by your users.]]></comment>
|
| 100 |
+
<sort_order>600</sort_order>
|
| 101 |
+
<show_in_default>1</show_in_default>
|
| 102 |
+
<show_in_website>1</show_in_website>
|
| 103 |
+
<show_in_store>1</show_in_store>
|
| 104 |
+
</enable_session_cookies>
|
| 105 |
<disable_magento_upsell translate="label comment">
|
| 106 |
<label>Disable Magento Upsell:</label>
|
| 107 |
<frontend_type>select</frontend_type>
|
| 108 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 109 |
+
<sort_order>700</sort_order>
|
| 110 |
<show_in_default>1</show_in_default>
|
| 111 |
<show_in_website>1</show_in_website>
|
| 112 |
<show_in_store>1</show_in_store>
|
app/design/frontend/default/default/layout/ireus.xml
CHANGED
|
@@ -78,26 +78,21 @@
|
|
| 78 |
</reference>
|
| 79 |
<reference name="before_body_end">
|
| 80 |
<block type="ireus/data" name="ireus_data" before="ireus_footer" as="ireus_data" template="ireus/data.phtml"/>
|
| 81 |
-
<block type="ireus/data" name="ireus_footer" after="
|
| 82 |
</reference>
|
| 83 |
</cms_index_index>
|
| 84 |
|
| 85 |
<checkout_onepage_success>
|
| 86 |
-
<reference name="content">
|
| 87 |
-
<block type="ireus/data" name="ireus_products" as="ireus_products" template="ireus/userrecomm.phtml"/>
|
| 88 |
-
</reference>
|
| 89 |
<reference name="before_body_end">
|
| 90 |
-
<block type="ireus/data" name="
|
| 91 |
-
<block type="ireus/data" name="
|
| 92 |
-
<block type="ireus/data" name="ireus_footer" after="-" as="ireus_footer" template="ireus/footer.phtml"/>
|
| 93 |
</reference>
|
| 94 |
</checkout_onepage_success>
|
| 95 |
|
| 96 |
<checkout_multishipping_success>
|
| 97 |
<reference name="before_body_end">
|
| 98 |
<block type="ireus/data" name="ireus_data" before="ireus_footer" as="ireus_data" template="ireus/data.phtml"/>
|
| 99 |
-
<block type="ireus/data" name="ireus_footer" after="
|
| 100 |
</reference>
|
| 101 |
</checkout_multishipping_success>
|
| 102 |
-
|
| 103 |
</layout>
|
| 78 |
</reference>
|
| 79 |
<reference name="before_body_end">
|
| 80 |
<block type="ireus/data" name="ireus_data" before="ireus_footer" as="ireus_data" template="ireus/data.phtml"/>
|
| 81 |
+
<block type="ireus/data" name="ireus_footer" after="ireus_data" as="ireus_footer" template="ireus/footer.phtml"/>
|
| 82 |
</reference>
|
| 83 |
</cms_index_index>
|
| 84 |
|
| 85 |
<checkout_onepage_success>
|
|
|
|
|
|
|
|
|
|
| 86 |
<reference name="before_body_end">
|
| 87 |
+
<block type="ireus/data" name="ireus_data" before="ireus_footer" as="ireus_data" template="ireus/data.phtml"/>
|
| 88 |
+
<block type="ireus/data" name="ireus_footer" after="ireus_data" as="ireus_footer" template="ireus/footer.phtml"/>
|
|
|
|
| 89 |
</reference>
|
| 90 |
</checkout_onepage_success>
|
| 91 |
|
| 92 |
<checkout_multishipping_success>
|
| 93 |
<reference name="before_body_end">
|
| 94 |
<block type="ireus/data" name="ireus_data" before="ireus_footer" as="ireus_data" template="ireus/data.phtml"/>
|
| 95 |
+
<block type="ireus/data" name="ireus_footer" after="ireus_data" as="ireus_footer" template="ireus/footer.phtml"/>
|
| 96 |
</reference>
|
| 97 |
</checkout_multishipping_success>
|
|
|
|
| 98 |
</layout>
|
lib/Ireus/Controller/Cache.php
CHANGED
|
@@ -67,7 +67,7 @@ class Ireus_Controller_Cache extends Ireus_Object
|
|
| 67 |
*
|
| 68 |
* @var string
|
| 69 |
*/
|
| 70 |
-
protected static $_servleturl = 'http://www.ireus.net/ireus-server';
|
| 71 |
|
| 72 |
|
| 73 |
/**
|
| 67 |
*
|
| 68 |
* @var string
|
| 69 |
*/
|
| 70 |
+
protected static $_servleturl = 'http://www.ireus.net/ireus-server'; //http://salieri.prudsys.com:8180/rde_server
|
| 71 |
|
| 72 |
|
| 73 |
/**
|
lib/Ireus/Controller/Export.php
CHANGED
|
@@ -105,7 +105,7 @@ class Ireus_Controller_Export extends Ireus_Object
|
|
| 105 |
'param3' => array(2000, 'string'),
|
| 106 |
'param4' => array(2000, 'string'),
|
| 107 |
'param5' => array(2000, 'string'),
|
| 108 |
-
|
| 109 |
//'type' => array(0, 'string'),
|
| 110 |
//'rank' => array(0, 'float'),
|
| 111 |
//'initstock' => array(0, 'float')
|
|
@@ -185,14 +185,14 @@ class Ireus_Controller_Export extends Ireus_Object
|
|
| 185 |
|
| 186 |
foreach($lines as $linekey => $line
|
| 187 |
) {
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
}
|
| 197 |
|
| 198 |
return $lines;
|
|
@@ -325,20 +325,20 @@ class Ireus_Controller_Export extends Ireus_Object
|
|
| 325 |
'/^\/*/',
|
| 326 |
'/',
|
| 327 |
preg_replace(
|
| 328 |
-
array('/^((https?)\:\/\/)(([
|
| 329 |
'',
|
| 330 |
$shopurl,
|
| 331 |
1
|
| 332 |
)
|
| 333 |
);
|
| 334 |
}
|
| 335 |
-
elseif (preg_match('/^(([
|
| 336 |
|
| 337 |
return preg_replace(
|
| 338 |
'/^\/*/',
|
| 339 |
'/',
|
| 340 |
preg_replace(
|
| 341 |
-
array('/^(([
|
| 342 |
'',
|
| 343 |
$shopurl,
|
| 344 |
1
|
| 105 |
'param3' => array(2000, 'string'),
|
| 106 |
'param4' => array(2000, 'string'),
|
| 107 |
'param5' => array(2000, 'string'),
|
| 108 |
+
'stock' => array(0, 'integer'),
|
| 109 |
//'type' => array(0, 'string'),
|
| 110 |
//'rank' => array(0, 'float'),
|
| 111 |
//'initstock' => array(0, 'float')
|
| 185 |
|
| 186 |
foreach($lines as $linekey => $line
|
| 187 |
) {
|
| 188 |
+
if (!in_array($line[$pidname], $pids)
|
| 189 |
+
) {
|
| 190 |
+
$pids[] = $line[$pidname];
|
| 191 |
+
}
|
| 192 |
+
else
|
| 193 |
+
{
|
| 194 |
+
unset($lines[$linekey]);
|
| 195 |
+
}
|
| 196 |
}
|
| 197 |
|
| 198 |
return $lines;
|
| 325 |
'/^\/*/',
|
| 326 |
'/',
|
| 327 |
preg_replace(
|
| 328 |
+
array('/^((https?)\:\/\/)(([A-Za-z0-9-.]*)\.([a-z]{2,3})|localhost)/', '/'.$this->_base.'/'),
|
| 329 |
'',
|
| 330 |
$shopurl,
|
| 331 |
1
|
| 332 |
)
|
| 333 |
);
|
| 334 |
}
|
| 335 |
+
elseif (preg_match('/^(([A-Za-z0-9-.]*)\.([a-z]{2,3})|localhost)/', $shopurl)) {
|
| 336 |
|
| 337 |
return preg_replace(
|
| 338 |
'/^\/*/',
|
| 339 |
'/',
|
| 340 |
preg_replace(
|
| 341 |
+
array('/^(([A-Za-z0-9-.]*)\.([a-z]{2,3})|localhost)/', '/'.$this->_base.'/'),
|
| 342 |
'',
|
| 343 |
$shopurl,
|
| 344 |
1
|
lib/Ireus/Model/Csv.php
CHANGED
|
@@ -34,7 +34,7 @@ class Ireus_Model_Csv extends Ireus_Object
|
|
| 34 |
* @param string $filename
|
| 35 |
* @return array
|
| 36 |
*/
|
| 37 |
-
public static function readFile ($file, $quoting = '"', $delimiter = '|', $lineending = "\r\n"
|
| 38 |
{
|
| 39 |
# Check file
|
| 40 |
if (!file_exists($file)) {
|
|
@@ -49,28 +49,14 @@ class Ireus_Model_Csv extends Ireus_Object
|
|
| 49 |
$header = fgetcsv($handle, 0, $delimiter);
|
| 50 |
$headercount = count($header);
|
| 51 |
|
| 52 |
-
# Flip keymap
|
| 53 |
-
if ($keymap
|
| 54 |
-
) {
|
| 55 |
-
$keymap = array_flip($keymap);
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
# Read the rest of the csv file to catch the data
|
| 59 |
while (!feof($handle)) {
|
| 60 |
$line = fgetcsv($handle, 0, $delimiter, $quoting);
|
| 61 |
-
|
| 62 |
if (count($line) == $headercount
|
| 63 |
) {
|
| 64 |
-
$line = array_combine($header, $line);
|
| 65 |
-
|
| 66 |
-
# Reduce line to needed fields
|
| 67 |
-
if ($keymap
|
| 68 |
-
) {
|
| 69 |
-
$line = array_intersect_key($line, $keymap);
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
# built array
|
| 73 |
-
$data[] = $line;
|
| 74 |
}
|
| 75 |
}
|
| 76 |
|
| 34 |
* @param string $filename
|
| 35 |
* @return array
|
| 36 |
*/
|
| 37 |
+
public static function readFile ($file, $quoting = '"', $delimiter = '|', $lineending = "\r\n")
|
| 38 |
{
|
| 39 |
# Check file
|
| 40 |
if (!file_exists($file)) {
|
| 49 |
$header = fgetcsv($handle, 0, $delimiter);
|
| 50 |
$headercount = count($header);
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
# Read the rest of the csv file to catch the data
|
| 53 |
while (!feof($handle)) {
|
| 54 |
$line = fgetcsv($handle, 0, $delimiter, $quoting);
|
| 55 |
+
|
| 56 |
if (count($line) == $headercount
|
| 57 |
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# built array
|
| 59 |
+
$data[] = array_combine($header, $line);
|
| 60 |
}
|
| 61 |
}
|
| 62 |
|
lib/Ireus/View/Client/event.tpl.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<script type="text/javascript">
|
| 2 |
//<![CDATA[
|
| 3 |
-
if(typeof(ireus_events) == 'undefined')
|
| 4 |
var ireus = new Object([[+IreusEventParams]]);
|
| 5 |
ireus_events.push(ireus);
|
| 6 |
//]]>
|
| 1 |
<script type="text/javascript">
|
| 2 |
//<![CDATA[
|
| 3 |
+
if(typeof(ireus_events) == 'undefined') ireus_events = new Array();
|
| 4 |
var ireus = new Object([[+IreusEventParams]]);
|
| 5 |
ireus_events.push(ireus);
|
| 6 |
//]]>
|
lib/Ireus/View/Client/home.tpl.php
CHANGED
|
@@ -1,5 +1 @@
|
|
| 1 |
-
<div id="ireus_userrecomm">
|
| 2 |
-
<noscript>
|
| 3 |
-
[[+IreusCachedRecomms]]
|
| 4 |
-
</noscript>
|
| 5 |
-
</div>
|
| 1 |
+
<div id="ireus_userrecomm"></div>
|
|
|
|
|
|
|
|
|
|
|
|
lib/Ireus/View/Client/product.tpl.php
CHANGED
|
@@ -1,5 +1 @@
|
|
| 1 |
-
<div id="ireus_recomm">
|
| 2 |
-
<noscript>
|
| 3 |
-
[[+IreusCachedRecomms]]
|
| 4 |
-
</noscript>
|
| 5 |
-
</div>
|
| 1 |
+
<div id="ireus_recomm"></div>
|
|
|
|
|
|
|
|
|
|
|
|
lib/Ireus/View/Client/user.tpl.php
CHANGED
|
@@ -1,5 +1 @@
|
|
| 1 |
-
<div id="ireus_userrecomm">
|
| 2 |
-
<noscript>
|
| 3 |
-
[[+IreusCachedRecomms]]
|
| 4 |
-
</noscript>
|
| 5 |
-
</div>
|
| 1 |
+
<div id="ireus_userrecomm"></div>
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,26 +1,23 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>IREUS_Recommendation_Engine_Interface</name>
|
| 4 |
-
<version>2.2.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>prudsys IREUS Online Recommendation Engine Connector</summary>
|
| 10 |
-
<description>
|
|
|
|
| 11 |

|
| 12 |
-
|
| 13 |
-

|
| 14 |
-
|
| 15 |
-

|
| 16 |
-
prudsys IREUS is based on the prudsys Realtime Decisioning Engine (prudsys RDE), the leading real-time analytics application in Germany. With the prudsys IREUS Magento connector you benefit from the easy integration of the prudsys IREUS recommendation engine in your own online shop.
|
| 17 |
-

|
| 18 |
-
The registration for prudsys IREUS is free of charge at: www.ireus.net.</description>
|
| 19 |
<notes>Log out and log in after install to get access to the configuration interface! You will find it in the menu [System -> Configuration -> IREUS Recommendation Engine]</notes>
|
| 20 |
-
<authors><author><name>prudsys IREUS
|
| 21 |
-
<date>
|
| 22 |
-
<time>
|
| 23 |
-
<contents><target name="magecommunity"><dir name="Netresearch"><dir name="Ireus"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="List"><file name="Upsell.php" hash="2063a8463153a5e74ab11333f6112c74"/></dir></dir></dir><dir name="Checkout"><dir name="Multishipping"><file name="Success.php" hash="72495e9ef43ab32d78ac9b225ad25e7b"/></dir></dir><file name="Data.php" hash="
|
| 24 |
<compatible/>
|
| 25 |
-
<dependencies
|
| 26 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>IREUS_Recommendation_Engine_Interface</name>
|
| 4 |
+
<version>2.2.8</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>prudsys IREUS Online Recommendation Engine Connector</summary>
|
| 10 |
+
<description>New features:
|
| 11 |
+
- Uses the magento Cookie Restriction Mode of Magento 1.7.0.0 or higher for EU cookie policy compliance
|
| 12 |

|
| 13 |
+
Bug fixes:
|
| 14 |
+
- Order tracking for grouped products is working now
|
| 15 |
+
- Several additional minor bug fixes</description>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<notes>Log out and log in after install to get access to the configuration interface! You will find it in the menu [System -> Configuration -> IREUS Recommendation Engine]</notes>
|
| 17 |
+
<authors><author><name>prudsys IREUS Team</name><user>ireus</user><email>support@ireus.net</email></author></authors>
|
| 18 |
+
<date>2012-06-08</date>
|
| 19 |
+
<time>08:27:15</time>
|
| 20 |
+
<contents><target name="magecommunity"><dir><dir name="Netresearch"><dir name="Ireus"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="List"><file name="Upsell.php" hash="2063a8463153a5e74ab11333f6112c74"/></dir></dir></dir><dir name="Checkout"><dir name="Multishipping"><file name="Success.php" hash="72495e9ef43ab32d78ac9b225ad25e7b"/></dir></dir><file name="Data.php" hash="4ec619023cf595c9cf340a9cb206cfa9"/></dir><dir name="Helper"><file name="Data.php" hash="166807c6ae52889ee30ae9d5d9760f06"/></dir><dir name="Model"><file name="Observer.php" hash="4fd4fb15426f06d1600c8b3077a3f654"/></dir><dir name="controllers"><file name="ExportController.php" hash="47bee89251ba880d8637e84d91b4f1c7"/><file name="ExportController_fast.php" hash="fe1fe7099822093daccbbb80f8869c8c"/><file name="ExportController_final.php" hash="b4ee2c7737a2977d042b3ce64785898d"/><file name="ExportController_noprice.php" hash="0a4ed9db5d898a948005272119efbb83"/><file name="ExportController_singlerow.php" hash="66f5046202e18bb127e008f32aef329d"/></dir><dir name="etc"><file name="config.xml" hash="427543517a58add407579b3422328f4a"/><file name="system.xml" hash="bbcfa1c9d53dfbca4c323b7cfcb62a78"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ireus.xml" hash="fa76c0766d2a2a74b1a28dac87240ced"/></dir><dir name="template"><dir name="ireus"><file name="data.phtml" hash="914c75fc9f1f09b3ec914a5aa12e1a71"/><file name="footer.phtml" hash="4f8718b50744c98cec9d1ffce31e2242"/><file name="recomm.phtml" hash="c56c8aa10531782cb0237a5cd7a715ad"/><file name="userrecomm.phtml" hash="879f8c79109f82ceff8a3c03d0c3ce1b"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Netresearch_Ireus.xml" hash="51f0d7dfc505541ad5bbd81cac334a4c"/></dir></dir></target><target name="mage"><dir><dir name="lib"><dir name="Ireus"><dir name="Controller"><file name="Cache.php" hash="4c0843da6f3b6a96c1327efd78b3c734"/><file name="Export.php" hash="308c96a7cbbf2fc84156a08967779d55"/></dir><dir name="Model"><file name="Csv.php" hash="dfaab91056524008fe28853609bef31d"/><file name="File.php" hash="70a796322ba8c1dcbd1c60944b7e95db"/></dir><file name="Object.php" hash="cf2c29389d0ae7c04858d763e074e4f3"/><dir name="View"><dir name="Client"><file name="call.tpl.php" hash="75da798d5fd4d21208fe636a12b3085c"/><file name="event.tpl.php" hash="811de7acc963000255d36d77d626c2ce"/><file name="home.tpl.php" hash="ffda3ac0b5957cbbe0988bd7159835d0"/><file name="product.tpl.php" hash="08b9f0d4bf23f6546956b6db8add2120"/><file name="user.tpl.php" hash="ffda3ac0b5957cbbe0988bd7159835d0"/></dir><file name="Client.php" hash="c1739c7d943f63863a2bd7b546db3a6a"/></dir></dir><file name="IreusAutoloader.php" hash="4c6d6bec65a2d8f196e3a9d3b94114b8"/></dir></dir></target></contents>
|
| 21 |
<compatible/>
|
| 22 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 23 |
</package>
|
