Version Notes
added support for magento table prefix
Download this release
Release Info
Developer | Aurélien Ponçon |
Extension | Atol_Productfeedgenerator |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- app/code/local/Atol/Productfeedgenerator/Helper/Data.php +43 -39
- app/code/local/Atol/Productfeedgenerator/controllers/Adminhtml/ProductflowController.php +29 -32
- app/code/local/Atol/Productfeedgenerator/controllers/ProductflowController.php +3 -3
- app/design/adminhtml/default/default/layout/productfeedgenerator.xml +25 -26
- package.xml +16 -16
app/code/local/Atol/Productfeedgenerator/Helper/Data.php
CHANGED
@@ -43,73 +43,77 @@ class Atol_Productfeedgenerator_Helper_Data extends Mage_Core_Helper_Abstract
|
|
43 |
),
|
44 |
'left'
|
45 |
)
|
46 |
-
;
|
|
|
|
|
|
|
|
|
47 |
$products->getSelect()
|
48 |
-
->join(
|
49 |
-
->where('
|
50 |
->group('e.entity_id');
|
51 |
-
|
52 |
-
|
53 |
if($filters) {
|
54 |
$todayDate = $product->getResource()->formatDate(time());
|
55 |
foreach($filters as $filter){
|
56 |
switch($filter) {
|
57 |
-
case 'discounted' :
|
58 |
$products->addPriceDataFieldFilter('%s < %s', array('special_price','price'));
|
59 |
$products->addAttributeToFilter('special_from_date', array('date'=>true, 'to'=> $todayDate))
|
60 |
->addAttributeToFilter(
|
61 |
array(
|
62 |
-
|
63 |
-
|
64 |
),
|
65 |
'',
|
66 |
'left'
|
67 |
);
|
68 |
break;
|
69 |
-
case 'new' :
|
70 |
$products->addAttributeToFilter('news_from_date', array('date'=>true, 'to'=> $todayDate))
|
71 |
->addAttributeToFilter(
|
72 |
array(
|
73 |
-
|
74 |
-
|
75 |
),
|
76 |
'',
|
77 |
'left'
|
78 |
)
|
79 |
->addAttributeToSort('news_from_date','desc');
|
80 |
break;
|
81 |
-
default :
|
82 |
break;
|
83 |
}
|
84 |
}
|
85 |
-
}
|
86 |
|
87 |
if($categoriesId) {
|
88 |
$cats = implode(',', $categoriesId);
|
89 |
$products->joinTable('catalog/category_product', 'product_id=entity_id', array('product_id' => 'product_id') , '{{table}}.category_id IN ( '. $cats .' )' );
|
90 |
}
|
91 |
-
|
92 |
foreach($attributes as $attribute) {
|
93 |
$attributeCode = $attribute['attribute_code'];
|
94 |
$expr = $attribute['expr'];
|
95 |
-
$products->addAttributeToFilter($attributeCode, $expr);
|
96 |
}
|
97 |
-
|
98 |
if($limit) {
|
99 |
$products->getSelect()->limit($limit, 0);
|
100 |
}
|
101 |
-
|
102 |
if($orders) {
|
103 |
foreach($orders as $orderby) {
|
104 |
if(isset($orderby['attribute']) && $orderby['attribute'] && isset($orderby['direction'])) {
|
105 |
$products->getSelect()->order($orderby['attribute'], $orderby['direction']);
|
106 |
}
|
107 |
}
|
108 |
-
}
|
109 |
-
|
110 |
return $products;
|
111 |
}
|
112 |
-
|
113 |
public function getProductCollectionFromJson($json) {
|
114 |
try {
|
115 |
$data = Mage::helper('core')->jsonDecode($json);
|
@@ -117,38 +121,38 @@ class Atol_Productfeedgenerator_Helper_Data extends Mage_Core_Helper_Abstract
|
|
117 |
Mage::logException($e);
|
118 |
return null;
|
119 |
}
|
120 |
-
|
121 |
if($data && isset($data['attributes']) && isset($data['categories']) && isset($data['filters']) && isset($data['others'])) {
|
122 |
$attributes = $data['attributes'];
|
123 |
$attributesQuery = Array();
|
124 |
foreach($attributes as $attribute) {
|
125 |
$attributeModel = Mage::getModel('eav/entity_attribute')->load($attribute['id']);
|
126 |
-
$attributeCode = $attributeModel->getData('attribute_code');
|
127 |
if($attributeCode && isset($attribute['operator']) && isset($attribute['values']) && count($attribute['values']) > 0) {
|
128 |
$expr = null;
|
129 |
switch($attribute['operator']) {
|
130 |
-
case 'or' :
|
131 |
-
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array('in' => $attribute['values']));
|
132 |
break;
|
133 |
case 'one' :
|
134 |
foreach($attribute['values'] as $value) {
|
135 |
$expr[] = array('finset' => $value);
|
136 |
}
|
137 |
-
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => $expr);
|
138 |
break;
|
139 |
-
case 'all' :
|
140 |
foreach($attribute['values'] as $value) {
|
141 |
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array('finset' => $value));
|
142 |
}
|
143 |
break;
|
144 |
-
case 'eq' :
|
145 |
-
case 'neq' :
|
146 |
-
default :
|
147 |
-
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array($attribute['operator'] => $attribute['values'][0]));
|
148 |
-
}
|
149 |
-
}
|
150 |
}
|
151 |
-
|
152 |
$filters = $data['filters'];
|
153 |
$filtersQuery = Array();
|
154 |
foreach($filters as $key => $value) {
|
@@ -156,7 +160,7 @@ class Atol_Productfeedgenerator_Helper_Data extends Mage_Core_Helper_Abstract
|
|
156 |
$filtersQuery[] = $key;
|
157 |
}
|
158 |
}
|
159 |
-
|
160 |
$categoriesId = $data['categories'];
|
161 |
$categoriesQuery = Array();
|
162 |
foreach($categoriesId as $categoryId) {
|
@@ -164,20 +168,20 @@ class Atol_Productfeedgenerator_Helper_Data extends Mage_Core_Helper_Abstract
|
|
164 |
$categoriesQuery[] = $categoryId;
|
165 |
}
|
166 |
}
|
167 |
-
|
168 |
$orderQueryTmp = $data['orderBy'];
|
169 |
$orderQuery = Array();
|
170 |
-
foreach($orderQueryTmp as $orderBy) {
|
171 |
if(isset($orderBy['attribute']) && isset($orderBy['direction']) && ($orderBy['direction'] == 'asc' || $orderBy['direction'] == 'desc')) {
|
172 |
$orderQuery[] = $orderBy;
|
173 |
}
|
174 |
}
|
175 |
-
|
176 |
$limitQuery = null;
|
177 |
if(isset($data['others']['limit'])) {
|
178 |
$limitQuery = $data['others']['limit'];
|
179 |
-
}
|
180 |
-
|
181 |
return $this->getProductCollection($attributesQuery, $filtersQuery, $categoriesQuery, $orderQuery, $limitQuery);
|
182 |
} else {
|
183 |
return null;
|
43 |
),
|
44 |
'left'
|
45 |
)
|
46 |
+
;
|
47 |
+
|
48 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_index_price');
|
49 |
+
Mage::log($tableName);
|
50 |
+
|
51 |
$products->getSelect()
|
52 |
+
->join($tableName,'e.entity_id = '.$tableName.'.entity_id', array('product_price' => 'price', 'product_final_price' => 'final_price'))
|
53 |
+
->where($tableName.'.customer_group_id = 0')
|
54 |
->group('e.entity_id');
|
55 |
+
|
56 |
+
|
57 |
if($filters) {
|
58 |
$todayDate = $product->getResource()->formatDate(time());
|
59 |
foreach($filters as $filter){
|
60 |
switch($filter) {
|
61 |
+
case 'discounted' :
|
62 |
$products->addPriceDataFieldFilter('%s < %s', array('special_price','price'));
|
63 |
$products->addAttributeToFilter('special_from_date', array('date'=>true, 'to'=> $todayDate))
|
64 |
->addAttributeToFilter(
|
65 |
array(
|
66 |
+
array('attribute'=>'special_to_date', 'date'=>true, 'from'=>$todayDate),
|
67 |
+
array('attribute'=>'special_to_date', 'is' => new Zend_Db_Expr('null'))
|
68 |
),
|
69 |
'',
|
70 |
'left'
|
71 |
);
|
72 |
break;
|
73 |
+
case 'new' :
|
74 |
$products->addAttributeToFilter('news_from_date', array('date'=>true, 'to'=> $todayDate))
|
75 |
->addAttributeToFilter(
|
76 |
array(
|
77 |
+
array('attribute'=>'news_to_date', 'date'=>true, 'from'=>$todayDate),
|
78 |
+
array('attribute'=>'news_to_date', 'is' => new Zend_Db_Expr('null'))
|
79 |
),
|
80 |
'',
|
81 |
'left'
|
82 |
)
|
83 |
->addAttributeToSort('news_from_date','desc');
|
84 |
break;
|
85 |
+
default :
|
86 |
break;
|
87 |
}
|
88 |
}
|
89 |
+
}
|
90 |
|
91 |
if($categoriesId) {
|
92 |
$cats = implode(',', $categoriesId);
|
93 |
$products->joinTable('catalog/category_product', 'product_id=entity_id', array('product_id' => 'product_id') , '{{table}}.category_id IN ( '. $cats .' )' );
|
94 |
}
|
95 |
+
|
96 |
foreach($attributes as $attribute) {
|
97 |
$attributeCode = $attribute['attribute_code'];
|
98 |
$expr = $attribute['expr'];
|
99 |
+
$products->addAttributeToFilter($attributeCode, $expr);
|
100 |
}
|
101 |
+
|
102 |
if($limit) {
|
103 |
$products->getSelect()->limit($limit, 0);
|
104 |
}
|
105 |
+
|
106 |
if($orders) {
|
107 |
foreach($orders as $orderby) {
|
108 |
if(isset($orderby['attribute']) && $orderby['attribute'] && isset($orderby['direction'])) {
|
109 |
$products->getSelect()->order($orderby['attribute'], $orderby['direction']);
|
110 |
}
|
111 |
}
|
112 |
+
}
|
113 |
+
|
114 |
return $products;
|
115 |
}
|
116 |
+
|
117 |
public function getProductCollectionFromJson($json) {
|
118 |
try {
|
119 |
$data = Mage::helper('core')->jsonDecode($json);
|
121 |
Mage::logException($e);
|
122 |
return null;
|
123 |
}
|
124 |
+
|
125 |
if($data && isset($data['attributes']) && isset($data['categories']) && isset($data['filters']) && isset($data['others'])) {
|
126 |
$attributes = $data['attributes'];
|
127 |
$attributesQuery = Array();
|
128 |
foreach($attributes as $attribute) {
|
129 |
$attributeModel = Mage::getModel('eav/entity_attribute')->load($attribute['id']);
|
130 |
+
$attributeCode = $attributeModel->getData('attribute_code');
|
131 |
if($attributeCode && isset($attribute['operator']) && isset($attribute['values']) && count($attribute['values']) > 0) {
|
132 |
$expr = null;
|
133 |
switch($attribute['operator']) {
|
134 |
+
case 'or' :
|
135 |
+
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array('in' => $attribute['values']));
|
136 |
break;
|
137 |
case 'one' :
|
138 |
foreach($attribute['values'] as $value) {
|
139 |
$expr[] = array('finset' => $value);
|
140 |
}
|
141 |
+
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => $expr);
|
142 |
break;
|
143 |
+
case 'all' :
|
144 |
foreach($attribute['values'] as $value) {
|
145 |
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array('finset' => $value));
|
146 |
}
|
147 |
break;
|
148 |
+
case 'eq' :
|
149 |
+
case 'neq' :
|
150 |
+
default :
|
151 |
+
$attributesQuery[] = array("attribute_code" => $attributeCode, "expr" => array($attribute['operator'] => $attribute['values'][0]));
|
152 |
+
}
|
153 |
+
}
|
154 |
}
|
155 |
+
|
156 |
$filters = $data['filters'];
|
157 |
$filtersQuery = Array();
|
158 |
foreach($filters as $key => $value) {
|
160 |
$filtersQuery[] = $key;
|
161 |
}
|
162 |
}
|
163 |
+
|
164 |
$categoriesId = $data['categories'];
|
165 |
$categoriesQuery = Array();
|
166 |
foreach($categoriesId as $categoryId) {
|
168 |
$categoriesQuery[] = $categoryId;
|
169 |
}
|
170 |
}
|
171 |
+
|
172 |
$orderQueryTmp = $data['orderBy'];
|
173 |
$orderQuery = Array();
|
174 |
+
foreach($orderQueryTmp as $orderBy) {
|
175 |
if(isset($orderBy['attribute']) && isset($orderBy['direction']) && ($orderBy['direction'] == 'asc' || $orderBy['direction'] == 'desc')) {
|
176 |
$orderQuery[] = $orderBy;
|
177 |
}
|
178 |
}
|
179 |
+
|
180 |
$limitQuery = null;
|
181 |
if(isset($data['others']['limit'])) {
|
182 |
$limitQuery = $data['others']['limit'];
|
183 |
+
}
|
184 |
+
|
185 |
return $this->getProductCollection($attributesQuery, $filtersQuery, $categoriesQuery, $orderQuery, $limitQuery);
|
186 |
} else {
|
187 |
return null;
|
app/code/local/Atol/Productfeedgenerator/controllers/Adminhtml/ProductflowController.php
CHANGED
@@ -14,16 +14,13 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,16 +31,16 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,29 +48,29 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,20 +78,20 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,13 +104,13 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,7 +119,7 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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,12 +164,12 @@ class Atol_Productfeedgenerator_Adminhtml_ProductflowController extends Mage_Adm
|
|
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);
|
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 |
}
|
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 |
$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 |
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 |
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 |
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 |
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);
|
app/code/local/Atol/Productfeedgenerator/controllers/ProductflowController.php
CHANGED
@@ -6,7 +6,7 @@
|
|
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');
|
@@ -21,12 +21,12 @@ class Atol_Productfeedgenerator_ProductflowController extends Mage_Core_Controll
|
|
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();
|
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');
|
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();
|
app/design/adminhtml/default/default/layout/productfeedgenerator.xml
CHANGED
@@ -1,27 +1,26 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<layout version="0.1.0">
|
4 |
-
<adminhtml_productflow_index>
|
5 |
-
<reference name="head">
|
6 |
-
<action method="addCss"><stylesheet>css/productfeedgenerator/styles.css</stylesheet></action>
|
7 |
-
</reference>
|
8 |
-
<reference name="content">
|
9 |
-
<block type="productfeedgenerator/adminhtml_productflow" name="productflow" />
|
10 |
-
</reference>
|
11 |
-
</adminhtml_productflow_index>
|
12 |
-
|
13 |
-
<adminhtml_productflow_edit>
|
14 |
-
<reference name="head">
|
15 |
-
<action method="addJs"><script>colorbox/jquery.colorbox-min.js</script></action>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
</adminhtml_productflow_edit>
|
27 |
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
<adminhtml_productflow_index>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addCss"><stylesheet>css/productfeedgenerator/styles.css</stylesheet></action>
|
7 |
+
</reference>
|
8 |
+
<reference name="content">
|
9 |
+
<block type="productfeedgenerator/adminhtml_productflow" name="productflow" />
|
10 |
+
</reference>
|
11 |
+
</adminhtml_productflow_index>
|
12 |
+
|
13 |
+
<adminhtml_productflow_edit>
|
14 |
+
<reference name="head">
|
15 |
+
<action method="addJs"><script>colorbox/jquery.colorbox-min.js</script></action>
|
16 |
+
<action method="addCss"><stylesheet>css/productfeedgenerator/styles.css</stylesheet></action>
|
17 |
+
</reference>
|
18 |
+
<reference name="content">
|
19 |
+
<block type="productfeedgenerator/adminhtml_productflow_edit" name="productflow_edit" template="productflow/edit.phtml">
|
20 |
+
<block type="productfeedgenerator/adminhtml_productflow_edit_categories" name="productflow_categories" as="categories">
|
21 |
+
<action method="setTemplate"><template>productflow/edit/categories.phtml</template></action>
|
22 |
+
</block>
|
23 |
+
</block>
|
24 |
+
</reference>
|
25 |
+
</adminhtml_productflow_edit>
|
|
|
26 |
</layout>
|
package.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Atol_Productfeedgenerator</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license>GNU General Public License
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Create custom product collections and display them through a widget or create a rss feed.</summary>
|
@@ -16,10 +16,10 @@ Couldn't be easier!
|
|
16 |
<br /><br />
|
17 |
Managing your web store becomes a lot easier with this extension. Using the product feed generator with its integrated widget you can display a custom collection of products filtered attributes as :
|
18 |
<br /><br />
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
<br />
|
24 |
You can use several filter at once.
|
25 |
<br /><br />
|
@@ -31,10 +31,10 @@ De façon native Magento vous limite quant aux listes de produits à aff
|
|
31 |
<br /><br />
|
32 |
L'animation d'une boutique en ligne se trouve simplifiée grâce à cette extension. En utilisant le « Product Feed Generator » (production de flux de produits) + un widget intégré dans une page CMS (pour rappel le widget est une fonction native dans Magento) vous pouvez afficher, sous forme de grille ou de liste, des produits en fonction de critères précis qui peuvent être :
|
33 |
<br /><br />
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
<br />
|
39 |
L'imbrication de règles et de critères permet d'aboutir à la liste souhaitée.
|
40 |
<br /><br />
|
@@ -43,11 +43,11 @@ L'utilisation du système de widget vous permet d'ajouter facilement votre f
|
|
43 |
Pour en savoir plus sur notre société, n'hésitez pas à consulter <a href="http://www.atolcd.com">www.atolcd.com</a>
|
44 |

|
45 |
</description>
|
46 |
-
<notes>added
|
47 |
-
<authors><author><name>
|
48 |
-
<date>
|
49 |
-
<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="
|
51 |
<compatible/>
|
52 |
-
<dependencies><required><php><min>5.3.0
|
53 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Atol_Productfeedgenerator</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License </license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Create custom product collections and display them through a widget or create a rss feed.</summary>
|
16 |
<br /><br />
|
17 |
Managing your web store becomes a lot easier with this extension. Using the product feed generator with its integrated widget you can display a custom collection of products filtered attributes as :
|
18 |
<br /><br />
|
19 |
+
- categories<br />
|
20 |
+
- attributes<br />
|
21 |
+
- promotions<br />
|
22 |
+
- recently added<br />
|
23 |
<br />
|
24 |
You can use several filter at once.
|
25 |
<br /><br />
|
31 |
<br /><br />
|
32 |
L'animation d'une boutique en ligne se trouve simplifiée grâce à cette extension. En utilisant le « Product Feed Generator » (production de flux de produits) + un widget intégré dans une page CMS (pour rappel le widget est une fonction native dans Magento) vous pouvez afficher, sous forme de grille ou de liste, des produits en fonction de critères précis qui peuvent être :
|
33 |
<br /><br />
|
34 |
+
- des catégories d'appartenance,<br />
|
35 |
+
- des attributs,<br />
|
36 |
+
- des produits en promotion (oui/non),<br />
|
37 |
+
- des produits nouveaux (oui/non).<br />
|
38 |
<br />
|
39 |
L'imbrication de règles et de critères permet d'aboutir à la liste souhaitée.
|
40 |
<br /><br />
|
43 |
Pour en savoir plus sur notre société, n'hésitez pas à consulter <a href="http://www.atolcd.com">www.atolcd.com</a>
|
44 |

|
45 |
</description>
|
46 |
+
<notes>added support for magento table prefix</notes>
|
47 |
+
<authors><author><name>Aurélien Ponçon</name><user>apo</user><email>apo@atolcd.com</email></author><author><name>Antoine Chevaldonne</name><user>ach</user><email>ach@atolcd.com</email></author><author><name>Antoine Trapet</name><user>atr</user><email>atr@atolcd.com</email></author></authors>
|
48 |
+
<date>2017-03-15</date>
|
49 |
+
<time>14:30:02</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="743a84d0439b03b5758658a0fbd21ca8"/></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="adc9f7aab5e1693d1e17b9773f2d9752"/></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="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="5252c8b3e33b1e8fb1e238dd0cc675a6"/></dir><dir name="template"><dir name="productflow"><dir name="edit"><file name="categories.phtml" hash="e88f45634328726e01768916cfe407d5"/></dir><file name="edit.phtml" hash="da258eef7da6988bc828b67f0d6a8a56"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="0f25d168848eb5ffc1e124544fd22b52"/></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="mage"><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>
|