tgonzalez Posted October 28, 2019 Share Posted October 28, 2019 Hola, estoy teniendo problemas al añadir un producto en buble, dónde puede estar el error? try{ echo "<br><br><br>"; if(getPriceCsv($refgen)){ // if(sizeof($d)==32){ /*$archivo2= preg_replace('/[\t]+/', ';',fgets($archivo)); $c = preg_split ('/[,;]/',$archivo2); $c[0]=intval(preg_replace('/-/', '', $c[0])); $d=$c; $id=preg_replace('/-/', '', $d[0]);; $refgen=(int)$id;*/ $existe=checkExiste($refgen); // echo "No existe"; //echo $id."<br>"; // $precioreseller=$d[29]; // $codigoFabricante=$d[30]; // $description=eliminar_simbolos($d[2]); //$tipoDeUnidad=$d[2]; // echo "Descripcion es $description"; $unidadesPriCol=100;//$c[3]; // echo "dividir es ".$c[3]; //echo "aqui llego"; include 'config/config.inc.php'; /*include 'classes\shop\Shop.php'; include 'classes\shop\ShopGroup.php'; include 'classes\shop\ShopUrl.php';*/ include 'init.php'; //limpio la caché Tools::clearSmartyCache(); Tools::clearXMLCache(); Media::clearCache(); Tools::generateIndex(); // echo "aqui llego"; $default_lang = Configuration::get('PS_LANG_DEFAULT'); //echo "def language"; ///CALCULO DE UNIDADES /*$unidadesVenta=$d[9]; $dividir=$d[8]; $precio1=($dividir/100)/$unidadesVenta;*/ $product->price = getPriceCsv($refgen); $product = new Product(); if($existe){ $product = new Product(intval($existe)); } $product->name = [$default_lang => urlencode($d[3])]; $product->link_rewrite = Tools::str2url($d[3])."".rand(300, 20000); $product->price = getPriceCsv($refgen); $product->quantity = 70; $product->active = 1; $product->reference = $id; $product->visibility = "both"; $product->show_price = 1; $product->on_sale = 1; $product->minimal_quantity = 1; $depth= $d[11]; $imagen1=$d[14]; echo "<br>la imagen es".$imagen1." <br>!"; $img = file_get_contents($d[14]); file_put_contents('imagen.jpg', $img); $url='imagen.jpg'; echo "imagen"; //if($imagen1){ echo "<br>imagen añadir<br>"; $image = new Image(); echo "<br>imagen añadir0<br>"; $image->id_product = (int) $product->id; $image->position = Image::getHighestPosition($product->id) + 1; echo "<br>imagen añadir1<br>"; $image->cover = true; $image->add(); echo "<br>imagen añadir2<br>"; if (!copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) { $image->delete(); } echo "llego al final"; //} //echo "1"; @unlink($url); //echo "1"; sleep(0.5); // } } }catch(Exception $ex){ $numVar="logger1.txt"; $fileVar=fopen($numVar,"a"); fwrite($fileVar,$i." dividir $dividir unidadesVenta $unidadesVenta ".$ex->getMessage()." depth ".$depth." \n"); fclose($fileVar); } Un saludo Link to comment Share on other sites More sharing options...
joseantgv Posted October 29, 2019 Share Posted October 29, 2019 Pero qué problema tienes? Link to comment Share on other sites More sharing options...
tgonzalez Posted October 29, 2019 Author Share Posted October 29, 2019 Sólo se añade 1 producto 😕 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