Favizone_Recommender - Version 1.0.8

Version Notes

* Editing product's categories data : getting all categories hierarchy

Download this release

Release Info

Developer Favizone
Extension Favizone_Recommender
Version 1.0.8
Comparing to
See all releases


Code changes from version 1.0.7 to 1.0.8

app/code/community/Favizone/Recommender/Model/Meta/Product.php CHANGED
@@ -89,7 +89,7 @@ class Favizone_Recommender_Model_Meta_Product extends Mage_Core_Model_Abstract{
89
  }
90
 
91
  //Categories
92
- $categories = $this->getProductCategories($product);
93
  $product_data['categoriesNames'] = $categories['categories_names'];
94
  $product_data['categories']= $categories['categories_ids'];
95
 
@@ -287,7 +287,7 @@ class Favizone_Recommender_Model_Meta_Product extends Mage_Core_Model_Abstract{
287
  array_push($product_data, "");
288
 
289
  //Categories
290
- $categories = $this->getProductCategories($product);
291
  array_push($product_data, implode(";", $categories['categories_names']));
292
  array_push($product_data, implode(";", $categories['categories_ids']));
293
 
@@ -521,17 +521,64 @@ class Favizone_Recommender_Model_Meta_Product extends Mage_Core_Model_Abstract{
521
  return $url;
522
  }
523
 
524
- protected function getProductCategories($product){
525
 
526
- $categories = array('categories_names'=> array(), 'categories_ids'=>array());
527
- $categories_collection = $product->getCategoryCollection()
528
- ->addAttributeToSelect('name');
529
- foreach ($categories_collection as $category) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
 
531
- array_push($categories['categories_ids'], $category->getId());
532
- array_push($categories['categories_names'], $category->getName());
 
 
 
 
 
 
 
 
 
 
533
  }
534
- return $categories;
535
  }
536
 
537
  protected function getProductName($productId, $storeId){
89
  }
90
 
91
  //Categories
92
+ $categories = $this->getProductCategories($product, $store);
93
  $product_data['categoriesNames'] = $categories['categories_names'];
94
  $product_data['categories']= $categories['categories_ids'];
95
 
287
  array_push($product_data, "");
288
 
289
  //Categories
290
+ $categories = $this->getProductCategories($product, $store);
291
  array_push($product_data, implode(";", $categories['categories_names']));
292
  array_push($product_data, implode(";", $categories['categories_ids']));
293
 
521
  return $url;
522
  }
523
 
524
+ protected function getProductCategories($product, Mage_Core_Model_Store $store){
525
 
526
+ $categoriesData = array('categories_identifiers'=> array(), 'categories_names' => array(), 'categories_ids'=>array());
527
+ $pathArray = array();
528
+ $idPathArray = array();
529
+ $collection1 = $product->getCategoryCollection()
530
+ ->setStoreId($store->getId())
531
+ ->addAttributeToSelect('path')
532
+ ->addAttributeToSelect('is_active');
533
+
534
+
535
+ foreach($collection1 as $cat1){
536
+ array_push($categoriesData['categories_ids'], $cat1->getId());
537
+ $pathIds = explode('/', $cat1->getPath());
538
+ $collection = Mage::getModel('catalog/category')->getCollection()
539
+ ->setStoreId($store->getId())
540
+ ->addAttributeToSelect('name')
541
+ ->addAttributeToSelect('is_active')
542
+ ->addFieldToFilter('entity_id', array('in' => $pathIds));
543
+
544
+ $pahtByName = '';
545
+ foreach($collection as $cat){
546
+ $pahtByName .= '/' . $cat->getName();
547
+ }
548
+ if($pahtByName[0]==='/')
549
+ $pahtByName = substr($pahtByName, 1);
550
+ $pathArray[] = $pahtByName;
551
+ $idPathArray[] = $cat1->getPath();
552
+
553
+ }
554
+ $unique = true;
555
+ for ($i=0; $i <count($pathArray) ; $i++) {
556
+ for ($j=$i+1; $j <count($pathArray); $j++) {
557
+ if (strpos($pathArray[$j], $pathArray[$i]) !== false) {
558
+ $unique = false;
559
+ break;
560
+ }
561
+ }
562
+ if($unique === true){
563
+ array_push($categoriesData['categories_names'], $pathArray[$i]);
564
+ }
565
+ $unique = true;
566
+ }
567
 
568
+ $unique = true;
569
+ for ($i=0; $i <count($idPathArray) ; $i++) {
570
+ for ($j=$i+1; $j <count($idPathArray); $j++) {
571
+ if (strpos($idPathArray[$j], $idPathArray[$i]) !== false) {
572
+ $unique = false;
573
+ break;
574
+ }
575
+ }
576
+ if($unique === true){
577
+ array_push($categoriesData['categories_identifiers'], $idPathArray[$i]);
578
+ }
579
+ $unique = true;
580
  }
581
+ return $categoriesData;
582
  }
583
 
584
  protected function getProductName($productId, $storeId){
app/code/community/Favizone/Recommender/etc/config.xml CHANGED
@@ -26,7 +26,7 @@
26
  names, with directory separators replaced by underscores
27
  -->
28
  <Favizone_Recommender>
29
- <version>1.0.7</version>
30
  </Favizone_Recommender>
31
  </modules>
32
  <global>
26
  names, with directory separators replaced by underscores
27
  -->
28
  <Favizone_Recommender>
29
+ <version>1.0.8</version>
30
  </Favizone_Recommender>
31
  </modules>
32
  <global>
package.xml CHANGED
@@ -1,19 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Favizone_Recommender</name>
4
- <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Favizone</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Personalization for Magento</summary>
10
  <description>Favizone Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.e_Recommender</description>
11
- <notes>* Edit A/B test processing.&#xD;
12
- </notes>
13
  <authors><author><name>Favizone</name><user>favizone</user><email>contact@favizone.com</email></author></authors>
14
- <date>2016-11-18</date>
15
- <time>11:04:46</time>
16
- <contents><target name="mageetc"><dir name="modules"><file name="Favizone_Recommender.xml" hash="7457b857a4a6fb30905081c9c87fee60"/></dir></target><target name="magecommunity"><dir name="Favizone"><dir name="Recommender"><dir name="Block"><dir name="Adminhtml"><file name="AdminConfig.php" hash="141fcf73ddb9a82818a65021d74a01a8"/></dir><file name="Common.php" hash="e53f8700fcf0fde9353a571d71272547"/><file name="Custom.php" hash="b904e161cc0100d7518f09bec7cf04ac"/><file name="Renderer.php" hash="6e97d9d908b47e7f59b288b35fe3d18d"/><file name="Tracker.php" hash="c099c9ff1e207aa5d0f868bf12434280"/></dir><dir name="Helper"><file name="Account.php" hash="62eda9b2b7bb7db618e117d9ba002b7b"/><file name="Category.php" hash="30cf71f08be4f4ff265652633c2c5876"/><file name="Common.php" hash="062d1cdf8c1403b3a02b9562af761328"/><file name="Customer.php" hash="d964c01b0feee83dd279115deaa8b209"/><file name="Data.php" hash="dc837e04dd9c0ebed5ef6946b909417f"/><file name="Export.php" hash="3f0623bf1ad76991ca5229938d957586"/><file name="Order.php" hash="d4023b65bf902b7ef202b91b7d0629e7"/><file name="Product.php" hash="57451c4180b61aee7cc4530b1e402e22"/><file name="Sender.php" hash="24f9459a7eefcaa5f3a13e90f932dab2"/></dir><dir name="Model"><file name="AccessKey.php" hash="c0fabf3617b346543bcca6f36fe98e1a"/><dir name="Meta"><file name="Customer.php" hash="de62cf990ba2d3b1e83759919f6f9cfc"/><file name="Order.php" hash="9ebb1a57b41bee5db8c3463f241d872f"/><file name="Product.php" hash="871d458c611d563950083a8e40b148d5"/></dir><file name="Observer.php" hash="6347d192cc5fd52aed37d206a5192166"/><file name="Product.php" hash="d480f4a105cba555b23831dbc4a25e1b"/><dir name="Resource"><dir name="AccessKey"><file name="Collection.php" hash="5255134124dc54701b4942cc0c29f018"/></dir><file name="AccessKey.php" hash="5e4d06afae4261e6f7e1da929a3c4d09"/><dir name="Product"><file name="Collection.php" hash="52bed2df792fe0562e3c2e777ffc3767"/></dir><file name="Setup.php" hash="5e0685b4baad75a3e84223fad4c1e3b9"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FavizoneController.php" hash="c26e28b6650c3150a68ba8bc822bd8c2"/></dir><file name="IndexController.php" hash="d6609e50ac68ad29a3a952bcf6b88ef9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="abe94fe89c2635eae6b0c46c27601982"/><file name="config.xml" hash="731ec78e2ab035f7d70d9da8582e6db4"/></dir><dir name="sql"><dir name="favizone_recommender_setup"><file name="mysql4-install-1.0.0.php" hash="b2b0bf8d6a50ea30808e284fe6e6d956"/><file name="mysql4-upgrade-1.0.0-1.0.3.php" hash="13a8f4614e43b2a65f854e6c51ae3e04"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="favizone"><file name="admin-custom-style.css" hash="f278f55ed46d78600f7613fa4ad494f4"/><file name="font-awesome.min.css" hash="7aa7a0865ce6f38d0e854d3dd4623e3d"/><dir name="fonts"><file name="FontAwesome.otf" hash="87d8ca3ddc57e7d2da6226e480f90457"/><file name="fontawesome-webfont.eot" hash="32400f4e08932a94d8bfd2422702c446"/><file name="fontawesome-webfont.svg" hash="f775f9cca88e21d45bebe185b27c0e5b"/><file name="fontawesome-webfont.ttf" hash="a3de2170e4e9df77161ea5d3f31b2668"/><file name="fontawesome-webfont.woff" hash="a35720c2fed2c7f043bc7e4ffb45e073"/><file name="fontawesome-webfont.woff2" hash="db812d8a70a4e88e888744c1c9a27e89"/></dir></dir><dir name="images"><dir name="favizone"><file name="close.png" hash="8177fd73492c9b00de9d8e39ce518352"/><file name="logo-favizone.png" hash="f4ba18ee390b6080b5660a0102c817e8"/><file name="minimize.png" hash="beff58e92474b2ff1365107c75747e63"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="favizone"><file name="favizone-auto-appender.js" hash="5d76d6c235b07ee68b73909d1c048a3a"/><file name="favizone-helper.js" hash="ad8fbad529e8e4d803949d860ae67ad8"/><file name="favizone-preview-manager.js" hash="76802c9d3e38cb8ec3c700754d40fd8f"/><file name="favizone-renderer.js" hash="86f672087f479cc113f66bc97227e3aa"/><file name="favizone-tracker.js" hash="dbd2e4d131911b41f220ff880e1df23c"/><file name="internal-sender.js" hash="79f6501b98c3fa279bcaf1bb885e663f"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="favizonerecommender.xml" hash="accc4ea6c5ec649f9c990508196399f5"/></dir><dir name="template"><dir name="favizonerecommender"><file name="adminconfig.phtml" hash="98c71b89a37ce684398ecf9fe8f9d651"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="favizonerecommender.xml" hash="761e78aad6a8b28baba9ceb008755732"/></dir><dir name="template"><dir name="favizonerecommender"><file name="bottom.phtml" hash="0a4c338723bbdc8753f4536cc69a7284"/><file name="common.phtml" hash="d9f906e6eb81892361b5bd5c0e88b8ed"/><file name="custom.phtml" hash="b4c5c3492a1eca27c59510b642a1f837"/><file name="event.phtml" hash="8da220d74a265c722edfa43f02b21a4e"/><file name="footer.phtml" hash="f080c361ceff1aed3010e9aad9c07251"/><file name="index.phtml" hash="17e341f9b39c20030ce03bced05fd091"/><file name="preview.phtml" hash="c205c5d2ed8dc98877f6d8d0f6a356ac"/><file name="renderer.phtml" hash="b269e1e7f9e4dfd57e6806e581e887f0"/><file name="tracker.phtml" hash="d3e3ee4ebaf6042f37c1366811bbad7f"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Favizone_Recommender.csv" hash="9832f3a28ed8c6af16ddb29d23444131"/></dir><dir name="fr_FR"><file name="Favizone_Recommender.csv" hash="af5908d502a8d2356e86f6a1729a7309"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Favizone_Recommender</name>
4
+ <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Favizone</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Personalization for Magento</summary>
10
  <description>Favizone Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.e_Recommender</description>
11
+ <notes>* Editing product's categories data : getting all categories hierarchy </notes>
 
12
  <authors><author><name>Favizone</name><user>favizone</user><email>contact@favizone.com</email></author></authors>
13
+ <date>2017-01-16</date>
14
+ <time>11:14:57</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Favizone_Recommender.xml" hash="7457b857a4a6fb30905081c9c87fee60"/></dir></target><target name="magecommunity"><dir name="Favizone"><dir name="Recommender"><dir name="Block"><dir name="Adminhtml"><file name="AdminConfig.php" hash="141fcf73ddb9a82818a65021d74a01a8"/></dir><file name="Common.php" hash="e53f8700fcf0fde9353a571d71272547"/><file name="Custom.php" hash="b904e161cc0100d7518f09bec7cf04ac"/><file name="Renderer.php" hash="6e97d9d908b47e7f59b288b35fe3d18d"/><file name="Tracker.php" hash="c099c9ff1e207aa5d0f868bf12434280"/></dir><dir name="Helper"><file name="Account.php" hash="62eda9b2b7bb7db618e117d9ba002b7b"/><file name="Category.php" hash="30cf71f08be4f4ff265652633c2c5876"/><file name="Common.php" hash="062d1cdf8c1403b3a02b9562af761328"/><file name="Customer.php" hash="d964c01b0feee83dd279115deaa8b209"/><file name="Data.php" hash="dc837e04dd9c0ebed5ef6946b909417f"/><file name="Export.php" hash="3f0623bf1ad76991ca5229938d957586"/><file name="Order.php" hash="d4023b65bf902b7ef202b91b7d0629e7"/><file name="Product.php" hash="57451c4180b61aee7cc4530b1e402e22"/><file name="Sender.php" hash="24f9459a7eefcaa5f3a13e90f932dab2"/></dir><dir name="Model"><file name="AccessKey.php" hash="c0fabf3617b346543bcca6f36fe98e1a"/><dir name="Meta"><file name="Customer.php" hash="de62cf990ba2d3b1e83759919f6f9cfc"/><file name="Order.php" hash="9ebb1a57b41bee5db8c3463f241d872f"/><file name="Product.php" hash="a2847ff70871f905cccf1688bdcc5cd4"/></dir><file name="Observer.php" hash="6347d192cc5fd52aed37d206a5192166"/><file name="Product.php" hash="d480f4a105cba555b23831dbc4a25e1b"/><dir name="Resource"><dir name="AccessKey"><file name="Collection.php" hash="5255134124dc54701b4942cc0c29f018"/></dir><file name="AccessKey.php" hash="5e4d06afae4261e6f7e1da929a3c4d09"/><dir name="Product"><file name="Collection.php" hash="52bed2df792fe0562e3c2e777ffc3767"/></dir><file name="Setup.php" hash="5e0685b4baad75a3e84223fad4c1e3b9"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FavizoneController.php" hash="c26e28b6650c3150a68ba8bc822bd8c2"/></dir><file name="IndexController.php" hash="d6609e50ac68ad29a3a952bcf6b88ef9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="abe94fe89c2635eae6b0c46c27601982"/><file name="config.xml" hash="26f6cdb8947835f5dc25cddd4ae34b6f"/></dir><dir name="sql"><dir name="favizone_recommender_setup"><file name="mysql4-install-1.0.0.php" hash="b2b0bf8d6a50ea30808e284fe6e6d956"/><file name="mysql4-upgrade-1.0.0-1.0.3.php" hash="13a8f4614e43b2a65f854e6c51ae3e04"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="favizone"><file name="admin-custom-style.css" hash="f278f55ed46d78600f7613fa4ad494f4"/><file name="font-awesome.min.css" hash="7aa7a0865ce6f38d0e854d3dd4623e3d"/><dir name="fonts"><file name="FontAwesome.otf" hash="87d8ca3ddc57e7d2da6226e480f90457"/><file name="fontawesome-webfont.eot" hash="32400f4e08932a94d8bfd2422702c446"/><file name="fontawesome-webfont.svg" hash="f775f9cca88e21d45bebe185b27c0e5b"/><file name="fontawesome-webfont.ttf" hash="a3de2170e4e9df77161ea5d3f31b2668"/><file name="fontawesome-webfont.woff" hash="a35720c2fed2c7f043bc7e4ffb45e073"/><file name="fontawesome-webfont.woff2" hash="db812d8a70a4e88e888744c1c9a27e89"/></dir></dir><dir name="images"><dir name="favizone"><file name="close.png" hash="8177fd73492c9b00de9d8e39ce518352"/><file name="logo-favizone.png" hash="f4ba18ee390b6080b5660a0102c817e8"/><file name="minimize.png" hash="beff58e92474b2ff1365107c75747e63"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="favizone"><file name="favizone-auto-appender.js" hash="5d76d6c235b07ee68b73909d1c048a3a"/><file name="favizone-helper.js" hash="ad8fbad529e8e4d803949d860ae67ad8"/><file name="favizone-preview-manager.js" hash="76802c9d3e38cb8ec3c700754d40fd8f"/><file name="favizone-renderer.js" hash="86f672087f479cc113f66bc97227e3aa"/><file name="favizone-tracker.js" hash="dbd2e4d131911b41f220ff880e1df23c"/><file name="internal-sender.js" hash="79f6501b98c3fa279bcaf1bb885e663f"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="favizonerecommender.xml" hash="accc4ea6c5ec649f9c990508196399f5"/></dir><dir name="template"><dir name="favizonerecommender"><file name="adminconfig.phtml" hash="98c71b89a37ce684398ecf9fe8f9d651"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="favizonerecommender.xml" hash="761e78aad6a8b28baba9ceb008755732"/></dir><dir name="template"><dir name="favizonerecommender"><file name="bottom.phtml" hash="0a4c338723bbdc8753f4536cc69a7284"/><file name="common.phtml" hash="d9f906e6eb81892361b5bd5c0e88b8ed"/><file name="custom.phtml" hash="b4c5c3492a1eca27c59510b642a1f837"/><file name="event.phtml" hash="8da220d74a265c722edfa43f02b21a4e"/><file name="footer.phtml" hash="f080c361ceff1aed3010e9aad9c07251"/><file name="index.phtml" hash="17e341f9b39c20030ce03bced05fd091"/><file name="preview.phtml" hash="c205c5d2ed8dc98877f6d8d0f6a356ac"/><file name="renderer.phtml" hash="b269e1e7f9e4dfd57e6806e581e887f0"/><file name="tracker.phtml" hash="d3e3ee4ebaf6042f37c1366811bbad7f"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Favizone_Recommender.csv" hash="9832f3a28ed8c6af16ddb29d23444131"/></dir><dir name="fr_FR"><file name="Favizone_Recommender.csv" hash="af5908d502a8d2356e86f6a1729a7309"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>