modif with addition of product name and attribute name

This commit is contained in:
Marion Muszynski 2017-03-09 10:35:56 +01:00
parent 28241acf6b
commit bac4ebbbc2

View File

@ -74,7 +74,8 @@ class Print_Ean extends Module {
}
$label = array(
'ref' => $product->reference,
'name' => $combination['attribute_name'].' - '.$product->name[2],
'name' => $product->name[2],
'attribute' => $combination['attribute_name']
);
$this->printEAN13($ean_generate,$label,1,Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee));
}
@ -88,6 +89,7 @@ class Print_Ean extends Module {
$label = array(
'ref' => $product->reference,
'name' => $product->name[2],
'attribute' => "",
);
$this->printEAN13($ean_generate,$label,1,Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee));
}
@ -108,7 +110,8 @@ class Print_Ean extends Module {
}
$label = array(
'ref' => $product->reference,
'name' => $combination['attribute_name'].' - '.$product->name[2],
'name' => $product->name[2],
'attribute' => $combination['attribute_name'],
);
$this->printEAN13($ean_generate,$label,1,Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee));
}
@ -195,10 +198,13 @@ class Print_Ean extends Module {
public function _getAttributeCombination($id_product, $id_attribute)
{
return Db::getInstance()->getRow('
SELECT pa.*
SELECT pa.*, al.`name` as `attribute_name`
FROM `'._DB_PREFIX_.'product_attribute` pa
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` ac ON (ac.`id_product_attribute` = pa.`id_product_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.`id_attribute` = ac.`id_attribute`)
WHERE pa.`id_product` = ' . (int)$id_product .'
AND pa.`id_product_attribute` = ' . (int)$id_attribute.'
AND al.`id_lang` = 2
');
}
@ -283,6 +289,8 @@ class Print_Ean extends Module {
$redis = new Predis\Client();
// .'1'.(strlen($ean13) == 12? 'B': 'F').'0000000150340'.$ean13."\n"
// .'1'.(strlen($ean13) == 12? 'B': (strlen($ean13) == 13? 'F': 'E')).'0000000150340'.$ean13."\n"
// .'1E022000015'.sprintf('%04d', (int) ((1020 - round((5.5 * strlen($ean) + 35) * 0.42 * 10)) / 2)).'B'.$ean13."\n"
$redis->publish(
$queue,
json_encode(array(
@ -293,9 +301,10 @@ class Print_Ean extends Module {
.'C0000'."\n"
.'D11'."\n"
.chr(2).'L'."\n"
.'121100000000100'.substr($label['ref'],0,30)."\n"
.'121100000000100'.substr($label['name'],0,30)."\n"
.'1'.(strlen($ean13) == 12? 'B': (strlen($ean13) == 13? 'F': 'E')).'0000000150340'.$ean13."\n"
.'121100002500'.(strlen($label['ref']) > 20? '330': '380').substr(str_replace(array('é','è','à','ï','ù'),array('e','e','a','i','u'),$label['ref']),0,30)."\n"
.'121100002000300'.substr(str_replace(array('é','è','à','ï','ù'),array('e','e','a','i','u'),$label['name']),0,30)."\n"
.'121100001500340'.substr(str_replace(array('é','è','à','ï','ù'),array('e','e','a','i','u'),$label['attribute']),0,30)."\n"
.'1E0000000150'.(strlen($ean13) == 12? '300': (strlen($ean13) == 13? '300': '340')).$ean13."\n"
.'Q'.sprintf('%04d', $quantity)."\n"
.'E'."\n"
),