EXPORTAR DATOS FW A PRESTASHOP [SOLUCIONADO PROBLEMA IMAGEN]

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Tue Dec 27, 2022 6:40 pm

Buenas tardes Navarro
Me uno a la petición
deumare arroba gmail punto com

gracias
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby csincuir » Wed Dec 28, 2022 1:01 pm

Cristobal, yo tambien me uno a la petición, me puedes compartir la clase por favor.
sincuir.romero arroba gmail.com

Gracias

Carlos
csincuir
 
Posts: 396
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby Cgallegoa » Wed Dec 28, 2022 10:04 pm

Cristobal, buenas tardes,

Una solicitud más, te agradeceré si me envías tu clase: cgallegoaecu@gmail.com

Gracias y feliz navidad
Saludos,

Carlos Gallego

*** FWH-23.10, xHarbour 1.2.3 Build 20190603, Borland C++7.30, PellesC ***
Cgallegoa
 
Posts: 414
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Thu Dec 29, 2022 4:39 am

Buenos dias
Sigo con las pruebas

Me he encontrado este pequeño problema.
Al generar el fichero CSV con la instrución :
Code: Select all  Expand view
COPY TO cNuevoFichero DELIMITED WITH ( { "",";" } )


el último caracter del fichero tiene un valor ASCII 26

ASCII HEX SIMBOLO DESCRIPCION
-----------------------------------------------------------------------
26 1A SUB SUBSTITUIR - REEEMPLAZAR

Esto provoca que al importarse en PRESTASHOP genera un registro falso, sin datos.

Alguien sabe como evitarlo o como eliminarlo ?

Lo he intentado con FWRITE() sin exito.

Gracias
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby Antonio Linares » Thu Dec 29, 2022 8:58 am

Prueba a leer el fichero usando hb_memoRead() y lo vuelves a salvar con hb_memoWrit() quitando el ultimo caracter usando SubStr()

hb_memoWrit( "nombreFichero", SubStr( hb_memoRead( "nombreFichero" ), 1, Len( hb_memoRead( "nombreFichero" ) ) - 1 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Thu Dec 29, 2022 10:45 am

Gracias Antonio por contestar.

Antes de leer tu respuesta he probado lo siguiente y parece que SI funciona.

Antes del codigo de control 26, estaba un salto de carro CHR(13)+CHR(10), así que se me ha ocurrido escribir tres espacios en blanco, donde estaba la cadena CHR(13)+CHR(10)+CHR(26).

En principio funciona.

Gracias de nuevo.

Jesús Marín
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Mon Jan 02, 2023 1:29 pm

Buenos dias a todos y Feliz Año

La verdad es que me estoy volviendo loco con la importación de las imagenes.
Al final, creo el fichero CSV desde FW pero por algún motivo la imagen no se carga ni se crean las miniaturas.

Algo extraño.
Tendre que acabar comprando un módulo para hacer importaciones.

Saludos a todos
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby VictorCasajuana » Mon Jan 02, 2023 3:40 pm

Como cargas las imágenes?

Enviado desde mi motorola edge 20 mediante Tapatalk
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Tue Jan 03, 2023 3:46 am

Buenos dias
1) He creado un directorio en el raiz (tambien he probado en /public_html/img)
2) Copio en ese directorio la(s) imagenes en formato .jpg
3) En el fichero que exporto desde FW, pongo la url de 1 sola imagen. P.ej.: https://deumare.com/lalimagenes/318.jpg
4) Hago la importación desde el back office de PS

No da error de ningun tipo (no existe el fichero o no válido), pero no carga ninguna imagen, ni genera las miniaturas.

Saludos
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby VictorCasajuana » Tue Jan 03, 2023 7:00 am

No sé si de la forma que lo estás haciendo es válido.
Prestashop ya tiene un método para subir las imágenes, si lo haces así, te genera las miniaturas y todo lo necesario para el correcto funcionamiento:
https://devdocs.prestashop-project.org/8/webservice/tutorials/advanced-use/image-management/
Yo con el Curl que incluye HB no lo pude conseguir ya que me faltaba la clase CurlFile(). Supongo que podría crearla investigando los datos que necesita, pero lo tengo con una llamada a la línea de comandos y el curl.exe
Code: Select all  Expand view

curl.exe -v -u WSKEY:WSKEY -F "image=@c:\nombreimagen.jpg -k http://url/images/products/123

donde 123 es el ID del producto y WSKEY es la llave del WS de prestashop

espero te sirva de ayuda.

Salud!
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby Marc Venken » Sat Jan 07, 2023 11:16 am

JESUS MARIN wrote:Tendre que acabar comprando un módulo para hacer importaciones.

Saludos a todos


I think you better do that.... Not always interesting reinventing the wheel ))))

Presta evolves and the import modules also. With a module you always will have a good working program and you only have to deliver the data as CSV or XLS. That never changes... Presta Does.

I used several mudules and be far the best in performance and use was :

Product Catalog (CSV, Excel) Import : Will be around 140 euro. In Belgium a IT's = 70 euro a hour )))
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby JESUS MARIN » Sat Jan 07, 2023 5:07 pm

Marc Venken wrote:
JESUS MARIN wrote:Tendre que acabar comprando un módulo para hacer importaciones.

Saludos a todos


I think you better do that.... Not always interesting reinventing the wheel ))))

Presta evolves and the import modules also. With a module you always will have a good working program and you only have to deliver the data as CSV or XLS. That never changes... Presta Does.

I used several mudules and be far the best in performance and use was :

Product Catalog (CSV, Excel) Import : Will be around 140 euro. In Belgium a IT's = 70 euro a hour )))


