Problem synchro sell with API Rest

  • philatelie-lmi77

    19 mensajes

    Francia

    Hello, I encounter difficulties with API rest when I sell a product and the stock is zero, I would like to know how the API treats it because the API does not update my stock on Prestashop! Can you tell me how the API treats a product whose stock goes from 1 to 0 after a sale, and especially if this task is done in real time or if this task is in a queue and s' run later. Thank you
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • philatelie-lmi77

    19 mensajes

    Francia

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
    • Creado 25 jun 2018 a 4:34
    • #877429
    Yes, it works well for the release of new products, updating quantities, prices ... But this does not seem to work for the notification of sales that are closed following a sale.
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • philatelie-lmi77

    19 mensajes

    Francia

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
    • Creado 25 jun 2018 a 5:02
    • #877444
    Here is the piece of code written to handle these notifications :

    $delcampesynchro = new DelcampeSynchro();
    $context = Context::getContext();

    if(isset($_POST['delcampeNotification'])) {
    $delcampe_notification_obj = new SimpleXMLElement($_POST['delcampeNotification']);
    $delcampe_item_id = $delcampe_notification_obj->Notification_Data->id_item;
    $delcampe_personnal_ref = $delcampe_notification_obj->Notification_Data->personal_reference;
    $prestashop_item_id = str_replace('PLMI77-', '', $delcampe_personnal_ref);
    $quantity_to_decrement = $delcampe_notification_obj->Notification_Data->qty;
    $quantity_product = StockAvailable::getQuantityAvailableByProduct($prestashop_item_id, null, 1);
    $final_quantity = $quantity_product - $quantity_to_decrement;
    $product = new Product($prestashop_item_id);

    if($final_quantity == 0) {
    $delcampesynchro->closeItemOnDelcampe($delcampe_item_id);
    }

    $q = "UPDATE ps_stock_available SET quantity = ".$final_quantity." WHERE id_product = ".$prestashop_item_id;
    Db::getInstance()->execute($q);

    Hook::exec('actionProductUpdate', array(
    'id_product' => $prestashop_item_id,
    'product' => $product,
    'delcampe_no_synchro' => true
    )
    );
    }

    Associé au hook « itemSold »
  • philatelie-lmi77

    19 mensajes

    Francia

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
    • Creado 25 jun 2018 a 5:02
    • #877444
    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
    • Creado 25 jun 2018 a 5:14
    • #877450
    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
    • Creado 25 jun 2018 a 8:04
    • #877492
    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • philatelie-lmi77

    19 mensajes

    Francia

    OK, that's what we use. Can you indicate to me if the notification of closing of a product following a sale intervenes immediately or not (queue)? do you have an example of how we should use Seller_Item_Close_Sold: Link (https)
    Thanks
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    OK, that's what we use. Can you indicate to me if the notification of closing of a product following a sale intervenes immediately or not (queue)? do you have an example of how we should use Seller_Item_Close_Sold: Link (https)
    Thanks
    • Creado 25 jun 2018 a 9:38
    • #877522
    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • Cuenta eliminada
    Cuenta eliminada

    0 mensajes

    Bélgica

    Los datos ya no están disponibles porque la cuenta de este usuario ha sido eliminada (Reglamento RGPD)
  • philatelie-lmi77

    19 mensajes

    Francia

    no, the problem persists and my developer will be able to look at it only in 15 days because it is on leave.

Únese a la comunidad de coleccionistas

Inscripción Identificarse