update('programs',array('daisycon_program_id' => $_POST['val']), array('program_id' => $_POST['program'])); }else{ $wpdb->query("UPDATE `programs` SET `daisycon_program_id` = '".$_POST['val']."'"); } } if($_GET['action'] == "updateStylesheet"){ $check = $wpdb->get_row("SELECT * FROM stylesheets WHERE name = '".$_POST['name']."'"); if(count($check) < 1){ if(empty($_POST['name'])){ return; }else{ $wpdb->insert('stylesheets', array( 'name' => $_POST['name'], 'bordercolor' => $_POST['border'], 'backgroundcolor' => $_POST['background'], 'textcolor' => $_POST['textcolor'], 'align' => $_POST['align'], 'store' => $_POST['store'], 'price' => $_POST['price'], 'view' => $_POST['view'], 'size' => $_POST['size'], 'width' => $_POST['width'], 'height' => $_POST['height'], 'store_before' => $_POST['before_store'], 'price_before' => $_POST['before_price'], 'button_store' => $_POST['button_store_'], 'buttoncolor' => $_POST['buttoncolor'], 'buttonbordercolor' => $_POST['buttonbordercolor'], 'buttontextcolor' => $_POST['buttontextcolor'], 'float' => $_POST['float'], 'price_button' => $_POST['price_button'], 'store_button_program' => $_POST['store_button_program'], 'moreproducts_color' => $_POST['moreproducts_color'], 'moreproducts_text' => $_POST['moreproducts_text'], 'moreproducts_font' => $_POST['moreproducts_font'] ) ); echo '

Stylesheet is bijgewerkt!

'; } }else{ $wpdb->update('stylesheets', array( 'name' => $_POST['name'], 'bordercolor' => $_POST['border'], 'backgroundcolor' => $_POST['background'], 'textcolor' => $_POST['textcolor'], 'align' => $_POST['align'], 'store' => $_POST['store'], 'price' => $_POST['price'], 'view' => $_POST['view'], 'size' => $_POST['size'], 'width' => $_POST['width'], 'height' => $_POST['height'], 'store_before' => $_POST['before-store'], 'price_before' => $_POST['before-price'], 'button_store' => $_POST['button-store'], 'buttoncolor' => $_POST['buttoncolor'], 'buttonbordercolor' => $_POST['buttonbordercolor'], 'buttontextcolor' => $_POST['buttontextcolor'], 'float' => $_POST['float'], 'price_button' => $_POST['price_button'], 'store_button_program' => $_POST['store_button_program'], 'moreproducts_color' => $_POST['moreproducts_color'], 'moreproducts_text' => $_POST['moreproducts_text'], 'moreproducts_font' => $_POST['moreproducts_font'] ), array('name' => $_POST['name']) ); } } // Automatically create product lists // Menu: Daisycon -> Producten -> Automatisch Producten genereren if($_GET['action'] == "viewAutoProducts"){ if($_POST['view'] == "auto"){ // Get list of stores to use in the product list for query $stores = explode(',', $_POST['stores']); $dStores = ''; for($i=0; $i 1){ $tDatabase .= " AND (productfeed.title REGEXP '[[:<:]]".$breed[1]."[[:>:]]' OR productfeed.description REGEXP '[[:<:]]".$breed[1]."[[:>:]]')"; }else{ $tDatabase .= " AND (productfeed.title LIKE '%".$eSearch[$i]."%' OR productfeed.description LIKE '%".$eSearch[$i]."%')"; } }else{ if(count($breed) > 1){ $tDatabase = "(productfeed.title REGEXP '[[:<:]]".$breed[1]."[[:>:]]' OR productfeed.description REGEXP '[[:<:]]".$breed[1]."[[:>:]]')"; }else{ $tDatabase = "(productfeed.title LIKE '%".$eSearch[$i]."%' OR productfeed.description LIKE '%".$eSearch[$i]."%')"; } } } if(isset($_POST['click'])){ $limit = ($_POST['amount'] * $_POST['click']).",".$_POST['amount']; }else{ $limit = $_POST['amount']; } // Get results from database with the query bits from above $products = $wpdb->get_results("SELECT productfeed.product_id FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE ".$tDatabase." AND (".$dStores.") ORDER BY ".$dOrder." LIMIT ".$limit.""); foreach($products AS $product){ $explode[] = $product->product_id; } }else{ $explode = explode(',', $_POST['products']); } if(count($explode) > 0){ $result = ''; // Get stylesheet for preview $style = $wpdb->get_row("SELECT * FROM stylesheets WHERE stylesheet_id = '".$_POST['stylesheet']."' "); for($i=0; $i < count($explode); $i++){ //Selected products $product = $wpdb->get_results("SELECT productfeed.image, productfeed.title, productfeed.price, programs.name, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE productfeed.product_id = '".$explode[$i]."' ORDER BY RAND()"); if(count($product) > 0){ // Price of the products if($product[0]->price === "0.00"){ $product[0]->price = "Gratis"; } // Float of the products, only for view = 1 (tegelweergave) if($style->float == 1){ $float = "left"; }else{ $float = "none"; } // View 1 is tile view (tegelweergave) if($style->view == 1){ $programwidth = $style->width / 4; if($style->store == 1){ $programimage = '
'; }else{ $programimage = ''; } // if($style->button_store == 1 || $style->store_button_program != "disabled"){ if($style->store_button_program == "disabled"){ $storetext = $style->before_store; } else if($style->store_button_program == "after"){ $storetext = $style->store_before.' '.$product[0]->name; }else{ $storetext = $product[0]->name.' '.$style->store_before; } if($style->button_store == 1){ $buttonstyle= 'padding:5px; padding-top:2px; padding-bottom:2px; color:#'.$style->buttontextcolor.'; border:#'.$style->buttonbordercolor.' solid 1px; background:#'.$style->buttoncolor.';'; }else{ $buttonstyle= ""; } $store = '
'.$storetext.'
'; }else{ $store = ''; } if($style->price == 1){ if($style->price_button == 1){ $buttonstyle= 'padding:5px; padding-top:2px; padding-bottom:2px; color:#'.$style->buttontextcolor.'; border:#'.$style->buttonbordercolor.' solid 1px; background:#'.$style->buttoncolor.';'; }else{ $buttonstyle= ""; } $pricetext = $style->price_before.' '.$product[0]->price; $price ='
'.$pricetext.'
'; }else{ $price =''; } // Create view example with all the details from above $result .='
'.$product[0]->title.'
'.$programimage.' '.$store.' '.$price.'
  '; } // View 0 is table vieuw (tabelweergave) elseif($style->view == 0){ $programwidth = $style->size / 2; if($style->store == 1){ $programimage = '
'; }else{ $programimage = ''; } if($style->price == 1){ if($style->price_button == 1){ $buttonstyle= 'color:#'.$style->buttontextcolor.'; border:#'.$style->buttonbordercolor.' solid 1px; background:#'.$style->buttoncolor.';'; }else{ $buttonstyle= ""; } $pricetext = $style->price_before.' '.$product[0]->price; $price ='
'.$pricetext.'
'; }else{ $price = ''; } $result .= '
'.$product[0]->title.'
'.$programimage.'
'.$price.'
'; } }else{ $result = ''; } } } $result .='
'; if($_POST['moreproducts'] == "1"){ if($style->view == 0){ $moreproducts_width = $style->width.'px'; }else{ $moreproducts_width = '90%'; } $result .='
'.$style->moreproducts_text.'
'; } echo $result; } if($_GET['action'] == "deleteProduct"){ global $wpdb; $wpdb->query("DELETE FROM productfeed WHERE program_id = '".$_POST['program']."' AND product_id = '".$_POST['product']."'"); echo "DELETE FROM productfeed WHERE program_id = '".$_POST['program']."' AND product_id = '".$_POST['product']."' "; } if($_GET['action'] == "getProductsArray"){ $products = $wpdb->get_results("SELECT product_id FROM productfeed WHERE program_id = '".$_POST['program']."'"); $i = 1; foreach($products AS $product){ if(count($products) > $i){ $ids .= ''.$product->product_id.', '; }else{ $ids .= ''.$product->product_id.''; } $i++; } echo $ids; } if ($_GET['action'] == "result"){ $explode = explode(" ", $_POST['word']); for($i=0; $i 1){ $tDatabase .= " AND (title REGEXP '[[:<:]]".$breed[1]."[[:>:]]' OR description REGEXP '[[:<:]]".$breed[1]."[[:>:]]')"; }else{ $tDatabase .= " AND (title LIKE '%".$explode[$i]."%' OR description LIKE '%".$explode[$i]."%')"; } }else{ if(count($breed) > 1){ $tDatabase = "(title REGEXP '[[:<:]]".$breed[1]."[[:>:]]' OR description REGEXP '[[:<:]]".$breed[1]."[[:>:]]')"; }else{ $tDatabase = "(title LIKE '%".$explode[$i]."%' OR description LIKE '%".$explode[$i]."%')"; } } } if($_POST['program'] != "" && $_POST['category'] == "" && $_POST['subcategory'] == ""){ $Aproducts = $wpdb->get_results("SELECT * FROM productfeed WHERE productfeed.program_id = '".$_POST['program']."' AND ".$tDatabase." ORDER BY RAND()"); } elseif($_POST['category'] != "" && $_POST['subcategory'] == ""){ $Aproducts = $wpdb->get_results("SELECT * FROM productfeed WHERE productfeed.program_id = '".$_POST['program']."' AND productfeed.category = '".$_POST['category']."' AND ".$tDatabase." ORDER BY RAND()"); } elseif($_POST['subcategory'] != ""){ $Aproducts = $wpdb->get_results("SELECT * FROM productfeed WHERE productfeed.program_id = '".$_POST['program']."' AND productfeed.sub_category = '".$_POST['subcategory']."' AND ".$tDatabase." ORDER BY RAND()"); } else{ $Aproducts = $wpdb->get_results("SELECT * FROM productfeed WHERE ".$tDatabase." ORDER BY RAND()"); } echo 'Producten gevonden:'; echo count($Aproducts) . '

'; if (count($Aproducts) > 1500){ // Limit of 1500 products to show in the example view _e('Wees specifieker in je zoekopdracht','DaisyconPlugin'); }else{ // Get all the different style options $aSheet = $wpdb->get_row("SELECT * FROM stylesheets WHERE stylesheet_id = '".$_POST['stylesheet']."'"); if(isset($_POST['size'])){$size = $_POST['size'];}else{$size = $aSheet->size;} if(isset($_POST['view'])){$view = $_POST['view'];}else{$view = $aSheet->view;} if(isset($_POST['border'])){$border = $_POST['border'];}else{$border = $aSheet->bordercolor;} if(isset($_POST['background'])){$background = $_POST['background'];}else{$background = $aSheet->backgroundcolor;} if(isset($_POST['align'])){$align = $_POST['align'];}else{$align = $aSheet->align;} if(isset($_POST['textcolor'])){$textcolor = $_POST['textcolor'];}else{$textcolor = $aSheet->textcolor;} if(isset($_POST['price'])){$price = $_POST['price'];}else{$price = $aSheet->price;} if(isset($_POST['store'])){$store = $_POST['store'];}else{$store = $aSheet->store;} if(isset($_POST['float'])){$float = $_POST['float'];}else{$float = $aSheet->float;} if(isset($_POST['height'])){$height = $_POST['height'];}else{$height = $aSheet->height;} if(isset($_POST['width'])){$width = $_POST['width'];}else{$width = $aSheet->width;} if(isset($_POST['before_price'])){$before_price = $_POST['before_price'];}else{$before_price = $aSheet->price_before;} if(isset($_POST['button_store_'])){$button_store = $_POST['button_store_'];}else{$button_store = $aSheet->button_store;} if(isset($_POST['button_color_'])){$button_color = $_POST['button_color_'];}else{$button_color = $aSheet->buttoncolor;} if(isset($_POST['button_border_color_'])){$button_border_color = $_POST['button_border_color_'];}else{$button_border_color = $aSheet->buttonbordercolor;} if(isset($_POST['button_text_color_'])){$button_text_color = $_POST['button_text_color_'];}else{$button_text_color = $aSheet->buttontextcolor;} if(isset($_POST['store_button_program_'])){$store_button_program = $_POST['store_button_program_'];}else{$store_button_program = $aSheet->store_button_program;} foreach($Aproducts AS $Rproducts){ echo '
  • '.$Rproducts->title.'
    '; $Aprogram = $wpdb->get_row("SELECT * FROM programs WHERE program_id = '".$Rproducts->program_id."' "); echo '
    '; echo '
    €'.$Rproducts->price.'
    '; echo '
  • '; } } } if ($_GET['action'] == "subcategory"){ $aSubcat = array(); $aSubcat = $wpdb->get_results("SELECT Distinct productfeed.sub_category FROM productfeed WHERE productfeed.program_id = '".$_POST['program']."' AND productfeed.category = '".$_POST['category']."' ORDER BY productfeed.sub_category"); echo ''; foreach($aSubcat AS $rSubcat){ echo ' '; } break; } if ($_GET['action'] == "category"){ $aCat = array(); $aCat = $wpdb->get_results("SELECT Distinct productfeed.category FROM productfeed WHERE program_id = '".$_POST['program']."' ORDER BY productfeed.category"); echo ''; foreach($aCat AS $rCat){ echo ''; } } if ($_GET['action'] == "widget"){ if(isset($_POST['store'])){ if($_POST['store'] == "all" || $_POST['store'] == ""){ $products = $wpdb->get_results("SELECT * FROM (SELECT productfeed.image, productfeed.title, productfeed.price, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE productfeed.title LIKE '%".$_POST['device_store']."%' AND NOT productfeed.program_id = '7' AND NOT productfeed.program_id = '21' AND NOT productfeed.program_id = '24' AND NOT productfeed.program_id = '36' AND NOT productfeed.program_id = '27' AND NOT productfeed.program_id = '40' AND NOT productfeed.program_id = '44' ORDER BY RAND() LIMIT 10) temp_tbl ORDER BY price ASC "); }else{ $products = $wpdb->get_results("SELECT productfeed.image, productfeed.title, productfeed.price, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE productfeed.title LIKE '%".$_POST['device_store']."%' AND productfeed.program_id = '".$_POST['store']."' ORDER BY RAND() LIMIT 10"); } } if(isset($_POST['provider'])){ if($_POST['provider'] == "all" || $_POST['provider'] == ""){ $products = $wpdb->get_results("SELECT * FROM (SELECT productfeed.image, productfeed.title, productfeed.price, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE productfeed.title LIKE '%".$_POST['device']."%' AND( productfeed.program_id = '7' OR productfeed.program_id = '21' OR productfeed.program_id = '24' OR productfeed.program_id = '36' OR productfeed.program_id = '27' OR productfeed.program_id = '40' OR productfeed.program_id = '44') ORDER BY RAND() LIMIT 10) temp_tbl ORDER BY price ASC "); }else{ $products = $wpdb->get_results("SELECT productfeed.image, productfeed.title, productfeed.price, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id WHERE productfeed.title LIKE '%".$_POST['device']."%' AND productfeed.program_id = '".$_POST['provider']."' ORDER BY RAND() LIMIT 10"); } } echo '

    '.$_POST['device'].'

    '; if ($products){ foreach($products AS $product){ if($product->price == "0.00"){ $price = "Gratis!"; }else{ $price = '€ '.$product->price; } echo ' '; } }else{ echo '
    Helaas zijn er geen producten gevonden!
    '; } } // Styleresult is for creating a preview of the stylesheet // Menu: Daisycon -> Stylesheets if ($_GET['action'] == "styleresult"){ $products = $wpdb->get_results("SELECT productfeed.image, productfeed.title, productfeed.price, programs.name, programs.image AS program_image, productfeed.link FROM productfeed INNER JOIN programs ON productfeed.program_id = programs.program_id ORDER BY RAND() LIMIT 3"); if($products){ foreach($products AS $product){ // Price of the products if($product->price == "0.00"){ $price = "Gratis!"; }else{ $price = $product->price; } // Float of the products, only for view = 1 (tegelweergave) if($_POST['float'] == 1){ $float = "left"; }else{ $float = "none"; } // View 1 is tile view (tegelweergave) if($_POST['view'] == 1){ $programwidth = $_POST['width'] / 4; if($_POST['store'] == 1){ $programimage = '
    '; }else{ $programimage = ''; } if($_POST['button_store'] == 1 || $_POST['store_button_program'] != "disabled"){ if($_POST['store_button_program'] == "disabled"){ $storetext = $_POST['before_store']; } else if($_POST['store_button_program'] == "after"){ $storetext = $_POST['before_store'].' '.$product->name; }else{ $storetext = $product->name.' '.$_POST['before_store']; } if($_POST['button_store'] == 1){ $buttonstyle = 'padding:5px; padding-top:2px; padding-bottom:2px; color:#'.$_POST['button_text_color'].'; border:#'.$_POST['button_border_color'].' solid 1px; background:#'.$_POST['button_color'].';'; }else{ $buttonstyle = ""; } $store = '
    '.$storetext.'
    '; }else{ $store = ''; } if($_POST['price'] == 1){ if($_POST['button_price'] == 1){ $buttonstyle = 'padding:5px; padding-top:2px; padding-bottom:2px; color:#'.$_POST['button_text_color'].'; border:#'.$_POST['button_border_color'].' solid 1px; background:#'.$_POST['button_color'].';'; }else{ $buttonstyle = ""; } $pricetext = $_POST['before_price'].' '.$product->price; $price = '
    '.$pricetext.'
    '; }else{ $price = ''; } echo '
    '.$product->title.'
    '.$programimage.' '.$store.' '.$price.'
    '; }else{ $programwidth = $_POST['size'] / 2; if($_POST['store'] == 1){ $programimage = '
    '; }else{ $programimage = ''; } if($_POST['price'] == 1){ if($_POST['button_price'] == 1){ $buttonstyle = 'color:#'.$_POST['button_text_color'].'; border:#'.$_POST['button_border_color'].' solid 1px; background:#'.$_POST['button_color'].';'; }else{ $buttonstyle = ""; } $pricetext = $_POST['before_price'].' '.$product->price; $price = '
    '.$pricetext.'
    '; }else{ $price = ''; } echo '
    '.$product->title.'
    '.$programimage.'
    '.$price.'
    '; } } } } } ?>