Register Mariadb External Database Products on Woocommerce

Asked

Viewed 112 times

0

Regards. The local system uses the database Mariadb, we know that there is Rest API Woocommerce, the question is whether there is a way to interconnect the databases Mariadb with Mysql Woocommerce to register all products in Wordpress, because all products are registered in Mariadb, I am totally lost and willing to pay if necessary, then I will post here the solution if I can, there is a simpler way to query and register products through a Query with PHP? Below is the return of products from the local database Mariadb:

Note: listed 2 products but are hundreds.

Array
(
    [0] => 0014535
    [codigo_Prd] => 0014535
    [1] => BALANCA DIGITAL MULTILASER
    [Desc_prd] => BALANCA DIGITAL MULTILASER
    [2] => MONDELEZ
    [Laboratorio] => MONDELEZ
    [3] => PERFUMARIA
    [Departamento] => PERFUMARIA
    [4] => VAREJINHO
    [Familia] => VAREJINHO
    [5] => 9835647846795
    [BARRAS] => 9835647846795
    [6] => 0.0000
    [Promocao] => 0.0000
    [7] => 0.0000
    [Tabloide] => 0.0000
    [8] => 39.90
    [VlrVenda] => 39.90
    [9] => 39.90
    [MelhorValor] => 39.90
)
Array
(
    [0] => 0067845
    [codigo_Prd] => 0067845
    [1] => BOMBOM SONHO DE VALSA
    [Desc_prd] => BOMBOM SONHO DE VALSA 
    [2] => MONDELEZ
    [Laboratorio] => MONDELEZ
    [3] => PERFUMARIA
    [Departamento] => PERFUMARIA
    [4] => CHOCOLATE / BALAS / CHICLETES
    [Familia] => CHOCOLATE / BALAS / CHICLETES
    [5] => 8643751945358
    [BARRAS] => 8643751945358
    [6] => 0.0000
    [Promocao] => 0.0000
    [7] => 0.0000
    [Tabloide] => 0.0000
    [8] => 1.00
    [VlrVenda] => 1.00
    [9] => 1.00
    [MelhorValor] => 1.00
)

Follow also the example of the API to add the products to the Woocommerce database:

const data = {
  name: "Premium Quality",
  type: "simple",
  regular_price: "21.99",
  description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
  short_description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
  categories: [
    {
      id: 9
    },
    {
      id: 14
    }
  ],
  images: [
    {
      src: "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg"
    },
    {
      src: "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg"
    }
  ]
};

WooCommerce.post("products", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });

  • this tool is running on the local machine synchronizing the stocks and prices... but it is possible to change to register also... https://rovann.com.br/2020/02/10/woosync/

  • @Rovannlinhalis the infected file accused antivirus in this tool, is normal?

  • they usually have a low reputation just because it’s not a known file... if you want to get in touch with me, send me an email

  • 1

    @Rovannlinhalis your Woosync tool solved my problem, it was the best if it was not the only solution we found. Many thanks and congratulations for the master tool!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.