本文整理汇总了PHP中uc_currency_format函数的典型用法代码示例。如果您正苦于以下问题:PHP uc_currency_format函数的具体用法?PHP uc_currency_format怎么用?PHP uc_currency_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uc_currency_format函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$items = \Drupal::service('uc_cart.manager')->get()->getContents();
$paypal_config = $this->config('uc_paypal.settings');
if (empty($items)) {
drupal_set_message($this->t('You do not have any items in your shopping cart.'));
return;
}
list($desc, $subtotal) = _uc_paypal_product_details($items);
$order = Order::create(['uid' => $this->currentUser()->id()]);
$order->save();
$nvp_request = array('METHOD' => 'SetExpressCheckout', 'RETURNURL' => Url::fromRoute('uc_paypal.ec_review', [], ['absolute' => TRUE])->toString(), 'CANCELURL' => Url::fromRoute('uc_cart.cart', [], ['absolute' => TRUE])->toString(), 'AMT' => uc_currency_format($subtotal, FALSE, FALSE, '.'), 'CURRENCYCODE' => $order->getCurrency(), 'PAYMENTACTION' => $paypal_config->get('wpp_cc_txn_type') == 'authorize' ? 'Authorization' : 'Sale', 'DESC' => substr($desc, 0, 127), 'INVNUM' => $order->id() . '-' . REQUEST_TIME, 'REQCONFIRMSHIPPING' => $paypal_config->get('ec_rqconfirmed_addr'), 'BUTTONSOURCE' => 'Ubercart_ShoppingCart_EC_US', 'NOTIFYURL' => Url::fromRoute('uc_paypal.ipn', [], ['absolute' => TRUE])->toString(), 'LANDINGPAGE' => $paypal_config->get('ec_landingpage_style'));
$order->products = $items;
$order->save();
$nvp_response = uc_paypal_api_request($nvp_request, $paypal_config->get('wpp_server'));
if ($nvp_response['ACK'] != 'Success') {
drupal_set_message($this->t('PayPal reported an error: @code: @message', ['@code' => $nvp_response['L_ERRORCODE0'], '@message' => $nvp_response['L_LONGMESSAGE0']]), 'error');
return;
}
$session = \Drupal::service('session');
$session->set('cart_order', $order->id());
$session->set('TOKEN', $nvp_response['TOKEN']);
$sandbox = '';
if (strpos($paypal_config->get('wpp_server'), 'sandbox') > 0) {
$sandbox = 'sandbox.';
}
header('Location: https://www.' . $sandbox . 'paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $session->get('TOKEN'));
exit;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:32,代码来源:EcCartButtonForm.php
示例2: chargeCard
/**
* {@inheritdoc}
*/
protected function chargeCard($order, $amount, $txn_type, $reference = NULL)
{
$user = \Drupal::currentUser();
// cc_exp_month and cc_exp_year are also validated by
// _uc_credit_valid_card_expiration() on the checkout form.
$month = $order->payment_details['cc_exp_month'];
$year = $order->payment_details['cc_exp_year'];
if ($year < 100) {
$year = $year + 2000;
}
// Card is expired at 0:00 on the first day of the next month.
$expiration_date = mktime(0, 0, 0, $month + 1, 1, $year);
// Conditions for failure are described in file documentation block above.
// All other transactions will succeed.
if ($order->payment_details['cc_number'] == '0000000000000000' || isset($order->payment_details['cc_cvv']) && $order->payment_details['cc_cvv'] == '000' || $expiration_date - REQUEST_TIME <= 0 || $amount == 12.34 || $order->billing_first_name == 'Fictitious' || $order->billing_phone == '8675309') {
$success = FALSE;
} else {
$success = TRUE;
}
// The information for the payment is in the $order->payment_details array.
if ($this->configuration['debug']) {
\Drupal::logger('uc_credit')->notice('Test gateway payment details @details.', ['@details' => print_r($order->payment_details, TRUE)]);
}
if ($success) {
$message = $this->t('Credit card charged: @amount', ['@amount' => uc_currency_format($amount)]);
uc_order_comment_save($order->id(), $user->id(), $message, 'admin');
} else {
$message = $this->t('Credit card charge failed.');
uc_order_comment_save($order->id(), $user->id(), $message, 'admin');
}
$result = array('success' => $success, 'comment' => $this->t('Card charged, resolution code: 0022548315'), 'message' => $success ? $this->t('Credit card payment processed successfully.') : $this->t('Credit card charge failed.'), 'uid' => $user->id());
return $result;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:36,代码来源:TestGateway.php
示例3: viewElements
/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items, $langcode)
{
$elements = [];
foreach ($items as $delta => $item) {
$elements[$delta] = array('#markup' => uc_currency_format($item->value));
}
return $elements;
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:11,代码来源:UcPriceFormatter.php
示例4: cartDetails
/**
* {@inheritdoc}
*/
public function cartDetails(OrderInterface $order, array $form, FormStateInterface $form_state)
{
$build['#attached']['library'][] = 'uc_payment_pack/cod.styles';
$build['policy'] = array('#prefix' => '<p>', '#markup' => Html::escape($this->configuration['policy']), '#suffix' => '</p>');
if (($max = $this->configuration['max_order']) > 0 && is_numeric($max)) {
$build['eligibility'] = array('#prefix' => '<p>', '#markup' => $this->t('Orders totalling more than @amount are <b>not eligible</b> for COD.', ['@amount' => uc_currency_format($max)]), '#suffix' => '</p>');
}
if ($this->configuration['delivery_date']) {
$build += $this->deliveryDateForm($order);
}
return $build;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:15,代码来源:CashOnDelivery.php
示例5: render
/**
* {@inheritdoc}
*/
public function render(ResultRow $values)
{
if ($this->options['format'] == 'uc_price') {
$value = $this->getValue($values);
if (is_null($value) || $value == 0 && $this->options['empty_zero']) {
return '';
}
return uc_currency_format($value);
} else {
return parent::render($values);
}
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:15,代码来源:Price.php
示例6: cartDetails
/**
* {@inheritdoc}
*/
public function cartDetails(OrderInterface $order, array $form, FormStateInterface $form_state)
{
$cod_config = \Drupal::config('uc_payment_pack.cod.settings');
$build['policy'] = array('#markup' => '<p>' . $cod_config->get('policy') . '</p>');
if (($max = $cod_config->get('max_order')) > 0 && is_numeric($max)) {
$build['eligibility'] = array('#markup' => '<p>' . t('Orders totalling more than @amount are <b>not eligible</b> for COD.', ['@amount' => uc_currency_format($max)]) . '</p>');
}
if ($cod_config->get('delivery_date')) {
$build += $this->deliveryDateForm($order);
}
return $build;
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:15,代码来源:CashOnDelivery.php
示例7: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $uc_order = NULL)
{
$balance = uc_payment_balance($uc_order);
$form['balance'] = array('#prefix' => '<strong>' . $this->t('Order balance:') . '</strong> ', '#markup' => uc_currency_format($balance));
$form['order_id'] = array('#type' => 'hidden', '#value' => $uc_order->id());
$form['amount'] = array('#type' => 'uc_price', '#title' => $this->t('Check amount'), '#default_value' => $balance);
$form['comment'] = array('#type' => 'textfield', '#title' => $this->t('Comment'), '#description' => $this->t('Any notes about the check, like type or check number.'), '#size' => 64, '#maxlength' => 256);
$form['clear_date'] = array('#type' => 'datetime', '#title' => $this->t('Expected clear date'), '#date_date_element' => 'date', '#date_time_element' => 'none', '#default_value' => DrupalDateTime::createFromTimestamp(REQUEST_TIME));
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Receive check'));
return $form;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:15,代码来源:ReceiveCheckForm.php
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $uc_order = NULL)
{
$balance = uc_payment_balance($uc_order);
$form['balance'] = array('#prefix' => '<strong>' . $this->t('Order balance:') . '</strong> ', '#markup' => uc_currency_format($balance));
$form['order_id'] = array('#type' => 'hidden', '#value' => $uc_order->id());
$form['amount'] = array('#type' => 'uc_price', '#title' => $this->t('Amount'), '#default_value' => $balance);
$form['comment'] = array('#type' => 'textfield', '#title' => $this->t('Comment'), '#description' => $this->t('Any notes about the check, like type or check number.'), '#size' => 64, '#maxlength' => 256);
$form['clear'] = array('#type' => 'fieldset', '#title' => $this->t('Expected clear date'), '#attributes' => array('class' => array('uc-inline-form', 'clearfix')));
$form['clear']['clear_month'] = uc_select_month(NULL, \Drupal::service('date.formatter')->format(REQUEST_TIME, 'custom', 'n'));
$form['clear']['clear_day'] = uc_select_day(NULL, \Drupal::service('date.formatter')->format(REQUEST_TIME, 'custom', 'j'));
$form['clear']['clear_year'] = uc_select_year(NULL, \Drupal::service('date.formatter')->format(REQUEST_TIME, 'custom', 'Y'), \Drupal::service('date.formatter')->format(REQUEST_TIME, 'custom', 'Y'), \Drupal::service('date.formatter')->format(REQUEST_TIME, 'custom', 'Y') + 1);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Receive check'));
return $form;
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:18,代码来源:ReceiveCheckForm.php
示例9: calculate
/**
* Displays the taxes for an order.
*/
function calculate($uc_order)
{
// Fetch the taxes for the order.
$data = uc_cybersource_uc_calculate_tax($uc_order);
// Build an item list for the taxes.
$items = array();
foreach ($data as $tax) {
$items[] = t('@tax: @amount', array('@tax' => $tax['name'], '@amount' => uc_currency_format($tax['amount'])));
}
// Display a message if there are no taxes.
if (empty($items)) {
$items[] = t('No taxes returned for this order.');
}
return array('#theme' => 'item_list', '#items' => $items);
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:18,代码来源:TaxController.php
示例10: testCatalog
/**
* Tests the catalog display and "buy it now" button.
*/
public function testCatalog()
{
$this->drupalLogin($this->adminUser);
$term = $this->createTerm();
$product = $this->createProduct(array('taxonomy_catalog' => array($term->id())));
$this->drupalGet('catalog');
$this->assertTitle('Catalog | Drupal');
$this->assertLink($term->label(), 0, 'The term is listed in the catalog.');
$this->clickLink($term->label());
$this->assertTitle($term->label() . ' | Drupal');
$this->assertLink($product->label(), 0, 'The product is listed in the catalog.');
$this->assertText($product->model->value, 'The product SKU is shown in the catalog.');
$this->assertText(uc_currency_format($product->price->value), 'The product price is shown in the catalog.');
$this->drupalPostForm(NULL, array(), 'Add to cart');
$this->assertText($product->label() . ' added to your shopping cart.');
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:19,代码来源:CatalogTest.php
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $attributes = NULL)
{
$form['attributes'] = array('#type' => 'table', '#header' => array($this->t('Remove'), $this->t('Name'), $this->t('Label'), $this->t('Default'), $this->t('Required'), $this->t('List position'), $this->t('Display')), '#empty' => $this->t('No attributes available.'), '#tabledrag' => array(array('action' => 'order', 'relationship' => 'sibling', 'group' => 'uc-attribute-table-ordering')));
foreach ($attributes as $aid => $attribute) {
$option = isset($attribute->options[$attribute->default_option]) ? $attribute->options[$attribute->default_option] : NULL;
$form['attributes'][$aid]['#attributes']['class'][] = 'draggable';
$form['attributes'][$aid]['remove'] = array('#type' => 'checkbox', '#title' => $this->t('Remove'), '#title_display' => 'invisible');
$form['attributes'][$aid]['name'] = array('#markup' => $attribute->name);
$form['attributes'][$aid]['label'] = array('#type' => 'textfield', '#title' => $this->t('Label'), '#title_display' => 'invisible', '#default_value' => empty($attribute->label) ? $attribute->name : $attribute->label, '#size' => 20);
$form['attributes'][$aid]['option'] = array('#markup' => $option ? $option->name . ' (' . uc_currency_format($option->price) . ')' : $this->t('n/a'));
$form['attributes'][$aid]['required'] = array('#type' => 'checkbox', '#title' => $this->t('Required'), '#title_display' => 'invisible', '#default_value' => $attribute->required);
$form['attributes'][$aid]['ordering'] = array('#type' => 'weight', '#title' => $this->t('List position'), '#title_display' => 'invisible', '#default_value' => $attribute->ordering, '#attributes' => array('class' => array('uc-attribute-table-ordering')));
$form['attributes'][$aid]['display'] = array('#type' => 'select', '#title' => $this->t('Display'), '#title_display' => 'invisible', '#default_value' => $attribute->display, '#options' => _uc_attribute_display_types());
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['save'] = array('#type' => 'submit', '#value' => $this->t('Save changes'));
return $form;
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:21,代码来源:ObjectAttributesFormBase.php
示例12: testProductNodeForm
public function testProductNodeForm()
{
$this->drupalGet('node/add/product');
$fields = array('model[0][value]', 'price[0][value]', 'shippable[value]', 'weight[0][value]', 'weight[0][units]', 'dimensions[0][length]', 'dimensions[0][width]', 'dimensions[0][height]', 'dimensions[0][units]', 'files[uc_product_image_0][]');
foreach ($fields as $field) {
$this->assertFieldByName($field, NULL);
}
$title_key = 'title[0][value]';
$body_key = 'body[0][value]';
// Make a node with those fields.
$edit = array($title_key => $this->randomMachineName(32), $body_key => $this->randomMachineName(64), 'model[0][value]' => $this->randomMachineName(8), 'price[0][value]' => mt_rand(1, 150), 'shippable[value]' => mt_rand(0, 1), 'weight[0][value]' => mt_rand(1, 50), 'weight[0][units]' => array_rand(array('lb' => t('Pounds'), 'kg' => t('Kilograms'), 'oz' => t('Ounces'), 'g' => t('Grams'))), 'dimensions[0][length]' => mt_rand(1, 50), 'dimensions[0][width]' => mt_rand(1, 50), 'dimensions[0][height]' => mt_rand(1, 50), 'dimensions[0][units]' => array_rand(array('in' => t('Inches'), 'ft' => t('Feet'), 'cm' => t('Centimeters'), 'mm' => t('Millimeters'))));
$this->drupalPostForm('node/add/product', $edit, 'Save');
$this->assertText(t('Product @title has been created.', ['@title' => $edit[$title_key]]), 'Product created.');
$this->assertText($edit[$body_key], 'Product body found.');
$this->assertText($edit['model[0][value]'], 'Product model found.');
$this->assertNoUniqueText(uc_currency_format($edit['price[0][value]']), 'Product price found.');
$this->assertText(uc_weight_format($edit['weight[0][value]'], $edit['weight[0][units]']), 'Product weight found.');
$this->assertText(uc_length_format($edit['dimensions[0][length]'], $edit['dimensions[0][units]']), 'Product length found.');
$this->assertText(uc_length_format($edit['dimensions[0][width]'], $edit['dimensions[0][units]']), 'Product width found.');
$this->assertText(uc_length_format($edit['dimensions[0][height]'], $edit['dimensions[0][units]']), 'Product height found.');
$elements = $this->xpath('//body[contains(@class, "uc-product-node")]');
$this->assertEqual(count($elements), 1, 'Product page contains body CSS class.');
// Update the node fields.
$edit = array($title_key => $this->randomMachineName(32), $body_key => $this->randomMachineName(64), 'model[0][value]' => $this->randomMachineName(8), 'price[0][value]' => mt_rand(1, 150), 'shippable[value]' => mt_rand(0, 1), 'weight[0][value]' => mt_rand(1, 50), 'weight[0][units]' => array_rand(array('lb' => t('Pounds'), 'kg' => t('Kilograms'), 'oz' => t('Ounces'), 'g' => t('Grams'))), 'dimensions[0][length]' => mt_rand(1, 50), 'dimensions[0][width]' => mt_rand(1, 50), 'dimensions[0][height]' => mt_rand(1, 50), 'dimensions[0][units]' => array_rand(array('in' => t('Inches'), 'ft' => t('Feet'), 'cm' => t('Centimeters'), 'mm' => t('Millimeters'))));
$this->clickLink('Edit');
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertText(t('Product @title has been updated.', ['@title' => $edit[$title_key]]), 'Product updated.');
$this->assertText($edit[$body_key], 'Updated product body found.');
$this->assertText($edit['model[0][value]'], 'Updated product model found.');
$this->assertNoUniqueText(uc_currency_format($edit['price[0][value]']), 'Updated product price found.');
$this->assertText(uc_weight_format($edit['weight[0][value]'], $edit['weight[0][units]']), 'Product weight found.');
$this->assertText(uc_length_format($edit['dimensions[0][length]'], $edit['dimensions[0][units]']), 'Product length found.');
$this->assertText(uc_length_format($edit['dimensions[0][width]'], $edit['dimensions[0][units]']), 'Product width found.');
$this->assertText(uc_length_format($edit['dimensions[0][height]'], $edit['dimensions[0][units]']), 'Product height found.');
$this->clickLink('Delete');
$this->drupalPostForm(NULL, [], 'Delete');
$this->assertText(t('Product @title has been deleted.', ['@title' => $edit[$title_key]]), 'Product deleted.');
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:38,代码来源:ProductTest.php
示例13: testCartBlock
/**
* Test cart block functionality.
*/
public function testCartBlock()
{
// Test the empty cart block.
$this->drupalGet('');
$this->assertRaw('empty');
$this->assertText('There are no products in your shopping cart.');
$this->assertText('0 Items');
$this->assertText('Total: $0.00');
$this->assertNoLink('View cart');
$this->assertNoLink('Checkout');
// Test the cart block with an item.
$this->addToCart($this->product);
$this->drupalGet('');
$this->assertNoRaw('empty');
$this->assertNoText('There are no products in your shopping cart.');
$this->assertText('1 ×');
$this->assertText($this->product->label());
$this->assertNoUniqueText(uc_currency_format($this->product->price->value));
$this->assertText('1 Item');
$this->assertText('Total: ' . uc_currency_format($this->product->price->value));
$this->assertLink('View cart');
$this->assertLink('Checkout');
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:26,代码来源:CartBlockTest.php
示例14: view
/**
* {@inheritdoc}
*/
public function view(OrderInterface $order, $view_mode)
{
if ($view_mode != 'customer') {
$build['balance'] = array('#markup' => $this->t('Balance: @balance', ['@balance' => uc_currency_format(uc_payment_balance($order))]));
$account = \Drupal::currentUser();
if ($account->hasPermission('view payments')) {
$build['view_payments'] = array('#type' => 'link', '#prefix' => ' (', '#title' => $this->t('View'), '#url' => Url::fromRoute('uc_payments.order_payments', ['uc_order' => $order->id()]), '#suffix' => ')');
}
$method = \Drupal::service('plugin.manager.uc_payment.method')->createFromOrder($order);
$build['method'] = array('#markup' => $this->t('Method: @payment_method', ['@payment_method' => $method->cartReviewTitle()]), '#prefix' => '<br />');
$method_output = $method->orderView($order);
if (!empty($method_output)) {
$build['output'] = $method_output + array('#prefix' => '<br />');
}
} else {
$method = \Drupal::service('plugin.manager.uc_payment.method')->createFromOrder($order);
$build['method'] = array('#markup' => $this->t('Method: @payment_method', ['@payment_method' => $method->cartReviewTitle()]));
$method_output = $method->customerView($order);
if (!empty($method_output)) {
$build['output'] = $method_output + array('#prefix' => '<br />');
}
}
return $build;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:27,代码来源:Payment.php
示例15: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$config = $this->config('uc_store.settings');
$form['store'] = array('#type' => 'vertical_tabs');
$form['basic'] = array('#type' => 'details', '#title' => $this->t('Basic information'), '#group' => 'store');
$form['basic']['uc_store_name'] = array('#type' => 'textfield', '#title' => $this->t('Store name'), '#default_value' => uc_store_name());
$form['basic']['uc_store_email'] = array('#type' => 'email', '#title' => $this->t('E-mail address'), '#size' => 32, '#required' => TRUE, '#default_value' => uc_store_email());
$form['basic']['uc_store_email_include_name'] = array('#type' => 'checkbox', '#title' => $this->t('Include the store name in the "From" line of store e-mails.'), '#description' => $this->t('May not be available on all server configurations. Turn off if this causes problems.'), '#default_value' => $config->get('mail_include_name'));
$form['basic']['uc_store_phone'] = array('#type' => 'tel', '#title' => $this->t('Phone number'), '#default_value' => $config->get('phone'));
$form['basic']['uc_store_fax'] = array('#type' => 'tel', '#title' => $this->t('Fax number'), '#default_value' => $config->get('fax'));
$form['basic']['uc_store_help_page'] = array('#type' => 'textfield', '#title' => $this->t('Store help page'), '#description' => $this->t('The Drupal page for the store help link.'), '#default_value' => $config->get('help_page'), '#size' => 32, '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]));
$form['address'] = array('#type' => 'details', '#title' => $this->t('Store address'), '#group' => 'store');
$form['address']['address'] = array('#type' => 'uc_address', '#default_value' => array('uc_store_street1' => $config->get('address.street1'), 'uc_store_street2' => $config->get('address.street2'), 'uc_store_city' => $config->get('address.city'), 'uc_store_zone' => $config->get('address.zone'), 'uc_store_country' => $form_state->hasValue('uc_store_country') ? $form_state->getValue('uc_store_country') : $config->get('address.country'), 'uc_store_postal_code' => $config->get('address.postal_code')), '#required' => FALSE, '#key_prefix' => 'uc_store');
$form['currency'] = array('#type' => 'details', '#title' => $this->t('Currency format'), '#group' => 'store');
$form['currency']['uc_currency_code'] = array('#type' => 'textfield', '#title' => $this->t('Currency code'), '#description' => $this->t('While not used directly in formatting, the currency code is used by other modules as the primary currency for your site. Enter here your three character <a href=":url">ISO 4217</a> currency code.', [':url' => Url::fromUri('http://en.wikipedia.org/wiki/ISO_4217#Active_codes')->toString()]), '#default_value' => $config->get('currency.code'), '#maxlength' => 3, '#size' => 5);
$form['currency']['example'] = array('#type' => 'textfield', '#title' => $this->t('Current format'), '#value' => uc_currency_format(1000.1234), '#disabled' => TRUE, '#size' => 10);
$form['currency']['uc_currency_sign'] = array('#type' => 'textfield', '#title' => $this->t('Currency sign'), '#default_value' => $config->get('currency.symbol'), '#size' => 10, '#maxlength' => 10);
$form['currency']['uc_sign_after_amount'] = array('#type' => 'checkbox', '#title' => $this->t('Display currency sign after amount.'), '#default_value' => $config->get('currency.symbol_after'));
$form['currency']['uc_currency_thou'] = array('#type' => 'textfield', '#title' => $this->t('Thousands marker'), '#default_value' => $config->get('currency.thousands_marker'), '#size' => 10, '#maxlength' => 10);
$form['currency']['uc_currency_dec'] = array('#type' => 'textfield', '#title' => $this->t('Decimal marker'), '#default_value' => $config->get('currency.decimal_marker'), '#size' => 10, '#maxlength' => 10);
$form['currency']['uc_currency_prec'] = array('#type' => 'select', '#title' => $this->t('Number of decimal places'), '#options' => array(0 => 0, 1 => 1, 2 => 2), '#default_value' => $config->get('currency.precision'));
$form['weight'] = array('#type' => 'details', '#title' => $this->t('Weight format'), '#group' => 'store');
$form['weight']['uc_weight_unit'] = array('#type' => 'select', '#title' => $this->t('Default weight units'), '#default_value' => $config->get('weight.units'), '#options' => array('lb' => $this->t('Pounds'), 'oz' => $this->t('Ounces'), 'kg' => $this->t('Kilograms'), 'g' => $this->t('Grams')));
$form['weight']['uc_weight_thou'] = array('#type' => 'textfield', '#title' => $this->t('Thousands marker'), '#default_value' => $config->get('weight.thousands_marker'), '#size' => 10, '#maxlength' => 10);
$form['weight']['uc_weight_dec'] = array('#type' => 'textfield', '#title' => $this->t('Decimal marker'), '#default_value' => $config->get('weight.decimal_marker'), '#size' => 10, '#maxlength' => 10);
$form['weight']['uc_weight_prec'] = array('#type' => 'select', '#title' => $this->t('Number of decimal places'), '#options' => array(0 => 0, 1 => 1, 2 => 2), '#default_value' => $config->get('weight.precision'));
$form['length'] = array('#type' => 'details', '#title' => $this->t('Length format'), '#group' => 'store');
$form['length']['uc_length_unit'] = array('#type' => 'select', '#title' => $this->t('Default length units'), '#default_value' => $config->get('length.units'), '#options' => array('in' => $this->t('Inches'), 'ft' => $this->t('Feet'), 'cm' => $this->t('Centimeters'), 'mm' => $this->t('Millimeters')));
$form['length']['uc_length_thou'] = array('#type' => 'textfield', '#title' => $this->t('Thousands marker'), '#default_value' => $config->get('length.thousands_marker'), '#size' => 10, '#maxlength' => 10);
$form['length']['uc_length_dec'] = array('#type' => 'textfield', '#title' => $this->t('Decimal marker'), '#default_value' => $config->get('length.decimal_marker'), '#size' => 10, '#maxlength' => 10);
$form['length']['uc_length_prec'] = array('#type' => 'select', '#title' => $this->t('Number of decimal places'), '#options' => array(0 => 0, 1 => 1, 2 => 2), '#default_value' => $config->get('length.precision'));
$form['display'] = array('#type' => 'details', '#title' => $this->t('Display settings'), '#group' => 'store');
$form['display']['uc_customer_list_address'] = array('#type' => 'radios', '#title' => $this->t('Primary customer address'), '#description' => $this->t('Select the address to be used on customer lists and summaries.'), '#options' => array('billing' => $this->t('Billing address'), 'shipping' => $this->t('Shipping address')), '#default_value' => $config->get('customer_address'));
$form['display']['uc_order_capitalize_addresses'] = array('#type' => 'checkbox', '#title' => $this->t('Capitalize address on order screens'), '#default_value' => $config->get('capitalize_address'));
return parent::buildForm($form, $form_state);
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:39,代码来源:StoreSettingsForm.php
示例16: t
[order-shipping-method]
</p>
<p>
<?php
echo t('Products:');
?>
<br />
<?php
foreach ($products as $product) {
?>
- <?php
echo $product->qty;
?>
x <?php
echo $product->title . ' - ' . uc_currency_format($product->price * $product->qty);
?>
<br />
<?php
echo t('Model: ') . $product->model;
?>
<br />
<?php
if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
?>
<?php
foreach ($product->data['attributes'] as $key => $value) {
echo ' ' . $key . ': ' . $value . '<br />';
}
?>
<?php
开发者ID:babyface,项目名称:ubercart,代码行数:31,代码来源:admin.itpl.php
示例17: testAttributeAddToCart
/**
* Tests that product in cart has the selected attribute option.
*/
public function testAttributeAddToCart()
{
for ($display = 0; $display <= 3; ++$display) {
// Set up an attribute.
$data = array('display' => $display);
$attribute = $this->createAttribute($data);
if ($display) {
// Give the attribute an option.
$option = $this->createAttributeOption(array('aid' => $attribute->aid));
}
$attribute = uc_attribute_load($attribute->aid);
// Put the attribute on a product.
$product = $this->createProduct();
uc_attribute_subject_save($attribute, 'product', $product->id(), TRUE);
// Add the product to the cart.
if ($display == 3) {
$edit = array("attributes[{$attribute->aid}][{$option->oid}]" => $option->oid);
} elseif (isset($option)) {
$edit = array("attributes[{$attribute->aid}]" => $option->oid);
} else {
$option = new \stdClass();
$option->name = self::randomMachineName();
$option->price = 0;
$edit = array("attributes[{$attribute->aid}]" => $option->name);
}
$this->addToCart($product, $edit);
$this->assertText("{$attribute->label}: {$option->name}", 'Option selected on cart item.');
$this->assertText(uc_currency_format($product->price->value + $option->price), 'Product has adjusted price.');
}
}
开发者ID:pedrocones,项目名称:hydrotools,代码行数:33,代码来源:AttributeTest.php
示例18: uc_currency_format
</div>
<?php
}
?>
</div>
<div id="product_header">
<font color="#FF7400">
<?php
print $field_heading[0]['view'];
?>
</div>
<div id="buy">
<div id="price">
<font color="#777777">
<?php
print uc_currency_format($node->sell_price);
?>
</div>
<div id="cartButtons">
<font color="#777777">
<?php
// add to cart buttons
?>
<?php
print $node->content['add_to_cart']["#value"];
?>
</div>
</div>
<div id="product_text">
<?php
开发者ID:reasonat,项目名称:heshbonaim,代码行数:31,代码来源:node-product.tpl.php
示例19: user_load
<?php
/**
* @file
* definition of ubercart-funds-account-withdrawals.tpl.php.
*/
$user = user_load($variables['uid']);
$transactions = db_query("SELECT * FROM {ubercart_funds_withdraw_requests} WHERE uid='{$user->uid}' AND status='Pending Approval'");
$methods = ubercart_funds_get_enabled_withdrawal_methods();
/*commerce_funds_get_enabled_withdrawal_methods();*/
$header = array(t('Time'), t('Amount'), t('Method'), t('Status'));
$rows = array();
foreach ($transactions as $transaction) {
$rows[] = array(date('d/m/Y g:i:s A', $transaction->created), uc_currency_format($transaction->amount / 100), $methods[$transaction->method], $transaction->status);
}
print t('<h2>Pending Withdrawals</h2>');
print theme('table', array('header' => $header, 'rows' => $rows));
$transactions = db_query("SELECT * FROM {ubercart_funds_withdraw_requests} WHERE uid='{$user->uid}' AND status!='Pending Approval'");
$header = array(t('Time'), t('Amount'), t('Method'), t('Status'));
$rows = array();
foreach ($transactions as $transaction) {
$rows[] = array(date('d/m/Y g:i:s A', $transaction->created), uc_currency_format($transaction->amount / 100), $methods[$transaction->method], $transaction->status == 'Declined' ? $transaction->status . '<br><br>Reason: ' . $transaction->notes : $transaction->status);
}
print t('<h2>Previous Requests</h2>');
print theme('table', array('header' => $header, 'rows' => $rows));
?>
开发者ID:shannonphillipl,项目名称:Come_Along,代码行数:26,代码来源:ubercart-funds-account-withdrawals.tpl.php
示例20: testTaxDisplay
public function testTaxDisplay()
{
$this->drupalLogin($this->adminUser);
// Enable a payment method for the payment preview checkout pane.
$edit = array('methods[check][status]' => 1);
$this->drupalPostForm('admin/store/config/payment', $edit, t('Save configuration'));
// Create a 20% inclusive tax rate.
$rate = (object) array('name' => $this->randomMachineName(8), 'rate' => 0.2, 'taxed_product_types' => array('product'), 'taxed_line_items' => array(), 'weight' => 0, 'shippable' => 0, 'display_include' => 1, 'inclusion_text' => '');
uc_tax_rate_save($rate);
$this->drupalGet('admin/store/config/taxes');
$this->assertText($rate->name, 'Tax was saved successfully.');
// $this->drupalGet("admin/store/config/taxes/manage/uc_tax_$rate->id");
// $this->assertText(t('Conditions'), 'Rules configuration linked to tax.');
$this->addToCart($this->product);
// Manually step through checkout. $this->checkout() doesn't know about taxes.
$this->drupalPostForm('cart', array(), 'Checkout');
$this->assertText(t('Enter your billing address and information here.'), 'Viewed cart page: Billing pane has been displayed.');
$this->assertRaw($rate->name, 'Tax line item displayed.');
$this->assertRaw(uc_currency_format($rate->rate * $this->product->price->value), 'Correct tax amount displayed.');
// Submit the checkout page.
$edit = $this->populateCheckoutForm();
$this->drupalPostForm('cart/checkout', $edit, t('Review order'));
$this->assertRaw(t('Your order is almost complete.'));
$this->assertRaw($rate->name, 'Tax line item displayed.');
$this->assertRaw(uc_currency_format($rate->rate * $this->product->price->value), 'Correct tax amount displayed.');
// Complete the review page.
$this->drupalPostForm(NULL, array(), t('Submit order'));
$order_ids = \Drupal::entityQuery('uc_order')->condition('delivery_first_name', $edit['panes[delivery][first_name]'])->execute();
$order_id = reset($order_ids);
if ($order_id) {
$this->pass(SafeMarkup::format('Order %order_id has been created', ['%order_id' => $order_id]));
$this->drupalGet('admin/store/orders/' . $order_id . '/edit');
$this->assertTaxLineCorrect($this->loadTaxLine($order_id), $rate->rate, 'on initial order load');
$this->drupalPostForm('admin/store/orders/' . $order_id . '/edit', array(), t('Save changes'));
$this->assertText(t('Order changes saved.'));
$this->assertTaxLineCorrect($this->loadTaxLine($order_id), $rate->rate, 'after saving order');
// Change tax rate and ensure order doesn't change.
$oldrate = $rate->rate;
$rate->rate = 0.1;
$rate = uc_tax_rate_save($rate);
// Save order because tax changes are only updated on save.
$this->drupalPostForm('admin/store/orders/' . $order_id . '/edit', array(), t('Save changes'));
$this->assertText(t('Order changes saved.'));
$this->assertTaxLineCorrect($this->loadTaxLine($order_id), $oldrate, 'after rate change');
// Change taxable products and ensure order doesn't change.
$class = $this->createProductClass();
$rate->taxed_product_types = array($class->getEntityTypeId());
uc_tax_rate_save($rate);
// entity_flush_caches();
$this->drupalPostForm('admin/store/orders/' . $order_id
|
请发表评论