在计算产品升级订单时执行。
参数
变量 | 类型 | 注意 |
---|---|---|
oldproductid | int | |
oldproductname | string | |
newproductid | int | |
newproductname | string | |
days | int | |
totaldays | int | |
newproductbillingcycle | string | |
price | float | |
discount | float | |
promoqualifies | bool |
响应
返回要覆盖的参数的任何键 -> 值对。例如返回数组(‘discount’ => 10.00,);
示例代码
<?php
use WHMCS\Carbon;
add_hook('OrderProductUpgradeOverride', 1, function($vars) {
$return = [];
if ($vars['newproductid'] == 15) {
/**
* No promotion should be applied to product 15
*/
$return['promoqualifies'] = false;
}
if (Carbon::now()->toDateString() == '2016-12-25') {
/**
* Offer half price upgrade on Christmas Day
* This can also be done by halving the $vars['price'] and returning that.
*/
$return['totaldays'] = round($vars['totaldays'] / 2);
}
return $return;
});
相关用法
- PHP WHMCS OrderProductPricingOverride用法及代码示例
- PHP WHMCS OrderPaid用法及代码示例
- PHP WHMCS OrderAddonPricingOverride用法及代码示例
- PHP WHMCS OrderDomainPricingOverride用法及代码示例
- PHP WHMCS OrderFraudCheck用法及代码示例
- PHP WHMCS OpenTicket用法及代码示例
- PHP WHMCS OverrideModuleUsernameGeneration用法及代码示例
- PHP WHMCS OverrideOrderNumberGeneration用法及代码示例
- PHP WHMCS ClientAreaPageDownloads用法及代码示例
- PHP Ds\Map isEmpty()用法及代码示例
- PHP PHPUnit assertIsNotFloat()用法及代码示例
- PHP disk_total_space()用法及代码示例
- PHP ReflectionClass getTraitAliases()用法及代码示例
- PHP hash_hmac()用法及代码示例
- PHP String wordwrap()用法及代码示例
- PHP XMLWriter endPi()用法及代码示例
- PHP SimpleXMLElement children()用法及代码示例
- PHP IntlCalendar getTimeZone()用法及代码示例
- PHP SplPriorityQueue isCorrupted()用法及代码示例
- PHP XMLReader::getParserProperty()用法及代码示例
- PHP imagegif()用法及代码示例
- PHP imageresolution()用法及代码示例
- PHP array_reverse()用法及代码示例
- PHP IntlCalendar getActualMinimum()用法及代码示例
- PHP WHMCS DomainGetWhoisInfo用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 OrderProductUpgradeOverride。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。