Files
crm.twinpol.com/modules/EcmProductB2Bs/productCardNew.php

712 lines
24 KiB
PHP
Raw Normal View History

2025-05-12 15:44:39 +00:00
<?php
error_reporting(0);
function prepareName($t){
$a1=array("&quot;","a","ą","b","c","ć","d","e","ę","f","g","h","i","j","k","l","ł","m","n","ń","o","ó","p","q","r","s","ś","t","u","v","w","x","y","z","ż","ź");
$a2=array('"',"A","Ą","B","C","Ć","D","E","Ę","F","G","H","I","J","K","L","Ł","M","N","Ń","O","Ó","P","Q","R","S","Ś","T","U","V","W","X","Y","Z","Ż","Ź");
$t=str_replace($a1,$a2,$t);
return iconv("UTF-8","ISO-8859-2",$t);
}
function blockToPrint($name,$str){
$str=str_replace("&nbsp;"," ",$str);
$str=str_replace("<ul> ","<ul>",$str);
$str=str_replace("<ul></ul>","",$str);
$str=str_replace("<ul> </ul>","",$str);
$numc=99999;
$e=explode("<strong>".trim($name),$str);
$ee=explode("<strong>",$e[1]);
if(!$ee[0])$ee=explode("</div>",$e[1]);
$e=$ee;
$e=explode("</strong>",$e[0]);
$t=$e[1];
$p=explode("<p>",$t);
$p=explode("</p>",$p[1]);
$p=$p[0];
$u=explode("<ul>",$t);
$u=explode("</ul>",$u[1]);
$u=$u[0];
$u=str_replace("&nbsp;"," ",$u);
$u=str_replace("<li>","",str_replace("</li>","",$u));
$l=explode("
",$u);
$p=str_replace("
","",$p);
if($p){
$tt=wordwrap(strip_tags($p),$numc,"\n");
$ee=explode("\n",$tt);
if(count($ee)>0){
foreach($ee as $e){
$text[]=$e;
$cc++;
}
}
}
if(count($l)>0){
foreach($l as $list){
if(!$list || $list==" " || strlen(strip_tags($list))<2)continue;
if(eregi("<span>",$list))$tt="".wordwrap(str_replace("<span>","",str_replace("</span>","",$list)),34,"\n&nbsp;&nbsp;&nbsp;");
else $tt="&bull;&nbsp;".wordwrap($list,$numc,"\n&nbsp;&nbsp;&nbsp;");
$ee=explode("\n",$tt);
foreach($ee as $e){
$text[]=$e;
}
}
}
return $text;
}
function categoryTitle($p,$cat,$th=""){
if($th)$thh="-th";
$p->SetLeftMargin(6);
$card="";
if($cat=="77b2bbbc-7ae1-47c3-a5d9-484da1665e3e")$card="title-cleaning".$thh.".jpg";
if($cat=="de0118bd-20c3-bf26-2175-484da1917b97")$card="title-headsets".$thh.".jpg";
if($cat=="a6e4f296-dda9-ba2a-1c2a-484d259fcb0f")$card="title-accessories".$thh.".jpg";
if($cat=="22f3c3c6-3f7d-12d2-dd29-484da06c4c6d")$card="title-mouses".$thh.".jpg";//mouses
if($cat=="7afa9376-7089-efda-c55d-4b2a51c8ebcc")$card="title-smartphones".$thh.".jpg";
if($cat=="59a70ebf-1ec0-2c76-b88c-484da075461d")$card="title-hubs".$thh.".jpg";
if($cat=="cda8794a-1bae-e94c-3e14-484da0df8608")$card="title-speakers".$thh.".jpg";
if($cat=="6f32ab3b-9aa1-5a05-d4c1-484da06783e2")$card="title-keyboards".$thh.".jpg";
if($cat=="1c2eeff4-5dcd-321c-29a1-484da0696af9")$card="title-gamepads".$thh.".jpg";
if($cat=="dcdbf698-a86c-faa6-4506-4ca4a2fa0500")$card="title-notebookacc".$thh.".jpg";
if($cat=="491e4185-8aaa-1b93-09d2-484da15dcfd0")$card="title-pouches".$thh.".jpg";
if($cat=="21a1c075-3bc4-a6f1-f506-49ae98e4e61c")$card="title-gpspouches".$thh.".jpg";
if($cat=="59d9f458-1ca5-ac55-1f04-4c7ccae6a7d6")$card="title-hddpouches".$thh.".jpg";
if($cat=="9bef594d-c7e1-500f-8d6a-4b2a35ef973a")$card="title-poweradapters".$thh.".jpg";
if($cat=="cde2b6bb-5cf3-2e8f-d236-484da0c771c3")$card="title-webcams".$thh.".jpg";
if($cat=="3c1d1dc1-1f6b-6bd6-3949-484da1668c48")$card="title-bags".$thh.".jpg";
if($cat=="91ba9e26-d2fa-cb07-125b-4c5c0c205a8d")$card="title-tvtunners".$thh.".jpg";
if($cat=="2be17986-7e5c-a654-dd4c-484da022b063")$card="title-chargers".$thh.".jpg";
if($cat=="4ba5dcce-070b-25e0-8e48-484da0dc9d18")$card="title-cables".$thh.".jpg";
if($cat=="3f3f22ef-6a34-7985-ff46-4af40019eb85")$card="title-audioheadsets".$thh.".jpg";//audio
if($cat=="e52d8e61-709f-1e13-34da-4d667c8c3a5f")$card="title-touchpadpouch".$thh.".jpg";
if($cat=="5ec7687f-db2e-2abe-525a-4cadc82177a9")$card="title-waterpouches".$thh.".jpg";
if($cat=="94930136-f89f-ab26-6695-4d9c6ea0f818")$card="title-euro".$thh.".jpg";
$card = "turkusowa.jpg";
if(file_exists("modules/EcmProductB2Bs/".$card) && $card!="")$p->Image("modules/EcmProductB2Bs/".$card,5,0,283);
return $p;
}
function contentView($p,$cat,$lang,$pricebook_id,$th=""){
if($th)$thh="-th";
$p->SetLeftMargin(6);
$card="";
if($cat=="77b2bbbc-7ae1-47c3-a5d9-484da1665e3e")$card="content-cleaning".$thh.".jpg";
if($cat=="de0118bd-20c3-bf26-2175-484da1917b97")$card="content-headsets".$thh.".jpg";
if($cat=="a6e4f296-dda9-ba2a-1c2a-484d259fcb0f")$card="content-accessories".$thh.".jpg";
if($cat=="22f3c3c6-3f7d-12d2-dd29-484da06c4c6d")$card="content-mouses".$thh.".jpg";//mouses
if($cat=="7afa9376-7089-efda-c55d-4b2a51c8ebcc")$card="content-smartphones".$thh.".jpg";
if($cat=="59a70ebf-1ec0-2c76-b88c-484da075461d")$card="content-hubs".$thh.".jpg";
if($cat=="cda8794a-1bae-e94c-3e14-484da0df8608")$card="content-speakers".$thh.".jpg";
if($cat=="6f32ab3b-9aa1-5a05-d4c1-484da06783e2")$card="content-keyboards".$thh.".jpg";
if($cat=="1c2eeff4-5dcd-321c-29a1-484da0696af9")$card="content-gamepads".$thh.".jpg";
if($cat=="dcdbf698-a86c-faa6-4506-4ca4a2fa0500")$card="content-notebookacc".$thh.".jpg";
if($cat=="491e4185-8aaa-1b93-09d2-484da15dcfd0")$card="content-pouches".$thh.".jpg";
if($cat=="21a1c075-3bc4-a6f1-f506-49ae98e4e61c")$card="content-gpspouches".$thh.".jpg";
if($cat=="59d9f458-1ca5-ac55-1f04-4c7ccae6a7d6")$card="content-hddpouches".$thh.".jpg";
if($cat=="9bef594d-c7e1-500f-8d6a-4b2a35ef973a")$card="content-poweradapters".$thh.".jpg";
if($cat=="cde2b6bb-5cf3-2e8f-d236-484da0c771c3")$card="content-webcams".$thh.".jpg";
if($cat=="3c1d1dc1-1f6b-6bd6-3949-484da1668c48")$card="content-bags".$thh.".jpg";
if($cat=="91ba9e26-d2fa-cb07-125b-4c5c0c205a8d")$card="content-tvtunners".$thh.".jpg";
if($cat=="2be17986-7e5c-a654-dd4c-484da022b063")$card="content-chargers".$thh.".jpg";
if($cat=="4ba5dcce-070b-25e0-8e48-484da0dc9d18")$card="content-cables".$thh.".jpg";
if($cat=="3f3f22ef-6a34-7985-ff46-4af40019eb85")$card="content-audioheadsets".$thh.".jpg";//audio
if($cat=="e52d8e61-709f-1e13-34da-4d667c8c3a5f")$card="content-touchpadpouch".$thh.".jpg";
if($cat=="5ec7687f-db2e-2abe-525a-4cadc82177a9")$card="content-waterpouches".$thh.".jpg";
$z="select distinct i.ecmproduct_id,i.price,p.product_category_id,p.th,p.name,p.code,p.srp_price,p.product_picture from ecmpricebooks_ecmproducts as i inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmpricebooks_ecmproducts_categories_sort as c on c.category_id=p.product_category_id where i.ecmpricebook_id='".$pricebook_id."' and i.deleted='0' and p.product_category_id='".$cat."' order by c.position asc,i.position asc";
$w=$GLOBALS['db']->query($z);
while($r=$GLOBALS['db']->fetchByAssoc($w)){
if($i%6==0){
$p->AddPage();
if(file_exists("modules/EcmProductB2Bs/".$card) && $card!="")$p->Image("modules/EcmProductB2Bs/".$card,5,0,200);
$p->Ln();
$m=0;
}
if(file_exists("modules/EcmProductB2Bs/upload/images/big/".$r['product_picture']) && $r['product_picture'])$p->Image("modules/EcmProductB2Bs/upload/images/big/".$r['product_picture'],10,$m*30+70,null,30);
$p->SetFont("arialpl","B",14);
$p->SetXY(55,$m*30+74);
$p->Multicell(100,6,prepareName($r['code']),0,"L",1);
//$p->Cell(40,6,$r['srp_price'],0,0,'L',0);
$p->SetFont("arialpl","",14);
$p->SetXY(55,$m*30+82);
$p->Multicell(100,6,prepareName($r['name']),0,"L",1);
$p->SetXY(155,$m*30+74);
$p->SetFont("arialpl","B",26);
$p->Cell(25,6,number_format($r['srp_price'],2,",","."),0,0,'L',1);
$p->SetFont("arialpl","",16);
if(strlen(number_format($r['srp_price'],2,",","."))==6)$plus=5;
else $plus=0;
$p->SetXY(181+$plus,$m*30+74);
$p->Cell(15,6,"PLN",0,0,'L',1);
$i++;
$m++;
}
return $p;
}
function categoryExtra($p,$cat,$th=""){
if($th)$thh="-th";
$p->SetLeftMargin(6);
$card="";
if($cat=="77b2bbbc-7ae1-47c3-a5d9-484da1665e3e")$card="extra-cleaning".$thh.".jpg";
if($cat=="de0118bd-20c3-bf26-2175-484da1917b97")$card="extra-headsets".$thh.".jpg";
if($cat=="a6e4f296-dda9-ba2a-1c2a-484d259fcb0f")$card="extra-accessories".$thh.".jpg";
if($cat=="22f3c3c6-3f7d-12d2-dd29-484da06c4c6d")$card="extra-mouses".$thh.".jpg";//mouses
if($cat=="7afa9376-7089-efda-c55d-4b2a51c8ebcc")$card="extra-smartphones".$thh.".jpg";
if($cat=="59a70ebf-1ec0-2c76-b88c-484da075461d")$card="extra-hubs".$thh.".jpg";
if($cat=="cda8794a-1bae-e94c-3e14-484da0df8608")$card="extra-speakers".$thh.".jpg";
if($cat=="6f32ab3b-9aa1-5a05-d4c1-484da06783e2")$card="extra-keyboards".$thh.".jpg";
if($cat=="1c2eeff4-5dcd-321c-29a1-484da0696af9")$card="extra-gamepads".$thh.".jpg";
if($cat=="dcdbf698-a86c-faa6-4506-4ca4a2fa0500")$card="extra-notebookacc".$thh.".jpg";
if($cat=="491e4185-8aaa-1b93-09d2-484da15dcfd0")$card="extra-pouches".$thh.".jpg";
if($cat=="21a1c075-3bc4-a6f1-f506-49ae98e4e61c")$card="extra-gpspouches".$thh.".jpg";
if($cat=="59d9f458-1ca5-ac55-1f04-4c7ccae6a7d6")$card="extra-hddpouches".$thh.".jpg";
if($cat=="9bef594d-c7e1-500f-8d6a-4b2a35ef973a")$card="extra-poweradapters".$thh.".jpg";
if($cat=="cde2b6bb-5cf3-2e8f-d236-484da0c771c3")$card="extra-webcams".$thh.".jpg";
if($cat=="3c1d1dc1-1f6b-6bd6-3949-484da1668c48")$card="extra-bags".$thh.".jpg";
if($cat=="91ba9e26-d2fa-cb07-125b-4c5c0c205a8d")$card="extra-tvtunners".$thh.".jpg";
if($cat=="2be17986-7e5c-a654-dd4c-484da022b063")$card="extra-chargers".$thh.".jpg";
if($cat=="4ba5dcce-070b-25e0-8e48-484da0dc9d18")$card="extra-cables".$thh.".jpg";
if($cat=="3f3f22ef-6a34-7985-ff46-4af40019eb85")$card="extra-audioheadsets".$thh.".jpg";//audio
if($cat=="e52d8e61-709f-1e13-34da-4d667c8c3a5f")$card="extra-touchpadpouch".$thh.".jpg";
if($cat=="5ec7687f-db2e-2abe-525a-4cadc82177a9")$card="extra-waterpouches".$thh.".jpg";
if(file_exists("modules/EcmProductB2Bs/".$card) && $card!=""){
return $card;
}
else return false;
}
function catalogueHeader($p,$th=""){
if($th)$thh="-th";
$p->AddPage();
$p->Image("modules/EcmProductB2Bs/header".$thh.".jpg",5,0,283);
if(file_exists("modules/EcmProductB2Bs/about".$thh.".jpg")){
$p->AddPage();
$p->Image("modules/EcmProductB2Bs/about".$thh.".jpg",5,0,283);
}
return $p;
}
function catalogueContent($p){
$p->AddPage();
$p->Image("modules/EcmProductB2Bs/content1.jpg",5,0,283);
$p->AddPage();
$p->Image("modules/EcmProductB2Bs/content2.jpg",5,0,283);
return $p;
}
function productCardNew($p,$id,$lang,$show_description=true,$show_specification=true,$price="",$symbol="",$show_price=1, $ean=1){
$p->AddPage();
$p->SetMargins(6,0,0,0);
$p->SetDrawColor(0,0,0);
if($lang=="en"){
$features_label="Features";
$description_label="Product Description";
$specification_label="Specification";
$specification_lbl="Description";
}
else {
$features_label="Cechy";
$description_label="Opis produktu";
$specification_label="Specyfikacja";
$specification_lbl="Opis";
}
//get data
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select th,product_category_id,srp_price,name,code,product_picture,packing_front_picture, ean, ean2 from ecmproducts where id='".$id."' and deleted='0'"));
$th=$r['th'];
if($price=="")$price=$r['srp_price'];
if($symbol=="")$symbol="PLN";
$product_picture='modules/EcmProductB2Bs/upload/images/big/'.$r['product_picture'];
if(file_exists('modules/EcmProductB2Bs/upload/images/big/'.$r['packing_front_picture']))$packing_front_picture='modules/EcmProductB2Bs/upload/images/big/'.$r['packing_front_picture'];
//else $packing_front_picture='modules/EcmProductB2Bs/upload/images/'.$r['packing_front_picture'];
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean,long_description,short_description from ecmproduct_language where ecmproduct_id='".$id."' and deleted='0' and lower(language)='".$lang."'"));
$ld=str_replace("&lt;","<",str_replace("&gt;",">",$rr['long_description']));
if($lang=="en")$r['name']=$rr['short_description'];
if(!$rr['ean']){
$rrr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean from ecmproduct_language where ecmproduct_id='".$id."' and language='pl'"));
$rr['ean']=$rrr['ean'];
}
$rrre=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean from ecmproducts where id='".$id."'"));
//if($rrre['ean'])$rr['ean'].="\n".$rrre['ean'];
//background
$pf_width=110;
$pf_x=196;
$pf_y=88;
$p_width=150;
$p_x=72;
$p_y=75;
$show_right_img=true;
$show_specification=true;
$show_description=false;
$spec_x=15;
$desc_x=15;
$textr=49;
$textg=52;
$textb=148;
$spec_l=63;
$desc_l=63;
$spec_d=45;
$desc_d=41;
if($r['product_category_id']=="22f3c3c6-3f7d-12d2-dd29-484da06c4c6d"){
$card="card-mouses.jpg";//mouses
$pf_width=90;
$pf_x=206;
$p_width=130;
$p_y=85;
$p_x=76;
$textr=122;$textg=137;$textb=108;
}
elseif($r['product_category_id']=="94930136-f89f-ab26-6695-4d9c6ea0f818"){
$card="card-euro.jpg";//mouses
$pf_width=90;
$pf_x=206;
$p_width=130;
$p_y=85;
$p_x=104;
$textr=122;$textg=137;$textb=108;
$spec_l=round(55*1.48);
$desc_l=round(55*1.66);
$spec_d=52;
$desc_d=55;
}
elseif($r['product_category_id']=="3f3f22ef-6a34-7985-ff46-4af40019eb85"){//audio headsets
$card="card-audioheadsets.jpg";
$textr=40;$textg=22;$textb=111;
$p_x=80;
$pf_y=80;
$p_width=110;$pf_width=80;
}
elseif($r['product_category_id']=="91ba9e26-d2fa-cb07-125b-4c5c0c205a8d"){//tunners
$textr=49;$textg=45;$textb=34;
$card="card-tvtunners.jpg";
$show_right_img=false;
$p_x=120;
$spec_l=105;
$spec_d=67;
}
elseif($r['product_category_id']=="2be17986-7e5c-a654-dd4c-484da022b063"){//chargers
$textr=82;$textg=148;$textb=204;
$card="card-chargers.jpg";
$p_x=82;
$p_width=140;
$pf_width=100;
$pf_x=202;
}
elseif($r['product_category_id']=="3f52c45d-5ddc-d32c-f072-484da1bf280f"){//memory
$card="card-headsets.jpg";
$p_x=132;
$p_width=134;
$spec_l=120;
$spec_d=75;
$show_right_img=false;
}
elseif($r['product_category_id']=="de0118bd-20c3-bf26-2175-484da1917b97"){
$card="card-headsets.jpg";//headsets
$pf_x=208;
$pf_width=93;
$p_x=88;
$p_y=82;
$p_width=137;
$textr=162;
$textg=124;
$textb=37;
$spec_l=round(55*1.48);
$desc_l=round(55*1.66);
$spec_d=52;
$desc_d=55;
}
elseif($r['product_category_id']=="4ba5dcce-070b-25e0-8e48-484da0dc9d18"){
$card="card-cables.jpg";//cables
$pf_x=205;
$pf_width=85;
$p_x=68;
$p_y=82;
$p_width=137;
$textr=162;
$textg=124;
$textb=37;
$spec_l=round(55*1.48);
$desc_l=round(55*1.66);
$spec_d=52;
$desc_d=55;
$textr=231;$textg=120;$textb=23;
}
elseif($r['product_category_id']=="91ba9e26-d2fa-cb07-125b-4c5c0c205a8d"){//tunners
$card="card-headsets.jpg";
$show_right_img=false;
$p_x=120;
$spec_l=105;
$spec_d=67;
}
elseif($r['product_category_id']=="2be17986-7e5c-a654-dd4c-484da022b063"){
$card="card-headsets.jpg";//chargers
$pf_x=208;
$pf_width=93;
$p_x=88;
$p_y=82;
$p_width=137;
$textr=162;
$textg=124;
$textb=37;
$spec_l=round(55*1.48);
$desc_l=round(55*1.66);
$spec_d=52;
$desc_d=55;
}
elseif($r['product_category_id']=="a6e4f296-dda9-ba2a-1c2a-484d259fcb0f"){
$p_x=86;
$card="card-accessories.jpg";//accessories
$show_right_img=false;
$textr=103;$textg=5;$textb=4;
}
elseif($r['product_category_id']=="1c2eeff4-5dcd-321c-29a1-484da0696af9"){
$card="card-gamepads.jpg";//gamepads
$textr=0;$textg=146;$textb=63;
}
//elseif($r['product_category_id']=="7afa9376-7089-efda-c55d-4b2a51c8ebcc")$card="card-gamepads.jpg";//smartphone accessories
elseif($r['product_category_id']=="21a1c075-3bc4-a6f1-f506-49ae98e4e61c"){
$card="card-gpspouches.jpg";//gps pouches
$pf_width=90;
$pf_x=206;
$textr=0;$textg=146;$textb=63;
}
elseif($r['product_category_id']=="59d9f458-1ca5-ac55-1f04-4c7ccae6a7d6"){
$card="card-hddpouches.jpg";//hdd pouches
$pf_width=90;
$pf_x=206;
$p_width=115;
$p_x+=20;
$textr=31;$textg=26;$textb=23;
}
elseif($r['product_category_id']=="dcdbf698-a86c-faa6-4506-4ca4a2fa0500"){
$p_x=86;
$p_width=130;
$p_y=82;
$show_right_img=false;
$card="card-notebookacc.jpg";//notebook acc
$textr=0;$textg=147;$textb=221;
$show_description=true;
$show_specification=true;
}
elseif($r['product_category_id']=="7afa9376-7089-efda-c55d-4b2a51c8ebcc"){
$card="card-smartphones.jpg";//smartphones
$textr=231;
$textg=120;
$textb=23;
}
elseif($r['product_category_id']=="491e4185-8aaa-1b93-09d2-484da15dcfd0"){
$card="card-pouches.jpg";//pouches
$textr=221;$textg=84;$textb=71;
}
elseif($r['product_category_id']=="9bef594d-c7e1-500f-8d6a-4b2a35ef973a"){
$card="card-poweradapters.jpg";//power adapters
$pf_x=208;
$pf_width=93;
$p_x=95;
$p_y=82;
$p_width=130;
$textr=40;$textg=22;$textb=111;
$spec_l=round(55*1.48);
$desc_l=round(55*1.66);
$spec_d=52;
$desc_d=55;
}
elseif($r['product_category_id']=="59a70ebf-1ec0-2c76-b88c-484da075461d"){
$card="card-hubs.jpg";//hubs
$p_x=94;
$p_width=126;
$pf_width=90;
$pf_x=206;
$spec_l=79;
$spec_d=46;
$textr=218;$textg=37;$textb=29;
}
elseif($r['product_category_id']=="cde2b6bb-5cf3-2e8f-d236-484da0c771c3"){
$card="card-webcams.jpg";//webcams
$p_width=108;
$p_x=82;
$p_y=76;
$pf_width=90;
$spec_l=72;
$textr=221;$textg=19;$textb=123;
}
elseif($r['product_category_id']=="6f32ab3b-9aa1-5a05-d4c1-484da06783e2"){
$card="card-keyboards.jpg";//keyboards
$show_specification=true;
$show_description=true;
$p_x=110;
$spec_l=73;
$spec_d=45;
$textr=0;$textg=124;$textb=195;
}
elseif($r['product_category_id']=="3c1d1dc1-1f6b-6bd6-3949-484da1668c48"){//bags
$card="card-bags.jpg";
//$p_x=126;
//$p_width=134;
//$spec_l=90;
//$spec_d=75;
//$textr=0;$textg=124;$textb=195;
$p_width=130;
$show_right_img=false;
$show_specification=true;
$show_description=true;
$spec_x=85;
$desc_x=15;
$p_x=152;
if($lang=="en")$specification_lbl="Specification";
else $specification_lbl="Specyfikacja";
$spec_l=72;
}
elseif($r['product_category_id']=="cda8794a-1bae-e94c-3e14-484da0df8608"){//speakers
$card="card-speakers.jpg";
$pf_width=80;
$pf_x=210;
$p_width=130;
$p_x=82;
$spec_l=68;
$spec_d=42;
$textr=0;$textg=147;$textb=221;
}
elseif($r['product_category_id']=="77b2bbbc-7ae1-47c3-a5d9-484da1665e3e"){//cleaning items
$show_right_img=false;
$card="card-cleaning.jpg";
$show_specification=true;
$show_description=true;
$spec_x=85;
$desc_x=15;
$p_x=118;
if($lang=="en")$specification_lbl="Specification";
else $specification_lbl="Specyfikacja";
$spec_l=72;
}
elseif($r['product_category_id']=='14c16614-c161-070d-5f81-4d89fbe39eb4'){
$card="card-headsets.jpg";
$pf_width=80;
$pf_x=210;
$p_width=130;
$p_x=115;
$spec_l=110;
$spec_d=82;
}
elseif($r['product_category_id']=="93a9ba91-90b1-89c4-2013-4e9289736925"){ //toys
$card="card-headsets.jpg";
$p_width=130;
$show_right_img=false;
$show_specification=true;
$show_description=true;
$spec_x=85;
$desc_x=15;
$p_x=152;
if($lang=="en")$specification_lbl="Specification";
else $specification_lbl="Specyfikacja";
$spec_l=72;
/*
$pf_width=80;
$pf_x=150;
$p_width=130;
$p_x=115;
$spec_l=120;
$spec_d=82;
$desc_l=80;
$show_specification=true;
$show_description=true;
*/
} elseif ($r['product_category_id']=="1d270ffc-182b-e597-5d06-505c1d133852"){ //poutches touchpad
$card="card-headsets.jpg";
$p_width=130;
$show_right_img=false;
$show_specification=true;
$show_description=true;
$spec_x=85;
$desc_x=15;
$p_x=152;
if($lang=="en")$specification_lbl="Specification";
else $specification_lbl="Specyfikacja";
$spec_l=72;
}
else $card="card-headsets.jpg";//other
$card = "new_card.jpg";
$code_x=230;$code_y=61;
$name_x=15;$name_y=61;
$fr=255;$fg=255;$fb=255;
$code_height=0;
$name_s=21;
$name_width=120;
if ($r['product_category_id']=="59d9f458-1ca5-ac55-1f04-4c7ccae6a7d6") {
$name_width = 100;
}
$price_x=$code_x;$price_y=$code_y+12;
if($th==1){
$pf_width=110;
$pf_x=196;
$pf_y=88;
$p_width=120;
$p_x=148;
$p_y=19;
$show_right_img=false;
$show_specification=true;
$show_description=false;
$spec_x=25;
$desc_x=25;
$textr=0;$textg=0;$textb=0;
$spec_l=100;
$desc_l=68;
$spec_d=65;
$desc_d=41;
$name_x=25;$name_y=85;
$code_x=25;$code_y=98;
$price_x=$code_x+50;$price_y=$code_y+2;
$code_height=10;
$name_s=14;
$name_width=100;
$fr=173;$fg=223;$fb=239;
if($r['product_category_id']=="de0118bd-20c3-bf26-2175-484da1917b97"){
$card="card-headsets-th.jpg";//headsets
}
elseif($r['product_category_id']=="e52d8e61-709f-1e13-34da-4d667c8c3a5f"){
$card="card-touchpadpouch-th.jpg";//touchadpouch
$fr=247;$fg=195;$fb=198;
}
elseif($r['product_category_id']=="3c1d1dc1-1f6b-6bd6-3949-484da1668c48"){
$card="card-bags-th.jpg";//touchadpouch
}
elseif($r['product_category_id']=="491e4185-8aaa-1b93-09d2-484da15dcfd0"){
$card="card-pouches-th.jpg";//touchadpouch
$fr=255;$fg=178;$fb=66;
}
elseif($r['product_category_id']=="7afa9376-7089-efda-c55d-4b2a51c8ebcc"){
$card="card-smartphones-th.jpg";//smartphones
$fr=247;$fg=182;$fb=214;
}
elseif($r['product_category_id']=="5ec7687f-db2e-2abe-525a-4cadc82177a9"){
$card="card-waterpouches-th.jpg";
$fr=214;$fg=223;$fb=33;
}
}
$p->Image("modules/EcmProductB2Bs/".$card,5,0,283);
//image
$p->SetLeftMargin($pf_x);
if(file_exists($packing_front_picture) && is_file($packing_front_picture) && $show_right_img)$p->Image($packing_front_picture,$pf_x,$pf_y,$pf_width);
//to move "new" in cleaning_items
if ($r['product_category_id']=="77b2bbbc-7ae1-47c3-a5d9-484da1665e3e")
$p->SetLeftMargin($p_x+10);
else
$p->SetLeftMargin($p_x);
$p_y-=15;
if(file_exists($product_picture) && is_file($product_picture))$p->Image($product_picture,$p_x,$p_y,$p_width);
//name
$p->SetFillColor($fr,$fg,$fb);
$p->SetFont("arialpl","B",$name_s);
$p->SetTextColor($textr,$textg,$textb);
$p->SetXY($name_x,$name_y);
$p->Multicell($name_width,round($name_s*9/21),prepareName($r['name']),0,"L",1);
$y=$p->GetY();
$p->SetTextColor(0,0,0);
//code, ean
$code_x = $name_x;
$code_y = $code_height+$y+5;
$p->SetXY($code_x,$code_y);
$p->SetFont("arialpl","B",9);
$p->Cell(15,6,"INDEX:",0,0,'L',1);
$p->SetFont("arialpl","",9);
$p->Cell(40,6,$r['code'],0,1,'L',1);
if ($ean==1) {
$p->SetXY($code_x,$code_y+5);
$p->SetFont("arialpl","B",9);
$p->Cell(15,6,"EAN:",0,0,'L',1);
$p->SetFont("arialpl","",9);
$p->Multicell(40,6,$r['ean'],0,'L',1);
} elseif ($ean==2) {
$p->SetXY($code_x,$code_y+5);
$p->SetFont("arialpl","B",9);
$p->Cell(15,6,"EAN:",0,0,'L',1);
$p->SetFont("arialpl","",9);
$p->Multicell(40,6,$r['ean2'],0,'L',1);
}
if($show_price==1){
$p->SetXY($price_x,$price_y);
$p->SetFont("arialpl","B",26);
$p->Cell(25,6,number_format($price,2,",","."),0,0,'L',1);$x=$p->GetX();
$p->SetFont("arialpl","",16);
if(strlen(number_format($price,2,",","."))==6)$plus=5;
else $plus=0;
$p->SetXY($x-1+$plus,$price_y+1);
$p->Cell(15,6,$symbol,0,0,'L',1);
}
//description
$p->SetFont("arialpl","",9);
if($show_description==true){
if($th!=1)$yy=$code_height+$y+15;
else $yy=$code_y+$code_height+13;
$p->SetY($yy);
$text=blockToPrint($description_label,$ld);
foreach($text as $tt){
$tt=str_replace("&bull;&nbsp;","- ",$tt);
$tt=str_replace("&quot;",'"',$tt);
$tt=str_replace("&nbsp;"," ",$tt);
$ttext[]=wordwrap($tt,$desc_d,"\n ");
}
$t=@implode("\n",$ttext);
$t=trim($t);
$t=iconv("UTF-8","ISO-8859-2",$t);
$p->SetX($desc_x);
$p->SetLineWidth(1);
$p->SetFont("arialpl","B",10);
$p->Cell(100,6,$description_label,0,1,'L',1);
$p->Ln(2);
$p->SetFont("arialpl","",9);
$p->SetX($desc_x);
$p->MultiCell($desc_l,4,"".$t,0,"L",1);
}
if($show_specification==true){
if($th!=1)$yy=$code_height+$y+15;
else $yy=$code_y+$code_height+13;
$p->SetY($yy);
$text=blockToPrint($specification_label,$ld);
$ttext=array();
foreach($text as $tt){
$tt=str_replace("&bull;&nbsp;","- ",$tt);
$tt=str_replace("&quot;",'"',$tt);
$tt=str_replace("&nbsp;"," ",$tt);
$ttext[]=wordwrap($tt,$spec_d,"\n ");
}
$t=@implode("\n",$ttext);
$t=trim($t);
$t=iconv("UTF-8","ISO-8859-2",$t);
$p->SetX($spec_x);
$p->SetLineWidth(1);
$p->SetFont("arialpl","B",10);
$p->Cell(50,6,$specification_lbl,0,1,'L',1);
$p->Ln(2);
$p->SetFont("arialpl","",9);
$p->SetX($spec_x);
$p->MultiCell($spec_l,4,"".$t,0,"L",1);
}
$p->SetLineWidth(0.3);
$p->SetDrawColor(77,79,78);
$p->Line(289,5,289,204);
return $p;
}
?>