Good afternoon Mark
Yes, you are absolutely right.
I have already managed to import many things, but I still have problems with the images. I'm looking (they're looking at me) at a couple of settings, in case it's a configuration issue.
But, I am very afraid, that I will end up buying a module.
Thank you for your comments and your recommendation.

Jesús Marín
(Valencia) Spain
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby gdeteran » Fri Jan 13, 2023 3:43 pm

Respecto a la sincronización de la Base de Datos, aqui un ejemplo de como lo hago :
En mi caso ingreso manualmente los productos en Prestashop pero, la actualización de precio y stock lo hago en este proceso:

Este código es lo primero que salió, sé que puede mejorar :)

Code: Select all  Expand view

   oCnW = maria_Connect( cSvr, cMdb, cUsu, cPsw )
   if ! Empty( "ps2v_product" )

      oRs   := oCnW:RowSet( "select * from `"ps2v_product"`" )
      if oRs == nil
         ? "Falló la apertura de ps2v_product"
      else
         LeeProduc( oRs, oCn, oCnW, aVars )
      endif
   endif

 STATIC PROCEDURE LeeProduc( oRs, oCn, oCnW, aVars )
*----------------------------------------------------
   oRs:Gotop()
   DO WHILE .NOT. oRs:Eof()
      cCodigo := RTRIM(oRs:Reference)

      IF .NOT. Empty(cCodigo)
         cSeek  := "Codigo = '" + cCodigo + "'"
         TRY
            oPRODUC:Find( cSeek, 0, 1, 1 )
         CATCH oError
            MsgInfo( oError:Description )
            FW_ShowAdoError( oCn )
         END

         IF .NOT. oPRODUC:Eof()

*------>  Registro en mi BD SQL que este producto está en PS y guardo el índice que creó PS
            oPRODUC:Fields("EnWeb"):Value  :=   1                                    
            oPRODUC:Fields("CodWeb"):Value :=   oRs:Id_Product              
            oPRODUC:Update()


*----->   Registro Stock del producto en Tabla "ps2v_stock_available" de PrestaShop
            oSTOCKAV := oCnW:RowSet( "SELECT * FROM ps2v_stock_available WHERE Id_Product = " + STR(oRs:Id_Product) )
            IF .NOT. oSTOCKAV:Eof()
               oSTOCKAV:Fields("physical_quantity"):value   :=  oPRODUC:Fields("StkReal"):Value
               oSTOCKAV:Fields("quantity"):value             := oPRODUC:Fields("StkReal"):Value
               oSTOCKAV:Update()
            ELSE
               MsgAlert("No encontré STOCKAV  : " )
            ENDIF

*----->   Registro el Precio del producto en Tabla "ps2v_product" de PrestaShop
            oPRODWEB := oCnW:RowSet( "SELECT * FROM ps2v_product WHERE Id_Product = " + STR(oRs:Id_Product) )
            IF .NOT. oPRODWEB:Eof()
               oPRODWEB:Fields("price"):value            := oPRODUC:Fields("PrVenta"):Value
               oPRODWEB:Update()
            ELSE
               MsgAlert("No encontré PRODWEB  : " )
            ENDIF

*----->   Registro el Precio del producto en Tabla "ps2v_layered_price_index" de PrestaShop
            oLAYPRICE := oCnW:RowSet( "SELECT * FROM ps2v_layered_price_index WHERE Id_Product = " + STR(oRs:Id_Product) )
            IF .NOT. oLAYPRICE:Eof()
               oLAYPRICE:Fields("price_min"):value           := oPRODUC:Fields("PrVenta"):Value * 1.19
               oLAYPRICE:Fields("price_max"):value           := oPRODUC:Fields("PrVenta"):Value * 1.19
               oLAYPRICE:Update()
            ELSE
               MsgAlert("No encontré LAYPRICE  : " )
            ENDIF


*----->   Registro el Precio del producto en Tabla "ps2v_product_shop" de PrestaShop
            oPRDSHOP := oCnW:RowSet( "SELECT * FROM ps2v_product_shop WHERE Id_Product = " + STR(oRs:Id_Product) )
            IF .NOT. oPRDSHOP:Eof()
               oPRDSHOP:Fields("price"):value            := oPRODUC:Fields("PrVenta"):Value
               oPRDSHOP:Update()
            ELSE
               MsgAlert("No encontré PRDSHOP  : " )
            ENDIF

         ENDIF
      else
         MsgAlert("Código en blanco")
      endif

      oRs:MoveNext()

   ENDDO

   RETURN

 
Saludos,
Gonzalo
Puerto Montt - CHILE
FWH 22.12 - Harbour 3.2.0dev (r2008190002) - Borland/Embarcadero C++ 7.0(32-bit)
User avatar
gdeteran
 
Posts: 115
Joined: Fri Oct 14, 2005 7:10 pm
Location: Puerto Montt - CHILE

Re: EXPORTAR DATOS DESDE FW A PRESTASHOP

Postby jnavas » Sat Jan 14, 2023 10:08 pm

Saludos
Estoy interesado en implementar mercado Libre, si algun colega lo tiene implementado podemos adquirir el código fuente.
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: EXPORTAR DATOS FW A PRESTASHOP [SOLUCIONADO PROBLEMA IMAGEN]

Postby JESUS MARIN » Mon Jan 16, 2023 11:16 am

Buenos dias a todos

Solucionado el problema con las imagenes. (desactivar URLs amigables)

Sigo con las pruebas de importación, pero por si sirve de ayuda a alguien en el futuro, puedo ayudaros.

Un saludo

Jesús Marín
Valencia (España)
Jesús Marín
JESUS MARIN
 
Posts: 174
Joined: Wed Jan 02, 2019 8:36 am

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests