db->getAll('select p.*,r.translit as rubric_translit,b2.email from catalogs_products p
LEFT JOIN catalogs_rubrics r ON r.id=p.rubric_id
LEFT JOIN catalogs_brends b ON b.id=p.brend_id
LEFT JOIN catalogs_brends b2 ON b2.name=b.name AND b2.active=1
WHERE p.count_modifications>0',array(),DB_FETCHMODE_ASSOC);
$products = array();
foreach($res as $row){
$count_mod = $setup->db->getOne("select count(DISTINCT(cine)) from catalogs_modifications where product_id=? and active=1",array($row['id']));
if($count_mod>1 && strlen($row['email'])>0)$products[ $row['email'] ][] = $row;
}
$mail = new PHPMailer();
$msg2 = '';
foreach($products as $email=>$_products){
print 1;
$mail->CharSet = "windows-1251";
$mail->From = "cron@extremstyle.ua";
$mail->FromName = "cron";
$mail->AddAddress($email,"shop");
$mail->Subject = "Îòëè÷èå öåí! extremstyle.ua";
$msg = "";
foreach($_products as $key=>$row){
$msg .= "http://extremstyle.ua/".$row['rubric_translit']."-catalogs/".$row['translit']."-".$row['id']."/";
$msg .= "
";
$msg2 .= $msg;
}
$mail->MsgHTML($msg);
if(!$mail->Send()){echo "There has been a mail error sending to
";return false;}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
$mail = new PHPMailer();
$mail->CharSet = "windows-1251";
$mail->From = "cron@extremstyle.ua";
$mail->FromName = "cron";
$mail->AddAddress('lena@eltrade.com.ua',"shop");
$mail->AddAddress('bykov@eltrade.com.ua',"shop");
$mail->Subject = "Îòëè÷èå öåí! extremstyle.ua";
$mail->MsgHTML($msg2);
if(!$mail->Send()){echo "There has been a mail error sending to
";return false;}
$mail->ClearAddresses();
$mail->ClearAttachments();
?>