Atol_Productfeedgenerator - Version 1.0.2

Version Notes

added a tip to remove list markers

Download this release

Release Info

Developer Atol C
Extension Atol_Productfeedgenerator
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/local/Atol/Productfeedgenerator/Block/Adminhtml/Productflow/Edit.php CHANGED
@@ -14,9 +14,7 @@ class Atol_Productfeedgenerator_Block_Adminhtml_Productflow_Edit extends Mage_Ad
14
  $this->operators = array(
15
  "multiselect" => array('one' => $this->__('at least one of them operator'), 'all' => $this->__('all of them operator')),
16
  "select" => array('eq' => $this->__('equal operator'), 'neq' => $this->__('not equal operator'), 'or' => $this->__('or operator')),
17
- "boolean" => array('eq' => $this->__('equal operator'), 'neq' => $this->__('not equal operator')),
18
- "text" => array('eq' => $this->__('equal operator'), 'neq' => $this->__('not equal operator'), 'in' => $this->__('in operator'))
19
-
20
  );
21
  }
22
 
14
  $this->operators = array(
15
  "multiselect" => array('one' => $this->__('at least one of them operator'), 'all' => $this->__('all of them operator')),
16
  "select" => array('eq' => $this->__('equal operator'), 'neq' => $this->__('not equal operator'), 'or' => $this->__('or operator')),
17
+ "boolean" => array('eq' => $this->__('equal operator'), 'neq' => $this->__('not equal operator'))
 
 
18
  );
19
  }
20
 
app/code/local/Atol/Productfeedgenerator/Block/Frontdisplay.php CHANGED
@@ -9,9 +9,13 @@ class Atol_Productfeedgenerator_Block_Frontdisplay
9
  $columns = self::getData('columns');
10
 
11
  $template = 'catalog/product/list.phtml';
12
- /* Pour ne pas avoir le bug des puces apparantes dans la liste de produits, ajouter le code suivant dans Page/Design/Page Layout/Layout Update XML
13
- * <reference name="content"><remove name="cms.wrapper" /><block type="core/template" name="home-content"
14
- * template="test.phtml" /><block type="cms/page" name="cms_page"/></reference>
 
 
 
 
15
  */
16
 
17
  $this->setColumnCount($columns);
9
  $columns = self::getData('columns');
10
 
11
  $template = 'catalog/product/list.phtml';
12
+ /*
13
+ To avoid displaying the list marker on product list widget, add the following code to CMS_page/Design/Page Layout/Layout Update XML
14
+ Pour ne pas avoir le bug des puces apparantes dans la liste de produits, ajouter le code suivant dans Page/Design/Page Layout/Layout Update XML
15
+ <reference name="content">
16
+ <remove name="cms.wrapper" />
17
+ <block type="cms/page" name="cms_page"/>
18
+ </reference>
19
  */
20
 
21
  $this->setColumnCount($columns);
app/code/local/Atol/Productfeedgenerator/Block/Productflow/Rss.php CHANGED
@@ -1,107 +1,107 @@
1
- <?php
2
- /**
3
- * @category Atol
4
- * @package Atol_Productfeedgenerator
5
- * @copyright Copyright (c) 2013 Atol C&D (http://www.atolcd.com)
6
- */
7
-
8
- class Atol_Productfeedgenerator_Block_Productflow_Rss extends Mage_Rss_Block_Catalog_New
9
- {
10
- protected function _construct()
11
- {
12
- /*
13
- * setting cache to save the rss for 10 minutes
14
- */
15
- $this->setCacheKey('rss_catalog_new_'.$this->_getStoreId());
16
- $this->setCacheLifetime(600);
17
- }
18
-
19
- protected function _toHtml()
20
- {
21
- $productFlow = Mage::registry('product_flow');
22
- if($productFlow) {
23
- $rssObj = Mage::getModel('rss/rss');
24
- $data = array('title' => Mage::helper('productfeedgenerator')->__('Products list from %s',$productFlow->getTitle()),
25
- 'description' => $productFlow->getNote(),
26
- 'link' => Mage::getUrl('productfeedgenerator/catalog/products'),
27
- 'charset' => 'UTF-8',
28
- 'language' => Mage::getStoreConfig('general/locale/code')
29
- );
30
- $rssObj->_addHeader($data);
31
-
32
- $products = ($productFlow) ? Mage::helper('productfeedgenerator')->getProductCollectionFromJson($productFlow->getData('json_data')) : null;
33
-
34
- $product = Mage::getModel('catalog/product');
35
-
36
- Mage::getSingleton('core/resource_iterator')->walk(
37
- $products->getSelect(),
38
- array(array($this, 'addNewItemXmlCallback')),
39
- array('rssObj'=> $rssObj, 'product'=> $product)
40
- );
41
-
42
- return $rssObj->createRssXml();
43
- } else {
44
- return '';
45
- }
46
- }
47
-
48
- /**
49
- * Preparing data and adding to rss object
50
- *
51
- * @param array $args
52
- */
53
- public function addNewItemXmlCallback($args)
54
- {
55
- $_coreHelper = Mage::helper('core');
56
- $_taxHelper = Mage::helper('tax');
57
-
58
- $product = $args['product'];
59
- $product->setData($args['row']);
60
-
61
- $_price = $_taxHelper->getPrice($product, $product->getPrice());
62
- $_finalPrice = $_taxHelper->getPrice($product, $product->getData('product_final_price'));
63
-
64
- $product->setAllowedInRss(true);
65
- $product->setAllowedPriceInRss(false);
66
- Mage::dispatchEvent('rss_catalog_new_xml_callback', $args);
67
-
68
- if (!$product->getAllowedInRss()) {
69
- //Skip adding product to RSS
70
- return;
71
- }
72
- $url = Mage::getUrl('catalog/product/view',array("id" => $product->getId()));
73
- $allowedPriceInRss = $product->getAllowedPriceInRss();
74
-
75
-
76
- $description =
77
- '<table>'.
78
- '<tr>'.
79
- '<td>'.
80
- '<a href="'.$url.'">'.
81
- '<img src="'. $this->helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75).'" border="0" align="left" height="75" width="75">' .
82
- '</a>'.
83
- '</td>'.
84
- '<td style="text-decoration:none;">'
85
- . $product->getDescription() . '<br /><br />'
86
- . $this->__('Price : ') . $_coreHelper->currency($_price,true,false) . '<br />'
87
- . $this->__('Final price : ') . $_coreHelper->currency($_finalPrice,true,false) ;
88
-
89
-
90
- if ($allowedPriceInRss) {
91
- $description .= $this->getPriceHtml($product,true);
92
- }
93
-
94
- $description .=
95
- '</td>'.
96
- '</tr>'.
97
- '</table>';
98
-
99
- $rssObj = $args['rssObj'];
100
- $data = array(
101
- 'title' => $product->getName(),
102
- 'link' => $url,
103
- 'description' => $description,
104
- );
105
- $rssObj->_addEntry($data);
106
- }
107
  }
1
+ <?php
2
+ /**
3
+ * @category Atol
4
+ * @package Atol_Productfeedgenerator
5
+ * @copyright Copyright (c) 2013 Atol C&D (http://www.atolcd.com)
6
+ */
7
+
8
+ class Atol_Productfeedgenerator_Block_Productflow_Rss extends Mage_Rss_Block_Catalog_New
9
+ {
10
+ protected function _construct()
11
+ {
12
+ /*
13
+ * setting cache to save the rss for 10 minutes
14
+ */
15
+ $this->setCacheKey('rss_catalog_new_'.$this->_getStoreId());
16
+ $this->setCacheLifetime(600);
17
+ }
18
+
19
+ protected function _toHtml()
20
+ {
21
+ $productFlow = Mage::registry('product_flow');
22
+ if($productFlow) {
23
+ $rssObj = Mage::getModel('rss/rss');
24
+ $data = array('title' => Mage::helper('productfeedgenerator')->__('Products list from %s',$productFlow->getTitle()),
25
+ 'description' => $productFlow->getNote(),
26
+ 'link' => Mage::getUrl('productfeedgenerator/catalog/products'),
27
+ 'charset' => 'UTF-8',
28
+ 'language' => Mage::getStoreConfig('general/locale/code')
29
+ );
30
+ $rssObj->_addHeader($data);
31
+
32
+ $products = ($productFlow) ? Mage::helper('productfeedgenerator')->getProductCollectionFromJson($productFlow->getData('json_data')) : null;
33
+
34
+ $product = Mage::getModel('catalog/product');
35
+
36
+ Mage::getSingleton('core/resource_iterator')->walk(
37
+ $products->getSelect(),
38
+ array(array($this, 'addNewItemXmlCallback')),
39
+ array('rssObj'=> $rssObj, 'product'=> $product)
40
+ );
41
+
42
+ return $rssObj->createRssXml();
43
+ } else {
44
+ return '';
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Preparing data and adding to rss object
50
+ *
51
+ * @param array $args
52
+ */
53
+ public function addNewItemXmlCallback($args)
54
+ {
55
+ $_coreHelper = Mage::helper('core');
56
+ $_taxHelper = Mage::helper('tax');
57
+
58
+ $product = $args['product'];
59
+ $product->setData($args['row']);
60
+
61
+ $_price = $_taxHelper->getPrice($product, $product->getPrice());
62
+ $_finalPrice = $_taxHelper->getPrice($product, $product->getData('product_final_price'));
63
+
64
+ $product->setAllowedInRss(true);
65
+ $product->setAllowedPriceInRss(false);
66
+ Mage::dispatchEvent('rss_catalog_new_xml_callback', $args);
67
+
68
+ if (!$product->getAllowedInRss()) {
69
+ //Skip adding product to RSS
70
+ return;
71
+ }
72
+ $url = Mage::getUrl('catalog/product/view',array("id" => $product->getId()));
73
+ $allowedPriceInRss = $product->getAllowedPriceInRss();
74
+
75
+
76
+ $description =
77
+ '<table>'.
78
+ '<tr>'.
79
+ '<td>'.
80
+ '<a href="'.$url.'">'.
81
+ '<img src="'. $this->helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75).'" border="0" align="left" height="75" width="75">' .
82
+ '</a>'.
83
+ '</td>'.
84
+ '<td style="text-decoration:none;">'
85
+ . $product->getDescription() . '<br /><br />'
86
+ . $this->__('Price : ') . $_coreHelper->currency($_price,true,false) . '<br />'
87
+ . $this->__('Final price : ') . $_coreHelper->currency($_finalPrice,true,false) ;
88
+
89
+
90
+ if ($allowedPriceInRss) {
91
+ $description .= $this->getPriceHtml($product,true);
92
+ }
93
+
94
+ $description .=
95
+ '</td>'.
96
+ '</tr>'.
97
+ '</table>';
98
+
99
+ $rssObj = $args['rssObj'];
100
+ $data = array(
101
+ 'title' => $product->getName(),
102
+ 'link' => $url,
103
+ 'description' => $description,
104
+ );
105
+ $rssObj->_addEntry($data);
106
+ }
107
  }
app/code/local/Atol/Productfeedgenerator/controllers/Adminhtml/ProductflowController.php CHANGED
@@ -14,13 +14,16 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
14
 
15
  return $this;
16
  }
