$content .= '<form name="pbrand" action="?open=products-brand" method="post" enctype="multipart/form-data">'; $total_products = $brand_id > 0 ? $class_pb->getTotalProducts($brand_id) : 0; if (!$is_deleted) { $content .= '<input type="hidden" name="me_action" value="SAVEPRODUCTSBRAND" />'; $content .= '<input type="hidden" name="brand_id" value="' . $brand_id . '" />'; $content .= '<table border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr><td width="130">Active Status</td><td><input type="checkbox" id="brandstatus" name="active_status" value="1" ' . $active_status . ' /> <label for="brandstatus" class="red">Check this to activate brand in J&G Website</label></td></tr>'; $content .= '<tr><td>Active Products</td><td>' . strval($total_products) . '</td></tr>'; $content .= '<tr><td>Brand Name</td><td><input type="text" name="brand_name" value="' . $brand_name . '" class="input2" /></td></tr>'; $content .= '<tr><td>Brand Description</td><td><textarea id="brand-desc" name="brand_description" class="input2" style="height:100px;">' . $brand_desc . '</textarea></td></tr>'; $content .= '<tr><td>SEO Brand Text</td><td><textarea id="seo_text" name="seo_text" class="input2" style="height:100px;">' . $seo_text . '</textarea></td></tr>'; $content .= '<tr><td>Upload Brand Logo</td><td><input type="file" name="brand_image" /></td></tr>'; $content .= '<tr><td>Need Repackaging</td><td><input type="checkbox" name="need_repackaging" ' . $need_repackaging . ' value="1" /></td></tr>'; $content .= '<tr><td colspan="2" style="padding-top:20px;"><h3>Brand ID in Sales Partner</h3></td></tr>'; $partners = $class_sp->retrieveList(); $sp_brands = $brand_id != '' ? $class_pb->getSPbrands($brand_id) : array(); foreach ($partners as $p) { $sp_brand_id = isset($sp_brands[$p['jng_sp_id']]) ? $sp_brands[$p['jng_sp_id']] : ''; $content .= '<tr><td>' . $p['name'] . '</td><td><input type="text" name="sp_brand_id[' . $p['jng_sp_id'] . ']" value="' . $sp_brand_id . '" class="input" /></td></tr>'; } } $content .= '</table>'; $content .= '<div class="buttons w500">'; $content .= '<div>'; if (!$is_deleted) { $content .= '<input type="submit" name="submit" value="' . $brand_action . '" class="blue" />'; // if($id>0) $content .= '<div style="float:right;">'.buttonWithIcon("ui-icon-trash", "btn-delete", '', 'Delete this brand').'</div>'; } $content .= '<input type="button" id="kill-brand" class="red" value="Kill Brand" title="Click this button to delete brand, all products under this brand will be automatically killed" />'; $content .= '</div>'; $content .= '<div style="margin-top:5px;"><input type="button" id="brand-list" value="Back to Brand List" /></div>';
$class_sp = new jng_sp(); $class_jpc = new jng_sp_catalog_params(); $class_pb = new products_brand(); //SP SETTING salesPartnerCombo(); //AJAX ACTOIN if (isset($_GET['tab'])) { $param_code = tep_db_prepare_input($_GET['tab']); $result = ''; if ($param_code == 'BL') { $brands = $class_pb->retrieveList(); $result .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">'; foreach ($brands as $b) { $param_id = $b['products_brand_id']; $param_name = $b['brand_name']; $sp_brands = $class_pb->getSPbrands($param_id); $param_value = $sp_brands[$jng_sp_id]; $checked = $param_value != '' ? 'checked="checked"' : ''; $result .= '<tr>'; $result .= '<td width="20"><input type="checkbox" id="param_id_' . $param_code . $param_id . '" class="param_id" value="' . $param_id . '" ' . $checked . ' /></td>'; $result .= '<td width="150"><label for="param_id_' . $param_code . $param_id . '">' . $param_name . '</label></td>'; $result .= '<td><input type="text" id="param_value_' . $param_id . '" class="input param_value" value="' . $param_value . '" /></td>'; $result .= '<td id="param_status_' . $param_code . $param_id . '"></td>'; $result .= '</tr>'; } $result .= '</table></div>'; } else { $params_raw = $class_jpc->load($jng_sp_id, $param_code); $params = array(); foreach ($params_raw as $pr) { $params[$pr['param_id']] = $pr['param_value'];
//OTTO.DE UPLOAD PROCESS //check cron/sp-2-catalog-updater.php $content .= '<h3 class="red">' . $jng_sp_name . ': Stock Update is managed by cron</h3>'; } elseif (in_array($jng_sp_id, $sp_local_id)) { //LAZADA AND ZALORA STOCK UPDATE $sp_detail = $class_sp->retrieveDetail($jng_sp_id); $lid = $sp_detail['languages_id']; $o_products = $class_jc->retrieveCatalogForUpload($jng_sp_id, true); $csv_data = array(); $row = array('SellerSku', 'Quantity', 'Price', 'SalePrice', 'SaleStartDate', 'SaleEndDate', 'Name'); $csv_data[] = $row; foreach ($o_products as $pid => $data) { $p = new Product($pid); $sp_values_brand = array(); $category_id = $p->category_id; $sp_brands = $class_pb->getSPbrands($p->brand_id); $sp_values_brand[$p->brand_id] = $sp_brands[$jng_sp_id]; $product_old_function = $p->getOldProductFunction()->retrieveDetail($p->id, 'p,pd,pd2,pc,pnc,cat,pei,pci'); //start looping the articles foreach ($p->articles as $aid => $a) { //todo: check and confirm articles for jewelry products if (!$p->isArticleKilled($aid)) { $row = array(); //SellerSku if ($category_top_id == '1') { if ($category_id == '29') { //ring only reported for length between 4.6 and 6 if ($a['length'] > 4.6 && $a['length'] < 6.0) { $row[] = $p->getSKU($aid); } else { continue;