Adding Store Id to database - how to?

I would like to add a store id to the database. I have the script example and was hoping it would be clear where I could imput the store name in the script but it is all Greek to me. :) if anyone knows how to script for DS would they be kind enough to look at the script and tell me where I should input the store name I wanted to use. I assume after I have the script it will just be a matter of using the Script IDE to add it. The script for adding a store id is at http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/metadata/add_store_id/start  You would have my undying gratitude if you could help me out with this! Thanks.

Comments

  • Richard HaseltineRichard Haseltine Posts: 102,805

    As far as I know you just edit the last line with name, URL, and token - I think the latter is a number.

  • Richard HaseltineRichard Haseltine Posts: 102,805

    OK, Rob sent me a note which I still didn't entirely follow but taking the linked sample and canibalising viciously:

    (function( ){  	/*********************************************************************/	// Get the asset manager	var oAssetMgr = App.getAssetMgr();	// If the asset manager is not found	if( !oAssetMgr ){		// We're done...		return;	} 	// 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 ){		// Convert for case-insensitive comparisons		print ( "Store ID %1 has URI %2 and token %3.".arg( aStoreIDs[ i ] ).arg( oAssetMgr.getStoreUrl( aStoreIDs[ i ] ) ).arg( oAssetMgr.getStoreToken( aStoreIDs[ i ] ) ) );	}  // Finalize the function and invoke} )(  );

    gives

    Store ID DAZ 3D has URI http://www.daz3d.com/i/shop/itemdetails/?item=@ and token @.
    Store ID LOCAL USER has URI and token .

    so what it needs is a palin URL for the store including a placeholder token for the product SKU, then the token value says what that is - so for the only real store, the @ in the URL shows where the SKU goes and the @ is declared as the token - now when the AssetManager needs to generate the URL for a specific product it subtitutes the SKU for that token in the generic URL. So, assuming I have that right, does the store you are trying to add have a regular pattern to its URLs that you could set up to sustitute in a similar manner?

  • OK, Rob sent me a note which I still didn't entirely follow but taking the linked sample and canibalising viciously:

    (function( ){  	/*********************************************************************/	// Get the asset manager	var oAssetMgr = App.getAssetMgr();	// If the asset manager is not found	if( !oAssetMgr ){		// We're done...		return;	} 	// 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 ){		// Convert for case-insensitive comparisons		print ( "Store ID %1 has URI %2 and token %3.".arg( aStoreIDs[ i ] ).arg( oAssetMgr.getStoreUrl( aStoreIDs[ i ] ) ).arg( oAssetMgr.getStoreToken( aStoreIDs[ i ] ) ) );	}  // Finalize the function and invoke} )(  );

    gives

    Store ID DAZ 3D has URI http://www.daz3d.com/i/shop/itemdetails/?item=@ and token @.
    Store ID LOCAL USER has URI and token .

    so what it needs is a palin URL for the store including a placeholder token for the product SKU, then the token value says what that is - so for the only real store, the @ in the URL shows where the SKU goes and the @ is declared as the token - now when the AssetManager needs to generate the URL for a specific product it subtitutes the SKU for that token in the generic URL. So, assuming I have that right, does the store you are trying to add have a regular pattern to its URLs that you could set up to sustitute in a similar manner?

    Thanks Richard for the reply. Like many other non-DAZ vendors I've just been using the token field for product identification (eg store name, vendor and a number) in the DB and it was working quite well. I would just leave the store set to none. With the recent update of DS they changed the dropdown options and it is now DAZ and Local User only. I'm not sure how the Local User option gets listed in the DB but can see this being a problem if everything not DAZ is listed as Local User #####. So I'm trying to see if I can add a store as a choice to the dropdown box. I can continue to use the token box as I have been doing - but without the store name as I'm assuming if it is in the dropdown menu it will be appended to the product.

  • Richard HaseltineRichard Haseltine Posts: 102,805
    edited July 2017

    As far as I know everything must belong to a store - Local User is a catch-all.

    Rob did send a follow-up note and I think the token (the bit that gets added to the base URL) can be anything (within reason, it must make a valid URL) - not just an SKU. I don't know if you could, for your own "products", use it to point to a readme via a file:// link.

    Post edited by Richard Haseltine on
  • As far as I know everything must belong to a store - Local User is a catch-all.

    Rob did send a follow-up note and I think the token (the bit that gets added to the base URL) can be anything (within reason, it must make a valid URL) - not just an SKU. I don't know if you could, for your own "products", use it to point to a readme via a file:// link.

    Thanks Richard. This is getting too complicated for me. :( I just noticed even though I have a previous version of DS with the old option of DAZ or blank in the dropdown box, it must append Local User as I noticed some product links are using Local User anyway. However my concern was that it was listed that way in the DB and it isn't, ie Local User - ####.  Instead it is using the name I input in the Token field.so I may just continue on that way. 

  • Richard HaseltineRichard Haseltine Posts: 102,805

    If you look at

    /resources/stores/

    in the DS Application folder you will see the default script for the More Infomation action, if you copy it and name it to match the store (as in the CMS) then you can set up custom behaviours - such as openign a readme as I suggested above.

  • If you look at

    /resources/stores/

    in the DS Application folder you will see the default script for the More Infomation action, if you copy it and name it to match the store (as in the CMS) then you can set up custom behaviours - such as openign a readme as I suggested above.

    Thanks Richard. Will have a look at that!

  • fixmypcmikefixmypcmike Posts: 19,613

    As far as I know everything must belong to a store - Local User is a catch-all.

    Rob did send a follow-up note and I think the token (the bit that gets added to the base URL) can be anything (within reason, it must make a valid URL) - not just an SKU. I don't know if you could, for your own "products", use it to point to a readme via a file:// link.

    Thanks Richard. This is getting too complicated for me. :( I just noticed even though I have a previous version of DS with the old option of DAZ or blank in the dropdown box, it must append Local User as I noticed some product links are using Local User anyway. However my concern was that it was listed that way in the DB and it isn't, ie Local User - ####.  Instead it is using the name I input in the Token field.so I may just continue on that way. 

    The blank entry in the dropbox is the Local User "store" -- in version 4.9.4.31 or later it explictly labels it as such, in older versions it is blank, but it still refers to the Local User "store".

Sign In or Register to comment.