本文整理汇总了PHP中CartRule::getCartsRuleByCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CartRule::getCartsRuleByCode方法的具体用法?PHP CartRule::getCartsRuleByCode怎么用?PHP CartRule::getCartsRuleByCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CartRule
的用法示例。
在下文中一共展示了CartRule::getCartsRuleByCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayAjaxSearchCartRuleVouchers
public function displayAjaxSearchCartRuleVouchers()
{
$found = false;
if ($vouchers = CartRule::getCartsRuleByCode(Tools::getValue('q'), (int) $this->context->language->id, true)) {
$found = true;
}
echo Tools::jsonEncode(array('found' => $found, 'vouchers' => $vouchers));
}
示例2: create_split_discount
private static function create_split_discount($amount, $id_customer, $id_currency, $id_carts)
{
${"GLOBALS"}["lpfswanqwex"] = "code";
${"GLOBALS"}["iuztfsobjr"] = "id_customer";
$ezdxpbfeg = "languages";
${"GLOBALS"}["rnwtmfeg"] = "amount";
$wbglpjrhabt = "id_carts";
$wvwcmnzwlplf = "id_currency";
global $cookie;
${${"GLOBALS"}["lpfswanqwex"]} = "split discount-" . ${${"GLOBALS"}["qnutktejfsm"]};
${"GLOBALS"}["rommybk"] = "languages";
${"GLOBALS"}["pjlvntsji"] = "discount";
$zwjuqmhrgn = "timeinfo";
if (CartRule::cartRuleExists(${${"GLOBALS"}["thjhsxt"]})) {
${"GLOBALS"}["mutlcfyzn"] = "cartRuleInfo";
$efjrrcbmmc = "code";
${"GLOBALS"}["dvulqgqhgy"] = "cartRuleInfo";
${${"GLOBALS"}["dvulqgqhgy"]} = CartRule::getCartsRuleByCode(${$efjrrcbmmc}, $cookie->id_lang);
if (!empty(${${"GLOBALS"}["mutlcfyzn"]})) {
${"GLOBALS"}["dutusymn"] = "id_currency";
$ugjhbkcy = "id_customer";
$vhkwbuk = "discount";
${"GLOBALS"}["wtngbnwjou"] = "amount";
${$vhkwbuk} = new CartRule((int) ${${"GLOBALS"}["exnqrgnk"]}[0]["id_cart_rule"]);
$discount->reduction_amount = Tools::ps_round(abs(${${"GLOBALS"}["wtngbnwjou"]}), 2);
$discount->id_customer = ${$ugjhbkcy};
$discount->reduction_currency = ${${"GLOBALS"}["dutusymn"]};
${"GLOBALS"}["lftybruvzf"] = "discount";
$discount->save();
return ${${"GLOBALS"}["lftybruvzf"]};
}
}
${$zwjuqmhrgn} = AgileHelper::getDbDateTime(1, "DAY");
${${"GLOBALS"}["rommybk"]} = Language::getLanguages();
${${"GLOBALS"}["pjlvntsji"]} = new CartRule();
$discount->code = "split discount-" . ${$wbglpjrhabt};
$discount->description = $discount->code;
$discount->id_customer = ${${"GLOBALS"}["iuztfsobjr"]};
$discount->id_group = 0;
$discount->reduction_currency = ${${"GLOBALS"}["lppjvltcyn"]};
$discount->reduction_amount = Tools::ps_round(abs(${${"GLOBALS"}["rnwtmfeg"]}), 2);
$discount->minimum_amount_currency = ${$wvwcmnzwlplf};
$discount->quantity = 1;
$discount->quantity_per_user = 1;
$discount->date_from = ${${"GLOBALS"}["vwwosyf"]}["timenow"];
$discount->date_to = ${${"GLOBALS"}["vwwosyf"]}["newtime"];
$discount->partial_use = 0;
$discount->include_tax = 1;
$discount->active = 1;
$discount->cart_display = 0;
$discount->date_add = ${${"GLOBALS"}["vwwosyf"]}["timenow"];
$discount->date_upd = ${${"GLOBALS"}["vwwosyf"]}["timenow"];
foreach (${$ezdxpbfeg} as ${${"GLOBALS"}["ehrifiqsh"]}) {
$edrgrgkvw = "fields";
$hfpvhmutci = "field";
${${"GLOBALS"}["samttghly"]} = array("name");
$gigicrqhcvtw = "language";
$vuqkbfsbtw = "field";
foreach (${$edrgrgkvw} as ${$vuqkbfsbtw}) {
$discount->{${$hfpvhmutci}}[intval(${$gigicrqhcvtw}["id_lang"])] = $discount->code;
}
}
$discount->save();
return ${${"GLOBALS"}["gwtztyfxho"]};
}