Quote:
Originally Posted by inebriate
by the looks of the screen shot, you are using product.tpl...just put a if statement and in a javascript put
Code:
var selitem = document.getElementById('po'+whatevertheidforthe3.5x4selectboxis).value;
var qtybox = document.getElementById('product_avail');
qtybox.options.length = 0;
if (selitem == '3.5 x 4')
qtybox.option[0] = new Option('1000',1000); //populate the qty box with what you want
else
qtybox.option[0] = new Option('10',10);
granted, this only works on javascript users
as for the product options javascript mod, just an idea, it may be easier to just modify the form validation and putting it as an onchange to the select input...should require less modification and support importing/exporting the javascript
|
Good point, but if I understand you correctly you'd (at least for the specific product in question) have to choose one or the other (onsubmit or onchange), but not both. Please let me know if that's not the case.
As I mentioned, this mod did require a good bit more changes to the code than I would have liked, but I've got a number of scenarios that I need to handle where I'm going to need the flexibility it offers, and I didn't want to have to special case the form validation every time. In particular, I'm writing a Smarty plugin that hooks into the HTML_AJAX PEAR module (which I am a big fan of) and I'm experimenting a bit using the product options JS mod and the Extra Fields HTML mod that someone else contributed, which opens up a lot of possibilities, but quickly leads to the maintainability issues inherent in most (all?) template-based systems.
As much as I enjoy working with X-Cart, as others have pointed out there is one problem with mod development in particular that really needs to be addressed - the inability to produce a workable patch system for the Smarty templates. We simply have to use the de facto documentation style that amounts to writing a diff by hand - I'm not knocking it, really, it's quite usable, but time-consuming and error-prone no matter how careful one tries to be. I've seen a couple of posts lately that touch on it, and if there are any others willing to try to come up with a usable system, I'm certainly willing to devote some time and effort to the project.
Anyway, sorry to veer so far off course, but I finished the import/export part of the mod, which I've just successfully tested, so after checking it over one more time I'll amend the original product options mod post, so that should no longer be an issue. Thanks for your feedback, I really appreciate it.
Regards,
Nate