Javascript
Enquiry
.create RC.Server.Enquiry.create
Create new customer enquiry.
METHOD PARAMETERS
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
mode |
required | string | (none) | Enquiry mode can be one of the following:
|
parameters |
required | hashmap or POST data | (none) | Subscription parameters. See parameters section below for more information. |
options |
optional | hashmap | (none) | Request options. See the options section below for details |
parameters
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
product_id |
required 1 | numeric | (none) | Product ID to add to the enquiry. |
variant_id |
optional 1 | numeric | (none) | Variant ID of the product being added to the enquiry. |
kit_id |
optional 1 | numeric | (none) | Kit ID of the product being added to the enquiry. |
customization_id |
optional 1 | numeric | (none) | Customization ID of the product being added to the enquiry. |
quantity |
optional 1 | numeric | 1 | Quantity for the product being added to the enquiry. |
contact_name |
required | string | (none) | Customer's contact name. |
contact_email |
required | string | (none) | Customer's contact email. |
company_name |
optional | numeric | (none) | Customer's company name. Normally used for quotation requests. |
company_tax_no |
optional | string | (none) | Customer's company tax number. Normally used for quotation requests. |
supplier_selector |
optional | list of IDs | (none) | Preferred supplier(s) selection, if supplier selection is allowed. |
contact_phone_mobile |
optional | numeric | (none) | Customer's mobile phone. |
contact_phone_office |
optional | numeric | (none) | Customer's office phone. |
contact_phone_home |
optional | numeric | (none) | Customer's home phone. |
contact_phone |
optional | numeric | (none) | Customer's phone. |
message |
optional | string | (none) | Free text message to be added to the enquiry. This must be specified for enuiry of type contact |
subject |
optional | string | (none) | Free text subject for the enquiry. |
billing_address_line1 |
optional 2 | string | (none) | Billing address first line. |
billing_address_line2 |
optional | string | (none) | Billing address second line. |
billing_address_line3 |
optional | string | (none) | Billing address third line. |
billing_address_city |
optional | string | (none) | Billing address city. |
billing_address_region |
optional | string | (none) | Billing address region. |
billing_address_code |
optional | string | (none) | Billing address postal code. |
billing_address_country_code |
optional | string | (none) | Billing address country code. This is an 2-character ISO 3166-1 alpha-2 code. |
shipping_address_line1 |
optional 2 | string | (none) | Billing address first line. |
shipping_address_line2 |
optional | string | (none) | Billing address second line. |
shipping_address_line3 |
optional | string | (none) | Billing address third line. |
shipping_address_city |
optional | string | (none) | Billing address city. |
shipping_address_region |
optional | string | (none) | Billing address region. |
shipping_address_code |
optional | string | (none) | Billing address postal code. |
shipping_address_country_code |
optional | string | (none) | Billing address country code. This is an 2-character ISO 3166-1 alpha-2 code. |
metafields |
optional | any | (none) | Comma-separated list of metafield names to add to the enquiry. Each metafield must be supplied as a separate request parameter. |
* |
optional | any | (none) | Metafield to be added to the enquiry. Only considered if the name of the metafield is mentioned in the metafields parameter (see above). |
- 1 Only applies to enquiries of type product.
- 2 The first line of the address must be present in the post (*_address_line1) in order for the rest of the address fields to be considered. If you do not wish to present the customer with this field, you can submit a hidden input field with blank value.
options
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
success |
optional | function | (none) | Default success handler.
The following fields are returned in the response XML data:
|
failure |
optional | function | (none) | Default failure handler. |
EXAMPLE
RC.Server.Enquiry.create( 'product', $('#create-enquiry-form').serialize(), { success: function(context,html,xml) { alert('Enquiry created successfully!'); }, failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } } );
.postMessage RC.Server.Enquiry.postMessage
Posts a new message to an existing enquiry.
METHOD PARAMETERS
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
id |
required | numeric | (none) | Enquiry ID to post the message to. |
parameters |
required | hashmap or POST data | (none) | Message post parameters. See parameters section below for more information. |
options |
optional | hashmap | (none) | Request options. See the options section below for details |
parameters
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
message |
required | string | (none) | Free text message to be added to the enquiry. |
options
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
success |
optional | function | (none) | Default success handler. |
failure |
optional | function | (none) | Default failure handler. |
EXAMPLE
RC.Server.Enquiry.post( {{ enquiry.id }}, $('#enquiry-post-form').serialize(), { success: function(context,html,xml) { alert('Message posted successfully!'); }, failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } } );
.checkout RC.Server.Enquiry.checkout
Create a new checkout from the enqyiry. This must be used when checking out quotations.
METHOD PARAMETERS
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
id |
required | numeric | (none) | Enquiry ID to checkout. |
parameters |
required | hashmap or POST data | (none) | Message post parameters. See parameters section below for more information. |
options |
optional | hashmap | (none) | Request options. See the options section below for details |
parameters
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
parentId |
optional | numeric | (none) | When checking out a grouped enquiry, specify the ID of the leading (top-level) item in the group. All selected items under the top-level item and the top-level item itself will be added to the checkout. |
options
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
post |
optional | hashmap or POST data | (none) | Additional item-related information. See post section below for more information. |
success |
optional | function | (none) | Callback handler for successful checkout initialization. The callback takes 1 parameter, the checkout unique key, used in the page URL. |
failure |
optional | function | (none) | Default failure handler. |
post
Parameter | Options | Type | Default | Description |
---|---|---|---|---|
buy-item-(id) |
optional | numeric | (none) | Item ID-specific flag indicating if the item should be included in the checkout or not. The value must be set to 1 to indicate that the item should be included, and to 0, blank value or not present, to indicate that the item should be excluded. |
EXAMPLE
RC.Server.Enquiry.checkout( {{ enquiry.id }}, {}, { post: $('#enquiry-checkout-form').serialize(), success: function(key) { location.href='/checkout/details/'+key; }, failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } } );