VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: projohn on May 08, 2014, 21:23:24 PM

Title: Strange code on product details page...
Post by: projohn on May 08, 2014, 21:23:24 PM
Reference:
(http://s29.postimg.org/dnot5w28z/error.jpg) (http://postimg.org/image/dnot5w28z/)
http://www.bbjunior.com/index.php/en-GB/baby-2/gg-2/r117g0ybl1-detail

As I tried adding stock variables for customers to choose clothing size, it pops up some strange codes under the stock variable options on the frontend PLUS an extra add to cart button with the original 'green' style add to cart button!

'); Virtuemart.product($("form.product")); } $(".availability").remove(); if ("risetime" == stockhandle && stockable_30[found_id].product_availability) { $(".addtocart-area").after('
' + stockable_30[found_id].product_availability + '
'); } // recalculate the price by found product child id; formProduct = Opt.parents("form.product"); virtuemart_product_id = formProduct.find('input[name="virtuemart_product_id[]"]').val(); //formProduct.find("#selectedStockable").remove(); //formProduct.append(''); formProduct.find('input[name*="customPlugin[30][stockable][child_id]"]').val(found_id); //(''); Virtuemart.setproducttype(formProduct,virtuemart_product_id); } function isChildValid_30(stockableBlockIndex, child_attrib, currentIndex) { return_value = true; for (var i = currentIndex; i > 0; i--) { if (child_attrib["selectoptions"+i][0] != selections_30[stockableBlockIndex][i]) { return_value = false; } } return return_value; } function populateNextSelect_30(stockableBlockIndex, child_attrib, nextIndex) { var selectList = $("#stockableBlockIndex_30_"+stockableBlockIndex+" select.attribute_list.customfield_id_30"); var nextSelect = selectList.eq(nextIndex-1); // if the select exists if ("undefined" !== typeof(nextSelect) && nextSelect.length > 0) { // if it doesn't already contain this option, add it if (nextSelect.find("option[value='" + child_attrib["selectoptions"+nextIndex][0] + "']").length == 0) { nextSelect.append(""); } // if there is only one option, make it selected if (1 == nextSelect.find("option").length) { nextSelect.find("option").attr("selected","selected"); selections_30[stockableBlockIndex][nextIndex] = child_attrib["selectoptions"+nextIndex][0]; } // if this is the selected value, populate the next select too if (nextSelect.val() == child_attrib["selectoptions"+nextIndex][0]) { populateNextSelect_30(stockableBlockIndex, child_attrib, nextIndex+1); } } } }); //]]>


I've tried checking the template add to cart file and product details view file to ensure there're no duplicates for add to cart buttons. When I search some of the codes it traces back to plugins/vmcustom/stockable/stockable.php

Really appreciate if anyone can point out the problem.   :-\
Title: Re: Strange code on product details page...
Post by: GJC Web Design on May 08, 2014, 21:53:21 PM
Looks like a html code mistake in the template (unclosed div, apos. in the wrong place, missing } etc) that is rendering the custom code as text in the browser
First try with a standard template (Beez etc)

if OK then you know there is a mistake in the default or default_addtocart template
Title: Re: Strange code on product details page...
Post by: projohn on May 08, 2014, 22:13:20 PM
Quote from: GJC Web Design on May 08, 2014, 21:53:21 PM
Looks like a html code mistake in the template (unclosed div, apos. in the wrong place, missing } etc) that is rendering the custom code as text in the browser
First try with a standard template (Beez etc)

if OK then you know there is a mistake in the default or default_addtocart template

Yes, first I thought it's template problem. Then I switches from template template. But other built-in template doesn't work... Here's a reference:
Beez:
(http://s18.postimg.org/nfxx6b479/error2.jpg) (http://postimg.org/image/nfxx6b479/)
My template:
(http://s29.postimg.org/dnot5w28z/error.jpg) (http://postimg.org/image/dnot5w28z/)

Title: Re: Strange code on product details page...
Post by: GJC Web Design on May 08, 2014, 22:39:01 PM
hmmm -- if all files are standard... unescaped Chinese charactor breaking the code - he suggests - clutching at straws...  :(

p.s the code displayed is JS to change the price when custom is chosen