ShopWindow Forum  

Go Back   ShopWindow Forum > ShopWindow API v3 > API Bug Reports v3
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #11  
Old 25-09-09, 14:45
currentstyle's Avatar
currentstyle currentstyle is offline
ShopWindow Pro
 
Join Date: Nov 2008
Posts: 78
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
Reply With Quote
  #12  
Old 25-09-09, 17:24
ljackson09 ljackson09 is offline
ShopWindow Pro
 
Join Date: Jun 2009
Posts: 96
no worries mate

Luke
Reply With Quote
  #13  
Old 08-11-09, 00:20
infocraze infocraze is offline
Active Member
 
Join Date: Oct 2008
Posts: 19
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
Reply With Quote
  #14  
Old 27-07-11, 11:15
ljackson09 ljackson09 is offline
ShopWindow Pro
 
Join Date: Jun 2009
Posts: 96
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("&pound;","",$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("&pound;","",$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());
                } 
				
}
}
but its now not returning any codes but an error instead?

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
Reply With Quote
  #15  
Old 27-07-11, 14:03
gez gez is offline
Active Member
 
Join Date: Sep 2010
Posts: 20
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:
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://v3.core.com.productserve.com/ProductServeService.wsdl' : Start tag expected, '<' not found
in /home/xxx/public_html/xxx.co.uk/classes/class.soap_client.php on line 53
They were working yesterday and earlier today, and I haven't touched that file, so I'm not sure if something has happened at my (hosted) server end or at productserve.com...
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
Reply With Quote
  #16  
Old 27-07-11, 16:16
gez gez is offline
Active Member
 
Join Date: Sep 2010
Posts: 20
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...
Reply With Quote
  #17  
Old 27-07-11, 17:01
GeorgeGaz's Avatar
GeorgeGaz GeorgeGaz is offline
Product Manager
 
Join Date: Jan 2008
Location: Digital Window HQ
Posts: 633
Hello all,

Please see this a4u post for more information but there was a power outage.

Kind regards
__________________
Please note I have now left Digital Window for pastures new.

George Fletcher
Product Manager
Digital Window Ltd
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 16:53.