本文整理汇总了PHP中html_helper::select方法的典型用法代码示例。如果您正苦于以下问题:PHP html_helper::select方法的具体用法?PHP html_helper::select怎么用?PHP html_helper::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_helper
的用法示例。
在下文中一共展示了html_helper::select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cpo_multi_product_form
function cpo_multi_product_form($products)
{
if (!is_array($products)) {
return false;
}
$paypal_options = get_option('cpo_settings');
if (!is_array($paypal_options)) {
return false;
}
// gather the data needed for the form and put it into arrays for the html output functions
// gather up the hidden form elements into one array
if (isset($paypal_options['action']) && $paypal_options['action'] != '') {
$form_action = $paypal_options['action'];
unset($paypal_options['action']);
} else {
return false;
}
$hidden_form_inputs = $paypal_options;
foreach ($products as $prod_index => $prod) {
$product_data = get_post_meta($prod->ID, '_cpo_product_data', true);
if ($product_data) {
$product_name = get_the_title($prod->ID);
$hidden_form_inputs['item_name'] = $product_name;
$hidden_form_inputs['item_number'] = $product_data['item_number'];
$hidden_form_inputs['shipping'] = $product_data['shipping'];
$hidden_form_inputs['shipping2'] = $product_data['shipping2'];
if ($product_data['price']) {
$hidden_form_inputs['amount'] = $product_data['price'];
}
// set up the product options data if we have a group_label
if ($product_data['option_group_label']) {
// need a label for the options for the PP form to work
// put all the needed data for the product options into an array
$option_group_label = $product_data['option_group_label'];
// add the hidden data to the $hidden_form_inputs
$hidden_form_inputs['on0'] = $option_group_label;
$product_options = $product_data['product_options'];
// check to see if there is a price set for the first option index.
// if the price is set we will be building an option/price index in the next foreach loop
if ($product_options[0]['price']) {
$hidden_form_inputs['option_index'] = 0;
}
// loop through product_options to remove empty fields
foreach ($product_options as $index => $option) {
if (!$option['label']) {
unset($product_options[$index]);
continue;
}
// create an array for use in the html helper function
$html_select_options[$index]['value'] = $option['label'];
$html_select_options[$index]['text'] = $option['label'] . ' inches';
// if we have a price then we need to add hidden inputs to relate the option labels to the prices in paypal
if ($option['price']) {
$select_index_label = 'option_select' . $index;
$amount_index_label = 'option_amount' . $index;
$label = $option['label'];
$amount = $option['price'];
$hidden_form_inputs[$select_index_label] = $label;
$hidden_form_inputs[$amount_index_label] = $amount;
// append the price to the html select options
$html_select_options[$index]['text'] .= ' - $' . $option['price'];
}
// set the first option to be the selected option in the form
if ($index == 0) {
$html_select_options[$index]['selected'] = true;
}
}
}
// end of the data setup
?>
<form target="paypal" action="<?php
echo $form_action;
?>
" method="post">
<?php
print_input_hidden($hidden_form_inputs);
?>
<tr <?php
if ($prod_index == 0) {
echo ' class="first"';
}
?>
>
<td>
<h4><?php
echo get_the_title($prod->ID);
?>
</h4>
<p class="product-sub-text"><?php
echo $product_data['sub_text'];
?>
</p>
</td>
<td>
<?php
// if we have options set for this product
if ($product_data['option_group_label']) {
// need a label for the options for the PP form to work
$html = new html_helper();
//.........这里部分代码省略.........