User Tools

Site Tools


Store Info

Summary

Below is an example demonstrating how you can retrieve information about a Store from the database, via script.

API Areas of Interest

Example

DB_Store_Info.dsa
// Define an anonymous function;
// serves as our main loop,
// limits the scope of variables
(function(){
 
	// Get the asset manager
	var oAssetMgr = App.getAssetMgr();
	// If the asset manager is not found
	if( !oAssetMgr ){
		// We are done...
		return;
	}
 
	// Declare working variables
	var sStoreID, sStoreUrl, sStoreToken;
 
	// Get the list of known store identifiers
	var aStoreIDs = oAssetMgr.getStoresIDs();
 
	// Iterate over the store IDs
	for( var i = 0, numStores = aStoreIDs.length; i < numStores; i += 1 ){
		// Get the 'current' store ID
		sStoreID = aStoreIDs[ i ];
 
		// Get the URL for the store
		sStoreUrl = oAssetMgr.getStoreUrl( sStoreID );
		// Get the token that is replaced within the URL,
		// with the ID of a product associated with the store
		sStoreToken = oAssetMgr.getStoreToken( sStoreID );
 
		// Report the information
		print( i + ",", sStoreID + ",", sStoreUrl + ",", sStoreToken );
	}
 
// Finalize the function and invoke
})();