function generateKeywords($product_id) { use_class('styles'); use_class('Product'); use_class('ProductAttribute'); $class_s = new styles(); $keywords = array(); $product = new Product($product_id); $language_id = 2; //Step 1 (Brand) if ($product->brand_id == 24) { $keywords = array(strtolower($product->brand_name), 'eli', 'silberschmuck', '925', 'junger', 'modischer', 'trendy', 'fashion'); } elseif ($product->brand_id == 3) { $keywords = array(strtolower($product->brand_name), 'vergoldet', 'golden', 'gold', 'vermeil'); } elseif ($product->brand_id == 7) { $keywords = array(strtolower($product->brand_name), 'perlenschmuck', 'brautschmuck', 'hochzeit'); } //Step 2 (Symbol) $symbol = $class_s->getProductStyle($product_id); if ($symbol['Symbol'] > 0) { $style = new ProductAttribute($symbol['Symbol']); if ($symbol['Symbol'] != '') { array_push($keywords, strtolower($style->displayAttributeName($product_id, ProductAttribute::GROUP_ID_SYMBOL, $language_id))); } } //Step 3 (Basic) array_push($keywords, 'günstiger', 'frau', 'freundin', 'geschenk', 'juwelier'); //Step 4 (Material) $materials = array(); $q = "SELECT ptpm.products_materials_id AS id" . " , material_name AS name" . " FROM products_to_products_materials ptpm" . " INNER JOIN products_materials pm" . " ON pm.products_materials_id = ptpm.products_materials_id" . " WHERE ptpm.products_id = {$product_id}"; $r = tep_db_query($q); while ($row = tep_db_fetch_array($r)) { $materials[$row['id']] = $row['name']; } foreach ($materials as $key => $value) { if ($key == 4 || $key == 2) { list($material_name2, $material_name1, $material_name3) = split(",", $value); array_push($keywords, strtolower($material_name2), 'glamourös', 'funkelnd', 'glitzernd', 'strass', 'festlich', 'elegant'); } else { list($material_name2, $material_name1, $material_name3) = split(",", $value); array_push($keywords, strtolower($material_name2)); } } //Step 5 (Color) $color = $product->getColors($language_id); array_push($keywords, strtolower($color)); //Step 6 (Rest of the products) array_push($keywords, 'basic', 'klassik', 'klassisch', 'schlicht', 'elegant', 'zeitlos', 'sportlich', 'dezent', 'filigran', 'zart', 'schlicht'); $final_k = implode(',', $keywords); //echo $pid." = ".$final_k; $sda = array(); $sda['products_head_keywords_tag'] = $final_k; tep_db_perform('products_description', $sda, 'update', "products_id={$product_id} AND language_id={$language_id}"); }
global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); use_class('logger'); $logger = new logger('cron', 'depot-refill'); //$logger->write('SIMULATION'); //Include Required Classes (and create object when necessary) use_class('Product'); use_class('products_minierp'); use_class('depot_orders'); use_class('styles'); $class_pm = new products_minierp(); $class_do = new depot_orders(); $class_s = new styles(); $whid = WAREHOUSE_ID_FOR_HANDLING_ORDERS; $segment_id = SEGMENT_ID_DEFAULT; //Grab all data that can be retrieved collectively for the whole products //stock from below function already exclude active booking $products_stock = $class_pm->stockRetrieveAll($whid, '', true); //Grab all required Settings Product::loadDIOHsettings(); //For now we can not run auto cancel in Manobo Local due to the //sync issues of Depot Orders with Manobo Central if (!SERVER_IS_LOCAL) { //query all auto refill orders currently open //and can still be canceled(grouped by article) $logger->write('1) AUTO CANCEL'); $logger->write('Query orders which can still be canceled:'); $q = "SELECT products_id, articles_id, SUM(quantity) AS total_qty" . ", GROUP_CONCAT(depot_orders_id) AS order_ids" . ", GROUP_CONCAT(status) AS order_status" . " FROM depot_orders" . " WHERE trans_type = 'AR' AND" . " trans_id = " . depot_orders::AUTO_REFILL_ID_DAILYCRON . " AND (status IN (1,2,3) OR (status = 4 AND prod_status = 'P'))" . " GROUP BY products_id, articles_id";
/** * get products based on filter (family, main element, symbol, color, and brand) * @param Int $product_id Products ID * @return Array Array of products ID */ function getProductsCrossSelling($product_id) { use_class('products_brand'); use_class('styles_php4'); use_class('products_minierp'); use_class('products_family_php4'); $class_s = new styles(); $class_pb = new products_brand(); $class_pm = new products_minierp(); $max_products = 50; $max_products_by_family = 20; $max_products_by_main_element = 10; $max_products_by_symbol = 30; // $max_products_by_color = 5; // $max_products_by_brand = 5; $max_products_by_category = 40; $pids = array(); $p_data = $class_pm->retrieveDetail($product_id, 'p,cat'); //FAMILY $family_id = $p_data['p']['family_id']; $obj_family = new products_family(null, $product_id); $pid_family = $obj_family->retrieveMembers(); $pid_family_exclude_kill_prod = $class_pm->filterExcludeKilledProducts($pid_family); $pid_similar = $obj_family->getSimilarProducts($product_id, false, false); $pids = array_merge($pid_family_exclude_kill_prod, $pid_similar); $key = array_search($product_id, $pids); unset($pids[$key]); $pids = array_slice($pids, 0, 20); //MAIN ELEMENT $pid_family_filter = implode(",", $pids); if ($pid_family_filter == '') { if ($p_data['p']['products_brand_id'] == 14) { $pid_family_filters = "AND pue.products_id NOT IN ({$product_id}) AND p.products_brand_id = 14 "; } else { $pid_family_filters = "AND pue.products_id NOT IN ({$product_id})"; } } else { if ($p_data['p']['products_brand_id'] == 14) { $pid_family_filters = "AND pue.products_id NOT IN ({$pid_family_filter}, {$product_id}) AND p.products_brand_id = 14 "; } else { $pid_family_filters = "AND pue.products_id NOT IN ({$pid_family_filter}, {$product_id})"; } } $main_element_id = $class_pm->getMainElement($product_id); if ($main_element_id != NULL) { $pid_main_element = $class_pm->getProductsByMainElement($main_element_id, false, $pid_family_filters, "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products_by_main_element}"); $pids = array_merge($pids, $pid_main_element); } //SYMBOL $symbol_id = $class_s->getProductStyle($product_id); $pid_main_element_filter = implode(",", $pids); if ($pid_main_element_filter == '') { if ($p_data['p']['products_brand_id'] == 14) { $pid_main_element_filters = "AND shp.products_id NOT IN ({$product_id}) AND p.products_brand_id = 14 "; } else { $pid_main_element_filters = "AND shp.products_id NOT IN ({$product_id})"; } } else { if ($p_data['p']['products_brand_id'] == 14) { $pid_main_element_filters = "AND shp.products_id NOT IN ({$pid_main_element_filter}, {$product_id}) AND p.products_brand_id = 14 "; } else { $pid_main_element_filters = "AND shp.products_id NOT IN ({$pid_main_element_filter}, {$product_id})"; } } if ($symbol_id['Symbol'] != '') { $pid_symbol = array_keys($class_s->retrieveProducts($symbol_id['Symbol'], false, $pid_main_element_filters, "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products_by_symbol}")); $pids = array_merge($pids, $pid_symbol); } //COLOR // $color_id = $class_pm->loadColorPattern($product_id); // if ($color_id) { // $pids_symbol_filter = implode(",", $pids); // if ($pids_symbol_filter == '') { // $pid_symbol_filters = "AND ptcp.products_id NOT IN ($product_id)"; // } else { // $pid_symbol_filters = "AND ptcp.products_id NOT IN ($pids_symbol_filter, $product_id)"; // } // $pid_color = $class_pm->getProductsByColor( // $color_id[0], // false, // $pid_symbol_filters, // "ORDER BY pl.sold_monthly_3 DESC LIMIT $max_products_by_color"); // $pids = array_merge($pids, $pid_color); // } //BRAND // $brand_id = $p_data['p']['products_brand_id']; // if ($brand_id) { // $pids_color_filter = implode(",", $pids); // if ($pids_color_filter == '') { // $pid_color_filters = "AND p.products_id NOT IN ($product_id)"; // } else { // $pid_color_filters = "AND p.products_id NOT IN ($pids_color_filter, $product_id)"; // } // $pid_brand = $class_pb->getProducts( // $brand_id, // false, // $pid_color_filters, // "ORDER BY pl.sold_monthly_3 DESC LIMIT $max_products_by_brand"); // $pids = array_merge($pids, $pid_brand); // } //CATEGORY $cat_id = $p_data['categories_id']; $pids_color_filter = implode(",", $pids); if ($pids_color_filter == '') { if ($p_data['p']['products_brand_id'] == 14) { $pid_color_filters = "AND p.products_id NOT IN ({$product_id}) AND p.products_brand_id = 14 "; } else { $pid_color_filters = "AND p.products_id NOT IN ({$product_id})"; } } else { if ($p_data['p']['products_brand_id'] == 14) { $pid_color_filters = "AND p.products_id NOT IN ({$pids_color_filter}, {$product_id}) AND p.products_brand_id = 14 "; } else { $pid_color_filters = "AND p.products_id NOT IN ({$pids_color_filter}, {$product_id})"; } } $pid_cat = $class_pm->getProductsByCategory($cat_id, false, $pid_color_filters, "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products_by_category}"); $pids = array_merge($pids, $pid_cat); //LIMIT ALL PRODUCTS BY 50 $pids = array_slice($pids, 0, $max_products); $pids_implode = implode(",", $pids); if ($p_data['p']['products_brand_id'] == 14) { $pids = $class_pb->getProducts($p_data['p']['products_brand_id'], false, "AND p.products_id IN ({$pids_implode})", "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products}"); } return $pids; }
function drawDetailTable($editable = true, $showImage = true, $columns = 1) { use_class('styles'); $class_s = new styles(); $design_id = $this->id; $original_products_id = $this->original_products_id; $element_id = $this->element_id; $prod_id_disabled = $this->original_products_id != '' ? ' readonly="readonly"' : ''; $el_id_disabled = $this->element_id != '' ? ' readonly="readonly"' : ''; $design_name = $this->name; $design_owner = ucfirst($this->owner_name); $attr_title = 'Product Attributes'; if ($editable) { $sty_disabled = ''; //$descat_disabled = ($showImage==='copy' || is_null($this->id) || $this->status=='1' || $this->status=='2' || $this->status=='11') ? '' : ' disabled="disabled"'; $descat_disabled = ' disabled="disabled"'; $prod_ref_hidden = true; $descat_hidden = '<input type="hidden" name="cat" value="' . $this->category . '" />'; //used this to avoid cat value not submitted when its disabled #$destype_hidden = '<input type="hidden" name="type" value="'.$this->type.'" />'; //DISABLED (waiting status from design team need to activate or not) if ($showImage === 'copy' || is_null($this->id) || $this->status == '1' || $this->status == '2' || $this->status == '11') { $descat_disabled = ''; $descat_hidden = ''; $prod_id_disabled = ''; $prod_ref_hidden = false; #$destype_hidden = ''; //DISABLED (waiting status from design team need to activate or not) } #$destype_disabled = $descat_disabled; //DISABLED (waiting status from design team need to activate or not) $destype_array[""] = 'Please select...'; $descat_array[""] = 'Please select...'; $destype_array = array_merge($destype_array, $this->getDesignType()); $descat_array = array_merge($descat_array, $this->getDesignCategory()); if (is_null($this->id)) { if ($this->category == 'R') { $descat_array = array('R' => 'Recombination'); } elseif ($this->category == 'W') { $descat_array = array('W' => 'New Wax'); } elseif ($this->category == 'E') { $descat_array = array('E' => 'Revision'); } //elseif($this->category=='V') $descat_array = array('V'=>'Variation'); //elseif($this->category=='RV') $descat_array = array('R'=>'Recombination', 'V'=>'Variation'); } $design_id = '<input type="text" name="designs_id" class="input" value="' . $design_id . '" readonly="readonly" />'; $design_owner = '<input type="text" name="owner_name" class="input" value="' . $design_owner . '" disabled="disabled" />'; $designtype_combo = '<select id="type" name="type" class="input"' . $destype_disabled . '>' . loadComboListFromArray($destype_array, '', $this->type, false) . '</select>'; $designcat_combo = $descat_hidden . '<select id="cat" name="cat" class="input"' . $descat_disabled . '>' . loadComboListFromArray($descat_array, '', $this->category, false) . '</select>'; $procat_combo = comboProductsCategory('procat', 'procat', $this->products_category_id, 'input'); $probra_combo = comboProductsBrand('probra', 'probra', $this->products_brand_id, 'input'); $original_products_id = '<input type="text" id="products_id" name="products_id" class="input" ' . $prod_id_disabled . ' value="' . $original_products_id . '" maxlength="32" />'; $original_products_id .= '<br /><small class="notice">Seperate multiple ID by comma</small>'; $element_id = '<input type="text" id="element_id" name="element_id" class="input" ' . $el_id_disabled . ' value="' . $element_id . '" maxlength="32" />'; $design_name = '<input type="text" id="name" name="name" class="input" value="' . $design_name . '" /></td>'; $target_price = '<input type="text" id="price" name="price" class="input" value="' . $this->target_price . '" /> <span class="notice">EUR</span>'; $option_none = '<option value="0">Please select attribute...</option>'; $attr_title .= ' <span class="notice smallText">(optional)</span>'; $attr_collection = '<select name="styles_id_L" class="input"' . $sty_disabled . '>' . $option_none . $class_s->drawComboOptions($this->styles_id_L, 'L') . '</select>'; // $attr_fashiongrd = '<select name="styles_id_F" class="input"'.$sty_disabled.'>'.$option_none.$class_s->drawComboOptions($this->styles_id_F, 'F').'</select>'; $design_structures = array(1 => 'Open', 2 => '100% Copy', 3 => 'Similar'); $design_structure = '<select name="structure_id" class="input"' . $desstruct_disabled . '><option value="">Please select structure...</option>' . loadComboListFromArray($design_structures, null, $this->structure_id) . '</select>'; $design_contents = array(1 => 'Open', 2 => '100% Copy', 3 => 'Similar', 4 => '30% Deviation MUST'); $design_content = '<select name="content_id" class="input"' . $descont_disabled . '><option value="">Please select content...</option>' . loadComboListFromArray($design_contents, null, $this->content_id) . '</select>'; } else { global $product_categories_name; global $products_brands_name; $sty_disabled = ' disabled="disabled"'; $designtype_combo = $this->getDesignType($this->type); $designcat_combo = $this->getDesignCategory($this->category); $procat_combo = $product_categories_name[$this->products_category_id]; $probra_combo = $product_brands_name[$this->products_brand_id]; $original_products_id = '<a href="?open=product-detail&products_id=' . $original_products_id . '">' . $original_products_id . '</a>'; $element_id = '<a href="?open=element&id=' . $element_id . '">' . $element_id . '</a>'; $target_price = $this->target_price . ' EUR'; $styles = $class_s->retrieveList('', "s.styles_id IN ({$this->styles_id_L}, {$this->styles_id_F})"); $styles_name = array(); foreach ($styles as $style) { $styles_name[$style['styles_id']] = $style['name']; } $attr_collection = $this->styles_id_L > '0' ? $styles_name[$this->styles_id_L] : '<span class="notice">Unset</span>'; // $attr_fashiongrd = ($this->styles_id_F>'0') ? $styles_name[$this->styles_id_F] : '<span class="notice">Unset</span>'; } $content = ''; if (!$editable && $showImage && $columns == 2) { $img = webImage($this->image_1, '80', '80', 'Image 1', 'img-border'); $img .= $this->image_2 != '' ? '<br /><br />' . webImage($this->image_2, '80', '80', 'Image 2', 'img-border') : ''; $img .= $this->image_3 != '' ? '<br /><br />' . webImage($this->image_3, '80', '80', 'Image 3', 'img-border') : ''; $img .= $this->image_4 != '' ? '<br /><br />' . webImage($this->image_4, '80', '80', 'Image 4', 'img-border') : ''; $content .= '<div style="float:left;margin:7px 5px 0 0;">' . $img . '</div>'; } $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">'; if (!is_null($this->id)) { if (!$editable && $showImage && $columns == 1) { // $img1 = webImage($this->image_1, '150', '150', 'Main Image', 'img-border').' '; $img1 = webImage($this->image_1, '80', '80', 'Image 1', 'img-border') . ' '; // $img2 = webImage($this->image_2, '150', '150', 'Additional Image', 'img-border'); $img2 = webImage($this->image_2, '80', '80', 'Image 2', 'img-border'); $img3 = webImage($this->image_3, '80', '80', 'Image 3', 'img-border'); $img4 = webImage($this->image_4, '80', '80', 'Image 4', 'img-border'); $content .= '<tr><td>' . $img1 . '</td><td>' . $img2 . '</td><td>' . $img3 . '</td>' . $img4 . '<td></td></tr>'; } if ($editable !== 'copy') { $content .= '<tr><td>Design ID</td><td>' . $design_id . '</td></tr>'; } } $content .= '<tr><td class="label">Design Created by</td><td>' . $design_owner . '</td></tr>'; //$hide_ori_pid = ($this->category=='R' || $this->category=='V') ? false : true; // echo "<pre>";var_dump($this);die(); if ($prod_ref_hidden) { $hide_ori_pid = $prod_ref_hidden && $this->original_products_id != '' ? false : true; } else { $hide_ori_pid = $prod_ref_hidden; } $content .= '<tr><td class="label">Design Type</td><td width="230">' . $designtype_combo . '</td></tr>'; $content .= '<tr><td class="label">Design Category</td><td width="230">' . $designcat_combo . '</td></tr>'; $content .= '<tr id="oriprodid"' . ($hide_ori_pid ? ' style="display:none;' : '') . '"><td>Product ID (Original)</td><td>' . $original_products_id . '</td></tr>'; $content .= '<tr><td>Element ID</td><td>' . $element_id . '</td></tr>'; $content .= '<tr><td>Product Category</td><td>' . $procat_combo . '</td></tr>'; $content .= '<tr><td>Product Brand</td><td>' . $probra_combo . '</td></tr>'; $content .= '<tr><td>' . (is_null($this->id) ? 'New ' : '') . 'Design Name</td><td>' . $design_name . '</tr>'; $content .= '<tr><td>Design Structure</td><td>' . $design_structure . '</td></tr>'; $content .= '<tr><td>Design Content</td><td>' . $design_content . '</td></tr>'; $content .= '<tr><td>Target Price</td><td>' . $target_price . '</td></tr>'; $content .= '<tr><td colspan="2" class="bold" style="padding-top:20px;">' . $attr_title . '</td></tr>'; $content .= '<tr><td>Collection</td><td>' . $attr_collection . '</td></tr>'; // $content .= '<tr><td>Fashion Grade</td><td>'.$attr_fashiongrd.'</td></tr>'; if ($showImage === 'copy') { $status_combo = '<select name="status" class="input red bold">' . loadComboListFromArray($this->getDesignStatus(array('1', '2')), null, $this->status, false) . '</select>'; $content .= '<tr><td class="red bold">NEW Status</td><td>' . $status_combo . '</td></tr>'; } $content .= '</table></div>'; return $content; }
//$q = tep_db_query("SELECT invoice_id FROM `payone_invoice` WHERE invoice_date<'$date_tolerance' AND (invoice_complete_status='0' OR (is_captured IN (0, 2) AND invoice_complete_status NOT IN (2, 3)))"); //Recalculate only for invoice which is new (not yet sent to payone) $q = tep_db_query("SELECT invoice_id FROM `payone_invoice` WHERE invoice_date < '{$date_tolerance}' AND invoice_complete_status = '0'"); while ($row = tep_db_fetch_array($q)) { $invoice = new payone_invoice('invoice_id', $row['invoice_id']); $invoice->recalculate(); } $logger->write("Task 5 - End"); $logger->write("Task 6 (DOOM TO KILL CHECKER) - Start"); if (SERVER_IS_LOCAL) { $logger->write("Skipped! Not to be run in Manobo Local"); } else { use_class('styles'); use_class('products_minierp'); use_class('products_articles'); $class_s = new styles(); $class_pm = new products_minierp(); $class_pa = new products_articles(); $style_id = 680; //COLLECTION: DOOMED TO BE KILLED $products = $class_s->retrieveProducts($style_id, false); $killed = array(); $logger->write('Total products to check: ' . count($products)); foreach ($products as $pid => $date_added) { //SET INACTIVE FOR DTK ARTICLES WHICH HAVE NO DEPOT STOCK $products_articles = $class_pa->retrieveList($pid); foreach ($products_articles as $pa) { $stock_article = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, $pa['products_articles_id']); if ($stock_article == 0) { $class_pa->setActiveStatus($pa['products_articles_id'], 0); }
use_class('logger'); $logger = new logger('cron', 'tradebyte-catalog-uploader'); use_class('xml_tools'); use_class('ProductAttribute'); use_class('Category'); use_class('products_minierp'); use_class('products_articles'); use_class('products_materials'); use_class('products_family'); use_class('jng_sp_catalog'); use_class('styles'); $class_pm = new products_minierp(); $class_pa = new products_articles(); $class_pmat = new products_materials(); $class_jc = new jng_sp_catalog(); $class_s = new styles(); $lid = '2'; $materials_name = array(); $materials_list = $class_pmat->retrieveList(); foreach ($materials_list as $mat) { //take only materials in german language $tmp_mat_name = explode(',', $mat['material_name']); $mat_name = trim($tmp_mat_name[0]); $materials_name[$mat['products_materials_id']] = $mat_name; } /** * Function to send message to responsible PIC * @global type $TB_CATUPLOAD_ADD_SUPERVISORS * @param type $messages */ function sendMessageToAdmin($messages)
<?php /** * Description of settingsforecasting * * @author IT TEAM BONOFACTUM * @created Sep 26, 2013 12:51:14 PM */ use_class('forecasting'); use_class('styles'); $class_s = new styles(); $kw_year = date('Y'); //always set current year as default $data_source = 'calendar-week.php?data='; $forecasting_conf = load_config('forecasting'); function drawDataGraph($fc, $kw_year) { global $data_source, $forecasting_conf; $data_graph = $fc->drawDataForGraph(); //if(count($fc->weeks_projected)>0) $data_graph .= '|||'.$fc->drawDataForGraph(1, true); return $data_source . $kw_year . '|||' . $data_graph; } function displayLTFCollection($id, $name, $products) { return '<div id="level-col-' . $id . '" class="ui-state-default' . ' ui-corner-all pointer level-cols" style="padding:4px;float:left;' . 'margin-right:10px;">' . $name . ' (' . $products . ')</div>'; } if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'SAVENEWFACTOR') { $kw_year = tep_db_prepare_input($_POST['kw_year']); $kw_start = tep_db_prepare_input($_POST['kw_start']); $kw_end = tep_db_prepare_input($_POST['kw_end']);
if (!isset($_POST[$wpbi_settings['parameter']['tb-cb-column-tf']]) || in_array($col_idx, $_POST[$wpbi_settings['parameter']['tb-cb-column-tf']])) { $checked = 'checked'; } $column_name = isset($_POST[$wpbi_settings['parameter']['tb-tx-column-tf']]) ? $_POST[$wpbi_settings['parameter']['tb-tx-column-tf']][$col_idx] : $my_test_col; $columns_html = $columns_html . ' <tr valign="top"> <td scope="row">' . $my_test_col . '</td> <td><input type="checkbox" name="' . $wpbi_settings['parameter']['tb-cb-column-tf'] . '[]" value="' . $col_idx . '" ' . $checked . ' /></td> <td><input type="text" maxlength="64" id="' . $wpbi_settings['parameter']['tb-tx-column-tf'] . '" name="' . $wpbi_settings['parameter']['tb-tx-column-tf'] . '[]" value="' . $column_name . '" /></td> </tr> '; $checked = ''; $col_idx++; } //Styles $styles = new styles(); $styles->set_rootdir($wpbi_url['styles']['directory']); $styles_lst = $styles->get_styles('tables'); $style_options = ''; for ($stl = 0; $stl < sizeof($styles_lst); $stl++) { $checked = ''; if ($_POST[$wpbi_settings['parameter']['tb-style']] == $styles_lst[$stl]) { $checked = 'selected'; } $style_options = $style_options . '<option ' . $checked . ' value="' . $styles_lst[$stl] . '">' . basename($styles_lst[$stl], '.css') . '</option>'; } $template_site->assign_vars(array('TPL_CSS' => $wpbi_url['styles']['url'] . "tables/" . $_POST[$wpbi_settings['parameter']['tb-style']], 'VW_NEW_STYLE_OPTIONS' => $style_options, 'VW_NEW_SETTINGS' => $wpbi_dialog['form']['label']['settings'], 'VW_NEW_VALUES' => $wpbi_dialog['form']['label']['values'], 'VW_NEW_NAME' => $wpbi_dialog['form']['label']['table-name'], 'P_VW_NAME' => $wpbi_settings['parameter']['tb-name'], 'V_VW_NAME' => $_POST[$wpbi_settings['parameter']['tb-name']], 'VW_NEW_TITLE' => $wpbi_dialog['form']['label']['table-title'], 'P_VW_TITLE' => $wpbi_settings['parameter']['tb-title'], 'V_VW_TITLE' => $_POST[$wpbi_settings['parameter']['tb-title']], 'VW_NEW_STYLE' => $wpbi_dialog['form']['label']['table-style'], 'P_VW_STYLE' => $wpbi_settings['parameter']['tb-style'], 'VW_NEW_HEADER' => $wpbi_dialog['form']['label']['table-header'], 'P_VW_HEADER' => $wpbi_settings['parameter']['tb-header'], 'V_VW_HEADER' => $_POST[$wpbi_settings['parameter']['tb-header']], 'V_VW_HEADER_CHECKED' => isset($_POST[$wpbi_settings['parameter']['tb-header']]) ? 'checked' : '', 'VW_NEW_FOOTER' => $wpbi_dialog['form']['label']['table-footer'], 'P_VW_FOOTER' => $wpbi_settings['parameter']['tb-footer'], 'V_VW_FOOTER' => $_POST[$wpbi_settings['parameter']['tb-footer']], 'V_VW_FOOTER_CHECKED' => isset($_POST[$wpbi_settings['parameter']['tb-footer']]) ? 'checked' : '', 'VW_NEW_DOWNLOAD' => $wpbi_dialog['form']['label']['table-download'], 'P_VW_DOWNLOAD' => $wpbi_settings['parameter']['tb-download'], 'V_VW_DOWNLOAD' => $_POST[$wpbi_settings['parameter']['tb-download']], 'V_VW_DOWNLOAD_CHECKED' => isset($_POST[$wpbi_settings['parameter']['tb-download']]) ? 'checked' : '', 'VW_NEW_HTML_VALUES' => $wpbi_dialog['form']['label']['table-html-values'], 'P_VW_HTML_VALUES' => $wpbi_settings['parameter']['tb-html-values'], 'V_VW_HTML_VALUES' => $_POST[$wpbi_settings['parameter']['tb-html-values']], 'V_VW_HTML_VALUES_CHECKED' => isset($_POST[$wpbi_settings['parameter']['tb-html-values']]) ? 'checked' : '', 'VW_NEW_ROWS_PER_PG' => $wpbi_dialog['form']['label']['table-rows-pg'], 'P_VW_ROWS_PER_PG' => $wpbi_settings['parameter']['tb-row-pg'], 'V_VW_ROWS_PER_PG' => is_numeric($_POST[$wpbi_settings['parameter']['tb-row-pg']]) ? abs(intval($_POST[$wpbi_settings['parameter']['tb-row-pg']])) : $wpbi_settings['parameter']['page-interval'], 'P_VW_TX_COLUMN_TF' => $wpbi_settings['parameter']['tb-tx-column-tf'], 'VW_NEW_COLUMNS' => $wpbi_dialog['form']['label']['table-col'], 'VW_NEW_COL_VISIBLE' => $wpbi_dialog['form']['label']['table-col-visible'], 'VW_NEW_COL_LABEL' => $wpbi_dialog['form']['label']['table-col-label'], 'VW_EDIT_COL_ISTIME' => $wpbi_dialog['form']['label']['table-col-istime'], 'LBL_BTN_ADD' => $wpbi_dialog['button']['label']['save'], 'LBL_BTN_TEST' => $wpbi_dialog['button']['label']['test'], 'P_VW_QY' => $wpbi_settings['parameter']['qy_id'], 'V_VW_QY' => $_POST[$wpbi_settings['parameter']['qy_id']], 'P_VW_ACTION' => $wpbi_settings['parameter']['action'], 'V_ADD_ACTION' => $wpbi_settings['value']['add'], 'V_TEST_ACTION' => $wpbi_settings['value']['test'], 'VW_TEST_RESULT' => $test_output, 'VW_NEW_STYLE_DEFAULT_OPT' => $wpbi_dialog['form']['option']['table-style-default'], 'VW_NEW_COLUMNS_OPTIONS' => $columns_html)); wp_enqueue_script('datatables-jquery', $wpbi_url['datatables']['jquerymin']); //Store output ob_start(); $template_site->pparse('tables-new-2');
<?php //*SPECIAL NOTE: THIS MODULE IS CALLED FROM PRODUCTS ANALYSIS //$_POST['me_action'] = 'LOADPRODUCT'; //$_POST['pid'] = '3103'; $maxnav = 3; use_class('styles'); $class_s = new styles(); $header = array(); $header['img'] = 'Product'; $header['name'] = 'Info'; $header['age'] = 'Age'; $header['ts1'] = 'Total Sold'; $header['ts2'] = 'Total Sales (EUR)'; $header['ps'] = 'Pieces Sold'; $header['pspw'] = 'Qty.<br />Sold<br />p.W'; $header['pspm'] = 'Qty.<br />Sold<br />p.M'; $header['pb'] = 'Brand'; $header['cur'] = 'Current <span class="curgroup"></span>'; $header['act'] = 'New <span class="curgroup"></span>'; function drawAttribute($pid, $id, $name) { return '<div id="attr-' . $pid . '-' . $id . '" class="boxer input ui-corner-all" style="margin:2px 10px;"><div class="notice pointer attr-remove" style="float:right;" title="Remove Attribute">[x]</div><div title="Click [x] to remove this Attribute">' . $name . '</div></div> '; } function loadProductRow($pid, $pos, $curgroup_id) { global $class_s, $header, $maxnav; use_class('products_minierp'); $class_pm = new products_minierp(); $product = $class_pm->retrieveDetail($pid, 'p,pl,sp'); $cols = array();
<?php /** * GENERATE IMAGES FOR OTTO B2B BASED ON COLLECTION ID * FILES WILL BE CREATED IN SERVER temp PATH, IN A SUBFOLDER * WHICH CAN BE DYNAMICALLY ADJUSTED BELOW ($dest_path) */ global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; require_once DIR_WS_FUNCTIONS . 'html_output.php'; tep_db_connect(); use_class('styles'); use_class('Product'); $class_s = new styles(); $dest_path = 'OTTO-Online-' . date('ymd') . '/'; if (!is_dir($dest_path)) { mkdir($dest_path, 0750); } $styles_id = tep_db_prepare_input($_GET['styles_id']); $products = array_keys($class_s->retrieveProducts($styles_id)); foreach ($products as $pid) { $p = new Product($pid); $images = array(); $main_default = $p->getImageRaw(Product::IMAGE_TYPE_DEFAULT); $main_amazon = $p->getImageRaw(Product::IMAGE_TYPE_AMAZON); $images[] = is_null($main_amazon) || $main_amazon == '' ? $main_default : $main_amazon; $total_additional_image = $p->getAdditionalImageTotal(); for ($i = 0; $i < $total_additional_image; $i++) { $images[] = $p->getImageAdditionalRaw($i);
$q .= ", COUNT(DISTINCT d2.designs_id) AS totaldes"; $q .= " FROM minierp_users mu"; $q .= " INNER JOIN designs d ON d.owner=mu.id"; $q .= " LEFT JOIN designs d2 ON d2.owner=mu.id AND d2.status={$status}"; if ($sub_status != '') { $q .= " AND d2.sub_status={$sub_status}"; } // $q .= " WHERE d.status IN (1,2,3,4,5,6,7,8,10,11,12)"; $q .= " WHERE d.status IN (1,2,3,4,5,6,7,8,10,11,12,13,14)"; $q .= " GROUP BY owner_id ORDER BY owner_name"; $r = tep_db_query($q); while ($row = tep_db_fetch_array($r)) { $designers[$row['owner_id']] = "{$row['owner_name']} ({$row['totaldes']})"; } use_class('styles'); $class_s = new styles(); $designs_filter .= '<div class="filter_desown" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Designer</strong><select><option value="0">Show All</option>' . loadComboListFromArray($designers, null, $designs_owner) . '</select></div>'; $designs_filter .= '<div class="filter_destype" style="margin-bottom:5px;float:left;"><strong style="margin:0 5px 0 20px;">Design Type</strong><select><option value="0">Show All</option>' . loadComboListFromArray(design::getDesignType(), null, $designs_type) . '</select></div>'; $designs_filter .= '<div class="filter_descat" style="margin-bottom:5px;float:left;"><strong style="margin:0 5px 0 20px;">Design Category</strong><select><option value="0">Show All</option>' . loadComboListFromArray(design::getDesignCategory(), null, $designs_category) . '</select></div>'; $pcs = getProductsCategorySupportData(); $prodcats .= loadComboList($pcs['tables'], $pcs['field_id'], $pcs['field_name'], $products_category, $pcs['filter']); $designs_filter .= '<div class="filter_prodcat" style="margin-bottom:5px;float:left;"><strong style="margin:0 5px 0 20px;">Product Category</strong><select><option value="0">Show All</option>' . $prodcats . '</select></div>'; $designs_filter .= '<div class="filter_collection" style="margin-bottom:5px;' . ($status > 2 ? 'float:left;' : '') . '"><strong style="margin:0 5px 0 20px;">Collection</strong><select><option value="0">Show All</option>' . $class_s->drawComboOptions($styles_id_L, 'L', null, '', 'sd.name') . '</select></div>'; if ($status > 2) { $designs_filter .= '<div class="filter_leadtime" style="margin-bottom:5px;"><strong style="margin:0 5px 0 20px;">Lead Time</strong>' . leadTimeCombo($lead_time_value) . '</div>'; } $designs_filter .= '<div style="margin:2px;clear:both;"> ⋅ <span class="smallText red">Sorting is available only for your Design which is on <strong>Ideas</strong> and <strong>Request</strong> Tab, and Filter by <strong>Category</strong> and <strong>Attributes</strong> is not used</div>'; $filter = $styles_id_L <= 0 ? '' : " AND styles_id_L={$styles_id_L} "; if ($designs_type != '0') { $filter .= " AND d.designs_type='{$designs_type}' "; }
/** * Draw list of all attributes of a product for 1 specific attribute group. To add behavior for adding and removing attributes, * be sure to include the javascript behavior with function drawAttributesJSBehavior(). Javascript needed to be attached * only once even if you call drawAttributes function several times in 1 module. * @global Object $class_s styles object, will be auto created if none found * @param Int $products_id Product ID * @param String $attr_group Attribute Group * @return String html string of all attributes */ function drawAttributes($products_id, $attr_group) { global $class_s; if (!is_object($class_s)) { use_class('styles'); $class_s = new styles(); } $attributes = $class_s->retrieveList($attr_group, "shp.products_id='{$products_id}'"); $total_attrs = count($attributes); $icon_add_style = $total_attrs == 0 ? 'display:none;' : ''; $form_style = $total_attrs == 0 ? '' : 'display:none;'; $result = '<div id="attr-' . $products_id . '-' . $attr_group . '" class="attr-form-parent">'; //add (plus) icon floating right, please only use one (left/right) //$result .= '<div style="float:right;'.$icon_add_style.'" title="Click to add" class="btn-attr-add ui-state-default ui-corner-all"><span class="ui-icon ui-icon-plus pointer"></span></div>'; $result .= '<div class="attr-form" style="margin-bottom:5px;' . $form_style . '">'; $result .= '<select class="cmb-attr-form input">'; $result .= '<option value="0">Add New ' . $class_s->groups[$attr_group] . '...</option>'; $result .= $class_s->drawComboOptions('', $attr_group, null, '', 'sd.name'); $result .= '</select>'; $result .= '</div>'; // .attr-form $result .= '<div class="attr-list" style="float:left;">'; foreach ($attributes as $attr) { $result .= $this->drawSingleAttribute($products_id, $attr['styles_id'], $attr['name'], $attr_group); } //add (plus) icon floating left, please only use one (left/right) $result .= '<div style="float:left;margin:1px 0 0 2px;' . $icon_add_style . '" title="Click to add" class="btn-attr-add ui-state-default ui-corner-all"><span class="ui-icon ui-icon-plus pointer"></span></div>'; $result .= '</div>'; $result .= '</div>'; // #attr-{products_id}-{attr_group} return $result; }
use_class('Product'); use_class('design_draft'); use_class('products_minierp'); use_class('products_articles'); use_class('products_brand'); use_class('element'); use_class('jng_sp'); use_class('jng_sp_catalog'); use_class('styles'); $class_pm = new products_minierp(); $class_pa = new products_articles(); $class_pb = new products_brand(); $class_sp = new jng_sp(); $class_jc = new jng_sp_catalog(); $class_s = new styles(); $imgsize = '80'; $net_pricer = 1 + VAT; /** * Remove products from style_has_products Table exclude grup Sub Categories (S) * @param Int $product_id Product ID * @param String $filter_1 Styles ID separated by comma * @param String $filter_2 Styles ID separated by comma * @return Delete */ function removeProducts($product_id, $filter_1 = '', $filter_2 = '') { $q = "DELETE shp.* FROM styles s"; $q .= " INNER JOIN styles_has_products shp ON shp.styles_id=s.styles_id"; $q .= " WHERE s.groups!='S' AND shp.products_id='{$product_id}'"; if ($filter_1 != "" && $filter_2 != "") {
use_class('jng_sp_catalog_params'); use_class('jng_sp_upload'); use_class('products_minierp'); use_class('products_articles'); use_class('products_linking'); use_class('products_brand'); use_class('styles'); use_class('products_materials'); use_class('Category'); use_class('SalesPartner'); $class_sp = new jng_sp(); $class_jc = new jng_sp_catalog(); $class_jcp = new jng_sp_catalog_params(); $class_ju = new jng_sp_upload(); $class_pl = new products_linking(); $class_s = new styles(); $class_pb = new products_brand(); $class_pa = new products_articles(); $class_pmat = new products_materials(); $class_pm = new products_minierp(); //load brands $brandlist = $class_pb->retrieveList(); //SP SETTING salesPartnerCombo(); $create_image_zip = true; /* Moved to confy (used also on sp-catalog-updater) and changed to LAZADA_ZALORA_DEFAULT_SALE_END_DATE define('DEFAULT_SALE_END_DATE', '2016-10-01'); */ //direct download means the file is not sent automatically to SP $spid_use_directdownload = array('4', '1001', '1002', '1003', '1004', '1005'); $is_directdownload = in_array($jng_sp_id, $spid_use_directdownload);