steveosoule
11/2/2015 - 9:02 PM

Miva - Get Item that was just Added to Cart

Miva - Get Item that was just Added to Cart

<mvt:if expr="g.Action EQ 'ADPR'">
	<mvt:foreach iterator="item" array="basket:groups">
		<mvt:assign name="l.settings:item:was_just_added" value="1" />
		<mvt:if expr="l.settings:item:code NE g.Product_Code">
			<mvt:assign name="l.settings:item:was_just_added" value="0" />
			<mvt:foreachcontinue/>
		</mvt:if>
		<mvt:if expr="miva_array_elements(g.Product_Attributes)">
			<mvt:assign name="l.settings:item:option_counter" value="0" />
			<mvt:foreach iterator="option" array="item:options">
				<mvt:assign name="l.settings:item:option_counter" value="l.settings:item:option_counter + 1" />
				<mvt:if expr="l.settings:option:attr_code NE g.Product_Attributes[l.settings:item:option_counter]:code">
					<mvt:assign name="l.settings:item:was_just_added" value="0" />
					<mvt:foreachcontinue/>
				</mvt:if>
				<mvt:if expr="l.settings:option:option_id">
					<mvt:if expr="l.settings:option:opt_code NE g.Product_Attributes[l.settings:item:option_counter]:value">
						<mvt:assign name="l.settings:item:was_just_added" value="0" />
						<mvt:foreachcontinue/>
					</mvt:if>
				<mvt:elseif expr="NOT ISNULL l.settings:option:data">
					<mvt:if expr="l.settings:option:data NE g.Product_Attributes[l.settings:item:option_counter]:value">
						<mvt:assign name="l.settings:item:was_just_added" value="0" />
						<mvt:foreachcontinue/>
					</mvt:if>
				<mvt:elseif expr="NOT ISNULL l.settings:option:data_long">
					<mvt:if expr="l.settings:option:data_long NE g.Product_Attributes[l.settings:item:option_counter]:value">
						<mvt:assign name="l.settings:item:was_just_added" value="0" />
						<mvt:foreachcontinue/>
					</mvt:if>
				</mvt:if>
			</mvt:foreach>
		</mvt:if>
		<mvt:if expr="l.settings:item:was_just_added">
			<mvt:assign name="l.settings:basket:just_added" value="l.settings:item" />
		</mvt:if>
	</mvt:foreach>
	<h3>Just Added:</h3>
	<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:basket:just_added), ',', '<br>'))" />
</mvt:if>