Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable attributes + COALESCE mysql fix + M2 max exception traces fix #54

Open
wants to merge 5 commits into
base: magento2
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion magmi/engines/magmi_productimportengine.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class Magmi_ProductImportEngine extends Magmi_Engine
//magento stock related table columns list
private $_stockcols = array();
//stats
private $_skustats = array();
private $_skustats = array(
'nsku' => 0,
'ok' => 0,
'ko' => 0,
);
//handlers cache
private $_handlercache = array();

Expand Down
2 changes: 1 addition & 1 deletion magmi/inc/dbhelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function initDb($host, $dbname, $user, $pass, $port = 3306, $socket = "/t
$pdostr = "mysql:host=$host;port=$port;dbname=$dbname;charset=utf8";
}

$this->_db = new PDO($pdostr, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8"));
$this->_db = new PDO($pdostr, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8, sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"));
// use exception error mode
$this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->_db->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL);
Expand Down
9 changes: 8 additions & 1 deletion magmi/inc/magmi_engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ public function getExceptionTrace($tk, &$traces)
$this->_excid++;
$trstr = "";
//FIXME: infinity loop in M2

$counter = 0;
foreach ($traces as $trace) {
if (isset($trace["file"])) {
$fname = str_replace(dirname(dirname(__FILE__)), "", $trace["file"]);
$fname = str_replace(dirname(__DIR__), "", $trace["file"]);
$trstr .= $fname . ":" . (isset($trace["line"]) ? $trace["line"] : "?") . " - ";
if (isset($trace["class"])) {
$trstr .= $trace["class"] . "->";
Expand All @@ -407,6 +409,11 @@ public function getExceptionTrace($tk, &$traces)
$trstr .= "\n";
}
}

// Simple max traces fix
if (++$counter % 10) {
break;
}
}
if (!isset($this->_exceptions[$tk])) {
$this->_exceptions[$tk] = array(0,$this->_excid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function getConfigurableOptsFromAsId($asid)
$cond = "ea.is_user_defined=1";
if ($this->checkMagentoVersion("1.3.x", "!=")) {
$cea = $this->tablename("catalog_eav_attribute");
$sql .= " JOIN $cea as cea ON cea.attribute_id=ea.attribute_id AND cea.is_global=1 AND cea.is_configurable=1";
$sql .= " JOIN $cea as cea ON cea.attribute_id=ea.attribute_id AND cea.is_global=1";
} else {
$cond .= " AND ea.is_global=1 AND ea.is_configurable=1";
$cond .= " AND ea.is_global=1";
}
$sql .= " WHERE $cond
GROUP by ea.attribute_id";
Expand Down