Hi,
Please can some one help me with this:
I have to send an email to the seller asking him to renew his products. The way I've done it. I send an email for each product to renew.
This is template email(EMAIL_RENEW_SELLER):
Renew your Products
[url]http://www.site.com[/url]
Dear &NAME&,
There is some products they must be renewed every 14 days to ensure that
they are still available for sale :
Product: &PRODUCT&
Please click on the link below to renew your products:
If there is any problem with your query please call
during office hours or email Site.com
And this is a script wich I run through crontab:
session_start();
$d = db_c();
$s1 = "SELECT ID, Name, SellerID FROM Products WHERE Purchased = \"No\" AND (TO_DAYS(NOW()) - TO_DAYS(RenewDate) >= ".RENEW_DELAY.")";
$q1 = db_q($s1);
while($r1 = db_r($q1)){
$renew[$r1["ID"]]=array(
"ID" => $r1["ID"],
"SellerID" => $r1["SellerID"],
"Name" => $r1["Name"]
);
}
foreach($renew as $k1=>$v1){
$s2="SELECT Name, Email FROM Accounts as a LEFT JOIN SellerAccount as sa ON a.ID=sa.AccountID WHERE sa.ID=".$v1["SellerID"];
$r2=db_r(db_q($s2));
$seller=$r2["Name"];
$mail=$r2["Email"];
$lines = file(EMAIL_RENEW_SELLER);
$out = "";
foreach($lines as $k => $v) {
$out.= $v;
}
$email="";
$email.= $out;
$email = str_replace("&NAME&", $seller, $email);
$email = str_replace("&PRODUCT&", $v1["Name"], $email);
$email = str_replace("&ID&", $v1["ID"], $email);
if($email!=""){ mail("$mail", "", $email); }
}
db_d($d);
exit;
But What I want it's to send all the products with there links on the same email