omega80 Posted March 6 Share Posted March 6 В связи с огромным количеством товара в системе Aimeos принято решение о разделении импорта на два направления: 1) Полный первичный импорт CSV всей информации о товаре, включая описание, характеристики и цены (сейчас получилось 86 столбцов); 2) Импорт только цен и остатков; Для решения данной задачи необходимо создать второй контроллер заданий, например "product/import/price". Расширить существующий класс \Aimeos\Controller\Jobs\Product\Import\Csv\Standard и перезаписать как минимум методы location() и mapping() для использования другого ключа конфигурации. После этого можно импортировать два разных вида файлов CSV с разными сопоставлениями столбцов, хранящимися в разных каталогах. Link to comment Share on other sites More sharing options...
omega80 Posted March 6 Author Share Posted March 6 Link to comment Share on other sites More sharing options...
omega80 Posted March 6 Author Share Posted March 6 return (string) $this->context()->config()->get( 'controller/jobs/product/import/csv/location', 'product' ); // second import file - only prices and stocks return (string) $this->context()->config()->get( 'controller/jobs/product/import/price/location', 'price' ); $map = (array) $this->context()->config()->get( 'controller/jobs/product/import/csv/mapping', $this->getDefaultMapping() ); if( !isset( $map['item'] ) || !is_array( $map['item'] ) ) { $msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return $map; // second import file - only prices and stocks $map = (array) $this->context()->config()->get( 'controller/jobs/product/import/csv/mappingprice', $this->getDefaultMapping() ); if( !isset( $map['item'] ) || !is_array( $map['item'] ) ) { $msg = sprintf( 'Required mappingprice key "%1$s" is missing or contains no array', 'item' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return $map; Link to comment Share on other sites More sharing options...
omega80 Posted March 6 Author Share Posted March 6 Link to comment Share on other sites More sharing options...
omega80 Posted March 6 Author Share Posted March 6 1) Создаем каталог для нашего файла с ценами 2) Добавляем папку "Prices" в каталоге задач импорта: 3) Добавляем новые сопоставления столбцов для файла CSV с ценами: Link to comment Share on other sites More sharing options...
omega80 Posted March 6 Author Share Posted March 6 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now