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_descriptive locale="fr_FR">
<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 locale="en_US">
<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>
<import id="thelia.import.price" class="Thelia\ImportExport\Import\Type\ProductPricesImport" category_id="thelia.import.products">
<import_descriptive locale="fr_FR">
<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 locale="en_US">
<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>
</imports>

View File

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

View File

@@ -9,6 +9,15 @@
<h4 class="modal-title" id="import-modal-label">Import: {$TITLE}</h4>
</div>
<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="col-md-12">
{form_field form=$form field="language"}

View File

@@ -39,6 +39,16 @@
{intl l='Export'}: {$TITLE}
</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_hidden_fields form=$form}
<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>
</td>
<td>
{$DESCRIPTION}
{$DESCRIPTION nofilter}
</td>
<td>
<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}
</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_hidden_fields form=$form}
<div class="row">

View File

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