Execute("select * from " . TABLE_PRODUCTS . " limit 1"); if ($chk_products->RecordCount() < 1) { $messageStack->add_session(ERROR_DEFINE_PRODUCTS, 'caution'); zen_redirect(zen_href_link(FILENAME_CATEGORIES)); } // verify product has a master_categories_id $chk_products = $db->Execute("select master_categories_id from " . TABLE_PRODUCTS . " where products_id='" . $_GET['products_filter'] . "'"); if ($chk_products->fields['master_categories_id'] <= 0) { $messageStack->add(ERROR_DEFINE_PRODUCTS_MASTER_CATEGORIES_ID, 'caution'); // zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $languages = zen_get_languages(); function array_minus_array($a, $b) { $c=array_diff($a,$b); $c=array_intersect($c, $a); return $c; } $products_filter = ((isset($_GET['products_filter']) and $_GET['products_filter'] > 0) ? $_GET['products_filter'] : $_POST['products_filter']); $action = (isset($_GET['action']) ? $_GET['action'] : ''); $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id); if ($action == 'new_cat') { $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id); $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name"); $products_filter = $new_product_query->fields['products_id']; // $messageStack->add_session('SUCCESSFUL! SWITCHED CATEGORIES', 'success'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } // set categories and products if not set if ($products_filter == '' and $current_category_id != '') { $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name"); $products_filter = $new_product_query->fields['products_id']; if ($products_filter != '') { $messageStack->add_session(WARNING_PRODUCTS_LINK_TO_CATEGORY_REMOVED, 'caution'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } } else { if ($products_filter == '' and $current_category_id == '') { $reset_categories_id = zen_get_category_tree('', '', '0', '', '', true); $current_category_id = $reset_categories_id[0]['id']; $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name"); $products_filter = $new_product_query->fields['products_id']; $_GET['products_filter'] = $products_filter; } } require(DIR_WS_MODULES . FILENAME_PREV_NEXT); if (zen_not_null($action)) { switch ($action) { case 'set_products_filter': $_GET['products_filter'] = $_POST['products_filter']; zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $_GET['products_filter'] . '¤t_category_id=' . $_POST['current_category_id'])); break; case 'copy_categories_products_to_another_category_linked': $zv_invalid_copy_linked = 'false'; $zv_complete_message_linked = ''; $copy_from_linked = $_POST['copy_categories_id_from_linked']; $copy_to_linked = $_POST['copy_categories_id_to_linked']; // do not proceed unless categories are different if ($copy_from_linked == $copy_to_linked) { $messageStack->add_session(WARNING_DUPLICATE_PRODUCTS_TO_CATEGORY_LINKED, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_from_linked . "' limit 1"); $check_category_to = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_to_linked . "' limit 1"); // check if from is valid category if ($check_category_from->RecordCount() < 1) { $zv_invalid_copy_linked = 'true'; $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $copy_from_linked . ' '; } else { $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $copy_from_linked . ' '; } // check if to is valid category if ($check_category_to->RecordCount() < 1) { if (zen_childs_in_category_count($copy_to_linked) > 0) { $zv_invalid_copy_linked = 'true'; $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $copy_to_linked . ' '; } } else { $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $copy_to_linked . ' '; } if ($zv_invalid_copy_linked == 'true') { $messageStack->add_session($zv_complete_message_linked, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } /////////////////////////////////////////////////////////////// // if either category was invalid nothing processes below /////////////////////////////////////////////////////////////// // get products to be linked from $products_to_categories_from_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_from_linked . "'"); while (!$products_to_categories_from_linked->EOF) { $add_links_array[] = array('products_id' => $products_to_categories_from_linked->fields['products_id']); $products_to_categories_from_linked->MoveNext(); } // get products already in category to be linked to $products_to_categories_to_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_to_linked . "'"); while (!$products_to_categories_to_linked->EOF) { $remove_links_array[] = array('products_id' => $products_to_categories_to_linked->fields['products_id']); $products_to_categories_to_linked->MoveNext(); } // cannot count added/removed due to the nature of the how these are done // $cnt_added = 0; // remove elements in $remove_links_array that are in $add_links_array for ($i=0, $n=sizeof($add_links_array); $i<$n; $i++) { $good = 'true'; for ($j=0, $nn=sizeof($remove_links_array); $j<$nn; $j++) { if ($add_links_array[$i]['products_id'] == $remove_links_array[$j]['products_id']) { $good = 'false'; break; } } // build final of good products if ($good == 'true') { $make_links_result[] = array('products_id' => $add_links_array[$i]['products_id']); } } for ($i=0, $n=sizeof($make_links_result); $i<$n; $i++) { // $cnt_added++; $new_product = $make_links_result[$i]['products_id']; $sql = "insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ($new_product, $copy_to_linked)"; $db->Execute($sql); } // set message of completion if (sizeof($make_links_result) == 0) { $zv_complete_message_linked = WARNING_COPY_FROM_IN_TO_LINKED . $zv_complete_message_linked; $warning_color = 'caution'; } else { if ($check_category_from->RecordCount() < 1 or $check_category_to->RecordCount() < 1) { $zv_complete_message_linked = WARNING_COPY_LINKED . $zv_complete_message_linked; $warning_color = 'error'; } else { $zv_complete_message_linked = SUCCESS_COPY_LINKED . $zv_complete_message_linked; $warning_color = 'success'; } } if (sizeof($make_links_result) == 0) { $messageStack->add_session($zv_complete_message_linked, $warning_color); } else { $messageStack->add_session($zv_complete_message_linked, $warning_color); } zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); break; case 'remove_categories_products_to_another_category_linked': $zv_invalid_remove_linked = 'false'; $zv_complete_message_linked = ''; $remove_from_linked = $_POST['remove_categories_id_from_linked']; $remove_to_linked = $_POST['remove_categories_id_to_linked']; // do not proceed unless categories are different if ($remove_from_linked == $remove_to_linked) { $messageStack->add_session(WARNING_DUPLICATE_PRODUCTS_TO_CATEGORY_LINKED, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_from_linked . "' limit 1"); $check_category_to = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_to_linked . "' limit 1"); // check if from is valid category if ($check_category_from->RecordCount() < 1) { $zv_invalid_remove_linked = 'true'; $zv_complete_message_linked .= WARNING_REMOVE_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $remove_from_linked . ' '; } else { $zv_complete_message_linked .= SUCCESS_REMOVE_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $remove_from_linked . ' '; } // check if to is valid category if ($check_category_to->RecordCount() < 1) { $zv_invalid_remove_linked = 'true'; $zv_complete_message_linked .= WARNING_REMOVE_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $remove_to_linked . ' '; } else { $zv_complete_message_linked .= SUCCESS_REMOVE_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $remove_to_linked . ' '; } if ($zv_invalid_remove_linked == 'true') { $messageStack->add_session($zv_complete_message_linked, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } /////////////////////////////////////////////////////////////// // if either category was invalid nothing processes below /////////////////////////////////////////////////////////////// // get products to be removed as added linked from $products_to_categories_from_linked = $db->Execute("select ptoc.products_id, p.master_categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc left join " . TABLE_PRODUCTS . " p on ptoc.products_id=p.products_id where ptoc.categories_id='" . $remove_from_linked . "'"); while (!$products_to_categories_from_linked->EOF) { if ($products_to_categories_from_linked->fields['master_categories_id'] == $remove_to_linked) { //die('THIS IS THE MASTER CATEGORIES ID!! ' . $remove_to_linked . '
'); //break; $master_categories_id_stop[] = array('products_id' => $products_to_categories_from_linked->fields['products_id'], 'master_categories_id' => $products_to_categories_from_linked->fields['master_categories_id']); } $add_links_array[] = array('products_id' => $products_to_categories_from_linked->fields['products_id'], 'master_categories_id' => $products_to_categories_from_linked->fields['master_categories_id']); $products_to_categories_from_linked->MoveNext(); } $stop_warning = ''; if (sizeof($master_categories_id_stop) > 0) { for ($i=0, $n=sizeof($master_categories_id_stop); $i<$n; $i++) { $stop_warning .= TEXT_PRODUCTS_ID . $master_categories_id_stop[$i]['products_id'] . ': ' . zen_get_products_name($master_categories_id_stop[$i]['products_id']) . '
'; } $stop_warning_message = WARNING_MASTER_CATEGORIES_ID_CONFLICT . ' ' . TEXT_MASTER_CATEGORIES_ID_CONFLICT_FROM . $remove_from_linked . TEXT_MASTER_CATEGORIES_ID_CONFLICT_TO . $remove_to_linked . '
' . TEXT_INFO_MASTER_CATEGORIES_ID_PURPOSE . WARNING_MASTER_CATEGORIES_ID_CONFLICT_FIX . '

' . TEXT_INFO_MASTER_CATEGORIES_ID_CONFLICT . $remove_to_linked . '
' . $stop_warning . '
'; $messageStack->add_session($stop_warning_message, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $master_categories_id_stop[0]['products_id'] . '¤t_category_id=' . $current_category_id)); // die('THIS IS THE MASTER CATEGORIES ID!! ' . $remove_to_linked . ' - stop: ' . sizeof($master_categories_id_stop) . '
'); } // get products already in category to be removed as linked to $products_to_categories_to_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_to_linked . "'"); while (!$products_to_categories_to_linked->EOF) { $remove_links_array[] = array('products_id' => $products_to_categories_to_linked->fields['products_id']); $products_to_categories_to_linked->MoveNext(); } // $cnt_removed = 0; // remove elements in $remove_links_array that are in $add_links_array for ($i=0, $n=sizeof($add_links_array); $i<$n; $i++) { $good = 'true'; for ($j=0, $nn=sizeof($remove_links_array); $j<$nn; $j++) { if ($add_links_array[$i]['products_id'] == $remove_links_array[$j]['products_id']) { $good = 'true'; break; } } // build final of good products if ($good == 'true') { $make_links_result[] = array('products_id' => $add_links_array[$i]['products_id']); } } for ($i=0, $n=sizeof($make_links_result); $i<$n; $i++) { // $cnt_removed++; $remove_product = $make_links_result[$i]['products_id']; $sql = "delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $remove_product . "' and categories_id='" . $remove_to_linked . "'"; $db->Execute($sql); } // set message of completion if (sizeof($make_links_result) == 0) { $zv_complete_message_linked = WARNING_REMOVE_FROM_IN_TO_LINKED . $zv_complete_message_linked; $warning_color = 'caution'; } else { if ($check_category_from->RecordCount() < 1 or $check_category_to->RecordCount() < 1) { $zv_complete_message_linked = WARNING_REMOVE_LINKED . $zv_complete_message_linked; $warning_color = 'warning'; } else { $zv_complete_message_linked = SUCCESS_REMOVE_LINKED . $zv_complete_message_linked; $warning_color = 'success'; } } if (sizeof($make_links_result) == 0) { $messageStack->add_session($zv_complete_message_linked, $warning_color); } else { $messageStack->add_session($zv_complete_message_linked, $warning_color); } zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); break; case 'reset_categories_products_to_another_category_master': // reset the master_categories_id for all products in selected category $zv_invalid_reset_master= 'false'; $zv_complete_message_master = ''; $reset_from_master = $_POST['reset_categories_id_from_master']; $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $reset_from_master . "' limit 1"); // check if from is valid category if ($check_category_from->RecordCount() < 1) { $zv_invalid_reset_master = 'true'; $zv_complete_message_master .= WARNING_RESET_ALL_PRODUCTS_TO_CATEGORY_FROM_MASTER . $reset_from_master . ' '; } else { $zv_complete_message_master .= SUCCESS_RESET_ALL_PRODUCTS_TO_CATEGORY_FROM_MASTER . $reset_from_master . ' '; } if ($zv_invalid_reset_master == 'true') { $messageStack->add_session($zv_complete_message_master, 'warning'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } /////////////////////////////////////////////////////////////// // if either category was invalid nothing processes below /////////////////////////////////////////////////////////////// $reset_master_categories_id = $db->Execute("select p.products_id, p.master_categories_id, ptoc.categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc on ptoc.products_id= p.products_id and ptoc.categories_id='" . $reset_from_master . "' where ptoc.categories_id='" . $reset_from_master . "'"); while (!$reset_master_categories_id->EOF) { $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $reset_from_master . "' where products_id='" . $reset_master_categories_id->fields['products_id'] . "'"); // reset products_price_sorter for searches etc. zen_update_products_price_sorter($reset_master_categories_id->fields['products_id']); $reset_master_categories_id->MoveNext(); } $messageStack->add_session($zv_complete_message_master, 'success'); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); break; case 'set_master_categories_id': $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $_GET['master_category'] . "' where products_id='" . $products_filter . "'"); // reset products_price_sorter for searches etc. zen_update_products_price_sorter($products_filter); zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $_GET['products_filter'] . '¤t_category_id=' . $current_category_id)); break; case 'update_product': $zv_check_master_categories_id = 'true'; $new_categories_sort_array[] = $_POST['current_master_categories_id']; $current_master_categories_id = $_POST['current_master_categories_id']; // set the linked products master_categories_id product(s) for ($i=0, $n=sizeof($_POST['categories_add']); $i<$n; $i++) { // is current master_categories_id in the list? if ($zv_check_master_categories_id == 'true' and $_POST['categories_add'][$i] == $current_master_categories_id->fields['master_categories_id']) { $zv_check_master_categories_id = 'true'; // array is set above to master category } else { $new_categories_sort_array[] = $_POST['categories_add'][$i]; } } // remove existing products_to_categories for current product $db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $products_filter . "'"); $reset_master_categories_id = ''; $old_master_categories_id = $current_master_categories_id; // add products to categories in order of master_categories_id first then others $verify_current_category_id = false; for ($i=0, $n=sizeof($new_categories_sort_array); $i<$n; $i++) { // is current master_categories_id in the list? if ($new_categories_sort_array[$i] <= 0) { die('I WOULD NOT ADD ' . $new_categories_sort_array[$i] . '
'); } else { if ($current_category_id == $new_categories_sort_array[$i]) { $verify_current_category_id = true; } $db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ($products_filter, $new_categories_sort_array[$i])"); if ($reset_master_categories_id == '') { $reset_master_categories_id = $new_categories_sort_array[$i]; } if ($old_master_categories_id == $new_categories_sort_array[$i]) { $reset_master_categories_id = $new_categories_sort_array[$i]; } } } // reset master_categories_id in products table if ($zv_check_master_categories_id == 'true') { // make sure master_categories_id is set to current master_categories_id $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $current_master_categories_id . "' where products_id='" . $products_filter . "'"); } else { // reset master_categories_id to current_category_id because it was unselected $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $reset_master_categories_id . "' where products_id='" . $products_filter . "'"); } // recalculate price based on new master_categories_id zen_update_products_price_sorter($products_filter); if ($zv_check_master_categories_id == 'true') { $messageStack->add_session(SUCCESS_MASTER_CATEGORIES_ID, 'success'); } else { $messageStack->add_session(WARNING_MASTER_CATEGORIES_ID, 'warning'); } // if product was removed from current categories_id stay in same category if (!$verify_current_category_id) { zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'current_category_id=' . $current_category_id)); } else { zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id)); } break; } } $product_to_copy = $db->Execute("select p.products_id, pd.products_name, p.products_price_sorter, p.products_model, p.master_categories_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd " . " where p.products_id = '" . $products_filter . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'"); // $catagories_query = "select distinct cd.categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " cd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc on cd.categories_id = ptoc.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'"; $catagories_query = "select distinct ptoc.categories_id, cd.* from " . TABLE_PRODUCTS_TO_CATEGORIES. " ptoc left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on cd.categories_id = ptoc.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by cd.categories_name"; $categories_list = $db->Execute($catagories_query); // current products to categories $products_list = $db->Execute("select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_filter . "'"); ?> > <?php echo TITLE; ?>
method="post">
 
