|

Select Quantity
Posted 11 April 2011 - 11:39 PM #1
i want to make SELECT list instead of Checkbox
eg
1
2
3
4
that will be show in the select area, if i chosse 1 they automatically add in the cart
and if click 2 in the select list, they aumatically add 2 products in the cart,
Thanks
Posted 12 April 2011 - 12:04 AM #2
{if $product.qty_content}
<select name="product_data[{$obj_id}][amount]" id="qty_count_{$obj_prefix}{$obj_id}">
{assign var="a_name" value="product_amount_`$obj_prefix``$obj_id`"}
{assign var="selected_amount" value=false}
{foreach name="`$a_name`" from=$product.qty_content item="var"}
<option value="{$var}" {if $product.selected_amount && ($product.selected_amount == $var || ($smarty.foreach.$a_name.last && !$selected_amount))}{assign var="selected_amount" value=true}selected="selected"{/if}>{$var}</option>
{/foreach}
</select>
Posted 12 April 2011 - 02:37 AM #3
EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.
Posted 12 April 2011 - 03:26 AM #4
here is my complete code, i dont know why is not showing in the page,
<div class="cm-reload-{$obj_prefix}{$obj_id}" id="qty_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_qty]" value="{$show_qty}" />
<input type="hidden" name="appearance[capture_options_vs_qty]" value="{$capture_options_vs_qty}" />
{if !empty($product.selected_amount)}
{assign var="default_amount" value=$product.selected_amount}
{elseif !empty($product.min_qty)}
{assign var="default_amount" value=$product.min_qty}
{else}
{assign var="default_amount" value="1"}
{/if}
{if ($product.qty_content || $show_qty) && $product.is_edp !== "Y" && $cart_button_exists == true && ($settings.General.allow_anonymous_shopping == "Y" || $auth.user_id)}
<div class="form-field{if !$capture_options_vs_qty} product-list-field{/if}{if $settings.Appearance.quantity_changer == "Y"} changer{/if}" id="qty_{$obj_prefix}{$obj_id}">
<label for="qty_count_{$obj_prefix}{$obj_id}">{$quantity_text|default:$lang.quantity}:</label>
{if $product.qty_content}
<select name="product_data[{$obj_id}][amount]" id="qty_count_{$obj_prefix}{$obj_id}">
{assign var="a_name" value="product_amount_`$obj_prefix``$obj_id`"}
{assign var="selected_amount" value=false}
{foreach name="`$a_name`" from=$product.qty_content item="var"}
<option value="{$var}" {if $product.selected_amount && ($product.selected_amount == $var || ($smarty.foreach.$a_name.last && !$selected_amount))}{assign var="selected_amount" value=true}selected="selected"{/if}>{$var}</option>
{/foreach}
</select>
{else}
{if $settings.Appearance.quantity_changer == "Y"}
<div class="center valign cm-value-changer">
<a class="cm-increase"><img src="{$images_dir}/icons/up_arrow.gif" width="11" height="5" border="0" /></a>
{/if}
<input type="text" size="5" class="input-text-short cm-amount" id="qty_count_{$obj_prefix}{$obj_id}" name="product_data[{$obj_id}][amount]" value="{$default_amount}" />
{if $settings.Appearance.quantity_changer == "Y"}
<a class="cm-decrease"><img src="{$images_dir}/icons/down_arrow.gif" width="11" height="5" border="0" /></a>
</div>
{/if}
{/if}
</div>
{if $product.prices}
{include file="views/products/components/products_qty_discounts.tpl"}
{/if}
{elseif !$bulk_add}
<input type="hidden" name="product_data[{$obj_id}][amount]" value="{$default_amount}" />
{/if}
<!--qty_update_{$obj_prefix}{$obj_id}--></div>
Posted 12 April 2011 - 03:38 AM #5
EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.
Posted 12 April 2011 - 03:46 AM #7
im gonna that code at, view_main_info.override.tpl
beside of Memory Modules, so client can chosse how many memory they want to put in their systems
Thanks
this is the link of my site
http://dev.amadiinc....product_id=1110
Posted 12 April 2011 - 03:54 AM #8
Add a {debug} to the top of the code and see if you get a debug window. Then check that you have values for the things you are conditional upon.
I'd definitely verify that values for all of the variables in this conditional (so glad this is a UI and not business logic).
{if ($product.qty_content || $show_qty) && $product.is_edp !== "Y" && $cart_button_exists == true && ($settings.General.allow_anonymous_shopping == "Y" || $auth.user_id)}
EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.
Posted 12 April 2011 - 04:11 AM #9
then if click the select automatically add into the cart
i hope you can help me here, cause i tried my code but its not working,
Thanks for the help, i aprreciatte you help. God bless you
see my updated link
http://dev.amadiinc....product_id=1110