Recoomedation for form setup

sinbadsinbad Member
in Help edited October 2008
I'm a modx user and this is my first time setting up a store using modx+foxycart.

I need some corrections/ideas from other people smilier with modx if they don't mind sharing their work.

I'm working on relatively large qty of products and I happen to have several options for each product or category, and they differ from one product to the other.

For example I'm selling both Shirts and Pants, the Shirts sizes are sm||med||lg||xl and the pants has 26||27||28||29||30||31||32||..

I'm not a coder so creating a complete snippet that choose the correct TV depending on the container the product is in is over my capabilities and so it happens that I use phx extensively on the form to display the correct options for each product.

Sticking to the example, for the shirts I have a check box tv for each available size and same goes for the Pants sizes.

in my form I let the user choose it's size like so, this is all inserted in a chunk that will be called only if product fits an if statement.
<option value="Select">Select</option>
[+phx:if=`[*product-sizes-shirts-xs*]`:ne=``:then=`<option value="[*product-sizes-shirts-xs*]">XS</option>`+]
[+phx:if=`[*product-sizes-shirts-sm*]`:ne=``:then=`<option value="[*product-sizes-shirts-sm*]">SM</option>`+]
[+phx:if=`[*product-sizes-shirts-med*]`:ne=``:then=`<option value="[*product-sizes-shirts-med*]">MED</option>`+]
[+phx:if=`[*product-sizes-shirts-lg*]`:ne=``:then=`<option value="[*product-sizes-shirts-lg*]">LG</option>`+]
[+phx:if=`[*product-sizes-shirts-xl*]`:ne=``:then=`<option value="[*product-sizes-shirts-xl*]">XL</option>`+]
[+phx:if=`[*product-sizes-shirts-2xl*]`:ne=``:then=`<option value="[*product-sizes-shirts-2xl*]">2XL</option>`+]
       </select>
Now this is just for the product size, same should repeat for other options as well.

Now though this 'work' and let me display the shopper only with the available sizes I'm thinking maybe it's a little overkill and there is too much PHx processing involved for each page request?
Also creating new options for the future site owner is not going to be anywhere easy so that's another draw back I didn't find solution for yet.

Hope no one fell asleep and can share a tip with me.
Regards,
tom.

can someone
Comments
  • brettbrett FoxyCart Team
    Well, your method certainly works, and depending on what you're looking to do it's certainly doable.

    You could do a TV for "Option 1 Name" and another for "Option 1 Values", leave them both as text inputs, and let the store admin enter whatever they wanted (using the same syntax for the Values).

    Then add a PHx modifier (custom) to parse something like S||M||L||XL||2XL into a bunch of <option> tags (or radio buttons, or whatever). Of course, that makes it a little more difficult for your admin to deal with, but there's almost always a trade off between usability (and idiot-proofing) and flexibility.

    Lots of options, clearly. The method you've described isn't "wrong", by any means. It's just a matter of figuring out what's going to work best for your particular needs. Sorry, that's probably not super helpful.
Sign In or Register to comment.