oc-mall-plugin
oc-mall-plugin copied to clipboard
Can't delete Payment Method
Hello. Mall 3.2.1. I click delete payment method, I get the message "Deleted selected records", but nothing happens. No errors. Thanks.
Hello,
Strange. I tried it myself and was able to delete everything without any issues, even the default payment option.
Is there perhaps an error written in the storage/log/system.log
file? It's best to empty this file and perform the operation again so that there are no overlaps with other errors.
Which DB System / OctoberCMS version are you using?
Sincerely,
Sam.
Hello,
closing this issue for now. Please update to the latest version, and if the error occur again, please re-open this issue and check out your storage/log/system.log
file.
Thanks.
~ Sam.
Hi @SamBrishes
OCMS 3.6.22. Mall 3.3.1.
It's nuts, but I still have this issue. See video
I have all my debug flags on, but no errors at all.
I've added trace logs in the 2 methods below for OFFLINE\Mall\Models\PaymentMethod
, so something is kicking in, but the deleted_at columns are still empty.
See Trait SoftDelete - I noticed the model was missing protected $dates = ['deleted_at'];
- i tried adding this but it makes no difference.
What to do? I guess I can just manually update the deleted_at date for now. Thanks.
public function beforeDelete()
{
trace_log(__METHOD__);
trace_log(post());
}
/**
* Hook after model has been deleted.
* @return void
*/
public function afterDelete()
{
trace_log(__METHOD__);
DB::table('offline_mall_prices')
->where('priceable_type', self::MORPH_KEY)
->where('priceable_id', $this->id)
->delete();
}
[2024-06-05 09:20:18] development.INFO: OFFLINE\Mall\Models\PaymentMethod::beforeDelete
[2024-06-05 09:20:18] development.INFO: Array
(
[checked] => Array
(
[0] => 7
)
)
[2024-06-05 09:20:18] development.INFO: OFFLINE\Mall\Models\PaymentMethod::afterDelete
Hello,
After a little code deep dive I found the error. The used method of Octobers SoftDeletes
trait creates a completely new query (instead of using the model itself) whereupon the is_enabled
statement is automatically added again and thus of course prevents disabled elements from being deleted.
No idea why it worked for me sometimes, but now it should work in general.
Anyways. fix is in next branch, should be part of 3.3.2
Sincerely,
Sam.
Excellent sleuthing @SamBrishes I'll confirm if it works for me next update.
Yip. Working for me.