-
-
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
Make admin product show simple and configurable page more granular #16267
Conversation
TheMilek
commented
May 16, 2024
•
edited
edited
Q | A |
---|---|
Branch? | 2.0 |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
License | MIT |
Bunnyshell Preview Environment deletedAvailable commands:
|
c6efc07
to
f31154d
Compare
'sylius_admin.product.show.content.page_body.details.simple_product.shipping': | ||
shipping_category: | ||
template: '@SyliusAdmin/product/show/content/page_body/details/shared/shipping/shipping_category.html.twig' | ||
width: | ||
template: '@SyliusAdmin/product/show/content/page_body/details/shared/shipping/width.html.twig' | ||
height: | ||
template: '@SyliusAdmin/product/show/content/page_body/details/shared/shipping/height.html.twig' | ||
depth: | ||
template: '@SyliusAdmin/product/show/content/page_body/details/shared/shipping/depth.html.twig' | ||
weight: | ||
template: '@SyliusAdmin/product/show/content/page_body/details/shared/shipping/weight.html.twig' |
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.
Just a thought, but can we make a details.common
hook and set it as one of the prefixes for data that's the same between configurable/simple?
Right now there's a lot of duplication.
Unless the prefixing logic is not yet released, in which case, welp.
...plates/product/show/content/page_body/details/configurable_product/details/pricing.html.twig
Outdated
Show resolved
Hide resolved
...plates/product/show/content/page_body/details/configurable_product/details/pricing.html.twig
Outdated
Show resolved
Hide resolved
...uct/show/content/page_body/details/shared/pricing/lowest_price_before_the_discount.html.twig
Outdated
Show resolved
Hide resolved
{% set channel = attribute(channels, channel_pricing.channelCode) %} | ||
{% set currency_code = channel.baseCurrency.code %} | ||
{% set price = channel_pricing.price %} | ||
{% set original_price = channel_pricing.originalPrice ?? 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.
Why are you defaulting the originalPrice
here, but the lowestPriceBeforeDiscount
in the hooked template?
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.
There is a problem with setting it, when it's null there is no variable I can base on in the hooked template and I've got problems with showing the -
.../templates/product/show/content/page_body/details/configurable_product/tab/product.html.twig
Outdated
Show resolved
Hide resolved
.../templates/product/show/content/page_body/details/configurable_product/tab/enabled.html.twig
Outdated
Show resolved
Hide resolved
...uct/show/content/page_body/details/shared/pricing/lowest_price_before_the_discount.html.twig
Outdated
Show resolved
Hide resolved
...AdminBundle/templates/product/show/content/page_body/details/shared/shipping/width.html.twig
Outdated
Show resolved
Hide resolved
...tes/product/show/content/page_body/details/configurable_product/tab/details_button.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/product/show.yaml
Outdated
Show resolved
Hide resolved
The base of this pull-request was changed, you need fetch and reset your local branch Unless you added new commits (to this branch) locally that you did not push yet, Feel free to ask for assistance when you get stuck 👍 |
3aac79b
to
532c997
Compare
@@ -15,5 +15,5 @@ Feature: Accessing the price history from the configurable product show page | |||
Scenario: Being able to access the price history of variant from the configurable product show page | |||
Given I am browsing products | |||
When I access the "Wyborowa Vodka" product | |||
And I access the price history of a product variant "Wyborowa Vodka Exquisite" for "United States" 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.
This channel
keyword could stay 🤔
src/Sylius/Bundle/AdminBundle/templates/order/show/content/sections/items/body/item.html.twig
Outdated
Show resolved
Hide resolved
...uct/show/content/page_body/details/shared/pricing/lowest_price_before_the_discount.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/templates/shared/helper/shop/product.html.twig
Outdated
Show resolved
Hide resolved
{% set channel = hookable_metadata.context.channel %} | ||
{% set variant = hookable_metadata.context.variant %} | ||
|
||
<td class="text-end" {{ sylius_test_html_attribute('lowest-price-before-the-discount', '%s.%s'|format(variant.code, channel.code)) }}>{% if channel_pricing.lowestPriceBeforeDiscount != null %}{{ money(channel_pricing.lowestPriceBeforeDiscount, currency_code) }}{% else %} - {% endif %}</td> |
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.
<td class="text-end" {{ sylius_test_html_attribute('lowest-price-before-the-discount', '%s.%s'|format(variant.code, channel.code)) }}>{% if channel_pricing.lowestPriceBeforeDiscount != null %}{{ money(channel_pricing.lowestPriceBeforeDiscount, currency_code) }}{% else %} - {% endif %}</td> | |
<td class="text-end" {{ sylius_test_html_attribute('lowest-price-before-the-discount', '%s.%s'|format(variant.code, channel.code)) }}> | |
{% if channel_pricing.lowestPriceBeforeDiscount != null %} | |
{{ money(channel_pricing.lowestPriceBeforeDiscount, currency_code) }} | |
{% else %} | |
- | |
{% endif %} | |
</td> |
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.
Maybe change the name of the file to product_image?
<th>{{ 'sylius.ui.channel'|trans }}</th> | ||
<th class="text-end">{{ 'sylius.ui.price'|trans }}</th> | ||
<th class="text-end">{{ 'sylius.ui.original_price'|trans }}</th> | ||
<th class="text-end">{{ 'sylius.ui.lowest_price_before_discount'|trans }}</th> | ||
<th class="text-end">{{ 'sylius.ui.discounted_by'|trans }}</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for channel_pricing in variant.channelPricings %} | ||
{% set channel = attribute(channels, channel_pricing.channelCode) %} | ||
{% set currency_code = channel.baseCurrency.code %} | ||
|
||
<tr {{ sylius_test_html_attribute('variant-pricing', '%s.%s'|format(channel.code, variant.code)) }} > | ||
{% hook 'pricing' with { variant, channel, channel_pricing, currency_code } %} | ||
</tr> | ||
{% endfor %} |
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 bit problematic, I can add more data via the hook, but I cannot label them, since headers are static.
The copy of this PR is here |