Skip to content

Commit 427e58f

Browse files
committed
Remove CMS synchronization until a better implementation can be made
1 parent 1c573ff commit 427e58f

File tree

5 files changed

+8
-140
lines changed

5 files changed

+8
-140
lines changed

code/Model/Categorypage.php

-53
This file was deleted.

code/Model/Paginator.php

-37
This file was deleted.

code/controllers/ApiController.php

+7-42
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,9 @@ public function categoryAction()
7474
{
7575
$this->authenticate();
7676

77-
$pageparam = $this->getIntParam('page');
77+
$page = $this->getIntParam('page');
7878
$limit = $this->getIntParam('limit');
7979

80-
$collection = new Varien_Data_Collection();
81-
$paginator = new Clerk_Clerk_Model_Paginator($collection);
82-
8380
$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
8481

8582
$categories = Mage::getModel('catalog/category')
@@ -89,7 +86,9 @@ public function categoryAction()
8986
->addAttributeToFilter('path', array('like' => "1/{$rootCategoryId}/%"))
9087
->setOrder('entity_id', Varien_Db_Select::SQL_ASC)
9188
->setPageSize($limit)
92-
->setCurPage($pageparam);
89+
->setCurPage($page + 1);
90+
91+
$items = [];
9392

9493
foreach ($categories as $category) {
9594
//Get children categories
@@ -102,48 +101,14 @@ public function categoryAction()
102101
'subcategories' => array_map('intval', $children),
103102
);
104103

105-
$item = new Varien_Object();
106-
$item->setData($data);
107-
108-
$collection->addItem($item);
109-
}
110-
111-
if (Mage::getStoreConfigFlag('clerk/general/sync_cms_pages')) {
112-
$pages = Mage::getModel('cms/page')
113-
->getCollection()
114-
->addFieldToFilter('is_active', '1')
115-
->addStoreFilter(Mage::app()->getStore()->getId());
116-
117-
foreach ($pages as $page) {
118-
$data = array(
119-
'id' => (int) $page->getId() + 10000,
120-
'name' => $page->getTitle(),
121-
'url' => Mage::helper('cms/page')->getPageUrl($page->getId()),
122-
'subcategories' => [],
123-
);
124-
125-
$item = new Varien_Object();
126-
$item->setData($data);
127-
128-
$collection->addItem($item);
129-
}
104+
$items[] = $data;
130105
}
131106

132-
$collection->setPageSize($limit);
133-
$collection->setCurPage($pageparam + 1);
134-
135-
$this->getResponse()->setHeader('Total-Page-Count', $collection->getLastPageNumber() - 1);
107+
$this->getResponse()->setHeader('Total-Page-Count', $categories->getLastPageNumber() - 1);
136108

137-
if ($pageparam > $collection->getLastPageNumber() - 1) {
109+
if ($page > $categories->getLastPageNumber() - 1) {
138110
$this->getResponse()->setBody(json_encode([]));
139111
} else {
140-
$iterator = $paginator->getIterator();
141-
142-
$items = [];
143-
foreach ($iterator as $item) {
144-
$items[] = $item->toArray();
145-
}
146-
147112
$this->getResponse()->setBody(json_encode($items));
148113
}
149114
}

code/etc/config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<config>
33
<modules>
44
<Clerk_Clerk>
5-
<version>3.4.6</version>
5+
<version>3.4.7</version>
66
</Clerk_Clerk>
77
</modules>
88
<global>

code/etc/system.xml

-7
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@
7676
<show_in_store>1</show_in_store>
7777
<source_model>adminhtml/system_config_source_yesno</source_model>
7878
</disable_order_synchronization>
79-
<sync_cms_pages>
80-
<label>Send CMS pages</label>
81-
<frontend_type>select</frontend_type>
82-
<sort_order>50</sort_order>
83-
<show_in_store>1</show_in_store>
84-
<source_model>adminhtml/system_config_source_yesno</source_model>
85-
</sync_cms_pages>
8679
<url>
8780
<label>Import url</label>
8881
<frontend_type>select</frontend_type>

0 commit comments

Comments
 (0)