Skip to content

Commit 1c1fbcb

Browse files
author
Marten Jansen
committed
Merge branch 'develop'
2 parents 3170615 + 4ad7d0f commit 1c1fbcb

File tree

4 files changed

+50
-22
lines changed

4 files changed

+50
-22
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ for consumers not coming back.
1717
The CreditClick Price Module enhances conversion by highlighting the estimated cost per month already on the product page and in the shopping cart ("Pay at once or pay X per month"). The estimated cost per month is calculated automatically and is explained to the consumer in compliance with the local credit regulation.
1818

1919
Please note that the CreditClick Price Module is only displayed on the product page when the
20-
product offered costs at least € 250 and up to € 1,000.
20+
product offered amount is within the limits of the country.
21+
22+
| | Minimum amount | Maximum amount |
23+
| --- |---| --- |
24+
| The Netherlands | € 250,- | € 1000,- |
25+
| Germany | € 150,- | € 5000,- |
2126

2227
Download the special WooCommerce module [here](https://github.com/CreditClick/PriceModuleWooCommerce/releases)
2328

ceditclick-pm/credit_click_pm.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get_ad($amount, $class=''){
4141
ob_start();
4242
?>
4343
<style><?=$this->get_option('style');?></style>
44-
<div class="<?=$class?>" data-cc="<?=$amount;?>" data-cc-btn="<?=$this->get_option('type_class');?>"></div>
44+
<div class="<?=$class?>" data-cc="<?=$amount;?>" data-cc-country="<?=$this->get_option('country');?>"></div>
4545
<?php
4646
return ob_get_clean();
4747
}
@@ -94,7 +94,7 @@ public function get_timestamp(){
9494

9595
public function enqueue_script() {
9696

97-
wp_register_script('cca-script', 'https://ecom.creditclick.eu/cc_nl.min.js','', $this->get_timestamp(), false);
97+
wp_register_script('cca-script', 'https://ecom.creditclick.eu/cc.min.js','', $this->get_timestamp(), false);
9898
wp_enqueue_script('cca-script');
9999
wp_add_inline_script( 'cca-script', 'loadCreditClick(); jQuery(function($) { $( document.body ).on( "updated_cart_totals", function(event) { loadCreditClick(); }); });' );
100100
}

ceditclick-pm/credit_click_pm_admin.php

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,22 @@ public function page_init()
113113
$this->option_section_name // Section
114114
);
115115

116-
117-
// Ad type / class
118-
add_settings_field(
119-
'type_class', // ID
120-
'Choose type of button (example: 1 or 2)', // Title
121-
array( $this, 'type_class_callback' ), // Callback
116+
add_settings_field(
117+
'country', // ID
118+
'Select Country', // Title
119+
array( $this, 'country_callback' ), // Callback
122120
$this->option_page_name, // Page
123121
$this->option_section_name // Section
124122
);
123+
124+
// // Ad type / class
125+
// add_settings_field(
126+
// 'type_class', // ID
127+
// 'Choose type of button (example: 1 or 2)', // Title
128+
// array( $this, 'type_class_callback' ), // Callback
129+
// $this->option_page_name, // Page
130+
// $this->option_section_name // Section
131+
// );
125132
// Custom CSS
126133
add_settings_field(
127134
'style', // ID
@@ -153,9 +160,12 @@ public function sanitize($input)
153160
if(isset($input['cart_enable']))
154161
$new_input['cart_enable'] = absint(intval($input['cart_enable']));
155162

156-
// Ad type / class
157-
if(isset($input['type_class']))
158-
$new_input['type_class'] = absint(intval($input['type_class']));
163+
if(isset($input['country']))
164+
$new_input['country'] = sanitize_textarea_field($input['country']);
165+
166+
// // Ad type / class
167+
// if(isset($input['type_class']))
168+
// $new_input['type_class'] = absint(intval($input['type_class']));
159169

160170
// Custom CSS
161171
if(isset($input['style']))
@@ -207,18 +217,31 @@ public function cart_enable_callback()
207217
);
208218
}
209219

220+
/**
221+
*
222+
*/
223+
public function country_callback() {
224+
$items = array("NL", "DE");
225+
echo "<select id='country' name='" . $this->option_name . "[country]'>";
226+
foreach($items as $item) {
227+
$selected = ($this->options['country'] == $item) ? 'selected="selected"' : '';
228+
echo "<option value='$item' $selected>$item</option>";
229+
}
230+
echo "</select>";
231+
}
232+
210233

211234
/**
212235
*
213236
*/
214-
public function type_class_callback()
215-
{
216-
printf(
217-
'<input type="number" id="type_class" name="%s[type_class]" value="%s" />',
218-
$this->option_name,
219-
isset( $this->options['type_class']) ? esc_attr( $this->options['type_class']) : ''
220-
);
221-
}
237+
// public function type_class_callback()
238+
// {
239+
// printf(
240+
// '<input type="number" id="type_class" name="%s[type_class]" value="%s" />',
241+
// $this->option_name,
242+
// isset( $this->options['type_class']) ? esc_attr( $this->options['type_class']) : ''
243+
// );
244+
// }
222245

223246
/**
224247
*

ceditclick-pm/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Plugin Name: CreditClick Price Module
44
Plugin URI: https://github.com/CreditClick/PriceModuleWooCommerce
55
Description: Extends WooCommerce with a CreditClick pricing information on products.
6-
Version: 1.2.0
6+
Version: 2.0.0
77
Author: CreditClick
88
Author URI: https://creditclick.eu/
99
Text Domain: creditclick-pm-
1010
Domain Path: /lang
11-
Copyright: © 2018 CreditClick
11+
Copyright: © 2019 CreditClick
1212
License: BSD 2-Clause
1313
License URI: https://github.com/CreditClick/PriceModuleWooCommerce/blob/master/LICENSE
1414
*/

0 commit comments

Comments
 (0)