Jump to content

"physical_quantity" et "reserved_quantity" introuvables dans l'API/le webservice


Recommended Posts

Bonjour à tous 😀

Depuis la version 1.7.2, PrestaShop s'est doté d'un nouveau système de gestion de stock (http://build.prestashop.com/news/stock-management-in-prestashop-1-7-part-4-prestashop-erp/).

Je suis cependant étonné de ne pas retrouver certaines notions de cette nouvelle manière de gérer les stocks via l'API/la webservice :

359413164_Capturedecran2019-10-1601_03_20.thumb.png.e1827e7ca8aa5ab22248d463f0acfb5b.png

Les notions principales ("physical_quantity" et "reserved_quantity" ) sont absentes 😔 Hors j'aurais aimé pouvoir les modifier lors de ma synchro ERP.

Comment faire ?

Cordialement,

David.

Link to comment
Share on other sites

Ben si^^

l'api dépend de l'objectModel et donc de sa définition et non des champs de la base de données :)

Donc StockAvailable:

    /**
     * @see ObjectModel::$definition
     */
    public static $definition = array(
        'table' => 'stock_available',
        'primary' => 'id_stock_available',
        'fields' => array(
            'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
            'depends_on_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
            'out_of_stock' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
            'location' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
        ),
    );

    /**
     * @see ObjectModel::$webserviceParameters
     */
    protected $webserviceParameters = array(
        'fields' => array(
            'id_product' => array('xlink_resource' => 'products'),
            'id_product_attribute' => array('xlink_resource' => 'combinations'),
            'id_shop' => array('xlink_resource' => 'shops'),
            'id_shop_group' => array('xlink_resource' => 'shop_groups'),
        ),
        'hidden_fields' => array(
        ),
        'objectMethods' => array(
            'add' => 'addWs',
            'update' => 'updateWs',
        ),
    );

Vos champs n'y sont pas.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...