nitebird
09-10-2007, 08:12 PM
I have been trying to set up a new shop. I have tried to create six sections with products. When attempting to view four of the six sections, instead of seeing the listing of all the products and options to edit product info, modify product design, move product, etc. I see code like in the quote box below. I have tried deleting the secitons and making new duplicate ones, but I still see code.
var colors_list = new Array(); function updatePrice(prod, num, price_add){ if(!document.getElementsByName('base'+num+'_'+prod)[0]){ return; } if(!price_add){ price_add = 0; } var commission = getCommission(num, prod); var low = commission + parseFloat(document.getElementsByName('base'+num+'_'+prod)[0].value); low = Math.round(low*100); low = low/100; var high = parseFloat(low) + parseFloat(price_add); high = Math.round(high*100); high = high/100; low = addZeros(low); high = addZeros(high); if(high == low){ document.getElementById('range'+num+'_'+prod).innerHTML = "$"+low; }else{ document.getElementById('range'+num+'_'+prod).innerHTML = "$"+low+" to $"+high; } } function getCommission(num, prod){ var commission = parseFloat(document.getElementsByName('price'+num+'_'+prod)[0].value); var test = commission + ""; if(test.substring(test.indexOf("."), test.length).length > 3){ // Too many decimals commission = Math.floor(commission*100); }else{ commission = Math.round(commission*100); } commission = commission/100; if(commission > 50){ document.getElementsByName('price'+num+'_'+prod)[0].value = 50; return 50; }else if (commission < 0){ document.getElementsByName('price'+num+'_'+prod)[0].value = 0; return 0; }else if (!commission){ return 0; }else{ return commission; } } function addZeros(price){ price += ""; var dec_index = price.indexOf("."); if(dec_index != "-1"){ var extra_zero = price.substring(dec_index+1, price.length); if(extra_zero.length == "1"){ price += "0"; }else if (!extra_zero.length){ price += "00"; } }else{ price += ".00"; } return price; } function editProduct(prod){ document.getElementsByName('product_order_'+prod)[0].style.display = 'none'; document.getElementsByName('product_order_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('title_'+prod)[0].style.display = 'none'; document.getElementsByName('title_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('desc_'+prod)[0].style.display = 'none'; document.getElementsByName('desc_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('price_'+prod)[0].style.display = 'none'; document.getElementsByName('price_'+prod+'_edit')[0].style.display = 'block'; var price = document.getElementsByName('price_'+prod); var price_edit = document.getElementsByName('price_'+prod+'_edit'); for(i=0; i< colors_list[productid][groupid].length; x++){ var objColor = document.getElementsByName("colors["+productid+"]["+colors_list[productid][groupid][x]+"]")[0]; if(objColor){ objColor.checked=checked; } } } function selectColorGroupHeader(productid, groupid){ var all_selected = true; for(var x=0; x < colors_list[productid][groupid].length; x++){ var objColor = document.getElementsByName("colors["+productid+"]["+colors_list[productid][groupid][x]+"]")[0]; if(objColor && !objColor.checked){ all_selected = false; break; } } if(all_selected){ document.getElementsByName("colorGroup["+productid+"]["+groupid+"]")[0].checked=true; }else{ document.getElementsByName("colorGroup["+productid+"]["+groupid+"]")[0].checked=false; } } //function hideProducts(){ // document.getElementById('products_display').style.display="none"; // document.getElementById('products_hidden').style.display="block"; // xajax_products_hidden(1); //} //function showProducts(){ // document.getElementById('products_display').style.display="block"; // document.getElementById('products_hidden').style.display="none"; // xajax_products_hidden(0); //}
var colors_list = new Array(); function updatePrice(prod, num, price_add){ if(!document.getElementsByName('base'+num+'_'+prod)[0]){ return; } if(!price_add){ price_add = 0; } var commission = getCommission(num, prod); var low = commission + parseFloat(document.getElementsByName('base'+num+'_'+prod)[0].value); low = Math.round(low*100); low = low/100; var high = parseFloat(low) + parseFloat(price_add); high = Math.round(high*100); high = high/100; low = addZeros(low); high = addZeros(high); if(high == low){ document.getElementById('range'+num+'_'+prod).innerHTML = "$"+low; }else{ document.getElementById('range'+num+'_'+prod).innerHTML = "$"+low+" to $"+high; } } function getCommission(num, prod){ var commission = parseFloat(document.getElementsByName('price'+num+'_'+prod)[0].value); var test = commission + ""; if(test.substring(test.indexOf("."), test.length).length > 3){ // Too many decimals commission = Math.floor(commission*100); }else{ commission = Math.round(commission*100); } commission = commission/100; if(commission > 50){ document.getElementsByName('price'+num+'_'+prod)[0].value = 50; return 50; }else if (commission < 0){ document.getElementsByName('price'+num+'_'+prod)[0].value = 0; return 0; }else if (!commission){ return 0; }else{ return commission; } } function addZeros(price){ price += ""; var dec_index = price.indexOf("."); if(dec_index != "-1"){ var extra_zero = price.substring(dec_index+1, price.length); if(extra_zero.length == "1"){ price += "0"; }else if (!extra_zero.length){ price += "00"; } }else{ price += ".00"; } return price; } function editProduct(prod){ document.getElementsByName('product_order_'+prod)[0].style.display = 'none'; document.getElementsByName('product_order_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('title_'+prod)[0].style.display = 'none'; document.getElementsByName('title_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('desc_'+prod)[0].style.display = 'none'; document.getElementsByName('desc_'+prod+'_edit')[0].style.display = 'block'; document.getElementsByName('price_'+prod)[0].style.display = 'none'; document.getElementsByName('price_'+prod+'_edit')[0].style.display = 'block'; var price = document.getElementsByName('price_'+prod); var price_edit = document.getElementsByName('price_'+prod+'_edit'); for(i=0; i< colors_list[productid][groupid].length; x++){ var objColor = document.getElementsByName("colors["+productid+"]["+colors_list[productid][groupid][x]+"]")[0]; if(objColor){ objColor.checked=checked; } } } function selectColorGroupHeader(productid, groupid){ var all_selected = true; for(var x=0; x < colors_list[productid][groupid].length; x++){ var objColor = document.getElementsByName("colors["+productid+"]["+colors_list[productid][groupid][x]+"]")[0]; if(objColor && !objColor.checked){ all_selected = false; break; } } if(all_selected){ document.getElementsByName("colorGroup["+productid+"]["+groupid+"]")[0].checked=true; }else{ document.getElementsByName("colorGroup["+productid+"]["+groupid+"]")[0].checked=false; } } //function hideProducts(){ // document.getElementById('products_display').style.display="none"; // document.getElementById('products_hidden').style.display="block"; // xajax_products_hidden(1); //} //function showProducts(){ // document.getElementById('products_display').style.display="block"; // document.getElementById('products_hidden').style.display="none"; // xajax_products_hidden(0); //}