← Back to team overview

openerp-connector-community team mailing list archive

Re: my patch to Catalog/Api.php to import product categories, but you may know a better way

 

On 03/28/2014 09:56 AM, jrook@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
>  
> 
> Greetings to those in this forum. This is my first post.
> I am impressed by the new job model in 7.0. Very nice. 
> 
> My first product category import took some extra coaxing. 
> 
> At first I consistently had xml responses like this: 
> 
> <methodResponse><fault><value><struct><member><name>faultCode</name><value><int>1</int></value></member><member><name>faultString</name><value><string>Internal
> Error. Please see log for
> details.</string></value></member></struct></value></fault></methodResponse>
> 
> 
> To xml requests like this: 
> 
> <methodCall>
> <methodName>call</methodName>
> <params>
> <param>
> <value><string>6f1ba3c8071c9ea351b5e2f0ab52bbf8</string></value>
> </param>
> <param>
> <value><string>catalog_category.tree</string></value>
> </param>
> <param>
> <value><array><data>
> <value><nil/></value><value><nil/></value></data></array></value>
> </param>
> </params>
> </methodCall> 
> 
> With find and grep, I located: 
> 
> openerp-connector-magento/magentoerpconnect/product_category.py
> class ProductCategoryAdapter
> def tree 
> 
> Then I found, on the Magento side, giving gratitude to
> http://alanstorm.com/debugging_magento_api_method_calls 
> 
> app/code/core/Mage/Catalog/Model/Category/Api.php
> class Mage_Catalog_Model_Category_Api
> public function tree($parentId = null, $store = null) 
> 
> Then my really sophisticated technique was to stick in lots of
> fopen/fprint/fclose until I saw what was going on. So I ended up adding
> these two lines to the top of the the tree() function: 
> 
>  {
>  if($parentId == '') $parentId = null;
>  if($store == '') $store = null; 
> 
> And I requeued the OpenERP Connector job and it finished, and then the
> products imported fine also. Excellent. 
> 
> I felt a duty in a way to share what I did with this list, so I joined,
> and I am also hereby placing myself open to suggestions.... 
> 
> Really, my whole team and I sincerely appreciate the master
> craftsmanship of this entire team, so thank you. 
>  
> 

Hi,

Thanks for you feedback and for the nice words!

Can you check what is the PHP version on your server? Magento 1.7 is
known to be incompatible with PHP 5.4 (but a patch has been published
[0]) and I know it can lead to weird issues like that.

If you are not using PHP 5.4 or you are using the patch, then I would be
grateful if you could create a bug report on
https://bugs.launchpad.net/openerp-connector-magento.

Thanks,

[0] http://www.magentocommerce.com/blog/magento-now-supports-php-54/

-- 
Guewen Baconnier
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 39
Office: +41 21 619 10 10
http://www.camptocamp.com/


References