Skip to content

Commit 77c0e12

Browse files
committed
Reset status on unsent orders when setting first order ID
1 parent ccbc945 commit 77c0e12

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

upload/admin/controller/extension/module/webwinkelkeur.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function index() {
6565

6666
$new_settings = $this->cleanSettings($form_data);
6767
$this->editSettings($new_settings);
68+
$this->fixUnsentOrders($new_settings['store_id'], $new_settings['invite_first_order_id']);
6869
$this->response->redirect($this->link($path_extensions));
6970
}
7071
}
@@ -280,4 +281,20 @@ private function link($action, array $params = []) {
280281
return $this->url->link($action, http_build_query($params), true);
281282
}
282283

284+
private function fixUnsentOrders($store_id, $first_order_id) {
285+
if (!(int) $first_order_id) {
286+
return;
287+
}
288+
289+
$this->db->query("
290+
UPDATE `" . DB_PREFIX . "order`
291+
SET
292+
webwinkelkeur_invite_sent = 0
293+
WHERE
294+
webwinkelkeur_invite_sent = 1
295+
AND webwinkelkeur_invite_tries = 0
296+
AND order_id >= " . (int) $first_order_id . "
297+
");
298+
}
299+
283300
}

upload/admin/view/template/extension/module/webwinkelkeur.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
</span>
151151
</label>
152152
<div class="col-sm-10">
153-
<input type="number" required size="2" class="form-control"
153+
<input type="number" required min="1" size="2" class="form-control"
154154
value="<?= $store['settings']['invite_first_order_id']; ?>"
155155
name="store[invite_first_order_id]">
156156
</div>

0 commit comments

Comments
 (0)