Customer Reviews
$instance::$app_id,
'store' => get_option('adnabu_store_id'),
));
$get_chouces_url = "https://www.adnabu.com/woocommerce/merchant/center/choices?$query";
$transient = $instance::$app_prefix . 'get_merchant_center_choices';
if(get_transient($transient) == 1){
$response = $instance->custom_wp_remote($get_chouces_url);
if(!is_wp_error( $response ) ) {
$merchant_center_choices = wp_remote_retrieve_body($response);
$merchant_center_choices_json = json_decode($merchant_center_choices, true);
delete_transient( $transient );
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST["get_merchant_center_choices"])){
set_transient($transient,1);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' and
wp_verify_nonce($_POST["_wpnonce"],$this::$app_prefix . "nonce") == 1) {
if (isset($_POST["merchant_id"])) {
update_option($this::$app_prefix . "merchant_id",
sanitize_text_field($_POST["merchant_id"]));
}
if (isset($_POST["google_reviews_status"])) {
update_option($this::$app_prefix . "reviews_status",
sanitize_text_field($_POST["google_reviews_status"]));
}
else{
update_option($this::$app_prefix . "reviews_status", "off");
}
if (isset($_POST["opt_in_position"])) {
update_option($this::$app_prefix . "opt_in_position",
sanitize_text_field($_POST["opt_in_position"]));
}
if (isset($_POST['expected_delivery_in_days'])) {
update_option($this::$app_prefix . "expected_delivery_in_days",
absint($_POST['expected_delivery_in_days']));
}
if (isset($_POST["rating_badge_status"])) {
update_option($this::$app_prefix . "rating_badge_status",
sanitize_text_field($_POST["rating_badge_status"]));
if (isset($_POST["rating_badge_position"])) {
update_option($this::$app_prefix . "rating_badge_position",
sanitize_text_field($_POST["rating_badge_position"]));
}
}
else {
update_option($this::$app_prefix . "rating_badge_status", "off");
}
if(isset($_POST["product_reviews_status"])){
update_option($this::$app_prefix . "product_reviews_status",
sanitize_text_field($_POST["product_reviews_status"]));
if(isset($_POST["gtin_field"])){
update_option($this::$app_prefix . "gtin_field",
sanitize_text_field($_POST["gtin_field"]));
}
}
else {
update_option($this::$app_prefix . "product_reviews_status", "off");
}
}
$show_setting_form = '';
$instance = new AdNabuGoogleCustomerReviews();
$connect_merchant_center_url = "\"https://www.adnabu.com/social/login/content-google-oauth2?$query\"";
$form_status = 'disabled';
$save_button_display = 'none';
$edit_button_display = '';
if (!get_option($this::$app_prefix . "merchant_id") && empty($merchant_center_choices_json)){
$show_setting_form = 'none';
?>
$merchant_id";
}
}
else{
foreach ($merchant_center_choices_json as $choice){
$id = $choice['id'];
$merchant_id_option = $merchant_id_option . "
";
}
$form_status = '';
$save_button_display = '';
$edit_button_display = 'none';
}
?>