17
-
18
- public function indexAction() {
 
 
 
19
  $this->_initAction()
20
  ->renderLayout();
21
  }
22
-
23
- public function editAction() {
24
  $id = $this->getRequest()->getParam('id', null);
25
  $model = Mage::getModel('productfeedgenerator/productflow');
26
  if ($id) {
@@ -31,16 +34,16 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
31
  }
32
  }
33
  Mage::register('productflow_data', $model);
34
-
35
  $this->loadLayout();
36
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
37
  $this->renderLayout();
38
  }
39
-
40
  public function newAction() {
41
  $this->_forward('edit');
42
  }
43
-
44
  public function saveAction() {
45
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
46
  $request = $this->getRequest();
@@ -48,29 +51,29 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
48
  $name = Mage::helper('core')->escapeHtml($request->getPost('name'));
49
  $comment = Mage::helper('core')->escapeHtml($request->getPost('comment'));
50
  $data = Mage::helper('core')->jsonDecode($request->getPost('data'));
51
-
52
-
53
- if($name && $data && isset($data['attributes']) && isset($data['categories']) && isset($data['filters']) && isset($data['others'])) {
54
- try {
55
- $now = date('Y-M-d H:i:s');
56
  $productFlow = Mage::getModel('productfeedgenerator/productflow');
57
  if($id) {
58
  $productFlow = $productFlow->load($id);
59
  } else {
60
  $productFlow->setData('created_at', $now);
61
- }
62
  $productFlow->setData('title', $name);
63
  $productFlow->setData('note', $comment);
64
  $productFlow->setData('json_data', $request->getPost('data'));
65
  $productFlow->setData('updated_at', $now);
66
-
67
- $productFlow->save();
68
-
69
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productfeedgenerator')->__('The product flow was successfully updated'));
70
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("success" => Mage::helper('productfeedgenerator')->__('The product flow was successfully updated'))));
71
- } catch(Exception $e) {
72
- return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("error" => $e->getMessage())));
73
- }
74
  } else {
75
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("error" => Mage::helper('productfeedgenerator')->__('Invalid data'))));
76
  }
@@ -78,20 +81,20 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
78
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
79
  }
80
  }
81
-
82
  public function deleteAction() {
83
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
84
  $id = $this->getRequest()->getPost('id');
85
  if( $id > 0 ) {
86
  try {
87
  $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($id);
88
-
89
  $now = date('Y-M-d H:i:s');
90
  $productFlow->setData('deleted_at', $now);
91
  $productFlow->setData('updated_at', $now);
92
-
93
  $productFlow->save();
94
-
95
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productfeedgenerator')->__('The product flow was successfully deleted'));
96
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("success" => Mage::helper('productfeedgenerator')->__('The product flow was successfully deleted'))));
97
  } catch(Exception $e) {
@@ -104,13 +107,13 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
104
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
105
  }
