Skip to content

Commit

Permalink
move channel pricing to separete tab
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKasp committed Oct 18, 2021
1 parent 7945169 commit ae8a6bb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public function createMenu(array $options = []): ItemInterface
->setLabel('sylius.ui.inventory')
;

$menu
->addChild('channelPricings')
->setAttribute('template', '@SyliusAdmin/ProductVariant/Tab/_channelPricings.html.twig')
->setLabel('sylius.ui.product_variant.channel_pricings')
;

$this->eventDispatcher->dispatch(
new ProductVariantMenuBuilderEvent($this->factory, $menu, $options['product_variant']),
self::EVENT_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ sylius:
ui:
product:
product_not_active_in_channel: The product is not yet activated in this channel.
product_variant:
channel_pricings: Channel Pricings
original_price_details: Original price - this is the price of the product variant It is displayed as crossed-out in the catalog. It is used as the base for current price calculations. If this value is not definded, Catalog Promotion logic will copy value from Price to Original Price
price_details: Price - this is the current price of the product variant displayed in the catalog. It can be modified explicitly by i.e. catalog promotions.
gateway:
no_sca_support_notice: The chosen payment gateway does not support SCA.
pay_pal_express_checkout_deprecation_notice: >
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="ui tab" data-tab="channelPricings">
<h3 class="ui dividing header">{{ 'sylius.ui.product_variant.channel_pricings'|trans }}</h3>
<div class="ui info message">
{{ 'sylius.ui.price_details'|trans }}
<br/>
{{ 'sylius.ui.original_price_details'|trans }}
</div>
<div id="sylius_product_variant_channelPricings">
{{ form_errors(form.channelPricings) }}
{% for channelCode, channelPricing in form.channelPricings %}
<div class="ui segment">
<div>
<strong>{{ channelPricing.vars.label }}</strong>
</div>
{% if channelCode not in product_variant.product.channels|map(channel => channel.code) %}
<div class="ui info message">
{{ 'sylius.ui.product.product_not_active_in_channel'|trans }}
</div>
{% endif %}
{{ form_row(channelPricing.price) }}
{{ form_row(channelPricing.originalPrice) }}
</div>
{% endfor %}
</div>

{{ sylius_template_event(['sylius.admin.product_variant.' ~ action ~ '.tab_channel_pricings', 'sylius.admin.product_variant.channelPricings'], {'form': form}) }}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
<div class="ui segment">
{{ form_row(form.code) }}
{{ form_row(form.enabled) }}
</div>
<div class="ui hidden divider"></div>
<div class="ui segment">
<div class="two fields">
{{ form_row(form.shippingCategory) }}
</div>
{{form_label(form.channelPricings)}}
{% include "@SyliusAdmin/Product/_channel_pricing.html.twig" with { product: product_variant.product, variantForm: form } only %}
</div>
<div class="ui segment">
<div class="one field">
{{ form_row(form.shippingRequired) }}
</div>
Expand Down

0 comments on commit ae8a6bb

Please sign in to comment.