<div id="wpshop_wysiwyg_shortcode_categorie_options_container" >
				<input type="checkbox" name="wpshop_wysiwyg_shortcode_options[]" id="wpshop_wysiwyg_shortcode_options_categorie_display_product" class="wpshop_wysiwyg_shortcode_options wpshop_wysiwyg_shortcode_options_categories_display_product" value="only_cat" checked ><label for="wpshop_wysiwyg_shortcode_options_categorie_display_product" > <?php 
            _e('Do not display product', 'wpshop');
            ?>
</label>
			</div>
<?php 
            $specific_options = ob_get_contents();
            ob_end_clean();
            break;
        case 'product':
            $query = $wpdb->prepare("SELECT COUNT(ID) as WPSHOP_PRODUCT_NB FROM " . $wpdb->posts . " WHERE post_type=%s AND post_status=%s", WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'publish');
            $wpshop_product_nb = $wpdb->get_var($query);
            $content = sprintf(__('Due to product number, you have to search for product or click on "%s" button', 'wpshop'), __('View all element', 'wpshop'));
            if ($wpshop_product_nb <= 100) {
                $content = wpshop_products::product_list(true);
            }
            $wpshop_wysiwyg_shortcode_inserter_shortcode_main_identifier = 'wpshop_products pid';
            break;
        case 'product_by_attribute':
            $content_explanation = '<p>' . __('Generate product listing shortcode from a selected attribute value', 'wpshop') . '</p>';
            $content = wpshop_attributes::get_attribute_list(null, $type);
            $wpshop_wysiwyg_shortcode_inserter_shortcode_main_identifier = 'wpshop_products att_name';
            $display_option_grouped = false;
            $display_search_form = false;
            break;
    }
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php 
/**
 * Search element in database for shortcode insertion interface
 */
function ajax_wpshop_element_search()
{
    check_ajax_referer('wpshop_element_search', 'wpshop_ajax_nonce');
    $wpshop_element_searched = isset($_REQUEST['wpshop_element_searched']) ? wpshop_tools::varSanitizer($_REQUEST['wpshop_element_searched']) : null;
    $wpshop_element_type = isset($_REQUEST['wpshop_element_type']) ? wpshop_tools::varSanitizer($_REQUEST['wpshop_element_type']) : null;
    $wpshop_format_result = isset($_REQUEST['wpshop_format_result']) ? (bool) wpshop_tools::varSanitizer($_REQUEST['wpshop_format_result']) : true;
    switch ($wpshop_element_type) {
        case 'product':
        case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT:
            $data = wpshop_products::product_list($wpshop_format_result, $wpshop_element_searched);
            break;
        case 'categories':
            $data = wpshop_categories::product_list_cats($wpshop_format_result, $wpshop_element_searched);
            break;
    }
    if ($wpshop_format_result) {
        $data = empty($data) ? __('No match', 'wpshop') : $data;
    } else {
        if (!empty($data)) {
            $temp_data = $data;
            unset($data);
            foreach ($temp_data as $post) {
                $data[$post->ID] = $post->ID . ' - ' . $post->post_title;
            }
        } else {
            $data = array();
        }
    }
    echo json_encode($data);
    die;
}
Beispiel #3
0
             $historic[$arraykey]['mess_dispatch_date'][] = current_time('mysql', 0);
             update_post_meta($postid, 'wpshop_messages_histo_' . $date, $historic);
             $data = $historic[$arraykey];
             $wps_message_ctr = new wps_message_ctr();
             $wps_message_ctr->wpshop_email($data['mess_user_email'], $data['mess_title'], $data['mess_message'], $save = false, $object = array());
             $array = array('result' => true, 'message' => '');
         } else {
             $array = array('result' => false, 'message' => __('An error occured', 'wpshop'));
         }
     } else {
         $array = array('result' => false, 'message' => __('An error occured', 'wpshop'));
     }
     echo json_encode($array);
     break;
 case 'related_products':
     $data = wpshop_products::product_list(false, $_REQUEST['search']);
     $array = array();
     foreach ($data as $d) {
         $array[] = array('id' => $d->ID, 'name' => $d->post_title);
     }
     echo json_encode($array);
     break;
 case 'ajax_cartAction':
     global $wpshop_cart;
     switch ($_REQUEST['action']) {
         case 'applyCoupon':
             $wps_coupon_ctr = new wps_coupon_ctr();
             $result = $wps_coupon_ctr->applyCoupon($_REQUEST['coupon_code']);
             if ($result['status'] === true) {
                 $wps_cart_ctr = new wps_cart();
                 $order = $wps_cart_ctr->calcul_cart_information(array());