Whitebeam Template Reference Documentation

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Template Reference Documentation

Catalogue Template

item.modify()

Modifies an existing item.

See Also

rb.catalogue.item.get()    rb.catalogue.item.create()   

Syntax

number = rb.catalogue.item.modify(ModifiedItemInfoType)

Parameters

The 'item.modify' method takes 1 parameter:

Name Type/Value Range/Length Description
ModifiedItemInfoTypestruct item.itemInfoTypesee definition Required. Changes to or modifiers of an existing item.

Results

The 'item.modify' method returns number:

Type/Value Range/Length Description
number itemID, -1itemID of the modified item.

Remarks

Any element of the specified item can be modified including existing prices or file associations. Only the elements that need to be modified should be specified and itemID is mandatory.

An item will become self-contained if containerID is set to itemID. For a contained item, this has the effect of removing it from a group which will cause its container item to also become self-contained when there are no group members. For a container item, all its contained items will additionally become self-contained so dissolving the group (or ungrouping). It is not permissable to change a container to contained or vice versa.

Prices and or file associations can be created, modified and deleted using this method (see example below).

Example

An item can be associated with both prices and files through the prices and fileRefs attributes respectively. A single call to rb.catalogue.item.modify() can result in a complete overhaul of associations. Whilst only prices attribute is discussed here, the same applies to fileRefs.

prices = new Array; // has no effect since an empty array of associations is like an undefined attribute.
prices[0] = new Object; // deletes all existing associations since first prices element is an empty object.
prices[1] = new Object; // has no effect.
prices[2] = {priceOrder:7, basePrice:999, currency:"GBP"}; // creates new association
prices[3] = {priceOrder:7, currency:"USD"}; // modifies old association.
prices[4] = {priceOrder:7}; // deletes specified association since only an order attribute is specified.

Note that the pricesarray index is continuous and from zero. Also, prices[5] = {basePrice:200}; will fail because attributes are ambiguous for modify, create or delete of association(s).
Whitebeam release 1.3.36
(loadtime : 81ms)