Version Notes
If you have ideas for improvements or find bugs, please send them to Anthony Poiret at www.auguria.net, with Auguria LastReviews as part of the subject line.
Download this release
Release Info
Developer | Auguria |
Extension | Auguria_Dolibarrapi |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
app/code/community/Auguria/Dolibarrapi/Model/Catalog/Category/Api.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Dolibarrapi
|
5 |
+
* @author www.asperience.fr
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_Dolibarrapi_Model_Catalog_Category_Api extends Mage_Catalog_Model_Category_Api
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Retrieve category tree
|
14 |
+
*
|
15 |
+
* @param int $parent
|
16 |
+
* @param string|int $store
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function tree($parentId = null, $store = null)
|
20 |
+
{
|
21 |
+
if (is_null($parentId) && !is_null($store)) {
|
22 |
+
$parentId = Mage::app()->getStore($this->_getStoreId($store))->getRootCategoryId();
|
23 |
+
} elseif (is_null($parentId)) {
|
24 |
+
$parentId = 1;
|
25 |
+
}
|
26 |
+
|
27 |
+
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
|
28 |
+
$tree = Mage::getResourceSingleton('catalog/category_tree')
|
29 |
+
->load();
|
30 |
+
|
31 |
+
$root = $tree->getNodeById($parentId);
|
32 |
+
|
33 |
+
if($root && $root->getId() == 1) {
|
34 |
+
$root->setName(Mage::helper('catalog')->__('Root'));
|
35 |
+
}
|
36 |
+
|
37 |
+
$collection = Mage::getModel('catalog/category')->getCollection()
|
38 |
+
->setStoreId($this->_getStoreId($store))
|
39 |
+
->addAttributeToSelect('name')
|
40 |
+
->addAttributeToSelect('description');
|
41 |
+
|
42 |
+
|
43 |
+
$tree->addCollectionData($collection, true);
|
44 |
+
|
45 |
+
return $this->_nodeToArray($root);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Convert node to array
|
50 |
+
*
|
51 |
+
* @param Varien_Data_Tree_Node $node
|
52 |
+
* @return array
|
53 |
+
*/
|
54 |
+
protected function _nodeToArray(Varien_Data_Tree_Node $node)
|
55 |
+
{
|
56 |
+
// Only basic category data
|
57 |
+
$result = array();
|
58 |
+
|
59 |
+
$result['category_id'] = $node->getId();
|
60 |
+
$result['parent_id'] = $node->getParentId();
|
61 |
+
$result['name'] = $node->getName();
|
62 |
+
$result['description'] = $node->getDescription();
|
63 |
+
$result['updated_at'] = $node->getUpdatedAt();
|
64 |
+
$result['children'] = array();
|
65 |
+
|
66 |
+
foreach ($node->getChildren() as $child) {
|
67 |
+
$result['children'][] = $this->_nodeToArray($child);
|
68 |
+
}
|
69 |
+
|
70 |
+
return $result;
|
71 |
+
}
|
72 |
+
|
73 |
+
} // Class Auguria_Dolibarrapi_Model_Catalog_Category_Api End
|
app/code/community/Auguria/Dolibarrapi/etc/api.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<config>
|
3 |
+
<api>
|
4 |
+
<resources>
|
5 |
+
<auguria_dolibarrapi_catalog_category translate="title" module="catalog">
|
6 |
+
<model>auguria_dolibarrapi/catalog_category_api</model>
|
7 |
+
<title>Category API</title>
|
8 |
+
<acl>catalog/category</acl>
|
9 |
+
<methods>
|
10 |
+
<tree translate="title" module="catalog">
|
11 |
+
<title>Retrieve hierarchical tree</title>
|
12 |
+
<acl>catalog/category/tree</acl>
|
13 |
+
</tree>
|
14 |
+
</methods>
|
15 |
+
<faults module="catalog">
|
16 |
+
<store_not_exists>
|
17 |
+
<code>100</code>
|
18 |
+
<message>Requested store view not found.</message>
|
19 |
+
</store_not_exists>
|
20 |
+
<website_not_exists>
|
21 |
+
<code>101</code>
|
22 |
+
<message>Requested website not found.</message>
|
23 |
+
</website_not_exists>
|
24 |
+
<not_exists>
|
25 |
+
<code>102</code>
|
26 |
+
<message>Category not exists.</message>
|
27 |
+
</not_exists>
|
28 |
+
<data_invalid>
|
29 |
+
<code>103</code>
|
30 |
+
<message>Invalid data given. Details in error message.</message>
|
31 |
+
</data_invalid>
|
32 |
+
<not_moved>
|
33 |
+
<code>104</code>
|
34 |
+
<message>Category not moved. Details in error message.</message>
|
35 |
+
</not_moved>
|
36 |
+
<not_deleted>
|
37 |
+
<code>105</code>
|
38 |
+
<message>Category not deleted. Details in error message.</message>
|
39 |
+
</not_deleted>
|
40 |
+
<product_not_assigned>
|
41 |
+
<code>106</code>
|
42 |
+
<message>Requested product is not assigned to category.</message>
|
43 |
+
</product_not_assigned>
|
44 |
+
</faults>
|
45 |
+
</auguria_dolibarrapi_catalog_category>
|
46 |
+
</resources>
|
47 |
+
</api>
|
48 |
+
</config>
|
app/code/community/Auguria/Dolibarrapi/etc/config.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category OpenDAS
|
5 |
+
* @package Auguria_Dolibarrapi
|
6 |
+
* @author ASPerience - www.asperience.fr
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_Dolibarrapi>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Auguria_Dolibarrapi>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<models>
|
18 |
+
<auguria_dolibarrapi>
|
19 |
+
<class>Auguria_Dolibarrapi_Model</class>
|
20 |
+
</auguria_dolibarrapi>
|
21 |
+
</models>
|
22 |
+
<resources>
|
23 |
+
<auguria_dolibarrapi_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Auguria_Dolibarrapi</module>
|
26 |
+
</setup>
|
27 |
+
<connection>
|
28 |
+
<use>core_setup</use>
|
29 |
+
</connection>
|
30 |
+
</auguria_dolibarrapi_setup>
|
31 |
+
<auguria_dolibarrapi_write>
|
32 |
+
<connection>
|
33 |
+
<use>core_write</use>
|
34 |
+
</connection>
|
35 |
+
</auguria_dolibarrapi_write>
|
36 |
+
<auguria_dolibarrapi_read>
|
37 |
+
<connection>
|
38 |
+
<use>core_read</use>
|
39 |
+
</connection>
|
40 |
+
</auguria_dolibarrapi_read>
|
41 |
+
</resources>
|
42 |
+
</global>
|
43 |
+
</config>
|
app/etc/modules/Auguria_Dolibarrapi.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Dolibarrapi
|
6 |
+
* @author www.asperience.fr
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_Dolibarrapi>
|
13 |
+
<codePool>community</codePool>
|
14 |
+
<active>true</active>
|
15 |
+
<depends>
|
16 |
+
<Mage_Api />
|
17 |
+
</depends>
|
18 |
+
</Auguria_Dolibarrapi>
|
19 |
+
</modules>
|
20 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Auguria_Dolibarrapi</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>change some features in category_tree function to able import of categories from Magento to Dolibarr</summary>
|
10 |
+
<description>This extension alter the category_tree function to get needfuls informations didn't provided by the native one, and remove some others useless.
|
11 |
+

|
12 |
+
Required to satisfy the calls applied in Dolibarr's eCommerce synchronization module.
|
13 |
+

|
14 |
+
If the functionnalities offered by this Dolibarr's module awake your interest, feel free to have a look on Dolistore at http://www.dolistore.com/ where you will find much more informations.</description>
|
15 |
+
<notes>If you have ideas for improvements or find bugs, please send them to Anthony Poiret at www.auguria.net, with Auguria LastReviews as part of the subject line.</notes>
|
16 |
+
<authors><author><name>Auguria</name><user>Auguria</user><email>magento@auguria.net</email></author></authors>
|
17 |
+
<date>2011-06-15</date>
|
18 |
+
<time>12:23:09</time>
|
19 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Auguria_Dolibarrapi.xml" hash="d2154189d81bfa588e3d433e67abc2cc"/></dir></target><target name="magecommunity"><dir name="Auguria"><dir name="Dolibarrapi"><dir name="Model"><dir name="Catalog"><dir name="Category"><file name="Api.php" hash="052733a177b27152fdb4c31bf74dcf0a"/></dir></dir></dir><dir name="etc"><file name="api.xml" hash="c5290b795447c169402e30fc73cca648"/><file name="config.xml" hash="e7936257c9e15a062df92602b9b23f9e"/></dir></dir></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|