export catalogue -> Fault: <Fault 101: 'Product not exists.'>

Bug #834619 reported by Jeroen_monkeytail
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
New
Undecided
Sébastien BEAU - http://www.akretion.com

Bug Description

after pressing 'export catalogue' in the magento shops form, I get the error:
Fault: <Fault 101: 'Product not exists.'>

It looks like one product of the stack of products that need to be send to magento, is actually send, but the others not.

what might be wrong?

regards,
Jeroen

Revision history for this message
Guillermo Cimatti (guillermo-cimatti) wrote :

There are any solution for this bug, is strange, because with the same Magento, and versions of addons, it only occur in Linux Ubuntu environment, but not in windows.

Best Regards

Revision history for this message
Hillebrand Dalstra (hillebrand-dalstra) wrote :
Download full text (3.2 KiB)

I have the same issue as Jeroen.

Environment Information :
System : Linux-2.6.32-33-generic-x86_64-with-Ubuntu-10.04-lucid
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 10.04.3 LTS
Release: 10.04
Codename: lucid
Operating System Release : 2.6.32-33-generic
Operating System Version : #72-Ubuntu SMP Fri Jul 29 21:07:13 UTC 2011
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.0.3
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/openerp/openerp-server/openerp-server-6/bin/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/openerp/openerp-server/openerp-server-6/bin/service/web_services.py", line 599, in dispatch
    res = fn(db, uid, *params)
  File "/home/openerp/openerp-server/openerp-server-6/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/openerp/openerp-server/openerp-server-6/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/openerp/openerp-server/openerp-server-6/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/openerp-server/openerp-server-6/bin/addons/base_sale_multichannels/sale.py", line 153, in export_catalog
    self.export_products(cr, uid, shop, context)
  File "/home/openerp/openerp-server/openerp-server-6/bin/addons/base_sale_multichannels/sale.py", line 138, in export_products
    self.export_products_collection(cr, uid, shop, context)
  File "/home/openerp/openerp-server/openerp-server-6/bin/addons/base_sale_multichannels/sale.py", line 135, in export_products_collection
    self.pool.get('product.product').ext_export(cr, uid, product_to_export, [shop.referential_id.id], {}, context)
  File "/home/openerp/openerp-server/magentoerpconnect/magentoerpconnect/product.py", line 1039, in ext_export
    self.ext_assign_links(cr, uid, id, external_referential_ids=external_referential_ids, defaults=defaults, context=context_storeview)
  File "/home/openerp/openerp-server/magentoerpconnect/magentoerpconnect/product.py", line 1084, in ext_assign_links
    external_referential_ids=external_referential_ids, defaults=defaults, context=context)
  File "/home/openerp/openerp-server/magentoerpconnect/magentoerpconnect/product.py", line 1110, in ext_product_assign
    child_list = conn.call('product_link.list', data) # get the sku of the products already assigned
  File "/home/openerp/openerp-server/magentoerpconnect/magentoerpconnect/magerp_osv.py", line 53, in call
    res = self.ser.call(self.session, method, arguments)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib/python2.6...

Read more...

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi all which king of product do you have in your catalog (simple, configurable, bundle, link between product)?
Can you try to identifie the product that failed to be exported, and try to export it manually directly from the product menu form?

Best Regards.

Revision history for this message
Nicolas TRUBERT (nicolas-trubert) wrote :

Hi all,

I have same kind of issue after magento upgrade on 1.6.

It seems that there are difference to get product id on magento side according to some web_service.

I modify magento core to test for tierce_price.update and product.update and it works.
It seems that it works around product by Id or sku ??

../app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php
/* Magento 1.6 source
    protected function _initProduct($productId, $identifierType = null)
    {
        $product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);
        if (!$product->getId()) {
            $this->_fault('product_not_exists');
        }

        return $product;
    }
*/
/* My modif */
    protected function _initProduct($productId, $identifierType = null)
    {
        $product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);

        if (!$product->getId()) {
            if ($identifierType === null) {
                $identifierType = 'sku';
                $idBySku = $product->getIdBySku($productId);
                if ($idBySku) {
                    $productId = $idBySku;
                    $product->load($productId);
                }
            }
            if (!$product->getId()) {
                $this->_fault('product_not_exists');
            }
        }

        return $product;
    }
/**/

../app/code/core/Mage/Catalog/Model/Product/Api.php

