View Single Post
  #18  
Old 04-30-2008, 10:13 AM
 
itsmeee itsmeee is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 56
 

Default Re: Case Quantities (ie. 12, 24, 36, etc) in quantity pulldown

Quote:
Originally Posted by Fueled
Hi

I started making this mod to my cart (4.1.5) but had to stop at the step where you modify the javascript. It looks like it has been moved and substantially changed in 4.1. Has anyone gotten this to work in their cart?

Thanks

Hey I had just started working on a module like this until I found this thread. I had the same problem though when I hit the last step until I looked at the bottom of the page and noticed that they have just seperated the java from the rest of the code.

So the last step for 4.1.8 (maybe the whole 4.1.x branch) should be

6. Open modules/Product_Options/func.js and find
Code:
if (!availObj) availObj = document.getElementById('product_avail'); if (availObj && availObj.tagName.toUpperCase() == 'SELECT') { if (!isNaN(min_avail) && !isNaN(avail)) { var first_value = -1; if (availObj.options[0]) first_value = availObj.options[0].value; if (first_value == min_avail) { /* New and old first value in quantities list is equal */ if ((avail-min_avail+1) != availObj.options.length) { if (availObj.options.length > avail) { var cnt = availObj.options.length; for (var x = (avail < 0 ? 0 : avail); x < cnt; x++) availObj.options[availObj.options.length-1] = null; } else { var cnt = availObj.options.length; for (var x = cnt+1; x <= avail; x++) availObj.options[cnt++] = new Option(x, x); } } } else { /* New and old first value in quantities list is differ */ while (availObj.options.length > 0) availObj.options[0] = null; var cnt = 0; for (var x = min_avail; x <= avail; x++) availObj.options[cnt++] = new Option(x, x); } if (availObj.options.length == 0) availObj.options[0] = new Option(txt_out_of_stock, 0); } select_avail = availObj.options[availObj.selectedIndex].value; } check_wholesale(select_avail); if ((alert_msg == 'Y') && (min_avail > avail)) alert(txt_out_of_stock);

and replace it with

Code:
if (case_size == '') { if (!availObj) availObj = document.getElementById('product_avail'); if (availObj && availObj.tagName.toUpperCase() == 'SELECT') { if (!isNaN(min_avail) && !isNaN(avail)) { var first_value = -1; if (availObj.options[0]) first_value = availObj.options[0].value; if (first_value == min_avail) { /* New and old first value in quantities list is equal */ if ((avail-min_avail+1) != availObj.options.length) { if (availObj.options.length > avail) { var cnt = availObj.options.length; for (var x = (avail < 0 ? 0 : avail); x < cnt; x++) availObj.options[availObj.options.length-1] = null; } else { var cnt = availObj.options.length; for (var x = cnt+1; x <= avail; x++) availObj.options[cnt++] = new Option(x, x); } } } else { /* New and old first value in quantities list is differ */ while (availObj.options.length > 0) availObj.options[0] = null; var cnt = 0; for (var x = min_avail; x <= avail; x++) availObj.options[cnt++] = new Option(x, x); } if (availObj.options.length == 0) availObj.options[0] = new Option(txt_out_of_stock, 0); } select_avail = availObj.options[availObj.selectedIndex].value; } check_wholesale(select_avail); if ((alert_msg == 'Y') && (min_avail > avail)) alert(txt_out_of_stock); }

I've gotten this working fine (I think) with dynamic images too so if you have questions about doing it with that program feel free to ask me and I'll try to help you through.

I need to confess though that I don't know javascript though so if anyone can confirm what I've done here I'd love to know I'm not screwing things up :p

Also I think these forums should setup some way to monetarily thank people for awesome modules like this! I know people are just sharing some knowledge which is really really awesome, but I'd love it if I could give a few bucks at least to thank people like gfiebich for saving me tons of time
__________________
Version 4.1.8
Reply With Quote