106
  }
107
-
108
  public function testAction() {
109
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
110
  $request = $this->getRequest();
111
  $collection = Mage::helper('productfeedgenerator')->getProductCollectionFromJson($request->getPost('data'));
112
-
113
- if($collection) {
114
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('count' => $collection->count())));
115
  } else {
116
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => Mage::helper('productfeedgenerator')->__('Invalid data'))));
@@ -119,7 +122,7 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
119
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
120
  }
121
  }
122
-
123
  /**
124
  * Initialize requested category and put it into registry.
125
  * Root category can be returned, if inappropriate store/category is specified
@@ -164,12 +167,12 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
164
  Mage::getSingleton('cms/wysiwyg_config')->setStoreId($this->getRequest()->getParam('store'));
165
  return $category;
166
  }
167
-
168
  /**
169
  * Get tree node (Ajax version)
170
  */
171
  public function categoriesJsonAction()
172
- {
173
  $productFlowId = (int) $this->getRequest()->getPost('productflow',false);
174
  if($productFlowId) {
175
  $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($productFlowId);
14
 
15
  return $this;
16
  }
17
+
18
+ public function indexAction() {
19
+ if(Mage::getStoreConfig('rss/active') != 1) {
20
+ Mage::getSingleton('adminhtml/session')->addWarning('Please enable rss in System/Configuration/Catalog/RSS Feeds');
21
+ }
22
  $this->_initAction()
23
  ->renderLayout();
24
  }
25
+
26
+ public function editAction() {
27
  $id = $this->getRequest()->getParam('id', null);
28
  $model = Mage::getModel('productfeedgenerator/productflow');
29
  if ($id) {
34
  }
35
  }
36
  Mage::register('productflow_data', $model);
37
+
38
  $this->loadLayout();
39
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
40
  $this->renderLayout();
41
  }
42
+
43
  public function newAction() {
44
  $this->_forward('edit');
45
  }
46
+
47
  public function saveAction() {
48
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
49
  $request = $this->getRequest();
51
  $name = Mage::helper('core')->escapeHtml($request->getPost('name'));
52
  $comment = Mage::helper('core')->escapeHtml($request->getPost('comment'));
53
  $data = Mage::helper('core')->jsonDecode($request->getPost('data'));
54
+
55
+
56
+ if($name && $data && isset($data['attributes']) && isset($data['categories']) && isset($data['filters']) && isset($data['others'])) {
57
+ try {
58
+ $now = date('Y-M-d H:i:s');
59
  $productFlow = Mage::getModel('productfeedgenerator/productflow');
60
  if($id) {
61
  $productFlow = $productFlow->load($id);
62
  } else {
63
  $productFlow->setData('created_at', $now);
64
+ }
65
  $productFlow->setData('title', $name);
66
  $productFlow->setData('note', $comment);
67
  $productFlow->setData('json_data', $request->getPost('data'));
68
  $productFlow->setData('updated_at', $now);
69
+
70
+ $productFlow->save();
71
+
72
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productfeedgenerator')->__('The product flow was successfully updated'));
73
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("success" => Mage::helper('productfeedgenerator')->__('The product flow was successfully updated'))));
74
+ } catch(Exception $e) {
75
+ return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("error" => $e->getMessage())));
76
+ }
77
  } else {
78
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("error" => Mage::helper('productfeedgenerator')->__('Invalid data'))));
79
  }
81
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
82
  }
83
  }
84
+
85
  public function deleteAction() {
86
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
87
  $id = $this->getRequest()->getPost('id');
88
  if( $id > 0 ) {
89
  try {
90
  $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($id);
91
+
92
  $now = date('Y-M-d H:i:s');
93
  $productFlow->setData('deleted_at', $now);
94
  $productFlow->setData('updated_at', $now);
95
+
96
  $productFlow->save();
97
+
98
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productfeedgenerator')->__('The product flow was successfully deleted'));
99
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("success" => Mage::helper('productfeedgenerator')->__('The product flow was successfully deleted'))));
100
  } catch(Exception $e) {
107
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
108
  }
109
  }
110
+
111
  public function testAction() {
112
  if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
113
  $request = $this->getRequest();
114
  $collection = Mage::helper('productfeedgenerator')->getProductCollectionFromJson($request->getPost('data'));
115
+
116
+ if($collection) {
117
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('count' => $collection->count())));
118
  } else {
119
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => Mage::helper('productfeedgenerator')->__('Invalid data'))));
122
  return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
123
  }
124
  }
