Giter Club home page Giter Club logo

techdivision / import-product Goto Github PK

View Code? Open in Web Editor NEW
6.0 13.0 12.0 1.01 MB

This library provides the basic function for the Magento 2 product import. This includes the import of simple products, their assignment to web pages and categories as well as the updating of the stock (not MSI) and the dynamic processing of the EAV attributes assigned to the product.

Home Page: https://pacemaker.techdivision.com

License: MIT License

PHP 100.00%
magento import products csv pacemaker

import-product's Introduction

Pacemaker - Product Import

Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality Code Coverage

Please visit the Pacemaker website or our documentation for additional information

import-product's People

Contributors

adhocore avatar amenk avatar hamplr avatar kenza-ya avatar lukaskiederle avatar mardl avatar pathmissing avatar sippsolutions avatar steinkopffp avatar svizevv avatar tklement avatar vadimjustus avatar wagnert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

import-product's Issues

Add Operation functionality

As provided by the Magento 2 standard import functionality, M2IF should also support the 3 different import operations

  • Add/Update
  • Replace
  • Delete

The operation to be used should be configurable in the configuration file as well as it should be possible to override it by appending a command line argument.

It should also be possible to have a complete different subject configuration for each operation.

cleaning of product/website relations not implemented

Hello,

The \TechDivision\Import\Product\Observers\ProductWebsiteUpdateObserver, while importing new product/website relations perfectly, does not clean out those that are no longer required. For many of the other observers there exist a config setting that indicates whether cleaning should take place or not. Such a feature would be required for the product/website relations as well.

Best regards,
Klaas

Add additional CSV configuration options

Actual, only the prefix of the filename of the CSV files that have to be imported, can be configured on subject level. Additional configuration options, also on subject level, are necessary:

  • Delimiter
  • Enclosure
  • Escape
  • From Charset
  • To Charset (because temporary CSV files could be created during import process)
  • File Mode (because temporary CSV files could be created during import process)
  • Strict Mode (ignores rows with a different column count)

All options have to be optional and should provide a reasonable default value.

Importing tier prices

Hi! Quick question. Is it currently possible to import tier prices with M2IF? If yes, how?

Change to an case insensitive approach for "visibility"

For visibility, there is a bunch of predefined values possible:

  • Not Visible Individually
  • Catalog
  • Search
  • Catalog, Search

There are validation logic and business logic for these values in the code, which is case sensitive. In the scope of an improvement it should be evaluated, whether it is possible to make the handling of these values case insensitive.

Leading 0 Ignored in Attribute Values during Product Import via Pacemaker

Describe the bug

When doing a product import using Pacemaker, if an attribute value, such as in my example the color number attribute, begins with a leading 0, Pacemaker ignores the leading 0. This did not happen in earlier versions of Pacemaker. It looks like there is a type conversion error where the color number (or in general numbers in attributes) is being treated as an integer instead of a string (for data consistency sake, string would always be the preferred way here), resulting in the loss of leading 0s.

To Reproduce

Steps to reproduce the behavior:

  1. Prepare an import and set an attribute value to for example "0123"
  2. Import the Product like always
  3. Check the Product's attribute in the Magento Backend

Expected behavior

The expected behavior is that Pacemaker should retain leading 0s in attribute values during the product import process, like in this example "0123".

Actual behavior

The attribute lost its leading 0s and now has the value "123" which leads to data inconsistencies.

ProductRepository returns wrong product if SKU matches entity ID of another product

Hello again! I found another nice one.

In TechDivision\Import\Product\Repositories\ProductRepository in the method findOneBySku(), first the cache is checked to see if a product has already been loaded. The thing is that the cache is checked using the SKU as cache key, while storing product data uses the entity ID as cache key. You use references to make this possible. However, it might happen that the SKU [sku] of product A matches the entity ID of product B. Furthermore assume that product B is loaded before product A. In that case, if the method findOneBySku() is called with [sku] as parameter, the call $this->resolveReference($cacheKey) will return [sku], since no reference for product A exists yet. But than $this->cache[$this->resolveReference($cacheKey)] will return the product data for B, which has interesting (as in horrible) side-effects. For example, the URL rewrite update observer will try to insert the URL rewrite for A with the SKU instead of the entity ID as entity_pk. And since product B has already been processed, a rewrite with that primary key already exists. Boom!

Now, I created a patch, which checks whether the product data returned from the cache is actually the one we want. In I replaced

if ($this->isCached($sku)) {
    return $this->fromCache($sku);
}

with

if ($this->isCached($sku)) {
    $product = $this->fromCache($sku);
    if ($product[MemberNames::SKU] == $sku)
        return $product;
}

But in general I think that the whole reference mechanism for accessing cached items is pretty dangerous, since the assumption cannot be made that there are no conflicts between actual cache keys and references.

Add Clean-Up functionality

When using replace/delete operation, all products found the specified CSV file(s) should be completely removed from the database, including their relations.

Beside the product and it's attributes, these entities are concerned

  • Product Inventory stock/items
  • Product Website relations
  • Product Category relations
  • Product URL Rewrites

product_type and attribute_set_code need to be provided, docs wrong?

On https://docs.m2if.com/38/file-structure/product-import/scopes it looks like the two attributes product_type and
attribute_set_code are not necessary for the store view scope lines.

product-import_20200629_1.zip

Still this file is not working:

sku,store_view_code,product_type,attribute_set_code,name
12345,,simple,Default,some global name
12345,shop_de_de,,,name de
12345,shop_at_de,,,name at
12345,shop_gb_en,,,name gb
12345,shop_it_it,,,name it

Validation error

+-------------------------------+------+--------------------+-------------------------------------------------------------------------------------------------------------------------------+
| File                          | Line | Column             | Error                                                                                                                         |
+-------------------------------+------+--------------------+-------------------------------------------------------------------------------------------------------------------------------+
| product-import_20200629_1.csv | 3    | product_type       | Found invalid value "" for column "product_type" (must be one of: "simple, virtual, configurable, bundle, grouped, giftcard") |
| product-import_20200629_1.csv | 4    | attribute_set_code | Found invalid value "" for column "attribute_set_code" (must be one of: "Default")                                            |
| product-import_20200629_1.csv | 5    | product_type       | Found invalid value "" for column "product_type" (must be one of: "simple, virtual, configurable, bundle, grouped, giftcard") |
| product-import_20200629_1.csv | 6    | attribute_set_code | Found invalid value "" for column "attribute_set_code" (must be one of: "Default")                                            |
| product-import_20200629_1.csv | 7    | product_type       | Found invalid value "" for column "product_type" (must be one of: "simple, virtual, configurable, bundle, grouped, giftcard") |
| product-import_20200629_1.csv | 8    | attribute_set_code | Found invalid value "" for column "attribute_set_code" (must be one of: "Default")                                            |
| product-import_20200629_1.csv | 9    | product_type       | Found invalid value "" for column "product_type" (must be one of: "simple, virtual, configurable, bundle, grouped, giftcard") |
| product-import_20200629_1.csv | 10   | attribute_set_code | Found invalid value "" for column "attribute_set_code" (must be one of: "Default")                                            |
+-------------------------------+------+--------------------+-------------------------------------------------------------------------------------------------------------------------------+

When filling those fields, it is working.

Option to remove values ("Use Default Value" in adminpanel)

Is your feature request related to a problem? Please describe.
We have imported values on store scope but in one store they are the same as the default value so we would like to remove them and just use the value of the global scope. In the adminpanel it is possible to check the checkbox "Use Default Value" which removes the value for the selected store.

Describe the solution you'd like
One possible solution could be to add a column like name_use_default_value and if 1 is passed it will remove the scoped name. The schema would be {attributeName}_use_default_value set to 1 in order to remove a value.

Describe alternatives you've considered
None so far.

Add Url Rewrite Handling

Actually new URL Rewrite will be created, when a new product is added.

If not already exists, a URL Rewrite has to be created for the product base URL and for each category the product is available in, e. g.

  • bruno-compete-hoodie-test.html
  • men/tops-men/hoodies-and-sweatshirts-men/bruno-compete-hoodie-test.html
  • collections/eco-friendly/bruno-compete-hoodie-test.html
  • men/tops-men/bruno-compete-hoodie-test.html

If the URL key already exists, a redirect for the old URL has to be created and the new URL rewrite has to be created (see above).

Skipping attributes

for example there can be many skus in a csv and some skus have values for some attribute while other skus have values for other attributes

and it maybe desirable to skip setting values for attributes for one sku but set for another.

very minimal and probably not realistic example (only to explain):

sku,color,weight
red_sku,red,
no_color_sku,,0.1

now how can we skip checking and setting weight for red_sku ad color for no_color_sku? instead of trying to set empty or 0 or some default for example aka skipping entirely?

is it possible something like this?

sku,color,weight
red_sku,red,__SKIP__
no_color_sku,__SKIP__,0.1

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.