Skip to content

Shopping Cart Integration ​

The shopping cart is used to order configured articles. It always lives on the customer's server, not on web.3doffice.de.

Setup ​

The URL parameter urlwarenkorb specifies the external shopping cart URL:

https://web.3doffice.de/webkatalog2_5/planning?urlwarenkorb=www.meinserver.de/warenkorb/kundenid

Note

The URL is given without http:// or https://. HTTPS:// is prepended automatically.

Flow ​

mermaid
sequenceDiagram
    participant U as User
    participant WK as WebKatalog
    participant EK as External shopping cart
    U->>WK: Configure article
    WK->>U: Show "Add to shopping cart" button
    U->>WK: Click the button
    WK->>EK: Form POST (field shoppingCartData)
    EK-->>U: Shopping cart page is shown
  1. A urlwarenkorb is set
  2. An "Add to shopping cart" button appears in the article information area. While the article still has an open mandatory property (obligatory2c), the shopping cart and wishlist buttons are not shown.
  3. Clicking the button sends the current article as a form POST to the given URL; the window (or the iFrame) switches to the shopping cart page
  4. The complete article is always sent (for meta planning: the top-level article)
  5. Child articles cannot be sent individually

POST data ​

The WebKatalog sends a form (application/x-www-form-urlencoded) with a field shoppingCartData. It contains a JSON object (as a string) with two parts: json is the complete top-level article (for storing and reconfiguring), hierarchy a simplified structure with texts and prices for display:

json
{
  "json": {
    "typename": "",
    "id": "{815F0BB3-0BC2-4D9B-AE21-0B25F026A14F}",
    "rootid": "{815F0BB3-0BC2-4D9B-AE21-0B25F026A14F}",
    "manufacturer": "_dx",
    "program": "webti",
    "basearticlenumber": "27R0614Q",
    "ocd": {
      "finalarticlenumber": "27 R 06 14 KL Q",
      "price": 540,
      "currency": "EUR",
      "shorttext": "Rechtecktisch, Tiefe 600 mm, Breite 1400 mm",
      "reinitstring": "..."
    }
  },
  "hierarchy": {
    "manufacturer": "_dx",
    "program": "webti",
    "basearticlenumber": "27R0614Q",
    "shorttext": "Rechtecktisch, Tiefe 600 mm, Breite 1400 mm",
    "price": 540,
    "currency": "EUR",
    "id": "{815F0BB3-0BC2-4D9B-AE21-0B25F026A14F}"
  }
}

Reading it in PHP:

php
$cart = json_decode($_POST['shoppingCartData']);
$article = $cart->json;

Wishlist ​

With urlmerkzettel, the "Add to wishlist" button appears. It sends the same data as the shopping cart to this URL. Button text: merkzettelbtntext. If urlwarenkorb is set as well, the wishlist appears as an icon button next to the shopping cart button; merkzettelbtntext is then its tooltip.

Article IDs ​

Every article has a unique ID. Use it to store the article in the customer's shopping cart. Updating an article after reconfiguration can also be handled through the ID.

Shopping cart rules

  • Always store the top-level article (id == rootid) with the complete JSON payload
  • Use id/rootid to group and reconfigure meta plannings
  • Never reconfigure a single child independently of its root

Reconfiguration ​

To configure an article from the shopping cart again:

  1. Send the top-level article JSON (field json of the POST data) via POST to /api/ofml.dll/ofml/reinit
  2. Use the returned id: {BASE}/planning?id={ID}

The demo shopping cart below is an example of this.

Demo shopping cart ​

For testing, there is a demo shopping cart that does not store any articles:

https://web.3doffice.de/webkatalog2_5/planning?urlwarenkorb=web.3doffice.de%2Fwebkatalog2%2Fassets%2FDemo-Warenkorb%2Fwarenkorb.php

WARNING

The demo shopping cart does not store articles and is only meant for a one-time view. It cannot be used in live operation.

Parameters ​

ParameterDescription
urlwarenkorbURL of the external shopping cart
warenkorbbtntextCustom text for the shopping cart button
urlmerkzettelURL of the wishlist (on its own or in addition to the shopping cart)
merkzettelbtntextCustom text for the wishlist button (with a shopping cart: tooltip of the icon button)

3D office WebKatalog 2.5 — ub.unitel GmbH