Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

TheMilek
Copy link
Member

@TheMilek TheMilek commented May 16, 2024

Q A
Branch? 2.0
Bug fix? no
New feature? no
BC breaks? no
License MIT

@TheMilek TheMilek added the Admin AdminBundle related issues and PRs. label May 16, 2024
@TheMilek TheMilek requested review from a team as code owners May 16, 2024 21:04
Copy link

github-actions bot commented May 16, 2024

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@TheMilek TheMilek force-pushed the SYL-3366 branch 2 times, most recently from c6efc07 to f31154d Compare May 17, 2024 05:48
Comment on lines +54 to +69
'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'
Copy link
Contributor

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.

{% 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 %}
Copy link
Contributor

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?

Copy link
Member Author

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 -

@GSadee
Copy link
Member

GSadee commented May 20, 2024

The base of this pull-request was changed, you need fetch and reset your local branch
if you want to add new commits to this pull request. Reset before you pull, else commits
may become messed-up.

Unless you added new commits (to this branch) locally that you did not push yet,
execute git fetch origin && git reset "SYL-3366" to update your local branch.

Feel free to ask for assistance when you get stuck 👍

@GSadee GSadee changed the base branch from bootstrap-admin-panel to 2.0 May 20, 2024 09:27
@TheMilek TheMilek force-pushed the SYL-3366 branch 5 times, most recently from 3aac79b to 532c997 Compare May 21, 2024 13:15
mpysiak
mpysiak previously approved these changes May 22, 2024
@@ -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
Copy link
Member

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 🤔

{% 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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Copy link
Contributor

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?

Comment on lines +12 to +28
<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 %}
Copy link
Contributor

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.

@TheMilek
Copy link
Member Author

The copy of this PR is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants