Upgrade the PriceProduct module
Edit on GitHubUpgrading from version 2.* to version 4.*
In order to dismantle the Horizontal Barrier and enable partial module updates on projects, a Technical Release took place. Public API of source and target major versions are equal. No migration efforts are required. Please contact us if you have any questions.
Upgrading from version 1.* to version 2.*
There are new functionalities and changes that were added in this new module release. First of all, the changes imply implementation of the Price Dimension concept as well as adding of Service layer with PriceProductService. See PriceProduct module details: Reference information for details.
In the previous version of the PriceProduct module, a product had only one price per store (and multi-currency) with gross and net amounts. By adding the Price dimension concept to the new release, you can set specific prices for each customer separately. Having logged in, a user with these specific prices will see another prices in Catalog and will be able to buy products for their own price.
To save BC, we have implemented Default Price Dimension inside the new PriceProduct
module, so all prices imported by new PriceProductDataImport
will be in the Default Price Dimension. See Prices per Merchant Relation to learn more about the price dimension.
Prices from price dimensions could be stored not only in DB, but also in Storage. Therefore, the update of the PriceProductStorage module was necessary. The new version 2.0.0 of the PriceProduct module already supports price dimensions and has Default Price Dimension implemented.
To migrate the changes to the module, do the following:
- Upgrade your database structure by running
console propel:install
-
Enable the new
PriceProductDataImport
module:- Remove project level
PriceProductDataImport
(Pyz\Zed\DataImport\Business\Model\ProductPrice\ProductPriceWriterStep
) from\Pyz\Zed\DataImport\Business\DataImportBusinessFactory
; - Install the new importer module:
composer install spryker/price-product-data-import
- Enable the module by adding
\Spryker\Zed\PriceProductDataImport\Communication\Plugin\PriceProductDataImportPlugin
to\Pyz\Zed\DataImport\DataImportDependencyProvider::getDataImporterPlugins()
- Remove project level
If you have customized PriceProductDataImport
on the project level, you are still able to continue using it. The only thing you have to do is to add $this->savePriceProductDefault($priceProductStoreEntity->getPrimaryKey());
at the end of your PriceProductWriterStep
.
/**
* @param string $idPriceProductStore
*
* @return void
*/
protected function savePriceProductDefault(string $idPriceProductStore): void
{
$priceProductDefaultEntity = SpyPriceProductDefaultQuery::create()
->filterByFkPriceProductStore($idPriceProductStore)
->findOneOrCreate();
if ($priceProductDefaultEntity->isNew()) {
$priceProductDefaultEntity->save();
}
}
- Update
PriceProductStorage
by running the command:
composer require spryker/price-product-storage:"^2.0.0"
Now that the module supports plugins for reading prices from different price dimensions, you can put your own plugins here:
\Pyz\Client\PriceProductStorage\PriceProductStorageDependencyProvider::getPriceDimensionStorageReaderPlugins()
Thank you!
For submitting the form