X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Validation onChange (https://forum.x-cart.com/showthread.php?t=35268)

jwwceo 11-07-2007 01:06 PM

Validation onChange
 
I have lots of exceptions and don't want my customers to have to press "add to Cart" to find out if their order is possible.

Is there any easy way to run the Exception Validation script every time a variant pull down is used.

Best,

James

derrick 11-07-2007 02:15 PM

Re: Validation onChange
 
James,

I just happen to be in that piece of code as I saw this message and see that the option exceptions are checked with each option change. Everytime an option is changed, it triggers via the following call:

onchange="javascript: check_options();"

check_options() is in the included in the skin1/modules/Product_Options/func.js and makes a call to check_exceptions() right at the bottom of the check_options function.

This is bases on 4.1.8 Gold.

I am looking to create a little code to use the exceptions to dynamically build only valid product options based upon the current selection... wish me luck.

-Derrick

Quote:

Originally Posted by jwwceo
I have lots of exceptions and don't want my customers to have to press "add to Cart" to find out if their order is possible.

Is there any easy way to run the Exception Validation script every time a variant pull down is used.

Best,

James


jwwceo 11-07-2007 02:30 PM

Re: Validation onChange
 
Derrick,

I saw that too, but it doesn't seem to do anything. I can select variants which are not allowed and only when I press add to cart does it seem to check to see if they are exceptions or not.

If you have any tips on this I'd love to hear them....or if you get something working where only the valid options are displaying, that would be sweet. I have thought about paying X-cart for that functionality or try and build it myself, which would take me forever probably. The problem for us is that we have three pull downs...so the 2nd two have to be disabled until the first is selected and so on. This causes a page reload unless Ajax is used...so it's hairy...

that's why I was going to settle for this temp solution of having the exception checked onChange instead of Add to Cart.

Best,

James

derrick 11-07-2007 02:40 PM

Re: Validation onChange
 
It may be that you are missing the error message since it is generated differently while checking inline versus checking at the time of submit. When you submit the form and there is an exception, it pops up a nice little javascript dialog box. If you pick an invalid combination inline, it just generates a poorly formatted text string right above the Quantity box. If you have modified the template, you may have removed the error string that it uses to report inline.

Go into view/source and search for "exception_msg"
Hope this helps.

The code I am writing will be quick and dirty to just remove any specific html option lines based upon the current selections.
I'll post something when I get it done. In the mean time, you should be able to just report the error already being generated.

If you still have a problem, send me a message with a link to take a look.

-Derrick

Quote:

Originally Posted by jwwceo
Derrick,

I saw that too, but it doesn't seem to do anything. I can select variants which are not allowed and only when I press add to cart does it seem to check to see if they are exceptions or not.

If you have any tips on this I'd love to hear them....or if you get something working where only the valid options are displaying, that would be sweet. I have thought about paying X-cart for that functionality or try and build it myself, which would take me forever probably. The problem for us is that we have three pull downs...so the 2nd two have to be disabled until the first is selected and so on. This causes a page reload unless Ajax is used...so it's hairy...

that's why I was going to settle for this temp solution of having the exception checked onChange instead of Add to Cart.

Best,

James


jwwceo 11-07-2007 03:08 PM

Re: Validation onChange
 
That's what I was thinking too, but for me there are never pop ups, just the inline error messsage, which I get when I press ADD TO CART. So it's in my template, just not coming up when I change the pull down. If you have a minute and wouldn't mind a quick peak the site is here...

http://www.boozingtees.com/product.php?productid=16145

An exception is a Pink Hoodie.

Thanks in advance!!!

James

derrick 11-07-2007 03:36 PM

Re: Validation onChange
 
Very odd. I recreated almost the exact same scenario with multiple nested variants on my test site (4.1.8) and I can't recreate the problem that I can clearly see on your site. I also verified that the variable is still there that it should be reporting through (yet nothing is there).

The only thing that looks odd is that the index for the exceptions is consistently starting with "2" on your site. That _could_ be causing some issues with the loop, but I will have to take a look.

I can take a deeper look, but would need access to the site. If you want me to take a look, I'd be happy to. You can PIM me with details if you want.

-Derrick

Widerimagellc 01-04-2008 09:31 AM

Re: Validation onChange
 
Was there ever a solution for this? I want to be able to have customers select the first option and other options appear/disappear based on their first selection. Not all options will be linked as the selections will be universal, but as an example, if someone selects "Add Text" a text box will appear for their input. Also, if they choose a particular size, another option further down will change its drop down options to include different selections.

Is this possible via javascript or what is the best way to make this happen for a particular product, I don't want the page to have to re-load or them to have to wait until the pushing add-to-cart. Any and all help would be most apprecaited!

Thanks!

Mike

derrick 01-04-2008 10:44 AM

Re: Validation onChange
 
Yes and Yes.

There was a conflict on James' site from the addition of the prototype javascript libraries. Once that was corrected, the message issue was resolved.

We went on to create a "dynamic option" module that would add/remove options based on the rules you define in the xcart admin section for that particular product. In James' example, if you put an exception rule in stating that you can't have a "hoodie" and a color "pink", then those two options would never be presented to the customer.

The work was custom contracted work done for James by myself. It is all javascript code that manipulates the DOM based upon the selected options.

I have reworked it and cleaned it up a little from this point, but it will give you the idea. I am not building this as a general module, but will do the work custom for a customers site if you are interested.

-Derrick

Quote:

Originally Posted by Widerimagellc
Was there ever a solution for this? I want to be able to have customers select the first option and other options appear/disappear based on their first selection. Not all options will be linked as the selections will be universal, but as an example, if someone selects "Add Text" a text box will appear for their input. Also, if they choose a particular size, another option further down will change its drop down options to include different selections.

Is this possible via javascript or what is the best way to make this happen for a particular product, I don't want the page to have to re-load or them to have to wait until the pushing add-to-cart. Any and all help would be most apprecaited!

Thanks!

Mike


golfland 01-17-2008 10:04 PM

Re: Validation onChange
 
Quote:

Originally Posted by derrick
Yes and Yes.


The work was custom contracted work done for James by myself. It is all javascript code that manipulates the DOM based upon the selected options. I think I still have an early demo put up at http://derrickknight.com/xcart

I have reworked it and cleaned it up a little from this point, but it will give you the idea. I am not building this as a general module, but will do the work custom for a customers site if you are interested.

-Derrick

I am very interested in this. How much would you charge for the dynamic options script? Do you have a demo I can see?

derrick 01-26-2008 12:55 PM

Re: Validation onChange
 
I'll send you a PM. I took the demo down when I moved hosting providers recently. I will put another demo up shortly. I have also made a few modifications to ensure proper operation with any variety of jquery, prototype, etc javascript libraries.

I do not sell this as a module or script simply for the reason that everyone seems to have some modification done to their site related to product or product options. It is much easier for me to just adjust as necessary if it is encountered. That is why I will need to take a quick look at the target site and then I'll contact you with a price for integration into your site.

This code was written to leverage the existing X-Cart product option exceptions. When this code is installed, it dynamically adds/removes options based upon the exceptions already entered into the existing product option exception tables. The options are dynamically updated as various choices are made. This does work with variants and price modifiers. Customers have built some pretty elaborate models with tons of variants and lots of combinations.

-Derrick

Quote:

Originally Posted by golfland
I am very interested in this. How much would you charge for the dynamic options script? Do you have a demo I can see?



All times are GMT -8. The time now is 06:40 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.