News:

Looking for documentation? Take a look on our wiki

Main Menu

Strange code on product details page...

Started by projohn, May 08, 2014, 21:23:24 PM

Previous topic - Next topic

projohn

Reference:

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.   :-\

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

projohn

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:

My template:



GJC Web Design

#3
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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation