$eao = 2;
//element adjust order
use_class('design');
use_class('elements_preorder');
use_class('elements_order');
use_class('elements_stock');
use_class('products_articles');
use_class('products_minierp');
$class_es = new elements_stock();
$class_pm = new products_minierp();
$class_pa = new products_articles();
$ean_eu_collection = array();
$max_el_per_article = 0;
$use_elements = array();
$class_d = new design($_GET['d']);
$products = $class_d->retrieveProducts();
foreach ($products as $p) {
    $query_products_categories = "SELECT * FROM products_to_categories ptc WHERE products_id={$p['products_id']}";
    $tpdbq_products_categories = tep_db_query($query_products_categories);
    $products_categories = tep_db_fetch_array($tpdbq_products_categories);
    // find what use element in this product
    $ean_eu_collection[$p['products_id'] . '-0'] = '';
    $tpdbq_products_use_elements = $class_pm->retrieveElementsUsage($p[products_id]);
    foreach ($tpdbq_products_use_elements as $row_pue) {
        $use_elements[] = array('elements_id' => $row_pue['elements_id'], 'quantity' => (int) $row_pue['quantity'] * $eao);
        $ean_eu_collection[$p['products_id'] . '-0'] .= $row_pue['elements_id'] . ' x ' . $row_pue['quantity'] . '|';
    }
    $mepa = count($tpdbq_products_use_elements);
    if ($mepa > $max_el_per_article) {
        $max_el_per_article = $mepa;
    }
Ejemplo n.º 2
0
     //        }
     //        $product = productLinkManageElementsUsed($products_id, $product_name);
     $product = productLinkWithID($products_id, $product_name, '&designs_id=' . $designs_id);
     $result = array();
     $result['product'] = $product;
     $result['designs_id'] = $draft->designs_id;
     $result['drafts_id'] = $draft->id;
     $result['products_id'] = $products_id;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'DELETEPRODUCT') {
     $products_id = tep_db_prepare_input($_POST['products_id']);
     $draft = new design_draft(null, $products_id);
     $draft->deleteProduct($products_id, $session_userinfo['username']);
     $design = new design($draft->designs_id);
     $products = $design->retrieveProducts();
     //        $need_load_row_design = (count($products)>0) ? false : true;
     $result = array();
     $result['products_id'] = $products_id;
     $result['designs_id'] = $design->id;
     $result['drafts_id'] = $draft->id;
     $result['status'] = 'DELETED';
     //        $result['load_row_design'] = $need_load_row_design;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'DELETEELEMENT') {
     $elements_id = tep_db_prepare_input($_POST['elements_id']);
     $new_status = tep_db_prepare_input($_POST['new_status']);
     $draft = new design_draft(null, null, $elements_id);
     $draft->deleteElement($elements_id, $session_userinfo['username']);
     $st_counter = '';