Search Component getUrl Method for SuiteCommerce Usage

Use the Search component's getUrl method to build dynamic item search URLs in SuiteCommerce, including session parameters.

·1 min read·View Oracle Docs

The Search component includes the getUrl() method, allowing developers to retrieve the URL of the item search API for SuiteCommerce websites. When getUrl() is invoked, it returns a string representing the end fragment of the item search URL (everything after the domain name). You can enhance your search URL by appending parameters through an object where the properties correspond to the desired search criteria.

Here's how to implement getUrl() to find items containing the string 'shirt'. This method is typically called within the mountToApp() method of your extension's entrypoint module.

javascript
"text-purple-400">var search = container.getComponent('Search');
"text-purple-400">var searchParams = {q: "shirt"};
"text-purple-400">var searchURL = search.getUrl(searchParams);

With the search parameters noted above, the generated URL might look like this:

api/items?language=en&country=US&currency=USD&pricelevel=5&use_pcv=F&q=shirt

Take note that the returned URL incorporates data based on the site visitor's session and includes the appended search parameters (q=shirt). The default parameters drawn from the user's session are:

  • language
  • country
  • currency
  • pricelevel
  • use_pcv

Frequently Asked Questions (4)

How can I include additional search criteria with the getUrl method in SuiteCommerce?
You can include additional search criteria by passing an object with properties that correspond to the desired search parameters when invoking the getUrl method.
What session data is automatically included in the URL generated by getUrl?
The URL generated by getUrl automatically includes session data such as language, country, currency, pricelevel, and use_pcv based on the site visitor's session.
Where should the getUrl method be called within a SuiteCommerce extension?
The getUrl method should typically be called within the mountToApp() method of your extension's entrypoint module.
Is the getUrl method available for all SuiteCommerce implementations?
The article specifies usage for SuiteCommerce but does not clarify if there are any limitations for other implementations. More information may be required to determine complete applicability.
Source: Basic Usage Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Commerce

View all Commerce articles →