Skip to content

Commit

Permalink
Merge pull request #151 from Setono/add-product-create-gc
Browse files Browse the repository at this point in the history
Allow to create Product GC from API
  • Loading branch information
Roshyo authored Sep 3, 2021
2 parents f85c6c5 + bcac310 commit adc7513
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
12 changes: 12 additions & 0 deletions src/Resources/config/serialization/Product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" ?>

<serializer xmlns="http://symfony.com/schema/dic/serializer-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
>
<class name="Sylius\Component\Core\Model\Product">
<attribute name="giftCard">
<group>admin:product:create</group>
</attribute>
</class>
</serializer>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{{ form_row(form.code) }}
{{ form_row(form.enabled) }}
{{ form_row(form.giftCard) }}

{% if product.simple %}
{{ form_row(form.variant.shippingRequired) }}
{% else %}
Expand All @@ -24,20 +23,23 @@
<div class="ui hidden element">
{% if product.simple %}
{{ form_row(form.variant.translations) }}
{{ form_row(form.variantSelectionMethod) }}
{% endif %}
{{ form_row(form.variantSelectionMethod) }}
</div>
</div>
</div>
<div class="column">
{{ form_row(form.channels) }}

{% if product.simple %}
<h4 class="ui dividing header">{{ 'sylius.ui.pricing'|trans }}</h4>
{{ form_row(form.variant.channelPricings, {'label': false}) }}
{% endif %}
</div>
</div>
{% if product.simple %}
<div class="ui one column stackable grid">
<div class="column">
<h4 class="ui dividing header">{{ 'sylius.ui.pricing'|trans }}</h4>
{% include "@SyliusAdmin/Product/_channel_pricing.html.twig" with { product: product, variantForm: form.variant } only %}
</div>
</div>
{% endif %}
<div class="ui hidden divider"></div>
{{ translationFormWithSlug(form.translations, '@SyliusAdmin/Product/_slugField.html.twig', product) }}
{% if product.simple %}
Expand All @@ -62,6 +64,6 @@
</div>
{% endif %}

{{ sonata_block_render_event('sylius.admin.product.' ~ action ~ '.tab_details', {'form': form}) }}
{{ sylius_template_event(['sylius.admin.product.' ~ action ~ '.tab_details', 'sylius.admin.product.tab_details'], {'form': form}) }}
</div>
</div>

0 comments on commit adc7513

Please sign in to comment.