Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Added SKU field
Browse files Browse the repository at this point in the history
  • Loading branch information
tonipinel committed Jun 9, 2015
1 parent 3d67306 commit db86c4a
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ admin:
dimensions:
title: Dimensions
description: "Configura les dimensions i el pes del teu producte. Aquesta informació serà molt útil per a calcular les despeses d'enviament."
sku:
title: Número de referencia
description: "El Número de referencia (SKU) es un identificador unic que permeteix identificar els productes. Cada SKU va relacionat a un producte."
variants:
title: Variants
description: 'Les variants son diferents versions del mateix producte (Color, talla...) que poden tenir un preu o atributs diferents.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@ admin:
name:
title: Title
placeholder: e.g. My Awesome Product
sku:
title: SKU
placeholder: ej. SAU102
slug:
title: Slug
placeholder: e.g. my/awesome/product
Expand Down Expand Up @@ -686,6 +689,9 @@ admin:
dimensions:
title: Dimensions
description: "Set the dimensions and weight for your product. This information will be useful to calculate shipping costs."
sku:
title: SKU
description: "SKU is an identifier that allows to identify the products. Each SKU it's related to just one product."
variants:
title: Variants
description: 'Variants are diferent versions of this product (color, size... ). Variants can have different prices or other attributes.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@ admin:
name:
title: Título
placeholder: ej. Mi genial producto
sku:
title: Número de referencia
placeholder: ej. SAU102
slug:
title: Slug
placeholder: ej. my/genial/producto
Expand Down Expand Up @@ -685,6 +688,9 @@ admin:
dimensions:
title: Dimensiones
description: "Configura las dimensiones y peso de tu producto. Esta información será realmente útil para calcular los costes de envio."
sku:
title: Número de referencia
description: "El Número de referencia (SKU) es un identificador único que permite identificar los productos. Cada SKU se asocia con un sólo producto."
variants:
title: Variantes
description: 'Las variantes son versiones diferentes del mismo producto (Color, talla...). Las variantes pueden tener diferente precio o atributos.'
Expand Down
3 changes: 3 additions & 0 deletions src/Elcodi/Admin/ProductBundle/Form/Type/ProductType.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('stock', 'hidden', [
'required' => true,
])
->add('sku', 'text', [
'required' => false,
])
->add('price', 'money_object', [
'required' => true,
'constraints' => [
Expand Down
3 changes: 3 additions & 0 deletions src/Elcodi/Admin/ProductBundle/Form/Type/VariantType.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('stock', 'number', [
'required' => false,
])
->add('sku', 'text', [
'required' => false,
])
->add('price', 'money_object', [
'required' => false,
'constraints' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,47 +228,74 @@
</div>
<div class="ph-n pt-m mb-n">
<div class="box-background pv-s mb-n">
<a data-fc-modules="toggle" href="#dimensions-edit"><i class="icon-plus-circle"></i> {{ 'admin.product.section.dimensions.title'|trans }}</a>
<a data-fc-modules="toggle" href="#dimensions-edit"><i class="icon-plus-circle"></i> {{ 'admin.product.section.dimensions.title'|trans }} {% if not product.hasVariants() %}/ {{ 'admin.product.section.sku.title'|trans }}{% endif %}</a>
</div>
<div id="dimensions-edit" class="grid hidden pt-s">
<div class="col-1-3">
<div class="box-none">
<h3 class="fw-n">{{ 'admin.product.section.dimensions.title'|trans }}</h3>
<p>{{ 'admin.product.section.dimensions.description'|trans }}</p>
<div id="dimensions-edit" class="hidden">
<div class="grid pt-s">
<div class="col-1-3">
<div class="box-none">
<h3 class="fw-n">{{ 'admin.product.section.dimensions.title'|trans }}</h3>
<p>{{ 'admin.product.section.dimensions.description'|trans }}</p>
</div>
</div>
</div>
<div class="col-2-3">
<div class="box pb-n">
<ol class="grid">
<li class="col-1-4 pr-l">
{{
<div class="col-2-3">
<div class="box pb-n">
<ol class="grid">
<li class="col-1-3">
<div class="pr-l">
{{
form_row(form.width, {
label: 'admin.product.field.width.title',
})
}}
</div>
</li>
<li class="col-1-3">
<div class="pr-l">
{{
form_row(form.height, {
label: 'admin.product.field.height.title',
})
}}
</div>
</li>
<li class="col-1-3">
<div class="pr-l">
{{
form_row(form.depth, {
label: 'admin.product.field.depth.title',
})
}}
</div>
</li>
</ol>
<ol>
<li class="col-1-3">
{{
form_row(form.weight, {
label: 'admin.product.field.weight.title',
})
}}
</li>
<li class="col-1-4 pr-l">
{{
form_row(form.width, {
label: 'admin.product.field.width.title',
})
}}
</li>
<li class="col-1-4 pr-l">
{{
form_row(form.height, {
label: 'admin.product.field.height.title',
})
}}
</li>
<li class="col-1-4 pr-l">
{{
form_row(form.depth, {
label: 'admin.product.field.depth.title',
})
}}
</li>
</ol>
}}
</li>
</ol>
</div>
</div>
</div>
<div class="grid {% if product.hasVariants() %}hidden{% endif %}">
<div class="col-1-3">
<div class="box-none">
<h3 class="fw-n">{{ 'admin.product.section.sku.title'|trans }}</h3>
<p>{{ 'admin.product.section.sku.description'|trans }}</p>
</div>
</div>
<div class="col-2-3">
<div class="box">
{{
form_row(form.sku, {
label: 'admin.product.field.sku.title',
})
}}
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,23 @@
</div>
</div>
</div>

<div class="grid">
<div class="col-1-3">
<div class="box-none">
<h3 class="fw-n">{{ 'admin.product.section.sku.title'|trans }}</h3>
<p>{{ 'admin.product.section.sku.description'|trans }}</p>
</div>
</div>
<div class="col-2-3">
<div class="box">
{{
form_row(form.sku, {
label: 'admin.product.field.sku.title',
})
}}
</div>
</div>
</div>
{% include '@AdminMedia/Module/_images-form-field.html.twig' with {
images: variant.images,
} %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@
id: entity.id,
})
}}">
{% set optionName = '' %}
{% for option in entity.options %}
{{ option.value }}
{% set optionName = optionName + option.value + ' ' %}
{% endfor %}
{% if optionName|replace(' ','') == '' %}
{{ 'admin.variant.single'|trans }}
{% else %}
{{ optionName }}
{% endif %}
</a>
</td>
<td>
Expand Down

0 comments on commit db86c4a

Please sign in to comment.