xml Miva - 货件领料报告|总产品收入报告|汇总产品信息

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Miva - 货件领料报告|总产品收入报告|汇总产品信息相关的知识,希望对你有一定的参考价值。

<mvt:comment>author: bedpauw</mvt:comment>

<mvt:foreach iterator="order" array="admin_order:orders">
	<mvt:foreach iterator="item" array="order:groups">
		<mvt:comment>Create array of all products</mvt:comment>
		<mvt:assign name="l.index" value="miva_array_insert_var( l.settings:all_products, l.settings:item, -1 )" />
	</mvt:foreach>
</mvt:foreach>
<mvt:comment>Duplicate array for comparison purposes</mvt:comment>
<mvt:assign name="l.settings:holderArray" value="l.settings:all_products"/>
<mvt:comment>Start index at position two as to not compare to itself in search</mvt:comment>
<mvt:assign name="l.currentIndex" value="2"/>
<mvt:foreach iterator="holderProduct" array="holderArray">
	<mvt:comment>Find the first instance after itself where the product ID is the same as current index of holderArray</mvt:comment>
	<mvt:assign name="l.removeIndex" value="miva_array_search( l.settings:all_products, l.currentIndex, l.settings:product, 'l.settings:product:product:id EQ l.settings:holderProduct:product:id' )"/>
	<mvt:comment>Run a while loop so we continue to run the search for all matches of the current index of holderArray</mvt:comment>
	<mvt:while expr="l.removeIndex NE 0">
		<mvt:assign name="l.grabQuantity" value="miva_variable_value('l.settings:all_products[' $ l.removeIndex $ ']:quantity')"/>
		<mvt:assign name="l.settings:holderProduct:quantity" value="l.settings:holderProduct:quantity + l.grabQuantity"/>
		<mvt:comment>Once the match is found and the quantity extracted, remove the matched index</mvt:comment>
		<mvt:assign name="l.remove" value="miva_array_delete( l.settings:all_products, l.removeIndex, 1 )"/>
		<mvt:assign name="l.remove2" value="miva_array_delete( l.settings:holderArray, l.removeIndex, 1 )"/>
		<mvt:comment>Check if there are more matches</mvt:comment>
		<mvt:assign name="l.removeIndex" value="miva_array_search( l.settings:all_products, l.currentIndex, l.settings:product, 'l.settings:product:product:id EQ l.settings:holderProduct:product:id' )"/>
		<mvt:comment>If no more matches, then increase currentIndex and move to the next new item</mvt:comment>
		<mvt:if expr="l.removeIndex EQ 0">
			<mvt:assign name="l.currentIndex" value="l.currentIndex + 1"/>
		</mvt:if>
	</mvt:while>
</mvt:foreach>
<mvt:comment>Dump array for testing</mvt:comment>
<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:holderArray), ',', '<br>'))" />

以上是关于xml Miva - 货件领料报告|总产品收入报告|汇总产品信息的主要内容,如果未能解决你的问题,请参考以下文章

xml Miva - 最近浏览过的产品

xml Miva QA:散装产品

xml Miva - 在商店中加载所有产品

xml 基于面包屑的Miva相关产品

xml Miva - 变异篮子项目替换与修复的Skipped产品

xml Miva - 使用产品主图像的CTGY子类别图像