-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MKP-362: enrichment uses mass edit (#23)
* MKP-362: enrichment uses mass edit * MKP-362: updated README.md instructions * MKP-362: added channel selector in icecat configuration * Update documentation: README and CHANGELOG
- Loading branch information
Showing
19 changed files
with
279 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,70 +42,50 @@ if (launchIntegrationTests.equals("yes")) { | |
|
||
def runIntegrationTest(phpVersion, mysqlVersion) { | ||
node('docker') { | ||
deleteDir() | ||
cleanUpEnvironment() | ||
|
||
def workspace = "/home/docker/pim" | ||
|
||
sh "docker network create akeneo" | ||
sh """ | ||
docker pull mysql:${mysqlVersion} | ||
docker pull carcel/akeneo:php-${phpVersion} | ||
""" | ||
|
||
sh "docker run -d --network akeneo --name mysql \ | ||
-e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=akeneo_pim -e MYSQL_PASSWORD=akeneo_pim -e MYSQL_DATABASE=akeneo_pim \ | ||
mysql:${mysqlVersion} \ | ||
--sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" | ||
|
||
unstash "pim_enterprise" | ||
|
||
sh "docker run -d --network akeneo --name akeneo \ | ||
-e WORKSPACE=${workspace} -e COMPOSER_HOME=/home/docker/.composer \ | ||
-v /home/akeneo/.composer:/home/docker/.composer -v \$(pwd):${workspace} \ | ||
-w ${workspace} \ | ||
carcel/akeneo:php-${phpVersion}" | ||
|
||
sh "docker ps -a" | ||
|
||
try { | ||
if (phpVersion != "5.6") { | ||
sh "docker exec akeneo composer require --no-update alcaeus/mongo-php-adapter" | ||
docker.image("mysql:5.5") | ||
.withRun("--name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=akeneo_pim -e MYSQL_PASSWORD=akeneo_pim -e MYSQL_DATABASE=akeneo_pim --tmpfs=/var/lib/mysql/:rw,noexec,nosuid,size=1000m --tmpfs=/tmp/:rw,noexec,nosuid,size=300m") { | ||
docker.image("akeneo/php:5.6") | ||
.inside("--link mysql:mysql -v /home/akeneo/.composer:/home/akeneo/.composer -e COMPOSER_HOME=/home/akeneo/.composer") { | ||
unstash "pim_enterprise" | ||
|
||
if (phpVersion != "5.6") { | ||
sh "composer require --no-update alcaeus/mongo-php-adapter" | ||
} | ||
|
||
sh """ | ||
composer config repositories.icecat '{"type": "vcs", "url": "[email protected]:akeneo/icecat-connector.git", "branch": "master"}' | ||
php -d memory_limit=3G /usr/local/bin/composer require phpunit/phpunit:5.4.* akeneo/icecat-connector:${Globals.extensionBranch} --no-interaction --no-progress --prefer-dist | ||
""" | ||
|
||
dir("vendor/akeneo/icecat-connector") { | ||
deleteDir() | ||
unstash "icecat_extension" | ||
} | ||
sh 'composer dump-autoload -o' | ||
|
||
sh """ | ||
rm app/cache/* -rf | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\IcecatConnectorBundle\\\\PimIcecatConnectorBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedMeasureBundle\\\\PimExtendedMeasureBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedAttributeTypeBundle\\\\PimExtendedAttributeTypeBundle(),#' app/AppKernel.php | ||
cat app/AppKernel.php | ||
""" | ||
|
||
sh """ | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/parameters_test.yml app/config/parameters_test.yml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/routing.yml >> app/config/routing.yml | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/phpunit.xml app/phpunit.xml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/config_test.yml >> app/config/config_test.yml | ||
mkdir -p app/build/logs | ||
""" | ||
|
||
sh "app/console pim:install --force --env=test" | ||
sh "bin/phpunit -c app/phpunit.xml --log-junit app/build/logs/phpunit.xml" | ||
} | ||
} | ||
|
||
sh """ | ||
docker exec akeneo composer config repositories.icecat '{"type": "vcs", "url": "[email protected]:akeneo/icecat-connector.git", "branch": "master"}' | ||
docker exec akeneo composer require --no-update akeneo/icecat-connector:${Globals.extensionBranch} | ||
docker exec akeneo php -d memory_limit=3G /usr/local/bin/composer update --optimize-autoloader --no-interaction --no-progress --prefer-dist | ||
""" | ||
|
||
dir("vendor/akeneo/icecat-connector") { | ||
deleteDir() | ||
unstash "icecat_extension" | ||
} | ||
sh 'docker exec akeneo composer dump-autoload -o' | ||
|
||
sh """ | ||
mkdir -p app/build/logs/ | ||
rm ./app/cache/* -rf | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\IcecatConnectorBundle\\\\PimIcecatConnectorBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedMeasureBundle\\\\PimExtendedMeasureBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedAttributeTypeBundle\\\\PimExtendedAttributeTypeBundle(),#' app/AppKernel.php | ||
cat app/AppKernel.php | ||
""" | ||
|
||
sh """ | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/parameters_test.yml app/config/parameters_test.yml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/routing.yml >> app/config/routing.yml | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/phpunit.xml app/phpunit.xml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/config_test.yml >> app/config/config_test.yml | ||
""" | ||
|
||
sh "docker exec akeneo app/console pim:install --force --env=test" | ||
|
||
sh 'mkdir -p app/build/logs/' | ||
sh 'docker exec akeneo bin/phpunit -c app/phpunit.xml --log-junit app/build/logs/phpunit.xml' | ||
|
||
} finally { | ||
junit "app/build/logs/*.xml" | ||
deleteDir() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ The Icecat Connector gives the capability to enrich Akeneo PIM product data with | |
|
||
| IcecatConnectorBundle | Akeneo PIM Community Edition | | ||
|:---------------------:|:----------------------------:| | ||
| 1.2.* | v1.7.* | | ||
| 1.1.* | v1.7.* | | ||
| 1.0.* | v1.6.* | | ||
|
||
|
@@ -48,6 +49,7 @@ There are 3 differents imports profiles in this extension: | |
First, you must require the connector dependencies: | ||
|
||
```php | ||
composer config repositories.icecat '{"type": "vcs", "url": "ssh://[email protected]:443/IcecatConnector", "branch": "master"}' | ||
composer require akeneo/icecat-connector 1.1.* | ||
``` | ||
|
||
|
@@ -82,6 +84,11 @@ In `app/AppKernel.php`: | |
} | ||
``` | ||
|
||
### Add new Mass Operation: | ||
``` | ||
app/console akeneo:batch:create-job "Akeneo Mass Edit Connector" "mass_edit_icecat_enrichment" "mass_edit" "mass_edit_icecat_enrichment" | ||
``` | ||
More explanation about the ProductValue override can be found in Akeneo documentation: | ||
https://docs.akeneo.com/1.7/cookbook/catalog_structure/overriding_the_orm_product_value.html | ||
|
@@ -95,6 +102,65 @@ akeneo_storage_utils: | |
override: Pim\Bundle\ExtendedCeBundle\Model\ProductValue | ||
``` | ||
|
||
### Mapping between Icecat locales and PIM locales | ||
By default, content in specific language are set into one locale. Here is the existing mapping: | ||
|
||
| Icecat locale | PIM Locale | ||
|---------------|----------- | ||
ZH_TW | zh_TW (Chinese - traditional)) | ||
EN_SG | en_SG (Singapore English) | ||
EN_IN | en_IN (Indian English) | ||
DE_CH | de_CH (Swiss German) | ||
INT | null (International standardized version) | ||
EN | en_GB (Standard or UK English) | ||
US | en_US (US English) | ||
NL | nl_NL (Dutch) | ||
FR | fr_FR (French) | ||
DE | de_DE (German) | ||
IT | it_IT (Italian) | ||
ES | es_ES (Spanish) | ||
DK | da_DK (Danish) | ||
RU | ru_RU (Russian) | ||
PT | pt_PT (Portuguese) | ||
BR | pt_BR (Brazilian Portuguese) | ||
ZH | zh_CN (Chinese (simplified)) | ||
SE | sv_SE (Swedish) | ||
PL | pl_PL (Polish) | ||
CZ | cs_CZ (Czech) | ||
HU | hu_HU (Hungarian) | ||
FI | fi_FI (Finnish) | ||
NO | nn_NO (Norwegian) | ||
TR | tr_TR (Turkish) | ||
BG | bg_BG (Bulgarian) | ||
KA | ka_GE (Georgian) | ||
RO | ro_RO (Romanian) | ||
SR | sr_RS (Serbian) | ||
JA | ja_JP (Japanese) | ||
UK | uk_UA (Ukrainian) | ||
CA | ca_ES (Catalan) | ||
HR | hr_HR (Croatian) | ||
AR | ar_SA (Arabic (Saudi Arabia)) | ||
VI | vi_VN (Vietnamese) | ||
HE | he_IL (Hebrew) | ||
KO | ko_KR (Korean) | ||
LT | lt_LT (Lithuanian) | ||
LV | lv_LV (Latvian) | ||
ID | id_ID (Indonesian) | ||
SK | sk_SK (Slovakian) | ||
|
||
If you need to customize, please add the following section in your `app/config/config.yml`: | ||
|
||
```yaml | ||
pim_icecat_connector: | ||
locale_mapping: | ||
EN: | ||
label: "Standard or UK English" | ||
locale: en_GB | ||
``` | ||
You can change any mapping this way. Only your changes are to be redefined, no need to rewrite | ||
all of them. | ||
### (Optionnal) Example bundles | ||
This connector is shipped with complete example bundle, especially to override the ProductValue model. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Pim\Bundle\IcecatConnectorBundle\Form\Type\MassAction; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
|
||
/** | ||
* This form type is used to provide possible users choices when performing the "icecat enrichment" mass action. | ||
* Since there are no information to expect from users, the class does not add any field to the form. | ||
* | ||
* @author Remy Betus <[email protected]> | ||
* @copyright 2017 Akeneo SAS (http://www.akeneo.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
class IcecatEnrichmentType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
{ | ||
$resolver->setDefaults( | ||
[ | ||
'data_class' => 'Pim\\Bundle\\IcecatConnectorBundle\\MassEditAction\\Operation\\IcecatEnrichment' | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return 'pim_icecat_mass_action_operation_icecat_enrichment'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Pim\Bundle\IcecatConnectorBundle\MassEditAction\Operation; | ||
|
||
use Pim\Bundle\EnrichBundle\MassEditAction\Operation\AbstractMassEditOperation; | ||
|
||
/** | ||
* This class describes what actions and options are available for the mass action. | ||
* In this case, we don't need to specify any of them as: | ||
* - locale/fallback locale are set in the Configuration screen | ||
* - channel choice is also set in the Configuration screen. | ||
* | ||
* In the future, it may be an idea to update this part so one can choose a different locale on-the-fly. | ||
* | ||
* @author Remy Betus <[email protected]> | ||
* @copyright 2017 Akeneo SAS (http://www.akeneo.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
class IcecatEnrichment extends AbstractMassEditOperation | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getOperationAlias() | ||
{ | ||
return 'icecat-enrichment'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormType() | ||
{ | ||
return 'pim_icecat_mass_action_operation_icecat_enrichment'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormOptions() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
pim_icecat.mass_action.form.type.icecat_enrichment: | ||
class: Pim\Bundle\IcecatConnectorBundle\Form\Type\MassAction\IcecatEnrichmentType | ||
tags: | ||
- { name: form.type, alias: pim_icecat_mass_action_operation_icecat_enrichment } |
Oops, something went wrong.