-
Notifications
You must be signed in to change notification settings - Fork 4
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
Configure number of synchronised products in Channel configuration #32
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we're missing validation for the number_of_synchronised_products
on the channel.
@@ -32,7 +33,12 @@ public function __invoke(SynchronizationEnded $event): void | |||
Assert::allIsInstanceOf($products, BoughtTogetherProductsAwareInterface::class); | |||
|
|||
foreach ($products as $product) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there can be a lot of products, it would be nice to flush every x products besides the one after all.
$numberOfProducts = max($numberOfProducts, $channel->getNumberOfSynchronisedProducts()); | ||
} | ||
|
||
if ($numberOfProducts === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($numberOfProducts === 0) { | |
if ($numberOfProducts <= 0) { |
Covering an edge case
@@ -5,3 +5,8 @@ sylius_ui: | |||
commerce_weavers_sylius_also_bought_missing_configuration: | |||
template: '@CommerceWeaversSyliusAlsoBoughtPlugin/_missing_configuration.html.twig' | |||
priority: 40 | |||
sylius.admin.channel.form.second_column_content: | |||
blocks: | |||
commerce_weavers_sylius_also_bought_number_of_synchronised_products: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commerce_weavers_sylius_also_bought_number_of_synchronised_products: | |
commerce_weavers_sylius_also_bought_number_of_synchronized_products: |
just because in different places, we already use the US version with z
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for twig tempalte file name etc.
@@ -0,0 +1,22 @@ | |||
@managing_channels | |||
Feature: Managing number of items on channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not detailed enough IMHO. I'd specify which items eg. Managing number of items to synchronize on channel
{ | ||
/** @ORM\Column(name="number_of_synchronised_products", type="integer", nullable=false, options={"default": 10}) */ | ||
#[ORM\Column(name: 'number_of_synchronised_products', type: 'integer', nullable: false, options: ['default' => 10])] | ||
private int $numberOfSynchronisedProducts = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private int $numberOfSynchronisedProducts = 10; | |
private int $numberOfSynchronizedProducts = 10; |
Closes #22
TODO: