Add import description

modifié:         core/lib/Thelia/Config/Resources/import.xml
	modifié:         core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php
	modifié:         templates/backOffice/default/ajax/export-modal.html
	modifié:         templates/backOffice/default/ajax/import-modal.html
	modifié:         templates/backOffice/default/export-page.html
	modifié:         templates/backOffice/default/export.html
	modifié:         templates/backOffice/default/import-page.html
	modifié:         templates/backOffice/default/import.html
This commit is contained in:
Benjamin Perche
2014-07-22 16:35:25 +02:00
parent 8a39b1215e
commit 749d55102c
8 changed files with 115 additions and 36 deletions

View File

@@ -14,18 +14,67 @@
<import id="thelia.import.stock" class="Thelia\ImportExport\Import\Type\ProductStockImport" category_id="thelia.import.products"> <import id="thelia.import.stock" class="Thelia\ImportExport\Import\Type\ProductStockImport" category_id="thelia.import.products">
<import_descriptive locale="fr_FR"> <import_descriptive locale="fr_FR">
<title>Importez votre stock</title> <title>Importez votre stock</title>
<description>
<![CDATA[
Your file must have the following columns to work:
<ul>
<li>ref: The reference of your product Attribute Combinations </li>
<li>stock: The quantity of product you have </li>
</ul>
]]>
</description>
</import_descriptive> </import_descriptive>
<import_descriptive locale="en_US"> <import_descriptive locale="en_US">
<title>Import your stock</title> <title>Import your stock</title>
<description>
<![CDATA[
Your file must have the following columns to work:
<ul>
<li>ref: The reference of your product attribute combinations </li>
<li>stock: The quantity of product you have </li>
</ul>
It can have the column "ean" that defines the product's EAN code.
]]>
</description>
</import_descriptive> </import_descriptive>
</import> </import>
<import id="thelia.import.price" class="Thelia\ImportExport\Import\Type\ProductPricesImport" category_id="thelia.import.products"> <import id="thelia.import.price" class="Thelia\ImportExport\Import\Type\ProductPricesImport" category_id="thelia.import.products">
<import_descriptive locale="fr_FR"> <import_descriptive locale="fr_FR">
<title>Importez vos prix Hors-Taxes</title> <title>Importez vos prix Hors-Taxes</title>
<description>
<![CDATA[
Votre fichier doit avoir les colonnes suivantes:
<ul>
<li>ref: La reférénce de votre déclinaison de combinaison de produit</li>
<li>price: Le prix Hors-Taxes de votre déclinaison de combinaison de produit</li>
</ul>
Il peut aussi optionnellement avoir ces colonnes:
<ul>
<li>currency: Le code de la monnaie (exemple: EUR, USD)</li>
<li>promo_price: Le prix promotionnel Hors-Taxes de votre déclinaison de combinaison de produit</li>
<li>promo: Si cette valeur est a 0, désactive la promotion, si elle est a 1, l'active</li>
</ul>
]]>
</description>
</import_descriptive> </import_descriptive>
<import_descriptive locale="en_US"> <import_descriptive locale="en_US">
<title>Import your prices excluding taxes</title> <title>Import your prices excluding taxes</title>
<description>
<![CDATA[
Your file must have the following columns:
<ul>
<li>ref: The reference of the product attribute combinations</li>
<li>price: The price excluding taxes of the product attribute combinations</li>
</ul>
It may also optionally have those columns:
<ul>
<li>currency: the currency code (example: EUR, USD)</li>
<li>promo_price: the promo price excluding taxes of the product attribute combinations</li>
<li>promo: If this value is 0, set the product not in promo, if 1, it sets the product in promo</li>
</ul>
]]>
</description>
</import_descriptive> </import_descriptive>
</import> </import>
</imports> </imports>

View File

@@ -12,7 +12,6 @@
namespace Thelia\ImportExport\Import\Type; namespace Thelia\ImportExport\Import\Type;
use Thelia\Core\FileFormat\Formatting\FormatterData; use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\Core\Translation\Translator;
use Thelia\Core\FileFormat\FormatType; use Thelia\Core\FileFormat\FormatType;
use Thelia\ImportExport\Import\ImportHandler; use Thelia\ImportExport\Import\ImportHandler;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
@@ -24,8 +23,6 @@ use Thelia\Model\ProductSaleElementsQuery;
*/ */
class ProductStockImport extends ImportHandler class ProductStockImport extends ImportHandler
{ {
/** /**
* @param \Thelia\Core\FileFormat\Formatting\FormatterData * @param \Thelia\Core\FileFormat\Formatting\FormatterData
* @return string|array error messages * @return string|array error messages
@@ -52,11 +49,13 @@ class ProductStockImport extends ImportHandler
] ]
); );
} else { } else {
$obj $obj->setQuantity($row["stock"]);
->setQuantity($row["stock"])
->setEanCode($row["ean"]) if (isset($row["ean"]) && !empty($row["ean"])) {
->save() $obj->setEanCode($row["ean"]);
; }
$obj->save();
$this->importedRows++; $this->importedRows++;
} }
} }
@@ -66,7 +65,7 @@ class ProductStockImport extends ImportHandler
protected function getMandatoryColumns() protected function getMandatoryColumns()
{ {
return ["ref", "stock", "ean"]; return ["ref", "stock"];
} }
/** /**

View File

@@ -9,6 +9,15 @@
<h4 class="modal-title" id="export-modal-label">Export: {$TITLE}</h4> <h4 class="modal-title" id="export-modal-label">Export: {$TITLE}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
{if $DESCRIPTION}
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
{$DESCRIPTION nofilter}
</div>
</div>
</div>
{/if}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{ifloop rel="export-formatters"} {ifloop rel="export-formatters"}

View File

@@ -9,6 +9,15 @@
<h4 class="modal-title" id="import-modal-label">Import: {$TITLE}</h4> <h4 class="modal-title" id="import-modal-label">Import: {$TITLE}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
{if $DESCRIPTION}
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
{$DESCRIPTION nofilter}
</div>
</div>
</div>
{/if}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{form_field form=$form field="language"} {form_field form=$form field="language"}

View File

@@ -39,6 +39,16 @@
{intl l='Export'}: {$TITLE} {intl l='Export'}: {$TITLE}
</div> </div>
{if $DESCRIPTION}
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
{$DESCRIPTION nofilter}
</div>
</div>
</div>
{/if}
<form action="{$URL}" method="post" {form_enctype form=$form}> <form action="{$URL}" method="post" {form_enctype form=$form}>
{form_hidden_fields form=$form} {form_hidden_fields form=$form}
<div class="row"> <div class="row">

View File

@@ -100,7 +100,7 @@
<a href="#category_{$category_title}" class="btn-show-export-modal" data-id="{$ID}" data-url="{$URL}">{$TITLE}</a> <a href="#category_{$category_title}" class="btn-show-export-modal" data-id="{$ID}" data-url="{$URL}">{$TITLE}</a>
</td> </td>
<td> <td>
{$DESCRIPTION} {$DESCRIPTION nofilter}
</td> </td>
<td> <td>
<a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}#category_{$category_title}"}"> <a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}#category_{$category_title}"}">

View File

@@ -46,6 +46,15 @@
{intl l='Import'}: {$TITLE} {intl l='Import'}: {$TITLE}
</div> </div>
{if $DESCRIPTION}
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
{$DESCRIPTION nofilter}
</div>
</div>
</div>
{/if}
<form action="{$URL}" method="post" {form_enctype form=$form}> <form action="{$URL}" method="post" {form_enctype form=$form}>
{form_hidden_fields form=$form} {form_hidden_fields form=$form}
<div class="row"> <div class="row">

View File

@@ -51,29 +51,26 @@
{$TITLE} {$TITLE}
</caption> </caption>
<thead> <thead>
<tr> <tr>
<th class="col-md-1"> <th class="col-md-1">
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=id{if $import_order == "id"}_reverse{/if}"> <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=id{if $import_order == "id"}_reverse{/if}">
{intl l="ID"} {intl l="ID"}
</a> </a>
</th> </th>
<th class="col-md-2"> <th class="col-md-8">
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=alpha{if $import_order == "alpha"}_reverse{/if}"> <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=alpha{if $import_order == "alpha"}_reverse{/if}">
{intl l="Name"} {intl l="Name"}
</a> </a>
</th> </th>
<th class="col-md-6"> <th class="col-md-2">
{intl l="Description"} <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=manual{if $import_order == "manual"}_reverse{/if}">
</th> {intl l="Position"}
<th class="col-md-2"> </a>
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=manual{if $import_order == "manual"}_reverse{/if}"> </th>
{intl l="Position"} <th class="col-md-1">
</a> {intl l="Actions"}
</th> </th>
<th class="col-md-1"> </tr>
{intl l="Actions"}
</th>
</tr>
</thead> </thead>
<tbody> <tbody>
{loop name="import-categ-list" type="import" order=$import_order category=$ID} {loop name="import-categ-list" type="import" order=$import_order category=$ID}
@@ -84,9 +81,6 @@
<td> <td>
<a href="#category_{$category_title}" class="btn-show-import-modal" data-id="{$ID}" data-url="{$URL}">{$TITLE}</a> <a href="#category_{$category_title}" class="btn-show-import-modal" data-id="{$ID}" data-url="{$URL}">{$TITLE}</a>
</td> </td>
<td>
{$DESCRIPTION}
</td>
<td> <td>
<a href="{url path="/admin/import/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}"> <a href="{url path="/admin/import/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
<span class="glyphicon glyphicon-arrow-up"></span> <span class="glyphicon glyphicon-arrow-up"></span>