tessguefen
7/31/2015 - 10:08 PM

Pre-populated Pre-selected options.

Pre-populated Pre-selected options.

<mvt:if expr="((g.Product_Attributes[l.settings:attribute:index]:value EQ 0) AND (l.settings:option:id EQ l.settings:attribute:default_id)) OR (g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code) OR l.settings:option:id EQ l.settings:attribute:curselected">

You can also do something like
[[ selects ]]
--> ... OR (g.bask_editoptions AND l.settings:option:id EQ l.settings:attribute:curselected)
[[ checkbox ]]
--> ...OR (g.bask_editoptions AND (l.settings:attribute:curselected EQ l.settings:attribute:code OR l.settings:attribute:curselected EQ l.settings:attribute:template_code))

If it's a textarea/ text input, you can use &mvt:attribute:curselected; -- if it's empty it will appear blank.
<mvt:comment>
| Check for global variable bask_editoptions (this is what I used to pass through the basket line id)
| If it's there, loop through & assign to :curselected
| Put this into your attribute template
</mvt:comment>
<mvt:if expr="g.bask_editoptions">
	<mvt:do name="l.settings:editoptions" file="g.Module_Library_DB" value=" BasketOptionList_Load_Line(g.bask_editoptions, l.settings:basketoptions) " />
</mvt:if>

<mvt:foreach iterator="attribute" array="attributes">
<!-- Add this at the top where your foreach attribute is -->
	<mvt:assign name="l.settings:attribute:curselected" value="''" />

	<mvt:if expr="l.settings:basketoptions">
		<mvt:foreach iterator="baskoption" array="basketoptions">
			<mvt:if expr="l.settings:baskoption:attr_id EQ l.settings:attribute:id AND l.settings:baskoption:attmpat_id EQ l.settings:attribute:attmpat_id">
				<mvt:if expr="l.settings:baskoption:option_id EQ 0 AND NOT ISNULL l.settings:baskoption:data">
					<mvt:assign name="l.settings:attribute:curselected" value="l.settings:baskoption:data" />
				<mvt:elseif expr="l.settings:baskoption:option_id EQ 0">
					<mvt:assign name="l.settings:attribute:curselected" value="l.settings:baskoption:attr_code" />
				<mvt:else>
					<mvt:assign name="l.settings:attribute:curselected" value="l.settings:baskoption:option_id" />
				</mvt:if>
			</mvt:if>
		</mvt:foreach>
	</mvt:if>
<!-- End Add -->