From 749d55102c0cf985b125196216516d38b35b389a Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 22 Jul 2014 16:35:25 +0200 Subject: [PATCH] =?UTF-8?q?Add=20import=20description=20=09modifi=C3=A9:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20core/lib/Thelia/Config/Resources/imp?= =?UTF-8?q?ort.xml=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/T?= =?UTF-8?q?helia/ImportExport/Import/Type/ProductStockImport.php=20=09modi?= =?UTF-8?q?fi=C3=A9:=20=20=20=20=20=20=20=20=20templates/backOffice/defaul?= =?UTF-8?q?t/ajax/export-modal.html=20=09modifi=C3=A9:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20templates/backOffice/default/ajax/import-modal.html=20?= =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20templates/backOffice?= =?UTF-8?q?/default/export-page.html=20=09modifi=C3=A9:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20templates/backOffice/default/export.html=20=09modifi?= =?UTF-8?q?=C3=A9:=20=20=20=20=20=20=20=20=20templates/backOffice/default/?= =?UTF-8?q?import-page.html=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20t?= =?UTF-8?q?emplates/backOffice/default/import.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Config/Resources/import.xml | 49 +++++++++++++++++++ .../Import/Type/ProductStockImport.php | 17 +++---- .../backOffice/default/ajax/export-modal.html | 9 ++++ .../backOffice/default/ajax/import-modal.html | 9 ++++ templates/backOffice/default/export-page.html | 10 ++++ templates/backOffice/default/export.html | 2 +- templates/backOffice/default/import-page.html | 9 ++++ templates/backOffice/default/import.html | 46 ++++++++--------- 8 files changed, 115 insertions(+), 36 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/import.xml b/core/lib/Thelia/Config/Resources/import.xml index 84dcbf9e1..4a57d7da8 100644 --- a/core/lib/Thelia/Config/Resources/import.xml +++ b/core/lib/Thelia/Config/Resources/import.xml @@ -14,18 +14,67 @@ Importez votre stock + + +
  • ref: The reference of your product Attribute Combinations
  • +
  • stock: The quantity of product you have
  • + + ]]> +
    Import your stock + + +
  • ref: The reference of your product attribute combinations
  • +
  • stock: The quantity of product you have
  • + + It can have the column "ean" that defines the product's EAN code. + ]]> +
    Importez vos prix Hors-Taxes + + +
  • ref: La reférénce de votre déclinaison de combinaison de produit
  • +
  • price: Le prix Hors-Taxes de votre déclinaison de combinaison de produit
  • + + Il peut aussi optionnellement avoir ces colonnes: +
      +
    • currency: Le code de la monnaie (exemple: EUR, USD)
    • +
    • promo_price: Le prix promotionnel Hors-Taxes de votre déclinaison de combinaison de produit
    • +
    • promo: Si cette valeur est a 0, désactive la promotion, si elle est a 1, l'active
    • +
    + ]]> +
    Import your prices excluding taxes + + +
  • ref: The reference of the product attribute combinations
  • +
  • price: The price excluding taxes of the product attribute combinations
  • + + It may also optionally have those columns: +
      +
    • currency: the currency code (example: EUR, USD)
    • +
    • promo_price: the promo price excluding taxes of the product attribute combinations
    • +
    • promo: If this value is 0, set the product not in promo, if 1, it sets the product in promo
    • +
    + ]]> +
    diff --git a/core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php b/core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php index 6e9d179f0..870c18e62 100644 --- a/core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php +++ b/core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php @@ -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"]; } /** diff --git a/templates/backOffice/default/ajax/export-modal.html b/templates/backOffice/default/ajax/export-modal.html index 178fe2bbf..efd0931e0 100644 --- a/templates/backOffice/default/ajax/export-modal.html +++ b/templates/backOffice/default/ajax/export-modal.html @@ -9,6 +9,15 @@