Forums / Templates, Stylesheets, Page Layout / Help with a bit of coding! Alternative to creating drop-down list

Help with a bit of coding! Alternative to creating drop-down list

Locked

Views: 855

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
4 May 2009, 11:14 AM
#1
teaj avatar

teaj

New Zenner

Join Date:
Dec 2007
Location:
South, UK
Posts:
66
Plugin Contributions:
0

Help with a bit of coding! Alternative to creating drop-down list

Hello, I wasnt sure where to post this, hopefully this is the right place.

I am trying to change some coding so I can display a list of available product attributes on the product listing page instead of a drop down box.

I would like to change this code:

$options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_array, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '" size="3"') . "\n"; 

So $options_menu[] becomes a simple text list rather than a drop down box. I am self-taught and dont know too much about php but I have tried using a foreach statement to display the attributes held in $products_options_array but I cant get it to work.

Would anyone have any suggestions?

Thanks!

4 May 2009, 12:12 PM
#2
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Help with a bit of coding! Alternative to creating drop-down list

If it's just a text list, how would the buyer select the attribute they wanted? Radio buttons? If so...

Where that code now says "zen_draw_pull_down_menu", there is a "zen_draw_radio_field" call you could try instead.

Rob

Breakfast: the most important donut of the day.

4 May 2009, 12:32 PM
#3
teaj avatar

teaj

New Zenner

Join Date:
Dec 2007
Location:
South, UK
Posts:
66
Plugin Contributions:
0

Re: Help with a bit of coding! Alternative to creating drop-down list

Thanks for your reply Rob, the list would be just for display purposes - the buyer would still need to go to the product info page to select the attribute.

This is to stop buyers clicking through when their desired size is not available, to pre-warn them we are out of stock in their size. (we have the stock control by attribute set up).

I was thinking about trying the radio buttons as an alternative, but ideally we just need the text not the button!

Cheers

4 May 2009, 6:32 PM
#4
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Help with a bit of coding! Alternative to creating drop-down list

Right. I didn't clue in that it was the listing you were talking about.

I believe there is a mod that allows you to have a separate (I think) short description for use in lists. You could put your text list there. Never tried it, but it may be worth looking at the Short Description mod.

Rob

Breakfast: the most important donut of the day.

5 May 2009, 11:25 AM
#5
teaj avatar

teaj

New Zenner

Join Date:
Dec 2007
Location:
South, UK
Posts:
66
Plugin Contributions:
0

Re: Help with a bit of coding! Alternative to creating drop-down list

Thanks Rob but it's mainly the actual coding I need help with, I know how / where to create my changes....just cant extract the data I need.

The idea is the sizing list will be automatically updated as sizes sell out, rather than manually entering/editing data that would be required with the mod you mention.