valantic-spryker/price-product-customer-group-storage

此模块用于将客户组价格保存到存储中,并包含用于读取它们的插件。

1.0.0 2023-08-01 15:26 UTC

This package is auto-updated.

Last update: 2024-09-09 12:30:32 UTC


README

Minimum PHP Version

此模块用于将客户组价格保存到存储中,并包含用于读取它们的插件。

安装包

composer req valantic-spryker/price-product-customer-group-storage

注册插件

src/Pyz/Zed/Event/EventDependencyProvider.php

use ValanticSpryker\Zed\PriceProductCustomerGroupStorage\Communication\Plugin\Event\Subscriber\PriceProductCustomerGroupStorageEventSubscriber;

...

public function getEventSubscriberCollection()
{
    ...
    $eventSubscriberCollection->add(new PriceProductCustomerGroupStorageEventSubscriber());
    ...
}

src/Pyz/Zed/Synchronization/SynchronizationDependencyProvider.php

use \ValanticSpryker\Zed\PriceProductCustomerGroupStorage\Communication\Plugin\Synchronization\PriceProductAbstractCustomerGroupSynchronizationDataBulkPlugin
use \ValanticSpryker\Zed\PriceProductCustomerGroupStorage\Communication\Plugin\Synchronization\PriceProductConcreteCustomerGroupSynchronizationDataBulkPlugin

...

protected function getSynchronizationDataPlugins(): array
{
    return [
        ...
        new PriceProductAbstractCustomerGroupSynchronizationDataBulkPlugin(),
        new PriceProductConcreteCustomerGroupSynchronizationDataBulkPlugin(),
    ];
}

src/Pyz/Client/PriceProductStorage/PriceProductStorageDependencyProvider.php

use ValanticSpryker\Client\PriceProductCustomerGroupStorage\Plugin\PriceProductStorageExtension\PriceProductCustomerGroupStorageDimensionPlugin;

...

public function getPriceDimensionStorageReaderPlugins(): array
{
    return [
        ...
        new PriceProductCustomerGroupStorageDimensionPlugin(),
    ];
}

src/Pyz/Zed/EventBehavior/EventBehaviorDependencyProvider.php

use ValanticSpryker\Zed\PriceProductCustomerGroupStorage\Communication\Plugin\Event\PriceProductAbstractCustomerGroupEventResourceBulkRepositoryPlugin;
use ValanticSpryker\Zed\PriceProductCustomerGroupStorage\Communication\Plugin\Event\PriceProductConcreteCustomerGroupEventResourceBulkRepositoryPlugin;

...

protected function getEventTriggerResourcePlugins()
{
    return [
        ...
        new PriceProductAbstractCustomerGroupEventResourceBulkRepositoryPlugin(),
        new PriceProductConcreteCustomerGroupEventResourceBulkRepositoryPlugin(),
    ];
}

创建项目级别的模块配置

src/Pyz/Zed/PriceProductCustomerGroupStorage/PriceProductCustomerGroupStorageConfig.php

<?php

declare(strict_types = 1);

namespace Pyz\Zed\PriceProductCustomerGroupStorage;

use Pyz\Zed\Synchronization\SynchronizationConfig;
use ValanticSpryker\Zed\PriceProductCustomerGroupStorage\PriceProductCustomerGroupStorageConfig as VsyPriceProductCustomerGroupStorageConfig;

class PriceProductCustomerGroupStorageConfig extends VsyPriceProductCustomerGroupStorageConfig
{
    /**
     * @return string|null
     */
    public function getPriceProductConcreteCustomerGroupSynchronizationPoolName(): ?string
    {
        return SynchronizationConfig::DEFAULT_SYNCHRONIZATION_POOL_NAME;
    }

    /**
     * @return string|null
     */
    public function getPriceProductAbstractCustomerGroupSynchronizationPoolName(): ?string
    {
        return SynchronizationConfig::DEFAULT_SYNCHRONIZATION_POOL_NAME;
    }
}

启用事件行为

src/Pyz/Zed/PriceProductCustomerGroup/Persistence/Propel/Schema/vsy_price_product_customer_group.schema.xml

<?xml version="1.0"?>
<database
    xmlns="spryker:schema-01"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    name="zed"
    xsi:schemaLocation="spryker:schema-01 https://static.spryker.com/schema-01.xsd"
    namespace="Orm\Zed\PriceProductCustomerGroup\Persistence"
    package="src.Orm.Zed.PriceProductCustomerGroup.Persistence"
>

    <table name="vsy_price_product_customer_group">
        <behavior name="event">
            <parameter name="vsy_price_product_customer_group_all" column="*"/>
        </behavior>
    </table>

</database>

迁移数据库并生成转换

propel:install, transfer:generate