summaryrefslogtreecommitdiff
path: root/views/mods/mod_campaigns/conditions_fields.phtml
blob: d122b05e89c6e8b659bb781b047d35b7f4499c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php

	/**
	 * Gemeinsame Auswahl-Felder für Kampagnen-/Template-Bedingungen.
	 * Erwartet $this->view['condition_options'] (id => label je Feld) und
	 * $this->view['condition_values'] (Feld => array('operator','value')).
	 * Wird von campaign_addedit.phtml und template_addedit.phtml eingebunden.
	 */

	$opts = (isset($this->view['condition_options']) && is_array($this->view['condition_options'])) ? $this->view['condition_options'] : array();
	$vals = (isset($this->view['condition_values']) && is_array($this->view['condition_values'])) ? $this->view['condition_values'] : array();

	$cond_val = function($field) use ($vals) { return isset($vals[$field]['value']) ? (string)$vals[$field]['value'] : ''; };
	$cond_op  = function($field) use ($vals) { return isset($vals[$field]['operator']) ? (string)$vals[$field]['operator'] : '=='; };

	$opt_status   = (isset($opts['order_status']) && is_array($opts['order_status'])) ? $opts['order_status'] : array();
	$opt_payment  = (isset($opts['order_payment_type']) && is_array($opts['order_payment_type'])) ? $opts['order_payment_type'] : array();
	$opt_subgroup = (isset($opts['subscriber_group']) && is_array($opts['subscriber_group'])) ? $opts['subscriber_group'] : array();
	$opt_pgroup   = (isset($opts['product_group']) && is_array($opts['product_group'])) ? $opts['product_group'] : array();
	$opt_country  = (isset($opts['customer_country']) && is_array($opts['customer_country'])) ? $opts['customer_country'] : array();

?>
<p><small><?php echo __('Optionale Bedingungen. Nur gesetzte Felder werden geprüft; es müssen alle gesetzten Bedingungen zutreffen, damit die Kampagne ausgelöst wird.', 'wpsg'); ?></small></p>

<?php
	/**
	 * Bedingung "Bestellstatus" — vorerst deaktiviert, weil sie in keinem der beiden
	 * Trigger einen Nutzen hat:
	 *
	 * - Produktkauf: die Bestellung steht zum Pruefzeitpunkt immer auf "Eingegangen",
	 *   jede andere Auswahl wuerde den Versand nur verhindern.
	 * - Statuswechsel: der Zielstatus steht bereits als Trigger-Wert im Versandprofil,
	 *   die Bedingung waere eine Dublette davon.
	 *
	 * Zum Reaktivieren genuegt es, den folgenden Block wieder freizugeben; die Auswertung
	 * im Matcher (Feld order_status) und das Ein-/Ausblenden in beiden Formularen sind
	 * weiterhin vorhanden.
	 *
	 * Hinweis: Bereits gespeicherte order_status-Bedingungen bleiben wirksam, bis der
	 * betreffende Datensatz einmal neu gespeichert wird — buildConditionsFromRequest()
	 * uebernimmt nur Felder, die auch im Formular stehen.
	 */
?>
<?php /*
<p id="wpsg_cond_order_status_wrap">
	<label for="cond_order_status"><strong><?php echo __('Bestellstatus', 'wpsg'); ?></strong></label><br />
	<select id="cond_order_status" name="cond[order_status]" class="widefat">
		<option value=""><?php echo __('— egal —', 'wpsg'); ?></option>
		<?php foreach ($opt_status as $k => $label) { ?>
			<option value="<?php echo esc_attr($k); ?>" <?php selected($cond_val('order_status'), (string)$k); ?>><?php echo esc_html($label); ?></option>
		<?php } ?>
	</select>
</p>
*/ ?>

<p>
	<label for="cond_order_total"><strong><?php echo __('Bestellsumme (brutto)', 'wpsg'); ?></strong></label><br />
	<select name="cond[order_total_op]" style="width:70px;">
		<?php foreach (array('>=' => '≥', '<=' => '≤', '==' => '=') as $op => $sym) { ?>
			<option value="<?php echo esc_attr($op); ?>" <?php selected($cond_op('order_total'), $op); ?>><?php echo $sym; ?></option>
		<?php } ?>
	</select>
	<input type="number" step="0.01" min="0" id="cond_order_total" name="cond[order_total]" value="<?php echo esc_attr($cond_val('order_total')); ?>" style="width:130px;" placeholder="<?php echo esc_attr(__('z.B. 50', 'wpsg')); ?>" />
</p>

<p>
	<label for="cond_order_payment_type"><strong><?php echo __('Zahlart', 'wpsg'); ?></strong></label><br />
	<select id="cond_order_payment_type" name="cond[order_payment_type]" class="widefat">
		<option value=""><?php echo __('— egal —', 'wpsg'); ?></option>
		<?php foreach ($opt_payment as $k => $label) { ?>
			<option value="<?php echo esc_attr($k); ?>" <?php selected($cond_val('order_payment_type'), (string)$k); ?>><?php echo esc_html($label); ?></option>
		<?php } ?>
	</select>
</p>

<p>
	<label for="cond_subscriber_group"><strong><?php echo __('Abonnentengruppe', 'wpsg'); ?></strong></label><br />
	<select id="cond_subscriber_group" name="cond[subscriber_group]" class="widefat">
		<option value=""><?php echo __('— egal —', 'wpsg'); ?></option>
		<?php foreach ($opt_subgroup as $k => $label) { ?>
			<option value="<?php echo esc_attr($k); ?>" <?php selected($cond_val('subscriber_group'), (string)$k); ?>><?php echo esc_html($label); ?></option>
		<?php } ?>
	</select>
</p>

<p>
	<label for="cond_product_group"><strong><?php echo __('Produktgruppe', 'wpsg'); ?></strong></label><br />
	<select id="cond_product_group" name="cond[product_group]" class="widefat">
		<option value=""><?php echo __('— egal —', 'wpsg'); ?></option>
		<?php foreach ($opt_pgroup as $k => $label) { ?>
			<option value="<?php echo esc_attr($k); ?>" <?php selected($cond_val('product_group'), (string)$k); ?>><?php echo esc_html($label); ?></option>
		<?php } ?>
	</select>
</p>

<p>
	<label for="cond_customer_country"><strong><?php echo __('Land des Kunden', 'wpsg'); ?></strong></label><br />
	<select id="cond_customer_country" name="cond[customer_country]" class="widefat">
		<option value=""><?php echo __('— egal —', 'wpsg'); ?></option>
		<?php foreach ($opt_country as $k => $label) { ?>
			<option value="<?php echo esc_attr($k); ?>" <?php selected($cond_val('customer_country'), (string)$k); ?>><?php echo esc_html($label); ?></option>
		<?php } ?>
	</select>
</p>