Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created August 22, 2011 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefrosty/1163397 to your computer and use it in GitHub Desktop.
Save thefrosty/1163397 to your computer and use it in GitHub Desktop.
Looking for select array
$product = new Cart66Product();
$setting = new Cart66Setting();
$products = $product->getModels( 'where id>0', 'order by name' );
if ( !empty( $products ) ) {
foreach( $products as $p )
$select_product = array('name' => $p->name, 'value' => $p->itemNumber);
}
$meta_boxes[] = array(
'id' => 'panier_metabox',
'title' => 'Product Settings',
'pages' => array('post'), // post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Select a product',
'desc' => 'You must add your product within the Cart66 "Products" menu before you can select a product from the dropdown.',
'id' => $prefix . '_item_number',
'type' => 'select',
'options' => array(
$select_product
)
),
$product = new Cart66Product();
$products = $product->getModels( 'where id>0', 'order by name' );
if ( !empty( $products ) ) {
foreach( $products as $p )
$select_product = array('name' => $p->name, 'value' => $p->itemNumber);
}
$meta_boxes[] = array(
'id' => 'panier_metabox',
'title' => 'Product Settings',
'pages' => array('post'), // post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Select a product',
'desc' => 'You must add your product within the Cart66 "Products" menu before you can select a product from the dropdown.',
'id' => $prefix . '_item_number',
'type' => 'select',
'options' => array(
$select_product
)
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment