Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
{
"name":"Sebastien Bracquemont"
}
],
"bin": [
"magmi/cli/magmi.cli.php"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function deleteUnreferencedAttributes()
,'catalog_product_index_eav_decimal_tmp'
,'catalog_product_index_eav_idx'
,'catalog_product_index_eav_tmp'
,['catalog_product_super_attribute','product_id']
, array('catalog_product_super_attribute','product_id')
);

foreach ($tables as $table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private function readValues()
{
$this->openCSV();
$this->getColumnNames();
$this->_availableValuesPerColumn=[];
$this->_availableValuesPerColumn= array();
while ($record = $this->getNextRecord()) {
foreach ($record as $columnName => $value) {
if (!isset($this->_availableValuesPerColumn[$columnName])) {
Expand Down
76 changes: 38 additions & 38 deletions magmi/plugins/5b5/general/attributesetimport/attributesetimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,90 +40,90 @@ class AttributeSetImporter extends Magmi_GeneralImportPlugin
* Config parameters for call to updateGeneric when processing attributes.
* @var array
*/
private $ATTRIBUTE_ARGS = [
private $ATTRIBUTE_ARGS = array(
'entityName'=>"attribute",
'tables'=>['eav_attribute','catalog_eav_attribute'],
'tables'=> array('eav_attribute','catalog_eav_attribute'),
'idColName'=>'attribute_id',
'nameColNames'=>['attribute_code'],
'nameColNames'=> array('attribute_code'),
'elementPrefix'=>'5B5ATI',
'verbose'=>true,
'fetchSystemAttributeIdsSql'=>"select attribute_id from ##eav_attribute## where is_user_defined = 0"
];
);

/**
* Config parameters for call to updateGeneric when processing attribute sets.
* @var array
*/
private $ATTRIBUTE_SET_ARGS = [
private $ATTRIBUTE_SET_ARGS = array(
'entityName'=>"attribute set",
'tables'=>['eav_attribute_set'],
'tables'=>array('eav_attribute_set'),
'idColName'=>'attribute_set_id',
'nameColNames'=>['attribute_set_name'],
'nameColNames'=>array('attribute_set_name'),
'elementPrefix'=>'5B5ASI',
'verbose'=>true,
'inner' => [
'magmi:groups' => [
'inner' => array(
'magmi:groups' => array(
'label' => 'Groups',
'recordSeparator' => ',',
'valueSeparator' => ':',
'columnNames' => [
'columnNames' => array(
'attribute_group_name',
'default_group_id',
'sort_order'
],
'applyDefaultsFromParent' => ['attribute_set_id'],
'applyConditionsFromParent' => ['attribute_set_id'],
'config' => [
),
'applyDefaultsFromParent' => array('attribute_set_id'),
'applyConditionsFromParent' => array('attribute_set_id'),
'config' => array(
'entityName'=>"attribute group",
'tables'=>['eav_attribute_group'],
'tables'=>array('eav_attribute_group'),
'idColName'=>'attribute_group_id',
'nameColNames'=>['attribute_group_name'],
'nameColNames'=>array('attribute_group_name'),
'elementPrefix'=>'5B5AGI',
'verbose'=>false
]
]
]
];
)
)
)
);

/**
* Config parameters for call to updateGeneric when processing attribute set associations.
* @var array
*/
private $ATTRIBUTE_SET_ASSOCIATION_ARGS = [
private $ATTRIBUTE_SET_ASSOCIATION_ARGS = array(
'entityName'=>"attribute association",
'tables'=>['eav_entity_attribute'],
'tables'=>array('eav_entity_attribute'),
'idColName'=>'entity_attribute_id',
'nameColNames'=>['attribute_set_id','attribute_id','attribute_group_id'],
'nameColNames'=>array('attribute_set_id','attribute_id','attribute_group_id'),
'elementPrefix'=>'5B5AAI',
'verbose'=>true,
'fetchSystemAttributeIdsSql'=>"select entity_attribute_id from ##eav_entity_attribute## where attribute_id in (select attribute_id from ##eav_attribute## where is_user_defined = 0)"
];
);

/**
* Configuration for the Name2IdDecoder used for attribute associations "decoding".
* @var array
*/
private $ATTRIBUTE_SET_ASSOCIATION_DECODER_ARGS = [
private $ATTRIBUTE_SET_ASSOCIATION_DECODER_ARGS = array(
'attribute_set_name'
=>[
=>array(
'tableName' => 'eav_attribute_set',
'nameColumnName' => 'attribute_set_name',
'idColumnName' => 'attribute_set_id'
],
),
'attribute_code'
=>[
=>array(
'tableName' => 'eav_attribute',
'nameColumnName' => 'attribute_code',
'idColumnName' => 'attribute_id'
],
),
'attribute_group_name'
=>[
=>array(
'tableName' => 'eav_attribute_group',
'nameColumnName' => 'attribute_group_name',
'idColumnName' => 'attribute_group_id',
'additionalIdColumn' => 'attribute_set_id'
]
];
)
);

public function initialize($params)
{
Expand Down Expand Up @@ -259,7 +259,7 @@ private function prepareCSV($prefix)
public function importAttributes($csvreader)
{
// condition to restrict on product entity type (will be given as default and fetchConditions to updateGeneric() function
$etiCondition = ['entity_type_id' => $this->getProductEntityType()];
$etiCondition = array('entity_type_id' => $this->getProductEntityType());
$this->updateGeneric($csvreader, $this->ATTRIBUTE_ARGS, $etiCondition, $etiCondition);
}

Expand All @@ -270,7 +270,7 @@ public function importAttributes($csvreader)
public function importAttributeSets($csvreader)
{
// condition to restrict on product entity type (will be given as default and fetchConditions to updateGeneric() function
$etiCondition = ['entity_type_id' => $this->getProductEntityType()];
$etiCondition = array('entity_type_id' => $this->getProductEntityType());
$this->updateGeneric($csvreader, $this->ATTRIBUTE_SET_ARGS, $etiCondition, $etiCondition);
}

Expand All @@ -280,12 +280,12 @@ public function importAttributeSets($csvreader)
public function importAttributeAssociations($csvreader)
{
// condition to restrict on product entity type (will be given as default and fetchConditions to updateGeneric() function
$etiCondition = ['entity_type_id' => $this->getProductEntityType()];
$etiCondition = array('entity_type_id' => $this->getProductEntityType());

// dynamically add product entity type id to decoder options
$decoderArgs = array_merge_recursive($this->ATTRIBUTE_SET_ASSOCIATION_DECODER_ARGS,
['attribute_set_name'=>['conditions' =>['entity_type_id' => $this->getProductEntityType()]],
'attribute_code'=>['conditions' =>['entity_type_id' => $this->getProductEntityType()]]]);
array('attribute_set_name'=>array('conditions' =>array('entity_type_id' => $this->getProductEntityType())),
'attribute_code'=>array('conditions' =>array('entity_type_id' => $this->getProductEntityType()))));

$decoder = new Name2IdDecoder($this, $decoderArgs);
$this->updateGeneric($csvreader, $this->ATTRIBUTE_SET_ASSOCIATION_ARGS, $etiCondition, $etiCondition, $decoder);
Expand Down Expand Up @@ -505,7 +505,7 @@ private function updateGeneric($csvreader, &$config, $defaults, $fetchConditions

// merge default values into $mergedDefaults, defaults are given from two sources: from user config parameter PREFIX:default_values (in JSON format)
// and from function parameter $defaults
$mergedDefaults = [];
$mergedDefaults = array();
$paramDefaults = json_decode($this->getParam($elementPrefix.":default_values", "{}"), true);
if (isset($defaults) || isset($paramDefaults)) {
$mergedDefaults = array_merge((array)$paramDefaults, (array)$defaults);
Expand Down
2 changes: 1 addition & 1 deletion magmi/plugins/5b5/general/attributesetimport/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function options($self, $title, $prefix, $entityName, $withCsvOptions, $withMagm
}
if ($withEnable) {
checkbox($self, $prefix, 'enable', true, "Enable ${entityName} import");
startDiv($self, $prefix, 'enabled', $self->getParam($prefix.":enable", "off")=="on");
startDiv($self, $prefix, 'enabled', $self->getParam($prefix.":enable", "on")=="on");
}
if ($withCsvOptions) {
csvOptions($self, $prefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public function BuildCustomOption($field, $value)
}
$opt['sku'] = $sku;
$opt['price'] = $price;
$opt['price_type'] = $price_type;
break;
case 'field':
case 'area':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ public function processColumnList(&$cols, $params = null)
if ($id = $this->selectone($sql, strtoupper($groupname), "customer_group_id")) {
$this->_groups[$col] = array('name'=>$groupname,'id'=>$id);
} else {
$this->_groups[$col] = array('name'=>$groupname,'id'=>$this->createGroup($groupname));
if($groupname == 'NOT LOGGED IN'){
$this->_groups[$col] = array('name'=>$groupname,'id'=>$id);
}
else{
$this->_groups[$col] =
array('name'=>$groupname,'id'=>$this->createGroup($groupname));
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion magmi/web/js/magmi_utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
var rawurlencode=function(str) {
str = (str+'').toString();
return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
}
var magmi_multifield=function(listfield,dyncontainer,linetpl,vlist)
{
this.vlist=vlist;
Expand All @@ -7,7 +11,7 @@ var magmi_multifield=function(listfield,dyncontainer,linetpl,vlist)

this.getinputline=function(fieldname,dvalue,linetpl)
{
linetpl=linetpl.replace('{fieldname}',fieldname).replace('{value}',dvalue).replace('{fieldname.enc}',encodeURIComponent(fieldname));
linetpl=linetpl.replace('{fieldname}',fieldname).replace('{value}',dvalue).replace('{fieldname.enc}',rawurlencode(fieldname));

return linetpl;
};
Expand Down