#1 (permalink)  
Alt 26.02.2009, 09:12
Neuer Benutzer
 
Registriert seit: 04.02.2009
Beiträge: 6
Standard Freitext und ATTRIBUTES_PRICES_JAVASCRIPT

Hallo,

ich habe folgendes Problem. Ich habe in meinem Shop das ATTRIBUTES_PRICES_JAVASCRIPT eingebunden, es läuft auch einwandfrei außer wenn dem Artikel das Freitext Attribut zugeordnet ist., dann wird der Preis nicht berechnet und angezeigt. hier mal die htmls zur Fehlersuche

html-code product_options_dropdown
HTML-Code:
{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>&nbsp;</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 language="javascript1.5" type="text/javascript">

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 deicmal_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 + deicmal_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 deicmal_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 + '.' + deicmal_part);
  	{literal}
}	
	{/literal}

updatePrice();
</script>

{* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de END *}
{/if}
html-Code Product_options_freitext
HTML-Code:
{if $options!=''}

<script language="javascript">
	{php}$myOptionCount=0;{/php}
	{foreach name=outer item=options_data from=$options} 
		{foreach key=key_data item=item_data from=$options_data.DATA}
			{if $item_data.PRICE}
				{php}$myOptionCount++;{/php}
				myOptionValues[{php}echo $myOptionCount;{/php}] = new Array(2);
				myOptionValues[{php}echo $myOptionCount;{/php}][1] = "{$options_data.ID}x{$item_data.ID}"
				myOptionValues[{php}echo $myOptionCount;{/php}][2] = "{$item_data.PREFIX}{$item_data.PRICE}"
			{/if}
		{/foreach}
	{/foreach}
	myOptionCount = {php}echo $myOptionCount;{/php};
</script>

<table width="100" border="0" cellspacing="0" cellpadding="0">
  {foreach name=outer item=options_data from=$options} 
  <tr>
  {if $options_data.DATA.0.TEXT == 'Freitext'}
    		<input type="hidden" name="product_options_id_freitext" value="{$options_data.ID}"/>
	  		<td class="main"><b>{$options_data.NAME}:</b>&nbsp;</td>
			<td class="main"><input type="text" name="freitext"/>&nbsp;</td>
    	{/if}
    	{if $options_data.DATA.0.TEXT != 'Freitext'}
    		 <td class="main"><b>{$options_data.NAME}:</b>&nbsp;</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>
{/if}
  </tr>
  {/foreach} 
</table>
{* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de *}
<script language="javascript1.5" type="text/javascript">

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 deicmal_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 + deicmal_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 deicmal_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 + '.' + deicmal_part);
  	{literal}
}	
	{/literal}

updatePrice();
</script>

{* ATTRIBUTES_PRICES_JAVASCRIPT by xtc-deluxe.de END *}
{/if}
vielleicht findet jemand den Fehler.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 27.02.2009, 05:33
Neuer Benutzer
 
Registriert seit: 04.02.2009
Beiträge: 6
Standard

hat keiner eine IDEE?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
freitext

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Gäste und Kunden sehen nur Nettobeträge Tobi4u Shopbereich 6 05.12.2010 10:26
Attribut Modul und Options PlugIn ahlfy Fragen zur Software 39 06.04.2009 15:09
Admin-Loginbereich und Kundenlogin. Immer fliegt man raus! Johannes01 Installation und Konfiguration 4 10.03.2009 16:38
Versandartenbedingte Rabatte und Zuschläge goooofy Modul Entwicklung 0 23.02.2009 08:57


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:44 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand