-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Admin][Product] Sort products within taxon #6612
Conversation
tuka217
commented
Nov 2, 2016
•
edited
Loading
edited
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | yes |
Related tickets | - |
License | MIT |
@@ -0,0 +1,113 @@ | |||
@managing_products | |||
Feature: Adding a new 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.
This feature title and body do not describe well enough what we are checking here.
Feature: Adding a new product with a position within a taxon
In order to organize products within taxons in my shop
As an Administrator
I want to assign positions in taxons to products when I create them
I would suggest sth like that.
And I add it | ||
Then I should be notified that it has been successfully created | ||
And the product "Old Pug" should appear in the shop | ||
And its position should be 0 in taxon "Soft Toys" |
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.
its position should be 0 in the "Soft Toys" taxon
When I specify its code as "OLD_PUG" | ||
And I name it "Old Pug" in "English (United States)" | ||
And I set its price to "$10.00" | ||
And I assign its to "Soft Toys" taxon |
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.
I assign it to the "Soft Toys" taxon
And its position should be 2 in taxon "Soft Toys" | ||
|
||
@todo | ||
Scenario: Adding a new simple product in many taxons with different positions |
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.
Adding a new simple product with different positions in many taxons
Scenario: Adding a new simple product without position | ||
And the store has a product "Young pug" | ||
And this product belongs to "Soft Toys" | ||
And this product is at position 1 at this taxon |
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.
this product is at position 1 in this taxon
And the last product on the list should have name "Small Pug" | ||
|
||
@todo | ||
Scenario: Shipping method added at no position is added as the last one |
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.
A shipping method added without position is added as the last one
b38ddfc
to
36d9593
Compare
3eafcb9
to
e113928
Compare
7b99692
to
b33fec4
Compare
…, which is used in ProductType
[CoreBundle][Core] Fix method (not use code, use id of taxon)
… of specific taxon [CoreBundle] Add Product Taxon Controller
c151f99
to
1a1bf28
Compare
Travis was stalled, so I needed to trigger the hook once again. |
Thank you Ania, nice work! :) |
How do we find if a product has a taxon if we only know the slug of the taxon now ? Suppose I have a filtered [...]
$taxon = $this->get('sylius.repository.taxon')->findOneBySlug($taxonSlug);
// Do I need to iterate over each productTaxon of each product ??
foreach ($products as $product) {
foreach($product->getProductTaxons() as $productTaxon) {
if ($productTaxon()->getTaxon() == $taxon) {
// filter or do whatever
}
}
} This seems a bit overkill, no ? Did I miss something ? |
How about something like:
|
Anyway the previous implementation would look almost exactly the same as yours now:
|
The for loop looks the same but doctrine hydrates thing differentely between the two, and performance can get tricky. I'll go with the Repository method I guess |
[Admin][Product] Sort products within taxon