Skip to content

Commit 1ae960e

Browse files
committed
Support deleted promo codes when loading a purchase
1 parent 69a38c9 commit 1ae960e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

classes/Kohana/Jam/Behavior/Promotable/Purchase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ public function model_after_load(Model_Purchase $purchase)
3838
{
3939
if ($purchase->promo_code_id)
4040
{
41-
$purchase->retrieved('promo_code_text', $purchase->promo_code->code);
41+
$promo_code = Jam_Behavior_Paranoid::with_filter(
42+
Jam_Behavior_Paranoid::ALL,
43+
function () use ($purchase) {
44+
return $purchase->promo_code;
45+
}
46+
);
47+
$purchase->retrieved('promo_code_text', $promo_code->code);
4248
}
4349
}
4450

0 commit comments

Comments
 (0)