Version Notes
- export crossselling products
Download this release
Release Info
| Developer | Flagbit GmbH |
| Extension | epoqRS |
| Version | 1.2.10 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.9 to 1.2.10
- app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php +24 -0
- app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php~ +339 -0
- app/code/community/Flagbit/EpoqInterface/etc/config.xml +1 -1
- app/code/community/Flagbit/EpoqInterface/etc/config.xml~ +194 -0
- package.xml +6 -6
app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php
CHANGED
|
@@ -160,6 +160,11 @@ class Flagbit_EpoqInterface_Block_Export_Productlist extends Flagbit_EpoqInterfa
|
|
| 160 |
|
| 161 |
);
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
|
| 165 |
// set Product variant
|
|
@@ -205,7 +210,26 @@ class Flagbit_EpoqInterface_Block_Export_Productlist extends Flagbit_EpoqInterfa
|
|
| 205 |
$product->setTypeInstance($this->_productTypeInstances[$type], true);
|
| 206 |
return $this;
|
| 207 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
/**
|
| 210 |
* get Product Variants
|
| 211 |
*
|
| 160 |
|
| 161 |
);
|
| 162 |
|
| 163 |
+
$crossSellIds=$this->_getCrossSellIds($product,'id');
|
| 164 |
+
if (count($crossSellIds)>0) {
|
| 165 |
+
$data['c:crosssell_id'] = implode(';',$crossSellIds);
|
| 166 |
+
$data['c:crosssell_sku'] = implode(';',$this->_getCrossSellIds($product,'sku'));
|
| 167 |
+
} // if
|
| 168 |
|
| 169 |
|
| 170 |
// set Product variant
|
| 210 |
$product->setTypeInstance($this->_productTypeInstances[$type], true);
|
| 211 |
return $this;
|
| 212 |
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* get Product CrossSells
|
| 216 |
+
*
|
| 217 |
+
* @param Mage_Catalog_Model_Product $product
|
| 218 |
+
* @return array
|
| 219 |
+
*/
|
| 220 |
+
protected function _getCrossSellIds($product, $type = 'id'){
|
| 221 |
|
| 222 |
+
$childProducts = $product->getCrossSellProducts();
|
| 223 |
+
foreach((array) $childProducts as $childProduct){
|
| 224 |
+
if ($type == 'id') {
|
| 225 |
+
$childProductIds[] = $childProduct->getId();
|
| 226 |
+
} else {
|
| 227 |
+
$childProductIds[] = $childProduct->getSku();
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
return $childProductIds;
|
| 231 |
+
} // _getCrossSellIds
|
| 232 |
+
|
| 233 |
/**
|
| 234 |
* get Product Variants
|
| 235 |
*
|
app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php~
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/* *
|
| 3 |
+
* This script is part of the epoq Recommendation Service project *
|
| 4 |
+
* *
|
| 5 |
+
* epoqinterface is free software; you can redistribute it and/or modify *
|
| 6 |
+
* it under the terms of the GNU General Public License version 2 as *
|
| 7 |
+
* published by the Free Software Foundation. *
|
| 8 |
+
* *
|
| 9 |
+
* This script is distributed in the hope that it will be useful, but *
|
| 10 |
+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
|
| 11 |
+
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
| 12 |
+
* Public License for more details. *
|
| 13 |
+
* *
|
| 14 |
+
* @version $Id: Productlist.php 884 2011-09-01 13:34:31Z weller $
|
| 15 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Flagbit_EpoqInterface_Block_Export_Productlist extends Flagbit_EpoqInterface_Block_Abstract
|
| 19 |
+
{
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Product Type Instances singletons
|
| 24 |
+
*
|
| 25 |
+
* @var array
|
| 26 |
+
*/
|
| 27 |
+
protected $_productTypeInstances = array();
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* generates the Output
|
| 31 |
+
*
|
| 32 |
+
* @return string
|
| 33 |
+
*/
|
| 34 |
+
protected function _toHtml()
|
| 35 |
+
{
|
| 36 |
+
// create XML Object
|
| 37 |
+
$xmlObj = new DOMDocument("1.0", "UTF-8");
|
| 38 |
+
$xmlObj->formatOutput = true;
|
| 39 |
+
|
| 40 |
+
// add RSS Element and Namespace
|
| 41 |
+
$elemRss = $xmlObj->createElement( 'rss' );
|
| 42 |
+
$elemRss->setAttribute ( 'version' , '2.0' );
|
| 43 |
+
$elemRss->setAttribute ( 'xmlns:g' , 'http://base.google.com/ns/1.0' );
|
| 44 |
+
$elemRss->setAttribute ( 'xmlns:e' , 'http://base.google.com/cns/1.0' );
|
| 45 |
+
$elemRss->setAttribute ( 'xmlns:c' , 'http://base.google.com/cns/1.0' );
|
| 46 |
+
$elemRss->setAttribute ( 'magento' , Mage::getVersion() );
|
| 47 |
+
$elemRss->setAttribute ( 'epoq' , (string) Mage::getConfig()->getNode()->modules->Flagbit_EpoqInterface->version );
|
| 48 |
+
$xmlObj->appendChild( $elemRss );
|
| 49 |
+
|
| 50 |
+
// add Channel Element
|
| 51 |
+
$elemChannel = $xmlObj->createElement( 'channel' );
|
| 52 |
+
$elemRss->appendChild( $elemChannel );
|
| 53 |
+
|
| 54 |
+
// get Products
|
| 55 |
+
$product = Mage::getModel('catalog/product');
|
| 56 |
+
|
| 57 |
+
/*@var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
|
| 58 |
+
$products = $product->getCollection()
|
| 59 |
+
->addStoreFilter()
|
| 60 |
+
->joinField('qty',
|
| 61 |
+
'cataloginventory/stock_item',
|
| 62 |
+
'qty',
|
| 63 |
+
'product_id='.Mage::helper('epoqinterface')->getIdFieldName(),
|
| 64 |
+
'{{table}}.stock_id=1',
|
| 65 |
+
'left')
|
| 66 |
+
->addAttributeToSelect(array('name', 'price'), 'inner')
|
| 67 |
+
->addAttributeToSelect(array('short_description', 'image'), 'left');
|
| 68 |
+
|
| 69 |
+
// split Export in Parts
|
| 70 |
+
if($this->getRequest()->getParam('part')){
|
| 71 |
+
$products->getSelect()->limitPage($this->getRequest()->getParam('part', 1), $this->getRequest()->getParam('limit', 1000));
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
Mage::helper('epoqinterface/debug')->log('Export select query: '.(string) $products->getSelect());
|
| 75 |
+
|
| 76 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
| 77 |
+
//Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
| 78 |
+
|
| 79 |
+
/*
|
| 80 |
+
using resource iterator to load the data one by one
|
| 81 |
+
instead of loading all at the same time. loading all data at the same time can cause the big memory allocation.
|
| 82 |
+
*/
|
| 83 |
+
// BUGFIX: replaced with foreach: customer reported that product links in export xml are always the same
|
| 84 |
+
// Mage::getSingleton('core/resource_iterator')
|
| 85 |
+
// ->walk($products->getSelect(), array(array($this, 'addNewItemXmlCallback')), array('xmlObj'=> $xmlObj, 'product'=>$product));
|
| 86 |
+
foreach ($products as $product)
|
| 87 |
+
{
|
| 88 |
+
$this->addNewItemXmlCallback(array('product' => $product, 'xmlObj' => $xmlObj));
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
return $xmlObj->saveXML();
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Product iterator callback function
|
| 96 |
+
* add detailinformations to products
|
| 97 |
+
*
|
| 98 |
+
* @param array $args
|
| 99 |
+
*/
|
| 100 |
+
public function addNewItemXmlCallback($args)
|
| 101 |
+
{
|
| 102 |
+
$product = $args['product'];
|
| 103 |
+
$this->setData('product', $product);
|
| 104 |
+
|
| 105 |
+
// reset time limit
|
| 106 |
+
@set_time_limit(30);
|
| 107 |
+
|
| 108 |
+
/*@var $product Mage_Catalog_Model_Product */
|
| 109 |
+
$product->load($product->getId());
|
| 110 |
+
|
| 111 |
+
$this->setProductTypeInstance($product);
|
| 112 |
+
|
| 113 |
+
$parentProduct = array();
|
| 114 |
+
if(method_exists($product, 'getParentProductIds')){
|
| 115 |
+
$product->loadParentProductIds();
|
| 116 |
+
$parentProduct = $product->getParentProductIds();
|
| 117 |
+
} elseif (method_exists($product, 'getParentIdsByChild')) {
|
| 118 |
+
$objConfigurableProduct = Mage::getModel('catalog/product_type_configurable');
|
| 119 |
+
$parentProduct = $objConfigurableProduct->getParentIdsByChild($product);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// get Productcategories
|
| 123 |
+
$categories = $product->getCategoryCollection()->load();
|
| 124 |
+
|
| 125 |
+
$categoryPaths = array();
|
| 126 |
+
// get path for each category
|
| 127 |
+
foreach ($categories as $category) {
|
| 128 |
+
$this->setData('category', $category);
|
| 129 |
+
$categoryPaths[] = implode('>', $this->getCategoryPath(true));
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/*@var $xmlObj DOMDocument*/
|
| 133 |
+
$xmlObj = $args['xmlObj'];
|
| 134 |
+
|
| 135 |
+
// create Item xml Element
|
| 136 |
+
$elemItem = $xmlObj->createElement('item');
|
| 137 |
+
|
| 138 |
+
$data = array(
|
| 139 |
+
'title' => $product->getName(),
|
| 140 |
+
'link' => $product->getProductUrl(),
|
| 141 |
+
|
| 142 |
+
// g Namespace
|
| 143 |
+
'g:entity_id' => $product->getId(),
|
| 144 |
+
'g:id' => $product->getData(Mage::helper('epoqinterface')->getIdFieldName()),
|
| 145 |
+
'description' => $product->getShortDescription(),
|
| 146 |
+
'g:price' => $this->getProductPrice($product),
|
| 147 |
+
'g:image_link' => (string) $this->helper('catalog/image')->init($product, 'image'),
|
| 148 |
+
'g:product_type' => implode('|', $categoryPaths),
|
| 149 |
+
'g:brand' => is_object($this->getProduct()->getResource()
|
| 150 |
+
->getAttribute('manufacturer')) ? $this->getProduct()->getAttributeText('manufacturer') : '',
|
| 151 |
+
'g:upc' => $this->getProduct()->getSku(),
|
| 152 |
+
'g:quantity' => $this->getProduct()->isSaleable(),
|
| 153 |
+
'g:visibility' => $this->getProduct()->getVisibility(),
|
| 154 |
+
|
| 155 |
+
// e Namespace
|
| 156 |
+
'e:locakey' => substr(Mage::getSingleton('core/locale')->getLocale(), 0, 2),
|
| 157 |
+
|
| 158 |
+
// c Namespace
|
| 159 |
+
'c:mgtproducttype' => $product->getTypeId(),
|
| 160 |
+
|
| 161 |
+
);
|
| 162 |
+
|
| 163 |
+
$crossSellIds=$this->_getCrossSellIds($product,'id');
|
| 164 |
+
if (count($crossSellIds)>0) {
|
| 165 |
+
$data['c:crosssell_id'] = implode(';',$crossSellIds);
|
| 166 |
+
$data['c:crosssell_sku'] = implode(';',$this->_getCrossSellIds($product,'sku'));
|
| 167 |
+
} // if
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
// set Product variant
|
| 171 |
+
if(isset($parentProduct[0])){
|
| 172 |
+
$data['e:variant_of'] = $parentProduct[0];
|
| 173 |
+
$data['c:mgt_parents'] = implode(';', $parentProduct);
|
| 174 |
+
}
|
| 175 |
+
if($product->isConfigurable()
|
| 176 |
+
&& $product->getTypeInstance(true) instanceof Mage_Catalog_Model_Product_Type_Configurable){
|
| 177 |
+
$data['e:variants_id'] = implode(';', $this->_getVariantIds($product));
|
| 178 |
+
$data['e:variants_sku'] = implode(';', $this->_getVariantIds($product, 'sku'));
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
// add Product Attributes
|
| 182 |
+
$attributes = $this->getProductAttributes();
|
| 183 |
+
foreach($attributes as $key => $value){
|
| 184 |
+
$data['c:'.$key] = $value;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// translate array to XML
|
| 188 |
+
$this->dataToXml($data, 'data', $elemItem, $xmlObj);
|
| 189 |
+
|
| 190 |
+
// add Product to Channel Element
|
| 191 |
+
/*@var $elemChannel DOMNodeList */
|
| 192 |
+
$elemChannel = $xmlObj->getElementsByTagName('channel');
|
| 193 |
+
$elemChannel->item(0)->appendChild( $elemItem );
|
| 194 |
+
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* ReDefine Product Type Instance to Product
|
| 199 |
+
*
|
| 200 |
+
* @param Mage_Catalog_Model_Product $product
|
| 201 |
+
* @return Mage_Catalog_Model_Convert_Adapter_Product
|
| 202 |
+
*/
|
| 203 |
+
public function setProductTypeInstance(Mage_Catalog_Model_Product $product)
|
| 204 |
+
{
|
| 205 |
+
$type = $product->getTypeId();
|
| 206 |
+
if (!isset($this->_productTypeInstances[$type])) {
|
| 207 |
+
$this->_productTypeInstances[$type] = Mage::getSingleton('catalog/product_type')
|
| 208 |
+
->factory($product, true);
|
| 209 |
+
}
|
| 210 |
+
$product->setTypeInstance($this->_productTypeInstances[$type], true);
|
| 211 |
+
return $this;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* get Product CrossSells
|
| 216 |
+
*
|
| 217 |
+
* @param Mage_Catalog_Model_Product $product
|
| 218 |
+
* @return array
|
| 219 |
+
*/
|
| 220 |
+
protected function _getCrossSellIds($product, $type = 'id'){
|
| 221 |
+
|
| 222 |
+
$childProducts = $product->getCrossSellProducts();
|
| 223 |
+
foreach((array) $childProducts as $childProduct){
|
| 224 |
+
if ($type == 'id') {
|
| 225 |
+
$childProductIds[] = $childProduct->getId();
|
| 226 |
+
} else {
|
| 227 |
+
$childProductIds[] = $childProduct->getSku();
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
return $childProductIds;
|
| 231 |
+
} // _getCrossSellIds
|
| 232 |
+
|
| 233 |
+
/**
|
| 234 |
+
* get Product Variants
|
| 235 |
+
*
|
| 236 |
+
* @param Mage_Catalog_Model_Product $product
|
| 237 |
+
* @return array
|
| 238 |
+
*/
|
| 239 |
+
protected function _getVariantIds($product, $type = 'id'){
|
| 240 |
+
|
| 241 |
+
$childProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
|
| 242 |
+
$childProductIds = array();
|
| 243 |
+
foreach((array) $childProducts as $childProduct){
|
| 244 |
+
if ($type == 'id') {
|
| 245 |
+
$childProductIds[] = $childProduct->getId();
|
| 246 |
+
} else {
|
| 247 |
+
$childProductIds[] = $childProduct->getSku();
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
return $childProductIds;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
* get current Product
|
| 255 |
+
*
|
| 256 |
+
* @return Mage_Catalog_Model_Product
|
| 257 |
+
*/
|
| 258 |
+
public function getProduct()
|
| 259 |
+
{
|
| 260 |
+
return $this->getData('product');
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
/**
|
| 265 |
+
* get current Category
|
| 266 |
+
*
|
| 267 |
+
* @return unknown
|
| 268 |
+
*/
|
| 269 |
+
public function getCategory()
|
| 270 |
+
{
|
| 271 |
+
return $this->getData('category');
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
/**
|
| 276 |
+
* The main function for converting to an XML document.
|
| 277 |
+
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
|
| 278 |
+
*
|
| 279 |
+
* @param array $data
|
| 280 |
+
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
|
| 281 |
+
* @param DomElement $elem - should only be used recursively
|
| 282 |
+
* @param DOMDocument $xml - should only be used recursively
|
| 283 |
+
* @return object DOMDocument
|
| 284 |
+
*/
|
| 285 |
+
protected function dataToXml($data, $rootNodeName = 'data', $elem=null, $xml=null)
|
| 286 |
+
{
|
| 287 |
+
|
| 288 |
+
if ($xml === null)
|
| 289 |
+
{
|
| 290 |
+
$xml = new DOMDocument("1.0", "UTF-8");
|
| 291 |
+
$xml->formatOutput = true;
|
| 292 |
+
$elem = $xml->createElement( $rootNodeName );
|
| 293 |
+
$xml->appendChild( $elem );
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
// loop through the data passed in.
|
| 297 |
+
foreach($data as $key => $value)
|
| 298 |
+
{
|
| 299 |
+
// no numeric keys in our xml please!
|
| 300 |
+
if (is_numeric($key))
|
| 301 |
+
{
|
| 302 |
+
// make string key...
|
| 303 |
+
$key = "node_". (string) $key;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// replace anything not alpha numeric
|
| 307 |
+
$key = preg_replace('/[^a-z0-9\_\:]/i', '', $key);
|
| 308 |
+
|
| 309 |
+
// if there is another array found recrusively call this function
|
| 310 |
+
if (is_array($value))
|
| 311 |
+
{
|
| 312 |
+
$subelem = $xml->createElement( $key );
|
| 313 |
+
$elem->appendChild( $subelem);
|
| 314 |
+
|
| 315 |
+
// recrusive call.
|
| 316 |
+
$this->DataToXml($value, $rootNodeName, $subelem, $xml);
|
| 317 |
+
}
|
| 318 |
+
else
|
| 319 |
+
{
|
| 320 |
+
$subelem = $xml->createElement( $key );
|
| 321 |
+
$subelem->appendChild(
|
| 322 |
+
(
|
| 323 |
+
strpos($value, '<')
|
| 324 |
+
or strpos($value, '>')
|
| 325 |
+
or strpos($value, '&')
|
| 326 |
+
)
|
| 327 |
+
? $xml->createCDATASection( $value )
|
| 328 |
+
: $xml->createTextNode( $value )
|
| 329 |
+
);
|
| 330 |
+
$elem->appendChild( $subelem );
|
| 331 |
+
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
// pass back as DOMDocument object
|
| 336 |
+
return $xml;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
}
|
app/code/community/Flagbit/EpoqInterface/etc/config.xml
CHANGED
|
@@ -20,7 +20,7 @@
|
|
| 20 |
<modules>
|
| 21 |
<Flagbit_EpoqInterface>
|
| 22 |
<active>true</active>
|
| 23 |
-
<version>1.2.
|
| 24 |
</Flagbit_EpoqInterface>
|
| 25 |
</modules>
|
| 26 |
|
| 20 |
<modules>
|
| 21 |
<Flagbit_EpoqInterface>
|
| 22 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/* *
|
| 4 |
+
* This script is part of the epoq Recommendation Service project *
|
| 5 |
+
* *
|
| 6 |
+
* epoqinterface is free software; you can redistribute it and/or modify *
|
| 7 |
+
* it under the terms of the GNU General Public License version 2 as *
|
| 8 |
+
* published by the Free Software Foundation. *
|
| 9 |
+
* *
|
| 10 |
+
* This script is distributed in the hope that it will be useful, but *
|
| 11 |
+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
|
| 12 |
+
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
| 13 |
+
* Public License for more details. *
|
| 14 |
+
* *
|
| 15 |
+
* @version $Id: config.xml 915 2011-10-19 12:35:02Z weller $
|
| 16 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<modules>
|
| 21 |
+
<Flagbit_EpoqInterface>
|
| 22 |
+
<active>true</active>
|
| 23 |
+
<version>1.2.10</version>
|
| 24 |
+
</Flagbit_EpoqInterface>
|
| 25 |
+
</modules>
|
| 26 |
+
|
| 27 |
+
<global>
|
| 28 |
+
<helpers>
|
| 29 |
+
<epoqinterface>
|
| 30 |
+
<class>Flagbit_EpoqInterface_Helper</class>
|
| 31 |
+
</epoqinterface>
|
| 32 |
+
</helpers>
|
| 33 |
+
<blocks>
|
| 34 |
+
<epoqinterface>
|
| 35 |
+
<class>Flagbit_EpoqInterface_Block</class>
|
| 36 |
+
</epoqinterface>
|
| 37 |
+
</blocks>
|
| 38 |
+
<models>
|
| 39 |
+
<epoqinterface>
|
| 40 |
+
<class>Flagbit_EpoqInterface_Model</class>
|
| 41 |
+
<resourceModel>epoqinterface_mysql4</resourceModel>
|
| 42 |
+
</epoqinterface>
|
| 43 |
+
<epoqinterface_mysql4>
|
| 44 |
+
<class>Flagbit_EpoqInterface_Model_Resource_Eav_Mysql4</class>
|
| 45 |
+
</epoqinterface_mysql4>
|
| 46 |
+
</models>
|
| 47 |
+
<rewrite>
|
| 48 |
+
<epoqinterface>
|
| 49 |
+
<from><![CDATA[#^/epoqinterface/$#]]></from>
|
| 50 |
+
<to>/epoqinterface/index/productlist/</to>
|
| 51 |
+
</epoqinterface>
|
| 52 |
+
</rewrite>
|
| 53 |
+
</global>
|
| 54 |
+
|
| 55 |
+
<frontend>
|
| 56 |
+
<layout>
|
| 57 |
+
<updates>
|
| 58 |
+
<epoqinterface>
|
| 59 |
+
<file>epoqinterface.xml</file>
|
| 60 |
+
</epoqinterface>
|
| 61 |
+
</updates>
|
| 62 |
+
</layout>
|
| 63 |
+
<routers>
|
| 64 |
+
<epoqinterface>
|
| 65 |
+
<use>standard</use>
|
| 66 |
+
<args>
|
| 67 |
+
<module>Flagbit_EpoqInterface</module>
|
| 68 |
+
<frontName>epoqinterface</frontName>
|
| 69 |
+
</args>
|
| 70 |
+
</epoqinterface>
|
| 71 |
+
</routers>
|
| 72 |
+
<events>
|
| 73 |
+
<checkout_cart_product_add_after>
|
| 74 |
+
<observers>
|
| 75 |
+
<epoqinterface>
|
| 76 |
+
<type>singleton</type>
|
| 77 |
+
<class>epoqinterface/observer</class>
|
| 78 |
+
<method>checkoutCartProductAddAfter</method>
|
| 79 |
+
</epoqinterface>
|
| 80 |
+
</observers>
|
| 81 |
+
</checkout_cart_product_add_after>
|
| 82 |
+
<checkout_cart_update_items_after>
|
| 83 |
+
<observers>
|
| 84 |
+
<epoqinterface>
|
| 85 |
+
<type>singleton</type>
|
| 86 |
+
<class>epoqinterface/observer</class>
|
| 87 |
+
<method>checkoutCartUpdateItemsAfter</method>
|
| 88 |
+
</epoqinterface>
|
| 89 |
+
</observers>
|
| 90 |
+
</checkout_cart_update_items_after>
|
| 91 |
+
<controller_action_predispatch_checkout_cart_delete>
|
| 92 |
+
<observers>
|
| 93 |
+
<epoqinterface>
|
| 94 |
+
<type>singleton</type>
|
| 95 |
+
<class>epoqinterface/observer</class>
|
| 96 |
+
<method>controllerActionPredispatchCheckoutCartDelete</method>
|
| 97 |
+
</epoqinterface>
|
| 98 |
+
</observers>
|
| 99 |
+
</controller_action_predispatch_checkout_cart_delete>
|
| 100 |
+
<sales_order_place_after>
|
| 101 |
+
<observers>
|
| 102 |
+
<epoqinterface>
|
| 103 |
+
<type>singleton</type>
|
| 104 |
+
<class>epoqinterface/observer</class>
|
| 105 |
+
<method>salesOrderPlaceAfter</method>
|
| 106 |
+
</epoqinterface>
|
| 107 |
+
</observers>
|
| 108 |
+
</sales_order_place_after>
|
| 109 |
+
<checkout_onepage_controller_success_action>
|
| 110 |
+
<observers>
|
| 111 |
+
<epoqinterface_order_success>
|
| 112 |
+
<class>epoqinterface/observer</class>
|
| 113 |
+
<method>setTrackOnOrderSuccessPageView</method>
|
| 114 |
+
</epoqinterface_order_success>
|
| 115 |
+
</observers>
|
| 116 |
+
</checkout_onepage_controller_success_action>
|
| 117 |
+
<checkout_multishipping_controller_success_action>
|
| 118 |
+
<observers>
|
| 119 |
+
<epoqinterface_order_success>
|
| 120 |
+
<class>epoqinterface/observer</class>
|
| 121 |
+
<method>setTrackOnOrderSuccessPageView</method>
|
| 122 |
+
</epoqinterface_order_success>
|
| 123 |
+
</observers>
|
| 124 |
+
</checkout_multishipping_controller_success_action>
|
| 125 |
+
</events>
|
| 126 |
+
</frontend>
|
| 127 |
+
|
| 128 |
+
<adminhtml>
|
| 129 |
+
<acl>
|
| 130 |
+
<resources>
|
| 131 |
+
<admin>
|
| 132 |
+
<children>
|
| 133 |
+
<system>
|
| 134 |
+
<children>
|
| 135 |
+
<config>
|
| 136 |
+
<children>
|
| 137 |
+
<epoqinterface>
|
| 138 |
+
<title>epoq Recommendation Service</title>
|
| 139 |
+
</epoqinterface>
|
| 140 |
+
</children>
|
| 141 |
+
</config>
|
| 142 |
+
</children>
|
| 143 |
+
</system>
|
| 144 |
+
</children>
|
| 145 |
+
</admin>
|
| 146 |
+
</resources>
|
| 147 |
+
</acl>
|
| 148 |
+
<translate>
|
| 149 |
+
<modules>
|
| 150 |
+
<Flagbit_EpoqInterface>
|
| 151 |
+
<files>
|
| 152 |
+
<default>Flagbit_EpoqInterface.csv</default>
|
| 153 |
+
</files>
|
| 154 |
+
</Flagbit_EpoqInterface>
|
| 155 |
+
</modules>
|
| 156 |
+
</translate>
|
| 157 |
+
</adminhtml>
|
| 158 |
+
|
| 159 |
+
<default>
|
| 160 |
+
<epoqinterface>
|
| 161 |
+
<config>
|
| 162 |
+
<timeout>2</timeout>
|
| 163 |
+
<demo>0</demo>
|
| 164 |
+
<demo_items>6</demo_items>
|
| 165 |
+
<customer_profiles>0</customer_profiles>
|
| 166 |
+
<debug>0</debug>
|
| 167 |
+
<ajax>0</ajax>
|
| 168 |
+
<cookie>0</cookie>
|
| 169 |
+
</config>
|
| 170 |
+
<display_recommendation>
|
| 171 |
+
<user>1</user>
|
| 172 |
+
<rule_customer>RecommendationForCustomerRule</rule_customer>
|
| 173 |
+
<cart>1</cart>
|
| 174 |
+
<rule_cart>RecommendationForCartRule</rule_cart>
|
| 175 |
+
<product>1</product>
|
| 176 |
+
<rule_product>default</rule_product>
|
| 177 |
+
</display_recommendation>
|
| 178 |
+
<export>
|
| 179 |
+
<username>epoq</username>
|
| 180 |
+
</export>
|
| 181 |
+
<error_handling>
|
| 182 |
+
<enabled>0</enabled>
|
| 183 |
+
<max_attempts>3</max_attempts>
|
| 184 |
+
<idle_time>10</idle_time>
|
| 185 |
+
</error_handling>
|
| 186 |
+
</epoqinterface>
|
| 187 |
+
<system>
|
| 188 |
+
<epoqinterface>
|
| 189 |
+
<rest_url>http://rs1.epoq.de/inbound-servletapi/</rest_url>
|
| 190 |
+
<rest_failure_counter>0</rest_failure_counter>
|
| 191 |
+
</epoqinterface>
|
| 192 |
+
</system>
|
| 193 |
+
</default>
|
| 194 |
+
</config>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>epoqRS</name>
|
| 4 |
-
<version>1.2.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -12,12 +12,12 @@
|
|
| 12 |
The quick and easy integration of epoq RS makes your Magento sell more within a few hours. You do not have to submit and update your product data and there is no need to connect to any internal systems - all available information - click stream, product data, cart information - are automatically processed for maximum quality recommendations.
|
| 13 |

|
| 14 |
Try epoq Recommendation Service - free and without obligation in our 30-day trial version.</description>
|
| 15 |
-
<notes>- export
|
| 16 |
-
|
| 17 |
<authors><author><name>FlagbitFlagbit GmbH Co. KG</name><user>flagbit</user><email>magento@flagbit.de</email></author></authors>
|
| 18 |
-
<date>2013-
|
| 19 |
-
<time>
|
| 20 |
-
<contents><target name="magecommunity"><dir name="Flagbit"><dir name="EpoqInterface"><dir name="Block"><file name="Abstract.php" hash="8d96815ddd6899c68bb127d1314276c5"/><dir name="Export"><file name="Productlist.php" hash="
|
| 21 |
<compatible/>
|
| 22 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 23 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>epoqRS</name>
|
| 4 |
+
<version>1.2.10</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
| 12 |
The quick and easy integration of epoq RS makes your Magento sell more within a few hours. You do not have to submit and update your product data and there is no need to connect to any internal systems - all available information - click stream, product data, cart information - are automatically processed for maximum quality recommendations.
|
| 13 |

|
| 14 |
Try epoq Recommendation Service - free and without obligation in our 30-day trial version.</description>
|
| 15 |
+
<notes>- export crossselling products
|
| 16 |
+
</notes>
|
| 17 |
<authors><author><name>FlagbitFlagbit GmbH Co. KG</name><user>flagbit</user><email>magento@flagbit.de</email></author></authors>
|
| 18 |
+
<date>2013-08-07</date>
|
| 19 |
+
<time>14:59:33</time>
|
| 20 |
+
<contents><target name="magecommunity"><dir name="Flagbit"><dir name="EpoqInterface"><dir name="Block"><file name="Abstract.php" hash="8d96815ddd6899c68bb127d1314276c5"/><dir name="Export"><file name="Productlist.php" hash="be568d92995300c70b377eb7bf965065"/><file name="Productlist.php~" hash="be568d92995300c70b377eb7bf965065"/></dir><file name="Head.php" hash="a898e39f4f86c0fcb8555c8d37e7ea2f"/><dir name="Recommendation"><file name="Abstract.php" hash="7fa68d2d34701511f60bbfe22931fd98"/><file name="Ajaxproduct.php" hash="558658147d6227436ff64996798e1fca"/><file name="Cart.php" hash="4bbe3e8abedbf4313db25b941b4f3e51"/><file name="Product.php" hash="94752b4f0837337862bb7d5ad692f21c"/><file name="User.php" hash="27d90f93b2a157bbb999a38136234407"/></dir><file name="Recommendation.php" hash="33875c34bffc6c50b8d894aea542cd63"/><dir name="Result"><file name="List.php" hash="247ba01688e5d9f89cf21fd0d73faf1f"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="71e3964c13333a57929221aa8e2edf07"/></dir></dir></dir></dir><dir name="Track"><file name="Cart.php" hash="401061ad5b1d3bf279019c0803497178"/><file name="Order.php" hash="5280a5644c6fb62493d6853dafb887e5"/><file name="Product.php" hash="fbc499387ab0a20a0e702d4752056218"/><file name="User.php" hash="0d16615628d7df944976db9c3f02bb09"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9d0d756bce4953b90624ba97ae6c63aa"/><file name="Debug.php" hash="7ab1e3121471d87ee59f02d129f308be"/></dir><dir name="Model"><file name="Abstract.php" hash="6d369b3b01ccaa3c796c37484e95a85f"/><dir name="Container"><file name="Product.php" hash="bb25e96a4159584c9701854d51962e52"/><file name="TrackProduct.php" hash="f95bbb60d7344859f71bd13b22d587c7"/></dir><dir name="Customer"><file name="Profiles.php" hash="fbedb6a3259a29db05b2c8783d02957b"/></dir><file name="Observer.php" hash="fa554bcc512f2c7d3b383b16ce41ebee"/><file name="Order.php" hash="9ff6141bb8a1a8b5070570310e1266e5"/><dir name="Recommendation"><file name="Abstract.php" hash="e7a8846905e453f5880b2362a9bbfe90"/><file name="Cart.php" hash="d46124c4c546c69ea64713e9402d6d25"/><file name="Product.php" hash="0e412fe277f5ef9d3e6a493dbfecc3fd"/><file name="User.php" hash="88e6b07cf2d0ba35441d95bc2d87f3d5"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="9a302cf7cdfec28370d7c9afa31dac8a"/></dir></dir></dir></dir><file name="Session.php" hash="413f7d31ad2d5878f20a7db7adf5d207"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attemps.php" hash="c01ebd5c76fd4d51305ed7111326d57d"/><file name="Identifier.php" hash="9e56f688a92a5691a5934e47f42144b6"/><file name="Idletime.php" hash="957ec9d0c4af2d52add60a9765c4e573"/><file name="Timeout.php" hash="95c38625ad50dc44ba2b2d371de1db65"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="6ea3c2de180540e082f0598133355e69"/><file name="RecommendationController.php" hash="a5930a94e2195adb07caac0bcac7cf5f"/></dir><dir name="documentation"><file name="epoqRS_Magento Installation Guide 1.2.4.pdf" hash="364abe5d2e44ce8aa31d08384dc54e1a"/></dir><dir name="etc"><file name="cache.xml" hash="7ed329563d8914670ae1ddeb399de34d"/><file name="config.xml" hash="6346ea919213fc06719b064e89e9d2a7"/><file name="config.xml~" hash="6346ea919213fc06719b064e89e9d2a7"/><file name="system.xml" hash="a5d70a49602cd9d14f542d515cde30bb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flagbit_EpoqInterface.xml" hash="8ada99bfdbcc7727ad36339bc11da6ec"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Flagbit_EpoqInterface.csv" hash="222d5eaedfde0639dd26f91c52dc395e"/></dir></target><target name="mageweb"><dir name="js"><dir name="epoqinterface"><file name="epoq_recommendations.js" hash="1b460589f83e228683ff2f610dfd13fc"/><file name="jQuery_init.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="444ae31a25a3fc4f9df6e335a5e2e15d"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="91fe1e5178fd79249dade5391952f9fa"/><file name="list.phtml" hash="c6c9c45f81993542dd182abea8c88f43"/><file name="mailproduct.phtml" hash="a81b28b9bee47f9e63a58ef87b7bb898"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="a3e884ce1f8ca6ab5ed4383e43b044d8"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="444ae31a25a3fc4f9df6e335a5e2e15d"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="71bd2c1724743d995d31df4b96a24e87"/><file name="list.phtml" hash="92158be9c3dddca88cbd202aab666d39"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="90043a07221d19dcb079b86615eafa3b"/></dir></dir></dir></dir></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>
|
