本文整理汇总了PHP中field::renderFields方法的典型用法代码示例。如果您正苦于以下问题:PHP field::renderFields方法的具体用法?PHP field::renderFields怎么用?PHP field::renderFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类field
的用法示例。
在下文中一共展示了field::renderFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($module = array())
{
self::$item_id++;
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
if (!empty($this->setting['customer_group']) && !in_array($customer_group_id, $this->setting['customer_group'])) {
return;
} elseif (!$this->setting['guest_checkout'] && !$this->customer->isLogged()) {
return;
} elseif (!is_null($this->setting['autch_checkout']) && !$this->setting['autch_checkout'] && $this->customer->isLogged()) {
return;
}
$template_info = $this->getTemplate($module['template_id']);
if (!$template_info) {
return;
}
if (!array_key_exists('store', $template_info) || !in_array($this->config->get('config_store_id'), $template_info['store'])) {
return;
}
if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/product') {
if (isset($this->request->get['product_id'])) {
$product_id = $this->request->get['product_id'];
} else {
$product_id = 0;
}
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
$this->data['type'] = '1';
} else {
return;
// product not found
}
} elseif (!$this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {
return;
// cart empty
} else {
$this->data['type'] = '0';
}
$position = in_array($module['position'], array('column_left', 'column_right')) ? 'sidebar' : 'content';
$key = implode(id::$separator, array($module['template_id'], $this->data['type'], (int) ($position == 'content'), self::$item_id, $module['layout_id']));
oc::registry()->message->data['form_id'] = $this->data['form_id'] = $this->form_id = id::encode($key);
$this->language->load('module/quick_order_pro');
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
$this->doCreateOrder($this->request->post);
if ($template_info['redirect']) {
$redirect = $this->url->link('checkout/success');
} else {
$redirect = $this->request->server['HTTP_REFERER'];
message::setState('success', $template_info['success_message'], $this->form_id, 'success');
$this->session->data['quick_order_pro_success'][$this->form_id] = $template_info['success_message'];
}
$this->redirect($redirect);
}
$this->data['total'] = false;
$this->data['fields'] = field::renderFields($template_info['fields']);
if ($this->data['type'] == '1') {
// product
if ($product_info['quantity'] <= 0 && !$template_info['stock_checkout']) {
return;
}
$this->data['product_info'] = array('name' => $product_info['name'], 'option' => array(), 'quantity' => $product_info['minimum']);
if ($template_info['use_option'] && $template_info['show_option']) {
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
if (in_array($option['type'], array('text', 'textarea', 'date', 'datetime', 'time')) && !empty($option['option_value'])) {
$this->data['product_info']['option'][] = array('name' => $option['name'], 'value' => utf8_strlen($option['option_value']) > 20 ? utf8_substr($option['option_value'], 0, 20) . '..' : $option['option_value']);
}
}
}
if ($template_info['show_total']) {
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$total = $product_info['price'];
}
if ((double) $product_info['special']) {
$total = $product_info['special'];
}
$quantity = $product_info['minimum'];
if ($total && $quantity) {
$this->data['total'] = $this->currency->format($this->calculateTax($total, $quantity, $product_info['tax_class_id']));
}
}
} else {
if ($template_info['show_total']) {
// Totals
$this->load->model('setting/extension');
$total_data = array();
$total = 0;
$taxes = $this->cart->getTaxes();
// Display prices
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$sort_order = array();
$results = $this->model_setting_extension->getExtensions('total');
foreach ($results as $key => $value) {
$sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
}
array_multisort($sort_order, SORT_ASC, $results);
foreach ($results as $result) {
//.........这里部分代码省略.........