Jump to content

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


Recommended Posts

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

Link to comment
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

Link to comment
Share on other sites

  • 5 years later...

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)
Link to comment
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...