WHMCS Changing <select> input to multiple boxes - dropdown

https://prnt.sc/vo986i - this is the default select dropdown menu that WHMCS provides.
https://prnt.sc/vo98m5 - this is the design I made in Figma.
I don't often work with WHMCS, I want to keep the functionality and just make it a multiple boxes choice rather than a dropdown.
{if $pricing.type eq "recurring"}
<div class="field-container">
<div class="form-group">
<label for="inputBillingcycle">{$LANG.cartchoosecycle}</label>
<select name="billingcycle" id="inputBillingcycle" class="form-control select-inline" onchange="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}">
{if $pricing.monthly}
<option value="monthly"{if $billingcycle eq "monthly"} selected{/if}>
{$pricing.monthly}
</option>
{/if}
{if $pricing.quarterly}
<option value="quarterly"{if $billingcycle eq "quarterly"} selected{/if}>
{$pricing.quarterly}
</option>
{/if}
{if $pricing.semiannually}
<option value="semiannually"{if $billingcycle eq "semiannually"} selected{/if}>
{$pricing.semiannually}
</option>
{/if}
{if $pricing.annually}
<option value="annually"{if $billingcycle eq "annually"} selected{/if}>
{$pricing.annually}
</option>
{/if}
{if $pricing.biennially}
<option value="biennially"{if $billingcycle eq "biennially"} selected{/if}>
{$pricing.biennially}
</option>
{/if}
{if $pricing.triennially}
<option value="triennially"{if $billingcycle eq "triennially"} selected{/if}>
{$pricing.triennially}
</option>
{/if}
</select>
</div>
</div>
{/if}
This is the code that WHMCS provides for the default billing cycle choice.
Thanks

