Jump to content

Add cart_rule to cart by web services


Hubz

Recommended Posts

My mobile App which is an m-commerce App is communicating with PrestaShop as a Back-end. So I'm using PrestaShop web services. I would like to offer the possibility to my customer to add a voucher code that I want to communicate to them. So I've added a field in the cart page where the user enters the voucher code (cart_rule). When the code is associated to a voucher, it is retrieved and it displays the discount. But how can I do to attach the cart_rule associated to the voucher code to the cart by Web services ?

 

The cart web service synopsis doesn't show up any cart_rule field, as you can see below:

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
  <cart>
  <id_address_delivery format="isUnsignedId"/>
  <id_address_invoice format="isUnsignedId"/>
  <id_currency required="true" format="isUnsignedId"/>
  <id_customer format="isUnsignedId"/>
  <id_guest format="isUnsignedId"/>
  <id_lang required="true" format="isUnsignedId"/>
  <id_shop_group format="isUnsignedId"/>
  <id_shop format="isUnsignedId"/>
  <id_carrier format="isUnsignedId"/>
  <recyclable format="isBool"/>
  <gift format="isBool"/>
  <gift_message format="isMessage"/>
  <mobile_theme format="isBool"/>
  <delivery_option/>
  <secure_key maxSize="32"/>
  <allow_seperated_package format="isBool"/>
  <date_add format="isDate"/>
  <date_upd format="isDate"/>
  <associations>
     <cart_rows nodeType="cart_row" virtualEntity="true">
        <cart_row>
            <id_product xlink:href="https://affleloustore.bertekgroup.fr/api/products/" required="true"/>
            <id_product_attribute xlink:href="https://affleloustore.bertekgroup.fr/api/combinations/" required="true"/>
            <id_address_delivery xlink:href="https://affleloustore.bertekgroup.fr/api/addresses/" required="true"/>
            <quantity required="true"/>
            <qte_detail/>
        </cart_row>
     </cart_rows>
  </associations>
  </cart>
</prestashop>
Edited by Hubz (see edit history)
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...