PDA

View Full Version : Multi Column Add to Cart Button


whitewolfspirits
08-31-06, 07:52 PM
"It's me again Margaret." ;) I am using a 4 column display in the category display. I actually have 2 questions, but I will post them seperately.

#1. In the category display, I have the thumbnails, price and size of these prints. When I try to add the "Add to Cart" button, it totally throws the columns off.

This is the code I am using:

<mvt:if expr="l.settings:product_count EQ 0">
<mvt:exit />
</mvt:if>
<table border=0 cellpadding=2 cellspacing=0 width=550>
<tr><td colspan="3" align="center">
<br>
</td></tr>
<tr>
<mvt:foreach iterator="product" array="products">
<td align="center" valign="top" width="25%">
<mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">
<img src="&mvte:product:thumbnail;" border=0 style="border: 3px double #9D7D60;"></a>
<mvt:else>&nbsp;
</mvt:if>
<br>
<mvt:item name="fonts" param="body_font">
<b>
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">&mvt:produc t:name;</a><br>
</b>&mvt:product:formatted_price;
</mvt:item>
&mvt:product:size;<br>
<mvt:if expr="l.settings:product:inv_active">
</mvt:if>
</td>
<mvt:if expr = "(pos1 MOD 4 ) EQ 0">
</tr><tr><td colspan=3><HR width="100%" color=#cccccc SIZE=1></td></tr>
</mvt:if>
</mvt:foreach>
</table>
<mvt:if expr="g.Offset OR g.NextOffset">
<br>
<table border=0 width="90%" align="center">
<tr>
<mvt:if expr="g.Offset EQ 0">
<td>&nbsp;</td>
<mvt:else>
<td align="left">
<mvt:item name="fonts" param="body_font">
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Screen" value="&mvte:global:Screen;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;">
<input type="hidden" name="Product_Code" value="&mvte:global:Product_Code;">
<input type="hidden" name="Search" value="&mvte:global:Search;">
<input type="hidden" name="Offset" value="&mvte:global:PrevOffset;">
<mvt:item name="buttons" param="Previous" />
</form>
</mvt:item>
</td>
</mvt:if>
<mvt:if expr="g.NextOffset EQ 0">
<td>&nbsp;</td>
<mvt:else>
<td align="right">
<mvt:item name="fonts" param="body_font">
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Screen" value="&mvte:global:Screen;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;">
<input type="hidden" name="Product_Code" value="&mvte:global:Product_Code;">
<input type="hidden" name="Search" value="&mvte:global:Search;">
<input type="hidden" name="Offset" value="&mvte:global:NextOffset;">
<mvt:item name="buttons" param="Next" />
</form>
</mvt:item>
</td>
</mvt:if>
</tr>
</table>
</mvt:if>

Here is the link to the page...http://whitewolfspirits.com/store/merchant.mvc?Screen=CTGY&Store_Code=WWS&Category_C ode=6 (http://whitewolfspirits.com/store/merchant.mvc?Screen=CTGY&Store_Code=WWS&Category_Code=6)

I tried to make a table with cells and put the Add to Cart in the bottom cell, but it just generates all kinds of errors.

I tried to put the button under the "Size" item, no luck.

HELP!! - lol

White Wolf

Leanne
09-01-06, 07:44 AM
What you want is something like this:
<table border=0 cellpadding=2 cellspacing=0 width=550>
<tr><td colspan="3" align="center">
<br>
</td></tr>
<tr>
<mvt:foreach iterator="product" array="products">
<td align="center" valign="top" width="25%">
<mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">
<img src="&mvte:product:thumbnail;" border=0 style="border: 3px double #9D7D60;"></a>
<mvt:else>&nbsp;
</mvt:if>
<br>
<mvt:item name="fonts" param="body_font">
<b>
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">&mvt:product:name;</a><br>
</b>&mvt:product:formatted_price;
&mvt:product:size;<br>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Action" value="ADPR">
<input type="hidden" name="Screen" value="BASK">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Product_Code" value="&mvte:product:code;">
<input type="hidden" name="Category_Code" value="&mvte:global:category_code;">
Quantity:
<input type="text" name="Quantity" value=1 size=4>
<mvt:item name="buttons" param="AddToBasket" />
</mvt:item>
</mvt:item>
<mvt:if expr="l.settings:product:inv_active">
</mvt:if>
</td>
<mvt:if expr = "(pos1 MOD 4 ) EQ 0">
</tr><tr><td colspan=3><HR width="100%" color=#cccccc SIZE=1></td></tr>
</mvt:if>
</mvt:foreach>
</table>


You may have to adjust things to be able to fit the code in a 4 column layout.

whitewolfspirits
09-05-06, 08:43 AM
Thanks,

I had to close the form and make some other small changes but the basic code worked.

This is what I ended up with. I left the quantity at the value of 1. The product display has an option for the quantity. Also, they can always add more in the shopping cart. I had to take the border off the images so I could add to them to make them equal in size.

<mvt:foreach iterator="product" array="products">
<td align="center" valign="bottom" width="30%">
<mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:global:Store_Code;&Product_Code=&mvta:product:code;&Category_Code=&mvta:global:Category_Code;">
<img src="&mvte:product:thumbnail;" border="0" style="padding: 0" ></a>
<mvt:else>
</mvt:if><font size="1" face="Tahoma">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:global:Store_Code;&Product_Code=&mvta:product:code;&Category_Code=&mvta:global:Category_Code;">
<br>&mvt:product:name;</a><br>
</b>&mvt:product:formatted_price;<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Action" value="ADPR">
<input type="hidden" name="Screen" value="BASK">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Product_Code" value="&mvte:product:code;">
<input type="hidden" name="Category_Code" value="&mvte:global:category_code;">
<input type="hidden" name="Quantity" value=1>
<mvt:item name="buttons" param="AddToBasket" />
</form>
<mvt:if expr="l.settings:product:inv_active">
</mvt:if>
</td>
<mvt:if expr = "(pos1 MOD 3 ) EQ 0">
</tr><tr><td colspan=3><HR width="100%" color=#cccccc SIZE=1></td></tr>
</mvt:if>
</mvt:foreach>

Thanks again!
White Wolf

Red Flare
01-18-07, 10:10 AM
What you want is something like this:
<table border=0 cellpadding=2 cellspacing=0 width=550>
<tr><td colspan="3" align="center">
<br>
</td></tr>
<tr>
<mvt:foreach iterator="product" array="products">
<td align="center" valign="top" width="25%">
<mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">
<img src="&mvte:product:thumbnail;" border=0 style="border: 3px double #9D7D60;"></a>
<mvt:else>&nbsp;
</mvt:if>
<br>
<mvt:item name="fonts" param="body_font">
<b>
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvta:category:code;">&mvt:product:name;</a><br>
</b>&mvt:product:formatted_price;
&mvt:product:size;<br>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Action" value="ADPR">
<input type="hidden" name="Screen" value="BASK">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Product_Code" value="&mvte:product:code;">
<input type="hidden" name="Category_Code" value="&mvte:global:category_code;">
Quantity:
<input type="text" name="Quantity" value=1 size=4>
<mvt:item name="buttons" param="AddToBasket" />
</mvt:item>
</mvt:item>
<mvt:if expr="l.settings:product:inv_active">
</mvt:if>
</td>
<mvt:if expr = "(pos1 MOD 4 ) EQ 0">
</tr><tr><td colspan=3><HR width="100%" color=#cccccc SIZE=1></td></tr>
</mvt:if>
</mvt:foreach>
</table>


You may have to adjust things to be able to fit the code in a 4 column layout.

I tried this code, but MIVA tells me that "foreach" is not closed. Anyway, no matter what I try, if I use the "AddToBasket" with a quantity, nothing is added to the basket.