Jump to content

qhe

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Activity
    Developer

qhe's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Hola, El problema estaba en la comillas de CURLAUTH_BASIC: curl_setopt($curl, CURLOPT_HTTPAUTH, 'CURLAUTH_BASIC'); En php 5.4 es una constante: curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); Quitando las comillas ya funciona. Saludos,
  2. Hola Gerard13, Entiendo que en momentos en que las cosas no funcionan como uno desearía, se tienda a buscar un "cabeza de turco" al que poder cargarle todas las culpas. Creo que esto es lo que hiciste en tus dos últimos posts. Sin embargo, cuando las cosas se arreglaron, hubieras tenido que matizar o cambiar estas informaciones ya que con ellas, independientemente del perjuicio que haces al producto, estas dando información errónea a toda la comunidad de usuarios de PrestaShop. Es cierto que hubo problemas con la subida de imágenes. Se daban sólo en una versión concreta de php (creo que era la 5.4) lo cual nos llevó más tiempo de lo normal en solucionarlo ya que en las demás versiones de php funcionaba correctamente. Lo de las dos semanas sin imágenes, fueron realmente dos días hasta que no logramos restaurar la web. Se tardó tanto en poder volver a subir y asignar las imagenes de los cerca de 4000 artículos, porque no habiais hecho ninguna copia de seguridad de la base de datos y no se pudo restaurar. También hay que destacar que estabais haciendo las pruebas directamente en la tienda de producción lo cual es bastante "temerario" si me permites la expresión y más si os saltabais el paso de hacer copias de seguridad. Como ya os dije en su dia, las pruebas hay que hacerlas siempre en una tienda de "pruebas" y más en tiendas con vuestro volumen y tráfico. De esta forma no se compromete la tienda de producción. Lo de los módulos de dropshiping que no funcionaban, no era debido a QFACWIN, como se demostró posteriormente: simplemente estabais intentando hacer dropshiping utilizando un hosting compartido en lugar de utilizar un VPS o servidor dedicado. El dropshiping utiliza muchos recursos del hosting y no es viable en servidores compartidos por ello no funcionaban dichos módulos. De hecho, cuando cambiasteis a un servidor VPS se solucionaron estos problemas. En cuanto a que el conector con prestashop no valida ningún campo a la hora de actualizar datos en prestashop: Hubo un problema con el caracter ^ que habíais puesto en las descripciones de los artículos, que al traspasarlo subia mal a prestashop, pero de ahí a que no se valide ningún campo... De todas formas, ya esta resuelto des de la versión 16.08. Cualquiera puede hacer la prueba: descargaros la versión gratuita e intentar subir a prestashop caracteres no permitidos en referencias, nombres de artículos, categorías o fabricantes. Me consta que una vez solucionados estos problemas, tanto vosotros como las empresas del grupo (alguna con licencia para 11 usuarios), seguís trabajando con QFACWIN y el conector de PrestaShop. Creo que esta información también deberías compartirla en este foro. Saludos, Quim
  3. I think it's a problem of cookies. I deleted all cookies from the site and it works. Regards Quim
  4. Thank you very much for your explanation Prestashopninja. I will change the code and all that I have like this.
  5. Thank you, Prestashopninja How you would control the result of curl_exec?
  6. I have a problem when trying to upload an image with cURL in php 5.4.4: returns HTTP/1.1 401 error The php code is: define("PS_SHOP_PATH", 'http://mydomain.com/'); define("PS_WS_AUTH_KEY", 'XXXXXXXXXXX' ); $img= _PS_TMP_IMG_DIR_ .$myfoto ; $crlf = '<br>'; $curl = curl_init(); curl_setopt($curl,CURLOPT_HEADER, true); curl_setopt($curl,CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLINFO_HEADER_OUT, true); curl_setopt($curl, CURLOPT_URL, PS_SHOP_PATH . '/api/images/products/' . $id_produc ); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_HTTPAUTH, 'CURLAUTH_BASIC'); curl_setopt($curl, CURLOPT_USERPWD, PS_WS_AUTH_KEY ); curl_setopt($curl, CURLOPT_POSTFIELDS, array('image' => '@'.$img) ); if( ! $result = curl_exec($curl)) { echo $crlf .'Error : '.$id_produc.' '.$img.' -> '. curl_error($curl). $crlf; } else { echo $result. '<br>. Image added: ' . $img . $crlf ; } curl_close($curl); curl_exec ($curl) does not return false, but it does nothing. The images are not added to ps_images table and the thumbnails do not regenerate The result: ------------------------------------------------------------ HTTP/1.1 100 Continue HTTP/1.1 401 Unauthorized Server: nginx Date: Thu, 13 Mar 2014 04:36:43 GMT Content-Type: text/html; charset=utf-8 Content-Length: 0 Connection: keep-alive WWW-Authenticate: Basic realm="Welcome to PrestaShop Webservice, please enter the authentication key as the login. No password required." Set-Cookie: d016c4f59c9c5afccdfacac7a5eaeabb=scp0ebxtPV2JO61O5kxfRnWYQSZx5ofvZ8EW2DJxg5lu%2FTf%2BTZmjJFe0sJR1QFz8SWdkd2Z1XhBYqCwZeRFMQoo9YQa3CxqL0AjjwnoyhR8%3D000079; expires=Wed, 02-Apr-2014 04:36:43 GMT; path=/; domain=mydomain.com; httponly Vary: Host,Accept-Encoding X-Powered-By: PleskLin --------------------------------------------------------------- I get the same error with different versions of prestashop (1.4.10.0, 1.5.6.1 and 1.6.0.5) in php 5.4.4. However, at the same stores in php 5.2 works well Do you know if there is any problem with prestashop webservice and php 5.4.4? Thank you very much. Regards, Quim
  7. Hola de nuevo, Investigando el error , parece que sólo se da en servidores con php 5.4.4 Me da el mismo error con distintas versiones de prestashop (1.4.10.0, 1.5.6.1 y 1.6.0.5) en php 5.4.4. Sin embargo,en las mismas tiendas en php 5.2 funciona bien ¿Sabeis si hay algun problema con el webservice de prestashop y php 5.4.4 ? Saludos,
  8. Hola, Tengo un problema que se reproduce en algunas tiendas de la versión 1.5.6.1 (en otras no) y en distintos hostings. Al intentar subir una imagen con cURL me da el error siguiente: El código es el mismo para ambos: define("PS_SHOP_PATH", 'http://midominio.com/'); define("PS_WS_AUTH_KEY", 'XXXXXXXXXXX' ); $img= _PS_TMP_IMG_DIR_ .$mifoto ; $curl = curl_init(); curl_setopt($curl,CURLOPT_HEADER, true); curl_setopt($curl,CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLINFO_HEADER_OUT, true); curl_setopt($curl, CURLOPT_URL, PS_SHOP_PATH . '/api/images/products/' . $id_produc ); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_HTTPAUTH, 'CURLAUTH_BASIC'); curl_setopt($curl, CURLOPT_USERPWD, PS_WS_AUTH_KEY ); curl_setopt($curl, CURLOPT_POSTFIELDS, array('image' => '@'.$img) ); if( ! $result = curl_exec($curl)) { echo $crlf .'Error : '.$idproduc.' '.$img.' -> '.curl_error($curl). $crlf; } else { echo $result. '<br>. Image added: ' . $nomfoto . $crlf ; } curl_close($curl); Al ejecutar curl_exec($curl) no devuelve falso, pero no hace nada (no añade la imagen a ps_images ni genera las miniaturas) y devuelve: HTTP/1.1 100 Continue HTTP/1.1 401 Unauthorized Server: nginx Date: Thu, 13 Mar 2014 04:36:43 GMT Content-Type: text/html; charset=utf-8 Content-Length: 0 Connection: keep-alive WWW-Authenticate: Basic realm="Welcome to PrestaShop Webservice, please enter the authentication key as the login. No password required." Set-Cookie: d016c4f59c9c5afccdfacac7a5eaeabb=scp0ebxtPV2JO61O5kxfRnWYQSZx5ofvZ8EW2DJxg5lu%2FTf%2BTZmjJFe0sJR1QFz8SWdkd2Z1XhBYqCwZeRFMQoo9YQa3CxqL0AjjwnoyhR8%3D000079; expires=Wed, 02-Apr-2014 04:36:43 GMT; path=/; domain=midominio.com; httponly Vary: Host,Accept-Encoding X-Powered-By: PleskLin En otra tienda devuelve: HTTP/1.1 100 Continue HTTP/1.1 401 Unauthorized Date: Tue, 11 Mar 2014 12:55:30 GMT Server: Apache Vary: Host,Accept-Encoding WWW-Authenticate: Basic realm="Welcome to PrestaShop Webservice, please enter the authentication key as the login. No password required." Set-Cookie: d016c4f59c9c5afccdfacac7a5eaeabb=I73CVkroiGPA%2F4UX%2F7335CgufWsoycErS8CFegXSq9B7FhBGJGfqHFWnxgy62pbwp26MTZJvGpBqJFjTCTpMAk%2FBf4ZTzpcehEuU1HP5%2Fm0%3D000079; expires=Mon, 31-Mar-2014 12:55:30 GMT; path=/tienda/; domain=midominio.es; httponly Content-Length: 0 Content-Type: text/html; charset=utf-8 ¿Alguien sabe a que puede ser debido o que estoy haciendo mal? Muchas gracias de antemano. Saludos. Quim
  9. I have two weeks testing and looking for documentation but I can not do it. I have prestashop 1.5.4.1 and use this code from Chapter 9 - Image management. It works to add images but not modify: I want to change the image 33 of the product 9 with a new image <?php define('PS_SHOP_PATH', 'http://myhost.com/testshop/api/images/products/9/33'); // id_product = 9 id_image = 33 (33.jpg) define('PS_WS_AUTH_KEY', 'RNOLmy key'); $img=$_SERVER["DOCUMENT_ROOT"].'/testshop/img/tmp/newimagefor33.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, PS_SHOP_PATH); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image . I do it curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$img)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); ?> It does not work (does nothing) <?php define('PS_SHOP_PATH', 'http://myhost.com/testshop/api/images/products/9/33'); // id_product = 9 id_image = 33 (33.jpg) define('PS_WS_AUTH_KEY', 'RNOLmy key'); $img=$_SERVER["DOCUMENT_ROOT"].'/testshop/img/tmp/newimagefor33.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, PS_SHOP_PATH); //curl_setopt($ch, CURLOPT_POST, true); //<--- I comment this curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$img)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); ?> It does not work. What am I doing wrong? Is there another way? Could delete the image and then add it back. Anyone know how to delete an existing image using the api? Thank you very much. Regards, Quim
  10. Thank you very much for the suggestion, Carlsen. Would need a solution that does not depend on whether or not the user uses these fields in his shop. If I do not find the way, I will have to work directly with the tables but it would be better to do it with the API. Regards,
  11. Hi all, I'm programming an ERP integration with prestashop and for this I need to create a field in the product table that will contain the id of the ERP product so I can synchronize both. The problem is that once I have modified the table and added the new field, I can not retrieve it using the web services. I tried with: www.myshop.com/api/products/1 and www.myshop.com/api/products/?display=full but the new field don't appears www.myshop.com/api/products/?display = [id, MyField] but fails Does anyone know how to do? Should we add the new field somewhere so that the web services will recognize? Thank you very much. Regards, Quim
  12. Hola a todos, Estoy programando la integración de un ERP con prestashop y para ello necesito crear un campo en la tabla product que contendra el id de producto del ERP y así poder sincronizar ambos. El problema que tengo es que una vez modificada la tabla y añadido el nuevo campo, no consigo recuperarlo mediante el web service. He probado con: www.mitienda.com/api/products/1 y con www.mitienda.com/api/products/?display=full pero no aparece el nuevo campo www.mitienda.com/api/products/?display=[id,MICAMPO] pero da error ¿ Alguien sabe como hacerlo ? ¿ Hay que añadir el nuevo campo en algún sitio para que el web service lo tenga en cuenta? Muchas gracias de antemano. Saludos, Quim
×
×
  • Create New...