LemonStand Forum: Product Option: Use 'Name' as a null <option> [SOLVED] - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Product Option: Use 'Name' as a null <option> [SOLVED]

#1 User is offline   jaybee 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 11-January 10
  • LocationCheltenham, UK

Posted 17 January 2012 - 02:48 PM

Any idea how I could somehow grab the option 'name' to use as an initial, null, <option> value, i.e,

<option value="">Colour...</option>


So, grab the option name:
Attached File  Screen shot 2012-01-17 at 22.35.33.png (6.91K)
Number of downloads: 16

To give:
Attached File  Screen shot 2012-01-17 at 22.35.20.png (2.95K)
Number of downloads: 15

Something like:

<?
$optionnames = $option->list_name();

foreach ($optionnames as $optionname):
?>
<option value=""><?= h($optionname) ?>...</option>
<? endforeach ?>

0

#2 User is offline   robertbanh 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 52
  • Joined: 13-July 11

Posted 19 January 2012 - 06:57 AM

Is this what you're trying to do?
http://lemonstandapp...roduct_options/
0

#3 User is offline   jaybee 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 11-January 10
  • LocationCheltenham, UK

Posted 19 January 2012 - 11:35 AM

Hi there,

No. If you read what I have written above carefully, you will see I'm trying to display the option 'name' as a first select menu item -not- the option 'value' as described in the page you have linked to.
0

#4 User is offline   robertbanh 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 52
  • Joined: 13-July 11

Posted 19 January 2012 - 11:43 AM

<select>
<? if ($product->options->count): ?>
	<? foreach ($product->options as $option): ?>
	     <option value=""><?= h($option->name) ?></option>
	<? endforeach ?>
<? endif ?>
</select>

0

#5 User is offline   jaybee 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 11-January 10
  • LocationCheltenham, UK

Posted 19 January 2012 - 12:00 PM

Cheers! I'm not at my station, but will give that a bash when back. Many thanks.
0

#6 User is offline   jaybee 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 11-January 10
  • LocationCheltenham, UK

Posted 20 January 2012 - 04:14 AM

Works great, thanks.


View Postrobertbanh, on 19 January 2012 - 11:43 AM, said:

<select>
<? if ($product->options->count): ?>
	<? foreach ($product->options as $option): ?>
	     <option value=""><?= h($option->name) ?></option>
	<? endforeach ?>
<? endif ?>
</select>


0

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users