Mirt Posted February 20, 2018 Share Posted February 20, 2018 Hola, Mi proveedor me a facilitado un codigo que debe ir en la raiz del ftp pero me arroja error500 alguien podria explicarme el motivo por favor? Gracias. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); include('config/config.inc.php'); $db = new PDO("mysql:host=localhost;port=3306;dbname="._DB_NAME_."", _DB_USER_, _DB_PASSWD_); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $jsonData = json_decode(file_get_contents('http://webproveedor.com/pedidosjson.php')); foreach($jsonData->data as $rowjson){ $quantity = $rowjson->Existencias-$rowjson->Reservas; $res4 = $db->prepare("SELECT id_product, id_product_attribute from vs_product_attribute WHERE reference = :reference"); $res4->execute(array(':reference'=> $rowjson->Articulo)); echo '[' . $rowjson->Articulo . ']' . $rowjson->Descripcion . ' => ' . $quantity . '<br/>'; if ($res4->rowCount() > 0) { $row4 = $res4->fetch(); $res = $db->prepare("update vs_stock_available set quantity = :q where id_product_attribute = :id_product_attribute"); $res->execute(array(':q'=>$quantity, ':id_product_attribute'=>$row4['id_product_attribute'])); $res = $db->prepare("update vs_product_attribute set quantity = :q where id_product_attribute = :id_product_attribute"); $res->execute(array(':q'=>$quantity, ':id_product_attribute'=>$row4['id_product_attribute'])); $res = $db->prepare("update vs_product_attribute set wholesale_price = :q where id_product_attribute = :id_product_attribute"); $res->execute(array(':q'=>$rowjson->cost, ':id_product_attribute'=>$row4['id_product_attribute'])); $res = $db->prepare("update vs_stock_available set quantity = quantity + :q where id_product = :id_product and id_product_attribute = 0"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); $res = $db->prepare("update vs_product set quantity = quantity + :q where id_product = :id_product"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); $res = $db->prepare("update vs_product set wholesale_price = :q where id_product = :id_product"); $res->execute(array(':q'=>$rowjson->cost, ':id_product'=>$row4['id_product'])); } else { $res4 = $db->prepare("SELECT id_product from vs_product WHERE reference = :reference"); $res4->execute(array(':reference'=>$rowjson->Articulo)); if ($res4->rowCount() > 0) { $row4 = $res4->fetch(); $res = $db->prepare("update vs_stock_available set quantity = :q where id_product = :id_product and id_product_attribute = 0"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); $res = $db->prepare("update vs_product set quantity = :q where id_product = :id_product"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); } } } Db::getInstance()->Execute("UPDATE vs_product_shop SET cache_default_attribute = NULL"); Db::getInstance()->Execute("UPDATE vs_product SET cache_default_attribute = NULL"); die(); ?> Link to comment Share on other sites More sharing options...
Mirt Posted February 20, 2018 Author Share Posted February 20, 2018 Ya lo arregle, era por la extension de la bd que en el codigo esta como vs_ y la tengo puesta por defecto en ps_ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now