differcost.php
1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
set_time_limit(0);
//error_reporting (0);
$_SERVER['DOCUMENT_ROOT'] = realpath(dirname(__FILE__)."/..");
require($_SERVER['DOCUMENT_ROOT'] . "/libs/setup.php");
$setup = new setup();
$res = $setup->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 .= "<br>";
$msg2 .= $msg;
}
$mail->MsgHTML($msg);
if(!$mail->Send()){echo "There has been a mail error sending to <br>";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 <br>";return false;}
$mail->ClearAddresses();
$mail->ClearAttachments();
?>