Wt  4.11.1
Public Member Functions | List of all members
Wt::Payment::OrderItem Class Reference

Describes an item in an order. More...

#include <Wt/Payment/OrderItem.h>

Public Member Functions

void setName (const WString &name)
 Sets the item name.
 
const WStringname () const
 Returns item name. More...
 
void setNumber (const std::string &number)
 Sets the item number.
 
std::string number () const
 Returns item number. More...
 
void setDescription (const WString &description)
 Sets the item description.
 
const WStringdescription () const
 Returns the item description. More...
 
void setQuantity (double quantity)
 Sets the item quantity. More...
 
double quantity () const
 Returns the item quantity. More...
 
void setUnitCost (const Money &unitCost)
 Changes the item unit cost field. More...
 
Money unitCost () const
 Returns item unit cost. More...
 
Money computeTotal () const
 Returns the total cost for this order item. More...
 

Detailed Description

Describes an item in an order.

Usage example:

item1.setName("Waffle Maker");
item1.setNumber("00001");
item1.setDescription("Emweb FlipSide Belgian Waffle Maker");
item1.setQuantity(1);
item1.setUnitCost(Wt::Payment::Money(49, 99, "USD"));
order.items().push_back(item1);
order.setShipping(Wt::Payment::Money(7, 1, "USD"));
order.setTax(Wt::Payment::Money(500, 99, "USD"));
A value class which describes a monetary value.
Definition: Money.h:27
Describes an item in an order.
Definition: OrderItem.h:46
void setNumber(const std::string &number)
Sets the item number.
Definition: OrderItem.C:11
void setDescription(const WString &description)
Sets the item description.
Definition: OrderItem.C:16
void setQuantity(double quantity)
Sets the item quantity.
Definition: OrderItem.C:21
void setUnitCost(const Money &unitCost)
Changes the item unit cost field.
Definition: OrderItem.C:26
void setName(const WString &name)
Sets the item name.
Definition: OrderItem.C:6
Contains information of a sales order.
Definition: Order.h:41
void setShippingDiscount(const Money &discount)
Sets the shipping discount.
Definition: Order.C:21
void setTax(const Money &tax)
Sets sales taxes.
Definition: Order.C:6
const std::vector< OrderItem > & items() const
Returns all items in the order.
Definition: Order.h:165
void setShipping(const Money &shipping)
Sets shipping cost.
Definition: Order.C:11
void setShippingInsurance(const Money &insurance)
Sets shipping insurance.
Definition: Order.C:26
See also
Order

Member Function Documentation

◆ computeTotal()

Money Wt::Payment::OrderItem::computeTotal ( ) const

Returns the total cost for this order item.

This returns quantity() * unitCost()

◆ description()

const WString& Wt::Payment::OrderItem::description ( ) const

Returns the item description.

See also
setDescription()

◆ name()

const WString& Wt::Payment::OrderItem::name ( ) const

Returns item name.

See also
setName()

◆ number()

std::string Wt::Payment::OrderItem::number ( ) const

Returns item number.

See also
setNumber()

◆ quantity()

double Wt::Payment::OrderItem::quantity ( ) const

Returns the item quantity.

See also
setQuantity()

◆ setQuantity()

void Wt::Payment::OrderItem::setQuantity ( double  quantity)

Sets the item quantity.

This is either an integer quantity (number of items) or a fractional quantity (e.g. 1.5 times 1 kilogram).

The total price for this item in the order will be the quantity() times the unitCost().

◆ setUnitCost()

void Wt::Payment::OrderItem::setUnitCost ( const Money unitCost)

Changes the item unit cost field.

This is the unit cost.

◆ unitCost()

Money Wt::Payment::OrderItem::unitCost ( ) const

Returns item unit cost.

See also
setUnitCost()