-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Shop][Product] Display product original price on product page #11200
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @viewing_products | ||
| Feature: Viewing a product discounted price | ||
| In order to see products discounted price | ||
| As a Visitor | ||
| I want to be able to view a single product discounted price | ||
|
|
||
| Background: | ||
| Given the store operates on a single channel in "United States" | ||
|
|
||
| @ui | ||
| Scenario: Viewing a detailed page with product's original price | ||
| Given the store has a product "T-shirt banana" priced at "$39.00" | ||
| Given the product "T-shirt banana" has original price at "$50.00" | ||
| When I check this product's details | ||
| Then I should see the product price "$39.00" | ||
| Then I should see the product original price "$50.00" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
| {% import "@SyliusShop/Common/Macro/money.html.twig" as money %} | ||
|
|
||
| <span class="ui huge header" id="product-price" {{ sylius_test_html_attribute('product-price', money.calculatePrice(product|sylius_resolve_variant)) }}> | ||
| {{ money.calculatePrice(product|sylius_resolve_variant) }} | ||
| {% set variant = product|sylius_resolve_variant %} | ||
| {% set hasDiscount = variant|sylius_has_discount({'channel': sylius.channel}) %} | ||
|
|
||
| {% if hasDiscount %} | ||
| <span class="ui small header" id="product-original-price" {{ sylius_test_html_attribute('product-original-price', money.calculateOriginalPrice(variant)) }}> | ||
| <del>{{ money.calculateOriginalPrice(variant) }}</del> | ||
| </span> | ||
| {% endif %} | ||
|
|
||
| <span class="ui huge header" id="product-price" {{ sylius_test_html_attribute('product-price', money.calculatePrice(variant)) }}> | ||
| {{ money.calculatePrice(variant) }} | ||
| </span> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,4 +22,9 @@ interface ProductVariantPriceCalculatorInterface | |
| * @throws MissingChannelConfigurationException when price for given channel does not exist | ||
| */ | ||
| public function calculate(ProductVariantInterface $productVariant, array $context): int; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a BC Break.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true, we cannot merge this PR due to this change. Maybe just a separate service could do the job? Or a new one |
||
| /** | ||
| * @throws MissingChannelConfigurationException when price for given channel does not exist | ||
| */ | ||
| public function calculateOriginal(ProductVariantInterface $productVariant, array $context): int; | ||
| } | ||
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 is a BC Break.
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.
Behats are not covered with our BC promise ;)