-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathgeneral.php
More file actions
209 lines (190 loc) · 9.93 KB
/
general.php
File metadata and controls
209 lines (190 loc) · 9.93 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
private $regions = array();
public function __construct() {
$this->get_regions();
}
private function get_regions() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['country'] ) ) {
$base_country = $_POST['country'];
} else {
$base_country = get_option( 'base_country' );
}
if ( ! empty( $base_country ) ) {
$wpsc_country = wpsc_get_country_object( $base_country );
if ( $wpsc_country && $wpsc_country->has_regions() ) {
$this->regions = $wpsc_country->get_regions();
}
}
}
public function display_region_drop_down() {
$base_region = get_option( 'base_region' );
if ( ! empty( $this->regions ) ):
?>
<select name='wpsc_options[base_region]'>
<?php foreach ( $this->regions as $region_id => $wpsc_region ): ?>
<option value='<?php echo esc_attr( $region_id ); ?>' <?php selected( $region_id, $base_region ); ?>><?php echo esc_html( $wpsc_region->get_name() ); ?></option>
<?php endforeach ?>
</select>
<?php
endif;
}
public function display() {
$all_countries = wpsc_get_all_countries();
?>
<h3><?php echo esc_html_e( 'General Settings', 'wpsc' ); ?></h3>
<table class='wpsc_options form-table'>
<tr>
<th scope="row"><label for="wpsc-base-country-drop-down"><?php esc_html_e( 'Base Country/Region', 'wpsc' ); ?></label></th>
<td>
<?php
wpsc_country_dropdown( array(
'id' => 'wpsc-base-country-drop-down',
'name' => 'wpsc_options[base_country]',
'selected' => get_option( 'base_country' ),
'include_invisible' => true,
) );
?>
<span id='wpsc-base-region-drop-down'>
<?php $this->display_region_drop_down(); ?>
<img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
</span>
<p class='description'><?php esc_html_e( 'Select your primary business location.', 'wpsc' ); ?></p>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e( 'Target Markets', 'wpsc' ); ?>
</th>
<td>
<?php
// check for the suhosin module
if ( wpsc_is_suhosin_enabled() ) {
echo "<em>" . __( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.", 'wpsc' ) . "</em>";
} else {
?>
<span>
<?php printf( __( 'Select: <a href="%1$s" class="wpsc-select-all" title="All">All</a> <a href="%2$s" class="wpsc-select-none" title="None">None</a>' , 'wpsc') , esc_url( add_query_arg( array( 'selected_all' => 'all' ) ) ), esc_url( add_query_arg( array( 'selected_all' => 'none' ) ) ) ); ?>
</span><br />
<div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
<?php foreach ( $all_countries as $country_id => $wpsc_country ) : ?>
<?php if ( $wpsc_country->is_visible() ) : ?>
<input type='checkbox' id="countrylist2-<?php echo $country_id; ?>" name='countrylist2[]' value='<?php echo $country_id; ?>' checked='checked' />
<label for="countrylist2-<?php echo $country_id; ?>"><?php esc_html_e( $wpsc_country->get_name() ); ?></label><br />
<?php else : ?>
<input type='checkbox' id="countrylist2-<?php echo $country_id; ?>" name='countrylist2[]' value='<?php echo $country_id; ?>' />
<label for="countrylist2-<?php echo $country_id; ?>"><?php esc_html_e( $wpsc_country->get_name() ); ?></label><br />
<?php endif; ?>
<?php endforeach; ?>
</div>
<p class='description'><?php esc_html_e( 'Select the markets you are selling products to.' , 'wpsc'); ?></p>
<?php
}
?>
</td>
</tr>
<?php
$stock_keeping_time = wpsc_get_stock_keeping_time();
$stock_keeping_interval = wpsc_get_stock_keeping_interval();
?>
<tr>
<th scope="row">
<label for="wpsc-stock-keeping-time"><?php esc_html_e( 'Keep stock in cart for', 'wpsc' ); ?></label>
</th>
<td>
<input type="text" name="wpsc_options[wpsc_stock_keeping_time]" id="wpsc-stock-keeping-time" size="2" value="<?php echo esc_attr( $stock_keeping_time ); ?>" />
<select name="wpsc_options[wpsc_stock_keeping_interval]">
<option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wpsc' ); ?></option>
<option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wpsc' ) ?></option>
<option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wpsc' ) ?></option>
</select>
<p class='description'><?php esc_html_e( "Set the amount of time items in a customer's cart are reserved. You can also specify decimal amounts such as '0.5 days' or '1.25 weeks'. Note that the minimum interval you can enter is 1 hour, i.e. you can't schedule it to run every 0.5 hour.", 'wpsc' ) ?></p>
</td>
</tr>
<?php
$hierarchical_category = get_option( 'product_category_hierarchical_url', 0 );
?>
<tr>
<th scope="row">
<?php _e( 'Use Hierarchical Product Category URL', 'wpsc' ); ?>
</th>
<td>
<label><input type="radio" <?php checked( $hierarchical_category, 1 ); ?> name="wpsc_options[product_category_hierarchical_url]" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>
<label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label><br />
<p class='description'><?php _e( 'When Hierarchical Product Category URL is enabled, parent product categories are also included in the product URL.<br />For example: <code>http://example.com/products-page/parent-cat/sub-cat/product-name</code>', 'wpsc' ); ?></p>
</td>
</tr>
</table>
<h3 class="form_group"><?php esc_html_e( 'Currency Settings', 'wpsc' ); ?></h3>
<table class='wpsc_options form-table'>
<?php
$currency_type_country_id = wpsc_get_currency_type_country_id();
?>
<tr>
<th scope="row"><label for="wpsc_options_currency_type"><?php esc_html_e( 'Currency Type', 'wpsc' ); ?></label></th>
<td>
<select id="wpsc_options_currency_type" name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
<?php foreach ( $all_countries as $country_id => $wpsc_country ) : ?>
<option value='<?php echo $country_id; ?>' <?php selected( $country_id, $currency_type_country_id ); ?>><?php esc_html_e( $wpsc_country->get_name() ); ?> (<?php echo $wpsc_country->get_currency_name(); ?>)</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php
$wpsc_country_of_currency_type = wpsc_get_currency_type_country_object();
if ( $wpsc_country_of_currency_type ) {
$currency_sign = $wpsc_country_of_currency_type->get_currency_symbol_html();
if ( empty( $currency_sign ) ) {
$currency_sign = $wpsc_country_of_currency_type->get_currency_symbol();
}
if ( empty( $currency_sign ) ) {
$currency_sign = $wpsc_country_of_currency_type->get_currency_code();
}
} else {
$currency_sign = '';
}
$currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
$csl1 = "";
$csl2 = "";
$csl3 = "";
$csl4 = "";
switch ( $currency_sign_location ) {
case 1:
$csl1 = "checked='checked'";
break;
case 2:
$csl2 = "checked='checked'";
break;
case 3:
$csl3 = "checked='checked'";
break;
case 4:
$csl4 = "checked='checked'";
break;
}
?>
<tr>
<th scope="row"><?php esc_html_e( 'Currency Sign Location', 'wpsc' ); ?></th>
<td>
<input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
<label for='csl1'><?php _ex( '100', 'Currency sign location - option 1', 'wpsc' ); ?><span id='cslchar1'><?php echo $currency_sign; ?></span></label>
<input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
<label for='csl2'><?php _ex( '100', 'Currency sign location - option 2', 'wpsc' ); ?> <span id='cslchar2'><?php echo $currency_sign; ?></span></label>
<input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
<label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span><?php _ex( '100', 'Currency sign location - option 3', 'wpsc' ); ?></label>
<input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
<label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> <?php _ex( '100', 'Currency sign location - option 4', 'wpsc' ); ?></label>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Thousands and decimal separators', 'wpsc' ); ?></th>
<td>
<label for="wpsc_options_wpsc_thousands_separator"><?php esc_html_e( 'Thousands separator', 'wpsc' ); ?></label>: <input name="wpsc_options[wpsc_thousands_separator]" id="wpsc_options_wpsc_thousands_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>" /><br />
<label for="wpsc_options_wpsc_decimal_separator"><?php esc_html_e( 'Decimal separator', 'wpsc' ); ?></label>: <input name="wpsc_options[wpsc_decimal_separator]" id="wpsc_options_wpsc_decimal_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>" /><br />
<?php esc_html_e( 'Preview:', 'wpsc' ); ?> 10<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>000<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>00
</td>
</tr>
</table>
<?php
}
} // end class