Code Monkey home page Code Monkey logo

Comments (6)

guewen avatar guewen commented on August 17, 2024

You should not modify directly the files in the addon. Instead, you should write an extension addon that modifies this behavior. You should probably extend the ProductMapper and remove the category_id mapping. Use the documentation for how to write this extension addon: http://odoo-magento-connector.com/guides/tutorial_customize.html

from connector-magento.

fohnbit avatar fohnbit commented on August 17, 2024

Hello!

Ok, thank you .. .but maybe you can give me a hint, in which file I found the command, where the connector write the product and category.
Then I could check for a change.

from connector-magento.

guewen avatar guewen commented on August 17, 2024

Here it is: https://github.com/OCA/connector-magento/blob/8.0/magentoerpconnect/product.py#L464-L491

from connector-magento.

fohnbit avatar fohnbit commented on August 17, 2024

Dear guewen,

many thanks for your support!
But I guess this is the main category import?
This is ok and I need to use.

I only want to disable, that the connector write in odoo the "Internal Category" to the imported products.

Thank you and have a great sunday!

from connector-magento.

guewen avatar guewen commented on August 17, 2024

Hi,

It is the "Internal Category", the field named categ_id. (Which is not different from the "Main category" or I miss something.)

from connector-magento.

fohnbit avatar fohnbit commented on August 17, 2024

Hello!

Again thank you for your help ... guess I describe it maybe not good enough:
I want disable, that the connector write the Main category on the products in odoo.

According to your link I try this:
@mapping
def website_ids(self, record):
website_ids = []
binder = self.binder_for('magento.website')
for mag_website_id in record['websites']:
website_id = binder.to_openerp(mag_website_id)
website_ids.append((4, website_id))
return {'website_ids': website_ids}

@mapping
def categories(self, record):
    mag_categories = record['categories']
    binder = self.binder_for('magento.product.category')

    category_ids = []
    main_categ_id = None

    for mag_category_id in mag_categories:
        cat_id = binder.to_openerp(mag_category_id, unwrap=True)
        if cat_id is None:
            raise MappingError("The product category with "
                               "magento id %s is not imported." %
                               mag_category_id)

        category_ids.append(cat_id)

   # if category_ids:
     #   main_categ_id = category_ids.pop(0)

   # if main_categ_id is None:
     #   default_categ = self.backend_record.default_category_id
     #   if default_categ:
      #      main_categ_id = default_categ.id

   # result = {'categ_ids': [(6, 0, category_ids)]}
   # if main_categ_id:  # OpenERP assign 'All Products' if not specified
   #     result['categ_id'] = main_categ_id
    return result

Maybe I disable the wrong lines, but he write still the Main category on the products.
Did I use the false line or must I disable also the "return result" ?

Thank you!!

from connector-magento.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.