Skip to content

Commit

Permalink
Merge pull request #22 from Agence-DnD/release/100.1.3
Browse files Browse the repository at this point in the history
Release/100.1.3
  • Loading branch information
Dnd-Gimix authored Mar 29, 2019
2 parents b136978 + b0e1d3d commit a89d3fe
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 37 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ Fix media import with wrong entity_type_id
Force attribute code to be lowercase

Manage attribute scope on import

### 100.1.3 :
Change default pagination value to 100

Add SQL statement possibility in configurable mapping

Add category configurations for anchor, status and display in menu

Remove metadata from temporary table

Fix JSON method for advanced filter

67 changes: 65 additions & 2 deletions app/code/community/Pimgento/Api/Helper/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,30 @@ class Pimgento_Api_Helper_Configuration extends Mage_Core_Helper_Abstract
* @var string $productTaxIdConfigField
*/
private $productTaxIdConfigField = 'tax_id';
/**
* Category config path
*
* @var string $categoryConfigGroup
*/
private $categoryConfigGroup = 'category';
/**
* Is category active config field
*
* @var string $isCategoryActive
*/
private $isCategoryActive = 'is_active';
/**
* Is category in menu config field
*
* @var string $isCategoryInMenu
*/
private $isCategoryInMenu = 'include_in_menu';
/**
* Is category anchor config field
*
* @var string $isCategoryAnchor
*/
private $isCategoryAnchor = 'is_anchor';
/**
* Attribute config path
*
Expand Down Expand Up @@ -540,6 +564,45 @@ public function getCacheList($importCode)
return $this->getConfigValue($configPath);
}

/**
* Retrieve if categories must be active
*
* @return int
*/
public function getIsCategoryActive()
{
/** @var string $configPath */
$configPath = sprintf('%s/%s/%s', $this->configSection, $this->categoryConfigGroup, $this->isCategoryActive);

return (int)$this->getConfigValue($configPath);
}

/**
* Retrieve if categories must be in menu
*
* @return int
*/
public function getIsCategoryInMenu()
{
/** @var string $configPath */
$configPath = sprintf('%s/%s/%s', $this->configSection, $this->categoryConfigGroup, $this->isCategoryInMenu);

return (int)$this->getConfigValue($configPath);
}

/**
* Retrieve if categories must be anchor
*
* @return int
*/
public function getIsCategoryAnchor()
{
/** @var string $configPath */
$configPath = sprintf('%s/%s/%s', $this->configSection, $this->categoryConfigGroup, $this->isCategoryAnchor);

return (int)$this->getConfigValue($configPath);
}

/**
* Retrieve Additional Attribute Types config
*
Expand Down Expand Up @@ -588,7 +651,7 @@ public function isPrefixEnabled()
{
/** @var string $configPath */
$configPath = sprintf('%s/%s/%s', $this->configSection, $this->attributeConfigGroup, $this->prefixReservedConfigField);
/** @var string $matches */
/** @var string $isEnabled */
$isEnabled = $this->getConfigValue($configPath);
if (empty($isEnabled)) {
return false;
Expand Down Expand Up @@ -933,7 +996,7 @@ public function getAdvancedFilters()
}

/** @var mixed[] $filters */
$filters = json_decode($filters);
$filters = Mage::helper('core')->jsonDecode($filters);

return (array)$filters;
}
Expand Down
5 changes: 4 additions & 1 deletion app/code/community/Pimgento/Api/Helper/Entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class Pimgento_Api_Helper_Entities extends Mage_Core_Helper_Abstract
*
* @var string[] EXCLUDED_COLUMNS
*/
const EXCLUDED_COLUMNS = ['_links'];
const EXCLUDED_COLUMNS = [
'_links',
'metadata',
];
/**
* Catalog product entity type id
*
Expand Down
6 changes: 3 additions & 3 deletions app/code/community/Pimgento/Api/Model/Job/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ public function setValues($task)

/** @var mixed[] $values */
$values = [
'is_active' => new Zend_Db_Expr(1),
'include_in_menu' => new Zend_Db_Expr(1),
'is_anchor' => new Zend_Db_Expr(1),
'is_active' => new Zend_Db_Expr($this->getConfigurationHelper()->getIsCategoryActive()),
'include_in_menu' => new Zend_Db_Expr($this->getConfigurationHelper()->getIsCategoryInMenu()),
'is_anchor' => new Zend_Db_Expr($this->getConfigurationHelper()->getIsCategoryAnchor()),
'display_mode' => new Zend_Db_Expr(sprintf('"%s"', Mage_Catalog_Model_Category::DM_PRODUCT)),
];

