Miva Merchant Modules and Development
Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.

MIVASCRIPT: Get any meta data from store items

Scot Ranney • December 19, 2023


<MvCOMMENT>
|
|  get_meta is a great function to grab meta from anything in the store. 
|  		type: page, category, product 
|		typedata: full structure of page, cat, or prod 
|
</MvCOMMENT>

<MvFUNCTION NAME = "get_meta" PARAMETERS = "type,typedata" STANDARDOUTPUTLEVEL="">
	<MvIF EXPR = "{ l.type EQ 'page' }">
	  	<MvASSIGN NAME = "l.ok" VALUE = "{ [ g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc' ].METANameAndValueList_Load_Page_All(l.typedata:id,l.metavalues)  }" />	
	</MvIF>
	<MvIF EXPR = "{ l.type EQ 'category' }">
	  	<MvASSIGN NAME = "l.ok" VALUE = "{ [ g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc' ].METANameAndValueList_Load_Category_All(l.typedata:id,l.metavalues)  }" />
	</MvIF>	
	<MvIF EXPR = "{ l.type EQ 'product' }">
	  	<MvASSIGN NAME = "l.ok" VALUE = "{ [ g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc' ].METANameAndValueList_Load_Product_All(l.typedata:id,l.metavalues)  }" />	
	</MvIF>		
  	<MvFOREACH ITERATOR = "l.metavalue" INDEX = "l.pos" ARRAY = "l.metavalues">
 	  	<MvASSIGN NAME = "l.ok" VALUE = "{ [ g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc' ].METAName_Load_Name(l.metavalue:name,l.metaname)  }" />
		<MvASSIGN NAME = "l.metaname:value" VALUE = "{ l.metavalue:value }" />
		<MvASSIGN NAME = "l.metanames" INDEX="{ l.pos }" VALUE = "{ l.metaname }" />
 	</MvFOREACH>	
	 <MvFUNCRETURN VALUE = "{ l.metanames }">	 	
</MvFUNCTION>

https://www.scotsscripts.com/mvblog/mivascript-get-any-meta-data-from-store-items.html

mvkb_mivascript mvkb_schema