Polskie wsparcie PrestaShop

PrestaShop => Konfiguracja => Wątek zaczęty przez: avatarusswtor w Maj 01, 2015, 10:55:22 pm

Tytuł: Webservices dodawanie zamówienie problem
Wiadomość wysłana przez: avatarusswtor w Maj 01, 2015, 10:55:22 pm
Witam
Próbuje stworzyc zamówienie za pomocą webservices, Klienta, adres i koszyk potrafię stworzyc, ale samego zamówienia juz nie.
Oto kod:
//////////////////////////////////////////////////////////////////////
                        //4: Tworzenie ORDER
                        //////////////////////////////////////////////////////////////////////
                        try
                        {
                            // Getting the empty XML document to send back completed

                            // Information about the customer to create

                            $id_adresu=255;
                            $id_koszyka=404;
                            $id_klienta=288;

                            // Information about the customer to create

$psXML = '<?xml version="1.0" encoding="UTF-8" ?>
<prestashop>
<order>
  <id_address_invoice>'.$id_adresu.'</id_address_invoice>
    <id_address_delivery>'.$id_adresu.'</id_address_delivery>
  <id_cart>'.$id_koszyka.'</id_cart>
  <id_currency>1</id_currency>
  <id_lang>1</id_lang>
  <id_customer>'.$id_klienta.'</id_customer>
  <id_carrier>25</id_carrier>
  <module>bankwire</module>
  <payment>przelew na konto</payment>
  <valid>1</valid>
  <current_state>3</current_state>
  <conversion_rate>1</conversion_rate>
  <total_paid>60.50</total_paid>
    <total_paid_real>60.50</total_paid_real>
    <total_products>35.77</total_products>
    <total_products_wt>44.50</total_products_wt>
    <total_shipping>16.00</total_shipping>
  <associations>
<order_rows>
     <order_row>
             <product_id>179</product_id>
              <product_attribute_id></product_attribute_id>
            <product_quantity>1</product_quantity>
    </order_row>
    <order_row>
             <product_id>174</product_id>
              <product_attribute_id></product_attribute_id>
            <product_quantity>1</product_quantity>
    </order_row>
    <order_row>
             <product_id>279</product_id>
              <product_attribute_id></product_attribute_id>
            <product_quantity>1</product_quantity>
    </order_row>
</order_rows>
</associations>
</order>
</prestashop>
';

                            $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
                            $xml = new SimpleXMLElement($psXML);
                            $opt = array( 'resource' => 'orders' );
                            $opt['postXml'] = $xml->asXML();

                             $xml = $webService->add($opt);
                             $result = $xml->children()->children();
                             $id_zamowienia = $result->{'id'};
                             echo '<br />Zamówienie zostało utworzone!<br />';
                             echo '<br />ID adresu:'.$id_adresu;
                             echo '<br />ID klienta: '.$id_klienta;
                             echo '<br />ID Koszyka: '.$id_koszyka;
                             echo '<br />ID Zamówienia: '.$id_zamowienia;
                    }
                    catch (PrestaShopWebserviceException $ex)
                        {
                            // Here we are dealing with errors
                            echo '<pre>';
                             print_r($ex);
                             echo '</pre>';
                             $trace = $ex->getTrace();
                            if ($trace[0]['args'][0] == 404) echo 'Bad ID';
                            else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
                            else echo '<br />Other error<br />'.$ex->getMessage();
                        }

wywala błąd: Internal error. To see this error please display the PHP errors
jakies pomysły?
Tytuł: Odp: Webservices dodawanie zamówienie problem
Wiadomość wysłana przez: west w Maj 02, 2015, 10:51:21 am
a zrobiłeś to co Ci system napisał ?  jaki masz komunikat?