Closed jasperzeinstra closed 5 years ago
Hey @jasperzeinstra,
We're taking a look at this during our current sprint. I'll update again once we've investigated. From a quick initial glance, I can't see why this plugin is required at all.
Simon
This has now been released in v3.0.3.
There's a big bug in de the plugin
\Dotdigitalgroup\Email\Plugin\CouponPlugin::afterUpdateSpecificCoupons
. It saves the$subject
by using the values of the$rule
.$subject
is the coupon record,$rule
is the sales rule record.How to reproduce
salesrule_coupon
in the databaseID 1
("Buy 3 tee shirts and get the 4th free")Specific coupon
and checkUse Auto Generation
salesrule_coupon
coupon_id = 1
has changed, but this coupon is connected torule_id = 4
. But we savedrule_id = 1
.\Dotdigitalgroup\Email\Plugin\CouponPlugin::afterUpdateSpecificCoupons
where data of rule object is used to save coupon object.generated_by_dotmailer
to be set to1
.From my point of view you should check if DotMailer is enabled. There's a helper being defined in the constructer method, but it's not being used in the class. And you should not change the rule, but only the coupon.
If you take a look at how they save date for the coupon in
\Magento\SalesRule\Model\ResourceModel\Coupon::updateSpecificCoupons
you'll notice that they use theupdate
method. So I think it's also better to use this code in the plugin of DotMailer