THR-135
When clicked on the ENQUIRE WITH US button on the category page, it navigates to the page for which the URL is provided in the configuration record in the NetSuite.
Created the custom field in the configuration record to add the URL for “ENQUIRE WITH US” button by editing the configuration file in the extension. Obtained the value of the Custom field in the view file from the configuration record by using “SC.Configuration” as dependency. The result obtained in the template file of extension from the view files through the getcontext
Configuration file:
{
"type": "object"
, "subtab": {
"id": "Custom"
, "title": "Custom"
, "docRef": ""
, "description": "Custom tab for adding url in configuration"
, "group": "extensions"
}
, "properties": {
"THREnquiry.config": {
"group": "extensions"
, "subtab": "Custom"
, "type": "string"
, "title": "URL For ENQUIRE WITH US"
, "description": "Enter the URL please"
}
}
}
View file
// @module JJ.THREnquiry.THREnquiry
define('JJ.THREnquiry.THREnquiry.View'
, [
'jj_threnquiry_threnquiry.tpl'
, 'JJ.THREnquiry.THREnquiry.SS2Model'
, 'Backbone', 'SC.Configuration'
]
, function (
jj_threnquiry_threnquiry_tpl
, THREnquirySS2Model
, Backbone
, Configuration
)
{
'use strict';
// @class JJ.THREnquiry.THREnquiry.View @extends Backbone.View
return Backbone.View.extend({
template: jj_threnquiry_threnquiry_tpl
, initialize: function (options) {
/* Uncomment to test backend communication with an example service
(you'll need to deploy and activate the extension first)
*/
// this.model = new THREnquiryModel();
// var self = this;
// this.model.fetch().done(function(result) {
// self.message = result.message;
// self.render();
// });
console.log("Configuration",Configuration);
console.log("Configuration",Configuration.THREnquiry.config);
this.url = Configuration.THREnquiry.config;
}
, events: {
}
, bindings: {
}
, childViews: {
}
//@method getContext @return JJ.THREnquiry.THREnquiry.View.Context
, getContext: function getContext()
{
console.log("xxxx", this.url);
//@class JJ.THREnquiry.THREnquiry.View.Context
return {
url: this.url
};
}
});
});
Template file
<section class="threnquiry-info-card">
<center>
<div class="enquiry-label-modal">
<br>
<a href="{{url}}" class="enquiry-label-modal-button">
ENQUIRE WITH US</a>
</div>
</center>
</section>