hagbard_2605 Posted May 24, 2007 Report Share Posted May 24, 2007 Guten Tag zusammen, ich habe das Modul "Textfeld Addon" und das Modul "Attributpreise mit autom. Preisberechnung" gekauft und installiert. Aber ich bekomme logischerweise nur eines der beiden zum Laufen. Jetzt habe ich das schon bestmöglich zusammengewurschtelt und habe folgendes Problem: Ich habe ein Produkt in dem der Besucher aus verschiedenen Dropdown-Liste Auflagen aussuchen kann (+ xy Euro) UND in Textfelder seinen Namen eingeben kann. Kurz gesagt ein Briefpapiermodul. Und so sieht das dann aus: http://www.gutundwillig.de/screen.jpg (right click safe). Über meinen Texteingabefeldern taucht diese kleine Dropdown-Box auf. Sonst geht alles! So sieht der Code meiner anzeige.html aus: /* ----------------------------------------------------------------------------- Aenderung für Textfeld Attribute Erstellt 2006 von Omega-Soft - http://www.omega-soft.de Erstellt für für xt:Commerce 3.0.4-SP2.1 - http://www.xt-commerce.com Alle Änderungen beginnen mit // Block X - zzzzz Copyright © 2006 by Omega-Soft - Version 2.0.2 Stand: 06.09.2006 Released under the GNU General Public License http://www.gnu.org ----------------------------------------------------------------------------*/ /* ----------------------------------------------------------------------------- Diese Date wurde neu erstellt. Sie macht eine automatische Auswahl zwischen den Artikel-Attribut-Funktionen. Je nachdem welche Funktion dem Attribut zugeordnet ist, wird die richtige Darstellung gewählt. ----------------------------------------------------------------------------*/ ?> {if $options!=''} <table width="100%" border="0" cellspacing="0" cellpadding="0"> {foreach name=outer item=options_data from=$options} <!-- Part for Checkbox --> {if $options_data.TYPE==3} <tr> <td valign="top" class="main"><b>{$options_data.NAME}:</b> </td> <td class="main"> {foreach key=key_data item=item_data from=$options_data.DATA} <input type="checkbox" name="id[{$options_data.ID}]" value="{$item_data.ID}" > {$item_data.TEXT} {if $item_data.PRICE!=''}( {$item_data.PREFIX}{$item_data.PRICE} ){/if}<br /> {/foreach} </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of Checkbox --> <!-- Part for Radiobutton --> {if $options_data.TYPE==2} <tr> <td valign="top" class="main"><b>{$options_data.NAME}:</b> </td> <td colspan="4" class="main"> {foreach key=key_data item=item_data from=$options_data.DATA} <input type="radio" name="id[{$options_data.ID}]" value="{$item_data.ID}" checked="checked" /> {$item_data.TEXT} {if $item_data.PRICE!=''}( {$item_data.PREFIX}{$item_data.PRICE} ){/if}<br /> {/foreach} </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of Radiobutton --> <!-- Part for Dropdown --> {if $options_data.TYPE==0} <tr> <td class="main"><b>{$options_data.NAME}:</b> </td> <td colspan="4"> <select name="id[{$options_data.ID}]"> {foreach key=key_data item=item_data from=$options_data.DATA} <option value="{$item_data.ID}">{$item_data.TEXT} {if $item_data.PRICE != '' }{$item_data.PREFIX} {$item_data.PRICE}{/if} </option> {/foreach} </select> </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of Dropdown --> <!-- Part for Textfeld --> {if $options_data.TYPE==1} <tr> <td class="main"><b>{$options_data.NAME}:</b> </td> <td colspan="4"> <? // für Textfeld ?> {if $options_data.TEFE=='false'} <select name="id[{$options_data.ID}]"> {foreach key=key_data item=item_data from=$options_data.DATA} <option value="{$item_data.ID}">{$item_data.TEXT}{$options_data.COMMENT} {if $item_data.PRICE != '' }{$item_data.PREFIX} {$item_data.PRICE}{/if} </option> {/foreach} </select> {/if} {if $options_data.TEFE=='true'} {foreach key=key_data item=item_data from=$options_data.DATA} {$item_data.TEXT} {$options_data.COMMENT} {if $item_data.PRICE != '' }{$item_data.PREFIX} {$item_data.PRICE}{/if} {/foreach} {/if} </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of Textfeld --> <!-- Part for TextArea --> {if $options_data.TYPE==4} <tr> <td class="main"><b>{$options_data.NAME}:</b> </td> <td colspan="4"> <? // für TextArea ?> {foreach key=key_data item=item_data from=$options_data.DATA} {$item_data.TEXT} {$options_data.COMMENT} {if $item_data.PRICE != '' }{$item_data.PREFIX} {$item_data.PRICE}{/if} {/foreach} </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of TextArea --> <!-- Part for FixText --> {if $options_data.TYPE==5} <tr> <td valign="top" class="main"><b>{$options_data.NAME}:</b> </td> <td colspan="4" class="main"> {foreach key=key_data item=item_data from=$options_data.DATA} <input type="hidden" name="id[{$options_data.ID}]" value="{$item_data.ID}" checked="checked" /> {$item_data.TEXT} {$options_data.COMMENT} {if $item_data.PRICE!=''}( {$item_data.PREFIX}{$item_data.PRICE} ){/if}<br /> {/foreach} </td> </tr> <tr> <td colspan="5"> </td> </tr> {/if} <!-- End of FixText --> {/foreach} </table> {/if}Und so der Code der product_options_dropdown.html: {if $options!=''} <table width="100" border="0" cellspacing="0" cellpadding="0"> {foreach name=outer item=options_data from=$options} <tr> <td class="main"><b>{$options_data.NAME}:</b> </td> <td> {* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de *} {* <select name="id[{$options_data.ID}]"> *} <select name="id[{$options_data.ID}]" onchange="updatePrice()"> {* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de END *} {foreach key=key_data item=item_data from=$options_data.DATA} <option value="{$item_data.ID}">{$item_data.TEXT} {if $item_data.PRICE !='' }{$item_data.PREFIX} {$item_data.PRICE}{/if} </option> {/foreach} </select> </td> </tr> {/foreach} </table> {* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de *} <script type="text/javascript"> // <![CDATA[ function updatePrice() {literal} { {/literal} var price = new Array(); var add_to_price = 0; {foreach name=outer item=options_data from=$options} price[{$options_data.ID}] = new Array(); {foreach key=key_data item=item_data from=$options_data.DATA} price[{$options_data.ID}][{$item_data.ID}] = Number({$item_data.PREFIX}{$item_data.PRICE_PLAIN}); {/foreach} var sel_index = document.getElementById("cart_quantity").elements["id[{$options_data.ID}]"].selectedIndex; var item_id = document.getElementById("cart_quantity").elements["id[{$options_data.ID}]"].options[sel_index].value; if (!isNaN(item_id)) add_to_price += price[{$options_data.ID}][item_id]; {/foreach} var calculated_price = Number(original_price)+Number(add_to_price); document.getElementById("price").firstChild.nodeValue = currencyToXTC(calculated_price); {literal} } {/literal} function toDecimalPlaces(x, n) {literal} { {/literal} if (n < 1 || n > 14) return false; var e = Math.pow(10, n); var k = (Math.round(x * e) / e).toString(); if (k.indexOf('.') == -1) k += '.'; k += e.toString().substring(1); return k.substring(0, k.indexOf('.') + n+1); {literal} } {/literal} function currencyToXTC(str) {literal} { {/literal} var decimal_point = '{$DECIMAL_POINT}'; var decimal_places = {$DECIMAL_PLACES}; var thousands_point = '{$THOUSANDS_POINT}'; str = toDecimalPlaces(str,decimal_places); var predecimal_part = str.substring(0,str.length-decimal_places-1); var decimal_part = str.substr(str.length-decimal_places,decimal_places); if(thousands_point != "" && predecimal_part.length > 3){literal}{{/literal} var predecimal_temp = predecimal_part; var predecimal_part = ""; for(j = 3; j < predecimal_temp.length ; j+=3){literal}{{/literal} var extrakt = predecimal_temp.slice(predecimal_temp.length - j, predecimal_temp.length - j + 3); predecimal_part = thousands_point + extrakt + predecimal_part + ""; {literal}}{/literal} var str_first = predecimal_temp.substr(0, (predecimal_temp.length % 3 == 0)?3:(predecimal_temp.length % 3)); predecimal_part = str_first + predecimal_part; {literal}}{/literal} return predecimal_part + decimal_point + decimal_part; {literal} } {/literal} function currencyToJavaScript(str) {literal} { {/literal} var decimal_places = {$DECIMAL_PLACES}; var thousands_point = '{$THOUSANDS_POINT}'; str = str.toString() var predecimal_part = str.substring(0,str.length-decimal_places-1); var decimal_part = str.substr(str.length-decimal_places,decimal_places); if(thousands_point != "" && predecimal_part.length > 3) predecimal_part = predecimal_part.replace(eval('/\\'+thousands_point+'/g'),''); return Number(predecimal_part + '.' + decimal_part); {literal} } {/literal} // ]]> </script> {* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de END *} {/if}Kann mir jemand einen Tipp geben? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.