item options as a list
Posted: 13 July 2010 07:04 PM
[ Ignore ]
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
Is there a way to list item_options rather than select or input?
Basically I have a client who is very picky about design and wants some special styling on a dropdown.
Thanks
[ Edited: 13 July 2010 08:19 PM by lisa ]
Posted: 14 July 2010 01:51 AM
[ Ignore ]
[ # 1 ]
Administrator
Total Posts: 8342
Joined 2008-09-29
you want to output them as a UL list element?
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Posted: 14 July 2010 01:56 AM
[ Ignore ]
[ # 2 ]
Administrator
Total Posts: 8342
Joined 2008-09-29
If your item_option field name is “product_size”
{product_size} Whatever whatever < input name = "item_option[product_size]" /> {option_name} $ {price} {option} < br /> { / product_size}
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Posted: 14 July 2010 02:04 AM
[ Ignore ]
[ # 3 ]
Administrator
Total Posts: 8342
Joined 2008-09-29
Use the field name as a variable pair. there are 3 variables available within that variable pair; option_name, price, option.
{product_size : label} has {product_size : option_count} options available {if product_size : option_count} {product_size} Whatever whatever < input name = "item_option[product_size]" /> {option_name} $ {price} {option} < br /> { / product_size} { / if}
There are also 2 pseudo variables that can be used anywhere in your weblog entries loops: YOUR_FIELD_NAME:option_count, and YOUR_FIELD_NAME:label. I believe you could have used YOUR_FIELD_NAME:option_count the other day… I forgot we even had that one. Man, I really need to go over our documentation with a fine tooth comb. Real world use has shown us some holes.
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Posted: 14 July 2010 06:58 AM
[ Ignore ]
[ # 4 ]
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
UL list would be idea…then I can do a suckerfish like dropdown maybe?
Chris you guys are doing a great job, real world testing is hard!
Posted: 22 July 2010 01:14 PM
[ Ignore ]
[ # 5 ]
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
Right now I have this:
{item_options : select : options} < option value = "{option}" > {option_name} {price} </ option > { / item_options : select : options}
and it works great as a normal dropdown.
How would I edit it to use <ul><li> tags to do a suckerfish like dropdown?
Posted: 22 July 2010 03:19 PM
[ Ignore ]
[ # 6 ]
Administrator
Total Posts: 8342
Joined 2008-09-29
< ul > {options} < li class= "my_options" id = "{option}" > {option_name} {price} </ li > { / options} </ ul > < input id = "my_id_whatevs" type = "hidden" name = "item_options[options]" value = "" />
You’d have to use jQuery/javascript to then set a hidden input field somewhere based on what’s clicked.
jQuery ( document ). ready (function($) { $( ".my_options" ). click (function() { var selected_value =$( this ). attr ( "id" ); $( "#my_id_whatevs" ). val ( selected_value ); } } );
Something like that anyway.
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Posted: 22 July 2010 04:20 PM
[ Ignore ]
[ # 7 ]
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
hrm and if i wanted to list I could do that too, with quantity fields next to each? —just checking
Posted: 22 July 2010 05:00 PM
[ Ignore ]
[ # 8 ]
Administrator
Total Posts: 8342
Joined 2008-09-29
You want to get the quantity of each option?
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Posted: 22 July 2010 05:04 PM
[ Ignore ]
[ # 9 ]
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
yes.—or is that a multi add to cart—but it really isn’t different products, just variations of the one product.
Administrator
Total Posts: 8342
Joined 2008-09-29
add_to_cart_form only works on adding one item at a time. Only one variation at a time. With multi_add_to_cart form you can add multiple products
{exp : cartthrob : multi_add_to_cart_form return= "cart/view_cart" } {exp : weblog : entries weblog = "products" category = "10" } < input type = "hidden" name = "entry_id[{count}]" value = "{entry_id}" /> < input type = "text" name = "quantity[{count}]" value = "1" /> < input type = "text" name = "item_options[{count}][option_name]" value = "whatevs" /> { / exp : weblog : entries} { / exp : cartthrob : multi_add_to_cart_form}
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
but—what if its one product with multiple variations—and I want to do multiple quantities of each variation?
Administrator
Total Posts: 8342
Joined 2008-09-29
I would think the same as above… but maybe you have something else in mind. Do you have a comp of what you want the user experience to be?
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
we are actually going back to the suckerfish dropdown thingie…much like this comp
Image Attachments
Click thumbnail to see full-size image
Administrator
Total Posts: 8342
Joined 2008-09-29
it looks like you wouldn’t be adding more than one item at a time to the cart… just one configured item with quantity. right?
You might be interested in some sample ajax stuff we have: http://www.cartthrob.net/ajax_examples/add_to_cart
Signature
NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit
Has a Nice Profile
Total Posts: 173
Joined 2010-04-08
Yep…I don’t know if they even need to add more than one thing at a time. I just need to be able to do that dropdown thing.
LOVE the example though!!!