' . TEXT_PRICED_BY_ATTRIBUTES . '' . '
' : ''); echo zen_get_products_display_price($_GET['products_filter']) . '

'; echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true); $not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'"); while (!$not_for_cart->EOF) { $not_for_cart_array[] = $not_for_cart->fields['products_id']; $not_for_cart->MoveNext(); } ?>
fields, true, $_GET['products_filter'], true, true); ?>
EOF) { ?>
' . '' . TEXT_PRODUCTS_ID . $products_filter . TEXT_PRODUCTS_ID_INVALID . ''; ?>
' . TEXT_PRODUCTS_ID . $product_to_copy->fields['products_id'] . ' ' . $product_to_copy->fields['products_name']; ?>
' . TEXT_MASTER_CATEGORIES_ID . ' ' . zen_draw_pull_down_menu('master_category', zen_get_master_categories_pulldown($products_filter), $product_to_copy->fields['master_categories_id'], 'onChange="this.form.submit();"'); echo zen_hide_session_id(); if ($product_to_copy->fields['master_categories_id'] <= 0) { echo '  ' . '' . WARNING_MASTER_CATEGORIES_ID . ''; } echo TEXT_INFO_LINKED_TO_COUNT . $products_list->RecordCount(); ?>
'' . TEXT_INFO_HEADING_EDIT_PRODUCTS_TO_CATEGORIES . ''); $contents = array('form' => zen_draw_form('products_downloads_edit', FILENAME_PRODUCTS_TO_CATEGORIES, '')); if ($products_filter > 0) { $contents[] = array('text' => zen_image(DIR_WS_CATALOG_IMAGES . $product_to_copy->fields['products_image'], $product_to_copy->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)); } $contents[] = array('text' => '' . TEXT_PRODUCTS_NAME . $product_to_copy->fields['products_name'] . '
' . TEXT_PRODUCTS_MODEL . $product_to_copy->fields['products_model'] . '
'); $contents[] = array('text' => '
' . TEXT_SET_PRODUCTS_TO_CATEGORIES_LINKS . '
' . TEXT_PRODUCTS_ID . zen_draw_input_field('products_filter', $products_filter)); // $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '' . ''); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' xxxx' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '' . ''); break; default: $heading[] = array('text' => '' . $product_to_copy->fields['products_id'] . ' ' . $product_to_copy->fields['products_name'] . ''); if ($products_filter > 0) { $contents[] = array('text' => zen_image(DIR_WS_CATALOG_IMAGES . $product_to_copy->fields['products_image'], $product_to_copy->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)); } $contents[] = array('text' => '
' . TEXT_PRODUCTS_NAME . $product_to_copy->fields['products_name']); $contents[] = array('text' => TEXT_PRODUCTS_MODEL . $product_to_copy->fields['products_model']); $contents[] = array('text' => TEXT_PRODUCTS_PRICE . zen_get_products_display_price($products_filter)); switch (true) { case ($product_to_copy->fields['master_categories_id'] == 0 and $products_filter > 0): $contents[] = array('text' => '
' . WARNING_MASTER_CATEGORIES_ID . '
 '); break; default: $contents[] = array('text' => ''); $contents[] = array('align' => 'center', 'text' => ''); $contents[] = array('text' => '
' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3') . '
 '); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '  ' . '' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '

' . '' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '  ' . '' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '' . '
 ' ); break; } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } ?>
EOF) { $selected_categories_check .= $products_list->fields['categories_id']; $products_list->MoveNext(); if (!$products_list->EOF) { $selected_categories_check .= ','; } } $selected_categories = explode(',', $selected_categories_check); echo zen_draw_form('update', FILENAME_PRODUCTS_TO_CATEGORIES, 'action=update_product&products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id, 'post'); ?> '; while ($cnt_columns != MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) { $cnt_columns++; echo '' . ''; } echo ''; // echo ''; $cnt_columns = 0; while (!$categories_list->EOF) { $cnt_columns++; if (zen_not_null($selected_categories_check)) { $selected = in_array($categories_list->fields['categories_id'], $selected_categories); } else { $selected = false; } $zc_categories_checkbox = zen_draw_checkbox_field('categories_add[]', $categories_list->fields['categories_id'], $selected); if ($cnt_columns == 1) { echo ''; } echo ' ' . "\n"; if ($product_to_copy->fields['master_categories_id'] == $categories_list->fields['categories_id']) { // echo ' ' . "\n"; echo ' ' . "\n"; } else { echo ' ' . "\n"; } $categories_list->MoveNext(); if ($cnt_columns == MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS or $categories_list->EOF) { if ($categories_list->EOF and $cnt_columns != MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) { while ($cnt_columns < MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) { $cnt_columns++; echo ' ' . "\n"; echo ' ' . "\n"; } } echo '' . "\n"; $cnt_columns = 0; } } ?>
fields['master_categories_id'] < 1) { echo '' . TEXT_SET_MASTER_CATEGORIES_ID . ''; } else { ?>
' . TEXT_INFO_ID . '' . '  Categories Name' . '
' . $categories_list->fields['categories_id'] . '' . ($selected ? '' : '') . $zc_categories_checkbox . ' ' . $categories_list->fields['categories_name'] . ($selected ? '' : '') . ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '' . ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . ' ' . $categories_list->fields['categories_name'] . zen_draw_hidden_field('current_master_categories_id', $categories_list->fields['categories_id']) . '' . ($selected ? '' : '') . $zc_categories_checkbox . ' ' . $categories_list->fields['categories_name'] . ($selected ? '' : '') . '' . ' ' . '' . ' ' . '
fields['master_categories_id'] < 1) { echo '' . TEXT_SET_MASTER_CATEGORIES_ID . ''; } else { ?>
 '; echo $categories_id_from_linked; ?>  '; echo $categories_id_to_linked; ?>   
 '; echo $categories_id_from_linked; ?>  '; echo $categories_id_to_linked; ?>   
 '; echo $categories_id_from_linked; ?>   
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '