ArrayApend on Multidimensional Array - Coldfusion

877 Views Asked by At

Is there a way to append data to a 3D array with arrayAppend? I am trying to create a shopping cart and I need to add each item with quantity, price, and shipping location together

1

There are 1 best solutions below

3
On BEST ANSWER

3D array? It may be easier to have an array of struct's.

cart = [
  {
    qty: 2,
    price: 3.99,
    shippingLocation: "somewhere"
  }
];

arrayAppend(cart, {
    qty: 3,
    price: 19.99,
    shippingLocation: "somewhere else"
});