Jump to content

Webservice API


DanyWay

Recommended Posts

Hi,

PrestaShop : 1.7.3.3

I have this error when creating an order with /api/orders

it create the order, but I would like to correct that (thanks for the help)

 

{"errors":[{"code":5,"message":"

 Trying to get property of non-object (\/var\/www\/html\/classes\/ImageManager.php, line 101)"}]}


Here is the line 101 of this file if (Context::getContext()->controller->controller_type == 'admin') {

    /**
     * @param $cacheImage
     * @param $disableCache
     * @return string
     */
    public static function getThumbnailPath($cacheImage, $disableCache)
    {
        $cacheParam = $disableCache ? '?time='.time() : '';

if (Context::getContext()->controller->controller_type == 'admin') {
            return '../img/tmp/'.$cacheImage.$cacheParam;
        }

        return _PS_TMP_IMG_.$cacheImage.$cacheParam;
    }

 

this is the example of my post to api/orders/

<?xml version="1.0" encoding="UTF-8"?>

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

    <order>

        <id_address_delivery>1408</id_address_delivery>

        <id_address_invoice>1408</id_address_invoice>

        <id_cart>3289</id_cart>

        <id_currency>1</id_currency>

        <id_lang>2</id_lang>

        <id_customer>1382</id_customer>

        <id_carrier>155</id_carrier>

        <current_state>2</current_state>

        <module>paypal</module>

        <payment>PayPal</payment>

        <total_paid>11.99</total_paid>

        <total_paid_real>11.99</total_paid_real>

        <total_products>11.99</total_products>

        <total_products_wt>11.99</total_products_wt>

        <conversion_rate>1</conversion_rate>

        <associations>

            <order_rows>

                <order_row>

                    <product_id>1</product_id>

                    <product_attribute_id>57</product_attribute_id>

                    <product_quantity>1</product_quantity>

                </order_row>

            </order_rows>

        </associations>

    </order>

</prestashop>

Edited by DanyWay (see edit history)
Link to comment
Share on other sites

  • 1 year later...

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...