Antwort #33 am: 24. November 2013, 14:54:38
Hallo h-h-h
zum Vorhaben ich habe zwei Optionen, einmal Kettelung und einmal Qualität.
Die Option Kettelung hat die attribute rot, schwarz, gelb usw.
diese möchte ich gern als Bild auf den Auswahl Buttons wiedergeben, damit der Kunde die Farben und die Kombination (Farbe Kettelung/Farbe Matte) richtig erkennen kann und durch klicken auf das Bild die Auswahl tätigen kann.
( ich glaube noriddle oder matt hatten mich darauf hingewiesen das es besser für den Kunden sei)
Die Option Qualität hat die arttibute: sprint, ralley, usw.
die möchte als Text auf den Buttons ausgeben, da hier das Attributbild mittels Modul "Attributbilder mit automatischer Preisaktualisierung für modified-shop" beim Produktbild ausgegeben wird.
anbei der Code in Original
{if $options!=''}<script type
="text/javascript">function change_ai
(option
, attribute
) {literal
}{{/literal
} if (!document
.getElementById
) return; var t_img
= ''; var t_pop
= ''; var images
= new Array(); {foreach name
=outer item
=options_data from
=$options} {if $options_data.HAS_IMAGE
} images
[{$options_data.ID
}] = new Array(); {foreach key=key_data item
=item_data from
=$options_data.DATA
} images
[{$options_data.ID
}][{$item_data.ID
}] = '{$item_data.IMAGE}'; {/foreach} {/if} {/foreach} if (images
[option
] && images
[option
][attribute
] != '') {literal
}{{/literal
} t_img
= '{$INFO_IMAGE_PATH}'+images
[option
][attribute
]; t_pop
= '{$POPUP_IMAGE_PATH}'+images
[option
][attribute
]; {literal
}}{/literal
} else {literal
}{{/literal
} t_img
= ori_image
; t_pop
= ori_popup
; {literal
}}{/literal
} document
.getElementById
('products_image').src
= t_img
; document
.getElementById
('products_popup').href
= t_pop
;{literal
}}{/literal
}function change_all_attributes
() {literal
}{{/literal
} {foreach name
=outer item
=options_data from
=$options} var sel_index
= document
.getElementById
("cart_quantity").elements
["id[{$options_data.ID}]"].selectedIndex
; change_ai
({$options_data.ID
}, document
.getElementById
("cart_quantity").elements
["id[{$options_data.ID}]"].options
[sel_index
].value
); {/foreach}{literal
}}{/literal
}</script><div id
="radios"> {foreach name
=outer item
=options_data from
=$options} <div
class="radio"><b
>{$options_data.NAME
}:</b
> {foreach key=key_data name
=key_data item
=item_data from
=$options_data.DATA
} <input id
="{$item_data.ID}" type
="radio" name
="id[{$options_data.ID}]" value
="{$item_data.ID}" {if $smarty.foreach.key_data
.first
}checked
="checked" {/if} {if $options_data.HAS_IMAGE
} onchange
="change_ai({$options_data.ID}, this.value)"{/if} /> <label
for="{$item_data.ID}"><img src
="images/product_images/info_images/{$item_data.IMAGE}" /></label
> {/foreach}</div
> {/foreach}</div
>{/if} P.S. Shop version ist die Aktuellste. vorgestern geladen, auch auf wunsch von o.g. Mitgliedern