![]() |
|
#11
|
||||
|
||||
|
And, thank you for pointing out the flaws, the updated code has gone straight onto my sites.
This is how it's supposed to work ![]()
__________________
Easy New Shop A work in progress |
|
#12
|
|||
|
|||
|
no worries mate
Luke |
|
#13
|
|||
|
|||
|
Thanks for this code which has been really helpful.
The code $sEndDate = $sEndDate[2].'/'.$sEndDate[1].'/'.$sEndDate[0]; now returns date with time that distorts the format of expiry date. Whats the workaround? Reversing the order i.e $sEndDate = $sEndDate[0].'/'.$sEndDate[1].'/'.$sEndDate[2];works well but gives the date in the format yyyy-mm-dd which is somehow confusing as it is not in UK format.
__________________
Beautify your garden with low priced LawnMowers |
|
#14
|
|||
|
|||
|
ok for some strange that exact same code has now stopped working!
not sure if it is a problem AW end or something that they have changed? here is my code Code:
$storeID = array(
9,65,157,172,282,323,380,427,483,547,550,686,782,854,896,911,980,1043,
1052,1084,1107,1109,1132,1134,1152,1184,1186,1198,1202,1221,1228,
1252,1256,1257,1311,1322,1331,1344,1350,1402,1404,1418,1472,
1487,1521,1559,1597,1598,1599,1672,1744,1815,1826,1836,1916,1946,
1947,1964,1970,1971,1995,2026,2038,2041,2066,2117,2124,2147,2203,2208,
2249,2258,2276,2339,2344,2354,2383,2400,2424,2433,2453,2481,2526,
2537,2547,2548,2549,2605,2650,2690,2713,2731,2787,2943,3146,3175,3278);
$oClient = ClientFactory::getClient();
$merchantcolumns = array(sStrapline,sDescription,sLogoUrl,sDisplayUrl,sClickThroughUrl,oDiscountCode);
$multiplemerchantwithcodes = array("sColumnToReturn" => $merchantcolumns, "iAdult" => 1);
$oResponse= $oClient->call('getMerchant', $multiplemerchantwithcodes);
print_r($oResponse);
foreach($oResponse->oMerchant as $details)
{
$iId = $details->iId;
$iId2 = "AW".$iId;
$smsName =$details->sName;
$sStrapline = $details->sStrapline;
$sDescription = $details->sDescription;
$sLogoUrl = $details->sLogoUrl;
$sDisplayUrl = $details->sDisplayUrl;
$sClickThroughUrl = $details->sClickThroughUrl;
#for merchants with multi codes
if(in_array($iId, $storeID))
{
$arraycheck1 = $details->oDiscountCode;
if(!empty($arraycheck1) and is_array($arraycheck1))
{
echo '<p><h3>Vouchers for '.$smsName.'</h3>';
foreach($details->oDiscountCode as $key=>$details2)
{
$sCode = "";
$sCode = $details2->sCode;
$sDescription = addslashes($details2->sDescription);
$sDescription = str_replace("£","£",$sDescription);
$sUrl = $details2->sUrl;
$sEndDate = $details2->sEndDate;
echo "<p><a href='$sUrl'>".$sCode."<br />".$sDescription."</a><br /></p>";
if ($sUrl == '')
{
$sUrl = $sClickThroughUrl;
}
$insert_codes = "INSERT INTO
tbl_codes (code, codeLink, storeID, details, datestamp, expireDate)
VALUES ('$sCode', '$sUrl', '$iId2', '$sDescription', '$date', '$sEndDate')";
$sql = mysql_query($insert_codes)or die(mysql_error());
}
}
#for merchants with single codes
elseif(!empty($arraycheck1) and !is_array($arraycheck1))
{
echo '<p><h3>Vouchers for '.$smsName.'</h3>';
$sCode = $details->oDiscountCode->sCode;
$sDescription = $details->sDescription;
$sDescription = str_replace("£","£",$sDescription);
$sUrl = $details->oDiscountCode->sUrl;
$sEndDate = $details2->sEndDate;
echo "<p>".$sCode."<br />".$sDescription."<br /></p>";
if ($sUrl=='')
{
$sUrl = $sClickThroughUrl;
}
$insert_codes = "INSERT INTO
tbl_codes (code, codeLink, storeID, details, datestamp, expireDate)
VALUES ('$sCode', '$sUrl', '$iId2', '$sDescription', '$date', '$sEndDate')";
$sql = mysql_query($insert_codes)or die(mysql_error());
}
}
}
the error says SoapError Object ( [sCode] => HTTP [sString] => Error Fetching http headers [sDetails] => getMerchant: No error message available ) anyone else experiencing the same problem thanks Luke |
|
#15
|
|||
|
|||
|
Not sure if this is related, Luke, but my sites all fell over this morning and I'm finding this in the log file:
Quote:
Gez Sorry - just realised you are referring to API, whereas I am using v3 Client... Last edited by gez : 27-07-11 at 14:15. Reason: realised OP referring to API not Client |
|
#16
|
|||
|
|||
|
Just to close out my reply, my own issue is now resolved - it was due to a power outage at AW's servers, so maybe this did impact on your problem Luke. If that was the culprit then it should be OK now...
|
|
#17
|
||||
|
||||
|
__________________
Please note I have now left Digital Window for pastures new. George Fletcher Product Manager Digital Window Ltd |
![]() |
| Thread Tools | |
| Display Modes | |
|
|