Problem synchro sell with API Rest

  • philatelie-lmi77

    19 berichten

    Frankrijk

    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
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • philatelie-lmi77

    19 berichten

    Frankrijk

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
    • Aangemaakt 25 jun 2018 op 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.
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • philatelie-lmi77

    19 berichten

    Frankrijk

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
    • Aangemaakt 25 jun 2018 op 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 berichten

    Frankrijk

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
    • Aangemaakt 25 jun 2018 op 05:02
    • #877444
    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    One question, when selling a product and the stock is zero, the notification sent by delcampe is ItemSold or ItemUpdate?
    • Aangemaakt 25 jun 2018 op 05:14
    • #877450
    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
    • Aangemaakt 25 jun 2018 op 08:04
    • #877492
    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • philatelie-lmi77

    19 berichten

    Frankrijk

    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
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    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
    • Aangemaakt 25 jun 2018 op 09:38
    • #877522
    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • Rekening verwijderd
    Rekening verwijderd

    0 berichten

    België

    De informatie is niet meer beschikbaar omdat de rekening van deze gebruiker is verwijderd (AVG)
  • philatelie-lmi77

    19 berichten

    Frankrijk

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

Word lid van de verzamelaars-community!

Registreren Aanmelden