Hi,
I’m a total beginner with php, so please bear with me…
I have a stock feed from a supplier working on a zencart website, it works fine when supplying an amount ie: Stock: 23, but when items are due back in stock it supplies an available date ie 27/3/2012.
In this instance all that would appear is Stock: 27 which obviously causes a problem.
The supplier has sent some suggested revised code, but I just end up with a blank product page.
Here is the relevant original code that just works for the stock figure:
[php]$pida=$_GET[‘products_id’];
$checkManId=$db->Execute(“SELECT manufacturers_id, products_model from products where products_id=”.$pida);
$manId=$checkManId->fields[‘manufacturers_id’];
$pModel=$checkManId->fields[‘products_model’];
if($manId == 2){
$Url=‘http://www.hafele.co.uk/hafele35a1/templates/hafele/StockAvailability2.asp?itemcodes=’.$pModel;
$stockLimit=curl_download($Url);
}
"){ $display_qty = 'Stock: 0
'; }else{ $display_qty = 'Stock: '.(int)$stockLimit."
"; } }else{ $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '
' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '
' : ''); } [/php] The revised code that causes a blank product page is as follows, as far as I can see it just has the one extra }elseif statement: [php]$pida=$_GET['products_id']; $checkManId=$db->Execute("SELECT manufacturers_id, products_model from products where products_id=".$pida); $manId=$checkManId->fields['manufacturers_id']; $pModel=$checkManId->fields['products_model']; if($manId == 2){ $Url='http://www.hafele.co.uk/hafele35a1/templates/hafele/StockAvailability2.asp?itemcodes='.$pModel; $stockLimit=curl_download($Url); } <?php if($manId == 2){ if(trim($stockLimit) == "DISC"){ $display_qty = 'Stock: 0
'; }elseif (strpos(trim($stockLimit), '/')) { $display_qty = 'Available: '.$stockLimit."
"; }else { $display_qty = 'Stock: '.(int) $stockLimit."
"; } }else{ $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '
' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']- >get_quantity($_GET['products_id']) . '
' : ''); } [/php] Any help would be greatly appreciated. Thanks Phil