steveosoule
11/11/2015 - 8:50 PM

Miva - Add Removed Product Back to Cart

Miva - Add Removed Product Back to Cart

<mvt:assign name="g.Restore_Counter" value="1" />
<mvt:assign name="g.Quantity" value="miva_variable_value('Quantity' $ g.Restore_Counter)" />
<mvt:while expr="NOT ISNULL g.Quantity">
	<mvt:assign name="g.Quantity" value="miva_variable_value('Quantity' $ g.Restore_Counter)" />
	<mvt:assign name="g.Restore_Name" value="miva_variable_value('Restore_Name' $ g.Restore_Counter)" />
	<mvt:assign name="g.Restore_Link" value="miva_variable_value('Restore_Link' $ g.Restore_Counter)" />
	<mvt:if expr="NOT ISNULL g.Quantity AND g.Quantity EQ 0">
		<div class="message message-info">
			<b>&mvte:global:Restore_Name;</b> has been removed from your cart. <a href="&mvte:global:Restore_Link;">Undo?</a>
		</div>
	</mvt:if>
	<mvt:assign name="g.Restore_Counter" value="g.Restore_Counter + 1" />
</mvt:while>
<form method="POST" action="&mvte:urls:BASK:auto;">
	<input type="hidden" name="SubScreen" value="TKQNTY">
	<input type="hidden" name="Action" value="NEW">
	...
	<mvt:foreach iterator="item" array="basket:item">
		...
		<mvt:assign name="l.settings:item:restore:link" value="g.domain:mm_url $ 'Screen=BASK&Action=ADPR&Product_Code=' $ l.settings:item:standard_code $ '&Quantity=' $ l.settings:item:quantity" />
		<mvt:foreach iterator="option" array="item:options">
			<mvt:if expr="l.settings:option:option_id">
				<mvt:assign name="l.settings:item:restore:link" value="l.settings:item:restore:link $ '&Product_Attributes[' $ g.option_counter $ ']:code=' $ l.settings:option:attr_code $ '&Product_Attributes[' $ g.option_counter $ ']:value=' $ l.settings:option:opt_code" />
				...
			<mvt:elseif expr="NOT ISNULL l.settings:option:data">
				<mvt:assign name="l.settings:item:restore:link" value="l.settings:item:restore:link $ '&Product_Attributes[' $ g.option_counter $ ']:code=' $ l.settings:option:attr_code $ '&Product_Attributes[' $ g.option_counter $ ']:value=' $ l.settings:option:data" />
				...
			<mvt:elseif expr="NOT ISNULL l.settings:option:data_long">
				<mvt:assign name="l.settings:item:restore:link" value="l.settings:item:restore:link $ '&Product_Attributes[' $ g.option_counter $ ']:code=' $ l.settings:option:attr_code $ '&Product_Attributes[' $ g.option_counter $ ']:value=' $ l.settings:option:data_long" />
				...
			<mvt:else>
				<mvt:assign name="l.settings:item:restore:link" value="l.settings:item:restore:link $ '&Product_Attributes[' $ g.option_counter $ ']:code=' $ l.settings:option:attr_code $ '&Product_Attributes[' $ g.option_counter $ ']:value=' $ l.settings:option:data" />
				...
			</mvt:if>
		</mvt:foreach>
		...
		<input type="text" name="Quantity&mvte:global:counter;" value="&mvte:item:quantity;">
		<input type="hidden" name="Basket_line&mvte:global:counter;" value="&mvte:item:line_id;" />
		<input type="hidden" name="Restore_Link&mvte:global:counter;" value="&mvte:item:restore:link;">
		<input type="hidden" name="Restore_Name&mvte:global:counter;" value="&mvte:item:name;">
		...
	</mvt:foreach>
</form>