Giter Site home page Giter Site logo

Comments (6)

garfix avatar garfix commented on May 30, 2024

Yes, you are right. Thanks for reporting it. There's a bug in the creation of categories. The "level" field catalog_category_entity is set 1 too high. Also the "position" of the new category within the parent category is not calculated right, but that's probably not so important.

I would like to make the following changes to fix this, can you check for me if this helps, before I create a new release:

The function now starts with

        $categoryEntityTable = $this->metaData->categoryEntityTable;
        $urlRewriteTable = $this->metaData->urlRewriteTable;
        $attributeSetId = $this->metaData->defaultCategoryAttributeSetId;

        $parentLevel = count($idPath) - 1;
        $childLevel = $parentLevel + 1;
        $parentId = $idPath[$parentLevel];
        $parentPath = implode(self::CATEGORY_ID_PATH_SEPARATOR, $idPath);

        // update parent data
        $this->db->execute("

and in the calculation of $position a bit below that in the same function

$position = $this->db->fetchSingleCell("
            SELECT MAX(`position`)
            FROM `{$categoryEntityTable}`
            WHERE `path` LIKE ? AND level = ?
        ", [
            "{$parentPath}/%",
            $childLevel
        ]);

Note that $parentLevel was changed to $childLevel

from product-import.

choleaoum avatar choleaoum commented on May 30, 2024

Hey sorry for the slow response, github didn't notify me that you replied. As I was testing the update I forgot that I should mention there's a trimming issue. I'm using CData to pass some special values into the category & description. XML does not like these values. Anyways, when being passed using CData it adds a random whitespace in front of the category.

image

In the ElementHandler.php

I changed line 395 to

$value = trim($this->characterData);

Line 406 to

$this->product->addCategoriesByGlobalName(array_map('trim', $this->items));

To remove any additional whitespacing. I'm still in the process of testing, just figured I post this now before I forget.

Update:
Your solution above fixed the level and position issue. I might need to mention that when deleting the categories from admin and importing using the script, the children count gets messed up. Doesn't seem to be such a big issue for me at least.

image

While I have you here, I was hoping I could get off topic a little and pick your brain a little in regards to pointing my images to an AWS S3 bucket. There's currently another bug where the product images don't get deleted when removing them from the XML. I had to manually remove the item and repopulate for it to have the correct images.

I'm going to store everything on S3 and run a cdn to cache all my images. Any chance you would know how to send me in the right direction? I'm currently hosting the images locally and I believe I can shave import time, space, and cost if I just point everything to S3.

My current benchmark is 2 minutes for 10k items. (I will have over 1 million items hopefully when I'm done populating)

I'm hoping in the future I will allow the API to accept a JSON body just for my personal preference.

from product-import.

patrick-bigbridge avatar patrick-bigbridge commented on May 30, 2024

No need to apologize for a slow response. I am not in a hurry ;)

Thanks for showing the missing trim(). Only I will place it in the Product and ProductStoreView classes for this use is more general. I noticed more trims were needed there as well.

I hope you find some more bugs. Name them here and when you're done I will create a single new release.

I need some more information if you want to have the image to be deleted. Are you using the ImportConfig::$imageStrategy 'set', for instance?

Check ImportConfig::$existingImageStrategy for options you can use to import images from remote locations.

from product-import.

choleaoum avatar choleaoum commented on May 30, 2024

When you import from a remote location, I believe it downloads it and then caches it locally correct? If so, that may defeat the purpose of me storing it in S3. I am hoping to run all my product images off S3 to share across other platforms.

As far as the images, I am just repopulating the xml file with just list of images removed/added. I am hoping this importer can serve as a lightweight inventory stock updater.

And I will keep an eye on more bugs! I hope to use this in production sometime this week. Working out all the kinks, but it's been a great extension so far.

from product-import.

patrick-bigbridge avatar patrick-bigbridge commented on May 30, 2024

Hi @choleaoum

I am planning to close this issue and create a new release for the fixes. Is there anything you would like to add?

from product-import.

patrick-bigbridge avatar patrick-bigbridge commented on May 30, 2024

I created a new release and close this issue.

from product-import.

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.