Jump to content
adamthomson123

how to change attributes from radio button to drop down in prestashop 1.6.0.11

Recommended Posts

i am trying to change the attributes from radio button to drop down menu, but i dont know how to do it, need help please, screenshot is attachedpost-723180-0-39730600-1421511747_thumb.png

thanks

Share this post


Link to post
Share on other sites

product.tpl

 

everything depends on attribute that you want to change, i will show an example for "color" attributes.

there is a code:
 

<ul id="color_to_pick_list" class="clearfix">
														{assign var="default_colorpicker" value=""}
														{foreach from=$group.attributes key=id_attribute item=group_attribute}
															{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
															<li{if $group.default == $id_attribute} class="selected"{/if}>
																<a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}">
																	{if $img_color_exists}
																		<img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="20" height="20" />
																	{/if}
																</a>
															</li>
															{if ($group.default == $id_attribute)}
																{$default_colorpicker = $id_attribute}
															{/if}
														{/foreach}
													</ul>
													<input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" />

change it to:


{foreach from=$group.attributes key=id_attribute item=group_attribute}
                                                            {$colors.$id_attribute.name|escape:'html':'UTF-8'} <input onchange="findCombination()"  type="radio" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute|intval}" />
                                                            <br/>
{/foreach}

 

 

effect:
Nwtj1EM.png

Share this post


Link to post
Share on other sites

product.tpl

 

everything depends on attribute that you want to change, i will show an example for "color" attributes.

there is a code:

 

<ul id="color_to_pick_list" class="clearfix">
														{assign var="default_colorpicker" value=""}
														{foreach from=$group.attributes key=id_attribute item=group_attribute}
															{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
															<li{if $group.default == $id_attribute} class="selected"{/if}>
																<a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}">
																	{if $img_color_exists}
																		<img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="20" height="20" />
																	{/if}
																</a>
															</li>
															{if ($group.default == $id_attribute)}
																{$default_colorpicker = $id_attribute}
															{/if}
														{/foreach}
													</ul>
													<input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" />

change it to:


{foreach from=$group.attributes key=id_attribute item=group_attribute}
                                                            {$colors.$id_attribute.name|escape:'html':'UTF-8'} <input onchange="findCombination()"  type="radio" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute|intval}" />
                                                            <br/>
{/foreach}

 

 

effect:

Nwtj1EM.png

Hi,

Vekia,    

My Website attributes are already in radio button, i want to change them from radio button to drop down, please how to do it?

thanks

Share this post


Link to post
Share on other sites

Goto BO/catalog/product attributes and click on edit next to color

 

post-535854-0-88231600-1421522719_thumb.png

 

then choose dropdown from the attribute type

 

post-535854-0-81380200-1421522770_thumb.png

 

result is

 

post-535854-0-86801000-1421522788_thumb.jpg

 

  • Like 2

Share this post


Link to post
Share on other sites

lol how i can miss the real question :(

sorry for the confusion. gladly mickeyboy1 found solution without touching the code.

Share this post


Link to post
Share on other sites

lol how i can miss the real question :(

sorry for the confusion. gladly mickeyboy1 found solution without touching the code.

no, problem ! thank you very much too!

you always helped alot ,

thanks

Share this post


Link to post
Share on other sites
Posted (edited)

Hi, 

I see, its a very old post but if anyone can attend the similar nature of problem. i want to convert the social titles from radio to drop down in the new account creation form in prestashop 1.7.6

 

https://xyzcom/en/login?create_account=1

 

 

classes/form/CustomerFormatter.php line 98 reads

 ->setType('radio-buttons')

change it to 

 ->setType('select')

 

Edited by mickeyboy1 (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More