本文整理汇总了PHP中SpecificPrice::getPriority方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecificPrice::getPriority方法的具体用法?PHP SpecificPrice::getPriority怎么用?PHP SpecificPrice::getPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecificPrice
的用法示例。
在下文中一共展示了SpecificPrice::getPriority方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getScoreQuery
protected static function _getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group)
{
$select = '(IF (NOW() >= `from` AND NOW() <= `to`, 1, 0) + ';
foreach (array_reverse(SpecificPrice::getPriority((int) $id_product)) as $k => $field) {
if ($field != 'id_shop') {
$select .= ' IF (`' . bqSQL($field) . '` = ' . (int) ${$field} . ', ' . pow(2, $k + 1) . ', 0) + ';
}
}
return rtrim($select, ' +') . ') `score`';
}
示例2: _getScoreQuery
protected static function _getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group)
{
$select = '(';
$now = date('Y-m-d H:i:s');
$select .= ' IF (\'' . $now . '\' >= `from` AND \'' . $now . '\' <= `to`, ' . pow(2, 0) . ', 0) + ';
$priority = SpecificPrice::getPriority($id_product);
foreach (array_reverse($priority) as $k => $field) {
$select .= ' IF (`' . $field . '` = ' . (int) ${$field} . ', ' . pow(2, $k + 1) . ', 0) + ';
}
return rtrim($select, ' +') . ') AS `score`';
}
示例3: _displaySpecificPriceModificationForm
protected function _displaySpecificPriceModificationForm($defaultCurrency, $shops, $currencies, $countries, $groups)
{
$lpdesmvcrvu = "specific_price_priorities";
${"GLOBALS"}["gwvlvnhgf"] = "group";
$plkmtiqjex = "specific_price_priorities";
${"GLOBALS"}["ertbhqqwavl"] = "tmp";
${"GLOBALS"}["glybiybrjmv"] = "group";
${"GLOBALS"}["nihfjn"] = "tmp";
$ivhgohevles = "taxRate";
${${"GLOBALS"}["nkvjzc"]} = "";
${"GLOBALS"}["ukanssy"] = "currencies";
if (!$this->object) {
return;
}
${"GLOBALS"}["tfufwuqnbgxc"] = "tmp";
${${"GLOBALS"}["ixsaqwcye"]} = SpecificPrice::getByProductId((int) $this->object->id);
$rarsexno = "shop";
$vrcmtksat = "shop";
$gedaion = "specific_price_priorities";
${"GLOBALS"}["xsrbwsm"] = "shops";
${$lpdesmvcrvu} = SpecificPrice::getPriority((int) $this->object->id);
${$ivhgohevles} = $this->object->getTaxesRate(Address::initialize());
$uhzkmfbqi = "shop";
$ahuedic = "specific_price_priorities";
${${"GLOBALS"}["bdtyklee"]} = array();
foreach (${${"GLOBALS"}["xsrbwsm"]} as ${$uhzkmfbqi}) {
${${"GLOBALS"}["bdtyklee"]}[${$rarsexno}["id_shop"]] = ${$vrcmtksat};
}
$rbdspr = "currencies";
${"GLOBALS"}["ruiubiwy"] = "countries";
$nyuyhmkcene = "content";
${${"GLOBALS"}["lazfnitt"]} = ${${"GLOBALS"}["bdtyklee"]};
$hcdvvpbef = "tmp";
$wdrtujtw = "currency";
${${"GLOBALS"}["nihfjn"]} = array();
foreach (${$rbdspr} as ${${"GLOBALS"}["qwffcfylwvlg"]}) {
${${"GLOBALS"}["bdtyklee"]}[${$wdrtujtw}["id_currency"]] = ${${"GLOBALS"}["qwffcfylwvlg"]};
}
${${"GLOBALS"}["ukanssy"]} = ${${"GLOBALS"}["ertbhqqwavl"]};
${${"GLOBALS"}["tfufwuqnbgxc"]} = array();
foreach (${${"GLOBALS"}["ruiubiwy"]} as ${${"GLOBALS"}["dtehljxk"]}) {
${${"GLOBALS"}["bdtyklee"]}[${${"GLOBALS"}["dtehljxk"]}["id_country"]] = ${${"GLOBALS"}["dtehljxk"]};
}
$tclsxk = "specific_price_priorities";
${${"GLOBALS"}["kroabu"]} = ${${"GLOBALS"}["bdtyklee"]};
${$hcdvvpbef} = array();
foreach (${${"GLOBALS"}["myyouyoez"]} as ${${"GLOBALS"}["gwvlvnhgf"]}) {
${${"GLOBALS"}["bdtyklee"]}[${${"GLOBALS"}["oxbcew"]}["id_group"]] = ${${"GLOBALS"}["glybiybrjmv"]};
}
${"GLOBALS"}["cptxpwqsgzo"] = "content";
${${"GLOBALS"}["myyouyoez"]} = ${${"GLOBALS"}["bdtyklee"]};
if (!is_array(${${"GLOBALS"}["ixsaqwcye"]}) || !count(${${"GLOBALS"}["ixsaqwcye"]})) {
${${"GLOBALS"}["nkvjzc"]} .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=\"13\">" . $this->l('No specific prices') . "</td>\n\t\t\t\t</tr>";
} else {
${"GLOBALS"}["ixvreqo"] = "specific_prices";
${${"GLOBALS"}["eqiehjn"]} = 0;
${"GLOBALS"}["xwjpok"] = "specific_price";
foreach (${${"GLOBALS"}["ixvreqo"]} as ${${"GLOBALS"}["xwjpok"]}) {
${"GLOBALS"}["jgkoendjlpt"] = "specific_price";
$sdpwvfzmwy = "current_specific_currency";
${"GLOBALS"}["drapxqkxjfw"] = "customer_full_name";
${"GLOBALS"}["wrefbrz"] = "specific_price";
$ywnqxjizw = "impact";
$pmhlqxsivhg = "currencies";
${"GLOBALS"}["lnqbpvxxuw"] = "i";
$qndkwpcllv = "specific_price";
${"GLOBALS"}["cfbvjzjfz"] = "specific_price";
${"GLOBALS"}["hyijedlreo"] = "specific_price";
${"GLOBALS"}["bdnvmedpllw"] = "customer_full_name";
${"GLOBALS"}["yonxxgguvyc"] = "shops";
${"GLOBALS"}["brpkiqjctz"] = "specific_price";
${"GLOBALS"}["cubiilo"] = "customer_full_name";
$msgvsejfwpg = "specific_price";
${"GLOBALS"}["ihxryxdypi"] = "groups";
$frcvwum = "rule";
$fpsxqukp = "price";
${"GLOBALS"}["ucfgiwdbfvge"] = "period";
${"GLOBALS"}["pjigladsg"] = "fixed_price";
${"GLOBALS"}["qrcsyna"] = "specific_price";
$nwumqlplzzwc = "specific_price";
$tihycjulltff = "impact";
${$sdpwvfzmwy} = ${$pmhlqxsivhg}[${${"GLOBALS"}["oudwfbvcvoj"]}["id_currency"] ? ${${"GLOBALS"}["cfbvjzjfz"]}["id_currency"] : $defaultCurrency->id];
${"GLOBALS"}["wxttwnsgf"] = "specific_price";
if (${${"GLOBALS"}["oudwfbvcvoj"]}["reduction_type"] == "percentage") {
${$ywnqxjizw} = "- " . ${${"GLOBALS"}["oudwfbvcvoj"]}["reduction"] * 100 . " %";
} elseif (${${"GLOBALS"}["oudwfbvcvoj"]}["reduction"] > 0) {
${${"GLOBALS"}["uaxmvunoy"]} = "- " . Tools::displayPrice(Tools::ps_round(${$nwumqlplzzwc}["reduction"], 2), ${${"GLOBALS"}["lbhedgts"]});
} else {
${$tihycjulltff} = "--";
}
${"GLOBALS"}["nwsoorkiv"] = "impact";
if (${${"GLOBALS"}["jgkoendjlpt"]}["from"] == "0000-00-00 00:00:00" && ${${"GLOBALS"}["oudwfbvcvoj"]}["to"] == "0000-00-00 00:00:00") {
${${"GLOBALS"}["zcpltzs"]} = $this->l('Unlimited');
} else {
${${"GLOBALS"}["zcpltzs"]} = $this->l('From') . " " . (${${"GLOBALS"}["wxttwnsgf"]}["from"] != "0000-00-00 00:00:00" ? ${${"GLOBALS"}["oudwfbvcvoj"]}["from"] : "0000-00-00 00:00:00") . "<br />" . $this->l('To') . " " . (${${"GLOBALS"}["oudwfbvcvoj"]}["to"] != "0000-00-00 00:00:00" ? ${${"GLOBALS"}["oudwfbvcvoj"]}["to"] : "0000-00-00 00:00:00");
}
if (${${"GLOBALS"}["oudwfbvcvoj"]}["id_product_attribute"]) {
${"GLOBALS"}["ysyybwjtlnlr"] = "attributes_name";
$supdob = "attributes_name";
$nwznli = "attribute";
//.........这里部分代码省略.........
示例4: _displaySpecificPriceModificationForm
protected function _displaySpecificPriceModificationForm($defaultCurrency, $shops, $currencies, $countries, $groups)
{
global $currentIndex;
if (!($obj = $this->loadObject())) {
return;
}
$specificPrices = SpecificPrice::getByProductId((int) $obj->id);
$specificPricePriorities = SpecificPrice::getPriority((int) $obj->id);
$default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
$taxRate = TaxRulesGroup::getTaxesRate($obj->id_tax_rules_group, Configuration::get('PS_COUNTRY_DEFAULT'), 0, 0);
$tmp = array();
foreach ($shops as $shop) {
$tmp[$shop['id_shop']] = $shop;
}
$shops = $tmp;
$tmp = array();
foreach ($currencies as $currency) {
$tmp[$currency['id_currency']] = $currency;
}
$currencies = $tmp;
$tmp = array();
foreach ($countries as $country) {
$tmp[$country['id_country']] = $country;
}
$countries = $tmp;
$tmp = array();
foreach ($groups as $group) {
$tmp[$group['id_group']] = $group;
}
$groups = $tmp;
echo '
<h4>' . $this->l('Current specific prices') . '</h4>
<table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="cell border" style="width: 12%;">' . $this->l('Currency') . '</th>
<th class="cell border" style="width: 11%;">' . $this->l('Country') . '</th>
<th class="cell border" style="width: 13%;">' . $this->l('Group') . '</th>
<th class="cell border" style="width: 12%;">' . $this->l('Price') . ' ' . ($default_country->display_tax_label ? $this->l('(tax excl.)') : '') . '</th>
<th class="cell border" style="width: 10%;">' . $this->l('Reduction') . '</th>
<th class="cell border" style="width: 15%;">' . $this->l('Period') . '</th>
<th class="cell border" style="width: 10%;">' . $this->l('From (quantity)') . '</th>
<th class="cell border" style="width: 15%;">' . $this->l('Final price') . ' ' . ($default_country->display_tax_label ? $this->l('(tax excl.)') : '') . '</th>
<th class="cell border" style="width: 2%;">' . $this->l('Action') . '</th>
</tr>
</thead>
<tbody>';
if (!is_array($specificPrices) or !sizeof($specificPrices)) {
echo '
<tr>
<td colspan="9">' . $this->l('No specific prices') . '</td>
</tr>';
} else {
$i = 0;
foreach ($specificPrices as $specificPrice) {
$current_specific_currency = $currencies[$specificPrice['id_currency'] ? $specificPrice['id_currency'] : $defaultCurrency->id];
if ($specificPrice['reduction_type'] == 'percentage') {
$reduction = $specificPrice['reduction'] * 100 . ' %';
} else {
$reduction = Tools::displayPrice(Tools::ps_round($specificPrice['reduction'], 2), $current_specific_currency);
}
if ($specificPrice['from'] == '0000-00-00 00:00:00' and $specificPrice['to'] == '0000-00-00 00:00:00') {
$period = $this->l('Unlimited');
} else {
$period = $this->l('From') . ' ' . ($specificPrice['from'] != '0000-00-00 00:00:00' ? $specificPrice['from'] : '0000-00-00 00:00:00') . '<br />' . $this->l('To') . ' ' . ($specificPrice['to'] != '0000-00-00 00:00:00' ? $specificPrice['to'] : '0000-00-00 00:00:00');
}
echo '
<tr ' . ($i % 2 ? 'class="alt_row"' : '') . '>
<td class="cell border">' . ($specificPrice['id_currency'] ? $currencies[$specificPrice['id_currency']]['name'] : $this->l('All currencies')) . '</td>
<td class="cell border">' . ($specificPrice['id_country'] ? $countries[$specificPrice['id_country']]['name'] : $this->l('All countries')) . '</td>
<td class="cell border">' . ($specificPrice['id_group'] ? $groups[$specificPrice['id_group']]['name'] : $this->l('All groups')) . '</td>
<td class="cell border">' . Tools::displayPrice((double) $specificPrice['price'], $current_specific_currency) . '</td>
<td class="cell border">' . $reduction . '</td>
<td class="cell border">' . $period . '</td>
<td class="cell border">' . $specificPrice['from_quantity'] . '</th>
<td class="cell border"><b>' . Tools::displayPrice(Tools::ps_round((double) $this->_getFinalPrice($specificPrice, (double) $obj->price, $taxRate), 2), $current_specific_currency) . '</b></td>
<td class="cell border"><a href="' . $currentIndex . (Tools::getValue('id_category') ? '&id_category=' . Tools::getValue('id_category') : '') . '&id_product=' . (int) Tools::getValue('id_product') . '&updateproduct&deleteSpecificPrice&id_specific_price=' . (int) $specificPrice['id_specific_price'] . '&token=' . Tools::getValue('token') . '"><img src="../img/admin/delete.gif" alt="' . $this->l('Delete') . '" /></a></td>
</tr>';
$i++;
}
}
echo '
</tbody>
</table>';
echo '
<script type="text/javascript">
var currencies = new Array();
currencies[0] = new Array();
currencies[0]["sign"] = "' . $defaultCurrency->sign . '";
currencies[0]["format"] = ' . $defaultCurrency->format . ';
';
foreach ($currencies as $currency) {
echo '
currencies[' . $currency['id_currency'] . '] = new Array();
currencies[' . $currency['id_currency'] . ']["sign"] = "' . $currency['sign'] . '";
currencies[' . $currency['id_currency'] . ']["format"] = ' . $currency['format'] . ';
';
}
echo '
//.........这里部分代码省略.........
示例5: _getScoreQuery
/**
* score generation for quantity discount
*/
protected static function _getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer)
{
$select = '(';
$priority = SpecificPrice::getPriority($id_product);
foreach (array_reverse($priority) as $k => $field) {
if (!empty($field)) {
$select .= ' IF (`' . bqSQL($field) . '` = ' . (int) ${$field} . ', ' . pow(2, $k + 1) . ', 0) + ';
}
}
return rtrim($select, ' +') . ') AS `score`';
}