125
+
126
  /**
127
  * Initialize requested category and put it into registry.
128
  * Root category can be returned, if inappropriate store/category is specified
167
  Mage::getSingleton('cms/wysiwyg_config')->setStoreId($this->getRequest()->getParam('store'));
168
  return $category;
169
  }
170
+
171
  /**
172
  * Get tree node (Ajax version)
173
  */
174
  public function categoriesJsonAction()
175
+ {
176
  $productFlowId = (int) $this->getRequest()->getPost('productflow',false);
177
  if($productFlowId) {
178
  $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($productFlowId);
app/code/local/Atol/Productfeedgenerator/controllers/ProductflowController.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
- /**
3
- * @category Atol
4
- * @package Atol_Productfeedgenerator
5
- * @copyright Copyright (c) 2013 Atol C&D (http://www.atolcd.com)
6
- */
7
-
8
- class Atol_Productfeedgenerator_ProductflowController extends Mage_Core_Controller_Front_Action {
9
-
10
- protected function isFeedEnable()
11
- {
12
- return Mage::getStoreConfig('rss/productfeedgenerator/active');
13
- }
14
-
15
- protected function checkFeedEnable()
16
- {
17
- if ($this->isFeedEnable()) {
18
- $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
19
- return true;
20
- } else {
21
- return $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
22
- }
23
- }
24
-
25
- public function rssAction() {
26
- $productFlowId = (int) $this->getRequest()->getParam('id',false);
27
- if($productFlowId) {
28
- $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($productFlowId);
29
-
30
- if($productFlow && $productFlow->getData('flow_id') && !$productFlow->getData('deleted_at')) {
31
- Mage::register('product_flow', $productFlow);
32
- $this->checkFeedEnable();
33
- //$this->checkSecurity();
34
- $this->loadLayout(false);
35
- $this->renderLayout();
36
- } else {
37
- return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
38
- }
39
- } else {
40
- return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
41
- }
42
- }
43
- }
1
+ <?php
2
+ /**
3
+ * @category Atol
4
+ * @package Atol_Productfeedgenerator
5
+ * @copyright Copyright (c) 2013 Atol C&D (http://www.atolcd.com)
6
+ */
7
+
8
+ class Atol_Productfeedgenerator_ProductflowController extends Mage_Core_Controller_Front_Action {
9
+
10
+ protected function isFeedEnable()
11
+ {
12
+ return Mage::getStoreConfig('rss/productfeedgenerator/active');
13
+ }
14
+
15
+ protected function checkFeedEnable()
16
+ {
17
+ if ($this->isFeedEnable()) {
18
+ $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
19
+ return true;
20
+ } else {
21
+ return $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
22
+ }
23
+ }
24
+
25
+ public function rssAction() {
26
+ $productFlowId = (int) $this->getRequest()->getParam('id',false);
27
+ if($productFlowId) {
28
+ $productFlow = Mage::getModel('productfeedgenerator/productflow')->load($productFlowId);
29
+
30
+ if($productFlow && $productFlow->getData('flow_id') && !$productFlow->getData('deleted_at')) {
31
+ Mage::register('product_flow', $productFlow);
32
+ $this->checkFeedEnable();
33
+ //$this->checkSecurity();
34
+ $this->loadLayout(false);
35
+ $this->renderLayout();
36
+ } else {
37
+ return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
38
+ }
39
+ } else {
40
+ return $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
41
+ }
42
+ }
43
+ }
app/design/adminhtml/default/default/template/productflow/edit.phtml CHANGED
@@ -71,7 +71,7 @@
71
  <fieldset>
72
  <?php foreach($attributes as $attribute) : ?>
73
  <?php $frontendInput = $attribute->getData('frontend_input'); ?>
74
- <?php if(in_array($attribute->getData('frontend_input'), array('select', 'multiselect', 'boolean','text'))) : ?>
75
  <div class="attribute_item <?php echo $frontendInput; ?> <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? '' : 'style="display:none;"'); ?> data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" data-attribute-type="<?php echo $frontendInput; ?>">
76
  <label for="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']"><?php echo $attribute->getData('frontend_label'); ?></label>
77
  <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']" class="operator">
@@ -101,8 +101,6 @@
101
  <option value="true" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(true, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('yes'); ?></option>
102
  <option value="false" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(false, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('no'); ?></option>
103
  </select>
104
- <?php elseif($frontendInput === 'text') : ?>
105
- <input type="text" id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['value']" name="productflow['attributes']" class="value" style="width:50%" value="<?php echo $attributesList[$attribute->getData('attribute_id')]['values'][0] ?>"/>
106
  <?php endif; ?>
107
  <button class="btn_drop_attribute" data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" ><?php echo $this->__('Drop'); ?></button>
108
  </div>
@@ -113,7 +111,7 @@
113
  <label for="add_attribute_select"><?php echo $this->__('Add an attribute to filter'); ?></label>
114
  <select id="add_attribute_select">
115
  <?php foreach($attributes as $attribute) : ?>
116
- <option value="<?php echo $attribute->getData('attribute_id'); ?>" class="<?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" ><?php echo $attribute->getData('attribute_code'); ?></option>
117
  <?php endforeach; ?>
118
  </select>
119
  <button class="btn_add_attribute"><?php echo $this->__('Add'); ?></button>
@@ -194,8 +192,8 @@
194
  var attributeType = jQuery(this).attr('data-attribute-type');
195
  return {
196
  "id" : jQuery(this).attr('data-attribute-id'),
197
- "operator" : jQuery(this).children('select.operator').val(),
198
- "values" : jQuery(this).find('select.value option:selected, :text').map(function() {
199
  return (attributeType == 'boolean') ? (jQuery(this).val() == "true") : jQuery(this).val();
200
  }).get()
201
  };
@@ -267,26 +265,6 @@
267
  }
268
  });
269
 
270
- /*jQuery('#btn_test, #btn_test span').live('click', function() {
271
- var flow = formToJson();
272
-
273
- jQuery.ajax({
274
- type : "POST",
275
- url : "<?php echo Mage::getUrl('adminhtml/productflow/test'); ?>",
276
- data : {
277
- "data" : Object.toJSON(flow),
278
- "form_key" : FORM_KEY
279
- },
280
- dataType : "json",
281
- success : function(data) {
282
- jQuery('#messages .messages').html('<li class="info-msg">' + data.count + ' <?php echo $this->__('products given by the current query') ?></li>');
283
- },
284
- error : function(data) {
285
- jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
286
- }
287
- });
288
- });*/
289
-
290
  jQuery('#btn_save, #btn_save span').live('click', function() {
291
  var flow = formToJson();
292
 
71
  <fieldset>
72
  <?php foreach($attributes as $attribute) : ?>
73
  <?php $frontendInput = $attribute->getData('frontend_input'); ?>
74
+ <?php if(in_array($attribute->getData('frontend_input'), array('select', 'multiselect', 'boolean'))) : ?>
75
  <div class="attribute_item <?php echo $frontendInput; ?> <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? '' : 'style="display:none;"'); ?> data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" data-attribute-type="<?php echo $frontendInput; ?>">
76
  <label for="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']"><?php echo $attribute->getData('frontend_label'); ?></label>
77
  <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']" class="operator">
101
  <option value="true" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(true, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('yes'); ?></option>
102
  <option value="false" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(false, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('no'); ?></option>
103
  </select>
 
 
104
  <?php endif; ?>
105
  <button class="btn_drop_attribute" data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" ><?php echo $this->__('Drop'); ?></button>
106
  </div>
111
  <label for="add_attribute_select"><?php echo $this->__('Add an attribute to filter'); ?></label>
112
  <select id="add_attribute_select">
113
  <?php foreach($attributes as $attribute) : ?>
114
+ <option value="<?php echo $attribute->getData('attribute_id'); ?>" class="<?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" ><?php echo $attribute->getData('frontend_label'); ?></option>
115
  <?php endforeach; ?>
116
  </select>
117
  <button class="btn_add_attribute"><?php echo $this->__('Add'); ?></button>
192
  var attributeType = jQuery(this).attr('data-attribute-type');
193
  return {
194
  "id" : jQuery(this).attr('data-attribute-id'),
195
+ "operator" : jQuery(this).children('select.operator').val(),
196
+ "values" : jQuery(this).find('select.value option:selected').map(function() {
197
  return (attributeType == 'boolean') ? (jQuery(this).val() == "true") : jQuery(this).val();
198
  }).get()
199
  };
265
  }
266
  });
267
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  jQuery('#btn_save, #btn_save span').live('click', function() {
269
  var flow = formToJson();
270
 
app/design/frontend/base/default/layout/productfeedgenerator.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <layout version="0.1.0">
29
+ <default>
30
+ <block type="rss/list" name="head_rss" ifconfig="rss/config/active" />
31
+ </default>
32
+ <productfeedgenerator_index_index>
33
+ <!-- Set title -->
34
+ <reference name="head">
35
+ <action method="setTitle">
36
+ <title>PFG Productlist</title>
37
+ </action>
38
+ </reference>
39
+ <reference name="root">
40
+ <action method="setTemplate">
41
+ <template>page/1column.phtml</template>
42
+ </action>
43
+ </reference>
44
+ <reference name="content">
45
+ <!-- Add product list to content -->
46
+ <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
47
+ <!-- Add toolbar to product list -->
48
+ <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
49
+ <!-- Add pager to toolbar -->
50
+ <block type="page/html_pager" name="product_list_toolbar_pager"/>
51
+ </block>
52
+
53
+ <!-- Specify toolbar block name -->
54
+ <action method="setToolbarBlockName">
55
+ <name>product_list_toolbar</name>
56
+ </action>
57
+
58
+ <!-- Use custom product collection -->
59
+ <action method="setCollection">
60
+ <value helper="productfeedgenerator/getProductCollectionFromId"/>
61
+ </action>
62
+
63
+ <!-- Set the default sort by order -->
64
+ <action method="setSortBy">
65
+ <value>price</value>
66
+ </action>
67
+
68
+ <!-- Set default direction to ascending -->
69
+ <action method="setDefaultDirection">
70
+ <value>asc</value>
71
+ </action>
72
+
73
+ <action method="setColumnCount">
74
+ <coulumn>5</coulumn>
75
+ </action>
76
+ </block>
77
+ </reference>
78
+ </productfeedgenerator_index_index>
79
+
80
+ <productfeedgenerator_productflow_rss>
81
+ <block type="productfeedgenerator/productflow_rss" output="toHtml" name="productfeedgenerator.productflow.rss">
82
+ <action method="addPriceBlockType"><type>msrp_rss</type><block>catalog/product_price</block><template>catalog/product/price_msrp_rss.phtml</template></action>
83
+ </block>
84
+ </productfeedgenerator_productflow_rss>
85
+ </layout>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Atol_Productfeedgenerator</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -43,11 +43,11 @@ L'utilisation du syst&#xE8;me de widget vous permet d'ajouter facilement votre f
43
  Pour en savoir plus sur notre soci&#xE9;t&#xE9;, n'h&#xE9;sitez pas &#xE0; consulter &lt;a href="http://www.atolcd.com"&gt;www.atolcd.com&lt;/a&gt;&#xD;
44
  &#xD;
45
  </description>
46
- <notes>first release</notes>
47
  <authors><author><name>AtolCD</name><user>AtolCD</user><email>magento@atolcd.com</email></author><author><name>Antoine Trapet</name><user>atr</user><email>atr@atolcd.com</email></author><author><name>Aur&#xE9;lien Pon&#xE7;on</name><user>apo</user><email>apo@atolcd.com</email></author><author><name>Antoine Chevaldonn&#xE9;</name><user>ach</user><email>ach@atolcd.com</email></author></authors>
48
  <date>2016-03-14</date>
49
- <time>08:29:17</time>
50
- <contents><target name="magelocal"><dir name="Atol"><dir name="Productfeedgenerator"><dir name="Block"><dir name="Adminhtml"><dir name="Productflow"><dir name="Edit"><file name="Categories.php" hash="1dab18a40a30827f9b1ab3001f04d13a"/></dir><file name="Edit.php" hash="000b7dc9137a5e92e7b503ff13713006"/><file name="Grid.php" hash="cc7def146fe698de4249b252eeb3c63e"/><dir name="Renderer"><file name="Linkscolumn.php" hash="d831799203369be2586698559aabf161"/></dir></dir><file name="Productflow.php" hash="827fd19128b6f6b03febbbb5387be50f"/></dir><file name="Frontdisplay.php" hash="ab7997b46c7391e0a0e5b24c6070beb8"/><dir name="Productflow"><file name="Rss.php" hash="a4caa2e3ac07511634be1bc5ee0267da"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7795364cf1483083b9594d95c34bc660"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productflow"><file name="Collection.php" hash="0d8056368d6c4599a00e3b3dd4f69722"/></dir><file name="Productflow.php" hash="e68259670802fa7f84571b19b0a030cb"/></dir><file name="Productflow.php" hash="aa0fb13c57acb92c3b3855dd6b115e1c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Orderbytype.php" hash="1a390fda30c5c9d1ca9f5a8c2bf1bb6f"/><file name="Productflowtype.php" hash="967ca8318947473e696612ceb8b9f2c6"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductflowController.php" hash="787a5ec0239348658787be719de4574b"/></dir><file name="IndexController.php" hash="39e2e2cf9354c35b32e5a738840b6d87"/><file name="ProductflowController.php" hash="5125ac0325a8f2fc62deb8c89d097111"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c8d2bb91591aae5a80941ef44e19dcc9"/><file name="config.xml" hash="8c2136b71a9c5e306fbf815455a5b443"/><file name="system.xml" hash="511c6ea6cbd55527dfc278b83a44eccb"/><file name="widget.xml" hash="b29e594a7912a2244c1d6fd01912d1c0"/></dir><dir name="sql"><dir name="productfeedgenerator_setup"><file name="mysql4-install-0.1.0.php" hash="178841fb1c45d4fd7e70abc5054ad0ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><file name="layout.productfeedgenerator.xml" hash=""/></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="2819062aab01040c428185362050432e"/></dir><dir name="template"><dir name="productflow"><dir><dir name="edit"><file name="categories.phtml" hash="e88f45634328726e01768916cfe407d5"/></dir></dir><file name="edit.phtml" hash="3dfa6696bf128cd285d5a0b85765b68d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Atol_Productfeedgenerator.xml" hash="21350607b70c31828328ba4e41f8bd04"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Atol_Productfeedgenerator.csv" hash="9e1bfbad6d620a09811cdbd9c1a5abfb"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.4.4.min.js" hash="eef9a6a171184899b08ebd61f1a03425"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="productfeedgenerator"><file name="styles.css" hash="8a550d9db1fcf37915a96e67919de9da"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Atol_Productfeedgenerator</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
43
  Pour en savoir plus sur notre soci&#xE9;t&#xE9;, n'h&#xE9;sitez pas &#xE0; consulter &lt;a href="http://www.atolcd.com"&gt;www.atolcd.com&lt;/a&gt;&#xD;
44
  &#xD;
45
  </description>
46
+ <notes>added a tip to remove list markers</notes>
47
  <authors><author><name>AtolCD</name><user>AtolCD</user><email>magento@atolcd.com</email></author><author><name>Antoine Trapet</name><user>atr</user><email>atr@atolcd.com</email></author><author><name>Aur&#xE9;lien Pon&#xE7;on</name><user>apo</user><email>apo@atolcd.com</email></author><author><name>Antoine Chevaldonn&#xE9;</name><user>ach</user><email>ach@atolcd.com</email></author></authors>
48
  <date>2016-03-14</date>
49
+ <time>13:08:25</time>
50
+ <contents><target name="magelocal"><dir name="Atol"><dir name="Productfeedgenerator"><dir name="Block"><dir name="Adminhtml"><dir name="Productflow"><dir name="Edit"><file name="Categories.php" hash="1dab18a40a30827f9b1ab3001f04d13a"/></dir><file name="Edit.php" hash="443b9996fc526536e092a79618bda545"/><file name="Grid.php" hash="cc7def146fe698de4249b252eeb3c63e"/><dir name="Renderer"><file name="Linkscolumn.php" hash="d831799203369be2586698559aabf161"/></dir></dir><file name="Productflow.php" hash="827fd19128b6f6b03febbbb5387be50f"/></dir><file name="Frontdisplay.php" hash="d81c6c6702612b86be759ba83a4348f0"/><dir name="Productflow"><file name="Rss.php" hash="c6bfb5c695f4b69af40f3b6f4a2c2020"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7795364cf1483083b9594d95c34bc660"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productflow"><file name="Collection.php" hash="0d8056368d6c4599a00e3b3dd4f69722"/></dir><file name="Productflow.php" hash="e68259670802fa7f84571b19b0a030cb"/></dir><file name="Productflow.php" hash="aa0fb13c57acb92c3b3855dd6b115e1c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Orderbytype.php" hash="1a390fda30c5c9d1ca9f5a8c2bf1bb6f"/><file name="Productflowtype.php" hash="967ca8318947473e696612ceb8b9f2c6"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductflowController.php" hash="6d313417ca90343355443bfdda645d70"/></dir><file name="IndexController.php" hash="39e2e2cf9354c35b32e5a738840b6d87"/><file name="ProductflowController.php" hash="a831dbd6d913689dabf8ff1204e406c6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c8d2bb91591aae5a80941ef44e19dcc9"/><file name="config.xml" hash="8c2136b71a9c5e306fbf815455a5b443"/><file name="system.xml" hash="511c6ea6cbd55527dfc278b83a44eccb"/><file name="widget.xml" hash="b29e594a7912a2244c1d6fd01912d1c0"/></dir><dir name="sql"><dir name="productfeedgenerator_setup"><file name="mysql4-install-0.1.0.php" hash="178841fb1c45d4fd7e70abc5054ad0ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="0f25d168848eb5ffc1e124544fd22b52"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="2819062aab01040c428185362050432e"/></dir><dir name="template"><dir name="productflow"><dir><dir name="edit"><file name="categories.phtml" hash="e88f45634328726e01768916cfe407d5"/></dir></dir><file name="edit.phtml" hash="da258eef7da6988bc828b67f0d6a8a56"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Atol_Productfeedgenerator.xml" hash="21350607b70c31828328ba4e41f8bd04"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Atol_Productfeedgenerator.csv" hash="9e1bfbad6d620a09811cdbd9c1a5abfb"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.4.4.min.js" hash="eef9a6a171184899b08ebd61f1a03425"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="productfeedgenerator"><file name="styles.css" hash="8a550d9db1fcf37915a96e67919de9da"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>