Give this a go, it should work, changed the option values to radio boxes and stripped out the select box.
You will need to add your own classes for the design.
<div class="field-container">
<div class="form-group">
<label for="inputBillingcycle">{$LANG.cartchoosecycle}</label>
{if $pricing.monthly}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="monthly" name="billingcycle" value="monthly"> {$pricing.monthly}
{/if}
{if $pricing.quarterly}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="quarterly" name="billingcycle" value="quarterly"> {$pricing.quarterly}
{/if}
{if $pricing.semiannually}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="semiannually" name="billingcycle" value="semiannually"> {$pricing.semiannually}
{/if}
{if $pricing.annually}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="annually" name="billingcycle" value="annually"> {$pricing.annually}
{/if}
{if $pricing.biennially}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="biennially" name="billingcycle" value="biennially"> {$pricing.biennially}
{/if}
{if $pricing.triennially}
<input onclick="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}" type="radio" id="biennially" name="billingcycle" value="biennially"> {$pricing.triennially}
{/if}
</div>
</div>
{/if}```

Related

"un-group" Product Features

In product-details.tpl the features, when grouped, are printed inside a single
For example:
<dl>
<dt>FEATURE</dt>
<dd>Value1 Value2 Value3</dd>
</dl>
I want to print the following:
Code:
<dl>
<dt>FEATURE</dt>
<dd>
<span title="value1">Value1</span>
<span title="value2">Value2</span>
<span title="value2">Value3</span>
</dd>
</dl>
This is the original code
{block name='product_features'}
{if $product.grouped_features}
<section>
<h3>{l s='Data sheet' d='Shop.Theme.Catalog'}</h3>
<dl>
{foreach from=$product.grouped_features item=feature}
<dt>{$feature.name}</dt>
<dd>{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
{/foreach}
</dl>
</section>
{/if}
{/block}
I tried
{if $product.grouped_features}
<section>
<h3>{l s='Data sheet' d='Shop.Theme.Catalog'}</h3>
<dl>
{foreach from=$product.grouped_features item=feature}
<dt>{$feature.name}</dt>
<dd>{foreach $feature.value}<span title="{$feature.value|replace:' ':'_'}">{$feature.value|escape:'htmlall'|nl2br nofilter}</span>{/foreach}</dd>
{/foreach}
</dl>
</section>
{/if}
But of course doesn't work..
Most grateful for any help possible.
Thank you
Try with:
{block name='product_features'}
{if $product.grouped_features}
<section>
<h3>{l s='Data sheet' d='Shop.Theme.Catalog'}</h3>
<dl>
{foreach from=$product.grouped_features item=feature}
<dt>{$feature.name}</dt>
{assign var=detail_feature value="<br />"|explode:$feature.value}
<dd>
{foreach from=$detail_feature item=det_feature}
<span title="{$det_feature|escape:'htmlall'|nl2br nofilter}">{$det_feature|escape:'htmlall'|nl2br nofilter}</span>
{/foreach}
</dd>
{/foreach}
</dl>
</section>
{/if}
{/block}

Filter list by date and search through list

I need to figure out how to order by date ascending and how I can add search to my list.
Here is example structure: https://jsfiddle.net/franso/jr7dsef3/
<div id="app">
<input type="text" v-model="search" placeholder="Search">
<select v-model="title">
<option value="Show all">Show all</option>
<option value="Title 1">Title 1</option>
<option value="Title 2">title 2</option>
</select>
<select v-model="name">
<option value="Show all">Show all</option>
<option value="Name 1">Name 1</option>
<option value="Name 2">Name 2</option>
</select>
<div class="list" v-for="post in filteredAndOrdered">
<div class="list__wrapper">
<div class="list__item">{{ post.title }}</div>
<div class="list__item">{{ post.name }}</div>
<div class="list__item">{{ post.FinalApplicationDate }}</div>
</div>
</div>
</div>
You can use array.sort() for sorting date and use #change function on input tag for using search
Sort Javascript Object Array By Date

how to pass the variable product.tpl or modal.tpl in in prestashoap 1.7

I have a problem that I can not solve. in prestashop 1.7 I have a tpl file called product.tpl where inside, besides the various data, I call a file with the following code:
`{block name='product_variants'}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
{block name='product_miniature_item'}
<article class="product-miniature js-product-miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
<div class="thumbnail-container">
{block name='product_thumbnail'}
<a href="{$product.url}" class="thumbnail product-thumbnail">
<img
src = "{$product.cover.bySize.home_default.url}"
alt = "{if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{/if}"
data-full-size-image-url = "{$product.cover.large.url}"
>
</a>
{/block}
<div class="product-description">
{block name='product_name'}
<h1 class="h3 product-title" itemprop="name">{$product.name|truncate:30:'...'}</h1>
{/block}
{block name='product_price_and_shipping'}
{if $product.show_price}
<div class="product-price-and-shipping">
{if $product.has_discount}
{hook h='displayProductPriceBlock' product=$product type="old_price"}
<span class="sr-only">{l s='Regular price' d='Shop.Theme.Catalog'}</span>
<span class="regular-price">{$product.regular_price}</span>
{if $product.discount_type === 'percentage'}
<span class="discount-percentage">{$product.discount_percentage}</span>
{/if}
{/if}
{hook h='displayProductPriceBlock' product=$product type="before_price"}
<span class="sr-only">{l s='Price' d='Shop.Theme.Catalog'}</span>
<span itemprop="price" class="price">{$product.price}</span>
{hook h='displayProductPriceBlock' product=$product type='unit_price'}
{hook h='displayProductPriceBlock' product=$product type='weight'}
<div class="add">
<form action="{$urls.pages.cart}" method="post">
<input type="hidden" value="{$product.id_product}" name="id_product">
<!--<input type="number" style="padding: 3px 13px; float:left; width:30%; margin-left: 10px;" class="input-group form-control" name="qty" min="1" value="1">-->
<a style="cursor: pointer; padding: 3px 13px; margin-left: 10px; background: #ff9600; color: #fff;" data-button-action="add-to-cart" class="addtocart-btn"
{if !$product.add_to_cart_url}
disabled
{/if}>
<i class="material-icons shopping-cart"></i>
{l s='Add' d='Shop.Theme.Actions'}
<a href="{$product.url}" style=" padding: 3px 13px; margin-left: 10px;" class="view-dtls-btn">
{if {$language.iso_code} === 'ar'}
{l s='رأي' d='Shop.Theme.Actions'}
{else}
{l s='View' d='Shop.Theme.Actions'}
{/if}
</a>
</form>
</div>
</div>
{/if}
{/block}
{block name='product_reviews'}
{hook h='displayProductListReviews' product=$product}
{/block}
</div>
{block name='product_flags'}
<ul class="product-flags">
{foreach from=$product.flags item=flag}
<li class="product-flag {$flag.type}">{$flag.label}</li>
{/foreach}
</ul>
{/block}
<div class="highlighted-informations{if !$product.main_variants} no-variants{/if} hidden-sm-down">
{block name='quick_view'}
<a class="quick-view" href="#" data-link-action="quickview">
<i class="material-icons search"></i> {l s='Quick view' d='Shop.Theme.Actions'}
</a>
{/block}
{block name='product_variants'}
{if $product.main_variants}
{include file='catalog/_partials/variant-links.tpl' variants=$product.main_variants}
{/if}
{/block}
</div>
</div>
</article>
{/block}`
and everything works correctly.
what interests me most specifically is the portion of code referred to in this block
{block name='product_variants'}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
The code is:
`<div class="product-variants">
{foreach from=$groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
<span class="control-label">{$group.name}</span>
{if $group.group_type == 'select'}
<select
class="form-control form-control-select"
id="group_{$id_attribute_group}"
data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
{/foreach}
</select>
{elseif $group.group_type == 'color'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="float-xs-left input-container">
<label>
<input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span
{if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
{if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
><span class="sr-only">{$group_attribute.name}</span></span>
</label>
</li>
{/foreach}
</ul>
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container float-xs-left">
<label>
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
</ul>
{/if}
</div>
{/foreach}
</div>`
then I modified the tpl file of the module product.tpl and modal.tpl and inside the main file "product.tpl and modal.tpl", inside the foreach I inserted a part of the code to display the variants and some product html design.
what happens is that I visualize perfectly the formatting but all the values ​​of the variants do not let me see them, specifically this portion of code does not work`<div class="product-variants">
{foreach from=$groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
<span class="control-label">{$group.name}</span>
{if $group.group_type == 'select'}
<select
class="form-control form-control-select"
id="group_{$id_attribute_group}"
data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
{/foreach}
</select>
{elseif $group.group_type == 'color'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="float-xs-left input-container">
<label>
<input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span
{if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
{if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
><span class="sr-only">{$group_attribute.name}</span></span>
</label>
</li>
{/foreach}
</ul>
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container float-xs-left">
<label>
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
</ul>
{/if}
</div>
{/foreach}
</div>`
Obviously the same code in the product page recalls all the variables, while in the home where I recall the contents on the homepage I can not recover them. Where am I wrong? I put hands on prestashop only a few weeks ago and I think I have a confused ideas. I hope little I have been clear, thanks to those who have the patience to answer.
or optional we want to pass the $groups variable in modal.tpl inside ps_shoppingcart please help me..
thnx in advance

Prestashop 1.7 template not pass variable

I have a problem that I can not solve.
in prestashop 1.7 I have a tpl file called product.tpl where inside, besides the various data, I call a file with the following code:
<div class="product-actions">
{block name='product_buy'}
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id">
<input type="hidden" name="id_customization" value="{$product.customization_id}" id="product_customization_id">
{block name='product_variants'}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
{block name='product_pack'}
{if $packItems}
<section class="product-pack">
<h3 class="h4">{l s='This pack contains' d='Shop.Theme.Catalog'}</h3>
{foreach from=$packItems item="product_pack"}
{block name='product_miniature'}
{include file='catalog/_partials/miniatures/pack-product.tpl' product=$product_pack}
{/block}
{/foreach}
</section>
{/if}
{/block}
{block name='product_discounts'}
{include file='catalog/_partials/product-discounts.tpl'}
{/block}
{block name='product_add_to_cart'}
{include file='catalog/_partials/product-add-to-cart.tpl'}
{/block}
{block name='product_additional_info'}
{include file='catalog/_partials/product-additional-info.tpl'}
{/block}
{block name='product_refresh'}
<input class="product-refresh ps-hidden-by-js" name="refresh" type="submit" value="{l s='Refresh' d='Shop.Theme.Actions'}">
{/block}
</form>
{/block}
</div>
and everything works correctly.
what interests me most specifically is the portion of code referred to in this block
{block name='product_variants'}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
The code is:
<div class="product-variants">
{foreach from=$groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
<span class="control-label">{$group.name}</span>
{if $group.group_type == 'select'}
<select
class="form-control form-control-select"
id="group_{$id_attribute_group}"
data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
{/foreach}
</select>
{elseif $group.group_type == 'color'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="float-xs-left input-container">
<label>
<input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span
{if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
{if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
><span class="sr-only">{$group_attribute.name}</span></span>
</label>
</li>
{/foreach}
</ul>
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container float-xs-left">
<label>
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
</ul>
{/if}
</div>
{/foreach}
</div>
then I modified the tpl file of the module ps_featuredproducts and inside the main file "ps_featuredproducts.tpl", inside the foreach I inserted a part of the code to display the variants and some product html design.
what happens is that I visualize perfectly the formatting but all the values ​​of the variants do not let me see them, specifically this portion of code does not work
<div class="product-variants">
{foreach from=$groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
<span class="control-label">{$group.name}</span>
{if $group.group_type == 'select'}
<select
class="form-control form-control-select"
id="group_{$id_attribute_group}"
data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
{/foreach}
</select>
{elseif $group.group_type == 'color'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="float-xs-left input-container">
<label>
<input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span
{if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
{if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
><span class="sr-only">{$group_attribute.name}</span></span>
</label>
</li>
{/foreach}
</ul>
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container float-xs-left">
<label>
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
</ul>
{/if}
</div>
{/foreach}
</div>
Obviously the same code in the product page recalls all the variables, while in the home where I recall the contents on the homepage I can not recover them. Where am I wrong? I put hands on prestashop only a few weeks ago and I think I have a confused ideas.
I hope little I have been clear, thanks to those who have the patience to answer.
The variable $groups does not exist in ps_featuredproducts. You have to add it to the module if you want to use it on your home page.
In order to do that, you have to modify function getWidgetVariables() in ps_featuredproducts.php like this.
public function getWidgetVariables($hookName = null, array $configuration = [])
{
$products = $this->getProducts();
foreach ($products as &$product) {
$product_object = new Product((int)$product['id_product']);
$groups = array();
$attributes_groups = $product_object->getAttributesGroups($this->context->language->id);
if (is_array($attributes_groups) && $attributes_groups) {
foreach ($attributes_groups as $k => $row) {
if (!isset($groups[$row['id_attribute_group']])) {
$groups[$row['id_attribute_group']] = array(
'group_name' => $row['group_name'],
'name' => $row['public_group_name'],
'group_type' => $row['group_type'],
'default' => -1,
);
}
$groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = array(
'name' => $row['attribute_name'],
'html_color_code' => $row['attribute_color'],
'texture' => (#filemtime(_PS_COL_IMG_DIR_.$row['id_attribute'].'.jpg')) ? _THEME_COL_DIR_.$row['id_attribute'].'.jpg' : '',
'selected' => (isset($product_for_template['attributes'][$row['id_attribute_group']]['id_attribute']) && $product_for_template['attributes'][$row['id_attribute_group']]['id_attribute'] == $row['id_attribute']) ? true : false,
);
if ($row['default_on'] && $groups[$row['id_attribute_group']]['default'] == -1) {
$groups[$row['id_attribute_group']]['default'] = (int) $row['id_attribute'];
}
if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) {
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
}
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int) $row['quantity'];
}
// wash attributes list (if some attributes are unavailables and if allowed to wash it)
if (!Product::isAvailableWhenOutOfStock($product_object->out_of_stock) && Configuration::get('PS_DISP_UNAVAILABLE_ATTR') == 0) {
foreach ($groups as &$group) {
foreach ($group['attributes_quantity'] as $key => &$quantity) {
if ($quantity <= 0) {
unset($group['attributes'][$key]);
}
}
}
}
}
$product['groups'] = $groups;
}
if (!empty($products)) {
return array(
'products' => $products,
'allProductsLink' => Context::getContext()->link->getCategoryLink($this->getConfigFieldsValues()['HOME_FEATURED_CAT']),
);
}
return false;
}
I am using here a part of the code from the function ProductController::assignAttributesGroups() to get only $groups variable.
Finally, in ps_featuredproducts.tpl, you have to replace:
<div class="product-variants">
{foreach from=$groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
By:
<div class="product-variants">
{foreach from=$product.groups key=id_attribute_group item=group}
<div class="clearfix product-variants-item">
And then, all variables will be displayed like on product page.
The variable $groups that is used in catalog/_partials/product-variants.tpl is passed from PoductController.php and is available only on product info page. You cannot use it on your homepage or elsewhere. If you want to achieve the same result you need to create some similar variable within your module and pass it to your own template. The variable created in the file controller/front/ProductController.php within method assignAttributesGroups but it is pretty complicated I think you can create something much simpler.

How to make a dropdown select form in Twitter Bootstrap

They've provided the example markup for a regular input-text form:
<form class="form-horizontal">
<fieldset>
<legend>Legend text</legend>
<div class="control-group">
<label class="control-label" for="input01">Text input</label>
<div class="controls">
<input type="text" class="input-xlarge" id="input01">
<p class="help-block">Supporting help text</p>
</div>
</div>
</fieldset>
</form>
But how could I get something like
Just a bit confused on how the markup would look for a select list. Thanks!
Bootstrap 2.3.2:
<form class="form-horizontal">
<fieldset>
<div class="control-group">
<label class="control-label">Select:</label>
<div class="controls">
<select>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div>
</div>
</fieldset>
</form>
Bootstrap 3.x:
<form role="form" class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Select:</label>
<div class="col-sm-3">
<select class="form-control">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
</fieldset>
</form>
col-sm-2 and col-sm-3 define the widths for you can change accordingly. Have a look at the Grid system on the Bootstrap site to see the different variations.
Hope this helps
The answer by Lodder is correct for Bootstrap 2.x, but it will not work for Bootstrap 3. This will work Bootstrap 3:
<form class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="control-label col-lg-2">Select:</label>
<div class="col-lg-3">
<select class="form-control">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div>
</div>
</fieldset>
</form>
And work without value - Bootstrap 3.
<form class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="control-label col-lg-2">Select:</label>
<div class="col-lg-3">
<select class="form-control">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</div>
</div>
</fieldset>
</form>