获取次数优惠券代码用于Magento

bla*_*aps 5 magento

如何获得优惠券代码的使用次数和优惠券代码列表.SalesRule模块中是否提供该信息?

Dan*_*oof 9

是.事实上非常容易:

$coupon = Mage::getModel('salesrule/coupon');
$coupon->load('SOMECOUPONCODE', 'code');
if($coupon->getId()) {
    $timesUsed = $coupon->getTimesUsed();
}
Run Code Online (Sandbox Code Playgroud)