/* Magento 1.6 source
    public function update($productId, $productData, $store = null, $identifierType = null)
    {

        $product = $this->_getProduct($productId, $store, $identifierType);
        if (!$product->getId()) {
            $this->_fault('not_exists');
        }
*/
/* My modif */
    public function update($productId, $productData, $store = null, $identifierType = null)
    {

        $product = $this->_getProduct($productId, $store, $identifierType);
        if (!$product->getId()) {

            if ($identifierType === null) {
                $identifierType = 'sku';
                $idBySku = $product->getIdBySku($productId);
                if ($idBySku) {
                    $productId = $idBySku;
                    $product->load($productId);
                }
            }
            if (!$product->getId()) {
                $this->_fault('product_not_exists');
            }
            /**/

Regards.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Same problem on Magento 1.6.1. No success with the proposed patch above. Magento can't find the product with the information provided by the connector.

mysql> select * from catalog_product_entity;
+-----------+----------------+------------------+---------+-------+-------------+------------------+---------------------+---------------------+
| entity_id | entity_type_id | attribute_set_id | type_id | sku | has_options | required_options | created_at | updated_at |
+-----------+----------------+------------------+---------+-------+-------------+------------------+---------------------+---------------------+
| 1 | 4 | 4 | simple | 12345 | 0 | 0 | 2011-08-18 13:46:03 | 2011-08-19 13:42:12 |
+-----------+----------------+------------------+---------+-------+-------------+------------------+---------------------+---------------------+
1 row in set (0.00 sec)

Export product :

[2011-12-28 20:11:26,432][?] INFO:Magento Connection:Calling Method:ol_catalog_product.update,Arguments:[u'12345', {'msrp_enabled': False, 'weight': 300.0, 'type_id': u'simple', 'options_container': u'container2', 'small_image_label': False, 'cost': 0, 'thumbnail_label': False, 'special_from_date': False, 'url_key': u'above-ground-pool', 'description': u'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In viverra eros eget eros vestibulum elementum. Nullam sit amet varius tellus. Nullam aliquet turpis diam. Nullam non purus neque. Nunc elementum, nibh vitae euismod egestas, lorem tortor feugiat mauris, ac placerat elit mauris et quam. Ut aliquet auctor lobortis. Maecenas dictum, eros lacinia blandit elementum, nisi est laoreet est, sed cursus dui nulla at elit. Mauris hendrerit dui neque, et consequat diam', 'meta_description': u'Really nice above ground pool', 'country_of_manufacture': False, 'msrp_display_actual_price_type': False, 'is_imported': False, 'page_layout': False, 'minimal_price': False, 'meta_keyword': u'Above Ground pool', 'gift_message_available': False, 'custom_design_to': False, 'short_description': u'Really nice above ground pool', 'tax_class_id': u'2', 'status': u'1', 'meta_title': u'Above Ground pool', 'custom_layout_update': u'', 'news_to_date': False, 'price_view': False, 'price': 2499.0, 'enable_googlecheckout': u'1', 'news_from_date': False, 'visibility': u'4', 'updated_at': u'2011-08-19 13:42:12', 'recurring_profile': False, 'is_recurring': False, 'categories': [u'25', u'3'], 'manufacturer': u'3', 'custom_design': False, 'required_options': u'0', 'name': u'Above Ground pool', 'created_at': u'2011-08-18 13:46:03', 'websites': [u'1'], 'special_to_date': False, 'custom_design_from': False, 'msrp': False, 'image_label': False}]
[2011-12-28 20:11:26,984][?] INFO:ext synchro:UPDATE ERROR: <Fault 0: 'Unknown Error'>
[2011-12-28 20:11:26,984][?] INFO:ext synchro:may be the resource doesn't exist any more in the external referential, trying to re-create a new one

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

In OpenERP, I changed the Magento SKU to the value of entity_id (in MySQL database) and I was able to update the product.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

catalog_product.update

Arguments:
    int product - product ID
    array productData - array of attributes values
    mixed storeView - store view ID or code (optional)

http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.update

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

By patching the magento module (see related branch), I was able to update the module.

I now have same error message (Fault: <Fault 101: 'Product not exists.'>) when :
* listing product link
* creating product image

I modified app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php to be able to find the product :

public function create($productId, $data, $store = null, $identifierType = null)
    {
        $data = $this->_prepareImageData($data);

        // Magento 1.6.1 : $product = $this->_initProduct($productId, $store, $identifierType);
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$productId);

and I got :

Fault: <Fault 102: 'The image contents is not valid base64 data.'>

Revision history for this message
Remco (remcobakker) wrote :

got pretty much the same problem in my bug

https://bugs.launchpad.net/magentoerpconnect/+bug/912025

It mixes SKU and ID with the new magento. switching sku with ID will update the product correctly

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Attached is my patch for Magento 1.6.1 to make this works.

Feel free to propose and provide a better solution.

Changed in magentoerpconnect:
assignee: nobody → Sébastien BEAU - http://www.akretion.com (sebastien.beau)
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

This bug is due to the fact that some time we used the sku as identifier intead of the id. This is an historic choice.
Indeed at the start (magento 1.3.2.4). All Magento API was mixing sku/id without posibility to choose the identifier.
This is mean that when you was asking for a product magento will check the sku and if there is no sku it will check in the id. This is a very strange behaviour for an API. But since 1.4 magento can give the posibility to force to use id or sku but not the two posibility at the same time.

I will fix it by cleanning the module MagentoERPconnect and use only id everythere. For now you can use the patch from Maxime

Just for information, udge refactor for MagentoERPconnect is comming.
Indeed we already start to redisgn base_external_referentials (new version here : https://code.launchpad.net/~openerp-commiter/openobject-extension/openobject-extension)
This will add a full reporting system to manage all synchronisation error. MagentoERPconnect is not already ported but I will do it soon (very soon).

Thank for partcipating to this project ;)

Revision history for this message
Edgar (christ-0) wrote :

Hi,

this error is still exist on 6.1 and magentoerpconnect trunk 570 and magento 1.6.2 extra-trunk.

The patch is not working for me.

Revision history for this message
Kyle Waid (midwest) wrote :

Hello,

Can you paste your stack trace. Everyone, I believe this bug is because of the product links module not the magento api. See the first post,

  File "/home/openerp/openerp-server/magentoerpconnect/magentoerpconnect/product.py", line 1110, in ext_product_assign
    child_list = conn.call('product_link.list', data) # get the sku of the products already assigned

I already report this problem. The issue occurs when you create a new product and attempt to export if no links are defined. It tries to assign itself as a link. I have tested this version of magento and i works fine if you comment out the method to assign external links

Revision history for this message
Edgar (christ-0) wrote :

Hi Kyle,

here come the traceback.

Server Traceback (most recent call last):
  File "/home/openerp/openerp-web/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/extra-trunk/base_sale_multichannels/sale.py", line 247, in export_catalog
    self.export_products(cr, uid, shop, context)
  File "/home/openerp/extra-trunk/base_sale_multichannels/sale.py", line 232, in export_products
    self.export_products_collection(cr, uid, shop, context)
  File "/home/openerp/extra-trunk/base_sale_multichannels/sale.py", line 229, in export_products_collection
    self.pool.get('product.product').ext_export(cr, uid, product_to_export, [shop.referential_id.id], {}, context)
  File "/home/openerp/magentoerpconnect/magentoerpconnect/product.py", line 1296, in ext_export
    self.ext_assign_links(cr, uid, id, external_referential_ids=external_referential_ids, defaults=defaults, context=context_storeview)
  File "/home/openerp/magentoerpconnect/magentoerpconnect/product.py", line 1401, in ext_assign_links
    external_referential_ids=external_referential_ids, defaults=defaults, context=context)
  File "/home/openerp/magentoerpconnect/magentoerpconnect/product.py", line 1427, in ext_product_assign
    child_list = conn.call('product_link.list', data) # get the sku of the products already assigned
  File "/home/openerp/magentoerpconnect/magentoerpconnect/magerp_osv.py", line 83, in call
    res = self.ser.call(self.session, method, arguments)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

I had to patch Magento 1.6.1 to be able to export product (which include getting the list of product_links).

In app/code/core/Mage/Catalog/Helper/Product.php :

public function getProduct($productId, $store, $identifierType = null) {
        $loadByIdOnFalse = false;
        if ($identifierType == null) {
            // Magento 1.6.1 : if (is_string($productId) && !preg_match("/^[+-]?[1-9][0-9]*$|^0$/", $productId)) {
            if (is_string($productId)) {
                $identifierType = 'sku';
                $loadByIdOnFalse = true;
            } else {
                $identifierType = 'id';
            }
        }

Revision history for this message
Kyle Waid (midwest) wrote :

You can see again,

child_list = conn.call('product_link.list', data) # get the sku of the products already assigned

The export has nothing to do with the magento api. It is because of a faulty method related to the product links feature. No patch to the magento api module is needed.

Revision history for this message
Kyle Waid (midwest) wrote :

I prove it to you,

go to product.py in magentoerpconnect. Comment out all lines in def ext_product_assign except return true. restart the server export will work. If you examine the stack trace properly you can see the reason it fails is because the product link it is trying to assign does not exist because you cannot assign a link to itself

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.