Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor import and export #20

Closed
naydav opened this issue May 19, 2017 · 0 comments
Closed

Refactor import and export #20

naydav opened this issue May 19, 2017 · 0 comments
Assignees

Comments

@naydav
Copy link

naydav commented May 19, 2017

Full context in documentation

[HLD] Inconsistent saving of Stock Data

Description

1. Skip attribute from import

For \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType:

namespace Magento\CatalogImportExport\Model\Import\Product\Type;
abstract class AbstractType
{
    /**
     * This property has been added in scope of work for backward compatible of stock item processing (work with
     * stock_data and quantity_and_stock_status keys)
     * quantity_and_stock_status attribute will be deleted
     *
     * @var array
     */
    private $attributesToSkip = ['quantity_and_stock_status']; // values must be configurable via DI
    ...
    public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDefaultValue = true)
    {
        $resultAttrs = [];
    
        foreach ($this->_getProductAttributes($rowData) as $attrCode => $attrParams) {
            if ($attrParams['is_static'] || in_array($attrCode, $this->attributesToSkip)) {
                continue;
            }
    ...
}

For the import test, \Magento\CatalogImportExport\Model\AbstractProductExportImportTestCase:

namespace Magento\CatalogImportExport\Model;

abstract class AbstractProductExportImportTestCase extends \PHPUnit_Framework_TestCase
{
    ...
    public static $skippedAttributes = [
    ...
    'quantity_and_stock_status',
    ];
    ...
}    

2. [Important!] Check possibility to disable/enable the Out of Stock status when importing products

3. Check and if needed replace 'quantity_and_stock_status' attribute with stock item data in Import/Export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant