本文整理汇总了PHP中TaxRulesGroup::getAssociatedTaxRatesByIdCountry方法的典型用法代码示例。如果您正苦于以下问题:PHP TaxRulesGroup::getAssociatedTaxRatesByIdCountry方法的具体用法?PHP TaxRulesGroup::getAssociatedTaxRatesByIdCountry怎么用?PHP TaxRulesGroup::getAssociatedTaxRatesByIdCountry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaxRulesGroup
的用法示例。
在下文中一共展示了TaxRulesGroup::getAssociatedTaxRatesByIdCountry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayFormInformations
//.........这里部分代码省略.........
}
// check if download directory is writable
?>
</div>
</td>
</tr>
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
<script type="text/javascript">
if ($('#is_virtual_good').attr('checked'))
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
}
</script>
<?php
echo '
<tr>
<td class="col-left">' . $this->l('Pre-tax wholesale price:') . '</td>
<td style="padding-bottom:5px;">
' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" name="wholesale_price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'wholesale_price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
<span style="margin-left:10px">' . $this->l('The wholesale price at which you bought this product') . '</span>
</td>
</tr>';
echo '
<tr>
<td class="col-left">' . $this->l('Pre-tax retail price:') . '</td>
<td style="padding-bottom:5px;">
' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<sup> *</sup>
<span style="margin-left:2px">' . $this->l('The pre-tax retail price to sell this product') . '</span>
</td>
</tr>';
$tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
$taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getDefaultCountryId());
$ecotaxTaxRate = Tax::getProductEcotaxRate();
echo '<script type="text/javascript">';
echo 'noTax = ' . (Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n";
echo 'taxesArray = new Array ();' . "\n";
echo 'taxesArray[0] = 0', ";\n";
foreach ($tax_rules_groups as $tax_rules_group) {
$tax_rate = array_key_exists($tax_rules_group['id_tax_rules_group'], $taxesRatesByGroup) ? $taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']] : 0;
echo 'taxesArray[' . $tax_rules_group['id_tax_rules_group'] . ']=' . $tax_rate . "\n";
}
echo '
ecotaxTaxRate = ' . $ecotaxTaxRate / 100 . ';
</script>';
echo '
<tr>
<td class="col-left">' . $this->l('Tax rule:') . '</td>
<td style="padding-bottom:5px;">
<span ' . (Tax::excludeTaxeOption() ? 'style="display:none;"' : '') . '>
<select onChange="javascript:calcPriceTI(); unitPriceWithTax(\'unit\');" name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
<option value="0">' . $this->l('No Tax') . '</option>';
foreach ($tax_rules_groups as $tax_rules_group) {
echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($tax_rules_group['name']) . '</option>';
}
echo '</select>
<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token=' . Tools::getAdminToken('AdminTaxRulesGroup' . (int) Tab::getIdFromClassName('AdminTaxRulesGroup') . (int) $cookie->id_employee) . '&id_product=' . (int) $obj->id . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a></span>
';
if (Tax::excludeTaxeOption()) {
echo '<span style="margin-left:10px; color:red;">' . $this->l('Taxes are currently disabled') . '</span> (<b><a href="index.php?tab=AdminTaxes&token=' . Tools::getAdminToken('AdminTaxes' . (int) Tab::getIdFromClassName('AdminTaxes') . (int) $cookie->id_employee) . '">' . $this->l('Tax options') . '</a></b>)';
echo '<input type="hidden" value="' . (int) $this->getFieldValue($obj, 'id_tax_rules_group') . '" name="id_tax_rules_group" />';
}
echo '</td>
</tr>
示例2: _postValidation
/**
* @brief Validate Method
*
* @return update the module depending on klarna webservices
*/
private function _postValidation()
{
$klarna = new Klarna();
if ($_POST['klarna_mod'] == 'live') {
Configuration::updateValue('KLARNA_MOD', Klarna::LIVE);
} else {
Configuration::updateValue('KLARNA_MOD', Klarna::BETA);
}
if (isset($_POST['klarna_active_invoice']) && $_POST['klarna_active_invoice']) {
Configuration::updateValue('KLARNA_ACTIVE_INVOICE', true);
} else {
Configuration::deleteByName('KLARNA_ACTIVE_INVOICE');
}
if (isset($_POST['klarna_active_partpayment']) && $_POST['klarna_active_partpayment']) {
Configuration::updateValue('KLARNA_ACTIVE_PARTPAYMENT', true);
} else {
Configuration::deleteByName('KLARNA_ACTIVE_PARTPAYMENT');
}
if (isset($_POST['klarna_email']) && $_POST['klarna_email']) {
Configuration::updateValue('KLARNA_EMAIL', true);
} else {
Configuration::deleteByName('KLARNA_EMAIL');
}
foreach ($this->countries as $country) {
Db::getInstance()->delete(_DB_PREFIX_ . 'klarna_payment_pclasses', 'country = "' . (int) $country['code'] . '"');
Configuration::updateValue('KLARNA_STORE_ID_' . $country['name'], null);
Configuration::updateValue('KLARNA_SECRET_' . $country['name'], null);
}
foreach ($this->countries as $key => $country) {
if (isset($_POST['activate' . $country['name']])) {
$storeId = (int) Tools::getValue('klarnaStoreId' . $country['name']);
$secret = pSQL(Tools::getValue('klarnaSecret' . $country['name']));
if ($storeId > 0 && $secret == '' || $storeId <= 0 && $secret != '') {
$this->_postErrors[] = $this->l('your credentials are incorrect and can\'t be used in ') . $country['name'];
} elseif ($storeId >= 0 && $secret != '') {
$error = false;
try {
$klarna->config($storeId, Tools::safeOutput($secret), $country['code'], $country['langue'], $country['currency'], Configuration::get('KLARNA_MOD'), 'mysql', $this->_getDb());
$PClasses = $klarna->fetchPClasses($country['code']);
} catch (Exception $e) {
$error = true;
$this->_postErrors[] = (int) $e->getCode() . ': ' . Tools::safeOutput($e->getMessage());
}
if (!$error) {
Configuration::updateValue('KLARNA_STORE_ID_' . $country['name'], $storeId);
Configuration::updateValue('KLARNA_SECRET_' . $country['name'], $secret);
Configuration::updateValue('KLARNA_INVOICE_FEE_' . $country['name'], (double) Tools::getValue('klarnaInvoiceFee' . $country['name']));
Configuration::updateValue('KLARNA_MINIMUM_VALUE_' . $country['name'], (double) Tools::getValue('klarnaMinimumValue' . $country['name']));
Configuration::updateValue('KLARNA_MAXIMUM_VALUE_' . $country['name'], $_POST['klarnaMaximumValue' . $country['name']] != 0 ? (double) Tools::getValue('klarnaMaximumValue' . $country['name']) : 99999);
$id_product = Db::getInstance()->getValue('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `name` = \'invoiceFee' . $country['name'] . '\'');
$taxeRules = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getByIso($key));
$maxiPrice = 0;
$idTaxe = 0;
foreach ($taxeRules as $key => $val) {
if ((int) $val > $maxiPrice) {
$maxiPrice = (int) $val;
$idTaxe = $key;
}
}
if ($id_product != null) {
$productInvoicefee = new Product((int) $id_product);
$productInvoicefee->price = (double) Tools::getValue('klarnaInvoiceFee' . $country['name']);
if (_PS_VERSION_ >= 1.5) {
StockAvailable::setProductOutOfStock((int) $productInvoicefee->id, true, null, 0);
}
if ($idTaxe != 0) {
$productInvoicefee->id_tax_rules_group = (int) $idTaxe;
}
$productInvoicefee->update();
} else {
$productInvoicefee = new Product();
$productInvoicefee->out_of_stock = 1;
$productInvoicefee->available_for_order = true;
$productInvoicefee->id_category_default = 2;
if ($idTaxe != 0) {
$productInvoicefee->id_tax_rules_group = (int) $idTaxe;
}
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
$productInvoicefee->name[$language['id_lang']] = 'invoiceFee' . $country['name'];
$productInvoicefee->link_rewrite[$language['id_lang']] = 'invoiceFee' . $country['name'];
}
$productInvoicefee->price = (double) Tools::getValue('klarnaInvoiceFee' . $country['name']);
if (_PS_VERSION_ >= 1.5) {
$productInvoicefee->active = false;
}
$productInvoicefee->add();
if (_PS_VERSION_ >= 1.5) {
StockAvailable::setProductOutOfStock((int) $productInvoicefee->id, true, null, 0);
}
}
Configuration::updateValue('KLARNA_INV_FEE_ID_' . $country['name'], $productInvoicefee->id);
$this->_postValidations[] = $this->l('Your account has been updated to be used in ') . $country['name'];
}
$error = false;
//.........这里部分代码省略.........