Expand Down
6 changes: 3 additions & 3 deletions app/code/community/Pimgento/Api/Model/Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public function createConfigurable($task)
}
/** @var string $associationName */
foreach ($associationNames as $associationName) {
if (!empty($associationName) && $connection->tableColumnExists($productModelTable, $associationName)) {
if (!empty($associationName) && $connection->tableColumnExists($productModelTable, $associationName) && $connection->tableColumnExists($tmpTable, $associationName)) {
$data[$associationName] = sprintf('v.%s', $associationName);
}
}
Expand Down Expand Up @@ -448,7 +448,7 @@ public function createConfigurable($task)
}

if (strlen($value) > 0) {
$data[$column] = new Zend_Db_Expr(sprintf('"%s"', $value));
$data[$column] = new Zend_Db_Expr($value);

continue;
}
Expand Down Expand Up @@ -741,7 +741,7 @@ public function setValues($task)
continue;
}

if (empty($columnParts[1]) && !isset($values[0][$columnPrefix])) {
if (empty($columnParts[1])) {
// No channel and no locale found: attribute scope naturally is Global
$values[0][$columnPrefix] = $column;

Expand Down
5 changes: 4 additions & 1 deletion app/code/community/Pimgento/Api/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<pimgento_api>
<general>
<akeneo_version>1</akeneo_version>
<pagination_size>10</pagination_size>
<pagination_size>100</pagination_size>
</general>
<credentials>
<base_url>http://demo.akeneo.com</base_url>
Expand All @@ -146,6 +146,9 @@
</credentials>
<category>
<cache_list>block_html,collections</cache_list>
<is_active>1</is_active>
<include_in_menu>1</include_in_menu>
<is_anchor>1</is_anchor>
</category>
<attribute>
<cache_list>block_html,collections,eav</cache_list>
Expand Down
35 changes: 33 additions & 2 deletions app/code/community/Pimgento/Api/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</akeneo_version>
<pagination_size translate="label comment">
<label>Pagination size</label>
<comment>Must be a value between 1 and 100. Default value is 10.</comment>
<comment>Must be a value between 1 and 100. Default value is 100.</comment>
<frontend_type>text</frontend_type>
<validate>required-entry</validate>
<sort_order>30</sort_order>
Expand Down Expand Up @@ -191,6 +191,36 @@
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</cache_list>
<is_active translate="label comment">
<label>Activate new categories</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<comment>Newly imported categories will be activated</comment>
<sort_order>22</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</is_active>
<include_in_menu translate="label comment">
<label>Include new categories in menu</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<comment>Newly imported categories categories will be included in menu</comment>
<sort_order>23</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</include_in_menu>
<is_anchor translate="label comment">
<label>Set new categories in anchor mode</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<comment>Newly imported categories will be in anchor mode</comment>
<sort_order>24</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</is_anchor>
</fields>
</category>
<attribute translate="label">
Expand Down Expand Up @@ -322,7 +352,7 @@
<label>Configurable attributes</label>
<frontend_model>pimgento_api/adminhtml_system_configurable</frontend_model>
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
<comment>Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists</comment>
<comment>Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists. Value must be a chain between quotes or an SQL statement.</comment>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
Expand Down Expand Up @@ -546,6 +576,7 @@
<frontend_type>textarea</frontend_type>
<comment>
<![CDATA[Build your query using a json.<br/>
Please, ensure that your JSON format is valid before using advanced filter.<br/>
For example :<br/>
<pre>
{
Expand Down
10 changes: 8 additions & 2 deletions app/locale/de_DE/Pimgento_Api.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Pimgento_Api::%d family(ies) inserted","%d Familie(n) eingefügt"
"Pimgento_Api::%d line(s) found","%d Zeile(n) gefunden"
"Pimgento_Api::%s product(s) with default family. Please try to import families.","%s Produkt(e) mit Standardfamilie. Bitte versuchen Sie, Familien zu importieren."
"Pimgento_Api::Activate new categories","Activ Kategorien"
"Pimgento_Api::Add 'pim_' prefix to attribute codes reserved by Magento. If disabled reserved attributes will be ignored (e.g.: collection)","Hinzufügen das Präfix 'pim_' den von Magento reservierten Attributcodes. Wenn deaktiviert, werden reservierte Attribute ignoriert (z.B. Sammlung)."
"Pimgento_Api::Add columns to product model table","Spalten zur Produktmodelltabelle hinzufügen"
"Pimgento_Api::Add or update attributes","Attribute hinzufügen oder aktualisieren"
Expand All @@ -20,6 +21,7 @@
"Pimgento_Api::Akeneo Version","Akeneo-Version"
"Pimgento_Api::API Credentials","API-Anmeldeinformationen"
"Pimgento_Api::Api test failed: %s","Api-Test fehlgeschlagen: %s"
"Pimgento_Api::Set new categories in anchor mode","Verankern Kategorien"
"Pimgento_Api::Asset import is not enabled","Asset-Import ist nicht aktiviert"
"Pimgento_Api::Associate options to attributes","Zuordnen von Optionen zu Attributen"
"Pimgento_Api::Associate values to options","Zuordnen von Werten zu Optionen"
Expand Down Expand Up @@ -104,7 +106,7 @@
"Pimgento_Api::Family Variant from PIM.","Familienvariante aus PIM."
"Pimgento_Api::Family Variant","Familienvariante"
"Pimgento_Api::Family","Familie"
"Pimgento_Api::Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists","Füllen Sie konfigurierbare Attribute mit einem Standardwert, lassen Sie das Feld leer, um einen einfachen Produktwert oder einen Produktmodellwert zu erhalten, falls vorhanden."
"Pimgento_Api::Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists. Value must be a chain between quotes or an SQL statement.","Füllen Sie konfigurierbare Attribute mit einem Standardwert, lassen Sie das Feld leer, um einen einfachen Produktwert oder einen Produktmodellwert zu erhalten, falls vorhanden. Der Wert muss eine SQL-Anweisung oder zwischen Anführungszeichen sein."
"Pimgento_Api::Fill data into temporary table","Daten in die temporäre Tabelle eintragen"
"Pimgento_Api::Fill temporary table","Füllen der temporären Tabelle"
"Pimgento_Api::Found in your Akeneo configuration : System / API connections","In Ihrer Akeneo-Konfiguration zu finden: System / API-Verbindungen"
Expand All @@ -124,6 +126,10 @@
"Pimgento_Api::Import only product updated since last X days. Leave blank for no filter.","Nur Produkte importieren, die seit den letzten X Tagen aktualisiert wurden. Lassen Sie das Feld leer, um keinen Filter zu verwenden."
"Pimgento_Api::Import product from PIM.","Produkt aus PIM importieren."
"Pimgento_Api::Import Product Model from PIM.","Produktmodell aus PIM importieren."
"Pimgento_Api::Newly imported categories will be activated","Importiert Kategorien activ sind"
"Pimgento_Api::Newly imported categories will be in anchor mode","Importiert Kategorien verankern sind"
"Pimgento_Api::Newly imported categories categories will be included in menu","Importiert Kategorien in Menü begriffen sind"
"Pimgento_Api::Include new categories in menu","Begriffen in Menü"
"Pimgento_Api::Init default groups","Standardgruppen einrichten"
"Pimgento_Api::Init stock","Init-Bestand"
"Pimgento_Api::Link configurable with children","Link mit Kindern konfigurierbar"
Expand All @@ -143,7 +149,7 @@
"Pimgento_Api::Match specific Pim attribute type with Magento any default field type","Abgleich des spezifischen Pim-Attributtyps mit Magento mit einem beliebigen Standardfeldtyp."
"Pimgento_Api::Media import is not enabled","Medienimport ist nicht aktiviert"
"Pimgento_Api::Mode","Modus"
"Pimgento_Api::Must be a value between 1 and 100. Default value is 10.","Muss ein Wert zwischen 1 und 100 sein. Der Standardwert ist 10."
"Pimgento_Api::Must be a value between 1 and 100. Default value is 100.","Muss ein Wert zwischen 1 und 100 sein. Der Standardwert ist 100."
"Pimgento_Api::No Attribute data to insert in temp table","Keine Attributdaten zum Einfügen in die Temp-Tabelle"
"Pimgento_Api::No axes for code: %s","Keine Achsen für Code: %s"
"Pimgento_Api::No cache to clear for import: %s","Kein Cache, der für den Import geleert werden muss: %s"
Expand Down
10 changes: 8 additions & 2 deletions app/locale/en_US/Pimgento_Api.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Pimgento_Api::%d family(ies) inserted","%d family(ies) inserted"
"Pimgento_Api::%d line(s) found","%d line(s) found"
"Pimgento_Api::%s product(s) with default family. Please try to import families.","%s product(s) with default family. Please try to import families."
"Pimgento_Api::Activate new categories","Activate new categories"
"Pimgento_Api::Add 'pim_' prefix to attribute codes reserved by Magento. If disabled reserved attributes will be ignored (e.g.: collection)","Add 'pim_' prefix to attribute codes reserved by Magento. If disabled reserved attributes will be ignored (e.g.: collection)"
"Pimgento_Api::Add columns to product model table","Add columns to product model table"
"Pimgento_Api::Add or update attributes","Add or update attributes"
Expand All @@ -18,6 +19,7 @@
"Pimgento_Api::Akeneo client authentication failed","Akeneo client authentication failed"
"Pimgento_Api::Akeneo Url","Akeneo Url"
"Pimgento_Api::Akeneo Version","Akeneo Version"
"Pimgento_Api::Set new categories in anchor mode","Set new categories in anchor mode"
"Pimgento_Api::API Credentials","API Credentials"
"Pimgento_Api::Api test failed: %s","Api test failed: %s"
"Pimgento_Api::Asset import is not enabled","Asset import is not enabled"
Expand Down Expand Up @@ -104,7 +106,7 @@
"Pimgento_Api::Family Variant from PIM.","Family Variant from PIM."
"Pimgento_Api::Family Variant","Family Variant"
"Pimgento_Api::Family","Family"
"Pimgento_Api::Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists","Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists"
"Pimgento_Api::Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists. Value must be a chain between quotes or an SQL statement.","Fill configurable attributes with default value, leave blank to take simple product value or Product Model value if exists. Value must be a chain between quotes or an SQL statement."
"Pimgento_Api::Fill data into temporary table","Fill data into temporary table"
"Pimgento_Api::Fill temporary table","Fill temporary table"
"Pimgento_Api::Found in your Akeneo configuration : System / API connections","Found in your Akeneo configuration : System / API connections"
Expand All @@ -124,6 +126,10 @@
"Pimgento_Api::Import only product updated since last X days. Leave blank for no filter.","Import only product updated since last X days. Leave blank for no filter."
"Pimgento_Api::Import product from PIM.","Import product from PIM."
"Pimgento_Api::Import Product Model from PIM.","Import Product Model from PIM."
"Pimgento_Api::Newly imported categories will be activated","Newly imported categories will be activated"
"Pimgento_Api::Newly imported categories will be in anchor mode","Newly imported categories will be in anchor mode"
"Pimgento_Api::Newly imported categories categories will be included in menu","Newly imported categories categories will be included in menu"
"Pimgento_Api::Include new categories in menu","Include new categories in menu"
"Pimgento_Api::Init default groups","Init default groups"
"Pimgento_Api::Init stock","Init stock"
"Pimgento_Api::Link configurable with children","Link configurable with children"
Expand All @@ -143,7 +149,7 @@
"Pimgento_Api::Match specific Pim attribute type with Magento any default field type","Match specific Pim attribute type with Magento any default field type"
"Pimgento_Api::Media import is not enabled","Media import is not enabled"
"Pimgento_Api::Mode","Mode"
"Pimgento_Api::Must be a value between 1 and 100. Default value is 10.","Must be a value between 1 and 100. Default value is 10."
"Pimgento_Api::Must be a value between 1 and 100. Default value is 100.","Must be a value between 1 and 100. Default value is 100."
"Pimgento_Api::No Attribute data to insert in temp table","No Attribute data to insert in temp table"
"Pimgento_Api::No axes for code: %s","No axes for code: %s"
"Pimgento_Api::No cache to clear for import: %s","No cache to clear for import: %s"
Expand Down
Loading

0 comments on commit a89d3fe

Please sign in to comment.