Top Banner
A Conceptual Schema of Magento Community Edition v1.4.0.1 Author: Adrià Ramirez Papell University: Universitat Politècnica de Catalunya (UPC) BarcelonaTech
295
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Magento Conceptual Schema

A Conceptual Schema of MagentoCommunity Edition v1.4.0.1

Author: Adrià Ramirez PapellUniversity: Universitat Politècnica de Catalunya (UPC) BarcelonaTech

Page 2: Magento Conceptual Schema

Índex

1 Conceptual Schema organitzation 71.1 Structure overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Structural Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 Behavioral Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Structural Schema 102.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.2 Schema presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.3 Schema Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Store Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.4.1 Stores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.4.2 Store Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.4.3 Currencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.4.4 Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.4.5 Shipping Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.4.6 Payment Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402.4.7 Taxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

2.5 Customers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552.5.1 Customers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552.5.2 Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

2.6 Store Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602.6.1 Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602.6.2 Product Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792.6.3 Product Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822.6.4 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882.6.5 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912.6.6 Attribute Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952.6.7 Price Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

2.7 Additional Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052.7.1 Product Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052.7.2 Product Reviews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072.7.3 Buying Process Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092.7.4 Newsletters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

2.8 Online Catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162.8.1 Shopping Carts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162.8.2 Shopping Cart Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1192.8.3 Shopping cart items of non-simple products . . . . . . . . . . . . . . . . . . 1252.8.4 Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1312.8.5 OrderLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372.8.6 Invoices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1392.8.7 Shipments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1432.8.8 Refund . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

1

Page 3: Magento Conceptual Schema

3 Behavioral Schema. Use Case Specification 1483.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1483.2 Schema presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1483.3 Use Case Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1493.4 Store Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

3.4.1 Add a website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1543.4.2 Edit a website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1543.4.3 Delete a website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1543.4.4 Select the default website . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1553.4.5 Add a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1553.4.6 Edit a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1553.4.7 Delete a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1553.4.8 Select the default store of a website . . . . . . . . . . . . . . . . . . . . . . 1563.4.9 Add an store view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1563.4.10 Edit an store view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1563.4.11 Delete an store view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1563.4.12 Select the default store view of a store . . . . . . . . . . . . . . . . . . . . . 1573.4.13 Select the default language . . . . . . . . . . . . . . . . . . . . . . . . . . . 1573.4.14 Change the catalog configuration values . . . . . . . . . . . . . . . . . . . . 1583.4.15 Change the stock configuration values . . . . . . . . . . . . . . . . . . . . . 1583.4.16 Change the wishlist configuration values . . . . . . . . . . . . . . . . . . . . 1583.4.17 Change the sales configuration values . . . . . . . . . . . . . . . . . . . . . 1593.4.18 Change the customer configuration values . . . . . . . . . . . . . . . . . . 1593.4.19 Change the tax configuration values . . . . . . . . . . . . . . . . . . . . . . 1603.4.20 Change the shipping configuration values . . . . . . . . . . . . . . . . . . . 1603.4.21 Change the tell to a friend configuration values . . . . . . . . . . . . . . . . 1603.4.22 Change the currency configuration values . . . . . . . . . . . . . . . . . . . 1613.4.23 Change the enabled currencies . . . . . . . . . . . . . . . . . . . . . . . . . 1613.4.24 Update currency rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1623.4.25 Change the geographical configuration values . . . . . . . . . . . . . . . . 1623.4.26 Change shipping method values . . . . . . . . . . . . . . . . . . . . . . . . 1633.4.27 Change payment method values . . . . . . . . . . . . . . . . . . . . . . . . 1633.4.28 Add a customer tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1633.4.29 Edit a customer tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1643.4.30 Delete a customer tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . 1643.4.31 Add a product tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1643.4.32 Edit a product tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1653.4.33 Delete a product tax class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1653.4.34 Add a tax rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1653.4.35 Edit a tax rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1663.4.36 Delete a tax rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1663.4.37 Add a tax rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1663.4.38 Edit a tax rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1663.4.39 Delete a tax rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

3.5 Customers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1683.5.1 Create a Customer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1683.5.2 Change password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1683.5.3 Change customer details . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1683.5.4 Administrate address book . . . . . . . . . . . . . . . . . . . . . . . . . . . 1693.5.5 Edit a customer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1693.5.6 Delete a customer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703.5.7 Show account information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703.5.8 Show address book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703.5.9 Add a customer group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

2

Page 4: Magento Conceptual Schema

3.5.10 Edit a customer group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1713.5.11 Delete a customer group . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1713.5.12 Add an administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1713.5.13 Edit an administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1723.5.14 Delete an administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1723.5.15 Add a role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1723.5.16 Edit a role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1733.5.17 Delete a role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1733.5.18 Log In . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1733.5.19 Log Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1743.5.20 Open session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1743.5.21 Finish session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1743.5.22 Change the current Website . . . . . . . . . . . . . . . . . . . . . . . . . . . 1753.5.23 Change the current Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1753.5.24 Change the current Store View . . . . . . . . . . . . . . . . . . . . . . . . . 1753.5.25 Change the current Currency . . . . . . . . . . . . . . . . . . . . . . . . . . 175

3.6 Store Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1773.6.1 Add a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1773.6.2 Edit a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1773.6.3 Delete a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1783.6.4 Add a product category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1783.6.5 Edit a product category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1783.6.6 Move a product category . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1793.6.7 Delete a product category . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1793.6.8 Add an attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1793.6.9 Edit an attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1803.6.10 Delete an attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1803.6.11 Add an attribute set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1803.6.12 Edit an attribute set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1813.6.13 Delete an attribute set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1813.6.14 Administrate tier prices of a product . . . . . . . . . . . . . . . . . . . . . . 1823.6.15 Add a catalog price rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1823.6.16 Edit a catalog price rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1833.6.17 Delete a catalog price rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1833.6.18 Add a shopping cart price rule . . . . . . . . . . . . . . . . . . . . . . . . . 1833.6.19 Edit a shopping cart price rule . . . . . . . . . . . . . . . . . . . . . . . . . 1843.6.20 Delete a shopping cart price rule . . . . . . . . . . . . . . . . . . . . . . . . 184

3.7 Additional Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1853.7.1 Tag a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1853.7.2 Add a tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1853.7.3 Edit a tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1853.7.4 Delete a tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1863.7.5 Show tags of a customer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1863.7.6 Show most popular tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1863.7.7 Show all tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1873.7.8 Add a review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1873.7.9 Edit a review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1873.7.10 Delete a review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1883.7.11 Add a review property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1883.7.12 Edit a review property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1883.7.13 Delete a review property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1883.7.14 Show reviews of a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1893.7.15 Show reviews of a customer . . . . . . . . . . . . . . . . . . . . . . . . . . . 1893.7.16 Add a product to the wish list . . . . . . . . . . . . . . . . . . . . . . . . . . 189

3

Page 5: Magento Conceptual Schema

3.7.17 Remove a product from the wish list . . . . . . . . . . . . . . . . . . . . . . 1903.7.18 Add a product to the compare list . . . . . . . . . . . . . . . . . . . . . . . . 1903.7.19 Remove a product from the compare list . . . . . . . . . . . . . . . . . . . . 1903.7.20 Share wish list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1913.7.21 Subscribe to a product price alert . . . . . . . . . . . . . . . . . . . . . . . . 1913.7.22 Subscribe to a product stock alert . . . . . . . . . . . . . . . . . . . . . . . 1913.7.23 Show wish list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1913.7.24 Show ready to compare products . . . . . . . . . . . . . . . . . . . . . . . . 1923.7.25 Show recently compared products . . . . . . . . . . . . . . . . . . . . . . . 1923.7.26 Show recently viewed products . . . . . . . . . . . . . . . . . . . . . . . . . 1923.7.27 Show compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1923.7.28 Add a newsletter template . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1933.7.29 Edit a newsletter template . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1933.7.30 Delete a newsletter template . . . . . . . . . . . . . . . . . . . . . . . . . . 1933.7.31 Add a newsletter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1943.7.32 Edit a newsletter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1943.7.33 Subscribe to the newsletter . . . . . . . . . . . . . . . . . . . . . . . . . . . 1943.7.34 Unsubscribe from the newsletter . . . . . . . . . . . . . . . . . . . . . . . . 1953.7.35 Delete a newsletter subscription . . . . . . . . . . . . . . . . . . . . . . . . 1953.7.36 Unsubscribe a newsletter subscription . . . . . . . . . . . . . . . . . . . . . 1953.7.37 Show shopping cart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1953.7.38 Download a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1963.7.39 Show downloadable products of a customer . . . . . . . . . . . . . . . . . . 1963.7.40 Tell to a friend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1963.7.41 View product information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1973.7.42 Search products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1973.7.43 Show the best purchased products . . . . . . . . . . . . . . . . . . . . . . . 1973.7.44 Reset the temporal information . . . . . . . . . . . . . . . . . . . . . . . . . 197

3.8 Online catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1993.8.1 Place an order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1993.8.2 Checkout an order with multiple addresses . . . . . . . . . . . . . . . . . . 2013.8.3 Add an order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2023.8.4 Cancel an order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2043.8.5 Hold an order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2043.8.6 Unhold an order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2043.8.7 Reorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2053.8.8 Add a gift message to a placed order . . . . . . . . . . . . . . . . . . . . . 2053.8.9 Print an Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2053.8.10 Send order information by email . . . . . . . . . . . . . . . . . . . . . . . . 2063.8.11 Show previous orders of a customer . . . . . . . . . . . . . . . . . . . . . . 2063.8.12 Add an invoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2063.8.13 Register an invoice payment . . . . . . . . . . . . . . . . . . . . . . . . . . 2073.8.14 Cancel an invoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2073.8.15 Add a shipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2073.8.16 Add a refund . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2083.8.17 Cancel a refund . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2093.8.18 Add a comment to an order, invoice, shipment or refund. . . . . . . . . . . . 209

3.9 Store Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2103.9.1 Show the sales report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2103.9.2 Show the tax report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2103.9.3 Show the shipping report . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2103.9.4 Show the invoices report . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2103.9.5 Show the refunds report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2113.9.6 Show the coupon codes report . . . . . . . . . . . . . . . . . . . . . . . . . 211

4

Page 6: Magento Conceptual Schema

3.9.7 Show the products in carts report . . . . . . . . . . . . . . . . . . . . . . . . 2113.9.8 Show the abandoned carts report . . . . . . . . . . . . . . . . . . . . . . . 2123.9.9 Show the bestseller products report . . . . . . . . . . . . . . . . . . . . . . 2123.9.10 Show the ordered products report . . . . . . . . . . . . . . . . . . . . . . . 2123.9.11 Show the most viewed products report . . . . . . . . . . . . . . . . . . . . . 2133.9.12 Show the stock of products report . . . . . . . . . . . . . . . . . . . . . . . 2133.9.13 Show the downloads report . . . . . . . . . . . . . . . . . . . . . . . . . . . 2133.9.14 Show the new customer accounts report . . . . . . . . . . . . . . . . . . . . 2143.9.15 Show the customers by orders total report . . . . . . . . . . . . . . . . . . . 2143.9.16 Show the customers by number of orders report . . . . . . . . . . . . . . . 2143.9.17 Show the customer reviews report . . . . . . . . . . . . . . . . . . . . . . . 2143.9.18 Show the product reviews report . . . . . . . . . . . . . . . . . . . . . . . . 2153.9.19 Show the tags by customer report . . . . . . . . . . . . . . . . . . . . . . . 2153.9.20 Show the tags by product report . . . . . . . . . . . . . . . . . . . . . . . . 2153.9.21 Show the popular tags report . . . . . . . . . . . . . . . . . . . . . . . . . . 2163.9.22 Show the search terms report . . . . . . . . . . . . . . . . . . . . . . . . . . 216

4 Behavioral Schema. Events Specification 2174.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2174.2 Schema presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2184.3 Events Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2194.4 Store Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

4.4.1 SetDefaultWebsite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2264.4.2 SetDefaultStoreOfWebsite . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2264.4.3 SetDefaultStoreViewOfStore . . . . . . . . . . . . . . . . . . . . . . . . . . 2274.4.4 SetDefaultLanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

4.5 Customers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2294.5.1 CreateCustomer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2294.5.2 PasswordChange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2304.5.3 EditCustomerDetails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2304.5.4 NewCustomerAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2314.5.5 DeleteCustomerAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2324.5.6 DefaultDeliveryAddressChange . . . . . . . . . . . . . . . . . . . . . . . . . 2334.5.7 DefaultBillingAddressChange . . . . . . . . . . . . . . . . . . . . . . . . . . 2344.5.8 EditCustomerAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2344.5.9 LogIn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2354.5.10 RestorePreviousShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . . 2364.5.11 RestorePreviousProductLists . . . . . . . . . . . . . . . . . . . . . . . . . . 2374.5.12 LogOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2384.5.13 SaveCurrentProductLists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2394.5.14 NewSession . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2394.5.15 DeleteSession . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2404.5.16 SetCurrentWebsite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2404.5.17 SetCurrentStore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2414.5.18 SetCurrentStoreView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2414.5.19 SetCurrentCurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

4.6 Store Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2434.6.1 NewProduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2434.6.2 EditProduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2474.6.3 DeleteProduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2524.6.4 MoveCategory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2534.6.5 NewAttribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2534.6.6 EditAttribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2554.6.7 DeleteAttribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

5

Page 7: Magento Conceptual Schema

4.7 Additional Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2584.7.1 NewReview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2584.7.2 NewAdministratorReview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2594.7.3 AddProductToWishlist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2604.7.4 AddCommentToWishlistItem . . . . . . . . . . . . . . . . . . . . . . . . . . 2614.7.5 RemoveCommentFromWishlistItem . . . . . . . . . . . . . . . . . . . . . . 2614.7.6 RemoveProductFromWishlist . . . . . . . . . . . . . . . . . . . . . . . . . . 2624.7.7 AddProductToCompareList . . . . . . . . . . . . . . . . . . . . . . . . . . . 2634.7.8 RemoveProductFromCompareList . . . . . . . . . . . . . . . . . . . . . . . 2644.7.9 SingUpForPriceAlert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2644.7.10 SingUpForStockAlert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2654.7.11 SignUpForNewsletter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2664.7.12 SignDownFromNewsletter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2674.7.13 TellToAFriendUsed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2684.7.14 ProductViewed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2694.7.15 ResetTemporalInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

4.8 Online catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2714.8.1 ProductViewed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2714.8.2 AddProductToShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . . . . 2724.8.3 UpdateShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2734.8.4 ApplyCouponCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2744.8.5 OrderConfirmation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2744.8.6 DuplicateAccount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2774.8.7 NewAdministrationShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . 2784.8.8 AddProductToShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . . . . 2784.8.9 ChangeCurrencyOfAdministrationShoppingCart . . . . . . . . . . . . . . . 2804.8.10 ChangeEMailAndGroupOfAdministrationShoppingCart . . . . . . . . . . . . 2804.8.11 ApplyCouponCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2814.8.12 AddProductToShoppingCart . . . . . . . . . . . . . . . . . . . . . . . . . . . 2814.8.13 AddGiftMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2834.8.14 AddGiftMessageToItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2834.8.15 OrderConfirmation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2844.8.16 DeleteAdministrationShoppingCart . . . . . . . . . . . . . . . . . . . . . . . 2864.8.17 CancelOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2874.8.18 HoldOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2874.8.19 UnholdOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2884.8.20 Reorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2884.8.21 AddInvoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2894.8.22 PayInvoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2904.8.23 CancelInvoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2914.8.24 AddShipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2914.8.25 AddRefund . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2924.8.26 CancelRefund . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2934.8.27 AddComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

6

Page 8: Magento Conceptual Schema

1Conceptual Schema organitzation

Chapters 2, 3 and 4 describe the Magento’s conceptual Schema in UML / OCL notation. Due toits size, the schema must be organized and divided in parts, facilitating its comprensibility.

This chapter presents the organizative structure that has been used to document Magento’sConceptual Schema. Section 1.1 presents a global view, which is detailed in sections 1.2 and1.31.

1.1 Structure overviewMagento’s Conceptual Schema is organised in the same way as in osCommerce ConceptualSchema (see ?). It’s structure can be divided in two parts: structural and behavioral (sub)schema’s.

Structural Schema presents the static knowledge of the system: entities, properties of thoseentities and constraints. Those concepts are represented in UML diagrams and OCL expressions.

Behavioral Schema describes the features that the system offers to its users, also known asits dynamic behaviour. The description is made by Use Cases, which are specified in naturallanguage and related to the main system Events. Events’ effects and restrictions are specified inOCL.

1.2 Structural SchemaA structural schema consists of a taxonomy of entity types (a set of entity types with their gen-eralization/specialization relationships and the taxonomic constraints), a set of relationship types(either attributes or associations), the cardinality constraints of the relationship types and a set ofother constraints formally defined in OCL.

Entity and relationship types may be base or derived. The population of the base entity andrelationship types is explicitly represented in the Information Base (IB). If they are derived, thereis a formal derivation rule in OCL that defines their population in terms of the population of othertypes.

Magento’s Structural Schema can be considered a large schema. Therefore, it can’t be rep-resented together, so it has been divided in several sub-schemas that group related concepts.Sub-schemas are interrelated and, as a whole, they perform the complete Structural Schema

1Some definitions in this chapter are citations of ??

7

Page 9: Magento Conceptual Schema

and represent the knowledge about the analysed domain. In order to facilitate its comprensibility,sub-schemas have been classified in five groups.

First, we present three simplified diagrams, that contain only the main entities and relation-ships of the system. Afterwards, the set of sub-schemas is detailed.

In order to facilitate schema’s readability and comprensibility, each sub-schema is presentedin the following format:

n Sub-schema’s Name

n Overview: brief explanation about the knowledge represented by the sub-schema.

n Schema Diagram: UML class diagram specifying the domain knowlege represented bythe sub-schema. Entities that are specified in other sub-schema’s but have relationshipswith entities specified here are shown in white colour, hidding it’s attributes. Sometimes,the UML sub-schema’s diagram must be separated in two or more pages due to documentformatting.

n Operations: auxiliar operations used in constraints and derivation rules.

n Derivation Rules: derivation rules, specified in OCL operations.

n Constraints: integrity constraints that have not been expressed graphically. All of them arespecified as boolean OCL operations.

n Description: sub-schema’s detailed description in natural language. Sometimes, it can befollowed by an State-Chart Diagram to facilitate its understanding.

1.3 Behavioral SchemaThe behavioral schema consists of a set of use cases and event types. Event types are modelizedas UML classes with the <<Event>> stereotype. In general, there are three kinds of event types:domain events, action requests and queries.

Domain events have characteristics, constraints and effects. The characteristics of an eventare the set of relationships (attributes or associations) in which it participates. Each event typehas an operation called effect() that gives the effect of an event occurrence. The characteristicsof the event are used as input parameters for the effect() operation. We define the effect by thepostcondition of the operation. Both the event constraints and the postcondition are specified inOCL.

The postcondition defines the state of the IB after the event occurrence. Therefore, the effectof a domain event is a state that satisfies the postcondition and all IB constraints. Note that theOCL expressions used in constraints, derivation rules and pre/post conditions are without side-effects. These expressions are evaluated over the IB and their evaluation cannot change theIB.

Behavioral schema presents use case specification in natural language, following the formatspecified below:

n Use Case Name

n Primary Actor: main use case actor.

n Precondition: conditions that must be satisfied to execute the use case, specified in naturallanguage.

n Trigger: action that initiates the use case.

n Main Success Scenario: an specification of the interaction between the system and theuse case actors, specified in a numered sequence of sentences in natural language.

8

Page 10: Magento Conceptual Schema

n Extensions: specification of alternative interactions to the main scenario. It’s first numberindicates the stage of the main scenario where the extension starts.

In some stages of scenario specification (main or extensions), the main system Events are in-voked, with the following syntaxis:

[-> EventName]Those Events are specified in chapter 4, using de format detailed below:

n Event Name

n Event Characteristics: the set of relationships (attributes or associations) in which it par-ticipates and are used as input parameters for the effect() operation.

n Initial Integrity Constraints: conditions that must be satisfied before the Event starts.They are specified in OCL.

n Effect: effect that productes the Event’s execution in the information base. It is specified inOCL.

9

Page 11: Magento Conceptual Schema

2Structural Schema

In this chapter we develop the structural schema of the Magento information system. Section 2.1defines the scope of the schema elicitation, while section 2.2 describes the way the schema ispresented. Section 2.3 presents an overview of the whole schema, which is detailed in section2.4 and furthermore.

2.1 ScopeA conceptual schema represents the knowledge that a system needs to know about its domain,and about the functions it has to perform ?.

Thus, knowledge related to the way the system is presented, or technical aspects that dependon the technologies it is implemented are analysed in further stages of the development process.

When eliciting this schema from Magento, those aspects have been identified and not includedin the conceptual schema. More precisely, they refer to the following aspects:

n Design and presentation

n Configuration of the integration with external systems: Magento can communicate to exter-nal systems such as Pay Pal, Google or Visa and configuration parameters are needed.

n Static web pages management: by default, Magento generates all its web pages dependingon the state of its information base, but it offers administrators to include their own staticpages too.

n Other technical aspects: CSS, Javascript or RSS configuration.

n Advanced configuration: system time-outs, backups, compilation, URL redirection and more.

Furthermore, the purpose of this project is to describe the conceptual schema of an e-commercesystem, Magento. Thus, those knowledge that does not characterize the buying activity has notbeen included in the schema:

n Search engine: included in Magento, allows users searching products by keywords andmanages a history of the last and more used search terms.

10

Page 12: Magento Conceptual Schema

Finally, Magento has a huge list of extensions that can be added to the core system. Eachextension needs its own knowledge to perform its functions, and the available extensions nevercease to change. The conceptual schema specified does not represent the knowledge need byany of those extensions.

2.2 Schema presentationThe main purpose of the Magento’s structural schema is to provide a description of the concep-tualization of the Magento’s domain.

The structural schema is too large to be presented together. Therefore, this chapter beginswith three UML general view diagrams with the most important conceptual entity types and theirrelationship types.

Next, the whole schema is structured in several diagrams of greater detail in order to makeit more understandable. Each diagram corresponds to a part of the whole detailed schema andgroups together related concepts which can be seen as a set of knowledge about the informationsystem. Entities which appear in a structural schema fragment but are fully specified in otherconceptual grouping diagrams are drawn without showing their attributes.

Each fragment of the whole structural schema diagram is represented in UML and is intro-duced by a brief textual overview. Derived types and integrity constraints are specified in OCL.The structural schema specification uses standard UML with some extensions (specification ofderived types and constraints by OCL operations, constant and permanent stereotypes, etc.)explained in ?.

2.3 Schema OverviewThree UML diagrams are used to represent a simplified conceptual schema of the Magento’sdomain. More details about each concept are given in the next section, where the whole schemais fully specified.

Figure 2.1: Store Configuration and Customers Schema Overview

11

Page 13: Magento Conceptual Schema

Store Configuration

Subschema’s classified into this group describe the core structure of the Magento System: Web-sites, Stores and StoreViews. Those three concepts act as different granularity levels when con-figuring several system properties. For each of them, the System Administrator can define thedesired configuration about Shipping and Payment methods, Languages, Currencies, Locations,Taxes and more (see fig. 2.1).

Customers

Magento saves information about Customers, which are relied to a Website. Each Customer canbe associated to one or more Addresses. Any use of the system can be conceptually representedby a Session. A Session can be relied to a registered Customer or it can be anonymous (see fig.2.1).

Figure 2.2: Store Administration and Additional Activities Schema Overview

Store Administration

The system mantains information about a catalog of Products, whose properties can be definedat three levels of granularity. Products are classified in Categories. Attributes can be defined forproducts by the Store Administrator. For each pair Attribute - Product, the Store Administratorcan assign an AttributeValue at any granularity level. In addition, Options can be also added toproducts. In that case, its value is choosen by Customers when purchasing the product (see fig.2.2).

Additional Activities

Magento saves information about the activities performed by customers when they navigatethrought the catalog and purchase products. Furthermore, the system offers other features tousers such as adding Tags and Reviews to products, or suscribing to a Newsletter (see fig. 2.2).

12

Page 14: Magento Conceptual Schema

Figure 2.3: Online Catalog Schema Overview

Online Catalog

Users that navigate throught the catalog can add the Products they want to buy to a Shopping-Cart. The purchase of a Product in a ShoppingCart is represented by a ShoppingCartItem. EachShoppingCart is asosociated to an Store View. Depending on several conditions, PriceRules canbe associated to a ShoppingCartItem, decrementing it’s price (see fig. 2.3).

13

Page 15: Magento Conceptual Schema

2.4 Store Configuration

2.4.1 Stores

n Overview

Magento allows multi-store support. It defines a hierarchy of Websites, Stores and Store-views.

n Schema Diagram

n Constraints

[1] Websites are identified by its code.

14

Page 16: Magento Conceptual Schema

Context Website :: isIdentifiedByItsCode() : Booleanbody: Website.allInstances() -> isUnique(code)

[2] Store are identified by its name.

Context Store :: isIdentifiedByItsName() : Booleanbody: Store.allInstances() -> isUnique(name)

[3] StoreViews are identified by its code and also by its name.

Context StoreView :: isIdentifiedByItsCodeAndName() : Booleanbody: StoreView.allInstances() -> isUnique(code) and StoreView.allInstances() -> isUnique(name)

[4] Each language is identified by its name.

Context Language :: isIdentifiedByItsName() : Booleanbody: Language.allInstances() -> isUnique(name)

[5] Each time zone is identified by its name.

Context TimeZone :: isIdentifiedByItsName() : Booleanbody: TimeZone.allInstances() -> isUnique(name)

n Description

Magento is able to manage multiple websites and stores. It organizes them in a hierarchyof Websites, Stores and Store Views.

The Website is the top-level structure and it consists of stores. Websites save the infor-mation about customers, shopping carts and orders, as shown in the next sections. Thisinformation is shared within the stores and store views of the website.

Stores are the middle level structure. Some product attributes and categories are definedat the store level and shared with all the store views of the store.

A Store View is a way of presenting a store. In most cases, different storeViews are usedto show the same store in different languages. We can also define two store views from thesame store in the same language, but oriented to different costumer segments.

Store views are identified by its name and code.

When customers access the system, they access to the default website. When customersaccess a website, they access to its default store. When customers access a store, itsdefault store view is shown.

15

Page 17: Magento Conceptual Schema

2.4.2 Store Configuration

n Overview

Magento allows the store administrator to specify several configurations to affect the waythat the system works.

n Schema Diagram

16

Page 18: Magento Conceptual Schema

n Constraints

[1] The catalog price scope should be Global or Website.

Context CatalogConfiguration :: hasACorrectPriceScope() : Booleanbody: not (self.catalogPriceScope = Scope::StoreView)

[2] The catalog price scope should be Website or Store View.

Context CatalogConfigurationInWebsite :: hasACorrectRecentlyViewedAndComparedProductsScope(): Booleanbody: not (self.recentlyViewedAndComparedProductsScope = Scope::Global)

17

Page 19: Magento Conceptual Schema

[3] The share account scope should be Global or Website.

Context CustomerConfiguration :: hasACorrectShareAccountScope() : Booleanbody: not (self.shareAccountScope = Scope::StoreView)

[4] If the tax is applied after discount, there is no definition about if discounts are applied includingtaxes or not.

Context TaxConfigurationInWebsite :: definesTheApplyDiscountMethodWhenItsNeeded() : Booleanbody: (self.methodRespectingDiscount = TaxRespectingDiscountsMethod::TaxAfterDiscount) = (self.-applyDiscountIncludingTax -> isEmpty())

[5] The the default customer group should not be the group named ’NotLoggedIn’.

Context CustomerConfigurationInStoreView :: doesNotDefineTheNotLoggedInGroupAsDefault() : Booleanbody: self.defaultCustomerGroup.name <> ’NotLoggedIn’

n Description

Magento’s configuration is organised in several groups. For each group, some propertiesare defined at the global level, others at the website level and others at the store view level.

The Catalog Configuration manages most of the properties about products:

• catalogPriceScope: defines the scope the product prices will be shared at.

• allowStockAlert: determines if the customers can indicate the system to notify themwhen a selected product which is out of stock comes back in stock.

• allowGuestsToWriteReviews: allows not registered users to write reviews for a prod-uct.

• recentlyViewedComparedProductsScope: defines the scope the recently viewedand comparet list will be shared at.

• allowDownloadBeforeOrderIsComplete: allows downloadable products to be down-loaded before an order is already paid.

• allowGuestCheckoutForDownloadableItems: allows not registered users to pur-chase downloadable products.

• maximumDownloadCount: the maximum of times a downloadable product can bedownloaded.

• allowPriceAlert: determines if the customers can indicate the system to notify themwhen a selected product changes its price.

• numberOfRecentlyComparedProductsSaved: that will be saved in the recently com-pared products list.

• numberOfRecentlyViewedProductsSaved: that will be saved in the recently viewedproducts list.

The Stock Configuration manages the product stock properties. The last five can be rede-fined for each individual product.

• decreaseStockWhenOrderIsPlaced: determines whether the quantity of a productwill automatically decrease when an order that purchases this product is placed.

• setItemInStockWhenOrderIsCancelled: determines whether the quantity of a prod-uct will automatically be re-increased when an order that purchases this product iscancelled.

18

Page 20: Magento Conceptual Schema

• displayOutOfStockProducts: determines whether products Out Of Stock are dis-played to customers.

• qtyToBecomeOutOfStock: determine at which quantity the availability of the item willswitch from In Stock to Out of Stock.

• minQtyAllowedInShoppingCart: the minimum amount the customer is required topurchase of each product in an order.

• maxQtyAllowedInShoppingCart: the maximum amount the customer is allowed topurchase of each product in an order.

• notifyForQuantityBelow: when a stock of any product goes below this level, Magentowill automatically notify the store admin.

• backOrderPolicy: determines if customers are allowed to purchase more quantitythan is available or not and, if yes, if they are notified when they place an order withunavailable quantities.

The Wishlist Configuration allows to set if wishlists are or not allowed in a website.

The Sales Configuration defines:

• allowGiftMessageForOrders: allows customers to add a gift message to its orders.

• allowGiftMessageForOrderLines: allows customers to add a gift message to a prod-uct they have ordered.

The Customer Configuration defines:

• shareAccountScope: defines the scope the customer accounts will be shared at.

• defaultCustomerGroup: the customer group that a customer will be assigned bydefault when it is created.

The Tax Configuration defines how taxes are calculated and when are they shown to users:

• shippingTax: this tax will be applied to shipping costs.

• method: determines wether the tax amount is calculated for each item, for each or-der line or for all the order. This can make the final tax amount vary due to decimaltruncation.

• usedAdress: the adress that will be use to calculate the applicable taxes. See taxesand order’s sections.

• methodRespectingDiscount: determines whether the taxes are applied before orafter discounts.

• applyDiscountIncludingTax: if taxes are applied before discounts, determines whetheran eventual discount is applied taking into account the tax amount.

• applyTaxOnCustomPriceIfAvailable: when a product is sold to a customer with acustom price, determines if taxes are applied to the new or the original price.

• displayShippingPriceWithTax: determines if shipping costs are shown to customerswith or without taxes.

• displayProductPriceWithTax: determines if product prices are shown to customerswith or without taxes.

The Shipping Configuration manages the following information:

• shippingOrigin: the postal area from where the shipments will be sent.

19

Page 21: Magento Conceptual Schema

• allowShippingToMultipleAdresses: determines whether it is allowed to ship prod-ucts from the same order to different adresses. When an Order with multiple shippingaddresses is saved, it will split into multiple Orders because only one shipping addressper order is allowed.

• mawQtyAllowedForMultipleAdresses: maximum quantity that a customer can enterin the for each item in a multiple adresses checkout.

The Tell to a friend Configuration defines:

• status: enables or disables all customers, including guests, to automatically sendmails with information about a product.

• guestStatus: enables or disables not registered customers (guests) to automaticallysend mails with information about a product.

• maxUsesPerHour: the maximum of times a customer can use the ’tell to a friend’feature per hour.

The Currency Configuration defines several currency properties that will be commentedin the Currency section. Similarly, the Locations Configuration will be commented in theLocations section.

20

Page 22: Magento Conceptual Schema

2.4.3 Currencies

n Overview

Magento is able to work with different currencies.

n Schema Diagram

n Derivation Rules

[1] CurrencyConfigurationInWebsite :: baseCurrency is the website’s base currency, if it is de-fined, or the general system’s base currency otherwise.

Context CurrencyConfigurationInWebsite :: baseCurrency : Currencybody:

21

Page 23: Magento Conceptual Schema

if self.redefinedBaseCurrency -> notEmpty() and CatalogConfiguration.catalogPriceScope = Scope::Websitethen

self.redefinedBaseCurrencyelse

CurrencyConfiguration.genericBaseCurrencyendif

[2] CurrencyConfigurationInStoreView :: allowedCurrency are the store view’s allowed curren-cies, if it is defined. If not, the website’s allowed currencies or the generic allowed currencies.

Context CurrencyConfigurationInStoreView :: allowedCurrency : Currencybody:

if self.redefinedAllowedCurrency -> notEmpty() thenself.redefinedAllowedCurrency

else if self.storeView.store.website.currencyConfigurationInWebsite.redefinedAllowedCurrency-> notEmpty() then

self.storeView.store.website.currencyConfigurationInWebsite.redefinedAllowedCurrencyelse CurrencyConfiguration.genericAllowedCurrency endif

[3] CurrencyConfigurationInStoreView :: defaultCurrency is the store view’s default currency, if itis defined. If not, the website’s default currency or the generic default currency..

Context CurrencyConfigurationInStoreView :: defaultCurrency : Currencybody:

if self.redefinedDefaultCurrency -> notEmpty() thenself.redefinedDefaultCurrency

else if self.storeView.store.website.currencyConfigurationInWebsite.redefinedDefaultCurrency -> notEmpty() then

self.storeView.store.website.currencyConfigurationInWebsite.redefinedDefaultCurrencyelse CurrencyConfiguration.genericDefaultCurrency endif

n Constraints

[1] Each currency is identified by its name.

Context Currency :: isIdentifiedByItsName() : Booleanbody: Currency.allInstances() -> isUnique(name)

[2] The base currency of a website is enabled.

Context CurrencyConfigurationInWebsite :: hasABaseCurrencyWhichIsEnabled() : Booleanbody: self.baseCurrency.status = Status::Enabled

[3] Only enabled currencies can be used in a Store View.

Context CurrencyConfigurationInStoreView :: allowsOnlyToUseEnabledCurrencies() : Booleanbody: self.allowedCurrency -> forAll ( ac | ac.status = Status::Enabled )

[4] Each currency allowed in a store view has a rate to relate it with the base currency of thewebsite the store view belongs to.

Context CurrencyConfigurationInStoreView :: hasTheNecessaryCurrencyRates() : Booleanbody: self.allowedCurrency -> forAll ( ac | ac.baseCurrency -> includes(self.storeView.store.web-site.baseCurrency) )

[5] The currency rate should be 1 if both currencies are the same.

Context CurrencyRate :: isOneIfCurrenciesAreEquals() : Booleanbody: self.baseCurrency = self.currency implies self.rate = 1

22

Page 24: Magento Conceptual Schema

n Description

Magento has a predefined set of currencies. Administrators can enable or disable them.

Each website has a base currency. The priced orders placed in this website are stored inthe base currency. A generic base currency can be defined for all websites and it can beredefined specifically for a website.

In each store view, the costumer will be able to see the monetary amounts in any of itsallowed currencies. By default, those amounts will be shown in the default currency. Also ageneric set of allowed currencies and a generic default currency can be defined for all storeviews and redefined specifically at the website or store view level.

A conversion rate should be defined between each allowed currency and the base cur-rency of its website. The rate is defined as follows: X base currency = rate * X allowedcurrency.

23

Page 25: Magento Conceptual Schema

2.4.4 Locations

n Overview

Magento saves information about customer adresses.

n Schema Diagram

n Derivation Rules

[1] LocationsConfigurationInStoreView :: allowedCountry are the store view’s allowed countries,if defined. If not, the website’s allowed countries or the generic allowed countries.

Context LocationsConfigurationInStoreView :: allowedCountry : Set(Country)body:

if self.redefinedAllowedCountry -> notEmpty() thenself.redefinedAllowedCountry

else if self.storeView.store.website.locationsConfigurationInWebsite.redefinedAllowedCountry -> notEmpty()then

self.storeView.store.website.locationsConfigurationInWebsite.redefinedAllowedCountryelse LocationsConfiguration.genericAllowedCountry endif

n Constraints

[1] Countries are identified by its name.

24

Page 26: Magento Conceptual Schema

Context Country :: isIdentifiedByItsName() : Booleanbody: Country.allInstances() -> isUnique(name)

[2] Zones are identified by its name and country.

Context Zone :: isIdentifiedByItsNameAndCountry() : Booleanbody: Zone.allInstances() -> isUnique(Setname,country)

[3] Municipalities are identified by its name and country.

Context Municipality :: isIdentifiedByItsNameAndCountry() : Booleanbody: Municipality.allInstances() -> isUnique(Setname,country)

[4] Postal areas are identified by its postal code and country.

Context PostalArea :: isIdentifiedByItsPostalCodeAndCountry() : Booleanbody: PostalArea.allInstances() -> isUnique(SetpostalCode,municipality.country)

[5] If the address country has zones, the address is also associated to a zone of this country.

Context Address :: hasACorrectZoneIfItIsNeeded() : Booleanbody: self.country.zone -> notEmpty() implies (self.zone -> notEmpty() and self.country = self.-zone.country)

[6] If the country the municipality is part of has zones, the municipality is also associated to a zoneof this country.

Context Municipality :: hasACorrectZoneIfItIsNeeded() : Booleanbody: self.country.zone -> notEmpty() implies (self.zone -> notEmpty() and self.country = self.-zone.country)

[7] If the country where an adress is located forces to specify a postal area, the address is asso-ciated to one postal area.

Context Adress :: hasAPostalAreaIfItIsNeeded() : Booleanbody: self.country.postalCodeIsMandatory implies self.postalArea -> notEmpty()

[8] The postal area of an address belongs to the municipality of that address.

Context Adress :: hasACorrectPostalArea() : Booleanbody: self.municipality.postalArea -> includes( self.postalArea )

[9] The municipality of an address belongs to the country and zone (if the zone is defined) of thataddress.

Context Adress :: hasACorrectMunicipality() : Booleanbody:

self.country.municipality -> includes( self.municipality ) andself.zone -> notEmpty() implies self.zone.municipality -> includes ( self.municipality )

[10] If an adress is related to a zone, the zone belongs to the country of that address.

Context Adress :: hasACorrectZone() : Booleanbody: self.country.zone -> includes( self.zone )

n DescriptionMagento allows creating customer adresses. Adresses specify where the orders will be

billed or delivered. Each adress consists of:

25

Page 27: Magento Conceptual Schema

• firstName

• middleName

• lastName

• namePrefix

• nameSuffix

• company

• streetAdress

• telephone

• fax

A Postal Area represents a geographical zone which shares the same postal code.

A Municipality is an administrative entity composed of a clearly defined territory and itspopulation and denotes a city, town or village.

Each municipality belongs to a Country. When a costumer creates a new adress, he willbe able to choose only between the countries allowed in the current store view.

Zones are states or provinces of a country. It is important to note that there can becountries with no zones defined.

26

Page 28: Magento Conceptual Schema

2.4.5 Shipping Methods

n OverviewThe system can operate with different shipping methods.

n Schema Diagram

27

Page 29: Magento Conceptual Schema

28

Page 30: Magento Conceptual Schema

n Operations

[1] context FlatRateInWebsite def: calculateCost (purchasedProducts : Set(OrderLine), delivery :Address) : Money =

if self.method=FlatRateMethod::None then0

else if self.method = FlatRateMethod::PerOrder then

29

Page 31: Magento Conceptual Schema

self.costelse

self.cost * ( purchasedProducts.quantity -> sum() )endif endif

[2] context TableRateInWebsite def: calculateCost (purchasedProducts : Set(OrderLine), delivery: Address) : Money =

let usedValue:Decimal =if self.method=TableRateMethod::Weight then

lines -> collect ( l |Product.allInstances() -> any(p|l.productSku=p.sku).productInStoreView

-> any(piw|piw.storeView=l.order.storeView).weight * l.quantity) -> sum()

else if self.method=TableRateMethod::Price then purchasedProducts.total -> sum()else purchasedProducts.quantity -> sum() endif endifin

let underValueItems:Set(TableRateItem) = self.item -> select ( i | i.number < usedValue )in

self.tableRateItem -> any ( i | underValueItems -> forAll ( uvi | uvi.number <= i.number )).cost

[3] context FreeShippingInWebsite def: calculateCost (purchasedProducts : Set(OrderLine), de-livery : Address) : Money =

0

[4] context ExternalShippingMethodInWebsite def: calculateCost (purchasedProducts :Set(OrderLine), delivery : Address) : Money

This operation calls an external service.

n Derivation Rules

[1] ShippingMethodInStoreView :: title is the redefinedStatus. If there’s no redefinition at thatlevel, it is the nearest upper redefined value.

Context ShippingMethodInStoreView :: title : Stringbody:

if self.redefinedTitle -> notEmpty() thenself.redefinedTitle

else if self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.-storeView -> includes ( self.storeView ) ).redefinedTitle -> notEmpty() then

self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.store-View -> includes ( self.storeView ) ).redefinedTitle

elseself.shippingMethod.genericTitle

endif endif

[2] InternalShippingMethodInStoreView :: methodName is the redefined method name. If there’sno redefinition at that level, it is the nearest upper redefined value.

Context InternalShippingMethodInStoreView :: methodName : Stringbody:

if self.redefinedMethodName -> notEmpty() thenself.redefinedMethodName

else if self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.-storeView -> includes ( self.storeView ) ).redefinedMethodName -> notEmpty() then

self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.store-View -> includes ( self.storeView ) ).redefinedMethodName

elseself.shippingMethod.genericMethodName

30

Page 32: Magento Conceptual Schema

endifendif

[3] ShippingMethodInStoreView :: errorMessage is the redefinedErrorMessage. If there’s no re-definition at that level, it is the nearest upper redefined value.

Context ShippingMethodInStoreView :: errorMessage : Stringbody:

if self.redefinedErrorMessage -> notEmpty() thenself.redefinedErrorMessage

elseif self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.store-View -> includes ( self.storeView ) ).redefinedErrorMessage -> notEmpty() then

self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website.store.store-View -> includes ( self.storeView ) ).redefinedErrorMessage

elseself.shippingMethod.genericErrorMessage

endif

[4] ShippingMethodInWebsite :: allowedCountry the redefinedAllowedCountry. If there’s no re-definition at the website level, it is the generic value.

Context ShippingMethodInWebsite :: allowedCountry : Set(Country)body:

if self.redefinedAllowedCountry -> notEmpty() thenself.redefinedAllowedCountry

elseself.shippingMethod.genericAllowedCountry

endif

[5] ShippingMethodInWebsite :: status is the redefinedStatus. If there’s no redefinition at thewebsite level, it is the generic value.

Context ShippingMethodInWebsite :: status : Statusbody:

if self.redefinedStatus -> notEmpty() thenself.redefinedStatus

elseself.shippingMethod.genericStatus

endif

[6] ShippingMethodInWebsite :: showIfNotApplicable is the redefinedShowIfNotApplicable. Ifthere’s no redefinition at the website level, it is the generic value.

Context ShippingMethodInWebsite :: showIfNotApplicable : Booleanbody:

if self.redefinedShowIfNotApplicable -> notEmpty() thenself.redefinedShowIfNotApplicable

elseself.shippingMethod.genericShowIfNotApplicable

endif

[7] ShippingMethodInWebsite :: handlingCalculatingMethod is the redefinedHandlingCalculat-ingMethod. If there’s no redefinition at the website level, it is the generic value.

Context ShippingMethodInWebsite :: handlingCalculatingMethod : PriceCalculatingMethodbody:

if self.redefinedHandlingCalculatingMethod -> notEmpty() thenself.redefinedHandlingCalculatingMethod

elseself.shippingMethod.genericHandlingCalculatingMethod

endif

[8] ShippingMethodInWebsite :: handlingFee is the redefinedHandlingFee. If there’s no redefini-tion at the website level, it is the generic value.

Context ShippingMethodInWebsite :: handlingFee : Decimalbody:

31

Page 33: Magento Conceptual Schema

if self.redefinedHandlingFee -> notEmpty() thenself.redefinedHandlingFee

elseself.shippingMethod.genericHandlingFee

endif

[9] FlatRateInWebsite :: method is the redefinedMethod. If there’s no redefinition at the websitelevel, it is the generic value.

Context FlatRateInWebsite :: method : FlatRateMethodbody:

if self.redefinedMethod -> notEmpty() thenself.redefinedMethod

elseself.flatRate.genericMethod

endif

[10] FlatRateInWebsite :: cost is the redefinedCost. If there’s no redefinition at the website level,it is the generic value.

Context FlatRateInWebsite :: cost : Moneybody:

if self.redefinedCost -> notEmpty() thenself.redefinedCost

elseself.flatRate.genericCost

endif

[11] TableRateInWebsite :: items is the redefinedItems. If there’s no redefinition at the websitelevel, it is the generic value.

Context TableRateInWebsite :: items : ShippingTableItembody:

if self.redefinedItems -> notEmpty() thenself.redefinedItems

elseself.tableRate.genericItems

endif

[12] TableRateInWebsite :: method is the redefinedMethod. If there’s no redefinition at the web-site level, it is the generic value.

Context TableRateInWebsite :: method : ShippingTableMethodbody:

if self.redefinedMethod -> notEmpty() thenself.redefinedMethod

elseself.tableRate.genericMethod

endif

[13] TableRateInWebsite :: includeVirtualProducts is the redefinedIncludeVirtualProducts. Ifthere’s no redefinition at the website level, it is the generic value.

Context TableRateInWebsite :: includeVirtualProducts : Booleanbody:

if self.redefinedIncludeVirtualProducts -> notEmpty() thenself.redefinedIncludeVirtualProducts

elseself.tableRate.genericIncludeVirtualProducts

endif

[14] FreeShippingInWebsite :: minimumOrderAmount is the redefinedMinimumOrderAmount. Ifthere’s no redefinition at the website level, it is the generic value.

Context FreeShippingInWebsite :: minimumOrderAmount : Moneybody:

if self.redefinedMinimumOrderAmount -> notEmpty() thenself.redefinedMinimumOrderAmount

32

Page 34: Magento Conceptual Schema

elseself.freeShipping.genericMinimumOrderAmount

endif

[15] ExternalShippingMethodInWebsite :: gatewayURL is the redefinedGatewayURL. If there’sno redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: gatewayURL : URLbody:

if self.redefinedGatewayURL -> notEmpty() thenself.redefinedGatewayURL

elseself.externalShippingMethod.genericGatewayURL

endif

[16] ExternalShippingMethodInWebsite :: maxPackageWeight is the redefinedMaxPack-ageWeight. If there’s no redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: maxPackageWeight : Weightbody:

if self.redefinedMaxPackageWeight -> notEmpty() thenself.redefinedMaxPackageWeight

elseself.externalShippingMethod.genericMaxPackageWeight

endif

[17] ExternalShippingMethodInWebsite :: handlingApplied is the redefinedHandlingApplied. Ifthere’s no redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: handlingApplied : HandlingMethodbody:

if self.redefinedHandlingApplied -> notEmpty() thenself.redefinedHandlingApplied

elseself.externalShippingMethod.genericHandlingApplied

endif

[18] ExternalShippingMethodInWebsite :: allowedSpecificMethods is the redefinedAllowedSpeci-ficMethods. If there’s no redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: allowedSpecificMethods : Set(ExternalSpecificShippingMethod)body:

if self.redefinedAllowedSpecificMethods -> notEmpty() thenself.redefinedAllowedSpecificMethods

elseself.externalShippingMethod.genericAllowedSpecificMethods

endif

[19] ExternalShippingMethodInWebsite :: freeSpecificMethod is the redefinedFreeSpeci-ficMethod. If there’s no redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: freeSpecificMethod : ExternalSpecificShippingMethodbody:

if self.redefinedFreeSpecificMethod -> notEmpty() thenself.redefinedFreeSpecificMethod

elseself.externalShippingMethod.genericFreeSpecificMethod

endif

[20] ExternalShippingMethodInWebsite :: minimumAmountForFreeShipping is the redefinedMin-imumAmountForFreeShipping. If there’s no redefinition at the website level, it is the generic value.

Context ExternalShippingMethodInWebsite :: minimumAmountForFreeShipping : Moneybody:

if self.redefinedMinimumAmountForFreeShipping -> notEmpty() thenself.redefinedMinimumAmountForFreeShipping

33

Page 35: Magento Conceptual Schema

elseself.externalShippingMethod.genericMinimumAmountForFreeShipping

endif

[21] UPSInWebsite :: container is the redefinedContainer. If there’s no redefinition at the websitelevel, it is the generic value.

Context UPSInWebsite :: container : USPSContainerbody:

if self.redefinedContainer -> notEmpty() thenself.redefinedContainer

elseself.uPS.genericContainer

endif

[22] UPSInWebsite :: destinationType is the redefinedDestinationType. If there’s no redefinitionat the website level, it is the generic value.

Context UPSInWebsite :: destinationType : Destinationbody:

if self.redefinedDestinationType -> notEmpty() thenself.redefinedDestinationType

elseself.uPS.genericDestinationType

endif

[23] UPSInWebsite :: pickup is the redefinedPickup. If there’s no redefinition at the website level,it is the generic value.

Context UPSInWebsite :: pickup : UPSPickupMethodbody:

if self.redefinedPickup -> notEmpty() thenself.redefinedPickup

elseself.uPS.genericPickup

endif

[24] USPSInWebsite :: userID is the redefinedUserID. If there’s no redefinition at the websitelevel, it is the generic value.

Context USPSInWebsite :: userID : Stringbody:

if self.redefinedUserID -> notEmpty() thenself.redefinedUserID

elseself.uSPS.genericUserID

endif

[25] USPSInWebsite :: container is the redefinedContainer. If there’s no redefinition at the web-site level, it is the generic value.

Context USPSInWebsite :: container : USPSContainerbody:

if self.redefinedContainer -> notEmpty() thenself.redefinedContainer

elseself.uSPS.genericContainer

endif

[26] USPSInWebsite :: size is the redefinedSize. If there’s no redefinition at the website level, itis the generic value.

Context USPSInWebsite :: size : USPSSizebody:

if self.redefinedSize -> notEmpty() thenself.redefinedSize

elseself.uSPS.genericSize

34

Page 36: Magento Conceptual Schema

endif

[27] FedExInWebsite :: userID is the redefinedUserID. If there’s no redefinition at the websitelevel, it is the generic value.

Context FedExInWebsite :: userID : Stringbody:

if self.redefinedUserID -> notEmpty() thenself.redefinedUserID

elseself.fedEx.genericUserID

endif

[28] FedExInWebsite :: container is the redefinedContainer. If there’s no redefinition at the web-site level, it is the generic value.

Context FedExInWebsite :: container : FedExContainerbody:

if self.redefinedContainer -> notEmpty() thenself.redefinedContainer

elseself.fedEx.genericContainer

endif

[29] FedExInWebsite :: destinationType is the redefinedDestinationType. If there’s no redefinitionat the website level, it is the generic value.

Context FedExInWebsite :: destinationType : Destinationbody:

if self.redefinedDestinationType -> notEmpty() thenself.redefinedDestinationType

elseself.fedEx.genericDestinationType

endif

[30] FedExInWebsite :: pickup is the redefinedPickup. If there’s no redefinition at the websitelevel, it is the generic value.

Context FedExInWebsite :: pickup : FedExPickupMethodbody:

if self.redefinedPickup -> notEmpty() thenself.redefinedPickup

elseself.fedEx.genericPickup

endif

[31] DHLInWebsite :: userID is the redefinedUserID. If there’s no redefinition at the website level,it is the generic value.

Context DHLInWebsite :: userID : Stringbody:

if self.redefinedUserID -> notEmpty() thenself.redefinedUserID

elseself.dHL.genericUserID

endif

[32] DHLInWebsite :: container is the redefinedContainer. If there’s no redefinition at the websitelevel, it is the generic value.

Context DHLInWebsite :: container : DHLContainerbody:

if self.redefinedContainer -> notEmpty() thenself.redefinedContainer

elseself.dHL.genericContainer

endif

35

Page 37: Magento Conceptual Schema

[33] DHLInWebsite :: password is the redefinedPassword. If there’s no redefinition at the websitelevel, it is the generic value.

Context DHLInWebsite :: password : Stringbody:

if self.redefinedPassword -> notEmpty() thenself.redefinedPassword

elseself.dHL.genericPassword

endif

[34] DHLInWebsite :: accountNumber is the redefinedAccountNumber. If there’s no redefinitionat the website level, it is the generic value.

Context DHLInWebsite :: accountNumber : Stringbody:

if self.redefinedAccountNumber -> notEmpty() thenself.redefinedAccountNumber

elseself.dHL.genericAccountNumber

endif

[35] DHLInWebsite :: shippingKey is the redefinedShippingKey. If there’s no redefinition at thewebsite level, it is the generic value.

Context DHLInWebsite :: shippingKey : Stringbody:

if self.redefinedShippingKey -> notEmpty() thenself.redefinedShippingKey

elseself.dHL.genericShippingKey

endif

[36] DHLInWebsite :: internationalShippingKey is the redefinedInternationalShippingKey. Ifthere’s no redefinition at the website level, it is the generic value.

Context DHLInWebsite :: internationalShippingKey : Stringbody:

if self.redefinedInternationalShippingKey -> notEmpty() thenself.redefinedInternationalShippingKey

elseself.dHL.genericInternationalShippingKey

endif

[37] DHLInWebsite :: packageDescription is the redefinedPackageDescription. If there’s no re-definition at the website level, it is the generic value.

Context DHLInWebsite :: packageDescription : Stringbody:

if self.redefinedPackageDescription -> notEmpty() thenself.redefinedPackageDescription

elseself.dHL.genericPackageDescription

endif

[38] DHLInWebsite :: isShipmentDurable is the redefinedIsShipmentDurable. If there’s no redefi-nition at the website level, it is the generic value.

Context DHLInWebsite :: isShipmentDurable : Booleanbody:

if self.redefinedIsShipmentDurable -> notEmpty() thenself.redefinedIsShipmentDurable

elseself.dHL.genericIsShipmentDurable

endif

36

Page 38: Magento Conceptual Schema

[39] DHLInWebsite :: dutyPaymentType is the redefinedDutyPaymentType. If there’s no redefini-tion at the website level, it is the generic value.

Context DHLInWebsite :: dutyPaymentType : DHLDutyPaymentTypebody:

if self.redefinedDutyPaymentType -> notEmpty() thenself.redefinedDutyPaymentType

elseself.dHL.genericDutyPaymentType

endif

n Constraints

[1] There is only one shipping method for each shipping method subtype, so shipping methodsare identified by its subtypes.

Context ShippingMethod :: isIdentifiedByItsSubtype() : Booleanbody:

FlatRate.allInstances() -> size() = 1 andTableRate.allInstances() -> size() = 1 andFreeShipping.allInstances() -> size() = 1 andUPS.allInstances() -> size() = 1 andUSPS.allInstances() -> size() = 1 andFedEx.allInstances() -> size() = 1 andDHL.allInstances() -> size() = 1

[2] A shipping method in a store view is identified by its title and store view.

Context ShippingMethodInStoreView :: isIdentifiedByItsTitleAndStoreView() : Booleanbody: ShippingMethodInStoreView.allInstances() -> isUnique(Settitle,storeView)

[3] Each shipping method should be specified in all existing store views in the system.

Context ShippingMethod :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

[4] Each shipping method should be specified in all existing websites in the system.

Context ShippingMethod :: isSpecifiedInAllWebsites() : Booleanbody: self.website -> includesAll( Website.allInstances() )

[5] Each internal shipping method should be specified in all existing websites in the system.

Context InternalShippingMethod :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfInternalShippingMethod -> includesAll( Website.allInstances() )

[6] Each external shipping method should be specified in all existing websites in the system.

Context ExternalShippingMethod :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfExternalShippingMethod -> includesAll( Website.allInstances() )

[7] The flate rate method should be specified in all existing websites in the system.

Context FlatRate :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfFlatRate -> includesAll( Website.allInstances() )

[8] The table rate method should be specified in all existing websites in the system.

37

Page 39: Magento Conceptual Schema

Context TableRate :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfTableRate -> includesAll( Website.allInstances() )

[9] The free shipping method should be specified in all existing websites in the system.

Context FreeShipping :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfFreeShipping -> includesAll( Website.allInstances() )

[10] The UPS method should be specified in all existing websites in the system.

Context UPS :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfUPS -> includesAll( Website.allInstances() )

[11] The USPS method should be specified in all existing websites in the system.

Context USPS :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfUSPS -> includesAll( Website.allInstances() )

[12] The FedEx method should be specified in all existing websites in the system.

Context FedEx :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfFedEx -> includesAll( Website.allInstances() )

[13] The DHL method should be specified in all existing websites in the system.

Context DHL :: isSpecifiedInAllWebsites() : Booleanbody: self.websiteOfDHL -> includesAll( Website.allInstances() )

[14] There is at least one enabled shipping method

Context Website :: hasOneShippingMethodEnabledAtLeast() : Booleanbody: self.shippingMethodInWebsite -> select (pm | pm.status=Status::Enabled) -> size() >= 1

[15] The free shipping method does not have any handling fee defined.

Context FreeShipping :: hasNoHandlingFee() : Booleanbody: self.handlingFee.isUndefined() and self.handlingCalculatingMethod.isUndefined()

n Description

The Magento store administrator can customize the shipping methods that are availableat checkout time. During the checkout process, the chosen method is used to calculate thefinal shipping and packaging costs for the order.

Depending on the selected method, the price can be affected by how many productshave been ordered, how much they weigh or other criteria. We present here the ShippingMethods allowed by Magento:

• Flat rate: a single price is used on all orders, regardless of how many items arebought, how much everything weighs, etc.

• Table rates: table rate charging sets the price for shipping based on the total weight,the total order’s price or the number of the products ordered. The weight or price islooked up in a table to find the matching range, and then that price is applied.

• Free shipping: no cost is added when using this method. The store administrator canestablish a minimum order amount for this method to be applicable.

• UPS: interacts with the external United Parcel Service website.

38

Page 40: Magento Conceptual Schema

• USPS: interacts with the external United States Postal Service website.

• FedEx: interacts with the external FedEx Corporation website.

• DHL: interacts with the external Deutsche Post DHL website.

For all shipping methods, some properties should be defined:

• status: defines if the method is available or not for customers.

• title: the name the users will see for this method.

• allowedCountry: only the Orders shipped to this countries will be able tu use thecurrent shipping method.

• showIfNotApplicable: determinates if the method will be displayed if the customerdoes not meet the country requirements.

• errorMessage: the message that will be displayed when the customer does not meetthe country requirements, if the showIfNotApplicable property is set to true.

• handlingFee: an additional shipping cost that will be added.

• handlingCalculatingMethod: the way the upper cost will be calculated, adding thewhole quantity or as a percent.

The first tree shipping methods described above are internally defined by magento. Foreach one, we should define the method name that will be used to show to the customers.

The last four methods interact with external shipping service’s websites to calculate theshipping cost. For that methods, we should define the following properties:

• gatewayURL: the url to connect with the service.

• maximumPackageWeight: the maximum weight allowed for an single shipment.

• handlingApplied: determines if the handling fee will be applied for each shipment oronly once per order.

• allowedSpecificMethods: set of specific shipping methods that each external ship-ping service provides.

• freeSpecificMethod: defines one specific method of this service that the store de-cides to offer for free.

• minimumAmountForFreeShipping: if this minimum amount is not reached by theorder total price, the free specific method will be offered with its normal price.

• userID: the id account provided by the external shipping service to identificate thestore.

• container: the type of container that will be tipically used to package the sold items.

• destinationType: the destination to which the store will typically deliver its orders.

• pickupMethod: the method by which the store will deliver its packages to the shippingservice.

The DHL Service has several other properties that should be defined. They are internalconfigurations to identificate ourselves at the DHL system, and fall out of the Magentoconceptual model.

39

Page 41: Magento Conceptual Schema

2.4.6 Payment Methods

n Overview

The system can operate with different payment methods.

n Schema Diagram

40

Page 42: Magento Conceptual Schema

41

Page 43: Magento Conceptual Schema

n Derivation Rules

[1] PaymentMethodInWebsite :: allowedCountry the redefinedAllowedCountry. If there’s no re-definition at the website level, it is the generic value.

Context PaymentMethodInWebsite :: allowedCountry : Set(Country)body:

if self.redefinedAllowedCountry -> notEmpty() thenself.redefinedAllowedCountry

elseself.shippingMethod.genericAllowedCountry

42

Page 44: Magento Conceptual Schema

endif

[2] PaymentMethodInWebsite :: status is the redefinedStatus. If there’s no redefinition at thewebsite level, it is the generic value.

Context PaymentMethodInWebsite :: status : Statusbody:

if self.redefinedStatus -> notEmpty() thenself.redefinedStatus

elseself.paymentMethod.genericStatus

endif

[3] PaymentMethodInWebsite :: newOrderStatus is the redefinedNewOrderStatus. If there’s noredefinition at the website level, it is the generic value.

Context PaymentMethodInWebsite :: newOrderStatus : OrderStatusbody:

if self.redefinedNewOrderStatus -> notEmpty() thenself.redefinedNewOrderStatus

elseself.paymentMethod.genericNewOrderStatus

endif

[4] PaymentMethodInWebsite :: minimumAllowed is the redefinedMinimumAllowed. If there’s noredefinition at the website level, it is the generic value.

Context PaymentMethodInWebsite :: minimumAllowed : Moneybody:

if self.redefinedMinimumAllowed -> notEmpty() thenself.redefinedMinimumAllowed

elseself.paymentMethod.genericMinimumAllowed

endif

[5] PaymentMethodInWebsite :: maximumAllowed is the redefinedMaximumAllowed. If there’sno redefinition at the website level, it is the generic value.

Context PaymentMethodInWebsite :: maximumAllowed : Moneybody:

if self.redefinedMaximumAllowed -> notEmpty() thenself.redefinedMaximumAllowed

elseself.paymentMethod.genericMaximumAllowed

endif

[6] PaymentMethodInStoreView :: title is the redefinedTitle. If there’s no redefinition at that level,it is the nearest upper redefined value.

Context PaymentMethodInStoreView :: title : Stringbody:

if self.redefinedTitle -> notEmpty() thenself.redefinedTitle

elseif self.paymentMethod.paymentMethodInWebsite -> select ( smiw | smiw.website.store.-storeView -> includes ( self.storeView ) ).redefinedTitle -> notEmpty() then

self.paymentMethod.paymentMethodInWebsite -> select ( smiw | smiw.website.store.store-View -> includes ( self.storeView ) ).redefinedTitle

elseself.paymentMethod.genericTitle

endifendif

[7] CreditCardMethodInWebsite :: allowedCard is the redefinedAllowedCard. If there’s no redefi-nition at the website level, it is the generic value.

Context CreditCardMethodInWebsite :: allowedCard : Set(CreditCardType)body:

if self.redefinedAllowedCard -> notEmpty() then

43

Page 45: Magento Conceptual Schema

self.redefinedAllowedCardelse

self.creditCardMethod.genericAllowedCardendif

[8] CreditCardMethodInWebsite :: cardValidation is the redefinedCardValidation. If there’s noredefinition at the website level, it is the generic value.

Context CreditCardMethodInWebsite :: cardValidation : Booleanbody:

if self.redefinedCardValidation -> notEmpty() thenself.redefinedCardValidation

elseself.creditCardMethod.genericCardValidation

endif

[9] CreditCardMethodInWebsite :: security3DCardValidation is the redefinedSecu-rity3DCardValidation. If there’s no redefinition at the website level, it is the generic value.

Context CreditCardMethodInWebsite :: security3DCardValidation : Booleanbody:

if self.redefinedSecurity3DCardValidation -> notEmpty() thenself.redefinedSecurity3DCardValidation

elseself.creditCardMethod.genericSecurity3DCardValidation

endif

[10] CreditCardMethodInWebsite :: invoiceAutomatically is the redefinedInvoiceAutomatically. Ifthere’s no redefinition at the website level, it is the generic value.

Context CreditCardMethodInWebsite :: invoiceAutomatically : Booleanbody:

if self.redefinedInvoiceAutomatically -> notEmpty() thenself.redefinedInvoiceAutomatically

elseself.creditCardMethod.genericInvoiceAutomatically

endif

[11] CheckMoneyInWebsite :: payeeName is the redefinedPayeeName. If there’s no redefinitionat that level, it is the nearest upper redefined value.

Context CheckMoneyInWebsite :: payeeName : Stringbody:

if self.redefinedPayeeName -> notEmpty() thenself.redefinedPayeeName

elseself.checkMoney.genericPayeeName

endif

[12] CheckMoneyInWebsite :: receiverName is the redefinedReceiverName. If there’s no redefi-nition at that level, it is the nearest upper redefined value.

Context CheckMoneyInWebsite :: receiverName : Stringbody:

if self.redefinedReceiverName -> notEmpty() thenself.redefinedReceiverName

elseself.checkMoney.genericReceiverName

endif.

[13] AuthorizeNetInWebsite :: username is the redefinedUsername. If there’s no redefinition atthe website level, it is the generic value.

Context AuthorizeNetInWebsite :: username : Stringbody:

if self.redefinedUsername -> notEmpty() thenself.redefinedUsername

44

Page 46: Magento Conceptual Schema

elseself.authorizeNet.genericUsername

endif

[14] AuthorizeNetInWebsite :: key is the redefinedKey. If there’s no redefinition at the websitelevel, it is the generic value.

Context AuthorizeNetInWebsite :: key : Stringbody:

if self.redefinedKey -> notEmpty() thenself.redefinedKey

elseself.authorizeNet.genericKey

endif

[15] AuthorizeNetInWebsite :: mode is the redefinedMode. If there’s no redefinition at the websitelevel, it is the generic value.

Context AuthorizeNetInWebsite :: mode : TransactionModebody:

if self.redefinedMode -> notEmpty() thenself.redefinedMode

elseself.authorizeNet.genericMode

endif

[16] AuthorizeNetInWebsite :: notification is the redefinedNotification. If there’s no redefinition atthe website level, it is the generic value.

Context AuthorizeNetInWebsite :: notification : Booleanbody:

if self.redefinedNotification -> notEmpty() thenself.redefinedNotification

elseself.authorizeNet.genericNotification

endif

[17] AuthorizeNetInWebsite :: gatewayURL is the redefinedGatewayURL. If there’s no redefinitionat the website level, it is the generic value.

Context AuthorizeNetInWebsite :: gatewayURL : URLbody:

if self.redefinedGatewayURL -> notEmpty() thenself.redefinedGatewayURL

elseself.authorizeNet.genericGatewayURL

endif

[18] AuthorizeNetInWebsite :: merchantEmail is the redefinedMerchantEmail. If there’s no redef-inition at the website level, it is the generic value.

Context AuthorizeNetInWebsite :: merchantEmail : Emailbody:

if self.redefinedMerchantEmail -> notEmpty() thenself.redefinedMerchantEmail

elseself.authorizeNet.genericMerchantEmail

endif

[19] AuthorizeNetInWebsite :: debugStatus is the redefinedDebugStatus. If there’s no redefinitionat the website level, it is the generic value.

Context AuthorizeNetInWebsite :: debugStatus : Statusbody:

if self.redefinedDebugStatus -> notEmpty() thenself.redefinedDebugStatus

else

45

Page 47: Magento Conceptual Schema

self.authorizeNet.genericDebugStatusendif

[20] PayFlowProInWebsite :: mode is the redefinedMode. If there’s no redefinition at the websitelevel, it is the generic value.

Context PayFlowProInWebsite :: mode : TransactionModebody:

if self.redefinedMode -> notEmpty() thenself.redefinedMode

elseself.payFlowPro.genericMode

endif

[21] PayFlowProInWebsite :: method is the redefinedMethod. If there’s no redefinition at thewebsite level, it is the generic value.

Context PayFlowProInWebsite :: method : TransactionMethodbody:

if self.redefinedMethod -> notEmpty() thenself.redefinedMethod

elseself.payFlowPro.genericMethod

endif

[22] PayFlowProInWebsite :: verboseInformation is the redefinedVerboseInformation. If there’sno redefinition at the website level, it is the generic value.

Context PayFlowProInWebsite :: verboseInformation : Booleanbody:

if self.redefinedVerboseInformation -> notEmpty() thenself.redefinedVerboseInformation

elseself.payFlowPro.genericVerboseInformation

endif

[23] PayFlowProInWebsite :: debugStatus is the redefinedDebugStatus. If there’s no redefinitionat the website level, it is the generic value.

Context PayFlowProInWebsite :: debugStatus : Statusbody:

if self.redefinedDebugStatus -> notEmpty() thenself.redefinedDebugStatus

elseself.payFlowPro.genericDebugStatus

endif

[24] PayFlowProInWebsite :: accountInfo is the redefinedAccountInfo. If there’s no redefinition atthe website level, it is the generic value.

Context PayFlowProInWebsite :: accountInfo : PayFlowProAccountbody:

if self.redefinedAccountInfo -> notEmpty() thenself.redefinedAccountInfo

elseself.payFlowPro.genericAccountInfo

endif

[25] PayFlowProInWebsite :: proxy is the redefinedProxy. If there’s no redefinition at the websitelevel, it is the generic value.

Context PayFlowProInWebsite :: proxy : Proxybody:

if self.redefinedProxy -> notEmpty() thenself.redefinedProxy

elseself.payFlowPro.genericProxy

46

Page 48: Magento Conceptual Schema

endif

[26] PayPalMethodInWebsite :: mode is the redefinedMode. If there’s no redefinition at the web-site level, it is the generic value.

Context PayPalMethodInWebsite :: mode : TransactionModebody:

if self.redefinedMode -> notEmpty() thenself.redefinedMode

elseself.payPalMethod.genericMode

endif

[27] PayPalMethodInWebsite :: accountInfo is the redefinedAccountInfo. If there’s no redefinitionat the website level, it is the generic value.

Context PayPalMethodInWebsite :: accountInfo : PayPalAccountbody:

if self.redefinedAccountInfo -> notEmpty() thenself.redefinedAccountInfo

elseself.payPalMethod.genericAccountInfo

endif

[28] PayPalMethodInWebsite :: transferCartLineItems is the redefinedTransferCartLineItems. Ifthere’s no redefinition at the website level, it is the generic value.

Context PayPalMethodInWebsite :: transferCartLineItems : Booleanbody:

if self.redefinedTransferCartLineItems -> notEmpty() thenself.redefinedTransferCartLineItems

elseself.payPalMethod.genericTransferCartLineItems

endif

[29] PayPalExpressCheckoutInWebsite :: guestCheckoutStatus is the redefinedGuestCheckout-Status. If there’s no redefinition at the website level, it is the generic value.

Context PayPalExpressCheckoutInWebsite :: guestCheckoutStatus : Statusbody:

if self.redefinedGuestCheckoutStatus -> notEmpty() thenself.redefinedGuestCheckoutStatus

elseself.payPalExpressCheckout.genericGuestCheckoutStatus

endif

[30] GoogleCheckoutInWebsite :: mode is the redefinedMode. If there’s no redefinition at thewebsite level, it is the generic value.

Context GoogleCheckoutInWebsite :: mode : TransactionModebody:

if self.redefinedMode -> notEmpty() thenself.redefinedMode

elseself.googleCheckout.genericMode

endif

[31] GoogleCheckoutInWebsite :: debugStatus is the redefinedDebugStatus. If there’s no redefi-nition at the website level, it is the generic value.

Context GoogleCheckoutInWebsite :: debugStatus : Statusbody:

if self.redefinedDebugStatus -> notEmpty() thenself.redefinedDebugStatus

elseself.googleCheckout.genericDebugStatus

endif

47

Page 49: Magento Conceptual Schema

[32] GoogleCheckoutInWebsite :: accountInfo is the redefinedAccountInfo. If there’s no redefini-tion at the website level, it is the generic value.

Context GoogleCheckoutInWebsite :: accountInfo : GoogleCheckoutAccountbody:

if self.redefinedAccountInfo -> notEmpty() thenself.redefinedAccountInfo

elseself.googleCheckout.genericAccountInfo

endif

[33] GoogleCheckoutInWebsite :: continueShoppingURL is the redefinedContinueShoppin-gURL. If there’s no redefinition at the website level, it is the generic value.

Context GoogleCheckoutInWebsite :: continueShoppingURL : URLbody:

if self.redefinedContinueShoppingURL -> notEmpty() thenself.redefinedContinueShoppingURL

elseself.googleCheckout.genericContinueShoppingURL

endif

[34] GoogleCheckoutInWebsite :: requireSecureCallback is the redefinedRequireSecureCall-back. If there’s no redefinition at the website level, it is the generic value.

Context GoogleCheckoutInWebsite :: requireSecureCallback : Booleanbody:

if self.redefinedRequireSecureCallback -> notEmpty() thenself.redefinedRequireSecureCallback

elseself.googleCheckout.genericRequireSecureCallback

endif

[35] GoogleCheckoutInWebsite :: disableDefaultTaxTables is the redefinedDisableDefaultTaxTa-bles. If there’s no redefinition at the website level, it is the generic value.

Context GoogleCheckoutInWebsite :: disableDefaultTaxTables : Booleanbody:

if self.redefinedDisableDefaultTaxTables -> notEmpty() thenself.redefinedDisableDefaultTaxTables

elseself.googleCheckout.genericDisableDefaultTaxTables

endif

n Constraints

[1] There is only one payment method for each payment method subtype, so payment methodsare identified by its subtypes.

Context PaymentMethod :: isIdentifiedByItsSubtype() : Booleanbody:

CreditCard.allInstances() -> size() = 1 andZeroSubtotalCheckout.allInstances() -> size() = 1 andCheckMoney.allInstances() -> size() = 1 andPurchaseOrder.allInstances() -> size() = 1 andAuthorizeNet.allInstances() -> size() = 1 andPayFlowPro.allInstances() -> size() = 1 andPayPalExpressCheckout.allInstances() -> size() = 1 andPayPalDirectPayment.allInstances() -> size() = 1 andPayPalStandard.allInstances() -> size() = 1 andGoogleCheckout.allInstances() -> size() = 1

[2] For a given store view, each payment method has a unique title.

48

Page 50: Magento Conceptual Schema

Context StoreView :: doesNotHaveTwoPaymentMethodsWithTheSameRedefinedName() : Booleanbody: self.paymentMethodInStoreView -> isUnique (title)

[3] Each payment method should be specified in all existing store views in the system.

Context PaymentMethod :: isSpecifiedInAllStoreViews() : Booleanbody: PaymentMethod.storeView -> includesAll( StoreView.allInstances() )

[4] Each payment method should be specified in all existing websites in the system.

Context PaymentMethod :: isSpecifiedInAllWebsites() : Booleanbody: PaymentMethod.website -> includesAll( Website.allInstances() )

[5] Each credit card method should be specified in all existing websites in the system.

Context CreditCardMethod :: isSpecifiedInAllWebsites() : Booleanbody: CreditCardMethod.website -> includesAll( Website.allInstances() )

[6] The simple credit card method should be specified in all existing websites in the system.

Context CreditCard :: isSpecifiedInAllWebsites() : Booleanbody: CreditCard.website -> includesAll( Website.allInstances() )

[7] The zero subtotal checkout method should be specified in all existing websites in the system.

Context ZeroSubtotalCheckout :: isSpecifiedInAllWebsites() : Booleanbody: ZeroSubtotalCheckout.website -> includesAll( Website.allInstances() )

[8] The check money method should be specified in all existing websites in the system.

Context CheckMoney :: isSpecifiedInAllWebsites() : Booleanbody: CheckMoney.website -> includesAll( Website.allInstances() )

[9] The purchase order method should be specified in all existing websites in the system.

Context PurchaseOrder :: isSpecifiedInAllWebsites() : Booleanbody: PurchaseOrder.website -> includesAll( Website.allInstances() )

[10] The Authorize.Net method should be specified in all existing websites in the system.

Context AuthorizeNet :: isSpecifiedInAllWebsites() : Booleanbody: AuthorizeNet.website -> includesAll( Website.allInstances() )

[11] The Pay Flow Pro method should be specified in all existing websites in the system.

Context PayFlowPro :: isSpecifiedInAllWebsites() : Booleanbody: PayFlowPro.website -> includesAll( Website.allInstances() )

[12] Each Pay Pal method should be specified in all existing websites in the system.

Context PayPalMethod :: isSpecifiedInAllWebsites() : Booleanbody: PayPalMethod.website -> includesAll( Website.allInstances() )

[13] The Pay Pal Express Checkout method should be specified in all existing websites in thesystem.

49

Page 51: Magento Conceptual Schema

Context PayPalExpressCheckout :: isSpecifiedInAllWebsites() : Booleanbody: PayPalExpressCheckout.website -> includesAll( Website.allInstances() )

[14] The Pay Pal Direct Payment method should be specified in all existing websites in the system.

Context PayPalDirectPayment :: isSpecifiedInAllWebsites() : Booleanbody: PayPalDirectPayment.website -> includesAll( Website.allInstances() )

[15] The Pay Pal Standard method should be specified in all existing websites in the system.

Context PayPalStandard :: isSpecifiedInAllWebsites() : Booleanbody: PayPalStandard.website -> includesAll( Website.allInstances() )

[16] The Google Checkout method should specified in all existing websites in the system.

Context GoogleCheckout :: isSpecifiedInAllWebsites() : Booleanbody: GoogleCheckout.website -> includesAll( Website.allInstances() )

[17] There is at least one enabled payment method

Context PaymentMethod :: hasOneInstanceEnabledAtLeast() : Booleanbody: PaymentMethod.allInstances() -> select (pm | pm.status=Status::Enabled) -> size() >= 1

[18] The PayPal and Google Checkout methods can not define a minimum and maximum orderamount allowed

Context PaymentMethodInWebsite :: definesMinAndMaxAllowedOnlyWhenNeeded() : Booleanbody:

( self.oclIsTypeOf( PayPalMethodInWebsite ) or self.oclIsTypeOf( GoogleCheckoutInWebsite ) )implies

( self.minimumAllowed.isUndefined() and self.maximumAllowed.isUndefined() )

[19] The zero subtotal chekout method defines the minimum and maximum order amount allowedas zero.

Context ZeroSubtotalCheckoutInWebsite :: isOnlyAvailableWithFreeOrders() : Booleanbody:self.minimumAllowed = 0 and self.maximumAllowed = 0

[20] Google checkout can only be applied at the United Kingdom and the United States.

Context GoogleCheckout :: isOnlyAvailableInUKAndUS() : Booleanbody:self.allowedCountry -> forAll ( c | c.name = ’United Kingdom’ or c.name = ’United States’)

n DescriptionThe system allows customers to pay through different payment methods, which can be

enabled or disabled and configured by the store administrator.

Some of the payment methods, like Authorize.net, PayFlow, PayPal or GoogleCheckout,involve an external company. The Credit Card, ZeroSubtotalCheckout and PurchaseOrdermethods simply store information for off-line processing.

There is also a method available for money order and check payments which do not involvean external merchant.

For all shipping methods, some properties should be defined:

• status: defines if the method is available or not for customers.

50

Page 52: Magento Conceptual Schema

• title: the name the users will see for this method.

• allowedCountry: only the Orders shipped to this countries will be able tu use thecurrent shipping method.

• newOrderStatus: the Order Status of all new Orders created using this paymentmethod.

For methods using a credit card, we should define which card types are allowed, and if asecurity validation is needed.

Some payment methods have specific or partially shared properties rellevant to the systembehaviour:

• minimumTotalAllowed: if the value is defined, the payment method will only be listedfor those orders whose total is above the minimum.

• maximumTotalAllowed: if the value is defined, the payment method will only be listedfor those orders whose total is below the maximum.

• invoiceAutomatically: if true, the system will automatically invoice the whole order.

All the payment methods have other specific information about all the data needed toprocess the payment. It has no effect on the Magento system.

51

Page 53: Magento Conceptual Schema

2.4.7 Taxes

n OverviewIn order to supply a flexible use of taxes, product prices are stored tax free. The final priceis calculated taking into account the customer tax class, the adress the products will beshipped and the product’s tax class.

n Schema Diagram

n Derivation Rules

[1] TaxRateInStoreView :: name is the redefinedName. If there’s no redefinition at the store viewlevel, it is the generic value.

Context TaxRateInStoreView :: name : Stringbody:

52

Page 54: Magento Conceptual Schema

if self.redefinedName -> notEmpty() thenself.redefinedName

elseself.taxRate.genericName

endif

[2] TaxRate :: applicableAdress are the municipalities where the tax rate can be applied.

Context TaxRate :: applicableAdress : Set(Adress)body:

if self.explicitPostalArea -> notEmpty() then self.explicitPostalArea.address -> asSet()else

if self.explicitZone -> notEmpty() then self.explicitZone.adress -> union(self.explicitZone.mu-nicipality.address) -> asSet()

else self.explicitCountry.address -> union(self.explicitCountry.municipality.address) -> asSet()endifendif

n Constraints

[1] Tax rates are identified by its generic name.

Context TaxRate :: isIdentifiedByGenericName() : Booleanbody: TaxRate.allInstances() -> isUnique(genericName)

[2] Tax rules are identified by its name.

Context TaxRule :: isIdentifiedByName() : Booleanbody: TaxRule.allInstances() -> isUnique(name)

[3] Customer Tax Classes are identified by its name.

Context CustomerTaxClass :: isIdentifiedByName() : Booleanbody: CustomerTaxClass.allInstances() -> isUnique(name)

[4] Product Tax Classes are identified by its name.

Context ProductTaxClass :: isIdentifiedByName() : Booleanbody: ProductTaxClass.allInstances() -> isUnique(name)

[5] .

Context TaxRate :: hasZoneAndMunicipalitiesFromTheExplicitCountry() : Booleanbody:

self.explicitCountry.zone -> includes(self.explicitZone) andself.explicitCountry.zone.municipality.postalArea -> includesAll(self.explicitPostalArea)

[6] If the a taxRate is associated to a Country that has zones and a Zone, the zone should be fromthis country.

Context TaxRate :: haveACorrectZoneIfNeeded() : Booleanbody: ( self.explicitCountry.zone -> notEmpty() and self.explicitZone -> notEmpty() )implies self.-explicitCountry = self.explicitZone.country

[7] A tax rate should be located in either a country, a zone or a municipality, or some of them.

Context TaxRate :: isLocated() : Booleanbody: self.explicitCountry -> notEmpty() or self.explicitZone -> notEmpty() or self.explicitPostalArea-> notEmpty()

53

Page 55: Magento Conceptual Schema

n Description

Magento allows Administrators to set up different types of taxes and relate them to thezones where they can be applied.

Tax Classes group products or customers that will be treated in the same way when de-ciding which taxes should be applied. Customer Tax Classes group Customers throughtCustomer Groups, and Product Tax Classes group Products.

A Tax Rate define the rate that can be applied as a tax. It also defines where the taxcan be applied, by defining a Country, a Zone and/or several Postal Areas. The tax will beapplied to Orders which rateApplicationAdress is one of the applicableAdress. Those arecalculated when the order is placed, taking the adresses that belong to one of the explicitpostal areas defined. If no one is defined, the tax will be able to be applicated to all Ordersbelonging to the defined Zone, or the whole Country if no Zone is defined.

A Tax Rate can be displayed with a different name in each StoreView. This name will bedefined as the title attribute of the TaxTitle entity type. If no title is defined for one StoreView,the tax rate identifier will be used instead. There’s no integrity constraint related to tax title’sidentification, as a TaxTitle can be identified by its StoreView and TaxRate, the identificableentities that participate in the relationship type that TaxTitle represents.

Finally, a Tax Rule defines when a tax Rate will be able to be applied, but now dependingon the Customer and Product Tax Classes. A tax rule is associated to three non-empty setsof Customer Tax Classes, Product Tax Classes and Tax Rates. When one rule is applied toan Order Line, it will check if the product ordered and the order’s customer are included inone of its respective tax classes. If true, the tax rates associated to this rule will be able tobe applicated, depending on the municipality where the Order is shipped.

Moreover, Tax Rules are ordered by priorities, and these priorities can be repeated be-tween rules. When deciding which taxes we should apply to an Order Line, only the ruleswith the higher priority number will be taken into account. If there are more than one, all ofthem will be applied.

54

Page 56: Magento Conceptual Schema

2.5 Customers

2.5.1 Customers

n Overview

Magento saves information about system users, which can be either Costumers or Admin-istrators. Magento groupes customers in CostumerGroups.

n Schema Diagram

55

Page 57: Magento Conceptual Schema

n Derivation Rules

[1] Website :: visibleCustomer are the costumers that can place orders, review and tag prod-ucts, use shopping cards, etc. in this website. Depending on the "shareAccountScope", costumeraccounts are visible throught all the websites or just in the website where they where created.

Context Website :: visibleCustomer : Set(Customer)body:

if CustomerConfiguration.shareAccountScope = Scope::Global thenCustomer.allInstances()

elseself.customer

endif

n Constraints

[1] Each customer from the same Website has a different eMail, but if the account visibility is setto Website, it can be repeated through different Websites.

Context Customer :: isIdentifiedByItsEmailAndTheWebsitesWhereIsVisible() : Booleanbody: Customer.allInstances() -> isUnique(SeteMail,websiteWhereIsVisible)

[2] Each administrator is identified by its user name.

Context Administrator :: isIdentifiedByItsUserName() : Booleanbody: Administrator.allInstances() -> isUnique(userName)

[3] Each administrator is identified by its eMail.

Context Administrator :: isIdentifiedByItsEmail() : Booleanbody: Administrator.allInstances() -> isUnique(eMail)

[4] Each role is identified by its name.

Context Role :: isIdentifiedByItsName() : Booleanbody: Role.allInstances() -> isUnique(name)

[5] The customer is created in a store view that belongs to the website where it was created.

Context Customer :: isCreatedInACorrectStoreView() : Booleanbody: self.websiteWhereIsAssociated.store.storeView -> includes (self.storeViewWhereIsCreated)

[6] At least an instance of customer group called ’NotLoggedIn’ exists in the system.

Context CustomerGroup :: hasTheNotLoggedInInstance() : Booleanbody: CustomerGroup.allInstances() -> exists(g|g.name = ’NotLoggedIn’)

[7] At least an instance of customer group called ’General’ exists in the system.

Context CustomerGroup :: hasTheGeneralInstance() : Booleanbody: CustomerGroup.allInstances() -> exists(g|g.name = ’General’)

n Description

Magento has the following information about Users, even if they are Costumers or Admin-istrators:

56

Page 58: Magento Conceptual Schema

• firstName: The first name of the user.

• lastName: The last name of the user.

• password: The password used by a user to be identified when logging in the system.

• eMail: The user’s email. There are neither two Costumers nor two Administrators withthe same email, but we can have a Customer and an Administrator with the sameemail. This email is used for identifying costumers when they log in.

Just for Administrators, Magento has the following information:

• userName: An small nickname the administrator will use to identificate himself whenlogging in the system.

• status: Indicates whether the administrator is allowed to access to the admin paneland use it. By this way, an administrator can be disabled without deleting his informa-tion.

Each administrator should be associated to a Role. The role will determine the adminfunctionalities he will be able to use.

For each Costumer, the system saves (or can optionally save) other personal and systeminformation:

• namePrefix

• middleName

• nameSuffix

• dateOfBirth

• taxVatNumber: an identifier used for taxation purposes.

• createdAt: the time the costumer was created.

• lastLoggedIn: the last time the customer logged in the system.

• accountConfirmed: indicates whether the system has checked that the customer hasentered an existing e-mail.

Costumers are associated to a website. If the user has been created from the front-end,the store view where the registration process have been done is saved.

Additonaly, Customers can have many adresses associated. When purchasing a product,the user will choose which of his adresses are used as delivery and billing adresses. Theuser can previously define what adresses would be used by default, those are the default-Billing and defaultDelivery addresses.

Address’ first, middle and last name, name prefix and name suffix may not have the samevalues in the customer where the address is associated. A customer can specify the storeto ship or bill its products to an address where his name doesn’t appear, for example as agift to a friend.

Magento makes you associate each customer to a CustomerGroup. The aim of this Cus-tomer group is to apply some Magento’s features to groups of costumers all at once. Aname is defined for each group and identifies it.

57

Page 59: Magento Conceptual Schema

2.5.2 Sessions

n Overview

Each active access to the system is a session. Sessions can be anonymous or can beassociated to a registered customer.

n Schema Diagram

n Derivation Rules

[1] Session :: customerGroup for customer sessions, the customer group of the correspondingcustomer. For anonymous session, the group named ’NotLoggedIn’.

Context Session :: customerGroup : CustomerGroupbody:

if self.oclIsTypeOf(CustomerSession) thenself.oclAsType(CustomerSession).customer.customerGroup

elseCustomerGroup.allInstances() -> any ( c | c.name = ’NotLoggedIn’ )

endif

[2] Customer :: online indicates whether the costumer is currently using the system. That’s, thecustomer has an active session

Context Customer :: online : Booleanbody: self.customerSession -> notEmpty()

58

Page 60: Magento Conceptual Schema

n Constraints

[1] Each anonymous session is identified by its IP address.

Context AnonymousSession :: isIdentifiedByItsIPAddress() : Booleanbody: AnonymousSession.allInstances() -> isUnique(ipAddress)

[2] Each customer session is identified by its associated customer.

Context CustomerSession :: isIdentifiedByItsCostumer() : Booleanbody: CustomerSession.allInstances() -> isUnique(customer)

[3] the current currency should be one of the allowed currencies the session is currently using.

Context Session :: displaysAnAllowedCurrency() : Booleanbody: self.storeView.currencyConfigurationInStoreView.allowedCurrency -> includes(self.currentCur-rency)

[4] the session’s store view should be enabled.

Context Session :: isPlacedInAnEnabledStoreView() : Booleanbody: self.storeView.status = Status::Enabled

n Description

A session maintains information about everyone which is now using the system. Thereis one CustomerSession for each registered customer logged in the system. There is oneAnonymousSession for each person who is currently in the system without being loggedin. We will refer to them as Guests. Moreover, there are not Sessions representing anAdministrator using now the system.

A session saves the following information.

• ipAddress: The IP adress from which a costumer is accessing the site.

• sessionStartTime: The time this session has begun.

• lastActivityAt: The time the most recent activity in the site has been done.

• currentCurrency: the currency selected by the costumer to see the prices and mon-etary amounts in the site.

• storeView: the storeView the customer is currently using.

59

Page 61: Magento Conceptual Schema

2.6 Store Administration

2.6.1 Products

n Overview

The system knows the information about the products of the online store.

n Schema Diagram

60

Page 62: Magento Conceptual Schema

61

Page 63: Magento Conceptual Schema

n Derivation Rules

[1] ProductInStoreView :: name is the redefinedName at the current base scope level (the basescope level is defined by the nameScope property, in product properties scope configuration). Ifthere’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() and ProductPropertiesScopeConfiguration.nameScope=Scope::StoreView then

self.redefinedName

62

Page 64: Magento Conceptual Schema

else if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (self.storeView ) ).redefinedName -> notEmpty() and

ProductPropertiesScopeConfiguration.nameScope!= Scope::Global thenself.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-

storeView ) ).redefinedNameelse

self.product.genericNameendif

[2] ProductInWebsite :: netPrice is the redefinedNetPrice. If there’s no redefinition at that level, itis the nearest upper redefined value.

Context ProductInWebsite :: netPrice : Moneybody:

if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedNetPrice -> notEmpty() then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedNetPrice

elseself.product.genericNetPrice

endif

[3] ProductInStoreView :: weight is the redefinedWeight at the current base scope level (the basescope level is defined by the weightScope property, in product properties scope configuration). Ifthere’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: weight : Decimalbody:

if self.redefinedWeight -> notEmpty() and ProductPropertiesScopeConfiguration.weightScope=Scope::StoreView then

self.redefinedWeightelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedWeight -> notEmpty() andProductPropertiesScopeConfiguration.weightScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedWeight

elseself.product.genericWeight

endif

[4] ProductInStoreView :: status is the redefinedStatus at the current base scope level (the basescope level is defined by the statusScope property, in product properties scope configuration). Ifthere’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: status : Statusbody:

if self.redefinedStatus -> notEmpty() and ProductPropertiesScopeConfiguration.statusScope=Scope::StoreView then

self.redefinedStatuselse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedStatus -> notEmpty() andProductPropertiesScopeConfiguration.statusScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedStatus

elseself.product.genericStatus

endif

[5] ProductInStoreView :: isNewFrom is the redefinedIsNewFrom at the current base scope level(the base scope level is defined by the isNewFromScope property, in product properties scope con-figuration). If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: isNewFrom : Datebody:

if self.redefinedIsNewFrom -> notEmpty() and ProductPropertiesScopeConfiguration.isNewFrom-Scope= Scope::StoreView then

self.redefinedIsNewFrom

63

Page 65: Magento Conceptual Schema

else if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (self.storeView ) ).redefinedIsNewFrom -> notEmpty() and

ProductPropertiesScopeConfiguration.isNewFromScope!= Scope::Global thenself.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-

storeView ) ).redefinedIsNewFromelse

self.product.genericIsNewFromendif

[6] ProductInStoreView :: isNewUntil is the redefinedIsNewUntil at the current base scope level(the base scope level is defined by the isNewUntilScope property, in product properties scope con-figuration). If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: isNewUntil : Datebody:

if self.redefinedIsNewUntil -> notEmpty() and ProductPropertiesScopeConfiguration.isNewUn-tilScope= Scope::StoreView then

self.redefinedIsNewUntilelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedIsNewUntil -> notEmpty() andProductPropertiesScopeConfiguration.isNewUntilScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedIsNewUntil

elseself.product.genericIsNewUntil

endif

[7] ProductInWebsite :: specialNetPrice is the redefinedSpecialNetPrice. If there’s no redefinitionat that level, it is the nearest upper redefined value.

Context ProductInWebsite :: specialNetPrice : Moneybody:

if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedSpecialNetPrice -> notEmpty() then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedSpecialNetPrice

elseself.product.genericSpecialNetPrice

endif

[8] ProductInStoreView :: specialNetPriceFrom is the redefinedSpecialNetPriceFrom at the cur-rent base scope level (the base scope level is defined by the specialNetPriceFromScope property, inproduct properties scope configuration). If there’s no redefinition at that level, it is the nearest upperredefined value.

Context ProductInStoreView :: specialNetPriceFrom : Datebody:

if self.redefinedSpecialNetPriceFrom -> notEmpty() and ProductPropertiesScopeConfiguration.-specialNetPriceFromScope= Scope::StoreView then

self.redefinedSpecialNetPriceFromelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedSpecialNetPriceFrom -> notEmpty() andProductPropertiesScopeConfiguration.specialNetPriceFromScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedSpecialNetPriceFrom

elseself.product.genericSpecialNetPriceFrom

endif

[9] ProductInStoreView :: specialNetPriceUntil is the redefinedSpecialNetPriceUntil at the currentbase scope level (the base scope level is defined by the specialNetPriceUntilScope property, inproduct properties scope configuration). If there’s no redefinition at that level, it is the nearest upperredefined value.

Context ProductInStoreView :: specialNetPriceUntil : Datebody:

64

Page 66: Magento Conceptual Schema

if self.redefinedSpecialNetPriceUntil -> notEmpty() and ProductPropertiesScopeConfiguration.-specialNetPriceUntilScope= Scope::StoreView then

self.redefinedSpecialNetPriceUntilelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedSpecialNetPriceUntil -> notEmpty() andProductPropertiesScopeConfiguration.specialNetPriceUntilScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedSpecialNetPriceUntil

elseself.product.genericSpecialNetPriceUntil

endif

[10] ProductInStoreView :: description is the redefinedDescription at the current base scope level(the base scope level is defined by the descriptionScope property, in product properties scope con-figuration). If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: description : Stringbody:

if self.redefinedDescription -> notEmpty() and ProductPropertiesScopeConfiguration.descrip-tionScope= Scope::StoreView then

self.redefinedDescriptionelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedDescription -> notEmpty() andProductPropertiesScopeConfiguration.descriptionScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedDescription

elseself.product.genericDescription

endif

[11] ProductInStoreView :: shortDescription is the redefinedShortDescription at the current basescope level (the base scope level is defined by the shortDescriptionScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: shortDescription : Stringbody:

if self.redefinedShortDescription -> notEmpty() and ProductPropertiesScopeConfiguration.short-DescriptionScope= Scope::StoreView then

self.redefinedShortDescriptionelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedShortDescription -> notEmpty() andProductPropertiesScopeConfiguration.shortDescriptionScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedShortDescription

elseself.product.genericShortDescription

endif

[12] ProductInStoreView :: metaDescription is the redefinedMetaDescription at the current basescope level (the base scope level is defined by the metaDescriptionScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: metaDescription : Stringbody:

if self.redefinedMetaDescription -> notEmpty() and ProductPropertiesScopeConfiguration.metaDe-scriptionScope= Scope::StoreView then

self.redefinedMetaDescriptionelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedMetaDescription -> notEmpty() andProductPropertiesScopeConfiguration.metaDescriptionScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedMetaDescription

elseself.product.genericMetaDescription

65

Page 67: Magento Conceptual Schema

endif

[13] ProductInStoreView :: metaKeyword is the redefinedMetaKeyword at the current base scopelevel (the base scope level is defined by the metaKeywordScope property, in product propertiesscope configuration). If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: metaKeyword : Stringbody:

if self.redefinedMetaKeyword -> notEmpty() and ProductPropertiesScopeConfiguration.metaKey-wordScope= Scope::StoreView then

self.redefinedMetaKeywordelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedMetaKeyword -> notEmpty() andProductPropertiesScopeConfiguration.metaKeywordScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedMetaKeyword

elseself.product.genericMetaKeyword

endif

[14] ProductInStoreView :: metaTitle is the redefinedMetaTitle at the current base scope level(the base scope level is defined by the metaTitleScope property, in product properties scope config-uration). If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: metaTitle : Stringbody:

if self.redefinedMetaTitle -> notEmpty() and ProductPropertiesScopeConfiguration.metaTitle-Scope= Scope::StoreView then

self.redefinedMetaTitleelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedMetaTitle -> notEmpty() andProductPropertiesScopeConfiguration.metaTitleScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedMetaTitle

elseself.product.genericMetaTitle

endif

[15] ProductInStoreView :: imageGalleryPath is the redefinedImageGalleryPath at the currentbase scope level (the base scope level is defined by the imageGalleryPathScope property, in productproperties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: imageGalleryPath : Stringbody:

if self.redefinedImageGalleryPath -> notEmpty() and ProductPropertiesScopeConfiguration.im-ageGalleryPathScope= Scope::StoreView then

self.redefinedImageGalleryPathelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedImageGalleryPath -> notEmpty() andProductPropertiesScopeConfiguration.imageGalleryPathScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedImageGalleryPath

elseself.product.genericImageGalleryPath

endif

[16] ProductInStoreView :: baseImagePath is the redefinedBaseImagePath at the current basescope level (the base scope level is defined by the baseImagePathScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: baseImagePath : Stringbody:

if self.redefinedBaseImagePath -> notEmpty() and ProductPropertiesScopeConfiguration.ba-seImagePathScope= Scope::StoreView then

66

Page 68: Magento Conceptual Schema

self.redefinedBaseImagePathelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedBaseImagePath -> notEmpty() andProductPropertiesScopeConfiguration.baseImagePathScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedBaseImagePath

elseself.product.genericBaseImagePath

endif

[17] ProductInStoreView :: smallImagePath is the redefinedSmallImagePath at the current basescope level (the base scope level is defined by the smallImagePathScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: smallImagePath : Stringbody:

if self.redefinedSmallImagePath -> notEmpty() and ProductPropertiesScopeConfiguration.small-ImagePathScope= Scope::StoreView then

self.redefinedSmallImagePathelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedSmallImagePath -> notEmpty() andProductPropertiesScopeConfiguration.smallImagePathScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedSmallImagePath

elseself.product.genericSmallImagePath

endif

[18] ProductInStoreView :: thumbnailPath is the redefinedThumbnailPath at the current basescope level (the base scope level is defined by the thumbnailPathScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: thumbnailPath : Stringbody:

if self.redefinedThumbnailPath -> notEmpty() and ProductPropertiesScopeConfiguration.thumb-nailPathScope= Scope::StoreView then

self.redefinedThumbnailPathelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedThumbnailPath -> notEmpty() andProductPropertiesScopeConfiguration.thumbnailPathScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedThumbnailPath

elseself.product.genericThumbnailPath

endif

[19] ProductInStoreView :: urlKey is the redefinedUrlKey at the current base scope level (thebase scope level is defined by the urlKeyScope property, in product properties scope configuration).-If there’s no redefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: urlKey : Stringbody:

if self.redefinedUrlKey -> notEmpty() and ProductPropertiesScopeConfiguration.urlKeyScope=Scope::StoreView then

self.redefinedUrlKeyelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedUrlKey -> notEmpty() andProductPropertiesScopeConfiguration.urlKeyScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedUrlKey

elseself.product.genericUrlKey

endif

67

Page 69: Magento Conceptual Schema

[20] ProductInStoreView :: isAvailableForGoogleCheckout is the redefinedIsAvailableFor-GoogleCheckout at the current base scope level (the base scope level is defined by the isAvail-ableForGoogleCheckoutScope property, in product properties scope configuration). If there’s noredefinition at that level, it is the nearest upper redefined value.

Context ProductInStoreView :: isAvailableForGoogleCheckout : Booleanbody:

if self.redefinedIsAvailableForGoogleCheckout -> notEmpty() and ProductPropertiesScopeCon-figuration.isAvailableForGoogleCheckoutScope= Scope::StoreView then

self.redefinedIsAvailableForGoogleCheckoutelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedIsAvailableForGoogleCheckout -> notEmpty() andProductPropertiesScopeConfiguration.isAvailableForGoogleCheckoutScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedIsAvailableForGoogleCheckout

elseself.product.genericIsAvailableForGoogleCheckout

endif

[21] ProductInStoreView :: giftMessageAllowed is the redefinedGiftMessageAllowed at the cur-rent base scope level (the base scope level is defined by the giftMessageAllowedScope property, inproduct properties scope configuration). If there’s no redefinition at that level, it is the nearest upperredefined value.

Context ProductInStoreView :: giftMessageAllowed : Booleanbody:

if self.redefinedGiftMessageAllowed -> notEmpty() and ProductPropertiesScopeConfiguration.-giftMessageAllowedScope= Scope::StoreView then

self.redefinedGiftMessageAllowedelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedGiftMessageAllowed -> notEmpty() andProductPropertiesScopeConfiguration.giftMessageAllowedScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedGiftMessageAllowed

elseself.product.genericGiftMessageAllowed

endif

[22] ProductInStoreView :: visibleOnCatalog is the redefinedVisibleOnCatalog at the currentbase scope level (the base scope level is defined by the visibleOnCatalogScope property, in prod-uct properties scope configuration). If there’s no redefinition at that level, it is the nearest upperredefined value.

Context ProductInStoreView :: visibleOnCatalog : Booleanbody:

if self.redefinedVisibleOnCatalog -> notEmpty() and ProductPropertiesScopeConfiguration.visi-bleOnCatalogScope= Scope::StoreView then

self.redefinedVisibleOnCatalogelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedVisibleOnCatalog -> notEmpty() andProductPropertiesScopeConfiguration.visibleOnCatalogScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedVisibleOnCatalog

elseself.product.genericVisibleOnCatalog

endif

[23] ProductInStoreView :: visibleOnSearch is the redefinedVisibleOnSearch at the current basescope level (the base scope level is defined by the visibleOnSearchScope property, in product prop-erties scope configuration). If there’s no redefinition at that level, it is the nearest upper redefinedvalue.

Context ProductInStoreView :: visibleOnSearch : Booleanbody:

if self.redefinedVisibleOnSearch -> notEmpty() and ProductPropertiesScopeConfiguration.visi-bleOnSearchScope= Scope::StoreView then

68

Page 70: Magento Conceptual Schema

self.redefinedVisibleOnSearchelse if self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes (

self.storeView ) ).redefinedVisibleOnSearch -> notEmpty() andProductPropertiesScopeConfiguration.visibleOnSearchScope!= Scope::Global then

self.product.productInWebsite -> select ( piw | piw.website.store.storeView -> includes ( self.-storeView ) ).redefinedVisibleOnSearch

elseself.product.genericVisibleOnSearch

endif

n Constraints

[1] A product is identified by its sku.

Context Product :: isIdentifiedBySku() : Booleanbody: Product.allInstances() -> isUnique(sku)

[2] Each product should be related to all existing store views in the system.

Context Product :: isSpecifiedInAllStoreViews() : Booleanbody: Product.storeView -> includesAll( StoreView.allInstances() )

[3] Each product should be related to all existing websites in the system.

Context Product :: isSpecifiedInAllWebsites() : Booleanbody: Product.website -> includesAll( Website.allInstances() )

[4] The netPrice property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInWebsite :: netPriceIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.de-scriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.netPrice.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.netPrice.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.netPrice.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.netPrice.isUndefined() and (not (associat-edTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.netPrice.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.netPrice.isUndefined()

[5] The weight property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInStoreView :: weightIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.weight.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.weight.isUndefined() and (not (associat-edTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.weight.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.weight.isUndefined() and (not (associat-edTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.weight.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.weight.isUndefined()

69

Page 71: Magento Conceptual Schema

[6] If Product Properties Obligatoriness Configuration sets that isNewFrom is mandatory, eachproduct should have a isNewFrom defined.

Context ProductInStoreView :: isNewFromIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.isNewFromIsMandatory impliesnot(self.isNewFrom.-isUndefined())

[7] The isNewFrom property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInStoreView :: isNewFromIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.isNewFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.isNewFrom.isUndefined() and (not (as-sociatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.isNewFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.isNewFrom.isUndefined() and (not (asso-ciatedTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.isNewFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.isNewFrom.isUndefined()

[8] If Product Properties Obligatoriness Configuration sets that isNewUntil is mandatory, eachproduct should have a isNewUntil defined.

Context ProductInStoreView :: isNewUntilIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.isNewUntilIsMandatory impliesnot(self.isNewUn-til.isUndefined())

[9] The isNewUntil property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInStoreView :: isNewUntilIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.isNewUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.isNewUntil.isUndefined() and (not (as-sociatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.isNewUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.isNewUntil.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.isNewUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.isNewUntil.isUndefined()

[10] If Product Properties Obligatoriness Configuration sets that specialNetPrice is mandatory,each product should have a specialNetPrice defined.

Context ProductInWebsite :: specialNetPriceIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.specialNetPriceIsMandatory impliesnot(self.-specialNetPrice.isUndefined())

[11] The specialNetPrice property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

Context ProductInWebsite :: specialNetPriceIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

70

Page 72: Magento Conceptual Schema

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.specialNetPrice.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.specialNetPrice.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.specialNetPrice.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.specialNetPrice.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.specialNet-Price.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.-product.oclIsTypeOf(BundleProduct)) implies self.specialNetPrice.isUndefined()

[12] If Product Properties Obligatoriness Configuration sets that specialNetPriceFrom is manda-tory, each product should have a specialNetPriceFrom defined.

Context ProductInStoreView :: specialNetPriceFromIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.specialNetPriceFromIsMandatory impliesnot(self.-specialNetPriceFrom.isUndefined())

[13] The specialNetPriceFrom property is defined only in products that are from one of the typesspecified in Product Properties Type Association Configuration.

Context ProductInStoreView :: specialNetPriceFromIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.specialNetPriceFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Pro-ductType::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.specialNetPrice-From.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) andself.product.oclIsTypeOf(ConfigurableProduct)) implies self.specialNetPriceFrom.isUndefined() and(not (associatedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.specialNetPriceFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Pro-ductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.special-NetPriceFrom.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) andself.product.oclIsTypeOf(BundleProduct)) implies self.specialNetPriceFrom.isUndefined()

[14] If Product Properties Obligatoriness Configuration sets that specialNetPriceUntil is manda-tory, each product should have a specialNetPriceUntil defined.

Context ProductInStoreView :: specialNetPriceUntilIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.specialNetPriceUntilIsMandatory impliesnot(self.-specialNetPriceUntil.isUndefined())

[15] The specialNetPriceUntil property is defined only in products that are from one of the typesspecified in Product Properties Type Association Configuration.

Context ProductInStoreView :: specialNetPriceUntilIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.specialNetPriceUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.specialNetPriceUntil.-isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.-product.oclIsTypeOf(ConfigurableProduct)) implies self.specialNetPriceUntil.isUndefined() and (not(associatedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.specialNetPriceUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.specialNet-PriceUntil.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) andself.product.oclIsTypeOf(BundleProduct)) implies self.specialNetPriceUntil.isUndefined()

71

Page 73: Magento Conceptual Schema

[16] If Product Properties Obligatoriness Configuration sets that description is mandatory, eachproduct should have a description defined.

Context ProductInStoreView :: descriptionIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.descriptionIsMandatory impliesnot(self.descrip-tion.isUndefined())

[17] The description property is defined only in products that are from one of the types specifiedin Product Properties Type Association Configuration.

Context ProductInStoreView :: descriptionIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.description.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.description.isUndefined() and (not (as-sociatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.description.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.description.isUndefined() and (not (asso-ciatedTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.description.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.description.isUndefined()

[18] If Product Properties Obligatoriness Configuration sets that shortDescription is mandatory,each product should have a shortDescription defined.

Context ProductInStoreView :: shortDescriptionIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.shortDescriptionIsMandatory impliesnot(self.-shortDescription.isUndefined())

[19] The shortDescription property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

Context ProductInStoreView :: shortDescriptionIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.shortDescription.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.shortDescription.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.shortDescription.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.shortDescription.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.shortDescrip-tion.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.prod-uct.oclIsTypeOf(BundleProduct)) implies self.shortDescription.isUndefined()

[20] If Product Properties Obligatoriness Configuration sets that metaDescription is mandatory,each product should have a metaDescription defined.

Context ProductInStoreView :: metaDescriptionIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.metaDescriptionIsMandatory impliesnot(self.-metaDescription.isUndefined())

[21] The metaDescription property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

Context ProductInStoreView :: metaDescriptionIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

72

Page 74: Magento Conceptual Schema

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.metaDescription.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.metaDescription.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.metaDescription.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.metaDescription.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.metaDescrip-tion.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.prod-uct.oclIsTypeOf(BundleProduct)) implies self.metaDescription.isUndefined()

[22] If Product Properties Obligatoriness Configuration sets that metaKeyword is mandatory, eachproduct should have a metaKeyword defined.

Context ProductInStoreView :: metaKeywordIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.metaKeywordIsMandatory impliesnot(self.-metaKeyword.isUndefined())

[23] The metaKeyword property is defined only in products that are from one of the types specifiedin Product Properties Type Association Configuration.

Context ProductInStoreView :: metaKeywordIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.metaKeyword.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.metaKeyword.isUnde-fined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.metaKeyword.isUndefined() and (not (associat-edTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct)) im-plies self.metaKeyword.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Downloadable))and self.product.oclIsTypeOf(DownloadableProduct)) implies self.metaKeyword.isUndefined() and (not(associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.product.oclIsTypeOf(BundleProduct))implies self.metaKeyword.isUndefined()

[24] If Product Properties Obligatoriness Configuration sets that metaTitle is mandatory, eachproduct should have a metaTitle defined.

Context ProductInStoreView :: metaTitleIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.metaTitleIsMandatory impliesnot(self.metaTi-tle.isUndefined())

[25] The metaTitle property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInStoreView :: metaTitleIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.metaTitle.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.metaTitle.isUndefined() and (not (asso-ciatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.metaTitle.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.metaTitle.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.metaTitle.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.metaTitle.isUndefined()

73

Page 75: Magento Conceptual Schema

[26] If Product Properties Obligatoriness Configuration sets that imageGalleryPath is mandatory,each product should have a imageGalleryPath defined.

Context ProductInStoreView :: imageGalleryPathIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.imageGalleryPathIsMandatory impliesnot(self.-imageGalleryPath.isUndefined())

[27] The imageGalleryPath property is defined only in products that are from one of the typesspecified in Product Properties Type Association Configuration.

Context ProductInStoreView :: imageGalleryPathIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.imageGalleryPath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.imageGalleryPath.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.imageGalleryPath.isUndefined() and (not (asso-ciatedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.imageGalleryPath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Pro-ductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.image-GalleryPath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) andself.product.oclIsTypeOf(BundleProduct)) implies self.imageGalleryPath.isUndefined()

[28] If Product Properties Obligatoriness Configuration sets that baseImagePath is mandatory,each product should have a baseImagePath defined.

Context ProductInStoreView :: baseImagePathIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.baseImagePathIsMandatory impliesnot(self.-baseImagePath.isUndefined())

[29] The baseImagePath property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

Context ProductInStoreView :: baseImagePathIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.baseImagePath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.baseImagePath.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.baseImagePath.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.baseImagePath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.baseImagePath.-isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.product.-oclIsTypeOf(BundleProduct)) implies self.baseImagePath.isUndefined()

[30] If Product Properties Obligatoriness Configuration sets that smallImagePath is mandatory,each product should have a smallImagePath defined.

Context ProductInStoreView :: smallImagePathIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.smallImagePathIsMandatory impliesnot(self.-smallImagePath.isUndefined())

[31] The smallImagePath property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

74

Page 76: Magento Conceptual Schema

Context ProductInStoreView :: smallImagePathIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.smallImagePath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.smallImagePath.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.smallImagePath.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.smallImagePath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.smallImagePath.-isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.product.-oclIsTypeOf(BundleProduct)) implies self.smallImagePath.isUndefined()

[32] If Product Properties Obligatoriness Configuration sets that thumbnailPath is mandatory, eachproduct should have a thumbnailPath defined.

Context ProductInStoreView :: thumbnailPathIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.thumbnailPathIsMandatory impliesnot(self.-thumbnailPath.isUndefined())

[33] The thumbnailPath property is defined only in products that are from one of the types specifiedin Product Properties Type Association Configuration.

Context ProductInStoreView :: thumbnailPathIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.thumbnailPath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.thumbnailPath.isUnde-fined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.-oclIsTypeOf(ConfigurableProduct)) implies self.thumbnailPath.isUndefined() and (not (associated-Types -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct)) impliesself.thumbnailPath.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Downloadable))and self.product.oclIsTypeOf(DownloadableProduct)) implies self.thumbnailPath.isUndefined() and(not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.product.oclIsTypeOf(BundleProduct))implies self.thumbnailPath.isUndefined()

[34] If Product Properties Obligatoriness Configuration sets that urlKey is mandatory, each productshould have a urlKey defined.

Context ProductInStoreView :: urlKeyIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.urlKeyIsMandatory impliesnot(self.urlKey.isUn-defined())

[35] The urlKey property is defined only in products that are from one of the types specified inProduct Properties Type Association Configuration.

Context ProductInStoreView :: urlKeyIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.urlKey.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Grouped))and self.product.oclIsTypeOf(GroupedProduct)) implies self.urlKey.isUndefined() and (not (associat-edTypes -> exists ( pt | pt = ProductType::Configurable)) and self.product.oclIsTypeOf(ConfigurableProduct))implies self.urlKey.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual))and self.product.oclIsTypeOf(VirtualProduct)) implies self.urlKey.isUndefined() and (not (associated-Types -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))

75

Page 77: Magento Conceptual Schema

implies self.urlKey.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle))and self.product.oclIsTypeOf(BundleProduct)) implies self.urlKey.isUndefined()

[36] If Product Properties Obligatoriness Configuration sets that isAvailableForGoogleCheckout ismandatory, each product should have a isAvailableForGoogleCheckout defined.

Context ProductInStoreView :: isAvailableForGoogleCheckoutIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.isAvailableForGoogleCheckoutIsMandatory im-pliesnot(self.isAvailableForGoogleCheckout.isUndefined())

[37] The isAvailableForGoogleCheckout property is defined only in products that are from one ofthe types specified in Product Properties Type Association Configuration.

Context ProductInStoreView :: isAvailableForGoogleCheckoutIsDefinedOnlyForAssociatedProductTypes(): Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.isAvailableForGoogleCheckout.isUndefined() and (not (associatedTypes -> exists ( pt | pt= ProductType::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.isAvailable-ForGoogleCheckout.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable))and self.product.oclIsTypeOf(ConfigurableProduct)) implies self.isAvailableForGoogleCheckout.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.-oclIsTypeOf(VirtualProduct)) implies self.isAvailableForGoogleCheckout.isUndefined() and (not (as-sociatedTypes -> exists ( pt | pt = ProductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct))implies self.isAvailableForGoogleCheckout.isUndefined() and (not (associatedTypes -> exists ( pt |pt = ProductType::Bundle)) and self.product.oclIsTypeOf(BundleProduct)) implies self.isAvailableFor-GoogleCheckout.isUndefined()

[38] If Product Properties Obligatoriness Configuration sets that giftMessageAllowed is manda-tory, each product should have a giftMessageAllowed defined.

Context ProductInStoreView :: giftMessageAllowedIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.giftMessageAllowedIsMandatory impliesnot(self.-giftMessageAllowed.isUndefined())

[39] The giftMessageAllowed property is defined only in products that are from one of the typesspecified in Product Properties Type Association Configuration.

Context ProductInStoreView :: giftMessageAllowedIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.giftMessageAllowed.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.giftMessageAllowed.-isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.-product.oclIsTypeOf(ConfigurableProduct)) implies self.giftMessageAllowed.isUndefined() and (not(associatedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.giftMessageAllowed.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Pro-ductType::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.giftMes-sageAllowed.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) andself.product.oclIsTypeOf(BundleProduct)) implies self.giftMessageAllowed.isUndefined()

[40] If Product Properties Obligatoriness Configuration sets that visibleOnCatalog is mandatory,each product should have a visibleOnCatalog defined.

Context ProductInStoreView :: visibleOnCatalogIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.visibleOnCatalogIsMandatory impliesnot(self.-visibleOnCatalog.isUndefined())

76

Page 78: Magento Conceptual Schema

[41] The visibleOnCatalog property is defined only in products that are from one of the typesspecified in Product Properties Type Association Configuration.

Context ProductInStoreView :: visibleOnCatalogIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.visibleOnCatalog.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.visibleOnCatalog.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.visibleOnCatalog.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.visibleOnCatalog.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.visibleOn-Catalog.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.-product.oclIsTypeOf(BundleProduct)) implies self.visibleOnCatalog.isUndefined()

[42] If Product Properties Obligatoriness Configuration sets that visibleOnSearch is mandatory,each product should have a visibleOnSearch defined.

Context ProductInStoreView :: visibleOnSearchIsMandatoryIfDefined() : Booleanbody: ProductPropertiesObligatorinessConfiguration.visibleOnSearchIsMandatory impliesnot(self.-visibleOnSearch.isUndefined())

[43] The visibleOnSearch property is defined only in products that are from one of the types spec-ified in Product Properties Type Association Configuration.

Context ProductInStoreView :: visibleOnSearchIsDefinedOnlyForAssociatedProductTypes() : Booleanbody:

let associatedTypes : Set(ProductType) = ProductPropertiesTypeAssociationConfiguration.-descriptionAssociatedToProductType

in(not (associatedTypes -> exists ( pt | pt = ProductType::Simple)) and self.product.oclIsTypeOf(SimpleProduct))

implies self.visibleOnSearch.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Grouped)) and self.product.oclIsTypeOf(GroupedProduct)) implies self.visibleOnSearch.isUn-defined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Configurable)) and self.prod-uct.oclIsTypeOf(ConfigurableProduct)) implies self.visibleOnSearch.isUndefined() and (not (associ-atedTypes -> exists ( pt | pt = ProductType::Virtual)) and self.product.oclIsTypeOf(VirtualProduct))implies self.visibleOnSearch.isUndefined() and (not (associatedTypes -> exists ( pt | pt = Product-Type::Downloadable)) and self.product.oclIsTypeOf(DownloadableProduct)) implies self.visibleOn-Search.isUndefined() and (not (associatedTypes -> exists ( pt | pt = ProductType::Bundle)) and self.-product.oclIsTypeOf(BundleProduct)) implies self.visibleOnSearch.isUndefined()

n Description

Product information is saved in a multi-level structure, depending on the scope. We detail,firstly, those properties that are defined globally (its value for a given product is the sameanywhere in the system):

• sku: a unique identifier for each distinct product that can be purchased.

• quantity: the product’s quantity in stock.

• stockStatus: even if some quantity of this product is in stock, the product can be setto ’Out of Stock’.

The following attributes redefine, for this product, some generic stock configuration prop-erties of the system. They are also defined globally. See the store configuration section forfurther information.

77

Page 79: Magento Conceptual Schema

• qtyToBecomeOutOfStock

• minQtyAllowedInShoppingCart

• maxQtyAllowedInShoppingCart

• backOrderPolicy

• notifyForQuantityBelow

Most of the product properties works as follows: for a given product and property, a generic(global) value should be defined. But this value can be redefined for each website or storeview.

The property’s value for a determinate product in a store view is calculated as the morespecific redefinition value. We can also tell the system to ignore some redefinitions, bychanging the corresponding property in the Scope Properties Configuration.

We detail here only the most important:

• name

• netPrice: the net price of this product, without applying taxes or special offers. It canbe redefined at the website level, but not at the store view level.

• specialNetPrice: a different price that can be used as a temporary offer. It can beredefined at the website level, but not at the store view level.

• weight: the product’s weight. Used for calculating the shipping costs in some shippingmethods. .

The Product Properties Type Association Configuration determine, for each property, thatonly the products that are from the types defined here can have this property defined.

The Product Properties Scope Configuration determine, for each property, the lower scopewhere redefinitions are taken into account when calculating the value for this property in astore view.

The Product Properties Obligatoriness Configuration determine, for each property, if allproducts should mandatory have this property defined (at least at the global level) or not.

A product is available in a Website if it can be purchased in the stores of this website.

Magento establishes three types of relations between two different products:

• relatedProduct: meant to be purchased in addition to the item the customer is view-ing.

• upSellProduct: items that customers would ideally buy instead of the product theyare viewing.

• crossSellProduct: items that a customer who is buying the product in question mightenjoy, but that are not directly related.

78

Page 80: Magento Conceptual Schema

2.6.2 Product Options

n Overview

Magento allows several options to be defined for each product, in order to offer multipleoptions of a product without needing to create many separate but very similar products

n Schema Diagram

n Derivation Rules

[1] OptionInStoreView :: name is the specific name defined for this store view, or the genericname if it is not defined.

Context OptionInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() then self.redefinedNameelse self.option.genericName endif

[2] OptionValueInStoreView :: name is the specific name defined for this store view, or the genericname if it is not defined.

Context OptionValueInStoreView :: name : Stringbody:

79

Page 81: Magento Conceptual Schema

if self.redefinedName -> notEmpty() then self.redefinedNameelse self.optionValue.genericName endif

n Constraints

[1] Options are identified by its generic name and the product they belong to.

Context Option :: isIdentifiedByItsGenericNameAndProduct() : Booleanbody: Option.allInstances() -> isUnique(SetgenericName,product)

[2] Options are also identified by its store view and name.

Context OptionInStoreView :: isIdentifiedByItsStoreViewAndName() : Booleanbody: OptionInStoreView.allInstances() -> isUnique(SetstoreView, name)

[3] Option values are identified by its generic name.

Context OptionValue :: isIdentifiedByItsGenericName() : Booleanbody: OptionValue.allInstances() -> isUnique(genericName)

[4] Option values are also identified by its store view and name.

Context OptionValueInStoreView :: isIdentifiedByItsStoreViewAndName() : Booleanbody: OptionValueInStoreView.allInstances() -> isUnique(SetstoreView, name)

[5] Each option should be specified in all existing StoreViews in the system.

Context Option :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

[6] Each option value should be specified in all existing StoreViews in the system.

Context OptionValue :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

[7] An Option Value defines, for the options it belongs to, a relative or a fixed increment, but notboth.

Context OptionValueInOption :: definesRelativeOrFixedIncrementButNotAll() : Booleanbody: ( self.fixedIncrement.isUndefined() <> self.relativeIncrement.isUndefined() )

[8] An option with user-defined-content defines a relative or a fixed increment, but not both.

Context OptionWithContentDefinedByCustomer :: definesRelativeOrFixedIncrementButNotAll() : Booleanbody: ( self.fixedIncrement.isUndefined() <> self.relativeIncrement.isUndefined() )

n DescriptionUsually, there are products which are sold in different Options. The store administrator

defines which are the options of each product. When a customer purchases it, the customershould define which value does he give to the options of this product.

Options with content defined by the customer allow the customer to give any textual ordate value to this option. The sign and increments define an extra amount of money thatwill be charged or deduced for giving a value to that option.

For Options with predefined content, the store administrator should define several OptionValues. When a customer purchases this product, he will choose one (or multiple) value(s)

80

Page 82: Magento Conceptual Schema

for this option. Each Option Value can define an increment that will be applied if the cus-tomer choses it.

The system also requires information about:

• isRequired: defines if the customer must give a value to the product when purchasingit, or if it is optional.

• skuAppendix: used if the store administrator wants to associate different sku’s to theproduct depending on the options choosen. The ’skuAppendix’ will be added at theend of the original’s product ’sku’.

81

Page 83: Magento Conceptual Schema

2.6.3 Product Types

n Overview

Products offerded by the store can be classified into six types: Simple, Grouped, Config-urable, Virtual, Downloadable and Bundle products.

n Schema Diagram

82

Page 84: Magento Conceptual Schema

n Derivation Rules

[1] Product :: productType denotes the product type as an enumeration value.

Context Product :: productType : ProductTypebody:

if self.oclIsTypeOf(SimpleProduct) then ProductType::Simpleelse if self.oclIsTypeOf(GroupedProduct) then ProductType::Groupedelse if self.oclIsTypeOf(ConfigurableProduct) then ProductType::Configurableelse if self.oclIsTypeOf(VirtualProduct) then ProductType::Virtualelse if self.oclIsTypeOf(DownloadableProduct) then ProductType::Downloadableelse ProductType::Bundle endif endif endif endif endif

n Constraints

83

Page 85: Magento Conceptual Schema

[1] Bundle product items are identified by its name.

Context BundleProductItem :: isIdentifiedByItsName() : Booleanbody: BundleProductItem.allInstances() -> isUnique(name)

[2] Downloadable items are identified by its name and downloadable product.

Context DownloadableItem :: isIdentifiedByItsNameAndDownloadableProduct() : Booleanbody: DownloadableItem.allInstances() -> isUnique(Setname,downloadableProduct)

[3] Configurable attributes should have its ’isConfigurable’ property set to true.

Context ConfigurableProduct :: hasOnlyCorrectConfigurableAttributes() : Booleanbody:self.configurableAttribute -> forAll ( ca | ca.isConfigurable )

[4] A configurable product is able to rate the same attributes than all its associated products.

Context ConfigurableProduct :: isAssociatedToProductsWithTheSameAbleToRateAttributes() : Booleanbody:

self.associatedProduct -> forAll ( ap |ap.ableToRateAttribute -> select ( a | self.configurableAttribute -> includes(a) ) = self.config-

urableAttribute)

[5] Each simple product associated to a configurable product should have a different combinationof the values assigned to its configurable attributes.

Context ConfigurableProduct :: hasNoAssociatedProductsRepeated() : Booleanbody:

self.associatedProduct -> forAll ( p1, p2 | p1 <> p2 implies not (p1.ableToRateAttribute -> select ( a | self.configurableAttribute -> includes(a) ).storeViewAt-

tributeRating.attributeValue =p2.ableToRateAttribute -> select ( a | self.configurableAttribute -> includes(a) ).storeViewAt-

tributeRating.attributeValue

) )

[6] Bundle product items have one and only one bundle product option as default.

Context BundleProductItem :: hasOnlyOneDefaultOption() : Booleanbody: self.bundleProductOption -> select ( bpo | bpo.isDefault) -> size() = 1

[7] Bundle product options are simple, downloadable or virtual products.

Context BundleProductOption :: isAProductOfTheCorrectType() : Booleanbody: self.product.oclIsTypeOf( SimpleProduct ) or self.product.oclIsTypeOf( DownloadableProduct) or self.product.oclIsTypeOf( VirtualProduct )

[8] Grouped, Configurable, Virtual, Downloadable and Bundle products are not associated to theweight attribute.

Context ProductPropertiesTypeAssociationConfiguration :: determineWeightOnlyForCorrectProduct-Types() : Booleanbody:self.weightAssociatedToProductType -> excludesAll ( Set ProductType::Grouped, ProductType::Configurable,ProductType::Bundle, ProductType::Virtual, ProductType::Downloadable )

[9] Grouped products are not associated to any attribute related to the price.

84

Page 86: Magento Conceptual Schema

Context ProductPropertiesTypeAssociationConfiguration :: determinePriceRelatedAttributesOnlyFor-CorrectProductTypes() : Booleanbody:

self.netPriceAssociatedToProductType -> excludes ( ProductType::Grouped ) andself.specialNetPriceAssociatedToProductType -> excludes ( ProductType::Grouped ) andself.specialNetPriceFromAssociatedToProductType -> excludes ( ProductType::Grouped ) andself.specialNetPriceUntilAssociatedToProductType -> excludes ( ProductType::Grouped )

[10] Grouped are not associated to the price attribute, other product types are.

Context ProductPropertiesTypeAssociationConfiguration :: determineNetPriceOnlyForCorrectProduct-Types() : Booleanbody:self.netPriceAssociatedToProductType = SetProductType::Simple,ProductType::Configurable,ProductType::Downloadable,ProductType::Virtual,ProductType::Bundle;

[11] Grouped, Configurable, Virtual, Downloadable and Bundle products are not associated to theallowed gift message attribute.

Context ProductPropertiesTypeAssociationConfiguration :: determineAllowedGiftMessageOnlyFor-CorrectProductTypes() : Booleanbody:self.allowedGiftMessageAssociatedToProductType -> excludesAll ( Set ProductType::Grouped, Pro-ductType::Configurable, ProductType::Bundle, ProductType::Virtual, ProductType::Downloadable )

[12] Groped, Configurable and Bundle Products do not have any inventory property, excepting thestock status.

Context Product :: hasInventoryPropertiesOnlyIfNeeded() : Booleanbody:

( self.oclIsTypeOf(GroupedProduct) or self.oclIsTypeOf(ConfigurableProduct) or self.oclIsTypeOf(BundleProduct)) implies (

self.quantity.isUndefined() andself.qtyToBecomeOutOfStock.isUndefined() andself.minQtyAllowedInShoppingCart.isUndefined() andself.maxQtyAllowedInShoppingCart.isUndefined() andself.notifyForQuantityBelow.isUndefined()andself.backOrderPolicy.isUndefined())

[13] Simple, Virtual and Downloadable Products must define its quantity property.

Context Product :: hasQuantityPropertyWhenNeeded() : Booleanbody:

( self.oclIsTypeOf(SimpleProduct) or self.oclIsTypeOf(VirtualProduct) or self.oclIsTypeOf(DownloadableProduct))

implies self.quantity.isDefined()

[14] The sign and increment attributes are only defined if the downloadable product allows itemsto be purchased separatelly, but only one increment (fixed or relative) is defined.

Context DownloadableItem :: definesIncrementWhenNeeded() : Booleanbody:

if self.downloadableProduct.purchaseItemsSeparatelly = Status::Enabled thenself.sign.isDefined() and ( self.fixedIncrement.isUndefined() = self.relativeIncrement.isDefined()

)else

self.sign.isUndefined() and self.fixedIncrement.isUndefined() and self.relativeIncrement.isUn-defined()

endif

[15] A Configuration defines a relative or a fixed increment, but not both.

85

Page 87: Magento Conceptual Schema

Context ConfigurationOfAConfigurableProduct :: definesRelativeOrFixedIncrementButNotAll() : Booleanbody: ( self.fixedIncrement.isUndefined() = self.relativeIncrement.isDefined() )

[16] The sign and increment attributes are only defined if the bundle product allows items to bepurchased separatelly, but only one increment (fixed or relative) is defined.

Context BundleProductOption :: definesIncrementWhenNeeded() : Booleanbody:

if self.bundleProductItem.bundleProduct.priceMethod = PriceMethod::Fixed thenself.sign.isDefined() and ( self.fixedIncrement.isUndefined() = self.relativeIncrement.isDefined()

)else

self.sign.isUndefined() and self.fixedIncrement.isUndefined() and self.relativeIncrement.isUn-defined()

endif

[17] Grouped Products and Bundle Products with the Fixed price do not have any Option.

Context Product :: hasOptionsOnlyIfNeeded() : Booleanbody:

self.oclIsTypeOf(GroupedProduct) or ( self.oclIsTypeOf(BundleProduct) and self.oclAsType(BundleProduct).-priceMethod = PriceMethod::Fixed )

implies self.option -> isEmpty()

[18] Grouped Products could not be associated to simple products with options.

Context GroupedProduct :: isNotAssociatedToProductsWithOptions() : Booleanbody: self.associatedProduct -> forAll ( ap | ap.option -> isEmpty() )

[19] Configurable Products could not be associated to simple products with options.

Context ConfigurableProduct :: isNotAssociatedToProductsWithOptions() : Booleanbody: self.associatedProduct -> forAll ( ap | ap.option -> isEmpty() )

[20] Bundle Products could not be associated to products with options.

Context BundleProduct :: isNotAssociatedToProductsWithOptions() : Booleanbody: self.bundleProductItem.product -> forAll ( p | p.option -> isEmpty() )

n DescriptionA Simple Product is an individual product, the attributes of which are determined by the

store owner.A Grouped Product is a set of simple products that are sold together as a pack.A Configurable Product allows customers to configure some of its attributes when pur-

chasing it (such as color, size...). The Configurable Product represents the abstract non-configurated product and is related to a set of Configured Products, each one representingone concrete available configuration. One or more configurableAttributes should be de-fined. The system will rely the configuration chosen by the customer to the simple asso-ciated product that matches it. Although this can be performed in a simpler way by usingproduct options, this method allows the store administrator to keep track of the inventory foreach configurated product.

A Configurated Product is a Simple Product that can be sold as a concrete configurationof a Configurable Product.

Virtual and Downloadable Products represent both non-physical items. The difference isthat downloadable products are for digitized stuff that can be downloaded by the customer.-The downloadable product record has a function to either point to a URL or file. Virtualproducts are more akin to a service.

86

Page 88: Magento Conceptual Schema

Bundle products could be considered as a combination of grouped and configurable prod-ucts. A Bundle Product has the following attributes:

• shippingMode: determines if the products will be shipped together or separately.

• priceMethod: determines the way the price will be calculated.

• specialNetPriceReduction: specifies a percentage reduction that will be applied toits original price to define the product’s special net price.

When a customer purchases a bundle product, he has to choose an option (or more) foreach bundle product item. Magento saves the following information about bundle productitems:

• name

• selectionType: determines if only one or more than bundle product options can bechoosen by a customer when purchasing the product.

• isRequired: determines if no bundle product option can be choosen for this item.

Each bundle product option is associated to one product. Magento also saves the followinginformation:

• defaultQty: the default quantity that the customer will purchase of that product, if hechooses it.

• isQtyRedefinable: determines if the customer can change the default quantity to pur-chase or not.

• isDefault: determines if this is the option selected by default for this bundle productitem.

87

Page 89: Magento Conceptual Schema

2.6.4 Categories

n Overview

Products are grouped into categories which are arranged hierarchically.

n Schema Diagram

n Operations

[1] context Category def: allParents () : Set(Category) =

self.parent -> union(self.parent.allParents())

n Derivation Rules

[1] CategoryInStoreView :: name is the redefinedName at the current base scope level, if it isdefined, or the genericName of the category.

Context CategoryInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() thenself.redefinedName

elseself.category.genericName

88

Page 90: Magento Conceptual Schema

endif

[2] CategoryInStoreView :: description is the redefinedDescription at the current base scopelevel, if it is defined, or the genericDescription of the category.

Context CategoryInStoreView :: description : Stringbody:

if self.redefinedDescription -> notEmpty() thenself.redefinedDescription

elseself.category.genericDescription

endif

[3] CategoryInStoreView :: imagePath is the redefinedImagePath at the current base scope level,if it is defined, or the genericImagePath of the category.

Context CategoryInStoreView :: imagePath : Stringbody:

if self.redefinedImagePath -> notEmpty() thenself.redefinedImagePath

elseself.category.genericImagePath

endif

[4] CategoryInStoreView :: pageTitle is the redefinedPageTitle at the current base scope level, ifit is defined, or the genericPageTitle of the category.

Context CategoryInStoreView :: pageTitle : Stringbody:

if self.redefinedPageTitle -> notEmpty() thenself.redefinedPageTitle

elseself.category.genericPageTitle

endif

[5] CategoryInStoreView :: metaKeyword is the redefinedMetaKeyword at the current base scopelevel, if it is defined, or the genericMetaKeyword of the category.

Context CategoryInStoreView :: metaKeyword : Set(String)body:

if self.redefinedMetaKeyword -> notEmpty() thenself.redefinedMetaKeyword

elseself.category.genericMetaKeyword

endif

[6] CategoryInStoreView :: metaDescription is the redefinedMetaDescription at the current basescope level, if it is defined, or the genericMetaDescription of the category.

Context CategoryInStoreView :: metaDescription : Stringbody:

if self.redefinedMetaDescription -> notEmpty() thenself.redefinedMetaDescription

elseself.category.genericMetaDescription

endif

[7] CategoryInStoreView :: status is the redefinedStatus at the current base scope level, if it isdefined, or the genericStatus of the category.

Context CategoryInStoreView :: status : Booleanbody:

if self.redefinedStatus -> notEmpty() thenself.redefinedStatus

elseself.category.genericStatus

89

Page 91: Magento Conceptual Schema

endif

n Constraints

[1] Categories are identified by its generic name and its parent category.

Context Category :: isIdentifiedByItsGenericNameAndParentCategory() : Booleanbody: Category.allInstances() -> isUnique (SetgenericName,parent)

[2] For a given store view, each category has a unique name.

Context StoreView :: doesNotHaveTwoCategoriesWithTheSameRedefinedName() : Booleanbody: self.categoryInStoreView -> isUnique (name)

[3] Each category should be related to all existing store views in the system.

Context Category :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

[4] There are no cycles in category hierarchy.

Context Category :: isAHierarchy() : Booleanbody: not self.allParents() -> includes(self)

n Description

Magento groups products into categories which are arranged hierarchically. Categorieshave the following attributes:

• name: the category’s name.

• status: determines if the category is visible and accessible from the front end.

• urlKey: a relative URL path which can be used to acess automatically to the categorypage.

• description: the category’s description.

• imagePath: a path to the image that will be associated to the category.

• pageTitle: the title that will be shown in the category’s page.

• metaKeyword: meta keywords of the category.

• metaDescription: the meta description of the category.

These attributes are defined for the whole system, but they can be redefined at the storeview level.

90

Page 92: Magento Conceptual Schema

2.6.5 Attributes

n Overview

Magento allows editing product attributes and creating new user-defined attributes.

n Schema Diagram

91

Page 93: Magento Conceptual Schema

n Derivation Rules

[1] AttributeInStoreView :: name is the specific name defined for this store view, or the genericname if it is not defined.

Context AttributeInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() then self.redefinedNameelse self.attribute.genericName endif

[2] Product :: ableToRateAttribute are the attributes that can be given a value for this product: allthe system attributes and the simple attributes associated to the attribute set of this product.

Context Product :: ableToRateAttribute : Set(Attribute)body: self.attributeSet.attribute

n Constraints

92

Page 94: Magento Conceptual Schema

[1] Attributes are identified by its internal code.

Context Attribute :: isIdentifiedByItsCode() : Booleanbody: Attribute.allInstances() -> isUnique(code)

[2] Attribute sets are identified by its name.

Context AttributeSet :: isIdentifiedByItsName() : Booleanbody: AttributeSet.allInstances() -> isUnique(name)

[3] Each attribute should be specified in all existing StoreViews in the system.

Context Attribute :: isSpecifiedInAllStoreViews() : Booleanbody: Attribute.storeView -> includesAll( StoreView.allInstances() )

[4] Image attributes doesn’t have those attributes defined. Other type of attributes should manda-tory have it defined.

Context Attribute :: hasTheUniqueAndRequiredPropertiesWhenNeeded() : Booleanbody:

if self.oclIsTypeOf(ImageAttribute) thenself.hasUniqueValues -> isEmpty() and self.isRequired -> isEmpty()

elseself.hasUniqueValues -> notEmpty() and self.isRequired -> Empty()

endif

[5] A single valued enumeration attribute can be configurable only if its scope is set to global.

Context SingleValuedEnumerationAttribute :: canBeConfigurableOnlyIfItIHasGlobalScope() : Booleanbody: self.scope <> Scope::Global implies self.isConfigurable = false

n Description

Attributes are properties of products in the catalog. Users can create, delete them anddefine some characteristics. For each attribute, users can set the following information:

• code: an internal code to identify this attribute.

• genericName: the name this attribute will be shown with in all store views.

• scope: the level at which the values of this attribute are shared.

• isComparable: determines whether the attribute values are usefull for customers tocompare two or more products.

• hasUniqueValues: if it is true, the value selected or entered for this attribute for eachproduct must be different.

• isRequired: if it is true, a value must be selected for this attribute for each product youcreate.

• associatedToProductType: the Product Types that will include this attribute.

The name of the attribute can be redefined for each storeView.

Depending on the type of data that they represent, attributes can be classified into:

• TextualAttribute

• BooleanAttribute

• PriceAttribute

• DateAttribute

93

Page 95: Magento Conceptual Schema

• IntegerAttribute

• DecimalAttribute

• ImageAttribute

• EnumerationAttribute: can be rated only with a limited set of Literal Values.

• MultipleValuedEnumerationAttribute: an Enumeration Attribute that can be ratedwith more than one literal value at the same time.

• SingleValuedEnumerationAttribute: an Enumeration Attribute that can be rated withonly one literal value at the same time.

Most types of attributes allow defining a default value. Some of them have also specificproperties:

• inputValidation: makes the system to check if the value assigned to this attributematches an specific pattern, such as an email or an URL. It is only applied to TextualAttributes.

• isConfigurable: determines if this attribute can be setted to configurable in a config-urable product. It is only applied to Single Valued Enumeration Attributes. See theproduct types section for more information.

Attributes can be assigned to one or more Attribute Sets. Each product is related to onlyone attribute set. For a given product, we are ableToRate all the attributes of its attributeset.

94

Page 96: Magento Conceptual Schema

2.6.6 Attribute Values

n OverviewAttributes should have a value for each product. Magento allows defining the scope in whicha product value is shared.

n Schema Diagram

n Derivation Rules

[1] StoreViewAttributeRating :: attributeValue is the value redefined for this store view. If it is notdefined, the value redefined in the website this store view belongs to. Inf it is not defined, the genericvalue.

Context StoreViewAttributeRating :: attributeValue : AttributeValuebody:

if self.redefinedAttributeValue -> notEmpty() and self.attribute.scope = Scope::StoreView thenself.redefinedAttributeValue

else if self.storeView.store.website.websiteAttributeRating -> select ( war | war.product = self.-product and war.attribute = self.attribute ).redefinedAttributeValue -> notEmpty() and self.attribute.-scope != Scope::Global then

self.storeView.store.website.websiteAttributeRating -> select ( war | war.product = self.productand war.attribute = self.attribute ).redefinedAttributeValue

95

Page 97: Magento Conceptual Schema

elseself.product.globalAttributeRating -> select ( gar | gar.attribute = self.attribute).genericAttribute-

Valueendif

[2] LiteralValueInStoreView :: name is the specific name defined for this store view, or the genericname if it is not defined.

Context LiteralValueInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() then self.redefinedNameelse self.attribute.genericName endif

n Constraints

[1] Textual values are identified by its value.

Context TextualValue :: isIdentifiedByItsValue() : Booleanbody: TextualValue.allInstances() -> isUnique(value)

[2] Boolean values are identified by its value.

Context BooleanValue :: isIdentifiedByItsValue() : Booleanbody: BooleanValue.allInstances() -> isUnique(value)

[3] Price values are identified by its value.

Context PriceValue :: isIdentifiedByItsValue() : Booleanbody: PriceValue.allInstances() -> isUnique(value)

[4] Date values are identified by its value.

Context DateValue :: isIdentifiedByItsValue() : Booleanbody: DateValue.allInstances() -> isUnique(value)

[5] Integer values are identified by its value.

Context IntegerValue :: isIdentifiedByItsValue() : Booleanbody: IntegerValue.allInstances() -> isUnique(value)

[6] Decimal values are identified by its value.

Context DecimalValue :: isIdentifiedByItsValue() : Booleanbody: DecimalValue.allInstances() -> isUnique(value)

[7] Image values are identified by its value.

Context ImageValue :: isIdentifiedByItsImagePath() : Booleanbody: ImageValue.allInstances() -> isUnique(path)

[8] Enumeration values are identified by its generic name and the enumeration attribute it belongsto.

Context EnumerationValue :: isIdentifiedByItsGenericNameAndAttribute() : Booleanbody: EnumerationValue.allInstances() -> isUnique(SetgenericName, enumerationAttribute)

[9] Multiple enumeration values are identified by its iset of enumeration values.

96

Page 98: Magento Conceptual Schema

Context MultipleEnumerationValue :: isIdentifiedByItsSetOfEnumerationValues() : Booleanbody: MultipleEnumerationValue.allInstances() -> isUnique(enumerationValue)

[10] A literal value is associated to all the storeviews.

Context EnumerationValue :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll ( StoreView.allInstances() )

[11] A product and attribute can only participate in the attribute rating relationship if the attribute isan able to rate attribute of this product.

Context Product :: isOnlyRatedForItsAbleToRateProducts() : Booleanbody:

self.ableToRateAttribute -> includesAll ( self.globalAttributeRating.attribute ) andself.ableToRateAttribute -> includesAll ( self.websiteAttributeRating.attribute ) andself.ableToRateAttribute -> includesAll ( self.storeViewAttributeRating.attribute )

[12] All the able to rate attributes have a global attribute rating, one website rating for each websiteand one store view rating for each store view in the system.

Context Product :: hasAGlobalWebsiteAndStoreViewRatingForAllAbleToRateProducts() : Booleanbody:

self.globalAttributeRating.attribute -> includesAll ( self.ableToRateAttribute ) andself.ableToRateAttribute -> forAll ( a |

self.websiteAttributeRating -> select ( gar | gar.attribute = a ).website -> includesAll (Website.-allInstances())

) andself.ableToRateAttribute -> forAll ( a |

self.storeViewAttributeRating -> select ( gar | gar.attribute = a ).storeView -> includesAll (Store-View.allInstances())

)

[13] A product has given a value to each required attribute it is related to.

Context Product :: hasARatingForAllRequiredAttributes() : Booleanbody:

self.ableToRateAttribute -> forall ( av |(av.isRequired.notEmpty() and av.isRequired) implies

self.storeViewAttributeRating -> forall (sar | sar.storeViewRatedAttribute=av implies sar.attributeValue.notEmpty()

))

[14] If an attribute is set to be unique, there are no two different products that assign it the samevalue, even in different store views.

Context Attribute :: ratingsRespectTheUniqueConstraint() : Booleanbody:

(self.hasUniqueValues -> notEmpty() andself.hasUniqueValues) implies self.storeViewAttributeR-ating -> forall ( sar1, sar2 |

sar1.attributeValue = sar2.attributeValue implies ar1.product = ar2.product)

[15] Only text field values are given to a text field attribute.

Context TextualAttribute :: isFilledWithTextualValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( TextualValue )

)

[16] Only price values are given to a price attribute.

97

Page 99: Magento Conceptual Schema

Context PriceAttribute :: isFilledWithPriceValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( PriceValue )

)

[17] Only date values are given to a date attribute.

Context DateAttribute :: isFilledWithDateValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( DateValue )

)

[18] Only boolean values are given to a boolean attribute.

Context BooleanAttribute :: isFilledWithBooleanValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( BooleanValue )

)

[19] Only integer values are given to a integer attribute.

Context IntegerAttribute :: isFilledWithIntegerValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( IntegerValue )

)

[20] Only decimal values are given to a decimal attribute.

Context DecimalAttribute :: isFilledWithDecimalValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( DecimalValue )

)

[21] Only image values are given to an image attribute.

Context ImageAttribute :: isFilledWithImageValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies v.oclIsTypeOf( ImageValue )

)

[22] Only single enumeration values are given to a single valued enumeration attribute, and itsvalue options are options of the attribute.

Context SingleValuedEnumerationAttribute :: isFilledWithSingleEnumerationValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies (v.oclIsTypeOf( EnumerationValue ) and self.allowedValue -> includes (

v )))

[23] Only multiple enumeration values are given to a multiple valued enumeration attribute, and itsvalue options are options of the attribute.

Context MultipleValuedEnumerationAttribute :: isFilledWithMultipleEnumerationValues() : Booleanbody:

self.storeViewAttributeRating.attributeValue -> forall ( v |v.isDefined() implies (v.oclIsTypeOf( MultipleEnumerationValue ) and self.allowedValue ->

includesAll ( v.oclAsType(MultipleEnumerationValue).enumerationValue )

98

Page 100: Magento Conceptual Schema

))

n Description

In Magento, users assign a global value to each couple product - attribute. But they canredefine this value for each website or storeview.

Some attribute properties restrict the way this values are assigned:

• scope: define at which level we can rate this attribute. If it is set to Global, no storeview and website redefinitions are not taken into account. If it is Website, only theredefinitions at the website level are taken into account. With a Store View scope, allredefinitions are taken into account.

• hasUniqueValues: if true, there can not be two products where this attribute is ratedwith the same value.

• isRequired: if true, each product that has this attribute should give it a value.

• isComparable: indicates whether the attribute can be used for customers to comparetwo different products.

Global, Website and Storeview Attribute Ratings are the fact that an attribute has a valuein a specific scope. Each one can have a generic value or its redefinition associated.

For a given product, attribute and store view, the attribute value is the more specific definedvalue, taking into account only the redefinitions specified by the scope property of thisattribute.

Depending on the type of data they represent, there are several types of Attribute Values.

• Textual Value

• Boolean Value

• Price Value

• Date Value

• Integer Value

• Decimal Value

• Image Value: where the file path of the image is specified.

• Single Enumeration Value: represents the choose of one literal value, from thosespecified by the corresponding single enumeration attribute.

• Multiple Enumeration Value: represents the choose of a non-empty set of literalvalues, from those specified by the corresponding multiple enumeration attribute.

Literal values have a generic name, that can be redefined for a given store view.

99

Page 101: Magento Conceptual Schema

2.6.7 Price Rules

n Overview

Magento allows modifing the final product prices depending on the quantity of productsordered or its properties.

n Schema Diagram

100

Page 102: Magento Conceptual Schema

n Derivation Rules

[1] ShoppingCartPriceRuleInStoreView :: label is the redefinedLabel at the current base scopelevel, if it is defined, or the genericLabel of the category.

Context ShoppingCartPriceRuleInStoreView :: label : Stringbody:

if not(self.redefinedLabel.isUndefined()) thenself.redefinedLabel

elseself.category.genericLabel

endif

[2] ShoppingCartPriceRule :: timesUsed is the number of times the rule has been used by any-one.

Context ShoppingCartPriceRule :: timesUsed : Stringbody: self.useOfShoppingCartPriceRule.timesUsed -> sum()

n Constraints

[1] A shopping cart price rule is identified by its product and quantity.

Context TierPrice :: isIdentifiedByItsProductAndQuantity() : Booleanbody: TierPrice.allInstances() -> isUnique(Tuplep:product,q:quantity)

[2] A catalog price rule is identified by its name.

Context CatalogPriceRule :: isIdentifiedByItsName() : Booleanbody: CatalogPriceRule.allInstances() -> isUnique(name)

[3] A catalog price rule is identified by its priority.

Context CatalogPriceRule :: isIdentifiedByItsPriority() : Booleanbody: CatalogPriceRule.allInstances() -> isUnique(priority)

[4] A shopping cart price rule is identified by its name.

Context ShoppingCartPriceRule :: isIdentifiedByItsName() : Booleanbody: ShoppingCartPriceRule.allInstances() -> isUnique(name)

[5] A shopping cart price rule is identified by its priority.

Context ShoppingCartPriceRule :: isIdentifiedByItsPriority() : Booleanbody: ShoppingCartPriceRule.allInstances() -> isUnique(priority)

[6] A shopping cart price rule in a store view is identified by its label and store view.

Context ShoppingCartPriceRuleInStoreView :: isIdentifiedByItsLabelAndStoreView() : Booleanbody: ShoppingCartPriceRuleInStoreView.allInstances() -> isUnique(Tuplel:label,s:storeView)

[7] Each shopping cart price rule should be specified in all existing store views in the system.

Context ShoppingCartPriceRule :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

[8] The discountQtyStep property is only defined if the apply method selected is Percentage orBuyXGetY.

101

Page 103: Magento Conceptual Schema

Context ShoppingCartPriceRule :: hasTheDiscountQtyStepDefinedWhenNeeded() : Booleanbody:

not(self.discountQtyStep.isUndefined()) implies (self.method = ShoppingCartRuleDiscountMethod::Percentage or

self.method = ShoppingCartRuleDiscountMethod::BuyXGetY)

[9] A shopping cart price rule can not be totally used more times than the total uses defined.

Context ShoppingCartPriceRule :: isNotUsedMoreThanPermitted() : Booleanbody:self.maxUses >= self.useOfShoppingCartPriceRule.timesUsed -> sum()

[10] A shopping cart price rule can not be used by a customer more times than the total uses percustomer defined.

Context ShoppingCartPriceRule :: isNotUsedMoreThanPermittedToOneCustomer() : Booleanbody:self.useOfShoppingCartPriceRule -> forAll ( usc | self.maxUsesPerCustomer >= usc.timesUsed)

[11] Fixed tier prices are not applied to Bundle and Grouped Products

Context FixedTierPrice :: isAppliedToProductsOfTheCorrectType() : Booleanbody:not(self.product.oclIsTypeOf(BundleProduct) or self.product.oclIsTypeOf(GroupedProduct))

[12] Relative tier prices are only applied to Bundle Products

Context RelativeTierPrice :: isAppliedToProductsOfTheCorrectType() : Booleanbody:self.product.oclIsTypeOf(BundleProduct)

n Description

A Tier Price determines that a product will be priced differently for higher quantities. If aCustomer of a selected Customer Group purchases more unities of a product than the es-tablished quantity, each unit will be priced at the new defined price (for Fixed Tier Prices) orthe percentage reduction will be applied (for Relative Tier Prices). For multiple tier definition,they take precedence from the highest to lowest quantity.

Catalog Price Rules are applied to a product, if it meets the defined condition. ShoppingCart Price Rules are applied to all products in a shopping cart, when the shopping cartmeet the defined condition. These conditions state values for the product attributes to beselected or quantities of products to be purchased in a shopping cart. Rules will only beapplied in the defined websites, as well as for customers belonging to the defined customergroups.

Magento saves the following information about price rules:

• name: the name of the rule.

• description: a description of the rule.

• status: whether the rule is currently enabled or not.

• priority: defines the order the rules will be applied.

• inEffectFrom: the beggining of the data range for the promotion to be in effect. Ifempty, the rule will be enabled as soon as it is created.

102

Page 104: Magento Conceptual Schema

• inEffectUntil: the end of the data range for the promotion to be in effect. If empty, therule will be enabled until it is deleted.

• amount: the numerical value of the discount, which can either a percentage or fixedmonetary amount, depending on the apply method defined.

• stopFurtherRules: will cause the system to ignore any other existing rules with alower priority once this rule has been calculated.

• condition: the condition a product or shopping cart should meet in order that the pricerule can be applied .

Additional attributes should be defined for Shopping Cart Price Rules:

• couponCode: if defined, the rule will only be applied if the customer enters this codewhen placing an order. If no code is defined, the application of the rule depends onlyon its conditions.

• maxUses: the maximum amount of thimes the rule can be used total. There’s no limitif it is no defined.

• maxUsesPerCustomer: the maximum amount of times the Rule can be used percustomer, whether or not you require a coupon code. If empty, there will be no limit.-The UseOfShoppingCartPriceRule::timesUsed property indicates the number of timesthe rule has been used by a customer.

• timesUsed: the number of times the rule has been used by anyone. Derived Attribute.• maxQuantity: limits how many units of each line item in the shopping cart will receive

this discount.• discountQtyStep: only defined if the apply method is Percentage or BuyXGetY, de-

termines the quantities that your customers will have to purchase in order to receive apercentage discount or the offered free units, respectively.

• freeShippingMethod: determines whether the rule can be combined with a free ship-ping offer, if it is offered. If MatchingItems is selected, only the products that match therule’s condition will be able to ship for free. For AllItems, that will be also applied forother products in the shopping cart.

• itemLevelCondition: restricts the application of the defined discounts to the productsthat meets it. If it is no defined, the rule is applied to all the products in the shoppingcart.

For shopping cart price rules, a discount applying method should be chosen from thefollowing:

• Percentage: substracts, for each product, the discount amount as a percentage of theoriginal price. If a discountQtyStep is defined, the discount will be placed only to areduced quantity of products, this quantity defined as the greatest factor of ’discoun-tQtyStep’ that is below the purchased quantity.

• Fixed: substracts, for each product, the discount amount from the price of each prod-uct.

• FixedForWholeCart: as the Fixed method, but it is applied only once to the total cartamount.

• BuyXGetY: offers a quantity of free items, for each product, determined by the dis-count amount property. The number of given units is defined by the discountQtyStepproperty.

A generic label is defined to show a shopping cart price rule to customers, which can beredefined at the store view level.

In catalog price rules, the following discount applying methods could be chosen:

103

Page 105: Magento Conceptual Schema

• SetAsFixed: sets the final discounted price to the discount amount.

• SubstractFixed: substracts the discount amount from the original price.

• SetAsPercentage: sets the final discounted price to the ’discount amount’ percentageof the original price.

• SubstractPercentage: substracts the discount amount as a percentage of the originalprice.

104

Page 106: Magento Conceptual Schema

2.7 Additional Activities

2.7.1 Product Tags

n Overview

Tags are one-word descriptors that customers can add to products.

n Schema Diagram

n Derivation Rules

[1] TagInStoreView :: popularity is the number of times the tag has been applied in this storeView,adding the base popularity.

Context TagInStoreView :: popularity : Integerbody: self.basePopularity + self.tag.productTagging -> select ( t | t.storeView = self.storeView ) ->size()

n Constraints

[1] Tags are identified by its name.

Context Tag :: isIdentifiedByItsName() : Booleanbody: Tag.allInstances() -> isUnique(name)

[2] Each tag should be related to all existing store views in the system.

105

Page 107: Magento Conceptual Schema

Context Tag :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

n Description

Tags act as keywords. Tags help Customers to organize and remember the products thatthey have seen. System saves the following information for tags:

• name: the description word itself. .

• status: Pending tags are those recently added by costumers. Administrators can afterchange its status to Approved or Disabled.

A ProductTagging is the fact that a Customer has assigned a Tag to a Product in a StoreView. Magento saves the time this assignation was made.

Administrators can also add Tags to Products. In this case, only the Product tagged andthe selectionned tag are saved.

Some tag properties can be set at the store view scope:

• basePopularity: is added to the number of times the tag is assigned to calculate itspopularity.

• popularity: used by the system to emphasize the most used tags. Derived Attribute.

106

Page 108: Magento Conceptual Schema

2.7.2 Product Reviews

n Overview

Customers can write reviews so that other users may read evaluations of a product.

n Schema Diagram

n Derivation Rules

[1] PropertyInStoreView :: name is the name redefined in this store view. If it is not defined, thegeneric name.

Context PropertyInStoreView :: name : Stringbody:

if self.redefinedName -> notEmpty() thenself.redefinedName

elseself.property.genericName

endif

n Constraints

[1] Properties are identified by its generic name.

Context Property :: isIdentifiedByItsGenericName() : Booleanbody: Property.allInstances() -> isUnique(genericName)

107

Page 109: Magento Conceptual Schema

[2] Within a store view, properties should also be identified by its name.

Context PropertyInStoreView :: isIdentifiedByItsStoreViewAndName() : Booleanbody: PropertyInStoreView.allInstances() -> isUnique(Setname,storeView)

[3] Reviews are identified by its author nick name and its text.

Context Review :: isIdentifiedByItsAuthorNickNameAndText() : Booleanbody: Review.allInstances() -> isUnique(SetauthorNickName,text)

[4] Each property should be related to all existing store views in the system.

Context Property :: isSpecifiedInAllStoreViews() : Booleanbody: self.storeView -> includesAll( StoreView.allInstances() )

n Description

A Review is a customer evaluation of a product. Magento takes into account the followinginformation about reviews:

• authorNickName: a name that the autor of the review chooses, with no restriction, toidentificate himself ahead of the other users.

• title: the title of the review.

• text: the text of the review.

• status: Pending reviews are those recently added by Costumers. Administrators canafter change its status to Approved or NotApproved.

• createdAt: the time the review was made.

• storeViewWhereIsVisible: the store views where this review is visible. When it iscreated, it is only visible in the store view it was created, but administrators can changeit after.

• productReviewed: the product that is reviewed.

• user: the costumer or administrator that has made the review. Reviews can be madeby not registered costumers. In this case, no user is associated to it.

Magento allows us to define properties that the user will be able to rate for a product.-Properties have a genericName that can be redefined for each store view. We can setproperties to be not visible in a store view.

A Property Score assigns a value to a property for a product.

When a review is placed, an score should be provided for each property which is visiblein the store view it was made. As properties’ visibility can be modified later, this constraintcould not be respected after editing a property.

108

Page 110: Magento Conceptual Schema

2.7.3 Buying Process Information

n Overview

Magento allows customers to save information to support the buying process: wished prod-ucts, product comparison and alerts, etc.

n Schema Diagram

109

Page 111: Magento Conceptual Schema

n Derivation Rules

[1] ActivityInfoOfSessionInStoreView :: readyToCompareProduct are the explicit ready to com-pare products, if the catalog configuration sets its scope to StoreView, or the website’s ready tocompare products otherwise.

Context ActivityInfoOfSessionInStoreView :: readyToCompareProduct : Set(Product)body:

let currentWebsite : Website = self.sessionWithInfoAbout.storeView.store.website inif currentWebsite.CatalogConfigurationInWebsite.recentlyViewedComparedProductsScope =

Scope::StoreView thenself.explicitReadyToCompareProduct

elsecurrentWebsite.activityInfoOfSessionInWebsite -> any ( siw | siw.sessionWithInfoAbout =

self ).explicitReadyToCompareProductendif

[2] ActivityInfoOfSessionInStoreView :: recentlyComparedProduct are the explicit recently com-pared products, if the catalog configuration sets its scope to StoreView, or the website’s recentlycompared products otherwise.

Context ActivityInfoOfSessionInStoreView :: recentlyComparedProduct : Set(Product)body:

let currentWebsite : Website = self.sessionWithInfoAbout.storeView.store.website inif currentWebsite.CatalogConfigurationInWebsite.recentlyViewedComparedProductsScope =

Scope::StoreView thenself.explicitRecentlyComparedProduct

elsecurrentWebsite.activityInfoOfSessionInWebsite -> any ( siw | siw.sessionWithInfoAbout =

self ).explicitRecentlyComparedProductendif

[3] ActivityInfoOfSessionInStoreView :: readyRecentlyViewedProduct are the explicit ready tocompare products, if the catalog configuration sets its scope to StoreView, or the website’s recentlyviewed products otherwise.

Context ActivityInfoOfSessionInStoreView :: readyRecentlyViewedProduct : Set(Product)body:

let currentWebsite : Website = self.sessionWithInfoAbout.storeView.store.website inif currentWebsite.CatalogConfigurationInWebsite.recentlyViewedComparedProductsScope =

Scope::StoreView thenself.explicitRecentlyViewedProduct

elsecurrentWebsite.activityInfoOfSessionInWebsite -> any ( siw | siw.sessionWithInfoAbout =

self ).explicitRecentlyViewedProductendif

n Constraints

[1] No wished products are registered if the wish list is not enabled for this website.

Context ActivityInfoOfCustomerInWebsite :: definesWishedProductsOnlyIfAllowed() : Booleanbody: self.websiteWithInfoAbout.wishlistConfigurationInWebsite.status = Status::Disabled impliesself.wishedProduct -> isEmpty()

[2] A ready to compare product can not match with any recently compared product.

Context ActivityInfoOfSessionInStoreView :: hasNotMatchingComparedAndRecentlyComparedProd-ucts() : Booleanbody: self.recentlyComparedProduct -> excludesAll ( self.readyToCompareProduct )

110

Page 112: Magento Conceptual Schema

[3] A ready to compare product can not match with any recently compared product.

Context ActivityInfoOfCustomerInStoreView :: hasNotMatchingComparedAndRecentlyComparedProd-ucts() : Booleanbody: self.recentlyComparedProduct -> excludesAll ( self.readyToCompareProduct )

[4] A ready to compare product can not match with any recently compared product.

Context ActivityInfoOfCustomerInWebsite :: hasNotMatchingComparedAndRecentlyComparedProd-ucts() : Booleanbody: self.recentlyComparedProduct -> excludesAll ( self.readyToCompareProduct )

[5] The number of uses of the ’Tell to a friend’ feature is not greater than the maximum usesallowed by the system configuration.

Context ActivityInfoOfSessionInStoreView :: hasNotUsedTellToAFriendTooMuch() : Booleanbody: self.usesOfTellToFriendInLastHour <= self.storeViewWithInfoAbout.tellToAFriendConfigura-tionInStoreView.maxUsesPerHour

[6] The customer’s saved number of uses of the ’Tell to a friend’ feature is not greater than themaximum uses allowed by the system configuration.

Context ActivityInfoOfCustomerInStoreView :: hasNotUsedTellToAFriendTooMuch() : Booleanbody: self.usesOfTellToFriendInLastHour <= self.storeViewWithInfoAbout.tellToAFriendConfigura-tionInStoreView.maxUsesPerHour

n Description

When a customer, either registered or not, uses the system, some information about hisactivity is generated: it is called the activity info of the session:

• readyToCompareProducts: Magento offers a useful feature to quickly compare prod-uct attribute information in a side-by-side view. Those are the products the Customerchoose to compare.

• recentlyComparedProducts: the products that the customer has recently removedfrom the ready to compare list.

• recentlyViewedProducts: the products for which the customers have recently viewedthe page.

When a registered Customer goes offline, its last activity info is saved to be restored thenext time he returns online.

The activity info can be shared at the website or the store view level, depending on theCatalog Configuration settings.

The system also keeps track of

• usesOfTellToAFriendInLastHour: the number of times the customer has used theTell to a friend feature in the last hour.

• wishedProducts: designated by registered customers to indicate that they wish topurchase them (or have someone purchase for them) at a later date. A comment canbe added by the Customer, explaining why does he wish that item.

• productSubscribedForPriceAlert: customers will receive an e-mail when the priceof this product is changed.

• productSubscribedForStockAlert: customers will receive an e-mail when this prod-uct goes back in stock.

111

Page 113: Magento Conceptual Schema

Wishlist and product alerts are only allowed for registered customers, while the uses of tellto friend are resetted when the corresponding session is closed.

112

Page 114: Magento Conceptual Schema

2.7.4 Newsletters

n Overview

Magento allows store owners to send emails and product notifications to customers.

n Schema Diagram

n Derivation Rules

[1] NewsletterSubscription :: email is the provided email, if it is defined, or the customer’s ownemail, otherwise.

Context NewsletterSubscription :: email : Emailbody:

113

Page 115: Magento Conceptual Schema

if self.oclIsTypeOf(AnonymousNewsletterSubscription) thenself.oclAsType(AnonymousNewsletterSubscription).providedEMail

else if not(self.providedEMail.isUndefined()) thenself.oclAsType(CustomerNewsletterSubscription).providedEMail

elseself.oclAsType(CustomerNewsletterSubscription).customer.email

endif

n Constraints

[1] Newsletter templates are identified by its name.

Context NewsletterTemplate :: isIdentifiedByItsName() : Booleanbody: NewsletterTemplate.allInstances() -> isUnique (name)

[2] Newsletters are identified by its subject and message.

Context Newsletter :: isIdentifiedByItsSubjectAndMessage() : Booleanbody: Newsletter.allInstances() -> isUnique (Setsubject,message)

[3] Newsletters are identified by its email and store view.

Context AnonymousNewsletterSubscription :: isIdentifiedByItsEmailAndStoreView() : Booleanbody: AnonymousNewsletterSubscription.allInstances() -> isUnique (Tuplec:eMail,s:storeView)

[4] Newsletters are identified by its customer and store view.

Context CustomerNewsletterSubscription :: isIdentifiedByItsCustomerAndStoreView() : Booleanbody: CustomerNewsletterSubscription.allInstances() -> isUnique (Tuplec:customer,s:storeView)

[5] A customer could not have two newsletter subscriptions from the same store view.

Context Customer :: isNotSubscribedTwiceInAStoreView() : Booleanbody: self.customerNewsletterSubscription -> isUnique (storeView)

[6] A newsletter can not have been sended to more customers or visitors than the total subscrip-tions that are made to it.

Context Newsletter :: hasTheCorrectProcessedSendings() : Booleanbody: self.processedSendigs <= self.storeView.newsletterSubscription -> asSet() -> size()

n Description

Customers, registered or not, can subscribe themselves to the store newsletter.

• email: the email address where the newsletter will be sent. Registered customers canoptionally specify a different email address, if not its own address is taken.

• status: the subscription can be temporally disabled, without deleting the subscriptioninformation.

To start sending newsletters, Newsletter Templates should be created first. Those are itsproperties:

• name: the template’s name.

• subject: the subject of the email that will be sent to your customers for a newsletterusing this template.

114

Page 116: Magento Conceptual Schema

• senderName: the name of the sender of the email that will be sent to your customersfor a newsletter using this template.

• senderEmail: the email address of the sender of the email that will be sent to yourcustomers for a newsletter using this template.

• message: the body of your email for a newsletter using this template.

• createdAt: the time the template was created.

• lastUpdatedAt: the last time the template was updated.

The newsletter is created from a template. The name, subject and sender name andemail are generally suposed to be the same, but can be changed. Additional properties aredefined:

• queueStartedAt: the time the system will start sending the newsletter. If not defined,the system starts sending the newsletter from the moment it is created.

• processedSendings: the number of customers or visitors where the newsletter hasbeen sent.

• storeView: this newsletter will be sent to all the customers or visitors that have beensubscribed for the newsletter at this store view.

• status

A newsletter problem reports a problem that the system had sending the newsletter. Ma-gento saves the newsletter where this error has been produced and, if needed, the corre-sponding subscription. For example, a newsletter sent to an erroneous e-mail address willappear here.

• id: identifies the problem report.

• code: identifies the type of error that have been succeded.

• text: a human friendly explanation of the error.

115

Page 117: Magento Conceptual Schema

2.8 Online Catalog

2.8.1 Shopping Carts

n Overview

Customers can add or remove products from their shopping carts while they are navigatingthe online store.

n Schema Diagram

n Derivation Rules

[1] ShoppingCart :: total the amount the customer will pay for all products in the shopping cart.

Context ShoppingCart :: total : Integerbody: self.shoppingCartItem.total -> sum()

[2] ShoppingCart :: currentStoreView Is the store view that will be used to calculate the pricesand discounts that will be applied to the purchased items.

Context ShoppingCart :: currentStoreView : StoreViewbody:

if self.oclIsTypeOf(AnonymousShoppingCart) thenself.oclAsType(AnonymousShoppingCart).anonymousSession.storeView

else if self.oclIsTypeOf(CustomerShoppingCart) thenself.oclAsType(CustomerShoppingCart).customer.customerSession.storeView

116

Page 118: Magento Conceptual Schema

elseself.oclAsType(AdministrationShoppingCart).storeView

endif endif

[3] ShoppingCart :: purchasingCurrency Is the currency used to buy the products in the shoppingcart.

Context ShoppingCart :: purchasingCurrency : Currencybody:

if self.oclIsTypeOf(AnonymousShoppingCart) thenself.oclAsType(AnonymousShoppingCart).anonymousSession.currentCurrency

else if self.oclIsTypeOf(CustomerShoppingCart) thenself.oclAsType(CustomerShoppingCart).customer.customerSession.currentCurrency

elseself.oclAsType(AdministrationShoppingCart).currency

endif endif

[4] ShoppingCart :: customerGroup will be used to define some characteristics (as taxes) thataffect the final amount that the user will pay for this products. For Anonymous Shopping Cartsthe "Not Logged In" group is applied, while Customer Shopping Carts use the group of its relatedcustomer. For Administration Shopping Carts, the group is explicitly selected.

Context ShoppingCart :: customerGroup : CustomerGroupbody:

if self.oclIsTypeOf(AnonymousShoppingCart) thenCustomerGroup.allInstances() -> any ( c | c.name = ’NotLoggedIn’ )

else if self.oclIsTypeOf(CustomerShoppingCart) thenself.oclAsType(CustomerShoppingCart).customer.customerGroup

elseif self.oclAsType(AdministrationShoppingCart).redefinedCustomerGroup -> notEmpty() then

self.oclAsType(AdministrationShoppingCart).redefinedCustomerGroupelse

self.oclAsType(AdministrationShoppingCart).customer.customerGroupendif

endif endif

[5] AdministrationShoppingCart :: customerEMail Is the redefined customer eMail, if defined, orthe eMail of the associated customer.

Context AdministrationShoppingCart :: customerEMail : EMailbody:

if self.redefinedCustomerEMail.isDefined() thenself.redefinedCustomerEMail

else self.customer.eMail endif

n Constraints

[1] An anonymous shopping cart is identified by its anonymous session.

Context AnonymousShoppingCart :: isIdentifiedByItsAnonymousSession() : Booleanbody: AnonymousShoppingCart.allInstances() -> isUnique(anonymousSession)

[2] A customer shopping cart is identified by its customer.

Context CustomerShoppingCart :: isIdentifiedByItsCustomer() : Booleanbody: CustomerShoppingCart.allInstances() -> isUnique(customer)

[3] An administration shopping cart is identified by its customer, the store view where is placedand the administrator who places it.

Context AdministrationShoppingCart :: isIdentifiedByItsCustomerStoreViewAndAdministrator() : Booleanbody: AdministrationShoppingCart.allInstances() -> isUnique(Setcustomer, storeView, administra-tor)

117

Page 119: Magento Conceptual Schema

[4] The shopping cart was not created in the future.

Context CustomerShoppingCart :: hasACorrectCreatedAtDate() : Booleanbody: self.createdAt <= Now()

[5] The time the user did his last update on the shopping cart should be between the time theshopping cart was created and now.

Context CustomerShoppingCart :: hasACorrectUpdatedAtDate() : Booleanbody: self.updatedAt >= self.createdAt and self.updatedAt <= Now()

n Description

Shopping Carts contain the products chosen by customers from the online catalog.

A Shopping Cart is anonymous until the Customer logs in. At this moment, if the Customerdidn’t have a previous Customer Shopping Cart, the Anonymous Shopping Cart becomesa Customer Shopping Cart. Otherwise, the anonymous Shopping Cart is removed from thesystem and their Products are added to the previous Customer Shopping Cart.

If a Customer leaves a Session with a non-empty Customer Shopping Cart, then the cartwill be automatically restored in his next session. Moreover, Anonymous Shopping Cartscan only exist in the context of a Session, and they are automatically removed when theSession expires.

Administration Shopping Carts are used when Administrators use the system to register anOrder for a Customer, that has normally asked for it in an offline way. The prices, discountsand taxes will be calculated as if the Order was placed using the specified store view.

In addition of the derived attributes, which are described by its derivation rules, Magentosaves the following information about Shopping Carts:

• giftMessage: a message that will be delivered to the person that receives the productsadded to the cart, if an order for it is finally placed.

• couponCode: a literal code that can enable the application of a Shopping Cart PriceRule that matches it.

For Customer Shopping Carts, the following information is also saved:

• createdAt: the time the cart was created.

• updatedAt: the last time a product was added, edited or removed from the shoppingcart.

When an order corresponding to a Shopping Cart is confirmed, the Shopping Cart isremoved from the system.

118

Page 120: Magento Conceptual Schema

2.8.2 Shopping Cart Items

n Overview

Each different Product added to a Shopping Cart is a Shopping Cart Item.

n Schema Diagram

n Operations

[1] context ShoppingCartItem def: calculateNetPrice (currentProduct : Product) : Money =

currentProduct.productInWebsite -> any ( piw | piw.website = self.shoppingCart.currentStoreView.-store.website).netPrice

[2] context ShoppingCartItem def: calculateSpecialNetPrice (currentProduct : Product) : Money =

letproductInTheCurrentWebsite:ProductInWebsite = currentProduct.productInWebsite -> any (

piw | piw.website = self.shoppingCart.currentStoreView.store.website)

119

Page 121: Magento Conceptual Schema

inlet

productInTheCurrentStoreView:ProductInStoreView = currentProduct.productInStoreView -> any ( pisv | pisv.storeView = self.shoppingCart.currentStoreView)

inif

productInTheCurrentWebsite.specialNetPrice.isDefined() andproductInTheCurrentStoreView.specialNetPriceFrom.isDefined() andproductInTheCurrentStoreView.specialNetPriceUntil.isDefined() andproductInTheCurrentStoreView.specialNetPriceFrom <= Now(); andproductInTheCurrentStoreView.specialNetPriceUntil >= Now();

then productInTheCurrentWebsite.specialNetPrice endif

[3] context ShoppingCartItem def: calculateTieredPrice (currentProduct : Product) : Money =

let applicableTierPrices:Set(TierPrice) =self.shoppingCart.currentStoreView.store.website.tierPrice -> select ( tp |

tp.product = currentProduct and tp.quantity <= self.quantity)

inapplicableTierPrices-> any ( tp | applicableTierPrices -> forAll ( tp1 | tp.quantity >= tp1.quantity

) ).oclAsType(FixedTierPrice).price

[4] context ShoppingCartItem def: calculateCatalogRulesPrice (currentProduct : Product, applied-CatalogPriceRules : CatalogPriceRule) : Money =

let netPrice: Money = calculateNetPrice( currentProduct ) inself.calculateCatalogRulesPriceRecursively(netPrice, appliedCatalogPriceRules)

[5] context ShoppingCartItem def: calculateCatalogRulesPriceRecursively (originalPrice : Money,appliedCatalogPriceRules : CatalogPriceRule) : Money =

let morePrioritaryRule: CatalogPriceRule =appliedCatalogPriceRules -> any ( r | appliedCatalogPriceRules -> forAll ( r1 | r.priority <=

r1.priority) )in

let calculatedPrice:Money =if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::SetAsFixed then

morePrioritaryRule.amountelse if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::SubstractFixed then

originalPrice - morePrioritaryRule.amountelse if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::SetAsPercentage

thenoriginalPrice * morePrioritaryRule.amount

elseoriginalPrice * (1 - morePrioritaryRule.amount)

endif endif endifin

if appliedCatalogPriceRules -> isEmpty() thenoriginalPrice

else elseself.calculateCatalogRulesPriceRecursively(calculatedPrice,appliedCatalogPriceRules -

> excluding(morePrioritaryRule))endif

[6] context ShoppingCartItem def: calculateOptionsIncrement (basePrice : Money) : Money =

self.optionValueInOption -> collect ( ovio |if ovio.sign = Sign::Plus then

if ovio.fixedIncrement.isDefined() then ovio.fixedIncrement else basePrice * ovio.relativeIn-crement endif

elseif ovio.fixedIncrement.isDefined() then -ovio.fixedIncrement else - (basePrice * ovio.rela-

tiveIncrement) endifendif

) -> sum() +self.textOption -> union(self.dateOption) -> collect ( op |

if op.sign = Sign::Plus then

120

Page 122: Magento Conceptual Schema

if op.fixedIncrement.isDefined() then op.fixedIncrement else basePrice * op.relativeIncre-ment endif

elseif op.fixedIncrement.isDefined() then -op.fixedIncrement else - (basePrice * op.relativeIn-

crement) endifendif

) -> sum()

[7] context ShoppingCartItem def: calculateDiscount (discountBasis : Money, appliedShopping-CartPriceRules : ShoppingCartPriceRule) : Money =

let morePrioritaryRule: ShoppingCartPriceRule =appliedShoppingCartPriceRules -> any ( r | appliedShoppingCartPriceRules -> forAll ( r1 |

r.priority <= r1.priority) )in

let calculatedDiscount:Money =if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::Percentage then

if morePrioritaryRule.discountQtyStep.isUndefined() then discountBasis * morePriori-taryRule.amount

else (discountBasis / self.quantity) * ((self.quantity / morePrioritaryRule.discountQtyStep).floor()* morePrioritaryRule.discountQtyStep) * morePrioritaryRule.amount

endifelse if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::Fixed then

morePrioritaryRule.amount * self.quantityelse if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::FixedForWholeCart

thenif self.shoppingCart.shoppingCartItem->excluding(self).appliedShoppingCartPriceRule->

excludes(morePrioritaryRule) then morePrioritaryRule.amountelse 0.0endif

else if morePrioritaryRule.method = ShoppingCartRuleDiscountMethod::BuyXGetY then(discountBasis / self.quantity) * (self.quantity/(morePrioritaryRule.discountQtyStep + morePri-

oritaryRule.amount)).floor() +(self.quantity.mod((morePrioritaryRule.discountQtyStep + morePrioritaryRule.amount).floor()) -

morePrioritaryRule.discountQtyStep).max(0)endif endif endif

inif appliedShoppingCartPriceRules -> isEmpty() then

0.0else else

calculatedDiscount + self.calculateDiscount(discountBasis, appliedShoppingCartPriceRules-> excluding(morePrioritaryRule))

endif

n Derivation Rules

[1] ShoppingCartItem :: basePrice is the unitary price of the product in the website the ShoppingCart is placed, taking into account the special net price, tier prices and catalog price rules.

Context ShoppingCartItem :: basePrice : Moneybody:

self.calculateNetPrice(self.product).min( self.calculateSpecialNetPrice( self.product )).min( self.calculateTieredPrice(self.product)).min( self.calculateCatalogRulesPrice( self.product, self.appliedCatalogPriceRule))

[2] ShoppingCartItem :: calculatedPrice is the unitary price of the product taking into account thebase price and the custom options selected

Context ShoppingCartItem :: calculatedPrice : Moneybody: self.basePrice + self.calculateOptionsIncrement( self.basePrice )

[3] ShoppingCartItem :: price is the price the customer pays for a unit of the product withoutadding taxes, shipping costs or discounts.

121

Page 123: Magento Conceptual Schema

Context ShoppingCartItem :: price : Moneybody:

if self.customPrice.isDefined() then self.customPriceelse self.calculatedPrice endif

[4] ShoppingCartItem :: discount is the total amount able to be discounted from the set of prod-ucts purchased of this shopping cart item, determined by shopping cart price rules.

Context ShoppingCartItem :: discount : Moneybody: self.calculateDiscount( self.price * self.quantity, self.appliedShoppingCartPriceRule )

[5] ShoppingCartItem :: total is the unitary cost of this product multiplied by the quantity added tothe shopping cart, minus the discount.

Context ShoppingCartItem :: total : Integerbody:

if self.applyDiscount then self.price * self.quantity - self.discountelse self.price * self.quantityendif

[6] ShoppingCartItem :: appliedShoppingCartPriceRule are the shopping cart price rules that areapplied to the current shopping cart item.

Context ShoppingCartItem :: appliedShoppingCartPriceRule : Set(ShoppingCartPriceRule)body:

let applicableRules: Set(ShoppingCartPriceRule) =ShoppingCartPriceRule.allInstances() -> select ( scr |

scr.status = Status::Enabled andscr.verifyForShoppingCart(self.shoppingCart) andscr.verifyItemLevelConditionForShoppingCart(self) andscr.website -> includes( currentSession.storeView.store.website ) andscr.customerGroup -> includes( currentSession().customerGroup() ) andscr.maxUses.isDefined() implies scr.timesUsed < scr.maxUses andscr.maxUsesPerCustomer.isDefined() implies scr.useOfShoppingCartPriceRule -> any ( use |

use.customer = self.shoppingCart.customer).timesUsed < scr.maxUsesPerCustomer andscr.inEffectFrom.isDefined() implies scr.inEffectFrom <= Now() andscr.inEffectUntil.isDefined() implies scr.inEffectUntil >= Now() andscr.couponCode.isDefined() implies self.shoppingCart.couponCode = scr.couponCode

)in

applicableRules -> select ( r | applicableRules->excluding(r) -> forAll ( r1 |r1.priority > r.priority implies r1.stopFurtherRules=false

) )

[7] ShoppingCartItem :: appliedCatalogPriceRule are the catalog price rules that are applied tothe current shopping cart item.

Context ShoppingCartItem :: appliedCatalogPriceRule : Set(CatalogPriceRule)body:

let applicableRules: Set(ShoppingCartPriceRule) =CatalogPriceRule.allInstances() -> select ( scr |

scr.status = Status::Enabled andscr.verifyConditionForShoppingCart(self.shoppingCart) andscr.website -> includes( currentSession().storeView.store.website ) andscr.customerGroup -> includes( currentSession().customerGroup() ) andscr.inEffectFrom.isDefined() implies scr.inEffectFrom <= Now() andscr.inEffectUntil.isDefined() implies scr.inEffectUntil >= Now() and

)in

applicableRules -> select ( r | applicableRules->excluding(r) -> forAll ( r1 |r1.priority > r.priority implies r1.stopFurtherRules=false

) )

122

Page 124: Magento Conceptual Schema

n Constraints

[1] Shopping cart items are identified by its product, the cart it belongs to and the eventual optionschoosen.

Context ShoppingCartItem :: isIdentifiedByItsProductItsCartAndItsOptions() : Booleanbody:

let textOp: Bag(TupleType(o:TextOption,v:String)) =self.textOptionRating -> collect(t|Tuplet=t.textOption,v=t.value)

inlet dateOp: Bag(TupleType(o:DateOption,v:Date)) =

self.dateOptionRating -> collect(t|Tuplet=t.dateOption,v=t.value)in

ShoppingCartItem.allInstances() -> isUnique(Tuples=shoppingCart,p=product,t=textOp,d=dateOp,v=optionValueInOption)

[2] If the shopping cart item does not belong to an administration shopping cart, the custom priceis undefined and the discount is always applied.

Context ShoppingCartItem :: definesCustomPriceAndApplyDiscountCorrectly() : Booleanbody:

(not self.shoppingCart.oclIsTypeOf(AdministrationShoppingCart)) implies(self.customPrice.isUndefined() and self.applyDiscount)

[3] The rated Text and Date Options and the selected Option Values belong to the product addedin this Shopping Cart Item.

Context ShoppingCartItem :: ratesOnlyOptionsOfItsProduct() : Booleanbody:

self.textOption -> forAll(to|to.product = self.product) andself.dateOption -> forAll(dop|dop.product = self.product) andself.optionValueInOption -> forAll(ovio|ovio.optionWithPredefinedContent.product = self.product)

[4] If the option is required, all Shopping Cart Items that add its related Product must give a valueto it.

Context Option :: isRatedWhenItIsNeeded() : Booleanbody:

self.isRequired implies (if self.oclIsTypeOf(OptionWithPredefinedContent) then

self.product.shoppingCartItem -> forAll ( i | i.optionValueInOption -> exists (ovio|ovio.option-WithPredefinedContent = self))

else if self.oclIsTypeOf(TextOption) thenself.product.shoppingCartItem -> forAll ( i | i.textOption -> exists (to|to = self))

elseself.product.shoppingCartItem -> forAll ( i | i.dateOption -> exists (dop|dop = self))

endif endif)

[5] If its section type is single, a Shopping Cart Item can not assign more than one value to theoption.

Context OptionWithPredefinedContent :: isRatedWithOnlyOneValueWhenItIsNeeded() : Booleanbody:

self.selectionType = SelectionType::Single implies self.optionValueInOption -> forAll ( ov1, ov2 |ov1 <> ov2 implies ov1.shoppingCartItem <> ov2.shoppingCartItem

)

[6] All products in the shopping cart should be enabled, in stock and available in the current web-site.

Context ShoppingCartItem :: hasOnlyAProductAbleToBeBougth() : Booleanbody:

self.product.productInStoreView -> any ( piw |

123

Page 125: Magento Conceptual Schema

piw.storeView = self.shoppingCart.currentStoreView).status = Status::Enabled andself.product.productInWebsite -> any ( piw |

piw.website = self.shoppingCart.currentStoreView.store.website).isAvailable andself.product.stockStatus = #InStock

n Description

A Shopping Cart Item has the following attributes:

• quantity: the number of items puchased of this product.

• giftMessage: a message that will be delivered to the person that receives the productsadded in this Shopping Cart Item.

• basePrice: the unitary price of the product in the website the Shopping Cart is placed,taking into account the special net price, tier prices and catalog price rules. DerivedAttribute.

• calculatedPrice: the unitary price of the product taking into account the base priceand the custom options selected. Derived Attribute.

• customPrice: a different price that can be optionally applied for this Shopping CartItem, instead of applying the product’s price.

• price: the unitary price of the product taking into account the calculated price and thecustom price. No taxes, discounts or shipping costs are added yet. Derived Attribute.

• discount: the global amount able to be discounted from the set of products added inthis Shopping Cart Item, determined by shopping cart price rules. Derived Attribute.

• applyDiscount: determines if discount defined above will be applied or not.

• total: the total cost of this Shopping Cart Item. Derived Attribute.

If the product purchased in this Shopping Cart Item has options, its values are specified inthe item itself: text and date options are rated, while an option value is choosen for OptionsWith Predefined Content. Thus, Products with different Options configuration are added tothe Shopping Cart as different Shopping Cart Items.

124

Page 126: Magento Conceptual Schema

2.8.3 Shopping cart items of non-simple products

n Overview

Shopping Cart Items of Downloadable, Configurated or Bundle Products need to save ad-ditional information.

n Schema Diagram

n Derivation Rules

125

Page 127: Magento Conceptual Schema

[1] SCItemOfADownloadableProduct :: calculatedPrice is the unitary price of the product takinginto account the base price, the custom options selected and increments due to the purchasedDownloadable Items.

Context SCItemOfADownloadableProduct :: calculatedPrice : Moneybody:

if self.downloadableProduct.purchaseItemsSeparatelly = Status::Enabled thenself.basePrice + self.calculateOptionsIncrement( self.basePrice )

elseself.downloadableItem -> collect ( dw |

if dw.sign = Sign::Plus thenif dw.fixedIncrement.isDefined() then dw.fixedIncrement else self.basePrice * dw.rela-

tiveIncrement endifelse

if dw.fixedIncrement.isDefined() then -dw.fixedIncrement else - (self.basePrice * dw.-relativeIncrement) endif

endif) -> sum() + self.basePrice + self.calculateOptionsIncrement( self.basePrice )

endif

[2] SCItemOfAConfiguratedProduct :: basePrice the base price of the configurable product (notthe configurated).

Context SCItemOfAConfiguratedProduct :: basePrice : Moneybody:

self.calculateNetPrice( self.configurableProduct ).min( self.calculateSpecialNetPrice( self.configurableProduct ) ).min( self.calculateTieredPrice( self.configurableProduct ) ).min( self.calculateCatalogRulesPrice( self.configurableProduct, self.catalogPriceRuleOfConfig-

urableProduct ) )

[3] SCItemOfAConfiguratedProduct :: calculatedPrice the unitary price of the product taking intoaccount the base price, the custom options selected and the increments due to the Configurationchosen.

Context SCItemOfAConfiguratedProduct :: calculatedPrice : Moneybody:

self.configuratedProduct.configurationOfAConfigurableProduct -> collect ( cpa |if cpa.sign = Sign::Plus then

if cpa.fixedIncrement.isDefined() then cpa.fixedIncrement else self.calculateBasePrice() *cpa.relativeIncrement endif

elseif cpa.fixedIncrement.isDefined() then -cpa.fixedIncrement else - (self.calculateBasePrice()

* cpa.relativeIncrement) endifendif

) -> sum() + self.calculateBasePrice() + self.calculateOptionsIncrement( self.basePrice )

[4] PurchaseOfABundleProductOption :: basePriceOfBundleProductOption is the base price, inthe current website, of the product purchased as a bundle option (as it was purchased alone).

Context PurchaseOfABundleProductOption :: basePriceOfBundleProductOption : Moneybody:

self.calculateNetPrice( self.bundleProductOption.product )-> min( self.calculateSpecialNetPrice( self.bundleProductOption.product ) )-> min( self.calculateTieredPrice( self.bundleProductOption.product, self.quantity ) )-> min( self.calculateCatalogRulesPrice( self.bundleProductOption.product, self.catalogPriceRule-

OfBundleProduct ) )

[5] SCItemOfABundleProduct :: bundlePrice is the unitary price of the product taking into accountthe products purchased as Bundle Options and, if present, the custom options selected, in thecurrent website

Context SCItemOfABundleProduct :: bundlePrice : Moneybody:

if self.bundleProduct.priceMethod = PriceMethod::Dynamic then

126

Page 128: Magento Conceptual Schema

self.purchaseOfABundleProductOption -> collect ( p | p.quantity * p.basePriceOfBundlePro-ductOption ) -> sum()

elseself.purchaseOfABundleProductOption -> collect ( pbpo | pbpo.quantity * (

if pbpo.bundleProductOption.sign = Sign::Plus thenif pbpo.bundleProductOption.fixedIncrement.isDefined() then pbpo.bundleProductOption.-

fixedIncrement else self.calculateNetPrice(self.bundleProduct) * pbpo.bundleProductOption.relativeIn-crement endif

elseif pbpo.bundleProductOption.fixedIncrement.isDefined() then -pbpo.bundleProductOp-

tion.fixedIncrement else - (self.calculateNetPrice(self.bundleProduct) * pbpo.bundleProductOption.-relativeIncrement) endif

endif) ) -> sum()

+ self.calculateNetPrice( self.bundleProduct )+ self.calculateOptionsIncrement( calculateNetPrice(self.bundleProduct) )endif

[6] SCItemOfABundleProduct :: calculatedPrice is the unitary price of the product taking intoaccount the bundle price and the reductions due to special and tiered prices.

Context SCItemOfABundleProduct :: calculatedPrice : Moneybody:

let specialBundlePrice: Real =let bundleProductInTheCurrentWebsite:BundleProductInWebsite = self.bundleProduct.bundlePro-

ductInWebsite -> any ( piw | piw.websiteWhereIsSpecifiedAsBundleProduct = self.shoppingCart.cur-rentStoreView.store.website) in

let productInTheCurrentStoreView:ProductInStoreView = self.bundleProduct.productInStore-View -> any ( pisv | pisv.storeView = self.shoppingCart.currentStoreView) in if

bundleProductInTheCurrentWebsite.specialNetPriceReduction.isDefined() andproductInTheCurrentStoreView.specialNetPriceFrom.isDefined() andproductInTheCurrentStoreView.specialNetPriceUntil.isDefined() andproductInTheCurrentStoreView.specialNetPriceFrom <= Now() andproductInTheCurrentStoreView.specialNetPriceUntil >= Now()

thenbundlePrice * bundleProductInTheCurrentWebsite.specialNetPriceReduction

elsebundlePrice

endifin

let applicableTierPrices:Set(TierPrice) =self.shoppingCart.currentStoreView.store.website.tierPrice -> select ( tp | tp.product = cur-

rentProduct and tp.quantity <= quantity)in

let tieredBundlePrice: Money = bundlePrice * applicableTierPrices-> select ( tp | applica-bleTierPrices -> forAll ( tp1 | tp.quantity >= tp1.quantity ) ).percentage in

bundlePrice.min( specialBundlePrice ).min( tieredBundlePrice ).min( self.calculateCatalogRulesPrice( self.bundleProductOption.product, self.catalogPriceRule-

OfBundleProduct ) )

n Constraints

[1] The downloadable items of the order line are downloadable items of the purchased download-able product.

Context SCItemOfADownloadableProduct :: hasTheCorrectDownloadItems() : Booleanbody: self.downloadableProduct.downloadableItem -> includesAll( self.downloadableItem )

[2] If the downloadable product does not allow to puchase its items separatelly, all downloadableitems are purchased.

Context SCItemOfADownloadableProduct :: hasAllDownloadItemsWhenNeeded() : Boolean

127

Page 129: Magento Conceptual Schema

body: self.downloadableProduct.purchaseItemsSeparatelly = Status::Enabled implies self.down-loadableItem -> includesAll( self.downloadableProduct.downloadableItem )

[3] A purchase of a downloadable item has not been downloaded more times than the maximumallowed by the downloadable item configuration and the website configuration.

Context PurchaseOfADownloadableItem :: hasNotMadeMoreDownloadsThanPermitted() : Booleanbody:

let maximumDownloadCountOfWebsite: PositiveInteger = self.SCItemOfADownloadableProd-uct.order.storeView.store.website.catalogConfigurationInWebsite.maximumDownloadCount

inself.downloadableItem.maximumDownloadCount.isDefined() implies self.downloadCount <=

self.downloadableItem.maximumDownloadCount andmaximumDownloadCountOfWebsite.isDefined() implies self.downloadCount <= maximumDown-

loadCountOfWebsite

[4] A Shopping Cart Item is not directly associated to a configurable or grouped product.

Context ShoppingCartItem :: doesNotPurchaseConfigurableBundleOrGroupedProductsDirectly() :Booleanbody:not ( self.product -> oclIsTypeOf(ConfigurableProduct) or self.product -> oclIsTypeOf(GroupedProduct)or self.product -> oclIsTypeOf(BundleProduct) )

[5] The configurated product purchased is one of the associated products of the configurableproduct it has been purchaset through.

Context SCItemOfAConfiguratedProduct :: hasACorrectConfigurableProduct() : Booleanbody: self.configurableProduct.associatedProduct -> includes( self.configuratedProduct )

[6] The bundle product options chosen are options available of the purchased bundle product.

Context SCItemOfABundleProduct :: hasTheCorrectBundleProductOptions() : Booleanbody: self.bundleProduct.bundleProductItem.bundleProductOption -> includesAll( self.bundlePro-ductOption )

n Description

A Shopping Cart Item Of a Downloadable Product must specify which downloadable itemshave been purchased. The selected items will affect its base price. For each item, thesystem saves:

• downloadCount: the number of times the item has been downloaded.

• calculatedPrice: an amount which includes not only the custom option price incre-ments, but also the increments due to the purchased Downloadable Items.

Shopping Cart Items of a Configurated Product must know the information about:

• configurableProduct: the Configurable Product this product has been bought through.-

• catalogPriceRuleOfConfigurableProduct: the catalog price rules applied to the con-figurable product (not the configurated).

• basePrice: the base price of the configurable product (not the configurated).

• calculatedPrice: an amount which includes not only the custom option price incre-ments, but also the increments due to the Configuration chosen.

128

Page 130: Magento Conceptual Schema

The base price of a Shopping Cart Item Of a Configurated Product will be calculated takinginto account the base price of the Configurable Product and the increments defined in thecorresponding Configuration of the Configurable Product.

An Shopping Cart Item Of a Bundle Product must specify:

• bundlePrice: an amount taking into account the price method of the Bundle Productand the increments due to the products purchased as Bundle Options.

• calculatedPrice: an amount which includes not only the bundle price, but also thereductions due to special reductions, relative tiered prices and catalog price rules.

For each bundle product option, the following attributes must be also specified:

• quantity: the purchased quantity of this product.

• basePriceOfBundleProductOption: the base price of the product associated to theselected bundle product option.

The bundle price of an Shopping Cart Item Of a Bundle Product will be calculated de-pending on the price method defined by the Bundle Product. Finally, the base price of theShopping Cart Item will be calculated by applying to the Bundle Net Price the reductionsdue to specialNetPrice, tieredPrice and Catalog Price Rules.

n Price calculation process

The price calculation process can be informally represented by the following schema.

129

Page 131: Magento Conceptual Schema

130

Page 132: Magento Conceptual Schema

2.8.4 Orders

n Overview

Orders are the confirmation that a customer wants to buy the contents of its shopping cart.

n Schema Diagram

131

Page 133: Magento Conceptual Schema

n Derivation Rules

[1] Order :: purchased is the Date and Time when the order was placed

Context Order :: purchased : DateTimebody: Now()

[2] Order :: shippingCosts are the costs derived from the used shipping method.

Context Order :: shippingCosts : Moneybody: self.shippingMethod.shippingMethodInWebsite -> select ( smiw | smiw.website = self.store-View.store.website).calculateCost( self.orderLine, self.delivery )

[3] Order :: total its the total cost the user will pay for the products ordered, including its shippingcosts.

Context Order :: total : Moneybody: self.orderLine.total -> sum() + self.shippingCosts

[4] Order :: name is the first and last name of the order’s customer.

Context Order :: name : Stringbody: self.customer.firstName.concat( self.customer.lastName )

[5] Order :: eMail is the email of the order’s customer.

Context Order :: eMail : Stringbody: self.customer.eMail

[6] Order :: websiteName its the name of the website where the order has been placed.

Context Order :: websiteName : Moneybody: self.storeView.store.website.name

[7] Order :: storeName its the name of the store where the order has been placed.

Context Order :: storeName : Moneybody: self.storeView.store.name

[8] Order :: storeViewName its the name of the store view where the order has been placed.

Context Order :: storeViewName : Moneybody: self.storeView.name

n Constraints

[1] An order is identified by the customer that has place it, the store view where it has been madeand the time it was created.

Context Order :: isIdentifiedByItsCustomerStoreViewAndCreationDate() : Booleanbody: Order.allInstances() -> isUnique(Setcustomer,storeView,purchased)

[2] The products that appear in the order should be available in the website the store of the orderbelongs to.

132

Page 134: Magento Conceptual Schema

Context Order :: hasProductsFromTheCorrectStore() : Booleanbody: self.storeView.store.website.product.sku -> includesAll(self.orderLine.productSku -> asSet())

[3] An order with only virtual and downloadable products should not have shipping method andaddress defined, an order with any other type of product should.

Context Order :: hasShippingPropertiesOnlyWhenNeeded() : Booleanbody:

let products : Set(Product) =Product.allInstances() -> select(p|self.orderLine.productSku -> includes(p.sku))

inproducts -> forAll ( p | (p.oclIsTypeOf(VirtualProduct) or p.oclIsTypeOf(DownloadableProduct)

) =(self.delivery -> isEmpty() and self.shippingMethod -> isEmpty()) ).

[4] If an Order has been edited, so it has a newer version of itself, the older version should becancelled.

Context Order :: statusIsCancelledIfWasEdited() : Booleanbody: self.newVersion -> notEmpty() implies self.status = OrderStatus::Cancelled.

[5] If an Order is Pending, no invoices or shipments are made for it.

Context Order :: meetsPendingStatusConditions() : Booleanbody:

self.status = OrderStatus::Pending implies (self.invoice -> isEmpty() and self.shipment -> isEmpty()

)

[6] If an Order is Processing, some invoices are made for it, but not all possible.

Context Order :: meetsProcessingStatusConditions() : Booleanbody:

self.status = OrderStatus::Processing implies (self.invoice -> notEmpty() and self.invoice.invoiceLine.quantity -> sum() < self.orderLine.quan-

tity -> sum() andself.shipment -> notEmpty() and self.shipment.shipmentLine.quantity -> sum() < self.orderLine.-

quantity -> sum())

[7] If an Order is Complete, all possible invoices and shipments are made for it, but not all creditmemos..

Context Order :: meetsCompleteStatusConditions() : Booleanbody:

self.status = OrderStatus::Complete implies (self.invoice.invoiceLine.quantity -> sum() = self.orderLine.quantity -> sum() and

self.shipment.shipmentLine.quantity -> sum() = self.orderLine.quantity -> sum() andself.refund.refundLine.quantity -> sum() < self.orderLine.quantity -> sum())

[8] If an Order is Closed, credit memos cover all items ordered, which implies Invoices cover allitems also because of ’hasNotMoreRefundedProductsThanInvoiced’ constraint.

Context Order :: meetsClosedStatusConditions() : Booleanbody:

self.status = OrderStatus::Closed implies (self.refund.refundLine.quantity -> sum() = self.orderLine.quantity -> sum()

)

[9] If an Order is Cancelled, not all invoices and shipments can be already made for it.

133

Page 135: Magento Conceptual Schema

Context Order :: meetsCancelledAndHoldStatusConditions() : Booleanbody:

(self.status = OrderStatus::Cancelled or self.status = OrderStatus::Hold) implies (self.invoice.invoiceLine.quantity -> sum() < self.orderLine.quantity -> sum() and

self.shipment.shipmentLine.quantity -> sum() < self.orderLine.quantity -> sum())

n Description

When a Customer confirms that he wants to buy the contents of a Shopping Cart, thesystem generates an Order. Orders have the following information:

• name: the name of the customer who has placed the order. Derived Attribute.

• eMail: the order’s customer eMail. Several notifications concerning this Order will besent here. Derived Attribute.

• websiteName: the name of the website where the order has been placed. DerivedAttribute.

• storeName: the name of the store where the order has been placed. Derived At-tribute.

• storeViewName: the name of the store view where the order has been placed. De-rived Attribute.

• purchased: the time the Order was placed.

• couponCode: a literal code that can enable the application of a Shopping Cart PriceRule that matches it.

• eMailSent: indicates if an email has been sent to the order’s costumer to notice himthe invoice was recorded.

• giftMessage: a message that will be delivered to the person that receives the productspurchased in this order.

• shippingCosts: the amount that will be paid for shipping the purchased products tothe customer’s delivery address, using the selected shipping method.

• total: the total amount the customer will pay for this order. Derived Attribute.

The total invoiced, non reinvoiceable, paid, shipped and refunded amounts will be detailledin the following sections.

An Order has also a status attribute, that can take the following values:

• Pending: no invoices or shipments have been made for this Order.

• Processing: some invoices or shipments have been made for this Order, but they donot cover all its ordered products.

• Completed: the whole Order has been paid and shipped, but not all items had beenrefunded.

• Closed: the whole Order has been refunded (so, it had been already paid before).

• Cancelled: the Order has been cancelled., so all the items that had not been invoicedand/or shipped before are cancelled. Items already invoiced and/or shipped are notaffected. A completed or closed Order cannot be Cancelled.

• Hold: the Order is temporary holded, so no changes can be made to it until someoneunholds it.

Each different Product purchased in this Order is represented as an OrderLine. Orderlines will be detailed in the next section.

The entity type Order participates in several relationship types:

134

Page 136: Magento Conceptual Schema

• storeView: the storeView the costumer used to record this Order. If the order wascreated by and administrator, he should choose one store view. The website that storeview belongs to determines to which product list you will have access when creatingthe order and to which of the customer’s Buying Process Information lists you will haveaccess.

• customer: the Customer that has made the Order. If the customer does not havean account in the website store you have chosen is in, an account will be createdfor the customer in that website upon completion of the order, with all the customerinformation duplicated. A Guest (a not registered Costumer) can also make orderswithout registrating themselves. In this case, no Customer will be associated to theOrder.

• customerGroup: some characteristics (as taxes) will be applied to the Order depend-ing on which CustomerGroup it is related. Even if normally this will be the same asthe group the Customer belongs to, administrators can choose another from the back-end. Even thought, the group the costumer belongs to is not changed.

• billing: the adress where the bill for this Order will be sent. It is not mandatory thatthey should be part of the Customer adresses.

• delivery: the adress where the products purchased will be shipped. It is not manda-tory that they should be part of the Customer adresses.

• rateApplicationAdress: will be used to calculate the tax rates applied to this order.

• shippingMethod: the method that will be used to ship the products to the Customersdelivery adress. Each method involves a specific method for calculating the costs.

• paymentMethod: the method that will be used for the Costumer to pay the orderamount. If it is a credit card method, the credit card info is saved.

• newVersion / previousVersion: already recorded Orders can be edited. This willsimultaneously create a new order and cancel the previous order. Each version of another is associated to its immediately newer and previous version.

Concerning currency management, an Order has the following information:

• genericBaseCurrency: the currency setted as the generic base currency when theorder was placed.

• websiteRedefinedBaseCurrency: the currency setted as website’s base currencywhen the order was placed, if defined. The conversion rate with respect to the genericbase currency at the time the order was placed is saved.

• purchasingCurrency: the currency in which the order was placed. If the order wasplaced using the genericBaseCurrency, no purchasing currency is saved. The conver-sion rate with respect to the generic base currency at the time the order was placed issaved.

Several Comments can be made to an Order, even when it is already created. For eachComment, the system saves its text, the time it was created, an status and if the customerwho purchases the order had been notified for this comment.

n State Transition Diagram

The state of Orders can be conceptually modeled by using a state transition diagram.

135

Page 137: Magento Conceptual Schema

136

Page 138: Magento Conceptual Schema

2.8.5 OrderLines

n Overview

Each different Product purchased in a Order is represented by an OrderLine.

n Schema Diagram

n Constraints

[1] An order line is identified by its order, the product sku and the info about the options choosen.

Context OrderLine :: isIdentifiedByItsOrderProductSkuAndOptions() : Booleanbody: OrderLine.allInstances() -> isUnique(Setorder,productSku,textOptions,dateOptions,predefinedContentOptions)

n Description

An OrderLine has the following attributes:

• productSku: the sku of the purchased product.

• productName: the name of the purchased product.

• quantity: the number of items puchased of this product.

137

Page 139: Magento Conceptual Schema

• giftMessage: a message that will be delivered to the person that receives the productspurchased in this order line.

• price: the unitary price the customer has finally paid for the product, taking into ac-count the calculated price and the custom price. No taxes, discounts or shipping costsare compounded.

• tax: the global cost from the application of all the applicable tax rates to the set ofproducts purchased in this order line.

• discount: the global amount that was discounted from the set of products purchasedin this order line, determined at the purchasing time by shopping cart price rules.

• total: the total cost of this order line.

If the product purchased in this order line has options, the values that the customer hasgiven for them are specified in the order line.

138

Page 140: Magento Conceptual Schema

2.8.6 Invoices

n Overview

Magento allows administrators to generate invoices for the ordered products.

n Schema Diagram

n Derivation Rules

[1] Invoice :: shippingCosts is the shipping amount for the entire order, if it is the first Invoice forits Order; zero otherwise.

Context Invoice :: shippingCosts : Integerbody:

let isFirstInvoice:Boolean =equals(self,

self.order.invoice -> any ( i | self.order.invoice -> forAll ( i2 | i <> i2 implies i.createdAt <i2.createdAt ) )

)in

if isFirstInvoice then self.order.shippingCostselse 0endif

[2] Invoice :: total its the total cost the user have paid, including shipping costs and taxes.

139

Page 141: Magento Conceptual Schema

Context Invoice :: total : Integerbody: self.invoiceLine.total -> sum() + self.shippingCosts

[3] InvoiceLine :: total is the unitary cost paid for this product multiplied by the quantity in theInvoice.

Context InvoiceLine :: total : Integerbody:

self.orderLine.price * self.quantity +(self.orderLine.tax / self.orderLine.quantity) * self.quantity +(self.orderLine.discount / self.orderLine.quantity) * self.quantity

[4] Order :: notCancelledInvoice is the set of invoices made for this Order that had not beencancelled.

Context Order :: notCancelledInvoice : Set(Invoice)body: self.invoice -> select ( i | i.status <> InvoiceStatus::Cancelled )

[5] Order :: totalInvoiced its the total amount already invoiced for the products of this order.

Context Order :: totalInvoiced : Moneybody: self.notCancelledInvoice.total -> sum()

[6] Order :: totalPaid its the total amount that the Costumer has already paid for the products ofthis order.

Context Order :: totalPaid : Moneybody: self.invoice -> select ( i | i.status = InvoiceStatus::Paid ).total -> sum()

[7] Order :: totalNonReInvoiceable its the total amount of the cancelled orders that where alreadypaid online througth a third-party gateway, so its products are not able to be re-invoiced again.

Context Order :: totalNonReInvoiceable : Moneybody: self.invoice -> select ( i | i.status = InvoiceStatus::Cancelled and i.isPaidOnline).total -> sum()

n Constraints

[1] An invoice line is identified by its invoice and order line.

Context InvoiceLine :: isIdentifiedByItsInvoiceAndOrderLine() : Booleanbody: InvoiceLine.allInstances() -> isUnique(Setinvoice,orderLine)

[2] An invoice line refers to an order line of the corresponding order.

Context InvoiceLine :: refersToACorrectOrderLine() : Booleanbody: self.invoice.order.orderLine -> includes(self.orderLine)

[3] An invoice is identified by the order it belongs to and the time it was created.

Context Invoice :: isIdentifiedByItsOrderAndCreationDate() : Booleanbody: Invoice.allInstances() -> isUnique(Setorder,createdAt)

[4] The payment method of an invoice that has been paid automatically online should be one ofthe followings: Authorize.net, PayFlowPro, PayPal or GoogleCheckout.

Context Invoice :: isPaidOnlineOnlyIfHasExternalPaymentMethod() : Booleanbody:

140

Page 142: Magento Conceptual Schema

self.isPaidOnline implies (self.order.paymentMethod.oclIsTypeOf( AuthorizeNet ) or

self.order.paymentMethod.oclIsTypeOf( PayFlowPro ) orself.order.paymentMethod.oclIsTypeOf( PayPalMethod ) orself.order.paymentMethod.oclIsTypeOf( GoogleCheckout ))

[5] Invoices related to this order don’t have a greater quantity of a product than the quantity orderedfor this product.

Context OrderLine :: hasNotMorePaidProductsThanOrdered() : Booleanbody:

let notCancelledLines: Set(InvoiceLine) =self.invoiceLine -> select(li|li.invoice.status <> InvoiceStatus::Cancelled )

in notCancelledLines.quantity -> sum() <= self.quantity

n Description

An Invoice is a document issued by the seller to the customer listing the goods or servicespurchased and the sum of money due.

Multiple Invoices can be created per Order, containing as much of the purchased itemquantity. However, each unit of each item can only be invoiced one time.

In Magento, the Invoice for a product should be created at the latest when the customerpays the money for this product, but they can also be created before.

The system saves the following information for each Invoice:

• createdAt: the time the Invoice has been recorded.

• emailSent: indicates if an email has been sent, during the creation of the Invoice, tothe order’s costumer, to notice him the Invoice was recorded.

• capturingMethod: indicates the method used to capture the payment for this invoice:automathically online with Magento, automatically Online throught a third party methodor only registering the invoice (with no payment).

• isPaidOnline: indicates if the customer’s payment of the Invoice’s amount has beendone automatically during Invoice creation. This can only be done throught an externalonline payment method: Authorize.net, PayFlowPro, PayPal or GoogleCheckout.

• shippingCosts: the shipping costs. They are only compounded for the first Invoicemade for an Order, regardless of how many products are included in this first Invoice.-Derived Attribute.

• total: the total price the Costumer have should pay for this Invoice.

The status of an Invoice indicates whether:

• Pending: the Invoice’s amount has not been paid yet by the customer.

• Paid: the Invoice’s amount has been already paid.

• Cancelled: the administrator has made an error creating the invoice or has changedhis opinion, and does not want to take this invoice into account no more.

Cancelled Invoice’s can be re-invoiced or not depending on if the invoice has been au-tomatically paid online or not. In the last, the products that where in the invoice can bere-invoiced, whether in the first they can not.

Each InvoiceLine records that one kind of product has been paid in this Invoice. Theproduct is specified by the related Order Line. The following information is also saved:

141

Page 143: Magento Conceptual Schema

• quantity: records the number of items of this Product that had been paid.

• total: is the total amount paid for this quantity of this product. Derived Attribute.

Several Comments can also be made to a Invoice, even when it is already created. Ofcourse, each Invoice is also related to the Order it belongs to.

n State Transition Diagram

The state of Invoices can be conceptually modeled by using a state transition diagram.

142

Page 144: Magento Conceptual Schema

2.8.7 Shipments

n OverviewMagento records the items in an Order which have been already shipped to the Costumer’sdestination.

n Schema Diagram

n Constraints

[1] A shipment is identified by the order it belongs to and the time it was created.

Context Shipment :: isIdentifiedByItsOrderAndCreationDate() : Booleanbody: Shipment.allInstances() -> isUnique(Setorder,createdAt)

[2] A refund line refers to an order line of the corresponding order.

Context ShipmentLine :: refersToACorrectOrderLine() : Booleanbody: self.shipment.order.orderLine -> includes(self.orderLine)

[3] Shipments related to this order do not ship a greater quantity of a product than the quantityordered for this product.

Context OrderLine :: hasNotMoreShippedProductsThanOrdered() : Booleanbody:self.shipmentLine.quantity -> sum() <= self.quantity

143

Page 145: Magento Conceptual Schema

n Description

A Shipment it’s a record that some quantity of the products in that Order have been al-ready shipped to its buyer, and they were not recorded to be shipped before. Whether theirphysically shipment could be together or not, the fact that they appear in the same Ship-ment means that someone (normally a system administrator) has recorded their shipmenttogether, at a determinated point of time.

Multiple shipments can be created per Order, as someone has recorded at diferent mo-ments that this products have been shipped. However, each unit of each item can only beshipped only one time, so there is a finite limit of Shipments.

The system saves the following information for each shipment:

• createdAt: the time the Shipment has been recorded.

• emailSent: indicates if an email has been sent to the order’s costumer to notice himthe shipment was recorded.

• trackingNumber: can optionally be associated to the shipment in order to facilitateeventual location purposes.

Each ShipmentLine records that one kind of product has been shipped in this shipment.-The product is specified by the related Order Line. The following information is also saved:

• quantity: records the number of items of this Product that had been shipped.

Several Comments can also be made to a Shipment, even when it is already created. Ofcourse, each shipment is related to the Order it belongs to.

144

Page 146: Magento Conceptual Schema

2.8.8 Refund

n Overview

Magento records the Refunds made by Customers. Magento refers them as "Credit Memos",which is the document that registers a Refund.

n Schema Diagram

n Derivation Rules

[1] Refund :: total is the total amount refunded to the costumer, including the shipping and theadditional amounts refunded (which are added) and the fee (which is substracted).

Context Refund :: total : Integerbody: self.refundLine.total -> sum() + self.shippingAmount + self.additionalAmount - self.fee

[2] RefundLine :: total is the unitary cost of this product multiplied by the quantity of items re-funded of this product.

Context RefundLine :: total : Booleanbody: self.orderLine.price * self.quantity

[3] Order :: totalRefunded its the total amount of this order that has been refunded to the cos-tumer.

145

Page 147: Magento Conceptual Schema

Context Order :: totalRefunded : Integerbody: self.refund.total -> sum()

n Constraints

[1] A refund is identified by the order it belongs to and the time it was created.

Context Refund :: isIdentifiedByItsOrderAndCreationDate() : Booleanbody: Refund.allInstances() -> isUnique(Setorder,createdAt)

[2] A refund line refers to an order line of the corresponding order.

Context RefundLine :: refersToACorrectOrderLine() : Booleanbody: self.refund.order.orderLine -> includes(self.orderLine)

[3] A refund line refers to an order line that has been already invoiced.

Context RefundLine :: refersToAnOrderLineAlreadyInvoiced() : Booleanbody: self.orderline.invoiceLine -> notEmpty()

[4] The total quantity refunded for each product should be equal or smaller than the total quantityinvoiced.

Context OrderLine :: hasNotMoreRefundedProductsThanInvoiced() : Booleanbody:

let notCancelledLines: Set(InvoiceLine) =self.invoiceLine -> select(li|li.invoice.status <> InvoiceStatus::Cancelled )

in notCancelledLines.quantity -> sum() <= self.refundLines.quantity -> sum()

[5] The total quantity refunded for this order cannot be greater than the total quantity paid.

Context Order :: hasNotRefundedMoreThanPaid() : Booleanbody: self.totalRefunded <= self.totalPaid

[6] The total amount refounded from the shipping cost of an order in all its refunds cannot begreater than the shipping costs

Context Order :: hasRefundsWithCorrectRefundShipping() : Booleanbody: self.refund.shippingAmount -> sum() <= self.shippingCosts

[7] We cannot create a Refund for an Order until an Invoice has been created for this Order.

Context Order :: hasARefundOnlyIfHasInvoice() : Booleanbody: self.refund -> notEmpty() implies self.invoice -> notEmpty()

n Description

A Refund is placed when a Customer returns a purchased Product that is unsatisfactoryfor him. This will normally cause the seller to give back the amount paid for this product,althought the returned quantity can be increased or decreased.

The status of the refund indicates whether:

• Pending: the customer has returned the product, but no amount money is given backto him.

• Refunded: the customer has returned the product and the seller has given back himthe corresponding amount.

146

Page 148: Magento Conceptual Schema

• Cancelled: the customer has finally changed his opinion an does not want to refundthe product no more. Refunds could not be deleted from the system.

A product can not be refunded until it is paid.Multiple Refunds can be created per Order, but each unit can only be refunded one time.The system saves the following information for each refund:

• createdAt: the time the Shipment has been recorded.• emailSent: indicates if an email has been sent, during the creation of the refund, to

the order’s costumer, to notice him the refund was recorded.• shippingAmount: the amount refunded from the shipping costs.• additionalAmount: an additional refund, not related to any particular aspect of the

order. .• fee: an amount charged to the customer for placing the refund. It is subtracted from

the total refunded.• total: the total amount that will be refunded to the Costumer for this Refund. Derived

Attribute.

Each RefundLine records that one type of product has been refunded. The product isspecified by the related Order Line. The following information is also saved:

• quantity: records the number of items of this Product that had been refunded.• total: is the total amount refunded for the quantity of that product in this Refund, as it

is described in its derivation rule. Derived Attribute.

Several Comments can also be made to a Refund, even when it is already created. Ofcourse, each Refund is related to the Order it belongs to.

n State Transition DiagramThe state of Refunds can be conceptually modeled by using a state transition diagram.

147

Page 149: Magento Conceptual Schema

3Behavioral Schema. Use Case Specification

In this chapter we develop the first part of the behavioral schema of the Magento informationsystem. Section 3.1 defines the scope of the schema elicitation, while section 3.2 describes theway the schema is presented. Section 3.3 presents an overview of the described Use Cases,which are detailed in the remaining sections.

3.1 ScopeUse Cases specification covers all the functions that the system perform within the scope definedin section 2.1.

3.2 Schema presentationThe main purpose of a behavioral schema is to specify the valid changes in the domain state, aswell as the actions that the described system can perform.

In the following sections of this chapter, and in the next chapter, we describe Magento’s be-havioral schema. We show first a list of all the defined use cases and its primary actor, in orderto give an overview of the most important funcionalities of the system and the stakeholders thatinteract with them. This list can be easily represented by a use case diagram.

After that, each use case is specified textually, giving the following information:

n Primary Actor(s)

n Precondition

n Trigger

n Main Success Scenario

n Extensions

The Main Success Scenario and Extensions are described as an interaction of activities betweenthe primary actors and the system. Some of those activities are mapped to system Events, usingthe following syntaxis:

148

Page 150: Magento Conceptual Schema

[-> EventName]

Use Cases are organised in six groups. First five are the same as in Structural Schema. Theyare defined in section 2.3.

In addition, Magento’s behavioral schema includes several use cases that retrieve informationabout the system, without modifying it’s state. They are specified here and classified in the StoreReports Use Case group.

3.3 Use Case Overview

n Store Configuration

1. Add a website. Primary Actor: Store Administrator.

2. Edit a website. Primary Actor: Store Administrator.

3. Delete a website. Primary Actor: Store Administrator.

4. Select the default website. Primary Actor: Store Administrator.

5. Add a store. Primary Actor: Store Administrator.

6. Edit a store. Primary Actor: Store Administrator.

7. Delete a store. Primary Actor: Store Administrator.

8. Select the default store of a website. Primary Actor: Store Administrator.

9. Add an store view. Primary Actor: Store Administrator.

10. Edit an store view. Primary Actor: Store Administrator.

11. Delete an store view. Primary Actor: Store Administrator.

12. Select the default store view of a store. Primary Actor: Store Administrator.

13. Select the default language. Primary Actor: Store Administrator.

14. Change the catalog configuration values. Primary Actor: Store Administrator.

15. Change the stock configuration values. Primary Actor: Store Administrator.

16. Change the wishlist configuration values. Primary Actor: Store Administrator.

17. Change the sales configuration values. Primary Actor: Store Administrator.

18. Change the customer configuration values. Primary Actor: Store Administrator.

19. Change the tax configuration values. Primary Actor: Store Administrator.

20. Change the shipping configuration values. Primary Actor: Store Administrator.

21. Change the tell to a friend configuration values. Primary Actor: Store Administra-tor.

22. Change the currency configuration values. Primary Actor: Store Administrator.

23. Change the enabled currencies. Primary Actor: Store Administrator.

24. Update currency rates. Primary Actor: Store Administrator.

25. Change the geographical configuration values. Primary Actor: Store Administrator.

26. Change shipping method values. Primary Actor: System Administrator.

27. Change payment method values. Primary Actor: System Administrator.

28. Add a customer tax class. Primary Actor: Store Administrator.

29. Edit a customer tax class. Primary Actor: Store Administrator.

30. Delete a customer tax class. Primary Actor: Store Administrator.

149

Page 151: Magento Conceptual Schema

31. Add a product tax class. Primary Actor: Store Administrator.

32. Edit a product tax class. Primary Actor: Store Administrator.

33. Delete a product tax class. Primary Actor: Store Administrator.

34. Add a tax rate. Primary Actor: Store Administrator.

35. Edit a tax rate. Primary Actor: Store Administrator.

36. Delete a tax rate . Primary Actor: Store Administrator.

37. Add a tax rule. Primary Actor: Store Administrator.

38. Edit a tax rule. Primary Actor: Store Administrator.

39. Delete a tax rule . Primary Actor: Store Administrator.

n Customers

1. Create a Customer. Primary Actor: Customer, Store Administrator.

2. Change password. Primary Actor: Customer.

3. Change customer details. Primary Actor: Customer.

4. Administrate address book. Primary Actor: Customer.

5. Edit a customer. Primary Actor: Store Administrator.

6. Delete a customer. Primary Actor: Store Administrator.

7. Show account information. Primary Actor: Customer.

8. Show address book. Primary Actor: Customer.

9. Add a customer group. Primary Actor: Store Administrator.

10. Edit a customer group. Primary Actor: Store Administrator.

11. Delete a customer group. Primary Actor: Store Administrator.

12. Add an administrator. Primary Actor: Store Administrator.

13. Edit an administrator. Primary Actor: Store Administrator.

14. Delete an administrator. Primary Actor: Store Administrator.

15. Add a role. Primary Actor: Store Administrator.

16. Edit a role. Primary Actor: Store Administrator.

17. Delete a role. Primary Actor: Store Administrator.

18. Log In. Primary Actor: Customer.

19. Log Out. Primary Actor: Customer.

20. Open session. Primary Actor: Customer.

21. Finish session. Primary Actor: Customer.

22. Change the current Website. Primary Actor: Customer.

23. Change the current Store. Primary Actor: Customer.

24. Change the current Store View. Primary Actor: Customer.

25. Change the current Currency. Primary Actor: Customer.

n Store Administration

1. Add a product. Primary Actor: Store Administrator.

150

Page 152: Magento Conceptual Schema

2. Edit a product. Primary Actor: Store Administrator.

3. Delete a product. Primary Actor: Store Administrator.

4. Add a product category. Primary Actor: Store Administrator.

5. Edit a product category. Primary Actor: Store Administrator.

6. Move a product category. Primary Actor: Store Administrator.

7. Delete a product category. Primary Actor: Store Administrator.

8. Add an attribute. Primary Actor: Store Administrator.

9. Edit an attribute. Primary Actor: Store Administrator.

10. Delete an attribute. Primary Actor: Store Administrator.

11. Add an attribute set. Primary Actor: Store Administrator.

12. Edit an attribute set. Primary Actor: Store Administrator.

13. Delete an attribute set. Primary Actor: Store Administrator.

14. Administrate tier prices of a product. Primary Actor: Store Administrator.

15. Add a catalog price rule. Primary Actor: Store Administrator.

16. Edit a catalog price rule. Primary Actor: Store Administrator.

17. Delete a catalog price rule. Primary Actor: Store Administrator.

18. Add a shopping cart price rule. Primary Actor: Store Administrator.

19. Edit a shopping cart price rule. Primary Actor: Store Administrator.

20. Delete a shopping cart price rule. Primary Actor: Store Administrator.

n Additional Activities

1. Tag a product. Primary Actor: Customer.

2. Add a tag. Primary Actor: Store Administrator.

3. Edit a tag. Primary Actor: Store Administrator.

4. Delete a tag. Primary Actor: Store Administrator.

5. Show tags of a customer. Primary Actor: Customer.

6. Show most popular tags. Primary Actor: Customer.

7. Show all tags. Primary Actor: Customer.

8. Add a review. Primary Actor: Customer, Store Administrator.

9. Edit a review. Primary Actor: Store Administrator.

10. Delete a review. Primary Actor: Store Administrator.

11. Add a review property. Primary Actor: Store Administrator.

12. Edit a review property. Primary Actor: Store Administrator.

13. Delete a review property. Primary Actor: Store Administrator.

14. Show reviews of a product. Primary Actor: Customer, Store Administrator.

15. Show reviews of a customer. Primary Actor: Customer.

16. Add a product to the wish list. Primary Actor: Customer.

17. Remove a product from the wish list. Primary Actor: Customer.

18. Add a product to the compare list. Primary Actor: Customer.

19. Remove a product from the compare list. Primary Actor: Customer.

151

Page 153: Magento Conceptual Schema

20. Share wish list. Primary Actor: Customer.

21. Subscribe to a product price alert. Primary Actor: Customer.

22. Subscribe to a product stock alert. Primary Actor: Customer.

23. Show wish list. Primary Actor: Customer.

24. Show ready to compare products. Primary Actor: Customer.

25. Show recently compared products. Primary Actor: Customer.

26. Show recently viewed products. Primary Actor: Customer.

27. Show compare. Primary Actor: Customer.

28. Add a newsletter template. Primary Actor: Store Administrator.

29. Edit a newsletter template. Primary Actor: Store Administrator.

30. Delete a newsletter template. Primary Actor: Store Administrator.

31. Add a newsletter. Primary Actor: Store Administrator.

32. Edit a newsletter. Primary Actor: Store Administrator.

33. Subscribe to the newsletter. Primary Actor: Customer.

34. Unsubscribe from the newsletter. Primary Actor: Customer.

35. Delete a newsletter subscription. Primary Actor: Store Administrator.

36. Unsubscribe a newsletter subscription. Primary Actor: Store Administrator.

37. Show shopping cart. Primary Actor: Customer.

38. Download a product. Primary Actor: Customer.

39. Show downloadable products of a customer. Primary Actor: Customer.

40. Tell to a friend. Primary Actor: Customer.

41. View product information. Primary Actor: Customer.

42. Search products. Primary Actor: Customer.

43. Show the best purchased products. Primary Actor: Customer.

44. Reset the temporal information. Primary Actor: System.

n Online catalog

1. Place an order. Primary Actor: Customer.

2. Checkout an order with multiple addresses. Primary Actor: Customer.

3. Add an order. Primary Actor: Store Administrator.

4. Cancel an order. Primary Actor: Store Administrator.

5. Hold an order. Primary Actor: Store Administrator.

6. Unhold an order. Primary Actor: Store Administrator.

7. Reorder. Primary Actor: Customer, Store Administrator.

8. Add a gift message to a placed order. Primary Actor: Store Administrator.

9. Print an Order. Primary Actor: Customer.

10. Send order information by email. Primary Actor: Store Administrator.

11. Show previous orders of a customer. Primary Actor: .

12. Add an invoice. Primary Actor: Store Administrator.

13. Register an invoice payment. Primary Actor: Store Administrator.

152

Page 154: Magento Conceptual Schema

14. Cancel an invoice. Primary Actor: Store Administrator.

15. Add a shipment. Primary Actor: Store Administrator.

16. Add a refund. Primary Actor: Store Administrator.

17. Cancel a refund. Primary Actor: Store Administrator.

18. Add a comment to an order, invoice, shipment or refund.. Primary Actor: StoreAdministrator.

n Store Reports

1. Show the sales report. Primary Actor: Store Administrator.

2. Show the tax report. Primary Actor: Store Administrator.

3. Show the shipping report. Primary Actor: Store Administrator.

4. Show the invoices report. Primary Actor: Store Administrator.

5. Show the refunds report. Primary Actor: Store Administrator.

6. Show the coupon codes report. Primary Actor: Store Administrator.

7. Show the products in carts report. Primary Actor: Store Administrator.

8. Show the abandoned carts report. Primary Actor: Store Administrator.

9. Show the bestseller products report. Primary Actor: Store Administrator.

10. Show the ordered products report. Primary Actor: Store Administrator.

11. Show the most viewed products report. Primary Actor: Store Administrator.

12. Show the stock of products report. Primary Actor: Store Administrator.

13. Show the downloads report. Primary Actor: Store Administrator.

14. Show the new customer accounts report. Primary Actor: Store Administrator.

15. Show the customers by orders total report. Primary Actor: Store Administrator.

16. Show the customers by number of orders report. Primary Actor: Store Administra-tor.

17. Show the customer reviews report. Primary Actor: Store Administrator.

18. Show the product reviews report. Primary Actor: Store Administrator.

19. Show the tags by customer report. Primary Actor: Store Administrator.

20. Show the tags by product report. Primary Actor: Store Administrator.

21. Show the popular tags report. Primary Actor: Store Administrator.

22. Show the search terms report. Primary Actor: Store Administrator.

153

Page 155: Magento Conceptual Schema

3.4 Store Configuration

Use Case

3.4.1 Add a website

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a website

Main success scenario

1. The store administrator provides the website’s details.2. The system saves the new website.

[NewWebsite]

Use Case

3.4.2 Edit a website

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a website

Main success scenario

1. The store administrator selects the website to be edited.2. The store administrator provides the new website’s details.3. The system saves the new website.

[EditWebsite]

Use Case

3.4.3 Delete a website

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a website

Main success scenario

1. The store administrator selects the website to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the website4. The system deletes the website.

[DeleteWebsite]

Extensions

2a.The store administrator does not want to delete the website2a1. The use case ends

154

Page 156: Magento Conceptual Schema

Use Case

3.4.4 Select the default website

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to change the default website

Main success scenario

1. The store administrator selects the website which will become the default website2. The system updates the default website

[SetDefaultWebsite]

Use Case

3.4.5 Add a store

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a store

Main success scenario

1. The store administrator provides the store’s details.2. The system saves the new store.

[NewStore]

Use Case

3.4.6 Edit a store

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a store

Main success scenario

1. The store administrator selects the store to be edited.2. The store administrator provides the new store’s details.3. The system saves the new store.

[EditStore]

Use Case

3.4.7 Delete a store

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a store

Main success scenario

1. The store administrator selects the store to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the store

155

Page 157: Magento Conceptual Schema

4. The system deletes the store.[DeleteStore]

Extensions

2a.The store administrator does not want to delete the store2a1. The use case ends

Use Case

3.4.8 Select the default store of a website

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to change the default store of a website

Main success scenario

1. The store administrator selects the website whose default store will be changed.2. The store administrator selects the store which will become the default store of this website.3. The system updates the default website

[SetDefaultStoreOfWebsite]

Use Case

3.4.9 Add an store view

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add an store view

Main success scenario

1. The store administrator provides the store view details.2. The system saves the new store view.

[NewStoreView]

Use Case

3.4.10 Edit an store view

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit an store view

Main success scenario

1. The store administrator selects the store view to be edited.2. The store administrator provides the new store view details.3. The system saves the new store view.

[EditStoreView]

Use Case

3.4.11 Delete an store view

156

Page 158: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete an store view

Main success scenario

1. The store administrator selects the store view to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the store view4. The system deletes the store view.

[DeleteStoreView]

Extensions

2a.The store administrator does not want to delete the store view.2a1. The use case ends

Use Case

3.4.12 Select the default store view of a store

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to change the default store view of a store

Main success scenario

1. The store administrator selects the store whose default store view will be changed.2. The store administrator selects the store view which will become the default store view of thisstore.3. The system updates the default store view of the store

[SetDefaultStoreViewOfStore]

Use Case

3.4.13 Select the default language

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to change the default language

Main success scenario

1. The store administrator selects the language which will become the default language2. The system updates the default language

[SetDefaultLanguage]

Extensions

2a.The system administrator wants to define the default language for only a restricted scope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

157

Page 159: Magento Conceptual Schema

Use Case

3.4.14 Change the catalog configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the catalog configuration.

Main success scenario

1. The system displays the current catalog configuration values.2. The store administrator provides the new values for the catalog configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeCatalogConfiguration]

Extensions

2a.The system administrator wants to change the catalog configuration values for only a restrictedscope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

Use Case

3.4.15 Change the stock configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the stock configuration.

Main success scenario

1. The system displays the current stock configuration values.2. The store administrator provides the new values for the stock configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeStockConfiguration]

Use Case

3.4.16 Change the wishlist configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the wishlist configuration.

Main success scenario

1. The system displays the current wishlist configuration values.2. The store administrator provides the new values for the wishlist configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeWishListConfiguration]

158

Page 160: Magento Conceptual Schema

Extensions

2a.The system administrator wants to change the wishlist configuration values for only a website2a1. The system displays the available websites2a2. The system administrator selects a website2a3. The use case continues at step 2

Use Case

3.4.17 Change the sales configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the sales configuration.

Main success scenario

1. The system displays the current sales configuration values.2. The store administrator provides the new values for the sales configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeSalesConfiguration]

Extensions

2a.The system administrator wants to change the sales configuration values for only a website2a1. The system displays the available websites2a2. The system administrator selects a website2a3. The use case continues at step 2

Use Case

3.4.18 Change the customer configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the customer configuration.

Main success scenario

1. The system displays the current customer configuration values.2. The store administrator provides the new values for the sales configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeCustomerConfiguration]

Extensions

2a.The system administrator wants to change the sales configuration values for only an storeview.2a1. The system displays the available store views2a2. The system administrator selects an store view2a3. The use case continues at step 2

159

Page 161: Magento Conceptual Schema

Use Case

3.4.19 Change the tax configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the tax configuration.

Main success scenario

1. The system displays the current tax configuration values.2. The store administrator provides the new values for the tax configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeTaxConfiguration]

Extensions

2a.The system administrator wants to change the tax configuration values for only a restrictedscope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

Use Case

3.4.20 Change the shipping configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the shipping configuration.

Main success scenario

1. The system displays the current shipping configuration values.2. The store administrator provides the new values for the shipping configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeShippingConfiguration]

Extensions

2a.The system administrator wants to change the shipping configuration values for only a website2a1. The system displays the available websites2a2. The system administrator selects a website2a3. The use case continues at step 2

Use Case

3.4.21 Change the tell to a friend configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the tell to a friend configuration.

Main success scenario

160

Page 162: Magento Conceptual Schema

1. The system displays the current tell to a friend configuration values.2. The store administrator provides the new values for the tell to a friend configuration.3. The system validates that the new values are correct4. The system saves the new values

[ChangeTellToAFriendConfiguration]

Extensions

2a.The system administrator wants to change the shipping configuration values for only a storeview2a1. The system displays the available store views2a2. The system administrator selects a store view2a3. The use case continues at step 2

Use Case

3.4.22 Change the currency configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the currency configuration

Main success scenario

1. The system displays the enabled currencies.2. The store administrator selects a base currency, the allowed currencies and the default cur-rency.3. The system validates that the new values are correct4. The system saves the new values

[ChangeCurrencyConfiguration]

Extensions

2a.The system administrator wants to change the currency configuration for only a restrictedscope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 23a.A selected currency is not enabled or the selected default currency is not one of the selectedallowed currencies3a1. The system informes the store administrator3a2. The use case continues at step 2

Use Case

3.4.23 Change the enabled currencies

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the enabled system currencies.

Main success scenario

1. The system displays all the currencies.

161

Page 163: Magento Conceptual Schema

2. The store administrator selects a base currency, the allowed currencies and the default cur-rency.3. The system validates that the new values are correct4. The system saves the new values

[ChangeEnabledCurrencies]

Extensions

3a.Some of the selected currencies are currently a base, allowed or default currency in somestore view.3a1. The system informes the store administrator3a2. The use case continues at step 2

Use Case

3.4.24 Update currency rates

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to updata automatically via Internet the change values forcurrency rates

Main success scenario

1. The system connects to the change information server.2. The value change is automatically updated for all the currencies

[UpdateCurrencyValue]

Use Case

3.4.25 Change the geographical configuration values

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants tho change the configuration related about countries.

Main success scenario

1. The system displays all the countries2. The store administrator selects the allowed countries and a default country.3. The system validates that the new values are correct4. The system saves the new values

[ChangeGeographicalConfiguration]

Extensions

2a.The system administrator wants to change the geographical configuration for only a restrictedscope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 23a.The selected default country is not one of the selected allowed countries.3a1. The system informes the store administrator3a2. The use case continues at step 2

162

Page 164: Magento Conceptual Schema

Use Case

3.4.26 Change shipping method values

Primary Actor: System AdministratorPrecondition: NoneTrigger: The store administrator wants to change the configuration values of a shipping method

Main success scenario

1. The system displays the shipping methods and its current values.2. The sytem administrator provides the new values for the configurable attributes that he wantsto change.3. The system validates that the new values are correct4. The system saves the new values

[EditShippingMethods]5. The system displays the new values of the shipping methods.

Extensions

2a.The system administrator wants to change shipping method values for only a restricted scope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

Use Case

3.4.27 Change payment method values

Primary Actor: System AdministratorPrecondition: NoneTrigger: The store administrator wants to change the configuration values of a payment method

Main success scenario

1. The system displays the payment methods and its current values.2. The sytem administrator provides the new values for the configurable attributes that he wantsto change.3. The system validats that the new values are correct4. The system saves the new values

[EditPaymentMethods]5. The system displays the new values of the payment methods.

Extensions

2a.The system administrator wants to change shipping method values only for a restricted scope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

Use Case

3.4.28 Add a customer tax class

Primary Actor: Store AdministratorPrecondition: None

163

Page 165: Magento Conceptual Schema

Trigger: The store administrator wants to add a customer tax class

Main success scenario

1. The store administrator provides the customer tax class name.2. The system saves the new customer tax class.

[NewCustomerTaxClass]

Use Case

3.4.29 Edit a customer tax class

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a customer tax class

Main success scenario

1. The store administrator selects the customer tax class to be edited.2. The store administrator provides the new customer tax class name.3. The system saves the new customer tax class.

[EditCustomerTaxClass]

Use Case

3.4.30 Delete a customer tax class

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a customer tax class

Main success scenario

1. The store administrator selects the customer tax class to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the customer tax class4. The system deletes the customer tax class.

[DeleteCustomerTaxClass]

Extensions

2a.The store administrator does not want to delete the customer tax class2a1. The use case ends

Use Case

3.4.31 Add a product tax class

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a product tax class

Main success scenario

1. The store administrator provides the product tax class name.2. The system saves the new product tax class.

164

Page 166: Magento Conceptual Schema

[NewProductTaxClass]

Use Case

3.4.32 Edit a product tax class

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a product tax class

Main success scenario

1. The store administrator selects the product tax class to be edited.2. The store administrator provides the new product tax class name.3. The system saves the changes.

[EditProductTaxClass]

Use Case

3.4.33 Delete a product tax class

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a product tax class

Main success scenario

1. The store administrator selects the product tax class to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the product tax class4. The system deletes the product tax class.

[DeleteProductTaxClass]

Extensions

2a.The store administrator does not want to delete the product tax class2a1. The use case ends

Use Case

3.4.34 Add a tax rate

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a tax rate

Main success scenario

1. The store administrator provides the details of the new.tax rate2. The system validates that the data is correct.3. The system saves the new tax rate.

[NewTaxRate]

165

Page 167: Magento Conceptual Schema

Use Case

3.4.35 Edit a tax rate

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a tax rate

Main success scenario

1. The store administrator selects the tax rate to be edited.2. The store administrator provides the new details of the tax rate.3. The system validates that the data is correct.4. The system saves the changes.

[EditTaxRate]

Use Case

3.4.36 Delete a tax rate

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a tax rate

Main success scenario

1. The store administrator selects the tax rate to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the tax rate4. The system deletes the tax rate.

[DeleteTaxRate]

Extensions

2a.The store administrator doesn’t want to delete the tax rate2a1. The use case ends

Use Case

3.4.37 Add a tax rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a tax rule

Main success scenario

1. The store administrator provides the details of the new.tax rule2. The system validates that the data is correct.3. The system saves the new tax rule.

[NewTaxRule]

Use Case

3.4.38 Edit a tax rule

166

Page 168: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a tax rule

Main success scenario

1. The store administrator selects the tax rate to be edited.2. The store administrator provides the new details of the tax rule.3. The system validates that the data is correct.4. The system saves the changes.

[EditTaxRule]

Use Case

3.4.39 Delete a tax rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a tax rule

Main success scenario

1. The store administrator selects the tax rule to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the tax rule4. The system deletes the tax rule.

[DeleteTaxRule]

Extensions

2a.The store administrator doesn’t want to delete the tax rule2a1. The use case ends

167

Page 169: Magento Conceptual Schema

3.5 Customers

Use Case

3.5.1 Create a Customer

Primary Actor: Customer, Store AdministratorPrecondition: NoneTrigger: A customer wants to open an account in the store

Main success scenario

1. The customer or the store administrator provides the required customer data2. The system validates the customer data3. The system saves the new account

[CreateCustomer]

Extensions

1a.The primary actor is the store administrator1a1. The store administrator provides also the website where this customer account is associat-ed

Use Case

3.5.2 Change password

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: A customer wants to change his password

Main success scenario

1. The customer provides the old password2. The customer provides the new password twice3. The system validates that the data is correct4. The system saves the changes

[PasswordChange]

Use Case

3.5.3 Change customer details

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: A customer wants to change its customer details

Main success scenario

1. The customer provides the new customer details2. The system validates that the data is correct3. The system saves the changes

[EditCustomerDetails]

168

Page 170: Magento Conceptual Schema

Use Case

3.5.4 Administrate address book

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: A customer wants to view or change the address book

Main success scenario

1. The system displays the current address book entries of the customer.2. The customer selects an address book entry to be edited3. The system validates that the data is correct4. The system saves the changes and displays the new address book

[EditCustomerAddress]The customer repeats steps 1-4 until he is done.

Extensions

2a.The customer doesn’t want tho change the address book2a1. The use case ends.2b.The customer wants to add a new address book entry2b1. The user provides the required data

[NewCustomerAddress]2b2. The use case continues at step 32c.The customer wants to delete an address book entry2c1. The user selects the address book entry

[DeleteCustomerAddress]2c2. The use case continues at step 32d.The customer wants to change the default shipping address2d1. The customer selects the new default shipping address

[DefaultDeliveryAddressChange]2d2. The use case continues at step 32e.The customer wants to change the default billing address2e1. The customer selects the new default billing address

[DefaultBillingAddressChange]2e2. The use case continues at step 3

Use Case

3.5.5 Edit a customer

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a customer

Main success scenario

1. The store administrator selects the customer to be edited.2. The store administrator provides the new details of the customer.3. The system validates that the data is correct.4. The system saves the changes.

[EditCustomer]

169

Page 171: Magento Conceptual Schema

Use Case

3.5.6 Delete a customer

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a customer

Main success scenario

1. The store administrator selects the customer to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the customer4. The system deletes the customer and his addresses, reviews, notification subscriptions, shop-ping carts, buying activity lists and tags.

[DeleteCustomer]

Extensions

2a.The store administrator doesn’t want to delete the customer2a1. The use case ends

Use Case

3.5.7 Show account information

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: The customer wants to visualize his account information.

Main success scenario

1. The system shows the customer’s account information.[ShowAccountInformation]

Use Case

3.5.8 Show address book

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: The customer wants to visualize his address book.

Main success scenario

1. The system shows the customer’s registered addresses.[ShowAddresses]

Use Case

3.5.9 Add a customer group

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a customer group

170

Page 172: Magento Conceptual Schema

Main success scenario

1. The store administrator provides the details of the new customer group.2. The system validates that the data is correct.3. The system saves the new customer group.

[NewCustomerGroup]

Use Case

3.5.10 Edit a customer group

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a customer group

Main success scenario

1. The store administrator selects the customer group to be edited.2. The store administrator provides the new details of the customer group.3. The system validates that the data is correct.4. The system saves the changes.

[EditCustomerGroup]

Use Case

3.5.11 Delete a customer group

Primary Actor: Store AdministratorPrecondition: More than three customer groups extist in the systemTrigger: The store administrator wants to delete a customer group

Main success scenario

1. The store administrator selects the customer group to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the customer group.4. The system deletes the customer group.

[DeleteCustomerGroup]

Extensions

2a.The store administrator doesn’t want to delete the customer group.2a1. The use case ends

Use Case

3.5.12 Add an administrator

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add an administrator

Main success scenario

1. The store administrator provides the details of the new administrator, including its role.2. The system validates that the data is correct.

171

Page 173: Magento Conceptual Schema

3. The system saves the new administrator.[NewAdministrator]

Use Case

3.5.13 Edit an administrator

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit an administrator

Main success scenario

1. The store administrator selects the administrator to be edited.2. The store administrator provides the new details of the administrator, including its role.3. The system validates that the data is correct.4. The system saves the changes.

[EditAdministrator]

Use Case

3.5.14 Delete an administrator

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a administrator

Main success scenario

1. The store administrator selects the administrator to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the administrator.4. The system deletes the administrator.

[DeleteAdministrator]

Extensions

2a.The store administrator doesn’t want to delete the administrator.2a1. The use case ends4a.The store administrator wants to delete himself4a1. The system informs the store administrator that he can’t delete himself.4a2. The use case ends.

Use Case

3.5.15 Add a role

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a role

Main success scenario

1. The store administrator provides the details of the new role.2. The system validates that the data is correct.3. The system saves the new role.

172

Page 174: Magento Conceptual Schema

[NewRole]

Use Case

3.5.16 Edit a role

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a role

Main success scenario

1. The store administrator selects the role to be edited.2. The store administrator provides the new details of the role.3. The system validates that the data is correct.4. The system saves the changes.

[EditRole]

Use Case

3.5.17 Delete a role

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a role

Main success scenario

1. The store administrator selects the role to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the role.4. The system deletes the role.

[DeleteRole]

Extensions

2a.The store administrator doesn’t want to delete the role.2a1. The use case ends4a.The store administrator wants to delete the role he has assigned4a1. The system informs the store administrator that he can’t delete the role he has assigned.4a2. The use case ends.

Use Case

3.5.18 Log In

Primary Actor: CustomerPrecondition: The customer is not logged inTrigger: A customer logs in the system

Main success scenario

1. The customer introduces their identification data2. The system validates the identification data3. The customer becomes the owner of the current session

[LogIn]

173

Page 175: Magento Conceptual Schema

Extensions

3a. The customer has a shopping cart from a previous session3a1. The previous shopping cart is restored

[RestorePreviousShoppingCart]3b. The customer has a non-empty compare list, a recently compared products list or a recentlyviewed products list from a previous session3b1. The previous compared, recently compared a recently viewed products are restored

[RestorePreviousProductLists]

Use Case

3.5.19 Log Out

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: A customer logs out from the system

Main success scenario

1. The current session becomes anonymous[LogOut]

Extensions

1a. The customer has a non empty compare list, recently compared products list or recentlyviewed products list.1a1. The compared, recently compared and recently viewed products are saved

[SaveCurrentProductLists]

Use Case

3.5.20 Open session

Primary Actor: CustomerPrecondition: NoneTrigger: A customer starts using the system

Main success scenario

1. The system creates an anonymous session[NewSession]

Use Case

3.5.21 Finish session

Primary Actor: CustomerPrecondition: NoneTrigger: A customer finishes using the system

Main success scenario

1. The system deletes the current session[DeleteSession]

174

Page 176: Magento Conceptual Schema

Extensions

1a.The customer is logged in and the session has a non empty shopping cart.1b. The customer has a non empty compare list, recently compared products list or recentlyviewed products list.1b1. The compared, recently compared and recently viewed products are saved

[SaveCurrentProductLists]

Use Case

3.5.22 Change the current Website

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to change the current website of the session

Main success scenario

1. The customer selects the website which will become the current website2. The system updates the current website

[SetCurrentWebsite]

Use Case

3.5.23 Change the current Store

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to change the current store of the session

Main success scenario

1. The customer selects the store which will become the current store2. The system updates the current store

[SetCurrentStore]

Use Case

3.5.24 Change the current Store View

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to change the current store view of the session

Main success scenario

1. The customer selects the store view which will become the current store view2. The system updates the current store view

[SetCurrentStoreView]

Use Case

3.5.25 Change the current Currency

Primary Actor: Customer

175

Page 177: Magento Conceptual Schema

Precondition: NoneTrigger: A customer wants to change the current currency of the session

Main success scenario

1. The customer selects the currency which will become the current currency2. The system updates the current currency

[SetCurrentCurrency]

176

Page 178: Magento Conceptual Schema

3.6 Store Administration

Use Case

3.6.1 Add a product

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a product to the store catalog

Main success scenario

1. The store administrator provides the product type and the attribute set associated.2. The system displays the attributes that can be given a value for this product, including productproperties and corresponding simple attributes

[ShowProductPropertiesAndAbleToRateAttributes]3. The store administrator provides the details of the new product.4. The system validates that the data is correct.5. The system saves the new product.

[NewProduct]

Extensions

3a.The system administrator wants to redefine some details for a restricted scope3a1. The system displays the available scopes3a2. The system administrator selects a scope3a3. The use case continues at step 2.5a.The store administrator wants to continue editing the product properties5a1. The use case continues at step 2.

Use Case

3.6.2 Edit a product

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a product

Main success scenario

1. The store administrator selects the product to be edited.2. The store administrator provides the new details of the product.3. The system validates that the data is correct.4. The system saves the changes.

[EditProduct]

Extensions

2a.The system administrator wants to redefine some details for a restricted scope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

177

Page 179: Magento Conceptual Schema

Use Case

3.6.3 Delete a product

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a product

Main success scenario

1. The store administrator selects the product to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the product4. The system deletes the product and the values associated to its attributes, if they are notassociated to any other product.

[DeleteProduct]

Extensions

2a.The store administrator doesn’t want to delete the product2a1. The use case ends

Use Case

3.6.4 Add a product category

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a category

Main success scenario

1. The store administrator provides the details of the new category, including its parent category,if any:2. The system validates that the data is correct.3. The system saves the new category.

[NewCategory]

Extensions

1a.The store administrator wants to redefine some details for a restricted scope1a1. The system displays the available scopes1a2. The store administrator selects a scope1a3. The use case continues at step 1

Use Case

3.6.5 Edit a product category

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a category

Main success scenario

1. The store administrator selects the category to be edited.2. The store administrator provides the new details of the category.

178

Page 180: Magento Conceptual Schema

3. The system validates that the data is correct.4. The system saves the changes.

[EditCategory]

Extensions

2a.The store administrator wants to redefine some details for a restricted scope2a1. The system displays the available store views2a2. The store administrator selects a store view2a3. The store administrator selects the category to be edited, within the available categories inthat store view2a4. The use case continues at step 1

Use Case

3.6.6 Move a product category

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to change the placement of a category in the categoryhierarchy

Main success scenario

1. The store administrator selects the category to be moved.2. The store administrator indicates the new parent category, if any.3. The system validates that the data is correct.4. The system saves the new placement.

[MoveCategory]

Use Case

3.6.7 Delete a product category

Primary Actor: Store AdministratorPrecondition: The selected category is not the root category of any store.Trigger: The store administrator wants to delete a category

Main success scenario

1. The store administrator selects the category to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the category4. The system deletes the category and all its subcategories. Products of those categories donot belong to them no more.

[DeleteCategory]

Extensions

2a.The store administrator doesn’t want to delete the category2a1. The use case ends

Use Case

3.6.8 Add an attribute

179

Page 181: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add an attribute

Main success scenario

1. The store administrator provides the attribute type.2. The system displays the properties that can be defined for this product

[ShowAttributeProperties]3. The store administrator provides the details of the new attribute4. The system validates that the data is correct.5. The system saves the new attribute.

[NewAttribute]

Use Case

3.6.9 Edit an attribute

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit an attribute

Main success scenario

1. The store administrator selects the attribute to be edited.2. The store administrator provides the new details of the attribute.3. The system validates that the data is correct.4. The system saves the changes.

[EditAttribute]

Use Case

3.6.10 Delete an attribute

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete an attribute

Main success scenario

1. The store administrator selects the attribute to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the attribute4. The system deletes the attribute.

[DeleteAttribute]

Extensions

2a.The store administrator doesn’t want to delete the attribute2a1. The use case ends

Use Case

3.6.11 Add an attribute set

180

Page 182: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add an attribute set

Main success scenario

1. The store administrator provides the details of the new attribute set.2. The system validates that the data is correct.3. The system saves the new attribute set.

[NewAttributeSet]

Use Case

3.6.12 Edit an attribute set

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit an attribute set

Main success scenario

1. The store administrator selects the attribute set to be edited.2. The system shows the attributes associated to the attribute set3. The store administrator provides the new details of the attribute set.4. The system validates that the data is correct.5. The system saves the changes.

[EditAttributeSet]

Extensions

3a.The store administrator wants to remove an attribute from the attribute set3a1. The store administrator selects the attribute to be removed.3a2. The use case continues at step 23b.The store administrator wants to add an attribute to the attribute set3b1. The store administrator selects the attribute to be added.3b2. The use case continues at step 2

Use Case

3.6.13 Delete an attribute set

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete an attribute set

Main success scenario

1. The store administrator selects the attribute set to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the attribute set.4. The system deletes the attribute set.

[DeleteAttributeSet]

Extensions

2a.The store administrator doesn’t want to delete the attribute set.

181

Page 183: Magento Conceptual Schema

2a1. The use case ends

Use Case

3.6.14 Administrate tier prices of a product

Primary Actor: Store AdministratorPrecondition: At least one product is created in the systemTrigger: A customer wants to view or change the tier prices of a product

Main success scenario

1. The store administrator selects a product2. The system displays the current tier prices of the selected product.3. The store administrator selects a tier price to be edited4. The system validates that the data is correct5. The system saves the changes and displays the new product tier prices

[EditTierPrice]The customer repeats steps 2-5 until he is done.

Extensions

3a.The customer doesn’t want tho change the tier price3a1. The use case ends.3b.The customer wants to add a new tier price3b1. The user provides the required data

[NewTierPrice]3b2. The use case continues at step 43c.The customer wants to delete a tier price3c1. The user selects the tier price

[DeleteTierPrice]3c2. The use case continues at step 4

Use Case

3.6.15 Add a catalog price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a catalog price rule

Main success scenario

1. The store administrator provides the details of the new catalog price rule and its condition.2. The system validates that the data is correct.3. The system saves the new catalog price rule.

[NewCatalogPriceRule]

Extensions

3a.The store administrator wants to apply now the rule to the product prices3a1. The system saves the new catalog price rule

[NewCatalogPriceRule]3a2. The system applies the new rule to applicable products in the catalog

[ApplyCatalogPriceRule]3a3. The use case ends.

182

Page 184: Magento Conceptual Schema

Use Case

3.6.16 Edit a catalog price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a catalog price rule

Main success scenario

1. The store administrator selects the catalog price rule to be edited.2. The store administrator provides the new details of the catalog price rule and its condition.3. The system validates that the data is correct.4. The system saves the changes.

[EditCatalogPriceRule]

Extensions

4a.The store administrator wants to apply now the rule to the product prices4a1. The system saves the changes

[EditCatalogPriceRule]4a2. The system applies the new rule to applicable products in the catalog

[ApplyCatalogPriceRule]4a3. The use case ends.

Use Case

3.6.17 Delete a catalog price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a catalog price rule

Main success scenario

1. The store administrator selects the catalog price rule to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the catalog price rule.4. The system deletes the catalog price rule and its condition.

[DeleteCatalogPriceRule]

Extensions

2a.The store administrator doesn’t want to delete the catalog price rule.2a1. The use case ends

Use Case

3.6.18 Add a shopping cart price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a shopping cart price rule

Main success scenario

183

Page 185: Magento Conceptual Schema

1. The store administrator provides the details of the new shopping cart price rule, including itslabels and its condition.2. The system validates that the data is correct.3. The system saves the new shopping cart price rule.

[NewShoppingCartPriceRule]

Use Case

3.6.19 Edit a shopping cart price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a shopping cart price rule

Main success scenario

1. The store administrator selects the shopping cart price rule to be edited.2. The store administrator provides the new details of the shopping cart price rule, including itslabels and its condition.3. The system validates that the data is correct.4. The system saves the changes.

[EditShoppingCartPriceRule]

Use Case

3.6.20 Delete a shopping cart price rule

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a shopping cart price rule

Main success scenario

1. The store administrator selects the shopping cart price rule to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the shopping cart price rule.4. The system deletes the shopping cart price rule and its condition.

[DeleteShoppingCartPriceRule]

Extensions

2a.The store administrator doesn’t want to delete the shopping cart price rule.2a1. The use case ends

184

Page 186: Magento Conceptual Schema

3.7 Additional Activities

Use Case

3.7.1 Tag a product

Primary Actor: CustomerPrecondition: The customer is logged in.The product is enabled in the current website.Trigger: A customer wants to add a tag to a product

Main success scenario

1. The customer selects the product.2. The customer gives the tag name.3. The system saves the association of this tag to a product by the customer in the current storeview

Use Case

3.7.2 Add a tag

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a tag

Main success scenario

1. The store administrator provides the details of the new tag.2. The system validates that the data is correct.3. The system saves the new tag.

[NewTag]

Extensions

1a.The system administrator wants to change shipping method values only for a restricted scope1a1. The system displays the available scopes1a2. The system administrator selects a scope1a3. The use case continues at step 1

Use Case

3.7.3 Edit a tag

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a tag

Main success scenario

1. The store administrator selects the tag to be edited.2. The store administrator provides the new details of the tag, including the products tagged byadministrators with this tag.3. The system validates that the data is correct.4. The system saves the changes.

185

Page 187: Magento Conceptual Schema

[EditTag]

Extensions

2a.The system administrator wants to change shipping method values only for a restricted scope2a1. The system displays the available scopes2a2. The system administrator selects a scope2a3. The use case continues at step 2

Use Case

3.7.4 Delete a tag

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a tag

Main success scenario

1. The store administrator selects the tag to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the tag.4. The system deletes the tag.

[DeleteTag]

Extensions

2a.The store administrator doesn’t want to delete the tag.2a1. The use case ends

Use Case

3.7.5 Show tags of a customer

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: The Customer wants to visualize the tags that he has added

Main success scenario

1. The system shows the tags added by the customer[ShowTagsOfCustomer]

Use Case

3.7.6 Show most popular tags

Primary Actor: CustomerPrecondition: NoneTrigger: The Customer enters to the system

Main success scenario

1. The system shows the most popular tags in the current store view, stressing those who arethe most used.

[ShowPopularTags]

186

Page 188: Magento Conceptual Schema

Use Case

3.7.7 Show all tags

Primary Actor: CustomerPrecondition: NoneTrigger: The Customer enters to the system

Main success scenario

1. The system shows all the tags in the current store view, stressing those who are the mostused.

[ShowAllTags]

Use Case

3.7.8 Add a review

Primary Actor: Customer, Store AdministratorPrecondition: The product is enabled in the current website.Trigger: A customer or store administrator wants to write a review of a product

Main success scenario

1. The customer or store administrator selects a product2. The customer or store administrator provides the content of review and a score for eachproperty

[NewReview]3. The system validates that the data is correct4. The system saves the review

Extensions

2a.The primary actor is an Store Administrator2a1. The store administrator provides also the initial review status and the store views where it isvisible

[NewAdministratorReview]2a2. The use case continues at step 3.

Use Case

3.7.9 Edit a review

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a review

Main success scenario

1. The store administrator selects the review to be edited.2. The store administrator provides the new details of the review, including its status and ratingscores.3. The system validates that the data is correct.4. The system saves the changes.

[EditReview]

187

Page 189: Magento Conceptual Schema

Use Case

3.7.10 Delete a review

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a review

Main success scenario

1. The store administrator selects the review to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the review.4. The system deletes the review.

[DeleteReview]

Extensions

2a.The store administrator doesn’t want to delete the review.2a1. The use case ends

Use Case

3.7.11 Add a review property

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a property

Main success scenario

1. The store administrator provides the details of the new property.2. The system validates that the data is correct.3. The system saves the new property.

[NewProperty]

Use Case

3.7.12 Edit a review property

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a property

Main success scenario

1. The store administrator selects the property to be edited.2. The store administrator provides the new details of the property.3. The system validates that the data is correct.4. The system saves the changes.

[EditProperty]

Use Case

3.7.13 Delete a review property

188

Page 190: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a property

Main success scenario

1. The store administrator selects the property to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the property.4. The system deletes the property.

[DeleteProperty]

Extensions

2a.The store administrator doesn’t want to delete the property.2a1. The use case ends

Use Case

3.7.14 Show reviews of a product

Primary Actor: Customer, Store AdministratorPrecondition: The customer is logged inTrigger: The Customer or the Store Administrator wants to visualize the reviews of a product

Main success scenario

1. The store administrator or the customer selects a product.2. The system shows the reviews of the selected product.

[ShowReviewsOfProduct]

Use Case

3.7.15 Show reviews of a customer

Primary Actor: CustomerPrecondition: The customer is logged inTrigger: The Customer wants to visualize the reviews that he has made

Main success scenario

1. The system shows the reviews written by the customer[ShowReviewsOfCustomer]

Use Case

3.7.16 Add a product to the wish list

Primary Actor: CustomerPrecondition: The product is enabled in the current website.Trigger: A customer wants to add a product to the wish list

Main success scenario

1. The customer selects a product2. The system adds this product to the wish list

189

Page 191: Magento Conceptual Schema

[AddProductToWishlist]3. The system shows the costumer’s wish list.

Extensions

1a.The product is already in the wish list1a1. The use case continues at step 33a.The customer wants to add or edit a comment to a product in the wish list.3a1. The customer provides the comment text.3a2. The system saves the comment.

[AddCommentToWishlistItem]3b.The customer wants to remove a comment from a product in the wish list.3b1. The system deletes the comment.

[RemoveCommentFromWishlistItem]

Use Case

3.7.17 Remove a product from the wish list

Primary Actor: CustomerPrecondition: The customer’s wish list contains one product at least.Trigger: A customer wants to remove a product from the wish list

Main success scenario

1. The customer selects a product from the wish list2. The system removes this product from the wish list

[RemoveProductFromWishlist]

Use Case

3.7.18 Add a product to the compare list

Primary Actor: CustomerPrecondition: The product is enabled in the current websiteTrigger: A customer wants to add a product to the compare list

Main success scenario

1. The customer selects a product2. The system adds this product to the compare list

[AddProductToCompareList]

Extensions

1a.The product is already in the compare list1a1. End of the use case.

Use Case

3.7.19 Remove a product from the compare list

Primary Actor: CustomerPrecondition: The customer’s compare list contains one product at least.Trigger: A customer wants to remove a product from the compare list

190

Page 192: Magento Conceptual Schema

Main success scenario

1. The customer selects a product from the compare list2. The system removes this product from the compare list

[RemoveProductFromCompareList]

Use Case

3.7.20 Share wish list

Primary Actor: CustomerPrecondition: The wish list has at least one productTrigger: A customer wants to share its wish list information

Main success scenario

1. The customer provides multiple email addresses and a message.2. The system sends an email to each address with the message and the customer’s wish listinformation.

Use Case

3.7.21 Subscribe to a product price alert

Primary Actor: CustomerPrecondition: The customer is logged in. Product alerts are enabled for the current website.Theproduct is enabled in the current website.Trigger: A customer wants to subscribe himself to a product price alert

Main success scenario

1. The customer selects the product2. The system signs up the customer for the price alerts of that product.

[SingUpForPriceAlert]

Use Case

3.7.22 Subscribe to a product stock alert

Primary Actor: CustomerPrecondition: The customer is logged in. Product alerts are enabled for the current website andthe product is out of stock.The product is enabled in the current website.Trigger: A customer wants to subscribe himself to a product stock alert

Main success scenario

1. The customer selects the product2. The system signs up the customer for the stock alerts of that product.

[SingUpForStockAlert]

Use Case

3.7.23 Show wish list

Primary Actor: Customer

191

Page 193: Magento Conceptual Schema

Precondition: The customer is logged inTrigger: The customer wants to visualize the products in his wish list.

Main success scenario

1. The system shows the products in the customer’s wish list.[ShowWishList]

Use Case

3.7.24 Show ready to compare products

Primary Actor: CustomerPrecondition: NoneTrigger: The customer wants to visualize the products in his ready to compare list.

Main success scenario

1. The system shows the products in the customer’s ready to compare list.[ShowReadyToCompareProducts]

Use Case

3.7.25 Show recently compared products

Primary Actor: CustomerPrecondition: NoneTrigger: The customer wants to visualize the products on his recently compared list.

Main success scenario

1. The system shows the products in the customer’s recently compared list.[ShowRecentlyComparedProducts]

Use Case

3.7.26 Show recently viewed products

Primary Actor: CustomerPrecondition: NoneTrigger: The customer wants to visualize the products on his recently viewed list.

Main success scenario

1. The system shows the products in the customer’s recently viewed list.[ShowRecentlyViewedProducts]

Use Case

3.7.27 Show compare

Primary Actor: CustomerPrecondition: There is at least one product in the customer’s ready to compare listTrigger: The customer wants to visualize the comparable attributes of products in his ready tocompare list.

192

Page 194: Magento Conceptual Schema

Main success scenario

1. The system shows the comparable attributes of products in the customer’s ready to comparelist.

[ShowCompare]

Use Case

3.7.28 Add a newsletter template

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a newsletter template

Main success scenario

1. The store administrator provides the details of the new newsletter template.2. The system validates that the data is correct.3. The system saves the new newsletter template.

[NewNewsletterTemplate]

Extensions

2a.The store administrator wants to see a preview of the newsletter template.2a1. The system displays a preview of the newsletter template.2a2. The use case continues at step 2

Use Case

3.7.29 Edit a newsletter template

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a newsletter template

Main success scenario

1. The store administrator selects the newsletter template to be edited.2. The store administrator provides the new details of the newsletter template.3. The system validates that the data is correct.4. The system saves the changes.

[EditNewsletterTemplate]

Use Case

3.7.30 Delete a newsletter template

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a newsletter template

Main success scenario

1. The store administrator selects the newsletter template to be deleted.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to delete the newsletter template

193

Page 195: Magento Conceptual Schema

4. The system deletes the newsletter template and all the newsletters created with this template.[DeleteNewsletterTemplate]

Extensions

2a.The store administrator doesn’t want to delete the newsletter template2a1. The use case ends

Use Case

3.7.31 Add a newsletter

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add a newsletter

Main success scenario

1. The store administrator selects the newsletter template that will be used to create this template.2. The store administrator provides the details of the new newsletter, including optionally redefi-nitions of the details taken from the newsletter template.3. The system validates that the data is correct.4. The system saves the new newsletter.

[NewNewsletter]

Use Case

3.7.32 Edit a newsletter

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to edit a newsletter

Main success scenario

1. The store administrator selects the newsletter to be edited.2. The store administrator provides the new details of the newsletter.3. The system validates that the data is correct.4. The system saves the changes.

[EditNewsletter]

Use Case

3.7.33 Subscribe to the newsletter

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to subscribe himself to the newsletter

Main success scenario

1. The customer provides an email2. The system subscribes the costumer to the newsletter of the current store view.

[SignUpForNewsletter]

Extensions

194

Page 196: Magento Conceptual Schema

1a.The customer does not provide an email, but it is a registered customer.1a1. The use case continues at step 21b.The customer does not provide an email and it is not a registered customer.1b1. The system informs the customer that providing an email is mandatory.1b2. The use case continues at step 1

Use Case

3.7.34 Unsubscribe from the newsletter

Primary Actor: CustomerPrecondition: The customer is not subscribed to the newsletter in the current store viewTrigger: A customer wants to unsubscribe himself from the newsletter

Main success scenario

1. The system unsubscribes the costumer from the newsletter in this store view.[SignDownFromNewsletter]

Use Case

3.7.35 Delete a newsletter subscription

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to delete a newsletter subscription.

Main success scenario

1. The store administrator selects the subscription to delete.2. The system deletes the newsletter subscription

[DeleteNewsletterSubscription]

Use Case

3.7.36 Unsubscribe a newsletter subscription

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to unsubscribe a newsletter subscription.

Main success scenario

1. The store administrator selects the subscription to delete.2. The system changes the newsletter subscription status to disabled.

[UnsubscribeNewsletterSubscription]

Use Case

3.7.37 Show shopping cart

Primary Actor: CustomerPrecondition: NoneTrigger: The customer wants to visualize the products in his shopping cart.

195

Page 197: Magento Conceptual Schema

Main success scenario

1. The system shows the products in the costumer’s shopping cart and the quantity chosen foreach item

[ShowShoppingCart]

Use Case

3.7.38 Download a product

Primary Actor: CustomerPrecondition: The customer is logged in. The customer purchased the product. Download isenabled by the system. The download is not expired and the number of download has not beenexceeded.Trigger: A customer wants to download an item of a downloadable product that he has pur-chased.

Main success scenario

1. The customer selects the item to be downloaded[ProductDownload]

2. The system allows the customer downloading the downloadable item

Use Case

3.7.39 Show downloadable products of a customer

Primary Actor: CustomerPrecondition: NoneTrigger: The Customer wants to visualize the downloadable products that he has already pur-chased.

Main success scenario

1. The system shows the downloadable products purchased by the Customer.[ShowDownloadableProductsOfCustomer]

Use Case

3.7.40 Tell to a friend

Primary Actor: CustomerPrecondition: Tell to a friend is enabled by the system. If the customer is not logged in, tell to afriend is also enabled for guests. The number of maximum sents allowed has not been exceededin the current hour.Trigger: A customer wants to send information about a product to a friend with a comment byemail

Main success scenario

1. The customer selects the product to be sent2. The customer provides his name, his friend’s name, his email, his friend’s email and themessage about the product.3. The system saves that the customer has used the "tell to a friend"feature.

[TellToAFriendUsed]

196

Page 198: Magento Conceptual Schema

4. The system sends the email with a link to the current product information.

Use Case

3.7.41 View product information

Primary Actor: CustomerPrecondition: The product is enabled in the current website.Trigger: A customer wants to see detailed information of a product

Main success scenario

1. The customer selects a product2. The system adds the product to the customer’s recently viewed products list

[ProductViewed]3. The system shows the detailled information about this product

[ShowProductInfo]

Use Case

3.7.42 Search products

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to search products by one or more keywords

Main success scenario

1. The customer enters one or more keywords to search2. The system shows the products that fit the keywords.

[ShowFoundProducts]

Use Case

3.7.43 Show the best purchased products

Primary Actor: CustomerPrecondition: NoneTrigger: The Customer enters to the system

Main success scenario

1. The system shows the products in stock that have been purchased more times by the cus-tomers, ordered by the number of times purchased.

[ShowBestPurchasedProducts]

Use Case

3.7.44 Reset the temporal information

Primary Actor: SystemPrecondition: NoneTrigger: An hour has passed since the last time the use case has been applied.

Main success scenario

197

Page 199: Magento Conceptual Schema

1. The system resets to its initial values all the temporal information that should be erased afteran hour.

[ResetTemporalInfo]

198

Page 200: Magento Conceptual Schema

3.8 Online catalog

Use Case

3.8.1 Place an order

Primary Actor: CustomerPrecondition: NoneTrigger: A customer wants to place and order.

Main success scenario

1. At any time before step 11 the customer, may log in:[LogIn]

2. The system adds the contents of the anonymous shopping cart to the customer shopping cart.3. The system displays the contents of the shopping cart.4. The system calculates the applicable discounts to this shopping cart5. The customer browses the product catalog

[ShowProductInfo][ProductViewed]

6. The customer selects a product to buy[AddProductToShoppingCart]

7. The system displays the contents of the shopping cart8. The customer changes the contents of the shopping cart

[UpdateShoppingCart]9. The system updates the shopping cart10. The system displays the contents of the updated shopping cart.The customer repeats steps from 3 to 1 as necessary to build his order.11. The customer checks out the order12. The system shows the default customer’s shipping address.13. The customer accepts the shipping address.14. The system shows the default customer’s billing address.15. The customer accepts the billing address.16. The system shows the available shipping methods with their cost17. The customer selects the preferred shipping method18. The system shows the available payment methods19. The customer selects the preferred payment method20. The system displays a summary of the order.21. The customer confirms the order

[OrderConfirmation]22. The system saves the order23. The system sends an email to the customer with the information about the order.

Extensions

1a.The customer is new1a1.5a.The customer wants to add a product from his wish list5a1. The system displays the contents of the wish list5a2. The use case continues at step 65b.The customer wants to add a product from his ready to compare list5b1. The system displays the contents of the ready to compare list5b2. The use case continues at step 6

199

Page 201: Magento Conceptual Schema

5c.The customer wants to add a product from his recently viewed products list5c1. The system displays the contents of the recently viewed products list5c2. The use case continues at step 65d.The customer wants to add a product from his recently compared products list5d1. The system displays the contents of the recently compared products list5d2. The use case continues at step 68a.The customer wants to use a coupon code8a1. The customer provides the coupon code.8a2. The system checks that the coupon code is applicable.8a3. The system applies the corresponding discount.

[ApplyCouponCode]8a4. The use case continues at step 9.8a2a.The coupon code is not applicable for this shopping cart8a2a1. The use case continues at step 9.8b.The customer wants to estimate the shipping and tax costs of the products in the shoppingcart8b1. The customer provides the Country, Zone or Postal Area where it is located.8b2. The system shows the tax amount associated and adds it to the total order cost8b3. The system shows the available shipping methods with their cost.8b4. The customer selects the preferred shipping method8b5. The system shows the estimated shipping and order’s total cost.

[ShowShippingCost]11a.The customer wants to Checkout with multiple Adresses11a1.11b.The customer is not yet logged in11b1. The system asks the customer to log in himself11b2. The customer logs in.

[LogIn]11b3. The use case continues at step 1211b1a.The customer wants to check out the order without logging in (as guest) and the configu-ration allows it.11b1a1. The customer checks out without logging in.11b1a2. The use case continues at step 1212a, 20b.The customer wants to change the shipping address.12a1. The system shows the know adresses of the customer.12a2. The customer selects a different shipping addres.12a3. The system shows the selected address.12a4. The customer continues with the checkout procedure at step 1312a2a, 14a2a.The customer wants to define a new address12a2a1. The customer gives the new address:

[NewCustomerAddress]12a2a2. The system saves the adress.12a2a3. The system shows the new address.12a2a4. The customer continues with the checkout procedure at step 1312b.All products in the shopping car are virtual or downloadable12b1. The customer continues with the checkout procedure at step 1313a.The customer wants to choose the same billing and shipping address13a1. The customer continues with the checkout procedure at step 1614a, 20b.The customer wants to change the billing address.14a1. The system shows the know adresses of the customer.14a2. The customer selects a different billing addres.14a3. The system shows the selected address14a4. The customer continues with the checkout procedure at step 1616a.The customer wants to add a gift message

200

Page 202: Magento Conceptual Schema

16a1. The customer enters the gift message information16a2. The system saves the gift message

[AddGiftMessage]16a3. The customer continues with the checkout procedure at step 1720a.The customer wants to change the contents of the shopping cart20a1. The customer continues with the checkout procedure at step 3

Use Case

3.8.2 Checkout an order with multiple addresses

Primary Actor: CustomerPrecondition: The customer’s shopping cart is not emptyTrigger: A customer wants to ship the order’s products to multiple adresses

Main success scenario

1. The customer selects the quantity of each product that will be shipped to each address.2. The system shows the available shipping methods.3. The customer chooses a shipping method for each address.4. The system shows the available payment methods and the default billing address5. The customer chooses a payment method for all addresses6. The system displays a summary of the order.7. The customer confirms the order

[OrderConfirmationWithMultipleCheckout]8. The system saves an order for each shipping address.9. For each shipping address, the system sends an email to the customer with the informationabout the order.

Extensions

1a, 4a2a.The customer wants to define a new address1a1. The customer gives the new address:

[NewCustomerAddress]1a2. The system saves the adress.1a3. The system shows the new address.1a4. The customer continues with the checkout procedure at step 12a.The customer wants to add a gift message to any of the addresses2a1. The customer enters the gift message information2a2. The system saves the gift message2a3. The customer continues with the checkout procedure at step 24a.The customer wants to change the billing address.4a1. The system shows all the customer’s addresses4a2. The customer chooses an address.4a3. The customer returns to step 44a2a.The customer wants to edit an Address4a2a1.4a2a2. The customer returns to step 46a.The customer wants to change the quantity of each product that will be shipped to eachaddress6a1. The customer returns to step 16b.The customer wants to change one or more shipping methods6b1. The customer returns to step 26c.The customer wants to change the billing address.

201

Page 203: Magento Conceptual Schema

6c1. The customer returns to step 46d.The customer wants to change the payment method.6d1. The customer returns to step 4

Use Case

3.8.3 Add an order

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to add an order for a registered customer

Main success scenario

1. The store administrator selects the customer.2. The store administrator selects the website where the order will be placed3. The system creates the administration shopping cart that will be used to choose the purchasedproducts

[NewAdministrationShoppingCart]4. The system shows the order settings (currency the order will be placed with, customer group,customer email and shipping and billing addresses) and the customer’s buying activity lists.

[ShowPredefinedOrderSettings][ShowShoppingCart][ShowWishList][ShowReadyToCompareProducts][ShowRecentlyComparedProducts][ShowRecentlyViewedProducts]

5. The system shows the available payment methods and its associated cost6. The store administrator selects a payment method7. The system shows the available shipping methods and its associated cost8. The store administrator selects a shipping methodThe store administrator repeats steps 4 - 8 until he is done.9. The store administrator confirms the current order settings10. The system saves the order

[OrderConfirmation]11. The system deletes the administration shopping cart that has been used.

[DeleteAdministrationShoppingCart]

Extensions

1a.The store administrator wants to add an order for a customer that doesn’t have an account inthe system yet.1a1.2a.The customer’s account is not visible in the selected website2a1. The system creates an account for the registered customer in the selected website

[DuplicateAccount]4a.The store administrator wants to add products to the order4a1. The system shows all the available products4a2. The store administrator selects the products he want to purchase, and defines its quantity.4a3. The system updates the selected products to be purchased

[AddProductToShoppingCart]4a4. The use case continues at step 44b.The store administrator wants to change the currency the order will be placed with4b1. The system displays the available currencies

202

Page 204: Magento Conceptual Schema

4b2. The store administrator selects a currency4b3. The system changes the order’s currency

[ChangeCurrencyOfAdministrationShoppingCart]4b4. The use case continues at step 44c.The store administrator wants to change the address details4c1. The store administrator provides the new address details.4c2. The system changes the new address details of the order.4c3. The use case continues at step 44c1a.The store administrator wants to use a saved customer’s address4c1a1. The system shows the customer’s addresses4c1a2. The store administrator selects an address4c1a3. The system changes the new address details of the order.4c1a4. The use case continues at step 44d.The store administrator wants to change the customer’s group and email4d1. The store administrator provides the new customer’s group and email.4d2. The system updates the changes.

[ChangeEMailAndGroupOfAdministrationShoppingCart]4d3. The use case continues at step 44e.The store administrator wants to apply a shopping cart rule that works with coupon code4e1. The store administrator provides the coupon code.4e2. The system applies the shopping cart rule.

[ApplyCouponCode]4e3. The use case continues at step 44e2a.The coupon code does not match with any applicable rule4e2a1. The system informs the store administrator that coupon code does not match4e2a2. The use case continues at step 44f.The store administrator wants to add to the order a product that appears in the customer’sbuying activity lists.4f1. The store administrator selects the product4f2. The system updates the changes

[AddProductToShoppingCart]4f3. The use case continues at step 44g.The store administrator wants to add a gift message for an item or the entire order4g1. The store administrator selects an item or the whole order.4g2. The store administrator provides the gift messsage’s details.4g3. The system saves the changes.

[AddGiftMessage][AddGiftMessageToItem]

4g4. The use case continues at step 44h.The store administrator wants to add a comment to the order4h1. The store administrator provides the comment’s details.4h2. The system saves the changes.4h3. The use case continues at step 410a.The order has no products added, no payment or shipping method selected or missing ad-dress and customer information.10a1. The system shows to the customer the information that is missing.10a2. The use case continues at step 410b.The store administrator wants to save the billing or shipping address in the address book10b1. The system saves the new address

[NewCustomerAddress]10b2. The system saves the order

[OrderConfirmation]

203

Page 205: Magento Conceptual Schema

Use Case

3.8.4 Cancel an order

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to cancel an order

Main success scenario

1. The store administrator selects the order to be cancelled.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to cancel the order.4. The system sets the order status to cancelled.

[CancelOrder]

Extensions

2a.The store administrator doesn’t want to cancel the order.2a1. The use case ends

Use Case

3.8.5 Hold an order

Primary Actor: Store AdministratorPrecondition: The order is not already hold.Trigger: The store administrator wants to put an order on hold.

Main success scenario

1. The store administrator selects the order to be on hold.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to put the order on hold.4. The system sets the order status to hold.

[HoldOrder]

Extensions

2a.The store administrator doesn’t want to puth the order on hold.2a1. The use case ends

Use Case

3.8.6 Unhold an order

Primary Actor: Store AdministratorPrecondition: The order is not already unhold.Trigger: The store administrator wants to release an order from holding status.

Main success scenario

1. The store administrator selects the order to be released from holding status.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to release an order from holding status.4. The system sets the order status to its corresponding status.

[UnholdOrder]

204

Page 206: Magento Conceptual Schema

Extensions

2a.The store administrator doesn’t want to release an order from holding status.2a1. The use case ends

Use Case

3.8.7 Reorder

Primary Actor: Customer, Store AdministratorPrecondition: An order is already placed by the customerTrigger: A customer or the store administrator wants to reorder the items purchased in a previousorder.

Main success scenario

1. The customer or store administrator selects the order to be reordered.2. The system adds to the customer shopping cart all the products in the selected order

[Reorder]3. The customer starts a checkout procedure

Extensions

2a.The primary actor is the store administrator2a1. The use case continues at step 3

Use Case

3.8.8 Add a gift message to a placed order

Primary Actor: Store AdministratorPrecondition: At least one order is placed in the systemTrigger: The customer asks the store administrator to add a gift message to an entire order or toa order line.

Main success scenario

1. The store administrator selects the order or the order line.2. The store administrator provides the information about the gift message.3. The system saves the gift message.

[AddGiftMessageToExistingOrder]

Use Case

3.8.9 Print an Order

Primary Actor: CustomerPrecondition: The order is placed.Trigger: A customer wants to print a summary of an order.

Main success scenario

1. The customer selects the order to be printed2. The system allows the customer printing the order summary

205

Page 207: Magento Conceptual Schema

Use Case

3.8.10 Send order information by email

Primary Actor: Store AdministratorPrecondition: At least one order is placed in the systemTrigger: The store administrator wants to send and email to a customer with the details of anorder he has purchased.

Main success scenario

1. The store administrator selects the order.2. The system asks the store administrator a confirmation3. The store administrator confirms that he wants to send the email.4. The system sends an email to the customer with the order details.

Extensions

2a.The store administrator doesn’t want to send the email.2a1. The use case ends

Use Case

3.8.11 Show previous orders of a customer

Primary Actor:Precondition: The customer is logged inTrigger: The Customer wants to visualize his orders

Main success scenario

1. The system shows the previous orders made by the customer[ShowOrdersOfCustomer]

Use Case

3.8.12 Add an invoice

Primary Actor: Store AdministratorPrecondition: At least one order is placed in the system, with not all products invoiced.Trigger: The store administrator wants to generate an invoice for a saved order.

Main success scenario

1. The store administrator selects the order2. The system shows the information about the invoice it is going to create3. The store administrator confirms he wants to create the invoice.4. The system creates the invoice

[AddInvoice]

Extensions

3a.The store administrator wants to change the quantity invoiced for each product3a1. The store administrator defines the quantity he wants to invoice for each product.3a2. The system validates that the data is correct.3a3. The use case continues at step 23b.The store administrator wants to add a comment to the invoice

206

Page 208: Magento Conceptual Schema

3b1. The store administrator provides the comment3b2. The use case continues at step 24a.The store administrator wants to send an email confirmation to the customer4a1. The system sends an email confirmation to the customer’s address.4a2. The system creates the invoice

[AddInvoice]4a3. The use case ends.4b.The store administrator wants to create a shipment with the same products of the invoice4b1. The system creates both the shipment and the invoice

[AddInvoice][AddShipment]

4b2. The use case ends.4b1a.The store administrator wants to add a tracking number to the shipment4b1a1. The store administrator provides the tracking number details4b1a2. The use case continues at step 1

Use Case

3.8.13 Register an invoice payment

Primary Actor: Store AdministratorPrecondition: At least one pending invoice is placed in the system.Trigger: The store administrator wants to register the payment of a saved invoice.

Main success scenario

1. The store administrator selects the invoice to be paid.2. The system registers that the payment has been made.

[PayInvoice]

Use Case

3.8.14 Cancel an invoice

Primary Actor: Store AdministratorPrecondition: At least one not cancelled invoice is placed in the system.Trigger: The store administrator wants to cancel an invoice.

Main success scenario

1. The store administrator selects the invoice.2. The system cancels the invoice.

[CancelInvoice]

Use Case

3.8.15 Add a shipment

Primary Actor: Store AdministratorPrecondition: At least one order is placed in the system, with not all products shipped.Trigger: The store administrator wants to generate a refund for a saved order.

Main success scenario

1. The store administrator selects the order

207

Page 209: Magento Conceptual Schema

2. The system shows the information about the shipment it is going to create3. The store administrator confirms he wants to create the shipment.4. The system creates the shipment

[AddShipment]

Extensions

3a.The store administrator wants to change the quantity shipped for each product3a1. The store administrator defines the quantity he wants to ship for each product.3a2. The system validates that the data is correct.3a3. The use case continues at step 23b.The store administrator wants to add a tracking number to the shipment3b1. The store administrator provides the tracking number details3b2. The use case continues at step 23c.The store administrator wants to add a comment to the shipment3c1. The store administrator provides the comment3c2. The use case continues at step 24a.The store administrator wants to send an email confirmation to the customer4a1. The system sends an email confirmation to the customer’s address.4a2. The system creates the shipment

[AddShipment]4a3. The use case ends.

Use Case

3.8.16 Add a refund

Primary Actor: Store AdministratorPrecondition: At least one order is placed in the system, with at least one product invoiced.Trigger: The store administrator wants to generate a refund for a saved order.

Main success scenario

1. The store administrator selects the order2. The system shows the information about the refund it is going to create3. The store administrator confirms he wants to create the refund.4. The system creates the refund

[AddRefund]

Extensions

3a.The store administrator wants to change the quantity refunded for each product3a1. The store administrator defines the quantity he wants to refund for each product.3a2. The system validates that the data is correct.3a3. The use case continues at step 23b.The store administrator wants to add a comment to the refund3b1. The store administrator provides the comment3b2. The use case continues at step 24a.The store administrator wants to send an email confirmation to the customer4a1. The system sends an email confirmation to the customer’s address.4a2. The system creates the refund

[AddRefund]4a3. The use case ends.

208

Page 210: Magento Conceptual Schema

Use Case

3.8.17 Cancel a refund

Primary Actor: Store AdministratorPrecondition: At least one non cancelled refund is placed in the system.Trigger: The store administrator wants to cancel a refund.

Main success scenario

1. The store administrator selects the refund.2. The system cancels the refund.

[CancelRefund]

Use Case

3.8.18 Add a comment to an order, invoice, shipment or refund.

Primary Actor: Store AdministratorPrecondition: At least one invoice is placed in the systemTrigger: The store administrator wants to add a comment to a saved order, invoice, shipment orrefund.

Main success scenario

1. The store administrator selects the order, invoice, shipment or refund2. The system shows the information about the order, invoice, shipment or refund.3. The store administrator provides the comment4. The system saves the comment.

[AddComment]

Extensions

3a.The store administrator wants to send an email notification to the customer3a1. The system sends an email confirmation to the customer’s address.3a2. The use case continues at step 1.

209

Page 211: Magento Conceptual Schema

3.9 Store Reports

Use Case

3.9.1 Show the sales report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the sales in the system.

Main success scenario

1. The store administrator provides the details to delimit the orders that will appear in the report,including the time period and scope.2. The system shows the orders that meet the provided details.

[ShowSalesReport]

Use Case

3.9.2 Show the tax report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the tax information of thesystem.

Main success scenario

1. The store administrator provides the details to delimit the tax information that will appear in thereport, including the time period and scope.2. The system shows the tax information that meet the provided details.

[ShowTaxInformationReport]

Use Case

3.9.3 Show the shipping report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the shipping information of thesystem.

Main success scenario

1. The store administrator provides the details to delimit the shipping information that will appearin the report, including the time period and scope.2. The system shows the shipping information that meet the provided details.

[ShowShippingInformationReport]

Use Case

3.9.4 Show the invoices report

210

Page 212: Magento Conceptual Schema

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the invoices in the system.

Main success scenario

1. The store administrator provides the details to delimit the invoices that will appear in the report,including the time period and scope.2. The system shows the invoices that meet the provided details.

[ShowInvoicesReport]

Use Case

3.9.5 Show the refunds report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the refunds in the system.

Main success scenario

1. The store administrator provides the details to delimit the refunds that will appear in the report,including the time period and scope.2. The system shows the refunds that meet the provided details.

[ShowRefundsReport]

Use Case

3.9.6 Show the coupon codes report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the coupon codes used in thesystem.

Main success scenario

1. The store administrator provides the details to delimit the coupon codes that will appear in thereport, including the time period and scope.2. The system shows the coupon codes that meet the provided details and the orders where ithave been used.

[ShowCouponCodeReport]

Use Case

3.9.7 Show the products in carts report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize the products that appear in any shopping cartin the system.

Main success scenario

1. The system shows the products that appear in any shopping cart in the system.

211

Page 213: Magento Conceptual Schema

[ShowProductsInCartsReport]

Extensions

1a.The store administrator wants to visualize the information for only a restricted scope1a1. The system displays the available scopes1a2. The system administrator selects a scope1a3. The use case continues at step 1

Use Case

3.9.8 Show the abandoned carts report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize the carts of customers who added productsto their shopping cart and then logged out.

Main success scenario

1. The system shows he carts of customers who added products to their shopping cart and thenlogged out.

[ShowAbandonedCartsReport]

Extensions

1a.The store administrator wants to visualize the information for only a restricted scope1a1. The system displays the available scopes1a2. The system administrator selects a scope1a3. The use case continues at step 1

Use Case

3.9.9 Show the bestseller products report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the bestseller products in thesystem.

Main success scenario

1. The store administrator provides the time period and scope to delimit the besteller productsthat will appear in the report.2. The system shows the best seller products in the system.

[ShowBestsellersReport]

Use Case

3.9.10 Show the ordered products report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of all the ordered products in thesystem.

212

Page 214: Magento Conceptual Schema

Main success scenario

1. The store administrator provides the time period and scope to delimit the besteller productsthat will appear in the report.2. The system shows the ordered products products in the system.

[ShowOrderedProductsReport]

Use Case

3.9.11 Show the most viewed products report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the most viewed products inthe system.

Main success scenario

1. The store administrator provides the time period and scope to delimit the most viewed productsthat will appear in the report.2. The system shows the most viewed products in the system.

[ShowMostViewedProductsReport]

Use Case

3.9.12 Show the stock of products report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the stock properties of theproducts in the system.

Main success scenario

1. The store administrator provides the scope to delimit the products that will appear in the report.2. The system shows the products in the system, ordered by its remaining quantity in stock.

[ShowStockOfProductsReport]

Use Case

3.9.13 Show the downloads report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the downloads the customershave made in the system.

Main success scenario

1. The store administrator provides the scope to delimit the downloads that will appear in thereport.2. The system shows the downloads the customers have made in the system.

[ShowDownloadsReport]

213

Page 215: Magento Conceptual Schema

Use Case

3.9.14 Show the new customer accounts report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the customer accounts thathave been created in the system.

Main success scenario

1. The store administrator provides the time period and scope to delimit the accounts that willappear in the report.2. The system shows the customer accounts that have been created in the system..

[ShowNewCustomerAccountsReport]

Use Case

3.9.15 Show the customers by orders total report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the orders that each customerhas placed, ordering customers by the total amount of its orders.

Main success scenario

1. The store administrator provides the time period and scope to delimit the orders that will appearin the report.2. The system shows the orders that each customer has placed, ordering customers by the totalamount of its orders

[ShowCustomersByOrdersTotalReport]

Use Case

3.9.16 Show the customers by number of orders report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the orders that each customerhas placed, ordering customers by the number of orders they have placed.

Main success scenario

1. The store administrator provides the time period and scope to delimit the orders that will appearin the report.2. The system shows the orders that each customer has placed, ordering customers by thenumber of orders they have placed

[ShowCustomersByNumberOfOrdersReport]

Use Case

3.9.17 Show the customer reviews report

Primary Actor: Store Administrator

214

Page 216: Magento Conceptual Schema

Precondition: NoneTrigger: The store administrator wants to visualize a summary of the registered customers thathave placed a review.

Main success scenario

1. The system shows the customers that have placed a review and the number of total reviewsthat they have placed.

[ShowCustomerReviewsReport]

Use Case

3.9.18 Show the product reviews report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the products that have receiveda review.

Main success scenario

1. The system shows the products that have received one or more reviews.[ShowProductsReviewsReport]

Use Case

3.9.19 Show the tags by customer report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the customers who have sub-mitted approved tags.

Main success scenario

1. The system shows the customers who have submitted approved tags, and the number ofapproved tags they have submitted.

[ShowTagsByCustomerReport]

Use Case

3.9.20 Show the tags by product report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of the products for which tagshave been submitted.

Main success scenario

1. The system shows the products for which tags have been submitted, and the number ofapproved tags.

[ShowTagsByProductReport]

215

Page 217: Magento Conceptual Schema

Use Case

3.9.21 Show the popular tags report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of all the approved tags in thesystem, ordered by the times it have been used.

Main success scenario

1. The store administrator provides the scope to delimit the tags that will appear in the report.2. The system shows all the approved tags in the system, ordered by the times it have beenused.

[ShowPopularTagsReport]

Use Case

3.9.22 Show the search terms report

Primary Actor: Store AdministratorPrecondition: NoneTrigger: The store administrator wants to visualize a summary of all the search terms used bycustomers.

Main success scenario

1. The system shows all the search terms used by customers and the number of results thatdisplayed the last time the search term was used.

[ShowPopularTagsReport]

216

Page 218: Magento Conceptual Schema

4Behavioral Schema. Events Specification

In this chapter we develop the second part of the behavioral schema of the Magento informationsystem: the specification of the Events defined in chapter 3. Section 4.1 defines the scope ofthe events elicitation, while section 4.2 describes the way the schema is presented. Section 4.3presents an overview of the described Events, which are detailed in the remaining sections.

4.1 ScopeEvent’s specification assumes that a set of events can be implicitly defined without explicitlyspecifying them.

The whole schema and information base is assumed to be visible to the actors that interactwith the system. Therefore, we assume that Queries, which only retrieve information from the IB,can be infered by its definition.

Secondly, for each entity type three basic Events1are assumed to exist: New, Edit and Deleteevents. They are known as Structural Events (see ?). In this chapter, they will be specified onlyif their effect or initial integrity constraints are relevant. For the remaining events, the followingbehaviour is assumed:

New: creates a new object as an instance of the class specified in the event’s name. The eventclass has the same attributes and relationship types as the created object’s class, so itsvalues are copied from one object to another.

Edit: replaces the values of an existing object. As New, event and edited classes have the sameattributes and relationship types. A relationship is also defined between the two classes, toidentify the existing object whose values will be replaced.

Delete: deletes an object. If other objects are related to it with a multiplicity of 1, it may be deletedtoo.

Some entities in the schema mantain information about the system’s configuration. In thosecases, no “New” or “Delete” Structural Event is defined. They are assumed to have the samebehaviour as “Edit” Structural Events, excepting that the event can not replace the relationship

1In permanent entities, no “Delete” Event can be defined. In constant entities, there can’t be “New” or “Delete” Eventsdefined.

217

Page 219: Magento Conceptual Schema

with an store view or a website (it represents the scope where this configuration is applied).

Thirdly, events specification only concerns about Simple Products. Thus, the following events arespecified by supposing that the related product is simple:

n NewProduct

n EditProduct

n AddProductToShoppingCart

n UpdateShoppingCart

n OrderConfirmation

Other events that concern specifically on Non-Simple Products are listed but not specified.A second iteration on the current project work should extend this scope (see section ??).

4.2 Schema presentationFirst of all, we describe a complete list of the events, detailing those which are specified or onlylisted, and the Use Case group they belong to.

In the next sections, the following information is given for each specified event:

n Event Specification: following the approach presented in ?, events are modelized as entitytypes. It’s attributes and relationship types (and those inherited from other events throughgeneralization/specialization) represent the information needed for its execution.

n Initial Integrity Constraints: used as preconditions, they specify in OCL the state of theinformation base in which the event can be instantiated.

n Effect: all events use an effect operation, whose OCL postconditions define the changesmade made in the information base when the event occurs.

Events specification is organized in the same six groups as Use Cases, described in sections 2.3and 3.2.

Event Specification sections define textually the event’s attributes and relationships. We usehere an example to show the way they are described. First, we show the way it will be describedby a classic UML Diagram.

218

Page 220: Magento Conceptual Schema

In the following sections, this event would be textually specified as follows:

Attributesattribute2 : Type2 [multiplicity4]

Relationshipsrole2 : Class2 [multiplicity2]

GeneralizationsAttributes inherited from AbstractEvent1attribute1 : Type1 [multiplicity3]

Relationships inherited from AbstractEvent1role1 : Class1 [multiplicity1]

The correspondance between textual and visual specifications can be easily established. Notethat the multiplicity of an event role in all its relationships is assumed to be [*].

4.3 Events Overview

First of all, we present a summary of all the events specified in the use case specification. Assome events are not specified (see scope restrictions in section 4.1), the criteria for not specifyingthem is listed below the event name. The specified events are highlighted in bold.

n Store Configuration

– NewWebsite. This event is a non-specified Structural Event.

– EditWebsite. This event is a non-specified Structural Event.

– DeleteWebsite. This event is a non-specified Structural Event.

– SetDefaultWebsite

– NewStore. This event is a non-specified Structural Event.

– EditStore. This event is a non-specified Structural Event.

– DeleteStore. This event is a non-specified Structural Event.

– SetDefaultStoreOfWebsite

– NewStoreView. This event is a non-specified Structural Event.

– EditStoreView. This event is a non-specified Structural Event.

– DeleteStoreView. This event is a non-specified Structural Event.

– SetDefaultStoreViewOfStore

– SetDefaultLanguage

– ChangeCatalogConfiguration. This event changes system configuration parameters.

– ChangeStockConfiguration. This event changes system configuration parameters.

– ChangeWishListConfiguration. This event changes system configuration parameters.

– ChangeSalesConfiguration. This event changes system configuration parameters.

– ChangeCustomerConfiguration. This event changes system configuration parameters.

– ChangeTaxConfiguration. This event changes system configuration parameters.

– ChangeShippingConfiguration. This event changes system configuration parameters.

– ChangeTellToAFriendConfiguration. This event changes system configuration parameters.

– ChangeCurrencyConfiguration. This event changes system configuration parameters.

219

Page 221: Magento Conceptual Schema

– ChangeEnabledCurrencies. This event changes system configuration parameters.

– UpdateCurrencyValue. This event changes system configuration parameters.

– ChangeGeographicalConfiguration. This event changes system configuration parameters.

– EditShippingMethods. This event changes system configuration parameters.

– EditPaymentMethods. This event changes system configuration parameters.

– NewCustomerTaxClass. This event is a non-specified Structural Event.

– EditCustomerTaxClass. This event is a non-specified Structural Event.

– DeleteCustomerTaxClass. This event is a non-specified Structural Event.

– NewProductTaxClass. This event is a non-specified Structural Event.

– EditProductTaxClass. This event is a non-specified Structural Event.

– DeleteProductTaxClass. This event is a non-specified Structural Event.

– NewTaxRate. This event is a non-specified Structural Event.

– EditTaxRate. This event is a non-specified Structural Event.

– DeleteTaxRate. This event is a non-specified Structural Event.

– NewTaxRule. This event is a non-specified Structural Event.

– EditTaxRule. This event is a non-specified Structural Event.

– DeleteTaxRule. This event is a non-specified Structural Event.

n Customers

– CreateCustomer

– PasswordChange

– EditCustomerDetails

– NewCustomerAddress

– DeleteCustomerAddress

– DefaultDeliveryAddressChange

– DefaultBillingAddressChange

– EditCustomerAddress

– EditCustomer. This event is a non-specified Structural Event.

– DeleteCustomer. This event is a non-specified Structural Event.

– ShowAccountInformation. This event is a query.

– ShowAddresses. This event is a query.

– NewCustomerGroup. This event is a non-specified Structural Event.

– EditCustomerGroup. This event is a non-specified Structural Event.

– DeleteCustomerGroup. This event is a non-specified Structural Event.

– NewAdministrator. This event is a non-specified Structural Event.

– EditAdministrator. This event is a non-specified Structural Event.

– DeleteAdministrator. This event is a non-specified Structural Event.

– NewRole. This event is a non-specified Structural Event.

– EditRole. This event is a non-specified Structural Event.

– DeleteRole. This event is a non-specified Structural Event.

– LogIn

– RestorePreviousShoppingCart

– RestorePreviousProductLists

220

Page 222: Magento Conceptual Schema

– LogOut

– SaveCurrentProductLists

– NewSession

– DeleteSession

– SetCurrentWebsite

– SetCurrentStore

– SetCurrentStoreView

– SetCurrentCurrency

n Store Administration

– ShowProductPropertiesAndAbleToRateAttributes. This event is a query.

– NewProduct

– EditProduct

– DeleteProduct

– NewCategory. This event is a non-specified Structural Event.

– EditCategory. This event is a non-specified Structural Event.

– MoveCategory

– DeleteCategory. This event is a non-specified Structural Event.

– ShowAttributeProperties. This event is a query.

– NewAttribute

– EditAttribute

– DeleteAttribute

– NewAttributeSet. This event is a non-specified Structural Event.

– EditAttributeSet. This event is a non-specified Structural Event.

– DeleteAttributeSet. This event is a non-specified Structural Event.

– NewTierPrice. This event is a non-specified Structural Event.

– EditTierPrice. This event is a non-specified Structural Event.

– DeleteTierPrice. This event is a non-specified Structural Event.

– NewCatalogPriceRule. This event is a non-specified Structural Event.

– EditCatalogPriceRule. This event is a non-specified Structural Event.

– ApplyCatalogPriceRule. This event .

– DeleteCatalogPriceRule. This event is a non-specified Structural Event.

– ApplyAllCatalogPriceRules. This event .

– NewShoppingCartPriceRule. This event is a non-specified Structural Event.

– EditShoppingCartPriceRule. This event is a non-specified Structural Event.

– DeleteShoppingCartPriceRule. This event is a non-specified Structural Event.

n Additional Activities

– NewTag. This event is a non-specified Structural Event.

– EditTag. This event is a non-specified Structural Event.

– DeleteTag. This event is a non-specified Structural Event.

– ShowTagsOfCustomer. This event is a query.

– ShowPopularTags. This event is a query.

221

Page 223: Magento Conceptual Schema

– ShowAllTags. This event is a query.

– NewReview

– NewAdministratorReview

– EditReview. This event is a non-specified Structural Event.

– DeleteReview. This event is a non-specified Structural Event.

– NewProperty. This event is a non-specified Structural Event.

– EditProperty. This event is a non-specified Structural Event.

– DeleteProperty. This event is a non-specified Structural Event.

– ShowReviewsOfProduct. This event is a query.

– ShowReviewsOfCustomer. This event is a query.

– AddProductToWishlist

– AddCommentToWishlistItem

– RemoveCommentFromWishlistItem

– RemoveProductFromWishlist

– AddProductToCompareList

– RemoveProductFromCompareList

– SingUpForPriceAlert

– SingUpForStockAlert

– ShowWishList. This event is a query.

– ShowReadyToCompareProducts. This event is a query.

– ShowRecentlyComparedProducts. This event is a query.

– ShowRecentlyViewedProducts. This event is a query.

– ShowCompare. This event is a query.

– NewNewsletterTemplate. This event is a non-specified Structural Event.

– EditNewsletterTemplate. This event is a non-specified Structural Event.

– DeleteNewsletterTemplate. This event is a non-specified Structural Event.

– NewNewsletter. This event is a non-specified Structural Event.

– EditNewsletter. This event is a non-specified Structural Event.

– SignUpForNewsletter

– SignDownFromNewsletter

– DeleteNewsletterSubscription. This event is a non-specified Structural Event.

– UnsubscribeNewsletterSubscription. This event .

– ShowShoppingCart. This event is a query.

– ProductDownload. This event concerns specifically on Non-Simple Products.

– ShowDownloadableProductsOfCustomer. This event concerns specifically on Non-Simple Prod-ucts.

– TellToAFriendUsed

– ProductViewed

– ResetTemporalInfo

n Online catalog

– ShowProductInfo. This event is a query.

– ProductViewed

222

Page 224: Magento Conceptual Schema

– AddProductToShoppingCart

– UpdateShoppingCart

– ApplyCouponCode

– ShowShippingCost. This event is a query.

– OrderConfirmation

– OrderConfirmationWithMultipleCheckout. This event concerns specifically on Non-Simple Prod-ucts.

– DuplicateAccount

– NewAdministrationShoppingCart

– ShowPredefinedOrderSettings. This event is a query.

– ShowShoppingCart. This event is a query.

– ShowWishList. This event is a query.

– ShowReadyToCompareProducts. This event is a query.

– ShowRecentlyComparedProducts. This event is a query.

– ShowRecentlyViewedProducts. This event is a query.

– ShowFoundProducts. This event is a query.

– ShowBestPurchasedProducts. This event is a query.

– AddProductToShoppingCart

– ChangeCurrencyOfAdministrationShoppingCart

– ChangeEMailAndGroupOfAdministrationShoppingCart

– ApplyCouponCode

– AddProductToShoppingCart

– AddGiftMessage

– AddGiftMessageToItem

– AddGiftMessageToExistingOrder. This event .

– OrderConfirmation

– DeleteAdministrationShoppingCart

– CancelOrder

– HoldOrder

– UnholdOrder

– Reorder

– ShowOrdersOfCustomer. This event is a query.

– AddInvoice

– PayInvoice

– CancelInvoice

– AddShipment

– AddRefund

– CancelRefund

– AddComment

n Store Reports

– ShowSalesReport. This event is a query.

– ShowTaxInformationReport. This event is a query.

223

Page 225: Magento Conceptual Schema

– ShowShippingInformationReport. This event is a query.

– ShowInvoicesReport. This event is a query.

– ShowRefundsReport. This event is a query.

– ShowCouponCodeReport. This event is a query.

– ShowProductsInCartsReport. This event is a query.

– ShowAbandonedCartsReport. This event is a query.

– ShowBestsellersReport. This event is a query.

– ShowOrderedProductsReport. This event is a query.

– ShowMostViewedProductsReport. This event is a query.

– ShowStockOfProductsReport. This event is a query.

– ShowDownloadsReport. This event is a query.

– ShowNewCustomerAccountsReport. This event is a query.

– ShowCustomersByOrdersTotalReport. This event is a query.

– ShowCustomersByNumberOfOrdersReport. This event is a query.

– ShowCustomerReviewsReport. This event is a query.

– ShowProductsReviewsReport. This event is a query.

– ShowTagsByCustomerReport. This event is a query.

– ShowTagsByProductReport. This event is a query.

– ShowPopularTagsReport. This event is a query.

– ShowPopularTagsReport. This event is a query.

Several events can be modelised as specializations of an abstract event, as structural entitiesdo (see section 1.2). The abstract events specified here do not define initial integrity constraintsor effect postconditions, but attributes and relationships that will be inherited by concrete events.Accordingly, they are not defined in any Use Case and represent any valid change on the IB. Wepresent here the specification of those Abstract Events:

n ScopeDefinedEventRelationshipseditForWebsiteScope : Website [0..1]editForStoreViewScope : StoreView [0..1]

n ExistingOrderEvent

Relationshipsorder : Order [1]

n ExistingCustomerEvent

Relationshipscustomer : Customer [1]

224

Page 226: Magento Conceptual Schema

n ExistingAdministratorEvent

Relationshipsadministrator : Administrator [1]

n StoreViewPlacedEvent

RelationshipsstoreView : StoreView [1]

n ExistingAdministrationShoppingCartEvent

RelationshipsshoppingCart : AdministrationShoppingCart [1]

n ExistingShoppingCartEvent

RelationshipsshoppingCart : ShoppingCart [1]

n ExistingSessionEvent

Relationshipssession : Session [1]

n ExistingCustomerSessionEvent

RelationshipscustomerSession : CustomerSession [1]

n ExistingWishListItemEvent

RelationshipswishListItem : WishListItem [1]

n ExistingProductEvent

Relationshipsproduct : Product [1]

225

Page 227: Magento Conceptual Schema

4.4 Store Configuration

Event

4.4.1 SetDefaultWebsiteFrom use case: Select the default website

n Event SpecificationRelationshipswebsite : Website [1]

n Effect

context SetDefaultWebsite::effect()

post:

System.allInstances->any(true).defaultWebsite = self.website

Event

4.4.2 SetDefaultStoreOfWebsiteFrom use case: Select the default store of a website

n Event SpecificationRelationshipsstore : Store [1]website : Website [1]

n Initial Integrity Constraints

context SetDefaultStoreOfWebsite :: storeBelongsToWebsite() : Booleanbody:

self.website.store->includes(self.store)

n Effect

context SetDefaultStoreOfWebsite::effect()

post:

self.website.defaultStore = self.store

226

Page 228: Magento Conceptual Schema

Event

4.4.3 SetDefaultStoreViewOfStoreFrom use case: Select the default store view of a store

n Event SpecificationRelationshipsstoreView : StoreView [1]store : Store [1]

n Initial Integrity Constraints

context SetDefaultStoreViewOfStore :: storeBelongsToWebsite() : Booleanbody:

self.store.storeView->includes(self.storeView)

n Effect

context SetDefaultStoreViewOfStore::effect()

post:

self.store.defaultStoreView = self.storeView

Event

4.4.4 SetDefaultLanguageFrom use case: Select the default language

n Event SpecificationRelationshipslanguage : Language [1]

GeneralizationsRelationships inherited from ScopeDefinedEventeditForWebsiteScope : Website [0..1]editForStoreViewScope : StoreView [0..1]

n Initial Integrity Constraints

context SetDefaultLanguage :: notTwoScopesDefined() : Booleanbody:

self.editForWebsiteScope.isEmpty() or self.editForStoreViewScope.isEmpty()

227

Page 229: Magento Conceptual Schema

n Effect

context SetDefaultLanguage::effect()

post:if self.editForWebsiteScope.notEmpty() then

self.editForWebsiteScope.store.storeView -> forAll(stv|stv.language = self.language)else if self.editForStoreViewScope.notEmpty() then

self.editForStoreViewScope.language = self.languageelse

StoreView.allInstances -> forAll(stv|stv.language = self.language)endif endif

228

Page 230: Magento Conceptual Schema

4.5 Customers

Event

4.5.1 CreateCustomerFrom use case: Create a Customer

n Event SpecificationAttributeseMail : EMail [1]firstName : String [1]lastName : String [1]password : String [1]passwordConfirmation : String [1]namePrefix : String [0..1]middleName : String [0..1]nameSuffix : String [0..1]dateOfBirth : Date [0..1]taxVatNumber : String [0..1]

GeneralizationsRelationships inherited from StoreViewPlacedEventstoreView : StoreView [1]

n Initial Integrity Constraints

context CreateCustomer :: customerDoesNotExist() : Booleanbody:

not Customer.allInstances() -> exists (c |c.eMail = self.eMail and c.websiteWhereIsVisible -> includes ( self.storeView.store.website )

)

context CreateCustomer :: passwordCorrect() : Booleanbody:

self.password = self.passwordConfirmation

n Effect

context CreateCustomer::effect()

post:c.oclIsNew() and

c.oclIsTypeOf(Customer) andc.eMail = self.eMail andc.firstName = self.firstName andc.lastName = self.lastName andc.password = self.password andc.namePrefix = self.namePrefix andc.middleName = self.middleName andc.nameSuffix = self.nameSuffix andc.dateOfBirth = self.dateOfBirth andc.taxVatNumber = self.taxVatNumber andc.createdAt = Now() andc.storeViewWhereIsCreated = self.storeView andc.websiteWhereIsAssociated = self.storeView.store.website and

229

Page 231: Magento Conceptual Schema

c.customerGroup = self.storeView.customerConfigurationInStoreView.defaultCustomerGroup

Event

4.5.2 PasswordChangeFrom use case: Change password

n Event SpecificationAttributesoldPassword : String [1]newPassword : String [1]newPasswordConfirmation : String [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context PasswordChange :: oldPasswordIsCorrect() : Booleanbody:

customer.password = self.oldPassword

context PasswordChange :: passwordCorrect() : Booleanbody:

self.newPassword = self.newPasswordConfirmation

n Effect

context PasswordChange::effect()

post:

self.customer.password = self.newPassword

Event

4.5.3 EditCustomerDetailsFrom use case: Change customer details

n Event SpecificationAttributesnewFirstName : String [1]newLastName : String [1]newEMail : EMail [1]

230

Page 232: Magento Conceptual Schema

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from StoreViewPlacedEventstoreView : StoreView [1]

n Initial Integrity Constraints

context EditCustomerDetails :: customerDoesNotExist() : Booleanbody:

not Customer.allInstances() -> exists (c |c.eMail = self.newEMail and c.websiteWhereIsVisible -> includes ( self.storeView.store.website )

)

n Effect

context EditCustomerDetails::effect()

post:self.customer.firstName = self.newFirstName and

self.customer.lastName = self.newLastName andself.customer.eMail = self.newEMail

Event

4.5.4 NewCustomerAddressFrom use case: Administrate address book, Place an Order, Checkout with multiple addresses, Add an order

n Event SpecificationAttributesnewFirstName : String [1]newMiddleName : String [0..1]newLastName : String [1]newNamePrefix : String [0..1]newNameSuffix : String [0..1]newCompany : String [0..1]newStreetAddress : String [1]newTelephone : String [1]newFax : String [0..1]

Relationshipscountry : Country [1]zone : Zone [0..1]municipality : Municipality [1]postalArea : PostalArea [0..1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context NewCustomerAddress :: hasACorrectZoneIfItIsNeeded() : Boolean

231

Page 233: Magento Conceptual Schema

body:

self.country.zone -> notEmpty() = (self.zone -> notEmpty() and self.country = self.zone.country)

context NewCustomerAddress :: municipalityBelongsToCorrectZoneIfItIsNeeded() : Booleanbody:

self.municipality.country.zone -> notEmpty() = (self.municipality.zone -> notEmpty() and self.municipality.country= self.municipality.zone.country)

context NewCustomerAddress :: hasAPostalAreaIfItIsNeeded() : Booleanbody:

self.country.postalCodeIsMandatory implies self.postalArea -> notEmpty()

context NewCustomerAddress :: hasACorrectPostalArea() : Booleanbody:

self.municipality.postalArea -> includes( self.postalArea )

context NewCustomerAddress :: hasACorrectMunicipality() : Booleanbody:

self.country.municipality -> includes( self.municipality ) andself.zone -> notEmpty() implies self.zone.municipality -> includes ( self.municipality )

context NewCustomerAddress :: hasACorrectZone() : Booleanbody:

self.country.zone -> includes( self.zone )

n Effect

context NewCustomerAddress::effect()

post:Address.allInstances() -> exists(a|

a.firstName = self.newFirstName anda.middleName = self.newMiddleName anda.lastName = self.newLastName anda.namePrefix = self.newNamePrefix anda.nameSuffix = self.newNameSuffix anda.company = self.newCompany anda.streetAddress = self.newStreetAddress anda.telephone = self.newTelephone anda.fax = self.newFax anda.country = self.country anda.zone = self.zone anda.municipality = self.municipality anda.postalArea = self.postalArea andself.customer.address -> includes(a))

Event

4.5.5 DeleteCustomerAddressFrom use case: Administrate address book

n Event SpecificationRelationships

232

Page 234: Magento Conceptual Schema

address : Address [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context DeleteCustomerAddress :: addressOfCustomer() : Booleanbody:

self.customer.address -> includes(self.address)

n Effect

context DeleteCustomerAddress::effect()

post:

self.customer.address -> excludes(self.address)

Event

4.5.6 DefaultDeliveryAddressChangeFrom use case: Administrate address book

n Event SpecificationRelationshipsaddress : Address [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context DefaultDeliveryAddressChange :: addressOfCustomer() : Booleanbody:

self.customer.address -> includes(self.address)

n Effect

context DefaultDeliveryAddressChange::effect()

post:

self.customer.defaultDelivery = self.address

233

Page 235: Magento Conceptual Schema

Event

4.5.7 DefaultBillingAddressChangeFrom use case: Administrate address book

n Event SpecificationRelationshipsaddress : Address [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context DefaultBillingAddressChange :: addressOfCustomer() : Booleanbody:

self.customer.address -> includes(self.address)

n Effect

context DefaultBillingAddressChange::effect()

post:

self.customer.defaultBilling = self.address

Event

4.5.8 EditCustomerAddressFrom use case: Administrate address book

n Event SpecificationAttributesnewAddress : Address [1]

Relationshipsaddress : Address [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context EditCustomerAddress :: addressOfCustomer() : Booleanbody:

234

Page 236: Magento Conceptual Schema

self.customer.address -> includes(self.address)

context EditCustomerAddress :: hasACorrectZoneIfItIsNeeded() : Booleanbody:

self.newAddress.country.zone -> notEmpty() implies (self.newAddress.zone -> notEmpty() and self.newAddress.-country = self.newAddress.zone.country)

context EditCustomerAddress :: hasAMunicipalityOfTheCorrectZoneIfItIsNeeded() : Booleanbody:

self.newAddress.municipality.country.zone -> notEmpty() implies (self.newAddress.municipality.zone -> notEmp-ty() and self.newAddress.municipality.country = self.newAddress.municipality.zone.country)

context EditCustomerAddress :: hasAPostalAreaIfItIsNeeded() : Booleanbody:

self.newAddress.newAddress.country.postalCodeIsMandatory implies self.newAddress.postalArea -> notEmp-ty()

context EditCustomerAddress :: hasACorrectPostalArea() : Booleanbody:

self.newAddress.municipality.postalArea -> includes( self.newAddress.postalArea )

context EditCustomerAddress :: hasACorrectMunicipality() : Booleanbody:

self.newAddress.country.municipality -> includes( self.newAddress.municipality ) andself.newAddress.zone -> notEmpty() implies self.newAddress.zone.municipality -> includes ( self.newAddress.-municipality )

context EditCustomerAddress :: hasACorrectZone() : Booleanbody:

self.newAddress.country.zone -> includes( self.newAddress.zone )

n Effect

context EditCustomerAddress::effect()

post:

self.customer.address -> excludes(self.address) and self.customer.address ->includes(self.newAddress)

Event

4.5.9 LogInFrom use case: Log In, Place an Order

n Event SpecificationRelationshipsanonymousSession : AnonymousSession [1]

Generalizations

235

Page 237: Magento Conceptual Schema

Relationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context LogIn :: CustomerIsNotLoggedIn() : Booleanbody:

self.customer.customerSession -> isEmpty()

context LogIn :: CustomerIsVisibleInWebsite() : Booleanbody:

self.customer.websiteWhereIsVisible -> includes(self.anonymousSession.storeView.store.website)

n Effect

context LogIn::effect()

post:s.oclIsNew() and s.oclIsTypeOf(CustomerSession) and

s.ipAddress = self.anonymousSession.ipAddress ands.createdAt = self.anonymousSession.createdAt ands.lastActivityAt = Now() and

s.customer = self.customer ands.storeView = self.anonymousSession.storeView andif self.customer.lastCurrentCurreny.isDefined() then

s.currentCurrency = self.customer.lastCurrentCurrencyelse

s.currentCurrency = self.anonymousSession.currentCurrencyendif

Event

4.5.10 RestorePreviousShoppingCartFrom use case: Log In

n Event SpecificationRelationshipsanonymousShoppingCart : AnonymousShoppingCart [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Effect

context RestorePreviousShoppingCart::effect()

post createCustomerSC:[email protected]() implies (sc.oclIsNew and sc.oclIsTypeOf(CustomerShoppingCart)

andsc.customer = self.customer andsc.createdAt = Now() andsc.updatedAt = Now())

236

Page 238: Magento Conceptual Schema

post updateCustomerSC:[email protected] -> notEmpty() implies

self.customer.customerShoppingCart.updatedAt = Now()

post addProductsToCustomerSC:self.customer.customerShoppingCart.shoppingCartItem -> forAll ( i |

([email protected] -> includes(i) or [email protected] -> includes(i))andself.customer.customerShoppingCart.shoppingCartItem -> any( i2 | i.product=i2.product ).quantity [email protected] -> any( i2 | i.product=i2.product ).quantity [email protected] -> any( i2 | i.product=i2.product ).quantity

)and self.customer.customerShoppingCart.couponCode = self.anonymousShoppingCart.couponCode

post removeProductsFromAnonymousSC:

self.anonymousShoppingCart.shoppingCartItem -> isEmpty()

Event

4.5.11 RestorePreviousProductListsFrom use case: Log In

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context RestorePreviousProductLists :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

n Effect

context RestorePreviousProductLists::effect()

post:let infoCuSt: ActivityInfoOfCustomerInStoreView =

self.customer.activityInfoOfCustomerInStoreView->any(ai|ai.storeViewWithInfoAbout=self.customer.custom-erSession.storeView)

inlet infoSeSt: ActivityInfoOfSessionInStoreView =

self.customer.customerSession.activityInfoOfSessionInStoreView->any(ai|ai.storeViewWithInfoAbout=self.-customer.customerSession.storeView)

in let numProdsLeft : Integer [email protected] -> size() + infoCuSt.readyToCompareProducts ->

size() - self.customer.customerSession.storeView.catalogConfigurationInStoreView.numberOfRecentlyCompared-ProductsSaved

in

infoSeSt.explicitReadyToCompareProducts = [email protected] -> union( infoCuSt.readyToCompareProducts ) andinfoSeSt.explicitRecentlyComparedProducts = [email protected] -> union (info-CuSt.recentlyComparedProducts.subOrderedSet(1, infoCuSt.recentlyComparedProducts->size() - numProdsLeft.-max(0))) and

237

Page 239: Magento Conceptual Schema

infoSeSt.explicitRecentlyViewedProducts = [email protected] -> union (infoCuSt.re-centlyViewedProducts.subOrderedSet(1, infoCuSt.recentlyViewedProducts->size() - numProdsLeft.max(0)))

post:

let infoCuWe: ActivityInfoOfCustomerInWebsite =self.customer.activityInfoOfCustomerInWebsite->any(ai|ai.websiteWithInfoAbout=self.customer.customerS-

ession.storeView.store.website)in

let infoSeWe: ActivityInfoOfSessionInWebsite =self.customer.customerSession.activityInfoOfSessionInWebsite->any(ai|ai.websiteWithInfoAbout=self.-

customer.customerSession.storeView.store.website)in let numProdsLeft : Integer =

[email protected] -> size() + infoCuWe.readyToCompareProducts ->size() - self.customer.customerSession.storeView.catalogConfigurationInStoreView.numberOfRecentlyCompared-ProductsSaved

in

infoSeWe.explicitReadyToCompareProducts = [email protected] -> union (infoCuWe.readyToCompareProducts ) andinfoSeWe.explicitRecentlyComparedProducts = [email protected] -> union (in-foCuWe.recentlyComparedProducts.subOrderedSet(1, infoCuWe.recentlyComparedProducts->size() - numProd-sLeft.max(0))) andinfoSeWe.explicitRecentlyViewedProducts = [email protected] -> union (infoCuWe.-recentlyViewedProducts.subOrderedSet(1, infoCuWe.recentlyViewedProducts->size() - numProdsLeft.max(0)))

Event

4.5.12 LogOutFrom use case: Log Out

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerSessionEventcustomerSession : CustomerSession [1]

n Effect

context LogOut::effect()

post createAnonymousSession:s.oclIsNew() and s.oclIsTypeOf(AnonymousSession) and

s.ipAddress = self.customerSession.ipAddress ands.createdAt = self.customerSession.createdAt ands.lastActivityAt = Now() ands.lastUrlVisited = self.anonymousSession.lastUrlVisited ands.storeView = self.customerSession.storeView ands.currentCurrency = self.customerSession.currentCurrency

post saveCustomersCurrentCurrency:

self.customerSession.customer.lastCurrentCurrency = self.customerSession.currentCurrency

238

Page 240: Magento Conceptual Schema

Event

4.5.13 SaveCurrentProductListsFrom use case: Log Out, Finish Session

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerSessionEventcustomerSession : CustomerSession [1]

n Effect

context SaveCurrentProductLists::effect()

post:let infoCuSt: ActivityInfoOfCustomerInStoreView =

self.customer.activityInfoOfCustomerInStoreView->any(ai|ai.storeViewWithInfoAbout=self.customerSession.-storeView)

inlet infoSeSt: ActivityInfoOfSessionInStoreView =

self.customer.customerSession.activityInfoOfSessionInStoreView->any(ai|ai.storeViewWithInfoAbout=self.-customerSession.storeView)

ininfoCuSt.readyToCompareProducts = [email protected] and

infoCuSt.recentlyComparedProducts = [email protected] andinfoCuSt.recentlyViewedProducts = [email protected]

post:

let infoCuWe: ActivityInfoOfCustomerInWebsite =self.customer.activityInfoOfCustomerInWebsite->any(ai|ai.websiteWithInfoAbout=self.customerSession.store-

View.store.website)in

let infoSeWe: ActivityInfoOfSessionInWebsite =self.customer.customerSession.activityInfoOfSessionInWebsite->any(ai|ai.websiteWithInfoAbout=self.-

customerSession.storeView.store.website)in

infoCuWe.readyToCompareProducts = [email protected] andinfoCuWe.recentlyComparedProducts = [email protected] andinfoCuWe.recentlyViewedProducts = [email protected]

Event

4.5.14 NewSessionFrom use case: Open session

n Event SpecificationAttributesipAddress : String [1]

Relationshipswebsite : Website [1]

239

Page 241: Magento Conceptual Schema

n Initial Integrity Constraints

context NewSession :: ipAddressDoesNotExist() : Booleanbody:

not AnonymousSession.allInstances() -> exists(s|s.ipAddress=self.ipAddress)

n Effect

context NewSession::effect()

post:s.oclIsNew() and s.oclIsTypeOf(AnonymousSession) and

s.ipAddress = self.ipAddress ands.createdAt = Now() ands.lastActivityAt = Now() ands.storeView = self.website.defaultStore.defaultStoreView ands.currentCurrency = s.storeView.currencyConfigurationInStoreView.defaultCurrency andcart.oclIsNew() and cart.oclIsTypeOf(AnonymousShoppingCart) ands.oclAsType(AnonymousSession).anonymousShoppingCart = cart

Event

4.5.15 DeleteSessionFrom use case: Finish session

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Effect

context DeleteSession::effect()

post:

not [email protected](OclAny)

post:

[email protected](AnonymousSession) implies [email protected] -> isEmp-ty()

Event

4.5.16 SetCurrentWebsiteFrom use case: Change the current Website

n Event Specification

240

Page 242: Magento Conceptual Schema

Relationshipswebsite : Website [1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Effect

context SetCurrentWebsite::effect()

post:

self.session.storeView = self.website.defaultStore.defaultStoreView

Event

4.5.17 SetCurrentStoreFrom use case: Change the current Store

n Event SpecificationRelationshipsstore : Store [1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Effect

context SetCurrentStore::effect()

post:

self.session.storeView = self.store.defaultStoreView

Event

4.5.18 SetCurrentStoreViewFrom use case: Change the current Store View

n Event SpecificationRelationshipsstoreView : StoreView [1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

241

Page 243: Magento Conceptual Schema

n Effect

context SetCurrentStoreView::effect()

post:

self.session.storeView = self.storeView

Event

4.5.19 SetCurrentCurrencyFrom use case: Change the current Currency

n Event SpecificationRelationshipscurrency : Currency [1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Initial Integrity Constraints

context SetCurrentCurrency :: currencyIsAllowed() : Booleanbody:

self.session.storeView.currencyConfigurationInStoreView.allowedCurrency -> includes(self.currency)

n Effect

context SetCurrentCurrency::effect()

post:

self.session.currentCurrency = self.currency

242

Page 244: Magento Conceptual Schema

4.6 Store Administration

Event

4.6.1 NewProductFrom use case: Add a product

n Event SpecificationAttributesvalues : TupleType (a: Attribute, v: AttributeValue) [1..*]productType : ProductType [1]sku : String [1]name : String [1]netPrice : Money [1]weight : Decimal [0..1]status : Status [1]isNewFrom : Date [0..1]isNewUntil : Date [0..1]specialNetPrice : Money [0..1]specialNetPriceFrom : Date [0..1]specialNetPriceUntil : Date [0..1]description : String [0..1]shortDescription : String [0..1]metaDescription : String [0..1]metaKeyword : String [*]metaTitle : String [0..1]imageGalleryPath : String [0..1]baseImagePath : String [0..1]smallImagePath : String [0..1]thumbnailPath : String [0..1]urlKey : String [0..1]isAvailableForGoogleCheckout : Boolean [0..1]giftMessageAllowed : Boolean [0..1]visibleOnCatalog : Boolean [0..1]visibleOnSearch : Boolean [0..1]stockStatus : ProductStatus [1]quantity : PositiveInteger [0..1]qtyToBecomeOutOfStock : PositiveInteger [0..1]minQtyAllowedInShoppingCart : PositiveInteger [0..1]maxQtyAllowedInShoppingCart : PositiveInteger [0..1]notifyForQuantityBelow : PositiveInteger [0..1]backOrderPolicy : BackOrderPolicy [0..1]

RelationshipscrossSellProduct : Product [*]upSellProduct : Product [*]relatedProduct : Product [*]website : Website [1..*]productTaxClass : ProductTaxClass [0..1]fixedTaxRate : TaxRate [*]attributeSet : AttributeSet [1]

243

Page 245: Magento Conceptual Schema

n Initial Integrity Constraints

context NewProduct :: skuDoesNotExist() : Booleanbody:

not Product.allInstances() -> exists ( p | p.sku = self.sku )

context NewProduct :: attributesHaveOnlyOneValue() : Booleanbody:

self.values -> isUnique(attribute)

context NewProduct :: attributeValuesHaveTheCorrectType() : Booleanbody:

self.values -> forAll ( v |(v.a.oclIsTypeOf ( TextualAttribute ) implies v.v.oclIsTypeOf ( TextualValue )) and

(v.a.oclIsTypeOf ( PriceAttribute ) implies v.v.oclIsTypeOf ( PriceValue )) and(v.a.oclIsTypeOf ( DateAttribute ) implies v.v.oclIsTypeOf ( DateValue )) and(v.a.oclIsTypeOf ( BooleanAttribute ) implies v.v.oclIsTypeOf ( BooleanValue )) and(v.a.oclIsTypeOf ( IntegerAttribute ) implies v.v.oclIsTypeOf ( IntegerValue )) and(v.a.oclIsTypeOf ( DecimalAttribute ) implies v.v.oclIsTypeOf ( DecimalValue )) and(v.a.oclIsTypeOf ( ImageAttribute ) implies v.v.oclIsTypeOf ( ImageValue )) and(v.a.oclIsTypeOf ( SingleValuedEnumerationAttribute ) implies

(v.v.oclIsTypeOf ( EnumerationValue ) and v.a.oclAsType(SingleValuedEnumerationAttribute).allowedValue->includes(v.v) ))

and (v.a.oclIsTypeOf ( MultipleValuedEnumerationAttribute ) implies(v.v.oclIsTypeOf ( MultipleEnumerationValue ) and v.a.oclAsType(EnumerationValue).allowedValue-

>includesAll(v.v.oclAsType(MultipleValuedEnumerationAttribute).enumerationValue) ))

)

context NewProduct :: onlyAbleToRateAttributesHaveValues() : Booleanbody:

let ableToRateAttributes : Set(Attribute) =self.attributeSet.attribute -> select(a|a.associatedProductType -> includes(self.productType))

in self.values->collect(a) -> forAll ( a | ableToRateAttributes -> includes(a) )

context NewProduct :: requiredAttributesHaveAValue() : Booleanbody:

let ableToRateAttributes : Set(Attribute) =self.attributeSet.attribute -> select(a|a.associatedProductType -> includes(self.productType))

in ableToRateAttributes -> forAll ( a | a.isRequired implies self.values->collect(a) -> includes(a) )

context NewProduct :: uniqueValuedAttributesHaveANonUsedValue() : Booleanbody:

self.values -> forAll ( v | v.a.hasUniqueValues impliesnot v.a.storeViewAttributeRating.attributeValue -> exists(val | val=v.v)

)

context NewProduct :: onlyAbleToRatePropertiesHaveValues() : Booleanbody:

let conf : ProductPropertiesTypeAssociationConfiguration =ProductPropertiesTypeAssociationConfiguration.allInstances() -> any(true)

in (self.name.isDefined() impliesconf.nameAssociatedToProductType->includes(self.productType))

and (self.netPrice.isDefined() impliesconf.netPriceAssociatedToProductType->includes(self.productType))

and (self.weight.isDefined() impliesconf.weightAssociatedToProductType->includes(self.productType))

and (self.status.isDefined() impliesconf.statusAssociatedToProductType->includes(self.productType))

and (self.isNewFrom.isDefined() impliesconf.isNewFromAssociatedToProductType->includes(self.productType))

and (self.isNewUntil.isDefined() impliesconf.isNewUntilAssociatedToProductType->includes(self.productType))

and (self.specialNetPrice.isDefined() impliesconf.specialNetPriceAssociatedToProductType->includes(self.productType))

and (self.specialNetPriceFrom.isDefined() impliesconf.specialNetPriceFromAssociatedToProductType->includes(self.productType))

and (self.specialNetPriceUntil.isDefined() impliesconf.specialNetPriceUntilAssociatedToProductType->includes(self.productType))

and (self.description.isDefined() implies

244

Page 246: Magento Conceptual Schema

conf.descriptionAssociatedToProductType->includes(self.productType))and (self.shortDescription.isDefined() implies

conf.shortDescriptionAssociatedToProductType->includes(self.productType))and (self.metaDescription.isDefined() implies

conf.metaDescriptionAssociatedToProductType->includes(self.productType))and (self.metaKeyword -> forAll(k|k.isDefined()) implies

conf.metaKeywordAssociatedToProductType->includes(self.productType))and (self.metaTitle.isDefined() implies

conf.metaTitleAssociatedToProductType->includes(self.productType))and (self.imageGalleryPath.isDefined() implies

conf.imageGalleryPathAssociatedToProductType->includes(self.productType))and (self.baseImagePath.isDefined() implies

conf.baseImagePathAssociatedToProductType->includes(self.productType))and (self.smallImagePath.isDefined() implies

conf.smallImagePathAssociatedToProductType->includes(self.productType))and (self.thumbnailPath.isDefined() implies

conf.thumbnailPathAssociatedToProductType->includes(self.productType))and (self.urlKey.isDefined() implies

conf.urlKeyAssociatedToProductType->includes(self.productType))and (self.isAvailableForGoogleCheckout.isDefined() implies

conf.isAvailableForGoogleCheckoutAssociatedToProductType->includes(self.productType))and (self.giftMessageAllowed.isDefined() implies

conf.giftMessageAllowedAssociatedToProductType->includes(self.productType))and (self.visibleOnCatalog.isDefined() implies

conf.visibleOnCatalogAssociatedToProductType->includes(self.productType))and (self.visibleOnSearch.isDefined() implies

conf.visibleOnSearchAssociatedToProductType->includes(self.productType))

context NewProduct :: mandatoryPropertiesAreRated() : Booleanbody:

let confType : ProductPropertiesTypeAssociationConfiguration =ProductPropertiesTypeAssociationConfiguration.allInstances() -> any(true)

in let confOblig : ProductPropertiesObligatorinessConfiguration =ProductPropertiesObligatorinessConfiguration.allInstances() -> any(true)

in ((confOblig.isNewFromIsMandatory andconfType.isNewFromAssociatedToProductType->includes(self.productType))implies self.isNewFrom.isDefined()) and((confOblig.isNewUntilIsMandatory andconfType.isNewUntilAssociatedToProductType->includes(self.productType))implies self.isNewUntil.isDefined()) and((confOblig.specialNetPriceIsMandatory andconfType.specialNetPriceAssociatedToProductType->includes(self.productType))implies self.specialNetPrice.isDefined()) and((confOblig.specialNetPriceFromIsMandatory andconfType.specialNetPriceFromAssociatedToProductType->includes(self.productType))implies self.specialNetPriceFrom.isDefined()) and((confOblig.specialNetPriceUntilIsMandatory andconfType.specialNetPriceUntilAssociatedToProductType->includes(self.productType))implies self.specialNetPriceUntil.isDefined()) and((confOblig.descriptionIsMandatory andconfType.descriptionAssociatedToProductType->includes(self.productType))implies self.description.isDefined()) and((confOblig.shortDescriptionIsMandatory andconfType.shortDescriptionAssociatedToProductType->includes(self.productType))implies self.shortDescription.isDefined()) and((confOblig.metaDescriptionIsMandatory andconfType.metaDescriptionAssociatedToProductType->includes(self.productType))implies self.metaDescription.isDefined()) and((confOblig.metaKeywordIsMandatory andconfType.metaKeywordAssociatedToProductType->includes(self.productType))implies self.metaKeyword -> forAll(k|k.isDefined())) and((confOblig.metaTitleIsMandatory andconfType.metaTitleAssociatedToProductType->includes(self.productType))implies self.metaTitle.isDefined()) and((confOblig.imageGalleryPathIsMandatory andconfType.imageGalleryPathAssociatedToProductType->includes(self.productType))implies self.imageGalleryPath.isDefined()) and((confOblig.baseImagePathIsMandatory andconfType.baseImagePathAssociatedToProductType->includes(self.productType))implies self.baseImagePath.isDefined()) and((confOblig.smallImagePathIsMandatory andconfType.smallImagePathAssociatedToProductType->includes(self.productType))implies self.smallImagePath.isDefined()) and((confOblig.thumbnailPathIsMandatory and

245

Page 247: Magento Conceptual Schema

confType.thumbnailPathAssociatedToProductType->includes(self.productType))implies self.thumbnailPath.isDefined()) and((confOblig.urlKeyIsMandatory andconfType.urlKeyAssociatedToProductType->includes(self.productType))implies self.urlKey.isDefined()) and((confOblig.isAvailableForGoogleCheckoutIsMandatory andconfType.isAvailableForGoogleCheckoutAssociatedToProductType->includes(self.productType))implies self.isAvailableForGoogleCheckout.isDefined()) and((confOblig.giftMessageAllowedIsMandatory andconfType.giftMessageAllowedAssociatedToProductType->includes(self.productType))implies self.giftMessageAllowed.isDefined()) and((confOblig.visibleOnCatalogIsMandatory andconfType.visibleOnCatalogAssociatedToProductType->includes(self.productType))implies self.visibleOnCatalog.isDefined()) and((confOblig.visibleOnSearchIsMandatory andconfType.visibleOnSearchAssociatedToProductType->includes(self.productType))implies self.visibleOnSearch.isDefined())

context NewProduct :: stockOptionsAreRatedOnlyForTheCorrectProductTypes() : Booleanbody:

( self.productType=ProductType::Grouped orself.productType=ProductType::Configurable orself.productType=ProductType::Bundle ) implies (

self.quantity.isUndefined() andself.qtyToBecomeOutOfStock.isUndefined() andself.minQtyAllowedInShoppingCart.isUndefined() andself.maxQtyAllowedInShoppingCart.isUndefined() andself.notifyForQuantityBelow.isUndefined()andself.backOrderPolicy.isUndefined()

)

n Effect

context NewProduct::effect()

post productIsCreated:p.oclIsNew() and p.oclIsKindOf(Product) and

self.productType = ProductType::Simple implies p.oclIsTypeOf(SimpleProduct) andself.productType = ProductType::Grouped implies p.oclIsTypeOf(GroupedProduct) andself.productType = ProductType::Configurable implies p.oclIsTypeOf(ConfigurableProduct) andself.productType = ProductType::Virtual implies p.oclIsTypeOf(VirtualProduct) andself.productType = ProductType::Bundle implies p.oclIsTypeOf(BundleProduct) andself.productType = ProductType::Downloadable implies p.oclIsTypeOf(DownloadableProduct) andp.productTaxClass = self.productTaxClass andp.fixedTaxRate = self.fixedTaxRate andp.attributeSet = self.attributeSet andp.crossSellProduct = self.crossSellProduct andp.upSellProduct = self.upSellProduct andp.relatedProduct = self.relatedProduct andWebsite.allInstances() -> forAll ( w |

piw.oclIsNew() and piw.oclIsTypeOf(ProductInWebsite) andpiw.product = p and piw.website = w andpiw.isAvailable = (self.website -> includes(w))

) andStoreView.allInstances() -> forAll ( stw |

pis.oclIsNew() and pis.oclIsTypeOf(ProductInStoreView) andpis.product = p and pis.storeView = stw

)andlet ableToRateAttributes : Set(Attribute) =

self.attributeSet.attribute -> select(a|a.associatedProductType -> includes(self.productType))in

ableToRateAttributes -> forAll ( a |gar.oclIsNew() and gar.oclIsTypeOf(GlobalAttributeRating) and

gar.productOfGloballyRatedAttribute = p and gar.globallyRatedAttribute = aand Website.allInstances() -> forAll ( w |

war.oclIsNew() and war.oclIsTypeOf(WebsiteAttributeRating) andwar.websiteRatedProduct = p andwar.websiteRatedAttribute = a andwar.websiteWhereIsRated = w

) and StoreView.allInstances() -> forAll ( s |sar.oclIsNew() and sar.oclIsTypeOf(StoreViewAttributeRating) and

246

Page 248: Magento Conceptual Schema

sar.storeViewRatedProduct = p andsar.storeViewRatedAttribute = a andsar.storeViewWhereIsRated = s

) )

post attributesAreRated:

self.values -> forAll ( v |v.a.globalAttributeRating->any(gar|gar.productOfGloballyRatedAttribute=p).genericAttributeValue=v.v

)

post propertiesAreRated:p.sku = self.sku and

p.genericName = self.name andp.genericNetPrice = self.netPrice andp.genericWeight = self.weight andp.genericStatus = self.status andp.genericIsNewFrom = self.isNewFrom andp.genericIsNewUntil = self.isNewUntil andp.genericSpecialNetPrice = self.specialNetPrice andp.genericSpecialNetPriceFrom = self.specialNetPriceFrom andp.genericSpecialNetPriceUntil = self.specialNetPriceUntil andp.genericDescription = self.description andp.genericShortDescription = self.shortDescription andp.genericMetaDescription = self.metaDescription andp.genericMetaKeyword = self.metaKeyword andp.genericMetaTitle = self.metaTitle andp.genericImageGalleryPath = self.imageGalleryPath andp.genericBaseImagePath = self.baseImagePath andp.genericSmallImagePath = self.smallImagePath andp.genericThumbnailPath = self.thumbnailPath andp.genericUrlKey = self.urlKey andp.genericIsAvailableForGoogleCheckout = self.isAvailableForGoogleCheckout andp.genericIsGiftMessageAllowed = self.giftMessageAllowed andp.genericIsVisibleOnCatalog = self.visibleOnCatalog andp.genericIsVisibleOnSearch = self.visibleOnSearch andp.stockStatus = self.stockStatus andp.quantity = self.quantity andp.qtyToBecomeOutOfStock = self.qtyToBecomeOutOfStock andp.minQtyAllowedInShoppingCart = self.minQtyAllowedInShoppingCart andp.maxQtyAllowedInShoppingCart = self.maxQtyAllowedInShoppingCart andp.notifyForQuantityBelow = self.notifyForQuantityBelow andp.backOrderPolicy = self.backOrderPolicy

Event

4.6.2 EditProductFrom use case: Edit a product

n Event SpecificationAttributesvalues : TupleType (a: Attribute, v: AttributeValue) [1..*]sku : String [1]name : String [1]netPrice : Money [1]weight : Decimal [0..1]status : Status [1]isNewFrom : Date [0..1]isNewUntil : Date [0..1]specialNetPrice : Money [0..1]specialNetPriceFrom : Date [0..1]specialNetPriceUntil : Date [0..1]description : String [0..1]shortDescription : String [0..1]

247

Page 249: Magento Conceptual Schema

metaDescription : String [0..1]metaKeyword : String [0..1]metaTitle : String [0..1]imageGalleryPath : String [0..1]baseImagePath : String [0..1]smallImagePath : String [0..1]thumbnailPath : String [0..1]urlKey : String [0..1]isAvailableForGoogleCheckout : Boolean [0..1]giftMessageAllowed : Boolean [0..1]visibleOnCatalog : Boolean [0..1]visibleOnSearch : Boolean [0..1]stockStatus : ProductStatus [1]quantity : PositiveInteger [0..1]qtyToBecomeOutOfStock : PositiveInteger [0..1]minQtyAllowedInShoppingCart : PositiveInteger [0..1]maxQtyAllowedInShoppingCart : PositiveInteger [0..1]notifyForQuantityBelow : PositiveInteger [0..1]backOrderPolicy : BackOrderPolicy [0..1]productType : ProductType [1]

RelationshipscrossSellProduct : Product [*]upSellProduct : Product [*]relatedProduct : Product [*]website : Website [1..*]productTaxClass : ProductTaxClass [0..1]fixedTaxRate : TaxRate [*]

GeneralizationsRelationships inherited from ExistingProductEventproduct : Product [1]

Relationships inherited from ScopeDefinedEventeditForWebsiteScope : Website [0..1]editForStoreViewScope : StoreView [0..1]

n Initial Integrity Constraints

context EditProduct :: notTwoScopesDefined() : Booleanbody:

self.editForWebsiteScope.isEmpty() or self.editForStoreViewScope.isEmpty()

context EditProduct :: onlyAbleToRateAttributesHaveValues() : Booleanbody:

let ableToRateAttributes : Set(Attribute) =self.product.attributeSet.attribute -> select(a|a.associatedProductType -> includes(self.productType))

in self.values->collect(a) -> forAll ( a | ableToRateAttributes -> includes(a) )

context EditProduct :: requiredAttributesHaveAValue() : Booleanbody:

let ableToRateAttributes : Set(Attribute) =self.product.attributeSet.attribute -> select(a|a.associatedProductType -> includes(self.productType))

in ableToRateAttributes -> forAll ( a | a.isRequired implies self.values->collect(a) -> includes(a) )

context EditProduct :: attributesHaveOnlyOneValue() : Booleanbody:

self.values -> isUnique(attribute)

248

Page 250: Magento Conceptual Schema

context EditProduct :: attributeValuesHaveTheCorrectType() : Booleanbody:

self.values -> forAll ( v |(v.a.oclIsTypeOf ( TextualAttribute ) implies v.v.oclIsTypeOf ( TextualValue )) and

(v.a.oclIsTypeOf ( PriceAttribute ) implies v.v.oclIsTypeOf ( PriceValue )) and(v.a.oclIsTypeOf ( DateAttribute ) implies v.v.oclIsTypeOf ( DateValue )) and(v.a.oclIsTypeOf ( BooleanAttribute ) implies v.v.oclIsTypeOf ( BooleanValue )) and(v.a.oclIsTypeOf ( IntegerAttribute ) implies v.v.oclIsTypeOf ( IntegerValue )) and(v.a.oclIsTypeOf ( DecimalAttribute ) implies v.v.oclIsTypeOf ( DecimalValue )) and(v.a.oclIsTypeOf ( ImageAttribute ) implies v.v.oclIsTypeOf ( ImageValue )) and(v.a.oclIsTypeOf ( SingleValuedEnumerationAttribute ) implies

(v.v.oclIsTypeOf ( EnumerationValue ) and v.a.oclAsType(SingleValuedEnumerationAttribute).allowedValue->includes(v.v) ))

and (v.a.oclIsTypeOf ( MultipleValuedEnumerationAttribute ) implies(v.v.oclIsTypeOf ( MultipleEnumerationValue ) and v.a.oclAsType(EnumerationValue).allowedValue-

>includesAll(v.v.oclAsType(MultipleValuedEnumerationAttribute).enumerationValue) ))

)

context EditProduct :: uniqueValuedAttributesHaveANonUsedValue() : Booleanbody:

self.values -> forAll ( v | v.a.hasUniqueValues impliesnot v.a.storeViewAttributeRating.attributeValue -> exists(val | val=v.v)

)

context EditProduct :: onlyAbleToRatePropertiesHaveValues() : Booleanbody:

let conf : ProductPropertiesTypeAssociationConfiguration =ProductPropertiesTypeAssociationConfiguration.allInstances() -> any(true)

in (self.name.isDefined() impliesconf.nameAssociatedToProductType->includes(self.productType))

and (self.netPrice.isDefined() impliesconf.netPriceAssociatedToProductType->includes(self.productType))

and (self.weight.isDefined() impliesconf.weightAssociatedToProductType->includes(self.productType))

and (self.status.isDefined() impliesconf.statusAssociatedToProductType->includes(self.productType))

and (self.isNewFrom.isDefined() impliesconf.isNewFromAssociatedToProductType->includes(self.productType))

and (self.isNewUntil.isDefined() impliesconf.isNewUntilAssociatedToProductType->includes(self.productType))

and (self.specialNetPrice.isDefined() impliesconf.specialNetPriceAssociatedToProductType->includes(self.productType))

and (self.specialNetPriceFrom.isDefined() impliesconf.specialNetPriceFromAssociatedToProductType->includes(self.productType))

and (self.specialNetPriceUntil.isDefined() impliesconf.specialNetPriceUntilAssociatedToProductType->includes(self.productType))

and (self.description.isDefined() impliesconf.descriptionAssociatedToProductType->includes(self.productType))

and (self.shortDescription.isDefined() impliesconf.shortDescriptionAssociatedToProductType->includes(self.productType))

and (self.metaDescription.isDefined() impliesconf.metaDescriptionAssociatedToProductType->includes(self.productType))

and (self.metaKeyword -> forAll(k|k.isDefined()) impliesconf.metaKeywordAssociatedToProductType->includes(self.productType))

and (self.metaTitle.isDefined() impliesconf.metaTitleAssociatedToProductType->includes(self.productType))

and (self.imageGalleryPath.isDefined() impliesconf.imageGalleryPathAssociatedToProductType->includes(self.productType))

and (self.baseImagePath.isDefined() impliesconf.baseImagePathAssociatedToProductType->includes(self.productType))

and (self.smallImagePath.isDefined() impliesconf.smallImagePathAssociatedToProductType->includes(self.productType))

and (self.thumbnailPath.isDefined() impliesconf.thumbnailPathAssociatedToProductType->includes(self.productType))

and (self.urlKey.isDefined() impliesconf.urlKeyAssociatedToProductType->includes(self.productType))

and (self.isAvailableForGoogleCheckout.isDefined() impliesconf.isAvailableForGoogleCheckoutAssociatedToProductType->includes(self.productType))

and (self.giftMessageAllowed.isDefined() impliesconf.giftMessageAllowedAssociatedToProductType->includes(self.productType))

and (self.visibleOnCatalog.isDefined() impliesconf.visibleOnCatalogAssociatedToProductType->includes(self.productType))

and (self.visibleOnSearch.isDefined() impliesconf.visibleOnSearchAssociatedToProductType->includes(self.productType))

249

Page 251: Magento Conceptual Schema

context EditProduct :: mandatoryPropertiesAreRated() : Booleanbody:

let confType : ProductPropertiesTypeAssociationConfiguration =ProductPropertiesTypeAssociationConfiguration.allInstances() -> any(true)

in let confOblig : ProductPropertiesObligatorinessConfiguration =ProductPropertiesObligatorinessConfiguration.allInstances() -> any(true)

in ((confOblig.isNewFromIsMandatory andconfType.isNewFromAssociatedToProductType->includes(self.productType))implies self.isNewFrom.isDefined()) and((confOblig.isNewUntilIsMandatory andconfType.isNewUntilAssociatedToProductType->includes(self.productType))implies self.isNewUntil.isDefined()) and((confOblig.specialNetPriceIsMandatory andconfType.specialNetPriceAssociatedToProductType->includes(self.productType))implies self.specialNetPrice.isDefined()) and((confOblig.specialNetPriceFromIsMandatory andconfType.specialNetPriceFromAssociatedToProductType->includes(self.productType))implies self.specialNetPriceFrom.isDefined()) and((confOblig.specialNetPriceUntilIsMandatory andconfType.specialNetPriceUntilAssociatedToProductType->includes(self.productType))implies self.specialNetPriceUntil.isDefined()) and((confOblig.descriptionIsMandatory andconfType.descriptionAssociatedToProductType->includes(self.productType))implies self.description.isDefined()) and((confOblig.shortDescriptionIsMandatory andconfType.shortDescriptionAssociatedToProductType->includes(self.productType))implies self.shortDescription.isDefined()) and((confOblig.metaDescriptionIsMandatory andconfType.metaDescriptionAssociatedToProductType->includes(self.productType))implies self.metaDescription.isDefined()) and((confOblig.metaKeywordIsMandatory andconfType.metaKeywordAssociatedToProductType->includes(self.productType))implies self.metaKeyword -> forAll(k|k.isDefined())) and((confOblig.metaTitleIsMandatory andconfType.metaTitleAssociatedToProductType->includes(self.productType))implies self.metaTitle.isDefined()) and((confOblig.imageGalleryPathIsMandatory andconfType.imageGalleryPathAssociatedToProductType->includes(self.productType))implies self.imageGalleryPath.isDefined()) and((confOblig.baseImagePathIsMandatory andconfType.baseImagePathAssociatedToProductType->includes(self.productType))implies self.baseImagePath.isDefined()) and((confOblig.smallImagePathIsMandatory andconfType.smallImagePathAssociatedToProductType->includes(self.productType))implies self.smallImagePath.isDefined()) and((confOblig.thumbnailPathIsMandatory andconfType.thumbnailPathAssociatedToProductType->includes(self.productType))implies self.thumbnailPath.isDefined()) and((confOblig.urlKeyIsMandatory andconfType.urlKeyAssociatedToProductType->includes(self.productType))implies self.urlKey.isDefined()) and((confOblig.isAvailableForGoogleCheckoutIsMandatory andconfType.isAvailableForGoogleCheckoutAssociatedToProductType->includes(self.productType))implies self.isAvailableForGoogleCheckout.isDefined()) and((confOblig.giftMessageAllowedIsMandatory andconfType.giftMessageAllowedAssociatedToProductType->includes(self.productType))implies self.giftMessageAllowed.isDefined()) and((confOblig.visibleOnCatalogIsMandatory andconfType.visibleOnCatalogAssociatedToProductType->includes(self.productType))implies self.visibleOnCatalog.isDefined()) and((confOblig.visibleOnSearchIsMandatory andconfType.visibleOnSearchAssociatedToProductType->includes(self.productType))implies self.visibleOnSearch.isDefined())

context EditProduct :: stockOptionsAreRatedOnlyForTheCorrectProductTypes() : Booleanbody:

( self.productType=ProductType::Grouped orself.productType=ProductType::Configurable orself.productType=ProductType::Bundle ) implies (

self.quantity.isUndefined() andself.qtyToBecomeOutOfStock.isUndefined() andself.minQtyAllowedInShoppingCart.isUndefined() andself.maxQtyAllowedInShoppingCart.isUndefined() andself.notifyForQuantityBelow.isUndefined()and

250

Page 252: Magento Conceptual Schema

self.backOrderPolicy.isUndefined())

n Effect

context EditProduct::effect()

post productIsEdited:self.product.crossSellProduct = self.crossSellProduct and

self.product.upSellProduct = self.upSellProduct andself.product.relatedProduct = self.relatedProduct andself.product.productTaxClass = self.productTaxClass andself.product.fixedTaxRate = self.fixedTaxRate andself.product.productInWebsite -> forAll (piw|piw.isAvailable = self.website->includes(piw.website))

post attributeRatingsAreEdited:self.values -> forAll ( v |

if self.editForWebsiteScope.isDefined() thenv.a.websiteAttributeRating->any(war|

war.websiteRatedProduct=self.product and war.websiteWhereIsRated=self.editForWebsiteScope).redefinedAttributeValue=v.v

else if self.editForStoreViewScope.isDefined() thenv.a.storeViewAttributeRating->any(sar|

sar.product=self.storeViewRatedProduct and sar.storeViewWhereIsRated=self.editForStoreViewS-cope

).redefinedAttributeValue=v.velse

v.a.globalAttributeRating->any(gar|gar.productOfGloballyRatedAttribute=self.product).genericAttribute-Value=v.v

endif endif)

post propertyRatingsAreEdited:if self.editForWebsiteScope.isDefined() then

let p : ProductInWebsite = self.product.productInWebsite->any(piw|piw.website=self.editForWebsiteScope)inp.redefinedName = self.name andp.redefinedNetPrice = self.netPrice andp.redefinedWeight = self.weight andp.redefinedStatus = self.status andp.redefinedIsNewFrom = self.isNewFrom andp.redefinedIsNewUntil = self.isNewUntil andp.redefinedSpecialNetPrice = self.specialNetPrice andp.redefinedSpecialNetPriceFrom = self.specialNetPriceFrom andp.redefinedSpecialNetPriceUntil = self.specialNetPriceUntil andp.redefinedDescription = self.description andp.redefinedShortDescription = self.shortDescription andp.redefinedMetaDescription = self.metaDescription andp.redefinedMetaKeyword = self.metaKeyword andp.redefinedMetaTitle = self.metaTitle andp.redefinedImageGalleryPath = self.imageGalleryPath andp.redefinedBaseImagePath = self.baseImagePath andp.redefinedSmallImagePath = self.smallImagePath andp.redefinedThumbnailPath = self.thumbnailPath andp.redefinedUrlKey = self.urlKey andp.redefinedIsAvailableForGoogleCheckout = self.isAvailableForGoogleCheckout andp.redefinedGiftMessageAllowed = self.giftMessageAllowed andp.redefinedVisibleOnCatalog = self.visibleOnCatalog andp.redefinedVisibleOnSearch = self.visibleOnSearch

else if self.editForStoreViewScope.isDefined() thenlet p : ProductInStoreView = self.product.productInStoreView->any(pis|pis.storeView=self.editForStore-

ViewScope)inp.redefinedName = self.name andp.redefinedWeight = self.weight andp.redefinedStatus = self.status andp.redefinedIsNewFrom = self.isNewFrom andp.redefinedIsNewUntil = self.isNewUntil andp.redefinedSpecialNetPriceFrom = self.specialNetPriceFrom andp.redefinedSpecialNetPriceUntil = self.specialNetPriceUntil andp.redefinedDescription = self.description andp.redefinedShortDescription = self.shortDescription andp.redefinedMetaDescription = self.metaDescription and

251

Page 253: Magento Conceptual Schema

p.redefinedMetaKeyword = self.metaKeyword andp.redefinedMetaTitle = self.metaTitle andp.redefinedImageGalleryPath = self.imageGalleryPath andp.redefinedBaseImagePath = self.baseImagePath andp.redefinedSmallImagePath = self.smallImagePath andp.redefinedThumbnailPath = self.thumbnailPath andp.redefinedUrlKey = self.urlKey andp.redefinedIsAvailableForGoogleCheckout = self.isAvailableForGoogleCheckout andp.redefinedGiftMessageAllowed = self.giftMessageAllowed andp.redefinedVisibleOnCatalog = self.visibleOnCatalog andp.redefinedVisibleOnSearch = self.visibleOnSearch andlet piw:ProductInWebsite = self.product.productInWebsite->any(piw|piw.website=self.editForStoreViewScope.store.-website)in

piw.redefinedNetPrice = self.netPrice andpiw.redefinedSpecialNetPrice = self.specialNetPrice

elseself.product.genericName = self.name and

self.product.genericNetPrice = self.netPrice andself.product.genericWeight = self.weight andself.product.genericStatus = self.status andself.product.genericIsNewFrom = self.isNewFrom andself.product.genericIsNewUntil = self.isNewUntil andself.product.genericSpecialNetPrice = self.specialNetPrice andself.product.genericSpecialNetPriceFrom = self.specialNetPriceFrom andself.product.genericSpecialNetPriceUntil = self.specialNetPriceUntil andself.product.genericDescription = self.description andself.product.genericShortDescription = self.shortDescription andself.product.genericMetaDescription = self.metaDescription andself.product.genericMetaKeyword = self.metaKeyword andself.product.genericMetaTitle = self.metaTitle andself.product.genericImageGalleryPath = self.imageGalleryPath andself.product.genericBaseImagePath = self.baseImagePath andself.product.genericSmallImagePath = self.smallImagePath andself.product.genericThumbnailPath = self.thumbnailPath andself.product.genericUrlKey = self.urlKey andself.product.genericIsAvailableForGoogleCheckout = self.isAvailableForGoogleCheckout andself.product.genericGiftMessageAllowed = self.giftMessageAllowed andself.product.genericVisibleOnCatalog = self.visibleOnCatalog andself.product.genericVisibleOnSearch = self.visibleOnSearch

endif endif andself.product.sku = self.sku andself.product.stockStatus = self.stockStatus andself.product.quantity = self.quantity andself.product.qtyToBecomeOutOfStock = self.qtyToBecomeOutOfStock andself.product.minQtyAllowedInShoppingCart = self.minQtyAllowedInShoppingCart andself.product.maxQtyAllowedInShoppingCart = self.maxQtyAllowedInShoppingCart andself.product.notifyForQuantityBelow = self.notifyForQuantityBelow andself.product.backOrderPolicy = self.backOrderPolicy

Event

4.6.3 DeleteProductFrom use case: Delete a product

n Event SpecificationGeneralizationsRelationships inherited from ExistingProductEventproduct : Product [1]

n Effect

context DeleteProduct::effect()

252

Page 254: Magento Conceptual Schema

post:not [email protected](OclAny) and

[email protected] -> forAll ( t | not [email protected](OclAny) ) [email protected] -> forAll ( t | not [email protected](OclAny) ) [email protected] -> forAll ( o | not [email protected](OclAny) ) and([email protected](DownloadableProduct) [email protected](DownloadableProduct).downloadableItem -> forAll ( i |

not [email protected](OclAny)) ) and

([email protected](BundleProduct) [email protected](BundleProduct).bundleItem -> forAll ( i |

not [email protected](OclAny)) ) and

Event

4.6.4 MoveCategoryFrom use case: Move a product category

n Event SpecificationRelationshipscategoryToMove : Category [1]newParentCategory : Category [0..1]

n Initial Integrity Constraints

context MoveCategory :: categoriesAreNotTheSame() : Booleanbody:

not self.categoryToMove = self.newParentCategory

n Effect

context MoveCategory::effect()

post:

if self.newParentCategory.isDefined() then self.categoryToMove.parent = self.newParentCategory else self.cate-goryToMove.parent->isEmpty() endif

Event

4.6.5 NewAttributeFrom use case: Add an attribute

n Event SpecificationAttributesattributeType : AttributeType [1]code : String [1]

253

Page 255: Magento Conceptual Schema

name : String [1]scope : Scope [1]isComparable : Boolean [1]hasUniqueValues : Boolean [0..1]isRequired : Boolean [0..1]associatedProductType : ProductType [1..*]inputValidation : InputValidation [0..1]isConfigurable : Boolean [0..1]

RelationshipsattributeSet : AttributeSet [1]allowedValue : EnumerationValue [*]defaultValue : AttributeValue [0..1]

n Initial Integrity Constraints

context NewAttribute :: allowedEnumerationValuesAreOnlyDefinedForEnumerationAttributes() : Booleanbody:

self.allowedValue -> notEmpty() =(self.attributeType = AttributeType::SingleValuedEnumeration orself.attributeType = AttributeType::MultipleValuedEnumeration)

context NewAttribute :: isConfigurablePropertyIsOnlyDefinedForSingleValuedEnumerationAttributes() : Booleanbody:

self.allowedValue -> notEmpty() = self.attributeType = AttributeType::SingleValuedEnumeration

context NewAttribute :: inputValidationIsOnlyDefinedForTextualAttributes() : Booleanbody:

self.inputValidation.isDefined() = self.attributeType = AttributeType::Textual

context NewAttribute :: requiredAndUniqueAreOnlyDefinedForNonImageAttributes() : Booleanbody:

(self.isRequired.isDefined() and self.hasUniqueValues.isDefined())= (self.attributeType <> AttributeType::Image)

context NewAttribute :: defaultValueIsNotDefinedForImageAttributes() : Booleanbody:

self.attributeType = AttributeType::Image implies self.defaultValue.isDefined()

context NewAttribute :: defaultValueHaveTheCorrectType() : Booleanbody:

self.attributeType = AttributeType::Textual implies self.defaultValue.oclIsTypeOf ( TextualValue ) andself.attributeType = AttributeType::Price implies self.defaultValue.oclIsTypeOf ( PriceValue ) andself.attributeType = AttributeType::Date implies self.defaultValue.oclIsTypeOf ( DateValue ) andself.attributeType = AttributeType::Boolean implies self.defaultValue.oclIsTypeOf ( BooleanValue ) andself.attributeType = AttributeType::Integer implies self.defaultValue.oclIsTypeOf ( IntegerValue ) andself.attributeType = AttributeType::Decimal implies self.defaultValue.oclIsTypeOf ( DecimalValue ) andself.attributeType = AttributeType::SingleValuedEnumeration implies self.defaultValue.oclIsTypeOf ( EnumerationVa-lue ) andself.attributeType = AttributeType::MultipleValuedEnumeration implies self.defaultValue.oclIsTypeOf ( MultipleEnu-merationValue )

n Effect

context NewAttribute::effect()

post:a.oclIsNew() and a.oclIsKindOf(Attribute) and self.attributeType = AttributeType::Textual implies a.oclIsType-

Of(TextualAttribute) and

254

Page 256: Magento Conceptual Schema

self.attributeType = AttributeType::Price implies a.oclIsTypeOf(PriceAttribute) andself.attributeType = AttributeType::Date implies a.oclIsTypeOf(DateAttribute) andself.attributeType = AttributeType::Boolean implies a.oclIsTypeOf(BooleanAttribute) andself.attributeType = AttributeType::Integer implies a.oclIsTypeOf(IntegerAttribute) andself.attributeType = AttributeType::Decimal implies a.oclIsTypeOf(DecimalAttribute) andself.attributeType = AttributeType::Image implies a.oclIsTypeOf(ImageAttribute) andself.attributeType = AttributeType::SingleValuedEnumeration implies a.oclIsTypeOf(SingleValuedEnumerationAttribute)andself.attributeType = AttributeType::MultipleValuedEnumeration implies a.oclIsTypeOf(MultipleValuedEnumerationAttribute)anda.code = self.code anda.genericName = self.name anda.scope = self.scope anda.isComparable = self.isComparable anda.hasUniqueValues = self.hasUniqueValues anda.isRequired = self.isRequired anda.associatedProductType = self.associatedProductType and(self.attributeType = AttributeType::Textual implies a.oclAsType(TextualAttribute).inputValidation = self.inputVali-dation) and(self.attributeType = AttributeType::SingleValuedEnumeration implies a.oclAsType(SingleValuedEnumerationAttribute).-isConfigurable = self.isConfigurable) and((self.attributeType = AttributeType::SingleValuedEnumeration or self.attributeType = AttributeType::SingleValuedEnumeration)implies a.oclAsType(EnumerationAttribute).allowedValue = self.allowedValue) anda.defaultValue = self.defaultValue andStoreView.allInstances() -> forAll ( stw |

ais.oclIsNew() and ais.oclIsTypeOf(AttributeInStoreView) andais.attribute = a and ais.storeView = stw

)andlet productAbleToBeRated : Set(Product) =

self.attributeSet.product -> select(p|a.associatedProductType -> includes(p.productType))in

productAbleToBeRated -> forAll ( p |gar.oclIsNew() and gar.oclIsTypeOf(GlobalAttributeRating) and

gar.productOfGloballyRatedAttribute = p and gar.globallyRatedAttribute = aand Website.allInstances() -> forAll ( w |

war.oclIsNew() and war.oclIsTypeOf(WebsiteAttributeRating) andwar.websiteRatedProduct = p and war.websiteRatedAttribute = a andwar.websiteWhereIsRated = w

) and StoreView.allInstances() -> forAll ( s |sar.oclIsNew() and sar.oclIsTypeOf(StoreViewAttributeRating) and

sar.storeViewRatedProduct = p and sar.storeViewRatedAttribute = a andsar.storeViewWhereIsRated = s

) )

Event

4.6.6 EditAttributeFrom use case: Edit an attribute

n Event SpecificationAttributesattributeType : AttributeType [1]code : String [1]name : String [1]scope : Scope [1]isComparable : Boolean [1]hasUniqueValues : Boolean [0..1]isRequired : Boolean [0..1]associatedProductType : ProductType [1..*]inputValidation : InputValidation [0..1]isConfigurable : Boolean [0..1]

Relationships

255

Page 257: Magento Conceptual Schema

attribute : Attribute [1]allowedValue : EnumerationValue [*]defaultValue : AttributeValue [0..1]

GeneralizationsRelationships inherited from ScopeDefinedEventeditForWebsiteScope : Website [0..1]editForStoreViewScope : StoreView [0..1]

n Initial Integrity Constraints

context EditAttribute :: allowedEnumerationValuesAreOnlyDefinedForEnumerationAttributes() : Booleanbody:

(self.attribute.oclIsTypeOf(SingleValuedEnumerationAttribute) orself.attribute.oclIsTypeOf(MultipleValuedEnumerationAttribute)) =self.attribute.oclAsType(EnumerationAttribute).allowedValue -> notEmpty()

context EditAttribute :: isConfigurablePropertyIsOnlyDefinedForSingleValuedEnumerationAttributes() : Booleanbody:

self.allowedValue -> notEmpty() = self.attribute.oclIsTypeOf(SingleValuedEnumerationAttribute)

context EditAttribute :: inputValidationIsOnlyDefinedForTextualAttributes() : Booleanbody:

self.inputValidation.isDefined() = self.attribute.oclIsTypeOf(TextualAttribute)

context EditAttribute :: requiredAndUniqueAreOnlyDefinedForNonImageAttributes() : Booleanbody:

(self.isRequired.isDefined() and self.hasUniqueValues.isDefined())= (not self.attribute.oclIsTypeOf(ImageAttribute))

context EditAttribute :: defaultValueIsNotDefinedForImageAttributes() : Booleanbody:

self.attribute.oclIsTypeOf(ImageAttribute) implies self.defaultValue.isDefined()

context EditAttribute :: defaultValueHaveTheCorrectType() : Booleanbody:

self.attribute.oclIsTypeOf(TextualAttribute) implies self.defaultValue.oclIsTypeOf ( TextualValue ) andself.attribute.oclIsTypeOf(PriceAttribute) implies self.defaultValue.oclIsTypeOf ( PriceValue ) andself.attribute.oclIsTypeOf(DateAttribute) implies self.defaultValue.oclIsTypeOf ( DateValue ) andself.attribute.oclIsTypeOf(BooleanAttribute) implies self.defaultValue.oclIsTypeOf ( BooleanValue ) andself.attribute.oclIsTypeOf(IntegerAttribute) implies self.defaultValue.oclIsTypeOf ( IntegerValue ) andself.attribute.oclIsTypeOf(DecimalAttribute) implies self.defaultValue.oclIsTypeOf ( DecimalValue ) andself.attribute.oclIsTypeOf(SingleValuedEnumerationAttribute) implies self.defaultValue.oclIsTypeOf ( EnumerationVa-lue )) andself.attribute.oclIsTypeOf(MultipleValuedEnumerationAttribute) implies self.defaultValue.oclIsTypeOf ( MultipleEnu-merationValue ))

n Effect

context EditAttribute::effect()

post:self.attribute.code = self.code and

self.attribute.scope = self.scope andself.attribute.isComparable = self.isComparable andself.attribute.hasUniqueValues = self.hasUniqueValues andself.attribute.isRequired = self.isRequired andself.attribute.associatedProductType = self.associatedProductType and(self.attributeType = AttributeType::Textual implies self.attribute.oclAsType(TextualAttribute).inputValidation = self.-inputValidation) and(self.attributeType = AttributeType::SingleValuedEnumeration implies self.attribute.oclAsType(SingleValuedEnumerationAttribute).-

256

Page 258: Magento Conceptual Schema

isConfigurable = self.isConfigurable) and((self.attributeType = AttributeType::SingleValuedEnumeration or self.attributeType = AttributeType::SingleValuedEnumeration)implies self.attribute.oclAsType(EnumerationAttribute).allowedValue = self.allowedValue) andself.attribute.defaultValue = self.defaultValue andif self.editForStoreViewScope.isDefined() then

self.attribute.attributeInStoreView->any(as|as.storeView=self.editForStoreViewScope

).redefinedName = self.nameelse

self.attribute.genericName = self.nameendif

Event

4.6.7 DeleteAttributeFrom use case: Delete an attribute

n Event SpecificationRelationshipsattribute : Attribute [1]

n Effect

context DeleteAttribute::effect()

post:

not [email protected](OclAny) and

257

Page 259: Magento Conceptual Schema

4.7 Additional Activities

Event

4.7.1 NewReviewFrom use case: Add a review

n Event SpecificationAttributesauthorNickName : String [1]title : String [1]text : String [1]scores : TupleType (value: Rating, property: Property) [1..*]

Relationshipsproduct : Product [1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Initial Integrity Constraints

context NewReview :: customerIsLoggedInIfGuestsAreNotAllowed() : Booleanbody:

self.session.storeView.store.website.CatalogConfigurationInWebsite.allowGuestsToWriteReviews orself.session.oclIsTypeOf(CustomerSession)

context NewReview :: scoresAllVisibleProperties() : Booleanbody:

self.scores.property -> includesAll( self.session.storeView.propertyInStoreView->select(piw|piw.isVisible).proper-ty )

context NewReview :: reviewDoesNotExist() : Booleanbody:

not Review.allInstances()->exists ( r | r.authorNickName = self.authorNickName and r.text = self.text )

n Effect

context NewReview::effect()

post:r.oclIsNew() and r.oclIsTypeOf(Review) and

r.authorNickName = self.authorNickName andr.title = self.title andr.text = self.text andr.status = ReviewStatus::Pending andr.createdAt = Now() andr.product = self.product andself.session.oclIsTypeOf(CustomerSession) implies r.user = self.session.oclAsType(CustomerSession).customerandr.storeViewWhereIsVisible -> includes(self.session.storeView) andself.scores -> forAll ( scoreTuple |

258

Page 260: Magento Conceptual Schema

s.oclIsNew() and s.oclIsTypeOf(PropertyScore) ands.property = scoreTuple.property ands.review = r ands.value = scoreTuple.value

)

Event

4.7.2 NewAdministratorReviewFrom use case: Add a review

n Event SpecificationAttributesauthorNickName : String [1]title : String [1]text : String [1]status : ReviewStatus [1]scores : TupleType (value: Rating, property: Property) [1..*]

Relationshipsproduct : Product [1]storeView : StoreView [1..*]

GeneralizationsRelationships inherited from ExistingAdministratorEventadministrator : Administrator [1]

n Initial Integrity Constraints

context NewAdministratorReview :: scoresAllVisibleProperties() : Booleanbody:

self.scores.property -> includesAll( self.storeView.propertyInStoreView->select(piw|piw.isVisible).property -> as-Set() )

context NewAdministratorReview :: reviewDoesNotExist() : Booleanbody:

not Review.allInstances()->exists ( r | r.authorNickName = self.authorNickName and r.text = self.text )

n Effect

context NewAdministratorReview::effect()

post:r.oclIsNew() and r.oclIsTypeOf(Review) and

r.authorNickName = self.authorNickName andr.title = self.title andr.text = self.text andr.status = self.status andr.createdAt = Now() andr.product = self.product andr.user = self.administrator andr.storeViewWhereIsVisible = self.storeView andr.scores -> forAll ( scoreTuple |

s.oclIsNew() and s.oclIsTypeOf(PropertyScore) ands.property = scoreTuple.property and

259

Page 261: Magento Conceptual Schema

s.review = r ands.value = scoreTuple.value

)

Event

4.7.3 AddProductToWishlistFrom use case: Add a product to the wish list

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context AddProductToWishlist :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

context AddProductToWishlist :: wishListIsEnabledInTheCurrentWebsite() : Booleanbody:

self.customer.customerSession.storeView.store.website.wishlistConfigurationInWebsite.status = Status::Enabled

context AddProductToWishlist :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.customer.customerSession.storeView.store.website.productInWebsite->any(piw | piw.product = self.product

).isAvailable

context AddProductToWishlist :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.customer.customerSession.storeView.productInStoreView->any(pisw | pisw.product = self.product

).status = #Enabled

context AddProductToWishlist :: productIsNotAlreadyInWishList() : Booleanbody:

let currentWebsite : Website = self.customer.customerSession.storeView.store.website inself.customer.activityInfoOfCustomerInWebsite -> any ( ai | ai.websiteWithInfoAbout = currentWebsite ).-

wishedProduct -> excludes(self.product)

n Effect

context AddProductToWishlist::effect()

post:w.oclIsNew and w.oclIsTypeOf(WishListItem) and

w.addedOn = Now() andw.wishedProduct = self.product andw.activityInfoOfCustomerInWebsite = self.customer.activityInfoOfCustomerInWebsite

260

Page 262: Magento Conceptual Schema

->any( ai | ai.websiteWithInfoAbout = self.customer.customerSession.storeView.store.website )

Event

4.7.4 AddCommentToWishlistItemFrom use case: Add a product to the wish list

n Event SpecificationAttributesnewComment : String [1]

GeneralizationsRelationships inherited from ExistingWishListItemEventwishListItem : WishListItem [1]

Relationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context AddCommentToWishlistItem :: wishListItemBelongsToCustomer() : Booleanbody:

self.wishListItem.activityInfoOfCustomerInWebsite.customerWithInfoAbout = self.customer

n Effect

context AddCommentToWishlistItem::effect()

post:

self.wishListItem.comment = self.newComment

Event

4.7.5 RemoveCommentFromWishlistItemFrom use case: Add a product to the wish list

n Event SpecificationGeneralizationsRelationships inherited from ExistingWishListItemEventwishListItem : WishListItem [1]

Relationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

261

Page 263: Magento Conceptual Schema

context RemoveCommentFromWishlistItem :: wishListItemBelongsToCustomer() : Booleanbody:

self.wishListItem.activityInfoOfCustomerInWebsite.customerWithInfoAbout = self.customer

n Effect

context RemoveCommentFromWishlistItem::effect()

post:

self.wishListItem.comment -> isEmpty()

Event

4.7.6 RemoveProductFromWishlistFrom use case: Remove a product from the wish list

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context RemoveProductFromWishlist :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

context RemoveProductFromWishlist :: productIsInTheWishList() : Booleanbody:

let currentWebsite : Website = self.customer.customerSession.storeView.store.website inself.customer.activityInfoOfCustomerInWebsite->any( ai | ai.websiteWithInfoAbout = currentWebsite ).-

wishedProduct -> includes(self.product)

n Effect

context RemoveProductFromWishlist::effect()

post:let currentWebsite : Website = self.customer.customerSession.storeView.store.website in

self.customer.activityInfoOfCustomerInWebsite( ai | ai.websiteWithInfoAbout = currentWebsite ).wished-Product -> excludes(self.product)

262

Page 264: Magento Conceptual Schema

Event

4.7.7 AddProductToCompareListFrom use case: Add a product to the compare list

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context AddProductToCompareList :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.session.storeView.store.website.productInWebsite->any(piw|piw.product = self.product).isAvailable

context AddProductToCompareList :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.session.storeView.productInStoreView->any(pisw|pisw.product = self.product).status = Status::Enabled

self.session.storeView.productInStoreView->any(pisw|pisw.product = self.product).status = Status::Enabled

context AddProductToCompareList :: productIsNotAlreadyInCompareList() : Booleanbody:

self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.storeView).readyToCompareProduct -> excludes(self.product)

n Effect

context AddProductToCompareList::effect()

post:let listScope : Scope =

self.session.storeView.store.website.catalogConfigurationInWebsite.recentlyViewedAndComparedProductsS-cope

inif listScope = Scope::StoreView then

self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.store-View).explicitReadyToCompareProduct -> includes(self.product)

elseself.session.activityInfoOfSessionInWebsite->any( ai | ai.websiteWithInfoAbout = self.session.storeView.-

store.website).explicitReadyToCompareProduct -> includes(self.product)

endif

263

Page 265: Magento Conceptual Schema

Event

4.7.8 RemoveProductFromCompareListFrom use case: Remove a product from the compare list

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context RemoveProductFromCompareList :: productIsInCompareList() : Booleanbody:

self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.storeView).readyToCompareProduct -> includes(self.product)

n Effect

context RemoveProductFromCompareList::effect()

post:self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.storeView)

.readyToCompareProduct -> excludes(self.product)

post:let listScope : Scope =

self.session.storeView.store.website.catalogConfigurationInWebsite.recentlyViewedAndComparedProductsS-cope

inlet comparedProducts : OrderedSet(Product) =

if listScope = Scope::StoreView thenself.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.-

storeView).explicitRecentlyComparedProduct

elseself.session.activityInfoOfSessionInWebsite->any( ai | ai.websiteWithInfoAbout = self.session.store-

View.store.website).explicitRecentlyComparedProduct

endifin

comparedProducts -> first() = self.product and( comparedProducts@pre -> size() = self.session.storeView.catalogConfigurationInStoreView.numberOfRecently-ComparedProductsSavedimplies comparedProducts -> excludes(comparedProducts@pre -> last()) )

Event

4.7.9 SingUpForPriceAlertFrom use case: Subscribe to a product price alert

n Event Specification

264

Page 266: Magento Conceptual Schema

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context SingUpForPriceAlert :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

context SingUpForPriceAlert :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.customer.customerSession.storeView.store.website.productInWebsite->any(piw | piw.product = self.product

).isAvailable

context SingUpForPriceAlert :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.customer.customerSession.storeView.productInStoreView->any(pisw | pisw.product = self.product

).status = #Enabled

context SingUpForPriceAlert :: priceAlertIsAllowed() : Booleanbody:

self.customer.customerSession.storeView.catalogConfigurationInStoreView.allowPriceAlert

n Effect

context SingUpForPriceAlert::effect()

post:self.customer.activityInfoOfCustomerInWebsite->any( ai | ai.websiteWithInfoAbout = self.customer.custom-

erSession.storeView.store.website).productSubscribedForPriceAlert -> includes(self.product)

Event

4.7.10 SingUpForStockAlertFrom use case: Subscribe to a product stock alert

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

265

Page 267: Magento Conceptual Schema

context SingUpForStockAlert :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

context SingUpForStockAlert :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.customer.customerSession.storeView.store.website.productInWebsite->any(piw | piw.product = self.product

).isAvailable

context SingUpForStockAlert :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.customer.customerSession.storeView.productInStoreView->any(pisw | pisw.product = self.product

).status = #Enabled

context SingUpForStockAlert :: stockAlertIsAllowed() : Booleanbody:

self.customer.customerSession.storeView.store.website.catalogConfigurationInWebsite.allowStockAlert

n Effect

context SingUpForStockAlert::effect()

post:self.customer.activityInfoOfCustomerInWebsite->any( ai | ai.websiteWithInfoAbout = self.customer.custom-

erSession.storeView.store.website).productSubscribedForStockAlert -> includes(self.product)

Event

4.7.11 SignUpForNewsletterFrom use case: Subscribe to the newsletter

n Event SpecificationAttributeseMail : EMail [0..1]

GeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Initial Integrity Constraints

context SignUpForNewsletter :: sessionIsFromCustomerOrAnEmailIsProvided() : Booleanbody:

self.session.oclIsTypeOf(CustomerSession) or self.eMail.isDefined()

context SignUpForNewsletter :: anonymousSubscriptionDoesNotExistIfCurrentSessionIsAnonymous() : Booleanbody:

self.session.oclIsTypeOf(AnonymousSession) implies not AnonymousNewsletterSubscription.allInstances() -> ex-ists ( s | s.storeView = self.session.storeView and s.providedEMail = self.eMail )

266

Page 268: Magento Conceptual Schema

n Effect

context SignUpForNewsletter::effect()

post:if self.session.oclIsTypeOf(CustomerSession) then

if self.session.oclAsType(CustomerSession)[email protected] -> exists( s| s.storeView = self.session.storeView ) then

let subs : CustomerNewsletterSubscription =self.session.oclAsType(CustomerSession).customer.customerNewsletterSubscription -> any( s | s.-

storeView = self.session.storeView )in

subs.status = Status::Enabled andsubs.providedEMail = self.eMail

else if [email protected]() -> exists ( s | s.storeView = self.session.storeViewand s.providedEMail = self.eMail ) then

let subs : AnonymousNewsletterSubscription [email protected]() -> any ( s | s.storeView = self.session.store-

View and s.providedEMail = self.eMail )in

subs.oclIsTypeOf(CustomerNewsletterSubscription) andsubs.customer = self.session.oclAsType(CustomerSession).customer

elses.oclIsNew() and s.oclIsTypeOf(CustomerNewsletterSubscription) and

s.customer = self.session.oclAsType(CustomerSession).customer and s.providedEMail = self.eMails.status = Status::Enabled ands.storeView = self.session.storeView

endif endifelse

s.oclIsNew() and s.oclIsTypeOf(AnonymousNewsletterSubscription) ands.providedEMail = self.eMail ands.status = Status::Enabled ands.storeView = self.session.storeView

endif

Event

4.7.12 SignDownFromNewsletterFrom use case: Unsubscribe from the newsletter

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context SignDownFromNewsletter :: customerIsLoggedIn() : Booleanbody:

self.customer.customerSession -> notEmpty()

context SignDownFromNewsletter :: customerHasAnEnabledSubscription() : Booleanbody:

self.customer.customerNewsletterSubscription -> exists ( s |s.storeView = self.customer.customerSession.storeView and s.status = Status::Enabled

)

n Effect

267

Page 269: Magento Conceptual Schema

context SignDownFromNewsletter::effect()

post:self.customer.customerNewsletterSubscription -> any ( s |

s.storeView = self.customer.customerSession.storeView).status = Status::Disabled

Event

4.7.13 TellToAFriendUsedFrom use case: Tell to a friend

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

n Initial Integrity Constraints

context TellToAFriendUsed :: tellToAFriendIsEnabled() : Booleanbody:

self.session.storeView.tellToAFriendConfigurationInStoreView.status = Status::Enabled

context TellToAFriendUsed :: sessionBelongsToCustomerOrGuestIsEnabled() : Booleanbody:

self.session.storeView.tellToAFriendConfigurationInStoreView.guestStatus = Status::Enabled or self.session.oclIsType-Of(CustomerSession)

context TellToAFriendUsed :: maxUsesNotReached() : Booleanbody:

let uses:Integer=self.session.activityInfoOfSessionInStoreView->any(ai|ai.storeViewWithInfoAbout=self.session.storeView)

.usesOfTellToAFriendInLastHourin

uses < self.session.storeView.tellToAFriendConfigurationInStoreView.maxUsesPerHour

n Effect

context TellToAFriendUsed::effect()

post:let uses:Integer=

self.session.activityInfoOfSessionInStoreView->any(ai|ai.storeViewWithInfoAbout = self.session.storeView).-usesOfTellToAFriendInLastHour

inuses = uses@pre +1

268

Page 270: Magento Conceptual Schema

Event

4.7.14 ProductViewedFrom use case: View product information, Place an Order

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context ProductViewed :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.session.storeView.store.website.productInWebsite->any(piw|piw.product = self.product).isAvailable

context ProductViewed :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.session.storeView.productInStoreView->any(pisw|pisw.product = self.product).status = Status::Enabled

context ProductViewed :: productIsNotAlreadyInRecentlyViewedList() : Booleanbody:

self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.storeView).recentlyViewedProduct -> excludes(self.product)

n Effect

context ProductViewed::effect()

post:let listScope : Scope =

self.session.storeView.store.website.catalogConfigurationInWebsite.recentlyViewedAndComparedProductsS-cope

inlet viewedProducts : OrderedSet(Product) =

if listScope = Scope::StoreView thenself.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.-

storeView).explicitRecentlyViewedProduct

elseself.session.activityInfoOfSessionInWebsite->any( ai | ai.websiteWithInfoAbout = self.session.store-

View.store.website).explicitRecentlyViewedProduct

endifin

viewedProducts -> first() = self.product and( viewedProducts@pre -> size() = self.session.storeView.catalogConfigurationInStoreView.numberOfRecentlyViewed-ProductsSavedimplies viewedProducts -> excludes(viewedProducts@pre -> last()) )

269

Page 271: Magento Conceptual Schema

Event

4.7.15 ResetTemporalInfoFrom use case: Reset the temporal information

n Event Specification

n Effectcontext ResetTemporalInfo::effect()

post:ActivityInfoOfSessionInStoreView.usesOfTellToAFriendInLastHour = 0 and

ActivityInfoOfCustomerInStoreView.usesOfTellToAFriendInLastHour = 0

270

Page 272: Magento Conceptual Schema

4.8 Online catalog

Event

4.8.1 ProductViewedFrom use case: View product information, Place an Order

n Event SpecificationGeneralizationsRelationships inherited from ExistingSessionEventsession : Session [1]

Relationships inherited from ExistingProductEventproduct : Product [1]

n Initial Integrity Constraints

context ProductViewed :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.session.storeView.store.website.productInWebsite->any(piw|piw.product = self.product).isAvailable

context ProductViewed :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.session.storeView.productInStoreView->any(pisw|pisw.product = self.product).status = Status::Enabled

context ProductViewed :: productIsNotAlreadyInRecentlyViewedList() : Booleanbody:

self.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.storeView).recentlyViewedProduct -> excludes(self.product)

n Effect

context ProductViewed::effect()

post:let listScope : Scope =

self.session.storeView.store.website.catalogConfigurationInWebsite.recentlyViewedAndComparedProductsS-cope

inlet viewedProducts : OrderedSet(Product) =

if listScope = Scope::StoreView thenself.session.activityInfoOfSessionInStoreView->any( ai | ai.storeViewWithInfoAbout = self.session.-

storeView).explicitRecentlyViewedProduct

elseself.session.activityInfoOfSessionInWebsite->any( ai | ai.websiteWithInfoAbout = self.session.store-

View.store.website).explicitRecentlyViewedProduct

endifin

viewedProducts -> first() = self.product and( viewedProducts@pre -> size() = self.session.storeView.catalogConfigurationInStoreView.numberOfRecentlyViewed-ProductsSavedimplies viewedProducts -> excludes(viewedProducts@pre -> last()) )

271

Page 273: Magento Conceptual Schema

Event

4.8.2 AddProductToShoppingCartFrom use case: Place an order

n Event SpecificationAttributesquantity : PositiveInteger [1]textOption : TupleType(o:TextOption,text:String) [*]dateOption : TupleType(o:DateOption,date:Date) [*]

RelationshipsoptionValue : OptionValueInOption [*]

GeneralizationsRelationships inherited from ExistingProductEventproduct : Product [1]

Relationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Initial Integrity Constraints

context AddProductToShoppingCart :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.shoppingCart.currentStoreView.store.website.productInWebsite->any(piw|piw.product = self.product

).isAvailable

context AddProductToShoppingCart :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.shoppingCart.currentStoreView.productInStoreView->any(pisw|pisw.product = self.product

).status = Status::Enabled

context AddProductToShoppingCart :: productIsInStock() : Booleanbody:

self.product.stockStatus = StockStatus::InStock

context AddProductToShoppingCart :: optionsAreFromTheProduct() : Booleanbody:

self.product.option -> includesAll(self.textOption->collect(o)) andself.product.option -> includesAll(self.dateOption->collect(o)) andself.product.option->select(o|

o.oclIsTypeOf(OptionWithPredefinedContent)).oclAsType(OptionWithPredefinedContent).optionValueInOption -> includesAll(self.optionValue)

context AddProductToShoppingCart :: optionsAreRatedOnlyOnce() : Booleanbody:

self.textOption -> isUnique(o) and self.dateOption -> isUnique(o) andself.optionValue -> isUnique(optionWithPredefinedContent)

context AddProductToShoppingCart :: optionIsRatedWhenIsRequired() : Booleanbody:

self.product.option -> select(o|o.isRequired) -> forAll ( o |if o.oclIsTypeOf(TextOption) then

self.textOption->collect(o) -> includes(o.oclAsType(TextOption))else if o.oclIsTypeOf(DateOption) then

272

Page 274: Magento Conceptual Schema

self.dateOption->collect(o) -> includes(o.oclAsType(DateOption))else

self.optionValue.optionWithPredefinedContent -> includes(o)endif endif

)

n Effect

context AddProductToShoppingCart::effect()

post addProduct:let productExists: Boolean =

let existingItem : ShoppingCartItem [email protected]@pre -> any(i|i.product=self.product)

inexistingItem.isDefined() and

existingItem.optionValueInOption = self.optionValue andexistingItem.textOptionRating -> collect(r| Tupleo=r.textOption,text=r.value) = self.textOption andexistingItem.dateOptionRating -> collect(r| Tupleo=r.textOption,date=r.value) = self.dateOption

inif productExists then

let i = self.shoppingCart.shoppingCartItem -> any( i | i.product = self.product ) in i.quantity = [email protected] + self.quantity

elsei.oclIsNew() and i.oclIsTypeOf(ShoppingCartItem) and

i.shoppingCart = self.shoppingCart and i.product = self.product andi.quantity = self.quantity and i.applyDiscount = true andself.textOption -> forAll(tupleOpt|

r.oclIsNew() and r.oclIsTypeOf(TextOptionRating) andr.textOption = tupleOpt.o and r.value = tupleOpt.text andr.shoppingCartItem = i

) andself.dateOption -> forAll(tupleOpt|

r.oclIsNew() and r.oclIsTypeOf(DateOptionRating) andr.dateOption = tupleOpt.o and r.value = tupleOpt.date andr.shoppingCartItem = i

) and i.optionValueInOption = self.optionValueendif

post decreaseQuantity:

StockConfiguration.allInstances->any(true).decreaseStockWhenOrderIsPlacedimplies (self.product.quantity = [email protected]@pre - self.quantity)

Event

4.8.3 UpdateShoppingCartFrom use case: Place an order

n Event SpecificationAttributeslineChange : TupleType (remove: Boolean, quantity: PositiveInteger, customPrice: Money, applyDis-

count: Boolean, item: ShoppingCartItem) [1..*]

GeneralizationsRelationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Initial Integrity Constraints

context UpdateShoppingCart :: itemsAreUpdatedOnlyOnce() : Boolean

273

Page 275: Magento Conceptual Schema

body:

self.lineChange -> isUnique(item)

n Effect

context UpdateShoppingCart::effect()

post:self.lineChange -> forAll ( lc |

let cartItem : ShoppingCartItem =self.shoppingCart.shoppingCartItem->any(i|i=lc.item)

inif lc.remove then

not [email protected](OclAny)else

lc.quantity = cartItem.quantity and self.shoppingCart.oclIsTypeOf(AdministrationShoppingCart) im-plies (

cartItem.customPrice = lc.customPrice andcartItem.applyDiscount = lc.applyDiscount

)endif

)

Event

4.8.4 ApplyCouponCodeFrom use case: Place an order, Add an order

n Event SpecificationAttributesnewCouponCode : String [1]

GeneralizationsRelationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Effect

context ApplyCouponCode::effect()

post:

self.shoppingCart.couponCode = self.newCouponCode

Event

4.8.5 OrderConfirmationFrom use case: Place an order, Add an order

n Event Specification

274

Page 276: Magento Conceptual Schema

Attributescomments : TupleType (text: String, notifyCustomer:Boolean) [*]creditCardInfo : TupleType (type: String, owner: String, number: String, expires: Date, verification:

String) [0..1]eMailSent : Boolean [1]

RelationshipsshoppingCart : ShoppingCart [1]delivery : Address [1]billing : Address [1]shippingMethod : ShippingMethod [1]paymentMethod : PaymentMethod [1]

n Initial Integrity Constraints

context OrderConfirmation :: guestCheckoutIsEnabledIfNeeded() : Booleanbody:

(self.shoppingCart.shoppingCartItem.product -> exists (p|p.oclIsTypeOf(DownloadableProduct)) and self.-shoppingCart.currentStoreView.store.website.catalogConfigurationInWebsite.allowGuestCheckoutForDownloadableIt-ems)implies(not self.shoppingCart.oclIsTypeOf(AnonymousShoppingCart))

context OrderConfirmation :: shippingMethodIsEnabledAtTheCurrentWebsite() : Booleanbody:

let sh:ShippingMethodInWebsite =self.shoppingCart.currentStoreview.store.website.

shippingMethodInWebsite->any(sw|sw.shippingMethod = self.shippingMethod)in

sh.status = Status::Enabled

context OrderConfirmation :: allowsFreeShippingOnlyForAMinimumAmount() : Booleanbody:

let sh:ShippingMethodInWebsite =self.shoppingCart.currentStoreview.store.website.

shippingMethodInWebsite->any(sw|sw.shippingMethod = self.shippingMethod)in

sh.oclIsTypeOf(FreeShippingInWebsite) impliesself.shoppingCart.total >= sh.oclAsType(FreeShippingInWebsite).minimumOrderAmount

context OrderConfirmation :: paymentMethodIsEnabledAtTheCurrentWebsite() : Booleanbody:

let selectedMethodConfiguration : PaymentMethodInWebsite =self.shoppingCart.currentStoreView.store.website.paymentMethodInWebsite->any(sw|sw.paymentMethod

= self.paymentMethod)in

selectedMethodConfiguration.status = Status::Enabled andselectedMethodConfiguration.minimumAllowed <= self.shoppingCart.total andselectedMethodConfiguration.maximumAllowed >= self.shoppingCart .total

context OrderConfirmation :: creditCardDetailsAreThereIfNeeded() : Booleanbody:

self.paymentMethod.oclIsKindOf(CreditCardMethod) implies self.creditCardInfo.isDefined()

n Effect

context OrderConfirmation::effect()

post theOrderIsCreated:let taxConf : TaxConfigurationInWebsite = [email protected]

275

Page 277: Magento Conceptual Schema

figurationInWebsite inlet wbCurrency : Currency = self.shoppingCart@pre.currentStoreView.store.website.currencyConfigurationInWeb-site.baseCurrency inlet purchCurrency : Currency = [email protected] ino.oclIsNew() and o.oclIsTypeOf(Order) ando.couponCode = [email protected] ando.eMailSent = self.eMailSent ando.giftMessage = [email protected] ando.storeView = [email protected] ando.customerGroup = [email protected] ando.billing = self.billing ando.delivery = self.delivery ando.shippingMethod = self.shippingMethod ando.paymentMethod = self.paymentMethod ando.status = OrderStatus::Pending andself.shoppingCart.oclIsTypeOf(CustomerShoppingCart) implies

o.customer = [email protected](CustomerShoppingCart).customer@preand self.shoppingCart.oclIsTypeOf(AdministrationShoppingCart) implies

o.customer = [email protected](AdministrationShoppingCart).customer@preand o.rateApplicationAddress =

if taxConf.usedAddress = TaxCalculatingAddress::Billing then o.billingelse if taxConf.usedAddress = TaxCalculatingAddress::Delivery then o.deliveryelse taxConf.website.shippingConfigurationInWebsite.shippingOrigin endif endif

and o.genericBaseCurrency = CurrencyConfiguration.allInstances()->any(true).genericBaseCurrencyand

wbCurrency <> o.genericBaseCurrency implies(u.oclIsNew and u.oclIsTypeOf(UseOfWebsiteRedefinedBaseCurrency) andu.orderOfRedefinedBaseCurrency = o and u.websiteRedefinedBaseCurrency = wbCurrency andu.initialRate = CurrencyRate.allInstances->any(r|

r.baseCurrency=o.genericBaseCurrency and r.currency=wbCurrency).rate)

and(purchCurrency <> o.genericBaseCurrency and purchCurrency <> o.websiteRedefinedBaseCurrency)

implies(u.oclIsNew and u.oclIsTypeOf(UseOfPurchasingCurrency) andu.orderOfPurchasingCurrency = o and u.purchasingCurrency = purchCurrency andu.initialRate = CurrencyRate.allInstances->any(r|

r.baseCurrency=o.genericBaseCurrency and r.currency=purchCurrency).rate)

andself.comments.forAll ( tupleCom |

c.oclIsNew() and c.oclIsTypeOf(Comment) andc.text = tupleCom.text and c.notifyCustomer = tupleCom.notifyCustomer andc.createdAt = Now() and c.status = CommentStatus::Pending ando.comment -> includes(c)

) [email protected]@pre -> forAll ( i |

ol.oclIsNew() and ol.oclIsTypeOf(OrderLine) andol.order = o andol.productSku = i.product.sku andol.productName = i.product.productInStoreView -> any(pw|pw.storeView = o.storeView).name andol.quantity = i.quantity and ol.giftMessage = i.giftMessage andol.price = i.price andif i.applyDiscount then

let discountBasis: Money =if self.shoppingCart.currentStoreView.store.website.taxConfigurationInWebsite.methodRespectingDis-

count = TaxRespectingDiscountsMethod::TaxAfterDiscount andself.shoppingCart.currentStoreView.store.website.taxConfigurationInWebsite.applyDiscountIncludingTax then

ol.price * ol.quantity + ol.taxelse

ol.price * ol.quantityendif

in ol.discount = i.calculateDiscount( discountBasis, i.appliedShoppingCartPriceRule )else ol.discount = 0.0

endif andlet appliedTaxRate : Bag(TaxRate) =

TaxRule.allInstances() -> select ( t |

TaxRule.allInstances() -> forAll ( t2 | t2.priority <= t.priority )) ->select ( t |

t.customerTaxClass -> includes(o.customerGroup.customerTaxClass) and t.productTaxClass -> in-cludes(i.product) )

-> collect ( t | t.taxRate ) -> select ( tr |

tr.applicableAddress -> includes(o.rateApplicationAddress)) -> union ( i.product.fixedTaxRate )

in

276

Page 278: Magento Conceptual Schema

ol.tax = (appliedTaxRate -> collect ( a | a.rate * i.price * i.quantity / 100 ) -> sum())and ol.total = (i.total + ol.tax) and

ol.textOptions = TextOptionInfo.allInstances() -> select (inf|i.textOption.genericName -> includes(inf.optionName) and

i.textOptionRating.value -> includes(inf.value)) and

ol.dateOptions = DateOptionInfo.allInstances() -> select (inf|i.dateOption.genericName -> includes(inf.optionName) and

i.dateOptionRating.value -> includes(inf.value)) and

ol.predefinedContentOptions = PredefinedContentOptionInfo.allInstances() -> select (inf|i.optionValueInOption.optionWithPredefinedContent.genericName -> includes(inf.optionName) and

i.optionValueInOption.optionValue.genericName -> includes(inf.valueName))

)

post theShoppingCartItemsAreRemoved:

self.shoppingCart.shoppingCartItem -> isEmpty()

post theShoppingCartIsRemovedIfItIsAdministration:

[email protected](AdministrationShoppingCart) implies (not [email protected](OclAny))

post updateProductQuantities:StockConfiguration.decreaseStockWhenOrderIsPlaced implies [email protected]@pre

-> forAll ( i |i.product.quantity = i.product.quantity@pre - i.quantity

)

Event

4.8.6 DuplicateAccountFrom use case: Add an order

n Event SpecificationRelationshipswebsite : Website [1]

GeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

n Initial Integrity Constraints

context DuplicateAccount :: customerIsNotVisibleInWebsite() : Booleanbody:

not self.website.visibleCustomer -> includes(self.customer)

n Effect

context DuplicateAccount::effect()

post:c.oclIsNew() and

277

Page 279: Magento Conceptual Schema

c.oclIsTypeOf(Customer) andc.eMail = self.customer.eMail andc.firstName = self.customer.firstName andc.lastName = self.customer.lastName andc.password = self.customer.password andc.namePrefix = self.customer.namePrefix andc.middleName = self.customer.middleName andc.nameSuffix = self.customer.nameSuffix andc.dateOfBirth = self.customer.dateOfBirth andc.taxVatNumber = self.customer.taxVatNumber andc.createdAt = Now() andc.websiteWhereIsAssociated = self.website andc.customerGroup = CustomerGroup.allInstances() -> any(cg|cg.name=’General’) andc.address = self.customer.address andc.defaultBilling = self.customer.defaultBilling andc.defaultDelivery = self.customer.defaultDelivery

Event

4.8.7 NewAdministrationShoppingCartFrom use case: Add an order

n Event SpecificationGeneralizationsRelationships inherited from ExistingCustomerEventcustomer : Customer [1]

Relationships inherited from ExistingAdministratorEventadministrator : Administrator [1]

Relationships inherited from StoreViewPlacedEventstoreView : StoreView [1]

n Effect

context NewAdministrationShoppingCart::effect()

post:sc.oclIsNew() and sc.oclIsTypeOf(AdministrationShoppingCart) and

sc.customer = self.customer and sc.administrator = self.administrator andsc.storeView = self.storeView andsc.currency = self.storeView.store.website.currencyConfigurationInWebsite.baseCurrency

Event

4.8.8 AddProductToShoppingCartFrom use case: Place an order

n Event SpecificationAttributesquantity : PositiveInteger [1]textOption : TupleType(o:TextOption,text:String) [*]dateOption : TupleType(o:DateOption,date:Date) [*]

RelationshipsoptionValue : OptionValueInOption [*]

278

Page 280: Magento Conceptual Schema

GeneralizationsRelationships inherited from ExistingProductEventproduct : Product [1]

Relationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Initial Integrity Constraints

context AddProductToShoppingCart :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.shoppingCart.currentStoreView.store.website.productInWebsite->any(piw|piw.product = self.product

).isAvailable

context AddProductToShoppingCart :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.shoppingCart.currentStoreView.productInStoreView->any(pisw|pisw.product = self.product

).status = Status::Enabled

context AddProductToShoppingCart :: productIsInStock() : Booleanbody:

self.product.stockStatus = StockStatus::InStock

context AddProductToShoppingCart :: optionsAreFromTheProduct() : Booleanbody:

self.product.option -> includesAll(self.textOption->collect(o)) andself.product.option -> includesAll(self.dateOption->collect(o)) andself.product.option->select(o|

o.oclIsTypeOf(OptionWithPredefinedContent)).oclAsType(OptionWithPredefinedContent).optionValueInOption -> includesAll(self.optionValue)

context AddProductToShoppingCart :: optionsAreRatedOnlyOnce() : Booleanbody:

self.textOption -> isUnique(o) and self.dateOption -> isUnique(o) andself.optionValue -> isUnique(optionWithPredefinedContent)

context AddProductToShoppingCart :: optionIsRatedWhenIsRequired() : Booleanbody:

self.product.option -> select(o|o.isRequired) -> forAll ( o |if o.oclIsTypeOf(TextOption) then

self.textOption->collect(o) -> includes(o.oclAsType(TextOption))else if o.oclIsTypeOf(DateOption) then

self.dateOption->collect(o) -> includes(o.oclAsType(DateOption))else

self.optionValue.optionWithPredefinedContent -> includes(o)endif endif

)

n Effect

context AddProductToShoppingCart::effect()

post addProduct:let productExists: Boolean =

let existingItem : ShoppingCartItem [email protected]@pre -> any(i|i.product=self.product)

inexistingItem.isDefined() and

existingItem.optionValueInOption = self.optionValue andexistingItem.textOptionRating -> collect(r| Tupleo=r.textOption,text=r.value) = self.textOption andexistingItem.dateOptionRating -> collect(r| Tupleo=r.textOption,date=r.value) = self.dateOption

inif productExists then

let i = self.shoppingCart.shoppingCartItem -> any( i | i.product = self.product ) in i.quantity = [email protected]

279

Page 281: Magento Conceptual Schema

quantity + self.quantityelse

i.oclIsNew() and i.oclIsTypeOf(ShoppingCartItem) andi.shoppingCart = self.shoppingCart and i.product = self.product andi.quantity = self.quantity and i.applyDiscount = true andself.textOption -> forAll(tupleOpt|

r.oclIsNew() and r.oclIsTypeOf(TextOptionRating) andr.textOption = tupleOpt.o and r.value = tupleOpt.text andr.shoppingCartItem = i

) andself.dateOption -> forAll(tupleOpt|

r.oclIsNew() and r.oclIsTypeOf(DateOptionRating) andr.dateOption = tupleOpt.o and r.value = tupleOpt.date andr.shoppingCartItem = i

) and i.optionValueInOption = self.optionValueendif

post decreaseQuantity:

StockConfiguration.allInstances->any(true).decreaseStockWhenOrderIsPlacedimplies (self.product.quantity = [email protected]@pre - self.quantity)

Event

4.8.9 ChangeCurrencyOfAdministrationShoppingCartFrom use case: Add an order

n Event SpecificationRelationshipsnewCurrency : Currency [1]

Generalizations

n Effect

context ChangeCurrencyOfAdministrationShoppingCart::effect()

post:

self.shoppingCart.currency = self.newCurrency

Event

4.8.10 ChangeEMailAndGroupOfAdministrationShoppingCartFrom use case: Add an order

n Event SpecificationAttributesnewEMail : EMail [0..1]

RelationshipsnewCustomerGroup : CustomerGroup [0..1]

Generalizations

280

Page 282: Magento Conceptual Schema

n Effect

context ChangeEMailAndGroupOfAdministrationShoppingCart::effect()

post:self.shoppingCart.redefinedCustomerEMail = self.newEMail and

self.shoppingCart.redefinedCustomerGroup = self.newCustomerGroup

Event

4.8.11 ApplyCouponCodeFrom use case: Place an order, Add an order

n Event SpecificationAttributesnewCouponCode : String [1]

GeneralizationsRelationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Effect

context ApplyCouponCode::effect()

post:

self.shoppingCart.couponCode = self.newCouponCode

Event

4.8.12 AddProductToShoppingCartFrom use case: Place an order

n Event SpecificationAttributesquantity : PositiveInteger [1]textOption : TupleType(o:TextOption,text:String) [*]dateOption : TupleType(o:DateOption,date:Date) [*]

RelationshipsoptionValue : OptionValueInOption [*]

GeneralizationsRelationships inherited from ExistingProductEventproduct : Product [1]

Relationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

281

Page 283: Magento Conceptual Schema

n Initial Integrity Constraints

context AddProductToShoppingCart :: productIsAvailableAtTheCurrentWebsite() : Booleanbody:

self.shoppingCart.currentStoreView.store.website.productInWebsite->any(piw|piw.product = self.product

).isAvailable

context AddProductToShoppingCart :: productIsEnabledAtTheCurrentStoreView() : Booleanbody:

self.shoppingCart.currentStoreView.productInStoreView->any(pisw|pisw.product = self.product

).status = Status::Enabled

context AddProductToShoppingCart :: productIsInStock() : Booleanbody:

self.product.stockStatus = StockStatus::InStock

context AddProductToShoppingCart :: optionsAreFromTheProduct() : Booleanbody:

self.product.option -> includesAll(self.textOption->collect(o)) andself.product.option -> includesAll(self.dateOption->collect(o)) andself.product.option->select(o|

o.oclIsTypeOf(OptionWithPredefinedContent)).oclAsType(OptionWithPredefinedContent).optionValueInOption -> includesAll(self.optionValue)

context AddProductToShoppingCart :: optionsAreRatedOnlyOnce() : Booleanbody:

self.textOption -> isUnique(o) and self.dateOption -> isUnique(o) andself.optionValue -> isUnique(optionWithPredefinedContent)

context AddProductToShoppingCart :: optionIsRatedWhenIsRequired() : Booleanbody:

self.product.option -> select(o|o.isRequired) -> forAll ( o |if o.oclIsTypeOf(TextOption) then

self.textOption->collect(o) -> includes(o.oclAsType(TextOption))else if o.oclIsTypeOf(DateOption) then

self.dateOption->collect(o) -> includes(o.oclAsType(DateOption))else

self.optionValue.optionWithPredefinedContent -> includes(o)endif endif

)

n Effect

context AddProductToShoppingCart::effect()

post addProduct:let productExists: Boolean =

let existingItem : ShoppingCartItem [email protected]@pre -> any(i|i.product=self.product)

inexistingItem.isDefined() and

existingItem.optionValueInOption = self.optionValue andexistingItem.textOptionRating -> collect(r| Tupleo=r.textOption,text=r.value) = self.textOption andexistingItem.dateOptionRating -> collect(r| Tupleo=r.textOption,date=r.value) = self.dateOption

inif productExists then

let i = self.shoppingCart.shoppingCartItem -> any( i | i.product = self.product ) in i.quantity = [email protected] + self.quantity

elsei.oclIsNew() and i.oclIsTypeOf(ShoppingCartItem) and

i.shoppingCart = self.shoppingCart and i.product = self.product andi.quantity = self.quantity and i.applyDiscount = true andself.textOption -> forAll(tupleOpt|

r.oclIsNew() and r.oclIsTypeOf(TextOptionRating) andr.textOption = tupleOpt.o and r.value = tupleOpt.text andr.shoppingCartItem = i

) and

282

Page 284: Magento Conceptual Schema

self.dateOption -> forAll(tupleOpt|r.oclIsNew() and r.oclIsTypeOf(DateOptionRating) and

r.dateOption = tupleOpt.o and r.value = tupleOpt.date andr.shoppingCartItem = i

) and i.optionValueInOption = self.optionValueendif

post decreaseQuantity:

StockConfiguration.allInstances->any(true).decreaseStockWhenOrderIsPlacedimplies (self.product.quantity = [email protected]@pre - self.quantity)

Event

4.8.13 AddGiftMessageFrom use case: Place an order, Add an order

n Event SpecificationAttributesnewGiftMessage : String [1]

GeneralizationsRelationships inherited from ExistingShoppingCartEventshoppingCart : ShoppingCart [1]

n Effect

context AddGiftMessage::effect()

post:

self.shoppingCart.giftMessage = newGiftMessage

Event

4.8.14 AddGiftMessageToItemFrom use case: Place an order, Add an order

n Event SpecificationAttributesnewGiftMessage : String [1]

RelationshipsshoppingCartItem : ShoppingCartItem [1]

n Effect

context AddGiftMessageToItem::effect()

post:

283

Page 285: Magento Conceptual Schema

self.shoppingCartItem.giftMessage = newGiftMessage

Event

4.8.15 OrderConfirmationFrom use case: Place an order, Add an order

n Event SpecificationAttributescomments : TupleType (text: String, notifyCustomer:Boolean) [*]creditCardInfo : TupleType (type: String, owner: String, number: String, expires: Date, verification:

String) [0..1]eMailSent : Boolean [1]

RelationshipsshoppingCart : ShoppingCart [1]delivery : Address [1]billing : Address [1]shippingMethod : ShippingMethod [1]paymentMethod : PaymentMethod [1]

n Initial Integrity Constraints

context OrderConfirmation :: guestCheckoutIsEnabledIfNeeded() : Booleanbody:

(self.shoppingCart.shoppingCartItem.product -> exists (p|p.oclIsTypeOf(DownloadableProduct)) and self.-shoppingCart.currentStoreView.store.website.catalogConfigurationInWebsite.allowGuestCheckoutForDownloadableIt-ems)implies(not self.shoppingCart.oclIsTypeOf(AnonymousShoppingCart))

context OrderConfirmation :: shippingMethodIsEnabledAtTheCurrentWebsite() : Booleanbody:

let sh:ShippingMethodInWebsite =self.shoppingCart.currentStoreview.store.website.

shippingMethodInWebsite->any(sw|sw.shippingMethod = self.shippingMethod)in

sh.status = Status::Enabled

context OrderConfirmation :: allowsFreeShippingOnlyForAMinimumAmount() : Booleanbody:

let sh:ShippingMethodInWebsite =self.shoppingCart.currentStoreview.store.website.

shippingMethodInWebsite->any(sw|sw.shippingMethod = self.shippingMethod)in

sh.oclIsTypeOf(FreeShippingInWebsite) impliesself.shoppingCart.total >= sh.oclAsType(FreeShippingInWebsite).minimumOrderAmount

context OrderConfirmation :: paymentMethodIsEnabledAtTheCurrentWebsite() : Booleanbody:

let selectedMethodConfiguration : PaymentMethodInWebsite =self.shoppingCart.currentStoreView.store.website.paymentMethodInWebsite->any(sw|sw.paymentMethod

= self.paymentMethod)in

selectedMethodConfiguration.status = Status::Enabled andselectedMethodConfiguration.minimumAllowed <= self.shoppingCart.total andselectedMethodConfiguration.maximumAllowed >= self.shoppingCart .total

context OrderConfirmation :: creditCardDetailsAreThereIfNeeded() : Boolean

284

Page 286: Magento Conceptual Schema

body:

self.paymentMethod.oclIsKindOf(CreditCardMethod) implies self.creditCardInfo.isDefined()

n Effect

context OrderConfirmation::effect()

post theOrderIsCreated:let taxConf : TaxConfigurationInWebsite = [email protected]

figurationInWebsite inlet wbCurrency : Currency = self.shoppingCart@pre.currentStoreView.store.website.currencyConfigurationInWeb-site.baseCurrency inlet purchCurrency : Currency = [email protected] ino.oclIsNew() and o.oclIsTypeOf(Order) ando.couponCode = [email protected] ando.eMailSent = self.eMailSent ando.giftMessage = [email protected] ando.storeView = [email protected] ando.customerGroup = [email protected] ando.billing = self.billing ando.delivery = self.delivery ando.shippingMethod = self.shippingMethod ando.paymentMethod = self.paymentMethod ando.status = OrderStatus::Pending andself.shoppingCart.oclIsTypeOf(CustomerShoppingCart) implies

o.customer = [email protected](CustomerShoppingCart).customer@preand self.shoppingCart.oclIsTypeOf(AdministrationShoppingCart) implies

o.customer = [email protected](AdministrationShoppingCart).customer@preand o.rateApplicationAddress =

if taxConf.usedAddress = TaxCalculatingAddress::Billing then o.billingelse if taxConf.usedAddress = TaxCalculatingAddress::Delivery then o.deliveryelse taxConf.website.shippingConfigurationInWebsite.shippingOrigin endif endif

and o.genericBaseCurrency = CurrencyConfiguration.allInstances()->any(true).genericBaseCurrencyand

wbCurrency <> o.genericBaseCurrency implies(u.oclIsNew and u.oclIsTypeOf(UseOfWebsiteRedefinedBaseCurrency) andu.orderOfRedefinedBaseCurrency = o and u.websiteRedefinedBaseCurrency = wbCurrency andu.initialRate = CurrencyRate.allInstances->any(r|

r.baseCurrency=o.genericBaseCurrency and r.currency=wbCurrency).rate)

and(purchCurrency <> o.genericBaseCurrency and purchCurrency <> o.websiteRedefinedBaseCurrency)

implies(u.oclIsNew and u.oclIsTypeOf(UseOfPurchasingCurrency) andu.orderOfPurchasingCurrency = o and u.purchasingCurrency = purchCurrency andu.initialRate = CurrencyRate.allInstances->any(r|

r.baseCurrency=o.genericBaseCurrency and r.currency=purchCurrency).rate)

andself.comments.forAll ( tupleCom |

c.oclIsNew() and c.oclIsTypeOf(Comment) andc.text = tupleCom.text and c.notifyCustomer = tupleCom.notifyCustomer andc.createdAt = Now() and c.status = CommentStatus::Pending ando.comment -> includes(c)

) [email protected]@pre -> forAll ( i |

ol.oclIsNew() and ol.oclIsTypeOf(OrderLine) andol.order = o andol.productSku = i.product.sku andol.productName = i.product.productInStoreView -> any(pw|pw.storeView = o.storeView).name andol.quantity = i.quantity and ol.giftMessage = i.giftMessage andol.price = i.price andif i.applyDiscount then

let discountBasis: Money =if self.shoppingCart.currentStoreView.store.website.taxConfigurationInWebsite.methodRespectingDis-

count = TaxRespectingDiscountsMethod::TaxAfterDiscount andself.shoppingCart.currentStoreView.store.website.taxConfigurationInWebsite.applyDiscountIncludingTax then

ol.price * ol.quantity + ol.tax

285

Page 287: Magento Conceptual Schema

elseol.price * ol.quantity

endifin ol.discount = i.calculateDiscount( discountBasis, i.appliedShoppingCartPriceRule )

else ol.discount = 0.0endif andlet appliedTaxRate : Bag(TaxRate) =

TaxRule.allInstances() -> select ( t |

TaxRule.allInstances() -> forAll ( t2 | t2.priority <= t.priority )) ->select ( t |

t.customerTaxClass -> includes(o.customerGroup.customerTaxClass) and t.productTaxClass -> in-cludes(i.product) )

-> collect ( t | t.taxRate ) -> select ( tr |

tr.applicableAddress -> includes(o.rateApplicationAddress)) -> union ( i.product.fixedTaxRate )

inol.tax = (appliedTaxRate -> collect ( a | a.rate * i.price * i.quantity / 100 ) -> sum())

and ol.total = (i.total + ol.tax) andol.textOptions = TextOptionInfo.allInstances() -> select (inf|

i.textOption.genericName -> includes(inf.optionName) andi.textOptionRating.value -> includes(inf.value)

) andol.dateOptions = DateOptionInfo.allInstances() -> select (inf|

i.dateOption.genericName -> includes(inf.optionName) andi.dateOptionRating.value -> includes(inf.value)

) andol.predefinedContentOptions = PredefinedContentOptionInfo.allInstances() -> select (inf|

i.optionValueInOption.optionWithPredefinedContent.genericName -> includes(inf.optionName) andi.optionValueInOption.optionValue.genericName -> includes(inf.valueName)

))

post theShoppingCartItemsAreRemoved:

self.shoppingCart.shoppingCartItem -> isEmpty()

post theShoppingCartIsRemovedIfItIsAdministration:

[email protected](AdministrationShoppingCart) implies (not [email protected](OclAny))

post updateProductQuantities:StockConfiguration.decreaseStockWhenOrderIsPlaced implies [email protected]@pre

-> forAll ( i |i.product.quantity = i.product.quantity@pre - i.quantity

)

Event

4.8.16 DeleteAdministrationShoppingCartFrom use case: Add an Order

n Event SpecificationRelationshipsadministrationShoppingCart : AdministrationShoppingCart [1]

n Effect

context DeleteAdministrationShoppingCart::effect()

post:

286

Page 288: Magento Conceptual Schema

not [email protected](OclAny)

Event

4.8.17 CancelOrderFrom use case: Cancel an order

n Event SpecificationGeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context CancelOrder :: orderIsPendingOrProcessing() : Booleanbody:

self.order.status = OrderStatus::Pending orself.order.status = OrderStatus::Processing

n Effect

context CancelOrder::effect()

post:

self.order.status = OrderStatus::Cancelled

Event

4.8.18 HoldOrderFrom use case: Hold an order

n Event SpecificationGeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context HoldOrder :: orderWasPendingOrProcessing() : Booleanbody:

self.order.status = OrderStatus::Pending orself.order.status = OrderStatus::Processing

n Effect

287

Page 289: Magento Conceptual Schema

context HoldOrder::effect()

post:

self.order.status = OrderStatus::Hold

Event

4.8.19 UnholdOrderFrom use case: Unhold an order

n Event SpecificationGeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context UnholdOrder :: orderWasHold() : Booleanbody:

self.order.status = OrderStatus::Hold

n Effect

context UnholdOrder::effect()

post:if self.order.invoice -> isEmpty() and self.order.shipment -> isEmpty() then

self.order.status = OrderStatus::Pendingelse

self.order.status = OrderStatus::Processingendif

Event

4.8.20 ReorderFrom use case: Reorder

n Event SpecificationRelationshipsorder : Order [1]

n Initial Integrity Constraints

context Reorder :: orderIsPlacedByARegisteredCustomer() : Booleanbody:

288

Page 290: Magento Conceptual Schema

self.order.customer.isDefined()

n Effect

context Reorder::effect()

post:let sc:CustomerShoppingCart=self.order.customer.customerShoppingCart in

self.order.orderLine -> forAll ( ol |if [email protected] -> excludes(ol.product) then

i.oclIsNew() and i.oclIsTypeOf(ShoppingCartItem) andi.shoppingCart = sc and i.product = ol.product andi.quantity = ol.quantity

elselet i = sc.shoppingCartItem -> any( i | i.product = ol.product ) in i.quantity = [email protected] + ol.-

quantityendif

)

Event

4.8.21 AddInvoiceFrom use case: Add an invoice

n Event SpecificationAttributesline : TupleType ( product:Product, quantity:PositiveInteger ) [1..*]eMailSent : Boolean [1]capturingMethod : InvoiceCapturingMethod [1]

GeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context AddInvoice :: orderAllowsMoreInvoices() : Booleanbody:

self.order.status = OrderStatus::Pending or self.order.status = OrderStatus::Processing

context AddInvoice :: productsAreFromTheOrder() : Booleanbody:

self.line -> collect(product) -> forAll ( p | self.order.orderLine.productSku -> includes(p.sku) )

context AddInvoice :: quantitiesAreNotOverAllowedValues() : Booleanbody:

self.line -> forAll ( li | li.quantity = self.order.orderLine->any(info|info.productSku=li.product.sku).quantity )

289

Page 291: Magento Conceptual Schema

n Effect

context AddInvoice::effect()

post createInvoice:i.oclIsNew and i.oclIsTypeOf(Invoice) and

i.order = self.order andi.eMailSent = self.eMailSent andi.createdAt = Now() andi.capturingMethod = self.capturingMethod andi.isPaidOnline = (

self.order.paymentMethod.oclIsTypeOf(AuthorizeNet) orself.order.paymentMethod.oclIsTypeOf(PayFlowPro) orself.order.paymentMethod.oclIsKindOf(PayPalMethod) orself.order.paymentMethod.oclIsTypeOf(GoogleCheckout)

) andi.status =

if self.capturingMethod = InvoiceCapturingMethod::PayLater and i.IsPaidOnline thenInvoiceStatus::Pending

elseInvoiceStatus::Paid

endifand self.line -> forAll ( line |

il.oclIsNew() and il.oclIsTypeOf(InvoiceLine) andil.invoice = i and il.product = line.product andil.quantity = line.quantity

)

post changeOrderStatus:if

(self.order.nonReInvoiceableTotal < self.order.total orself.order.shipment.shipmentLine.quantity -> sum() < self.order.orderLine.quantity -> sum())

thenself.order.status = OrderStatus::Processing

elseself.order.status = OrderStatus::Complete

endif

Event

4.8.22 PayInvoiceFrom use case: Register an invoice payment

n Event SpecificationRelationshipsinvoice : Invoice [1]

n Initial Integrity Constraints

context PayInvoice :: invoiceWasPending() : Booleanbody:

self.invoice.status = Status::Pending

n Effect

context PayInvoice::effect()

post:

self.invoice.status = Status::Paid

290

Page 292: Magento Conceptual Schema

Event

4.8.23 CancelInvoiceFrom use case: Cancel an invoice

n Event SpecificationRelationshipsinvoice : Invoice [1]

n Initial Integrity Constraints

context CancelInvoice :: invoiceWasNotCancelled() : Booleanbody:

self.invoice.status <> Status::Cancelled

n Effect

context CancelInvoice::effect()

post:

self.invoice.status = Status::Cancelled

Event

4.8.24 AddShipmentFrom use case: Add a shipment, Add an invoice

n Event SpecificationAttributesline : TupleType ( product:Product, quantity:PositiveInteger ) [1..*]eMailSent : Boolean [1]trackingNumber : TrackingNumber [*]

GeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context AddShipment :: orderAllowsMoreShipments() : Booleanbody:

self.order.status = OrderStatus::Pending or self.order.status = OrderStatus::Processing

context AddShipment :: productsAreFromTheOrder() : Booleanbody:

291

Page 293: Magento Conceptual Schema

self.line -> collect(product) -> forAll ( p | self.order.orderLine.productSku -> includes(p.sku) )

context AddShipment :: quantitiesAreNotOverAllowedValues() : Booleanbody:

self.line -> forAll ( li | li.quantity = self.order.orderLine->any(info|info.productSku=li.product.sku).quantity )

n Effect

context AddShipment::effect()

post createShipment:s.oclIsNew and s.oclIsTypeOf(Shipment) and

s.order = self.order ands.eMailSent = self.eMailSent ands.createdAt = Now() ands.trackingNumber = self.trackingNumber andand self.line -> forAll ( line |

sl.oclIsNew() and sl.oclIsTypeOf(ShipmentLine) andsl.shipment = s and sl.orderLine.productSku = line.product.sku andsl.quantity = line.quantity

)

post changeOrderStatus:if

(self.order.nonReInvoiceableTotal < self.order.total orself.order.shipment.shipmentLine.quantity -> sum() < self.order.orderLine.quantity -> sum())

thenself.order.status = OrderStatus::Processing

elseself.order.status = OrderStatus::Complete

endif

Event

4.8.25 AddRefundFrom use case: Add a refund

n Event SpecificationAttributesline : TupleType ( product:Product, quantity:PositiveInteger ) [1..*]eMailSent : Boolean [1]shippingAmount : Money [1]additionalAmount : Money [1]fee : Money [1]refundIsAlreadyReturned : Boolean [1]

GeneralizationsRelationships inherited from ExistingOrderEventorder : Order [1]

n Initial Integrity Constraints

context AddRefund :: orderAllowsMoreRefunds() : Booleanbody:

self.order.status = OrderStatus::Processing or self.order.status = OrderStatus::Complete

292

Page 294: Magento Conceptual Schema

context AddRefund :: productsAreFromTheOrder() : Booleanbody:

self.line -> collect(product) -> forAll ( p | self.order.orderLine.productSku -> includes(p.sku) )

context AddRefund :: quantitiesAreNotOverAllowedValues() : Booleanbody:

self.line -> forAll ( li | li.quantity = self.order.invoice->select(i|i.status=Status::Paid).invoiceLine->select(info|info.orderLine.productSku=li.product.sku).quantity->sum())

n Effect

context AddRefund::effect()

post createRefund:r.oclIsNew and r.oclIsTypeOf(Refund) and

r.order = self.order andr.eMailSent = self.eMailSent andr.createdAt = Now() andr.shippingAmount = self.shippingAmount andr.additionalAmount = self.additionalAmount andr.fee = self.fee andr.status =

if self.refundIsAlreadyReturned then RefundStatus::Refundedelse RefundStatus::Pendingendif

and self.line -> forAll ( line |rl.oclIsNew() and rl.oclIsTypeOf(RefundLine) and

rl.refund = r and rl.product = line.product andrl.quantity = line.quantity

)

post changeOrderStatus:

self.order.totalRefunded = self.order.total implies self.order.status = OrderStatus::Closed

Event

4.8.26 CancelRefundFrom use case: Cancel a refund

n Event SpecificationRelationshipsrefund : Refund [1]

n Initial Integrity Constraints

context CancelRefund :: refundWasNotCancelled() : Booleanbody:

self.refund.status <> Status::Cancelled

n Effect

context CancelRefund::effect()

293

Page 295: Magento Conceptual Schema

post:

self.refund.status = Status::Cancelled

Event

4.8.27 AddCommentFrom use case: Add a comment to an order, invoice, shipment or refund.

n Event SpecificationAttributestext : String [1]notifyCustomer : Boolean [1]

Relationshipscommentable : Commentable [1]

n Effect

context AddComment::effect()

post:co.oclIsNew() and co.oclIsTypeOf(Comment and

co.text = self.text andco.notifyCustomer = self.notifyCustomer andco.createdAt = now() andco.status = CommentStatus::Pending

294