xml Miva - 变异篮子项目替换与自定义领域排除产品

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Miva - 变异篮子项目替换与自定义领域排除产品相关的知识,希望对你有一定的参考价值。

<mvt:comment>
	| ------------------------------------------------
	| Variant Basket Item Replacement (VBIR) with Exclusion
	| ------------------------------------------------
	| This custom functionality replicates the VBIR module,
	| EXCEPT it allows line items to not have their variant code replaced based on a `disable_variant_basket_item_replacement` custom-field
</mvt:comment>

<mvt:foreach iterator="item" array="basket:items">

	<mvt:comment>
		| We only need to do this process for items with a single variant part
	</mvt:comment>
	<mvt:if expr="miva_array_elements( l.settings:item:parts ) NE 1 ">
		<mvt:foreachcontinue/>
	</mvt:if>

	<mvt:comment>
		| Check if the current item woudld like to disable the VBIR functionality
	</mvt:comment>
	<mvt:item name="customfields" param="Read_Product_ID(l.settings:item:product:id, 'disable_variant_basket_item_replacement', l.settings:item:cf:disable_variant_basket_item_replacement)" />
	<mvt:if expr="l.settings:item:cf:disable_variant_basket_item_replacement">
		<mvt:foreachcontinue/>
	</mvt:if>

	<mvt:comment>
		| Update the DB with our custom variant code logic
	</mvt:comment>
	<mvt:if expr="l.settings:item:parts[1]:code NE l.settings:item:code">
		<mvt:assign name="l.settings:query:query" value="'UPDATE ' $ g.Store_Table_Prefix $ 'BasketItems SET code = ? WHERE line_id = ?'" />
		<mvt:assign name="l.settings:query:bind_parameters[1]" value="l.settings:item:parts[1]:code" />
		<mvt:assign name="l.settings:query:bind_parameters[2]" value="l.settings:item:line_id" />
		<mvt:item name="sql" param="l.settings:query"/>

		<mvt:comment>
			| Update the current page's `l.settings:basket:items[]:code` and `l.settings:basket:groups[]:code` values for the current element
		</mvt:comment>
		<mvt:assign name="l.settings:item:code" value="l.settings:item:parts[1]:code" />
		<mvt:assign name="l.result" value="miva_array_search( l.settings:basket:groups, POS1, l.group, 'l.settings:item:code EQ l.group:code' )" />
		<mvt:assign name="l.group:code" value="l.settings:item:parts[1]:code" />
	</mvt:if>


</mvt:foreach>

以上是关于xml Miva - 变异篮子项目替换与自定义领域排除产品的主要内容,如果未能解决你的问题,请参考以下文章

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

xml Miva - 添加和删除篮子费用

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

xml Miva - 自定义XML站点地图

xml Miva - 属性自定义显示顺序

xml Miva - 自定义SearchSpring Feed