Problem synchro sell with API Rest

  • philatelie-lmi77

    19 Beiträge

    Frankreich

    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
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • philatelie-lmi77

    19 Beiträge

    Frankreich

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
    • Erstellt am 25.06.2018 um 04: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.
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • philatelie-lmi77

    19 Beiträge

    Frankreich

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
    • Erstellt am 25.06.2018 um 05: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 Beiträge

    Frankreich

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
    • Erstellt am 25.06.2018 um 05:02
    • #877444
    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
    • Erstellt am 25.06.2018 um 05:14
    • #877450
    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
    • Erstellt am 25.06.2018 um 08:04
    • #877492
    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • philatelie-lmi77

    19 Beiträge

    Frankreich

    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
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    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
    • Erstellt am 25.06.2018 um 09:38
    • #877522
    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • Konto gelöscht
    Konto gelöscht

    0 Beiträge

    Belgien

    Die Informationen sind nicht mehr verfügbar, da das Konto dieses Benutzers gelöscht wird (DSGVO-Grundverordnung).
  • philatelie-lmi77

    19 Beiträge

    Frankreich

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

Werden Sie Mitglied der Sammler-Community!

Anmelden Einloggen