//$tb->connect('NONSSL');
     $target_filename = TRADEBYTE_FTP_IN_PATH . $xml_file;
     $success_upload = false;
     if ($tb->send($xml_filename, $target_filename)) {
         rename($xml_filename, TRADEBYTE_ARCHIVE_CAT_PATH . $xml_file);
         $success_upload = true;
     }
     $tb->disconnect();
     if ($success_upload) {
         //SET family_locked FOR ALREADY UPLOADED PRODUCTS TO TB
         $class_pm->updateFlagFamilyLocked($products_uploaded, 1);
         $class_pm->setTBStatus($products_uploaded, 1);
         if (count($images_uploaded) > 0) {
             $class_jc->updateImageUploadStatus($tb_sp_ids, $images_uploaded, '1');
         }
         $class_jc->updatePriceUploadStatus($tb_sp_ids, $products_uploaded, '1');
         //Set all catalog for each jng_sp_id (related to the upload)
         //last_active_status = 1/0 to trigger the active age counting.
         if (count($last_active_status_need_update) > 0) {
             $all_cats = implode(',', $last_active_status_need_update);
             $filter_las = "jng_sp_catalog_id IN ({$all_cats})";
             $class_jc->updateLastActiveStatus(null, $filter_las);
         }
         $messages['s'] = "<h3>{$total_family_uploaded} of {$total_family}" . " Family are uploaded to TB</h3>" . "<h3>{$total_products_uploaded} products are uploaded to TB</h3>";
     } else {
         $messages['e'] = '<h3>Failed uploading xml cat to TB Server</h3><br/>';
         unlink($xml_filename);
     }
 } else {
     $messages['n'] = 'No products need to upload/reupload to Tradebyte';
     unset($xmlt);
Пример #2
0
     $spid = tep_db_prepare_input($_POST['spid']);
     $val = tep_db_prepare_input($_POST['chk']);
     $newvalue = $val == 1 ? '0' : '1';
     $class_jc->updateImageUploadStatus($spid, $pid, $newvalue);
     $ajaxResult = array();
     $ajaxResult['pid'] = $pid;
     $ajaxResult['status'] = '<div class="red">Image uploaded status changed!</div>';
     $ajaxResult['loadid'] = $_POST['loadid'];
     ajaxReturn($ajaxResult);
     exit;
 } elseif ($_POST['me_action'] == 'PRICEREUPLOAD') {
     $pid = tep_db_prepare_input($_POST['pid']);
     $spid = tep_db_prepare_input($_POST['spid']);
     $val = tep_db_prepare_input($_POST['chk']);
     $newvalue = $val == 1 ? '0' : '1';
     $class_jc->updatePriceUploadStatus($spid, $pid, $newvalue);
     $ajaxResult = array();
     $ajaxResult['pid'] = $pid;
     $ajaxResult['status'] .= '<div class="red">Price uploaded status changed!</div>';
     $ajaxResult['loadid'] = $_POST['loadid'];
     ajaxReturn($ajaxResult);
     exit;
     //    } elseif($_POST['me_action']=='IMGREUPLOADALL') {
     //        $pids = explode(",",$_POST['pids']);
     //        $spid = tep_db_prepare_input($_POST['spid']);
     //        $val = tep_db_prepare_input($_POST['chk']);
     //        $class_jc->updateImageUploadStatus($spid, $pids, $val);
     //        $ajaxResult = array();
     //        $ajaxResult['status'] = ($val==1) ? 'On' : 'Off';
     //        $ajaxResult['tooltip'] = ($val==1) ? 'Check to exclude this product image when generate catalog' : 'Uncheck to include this product image when generate catalog';
     //        $ajaxResult['statusclass'] = ($val==1) ? 'green' : 'red';