function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (sizeof($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => "Catalog"); } if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int) $languages_id . "' and cd.categories_id = '" . (int) $parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); } $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; }
<td class="dataTableHeadingContent" colspan="3" align="center"><?php echo sprintf(ADDING_TITLE, $oID); ?> </td> </tr> <tr class="dataTableRow"> <form action="<?php echo tep_href_link(FILENAME_ORDERS_EDIT_ADD_PRODUCT, 'oID=' . $_GET['oID']); ?> " method="POST"> <td class="dataTableContent" align="right"><?php echo TEXT_STEP_1; ?> </td> <td class="dataTableContent" valign="top"><?php echo tep_draw_pull_down_menu('add_product_categories_id', tep_get_category_tree('0', '', '0', $category_array), $add_product_categories_id, 'style="width:300px;" onchange="this.form.submit();"'); ?> </td> <td class="dataTableContent" align="center"> <noscript> <input type="submit" value="<?php echo TEXT_BUTTON_SELECT_CATEGORY; ?> "> </noscript> <input type="hidden" name="step" value="2"> </td> </form> </tr> <tr class="dataTableRow"> <td class="dataTableContent" colspan="3" align="center"><?php
echo tep_draw_separator(); ?> </td> </tr> <?php echo tep_draw_form('order_products', FILENAME_ORDERS, tep_get_all_get_params()); ?> <tr> <td class="main"><?php echo TEXT_CHOOSE_CATEGORIES; ?> </td> </tr> <tr> <td><?php echo tep_draw_pull_down_menu('categories[]', tep_get_category_tree('', ' '), $HTTP_POST_VARS['categories'], 'size="10" multiple="true"'); ?> </td> </tr> <tr> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?> </td> </tr> <tr> <td class="main"><?php echo TEXT_SEARCH_PRODUCTS; ?> </td> </tr>
<?php require 'includes/application_top.php'; set_time_limit(0); // OPRUIMEN LEGE CATEGORIEËN EN SUBCATEGORIEËN $categories_id = 0; $categories = tep_get_category_tree($categories_id, '', '0', '', true); // 'snoeit' tot 4 subcategorieën diep for ($t = 0; $t <= 4; $t++) { for ($i = 0, $n = sizeof($categories); $i < $n; $i++) { if (tep_childs_in_category_count($categories[$i]['id']) == 0) { if (tep_products_in_category_count($categories[$i]['id'], $include_deactivated = true) == 0) { tep_remove_category($categories[$i]['id']); } } } } // OPRUIMEN LEGE MERKEN $manuf_query = tep_db_query("SELECT manufacturers_id FROM " . TABLE_MANUFACTURERS); $row = mysql_fetch_array($manuf_query); while ($row) { $manuf_id[] = $row[0]; $row = mysql_fetch_array($manuf_query); } sort($manuf_id); // array met alle manufacturers-id's $aantal = count($manuf_id); $prod_manufs_query = tep_db_query("SELECT DISTINCT manufacturers_id FROM " . TABLE_PRODUCTS); $row2 = mysql_fetch_array($prod_manufs_query); while ($row2) { $prod_manufs[] = $row2[0];
tep_db_query($query); $update_product_result = true; } } if ($update_product_result) { $updated++; } } $messageStack->add_session(sprintf(SUCCESS_PRODUCTS_UPDATED, $updated), 'success'); tep_redirect(FILENAME_PRODUCTS_UPDATES); } break; } } $categories_array = array(array('id' => '', 'text' => TEXT_CHOOSE)); $categories_array = array_merge($categories_array, tep_get_category_tree(0, '', 0)); $manufacturers_array = array(array('id' => '', 'text' => TEXT_CHOOSE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int) $languages_id . "' order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } $products_types_array = array(array('id' => '', 'text' => TEXT_CHOOSE)); $products_types_query = tep_db_query("select products_types_id, products_types_name from " . TABLE_PRODUCTS_TYPES . " where language_id = '" . (int) $languages_id . "' order by sort_order, products_types_name"); while ($products_types = tep_db_fetch_array($products_types_query)) { $products_types_array[] = array('id' => $products_types['products_types_id'], 'text' => $products_types['products_types_name']); } $series_array = array(array('id' => '', 'text' => TEXT_CHOOSE)); $series_query = tep_db_query("select series_id, series_name from " . TABLE_SERIES . " where language_id = '" . (int) $languages_id . "' order by sort_order, series_name"); while ($series = tep_db_fetch_array($series_query)) { $series_array[] = array('id' => $series['series_id'], 'text' => $series['series_name']); }
?> <tr class="dataTableHeadingRow"> <td valign="top"><form action="<?php echo $current_page; ?> " method="POST"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" align="left"> <?php $customers_groups_query = tep_db_query("select customers_group_name, customers_group_id from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id "); while ($existing_groups = tep_db_fetch_array($customers_groups_query)) { $input_groups[] = array("id" => $existing_groups['customers_group_id'], "text" => $existing_groups['customers_group_name']); $all_groups[$existing_groups['customers_group_id']] = $existing_groups['customers_group_name']; } echo TEXT_SELECT_CAT . ': ' . tep_draw_pull_down_menu('categories', tep_get_category_tree(), $categories) . ' ' . TEXT_SELECT_CUST_GROUP . ': ' . tep_draw_pull_down_menu('customers_groups', $input_groups, isset($customers_group) ? $customers_group : '') . ' '; $manufacturers_array = array(array('id' => '0', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } echo TEXT_SELECT_MAN . ' : ' . tep_draw_pull_down_menu('manufacturer', $manufacturers_array, $manufacturer) . ' ' . TEXT_ENTER_DISCOUNT . ': '; ?> <input type="text" size="4" name="discount" value="<?php if ($discount > 0) { echo $discount; } ?> "><?php echo TEXT_PCT_AND;
} break; case 'move_product': $heading[] = array('text' => OSCOM::getDef('text_info_heading_move_product')); $contents = array('form' => HTML::form('products', OSCOM::link(FILENAME_CATEGORIES, 'action=move_product_confirm&cPath=' . $cPath)) . HTML::hiddenField('products_id', $pInfo->products_id)); $contents[] = array('text' => OSCOM::getDef('text_move_products_intro', ['products_name' => $pInfo->products_name])); $contents[] = array('text' => OSCOM::getDef('text_info_current_categories') . '<br /><strong>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</strong>'); $contents[] = array('text' => OSCOM::getDef('text_move', ['item_name' => $pInfo->products_name]) . '<br />' . HTML::selectField('move_to_category_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('text' => HTML::button(OSCOM::getDef('image_move'), 'fa fa-share', null, null, 'btn-success') . HTML::button(OSCOM::getDef('image_cancel'), null, OSCOM::link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id), null, 'btn-link')); break; case 'copy_to': $heading[] = array('text' => OSCOM::getDef('text_info_heading_copy_to')); $contents = array('form' => HTML::form('copy_to', OSCOM::link(FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath)) . HTML::hiddenField('products_id', $pInfo->products_id)); $contents[] = array('text' => OSCOM::getDef('text_info_copy_to_intro')); $contents[] = array('text' => OSCOM::getDef('text_info_current_categories') . '<br /><strong>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</strong>'); $contents[] = array('text' => OSCOM::getDef('text_categories') . '<br />' . HTML::selectField('categories_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('text' => OSCOM::getDef('text_how_to_copy') . '<br />' . HTML::radioField('copy_as', 'link', true) . ' ' . OSCOM::getDef('text_copy_as_link') . '<br />' . HTML::radioField('copy_as', 'duplicate') . ' ' . OSCOM::getDef('text_copy_as_duplicate')); $contents[] = array('text' => HTML::button(OSCOM::getDef('image_copy'), 'fa fa-copy', null, null, 'btn-success') . HTML::button(OSCOM::getDef('image_cancel'), null, OSCOM::link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id), null, 'btn-link')); break; } if (tep_not_null($heading) && tep_not_null($contents)) { $show_listing = false; echo HTML::panel($heading, $contents, ['type' => 'info']); } } } if ($show_listing === true) { ?> <table class="oscom-table table table-hover"> <thead>
$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'move_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_PRODUCT . '</b>'); $contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=move_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_PRODUCTS_INTRO, $pInfo->products_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $pInfo->products_name) . '<br>' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'copy_to': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>'); $contents = array('form' => tep_draw_form('copy_to', FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br>' . TEXT_CATEGORIES . '<br>' . tep_draw_pull_down_menu('categories_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('text' => '<br>' . TEXT_HOW_TO_COPY . '<br>' . tep_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br>' . tep_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_copy.gif', IMAGE_COPY) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added)); if (tep_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified)); } $contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image); $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count);
if ($tmp_col_count >= 7) { $tmp_row_count += 1; $tmp_col_count = 0; } } $bigbox = new epbox('', false); $bigbox->table_parameters = 'id="customtable" style="border: 1px solid #CCCCCC; padding: 2px; margin: 3px;"'; echo $bigbox->output($cells); $manufacturers_array = array(); $manufacturers_array[] = array("id" => '', 'text' => '- manufacturer -'); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array("id" => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } $status_array = array(array("id" => '', 'text' => '- status -'), array("id" => '1', 'text' => 'active'), array("id" => '0', 'text' => 'disabled')); echo 'filter by: ' . tep_draw_pull_down_menu('epcust_category_filter', array_merge(array(0 => array("id" => '', 'text' => '- category -')), tep_get_category_tree())); echo ' ' . tep_draw_pull_down_menu('epcust_manufacturer_filter', $manufacturers_array) . ' '; echo ' ' . tep_draw_pull_down_menu('epcust_status_filter', $status_array) . ' '; echo tep_draw_input_field('submit', 'Build File', ' style="padding: 0px"', false, 'submit'); ?> </td></tr> </table> </form> <br /><br /> <font size="-2">Quick Links</font> <table width="100%" border="0" cellpadding="3" cellspacing="3"><tr><td width="50%" valign="top" bgcolor="#EEEEEE"> <p style="margin-top: 8px;"><b>Create then Download Files</b><br /> <font size="-2">Create entire file in server memory then stream download after completed.</font></p> <p><!-- Download file links - Add your custom fields here --> <a href="easypopulate.php?download=stream&dltype=full<?php
echo tep_draw_form('row_by_page', FILENAME_DISCOUNT_CATEGORIES, '', 'get'); echo tep_draw_hidden_field('action', 'show_products'); echo tep_draw_hidden_field('cgID', $cgID); echo tep_draw_hidden_field('dcID', $dcID); echo tep_draw_hidden_field('manufacturer', $manufacturer); echo tep_draw_hidden_field('cPath', $current_category_id) . tep_draw_pull_down_menu('row_by_page', $row_bypage_array, $row_by_page, 'onChange="this.form.submit();"'); ?> </form></td> <td class="smallText" align="center" valign="top"><?php echo tep_draw_form('categorie', FILENAME_DISCOUNT_CATEGORIES, '', 'get'); echo tep_draw_hidden_field('action', 'show_products'); echo tep_draw_hidden_field('cgID', $cgID); echo tep_draw_hidden_field('dcID', $dcID); echo tep_draw_hidden_field('row_by_page', $row_by_page); echo tep_draw_hidden_field('manufacturer', $manufacturer); echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); ?> </form></td> <td class="smallText" align="center" valign="top"><?php echo tep_draw_form('manufacturers', FILENAME_DISCOUNT_CATEGORIES, '', 'get'); echo tep_draw_hidden_field('action', 'show_products'); echo tep_draw_hidden_field('cgID', $cgID); echo tep_draw_hidden_field('dcID', $dcID); echo tep_draw_hidden_field('row_by_page', $row_by_page); echo tep_draw_hidden_field('cPath', $current_category_id); echo manufacturers_list(); ?> </form></td> <td class="smallText" align="center" valign="top" style="border-right: 1px solid #7b9ebd;"><?php echo tep_draw_form('discount_categorie', FILENAME_DISCOUNT_CATEGORIES, '', 'get'); echo tep_draw_hidden_field('action', 'show_products');
</td> <td align="right" class="smallText"> <?php // Check if we are editing a cross sell - if so hide the form if (!isset($_GET['sort']) && !isset($_GET['add_related_product_ID'])) { // PGM adds cross sell filter $action_filter[0] = array('id' => 'all', 'text' => TEXT_ALL_PRODUCTS); $action_filter[1] = array('id' => 'edit_xsell', 'text' => TEXT_PRODUCTS_WITH); $action_filter[2] = array('id' => 'new_xsell', 'text' => TEXT_PRODUCTS_WITHOUT); echo tep_draw_form('action', FILENAME_XSELL_PRODUCTS, '', 'get'); echo TEXT_FILTER_XSELL . tep_draw_pull_down_menu('action', $action_filter, '', 'onChange="this.form.submit();"'); echo tep_hide_session_id() . '</form>'; // PGM adds category filter echo tep_draw_form('category', FILENAME_XSELL_PRODUCTS, '', 'get'); echo ' ' . TEXT_CATEGORY_XSELL . tep_draw_pull_down_menu('category', tep_get_category_tree(), '', 'onChange="this.form.submit();"'); echo tep_hide_session_id() . '</form>'; // PGM adds Search functionality to xSell echo tep_draw_form('search', FILENAME_XSELL_PRODUCTS, '', 'get'); echo ' ' . TEXT_SEARCH_XSELL . ' ' . tep_draw_input_field('search'); echo '</form>'; echo ' <td align="right" width="10"><a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a></td>'; } // end if ( (!isset($_GET['sort'])) && (!isset($_GET['add_related_product_ID'])) ) if (isset($_GET['category']) && $_GET['category'] != 0) { $category_filter = " and p2c.categories_id = '" . (int) $_GET['category'] . "'"; } else { $category_filter = ""; } if (isset($_GET['search'])) { $search_string = " and ((pd.products_name like '%" . tep_db_prepare_input(addslashes($_GET['search'])) . "%') or (p.products_model like '%" . tep_db_prepare_input(addslashes($_GET['search'])) . "%'))";
function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false, $disable_with_subs = false, $disable_with_prods = false) { global $languages_id; if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (sizeof($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); } if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int) $languages_id . "' and cd.categories_id = '" . (int) $parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) { if ($disable_with_subs == true) { $subs = tep_db_query('SELECT categories_id FROM categories WHERE parent_id = ' . $categories['categories_id']); if (tep_db_num_rows($subs) > 0) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'params' => 'disabled=disabled'); } else { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'params' => ''); } } else { if ($disable_with_prods == true) { $prods = tep_db_query('SELECT categories_id FROM products_to_categories WHERE categories_id = ' . $categories['categories_id']); if (tep_db_num_rows($prods) > 0) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'params' => 'disabled=disabled unselectable=on'); } else { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'params' => ''); } } else { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'params' => ''); } } } $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array, $include_itself, $disable_with_subs, $disable_with_prods); } return $category_tree_array; }
Copyright 2000 - 2011 osCmax Released under the GNU General Public License */ require 'includes/application_top.php'; $action = isset($_GET['action']) ? $_GET['action'] : ''; $eid = isset($_GET['eid']) ? $_GET['eid'] : ''; $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : ''; $languages = tep_get_languages(); $lang = array(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { // build array accessed directly by language id $lang[$languages[$i]['id']] = array('name' => $languages[$i]['name'], 'code' => $languages[$i]['code'], 'image' => $languages[$i]['image'], 'directory' => $languages[$i]['directory']); } $categories = tep_get_category_tree(); $confirmation_needed = false; if (tep_not_null($action)) { $messages = array(); $error = false; switch ($action) { case 'insert': // validate form if (!isset($_POST['status'])) { $error = true; $messages[] = ERROR_ENTRY_REQUIRED . ENTRY_ACTIVATE_NOW; } else { $status = $_POST['status'] == '0' ? 0 : 1; } if (!isset($_POST['show_admin'])) { $error = true;
function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { $OSCOM_Db = Registry::get('Db'); $OSCOM_Language = Registry::get('Language'); if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (sizeof($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => OSCOM::getDef('text_top')); } if ($include_itself) { $Qcategory = $OSCOM_Db->get('categories_description', 'categories_name', ['language_id' => $OSCOM_Language->getId(), 'categories_id' => (int) $parent_id]); $category_tree_array[] = ['id' => $parent_id, 'text' => $Qcategory->value('categories_name')]; } $Qcategories = $OSCOM_Db->get(['categories c', 'categories_description cd'], ['c.categories_id', 'cd.categories_name', 'c.parent_id'], ['c.categories_id' => ['rel' => 'cd.categories_id'], 'cd.language_id' => $OSCOM_Language->getId(), 'c.parent_id' => (int) $parent_id], ['c.sort_order', 'cd.categories_name']); while ($Qcategories->fetch()) { if ($exclude != $Qcategories->valueInt('categories_id')) { $category_tree_array[] = array('id' => $Qcategories->valueInt('categories_id'), 'text' => $spacing . $Qcategories->value('categories_name')); } $category_tree_array = tep_get_category_tree($Qcategories->valueInt('categories_id'), $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; }
// ############################################################################ // Add Products Steps // ############################################################################ print "<tr><td><table border='0'>\n"; // # Set Defaults if (!isset($add_product_categories_id)) { $add_product_categories_id = 0; } if (!isset($add_product_products_id)) { $add_product_products_id = 0; } // # Step 1: Choose Category print "<tr class=\"dataTableRow\"><form action='{$PHP_SELF}?oID={$oID}&action={$action}' method='POST'>\n"; print "<td class='dataTableContent' align='right'><b>" . ADDPRODUCT_TEXT_STEP . " 1:</b></td>\n"; print "<td class='dataTableContent' valign='top'>"; echo ' ' . tep_draw_pull_down_menu('add_product_categories_id', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); print "<input type='hidden' name='step' value='2'>"; print "</td>\n"; print "<td class='dataTableContent'>" . ADDPRODUCT_TEXT_STEP1 . "</td>\n"; print "</form></tr>\n"; print "<tr><td colspan='3'> </td></tr>\n"; // # Step 2: Choose Product if ($step > 1 && $add_product_categories_id > 0) { print "<tr class=\"dataTableRow\"><form action='{$PHP_SELF}?oID={$oID}&action={$action}' method='POST'>\n"; print "<td class='dataTableContent' align='right'><b>" . ADDPRODUCT_TEXT_STEP . " 2: </b></td>\n"; print "<td class='dataTableContent' valign='top'><select name=\"add_product_products_id\" onChange=\"this.form.submit();\">"; $ProductOptions = "<option value='0'>" . ADDPRODUCT_TEXT_SELECT_PRODUCT . "\n"; asort($ProductList[$add_product_categories_id]); foreach ($ProductList[$add_product_categories_id] as $ProductID => $ProductName) { $ProductOptions .= "<option value='{$ProductID}'> {$ProductName}\n"; }
function show_attrctl($products_id, $base_prices, $pobj) { $opts = tep_get_product_options($products_id); $attrSort = array(); $numimgs = 5; $savedAttrImages = array('none:' => '<img src="images/add-icon.jpg" alt="" title="Add attribute swatch image">'); $addattrimg = array(); foreach ($opts as $optn => $attrs) { $attr_sort = 1; $attrSort[$optn] = array(); foreach ($attrs as $attr => $attrdata) { $attrSort[$optn][$attr] = $attr_sort++; $imgptr = $attrdata['options_image'] ? 'file:' . $attrdata['options_image'] : 'none:'; if ($attrdata['options_image'] && !isset($savedAttrImages[$imgptr])) { $savedAttrImages[$imgptr] = tep_image(DIR_WS_CATALOG_IMAGES . $attrdata['options_image'], $attrdata['options_image'], 24, 16); } $addattrimg[] = "setAttrImage('{$optn}','{$attr}'," . tep_js_quote($imgptr) . ");"; } } $modelFieldList = array(); foreach (array('name', 'price', 'price_sign', 'sku', 'quantity', 'upc', 'childProducts_id') as $fld) { if (!in_array($fld, $pobj->disableModelFields())) { $modelFieldList[] = 'model_' . $fld; } } foreach ($pobj->getModelFields() as $xfld => $fdata) { $modelFieldList[] = 'model_extra[' . $xfld . ']'; } ?> <div id="modelManagerBase"> <div id="addOptionBox" style="display:none"> <table> <tr><td>Create new option:</td><td><input type="text" name="new_option_name" id="new_option_name"></td></tr> <tr><td colspan="2" align="center"> <button type="button" onClick="returnPromptBox(this,$('new_option_name').value)">Create</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </td></tr> </table> </div> <div id="addOptionValueBox" style="display:none"> <table> <tr><td>Create new value for option <span field="optn_name"></span>:</td><td><input type="text" name="new_option_value_name" id="new_option_value_name"></td></tr> <tr><td colspan="2" align="center"> <button type="button" onClick="returnPromptBox(this,$('new_option_value_name').value)">Create</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </td></tr> </table> </div> <div id="alertBox" style="display:none"> <table> <tr><td align="left"><pre field="message"></pre></td></tr> <tr><td align="center"><button type="button" onClick="returnPromptBox(this,0)">Ok</button></td></tr> </table> </div> <div id="confirmBox" style="display:none"> <table> <tr><td align="left"><pre field="message"></pre></td></tr> <tr><td align="center"><button type="button" onClick="returnPromptBox(this,1)">Ok</button> <button type="button" onClick="returnPromptBox(this,0)">Cancel</button></td></tr> </table> </div> <div id="selectModelImage" style="display:none"> <div id="selectModelImageExisting"> </div> <div style="display:none"><input type="file" id="upload_model_image_new" name="upload_model_image_new"></div> <table> <tr id="upload_model_image_block_0"> <td><input type="radio" name="select_model_image" value="upload:0"></td> <td> </td> <td><input type="file" id="upload_model_image_0" name="upload_model_image_0"></td> </tr> </table> <div id="selectModelImageDiffWarning" style="width:300px"> <b>Warning:</b> The models in this group have different images in this slot, the individual model images will be overriden if applied! </div> <button type="button" onClick="returnPromptBox(this,this.form.select_model_image)">Select</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </div> <div id="selectAttrImage" style="display:none; z-index:20;"> <table border="0" style="background:#C0C0C0;"> <tr><td onClick="selectAttrImageDone('none:');">[none]</td><td field="img_icons"> </td></tr> <td colspan="2"><input type="file" id="upload_attr_image_new" name="upload_attr_image_new" style="display:none;"><button onClick="selectAttrImageDone(); return false;">»</button></td> </table> </div> <div id="modelPricingBox" style="display:none;"> Group: <select id="model_switch_pricing_group" onChange="for (var i=0;this.options[i];i++) { var b=$('modelPricingBoxGrp_'+this.options[i].value); if (b) b.style.display=this.options[i].selected?'':'none'; }; updatePromptBox($('modelPricingBox'));"> <?php foreach (tep_get_customer_groups() as $cgrp => $cgname) { ?> <option value="<?php echo $cgrp; ?> "><?php echo $cgname; ?> </option><?php } ?> </select> <div id="modelPricingBoxGrp" style="display:none"> <input type="checkbox" name="mgrp_allow" value="1" onClick="this.parentNode.getElementsByTagName('table')[0].style.display=this.checked?'':'none'; updatePromptBox($('modelPricingBox'));"> Allow separate pricing for this model <table border="0"> <tr><td>Unit Price:</td><td><select name="mgrp_price_sign"><option value="+">+</option><option value="-">-</option></select><input name="mgrp_price_value" type="text"></td></tr> <tr><td colspan="2"> Separate Discount Brackets for this model <table border="0"> <tr><th>Quantity</th><th>Discount %</th></tr> <?php for ($idx = 1; $idx <= 10; $idx++) { ?> <tr><td><input type="text" name="mgrp_dq[<?php echo $idx; ?> ]" size="5"></td><td><input type="text" name="mgrp_dv[<?php echo $idx; ?> ]" size="5"></td></tr> <?php } ?> </table> </td></tr></table> </div> <button type="button" onClick="returnPromptBox(this,this.form.select_model_image)">Select</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </div> <div id="model_panel_prototype" class="AccordionPanel" style="display:none"> <div class="AccordionPanelTab" style="height:48px !important"> <table cellpadding="1" cellspacing="0" border="0" width="100%" height="45"><tr><td style="padding:3px 0 0 7px; width:21px;" valign="middle"><h4 style="width:11px; height:11px; padding:0"></h4></td><td valign="middle" align="left" style="white-space:nowrap; padding:4px 0 0 1px; font:bold 12px arial"><span field="attribute" style="white-space:nowrap;">Attribute</span> (<span field="count">0</span>)</td> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td style="width:<?php echo MODEL_THUMB_WIDTH; ?> px; height:<?php echo MODEL_THUMB_HEIGHT; ?> px; padding:3px 5px 0 0; cursor:pointer; text-align:center; vertical-align:middle;" field="model_image_<?php echo $i; ?> " onClick="selectGroupImage(this,<?php echo $i; ?> ); event.cancelBubble=true;"><?php echo tep_image(DIR_WS_IMAGES . 'no_image.gif', '', MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); ?> </td> <?php } ?> </tr></table> </div> <div class="AccordionPanelContent"><div></div></div> </div> <div id="model_entry_prototype" style="display:none;"> <table width="95%" style="border-bottom:1px dashed #999999"> <tr> <td align="center" width="50"><img src="images/expand.png" border="0" alt="" vspace="5" > <div style="z-index:100; width:42px; height:42px; padding:0; overflow:hidden; position:relative;"> <div style="z-index:20; position:absolute; top:-3px; left:-3px; margin:0;" onMouseOver="this.parentNode.style.overflow='visible';" onMouseOut="this.parentNode.style.overflow='hidden';"> <table cellspacing="0" cellpadding="0" border="0" style="border:dashed 1px #999999; background-color:#CCC;"> <tr> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td> <div style="width:<?php echo MODEL_HEIGHT_WIDTH; ?> px;height:<?php echo MODEL_THUMB_HEIGHT; ?> px;padding:3px 10px 5px 3px;margin:0;cursor:pointer; text-align:center; vertical-align:middle;" field="model_image_<?php echo $i; ?> " onClick="selectModelImage(this,<?php echo $i; ?> )"><?php echo tep_image(DIR_WS_IMAGES . 'no_image.gif', '', MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); ?> </div> </td> <?php } ?> </tr> <tr> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td align="center"><?php echo $i > 0 ? 'alt' . $i : 'main'; ?> </td> <?php } ?> </tr> </table> </div> </div> </td> <td valign="top"> <div style="overflow:hidden"> <div field="attributes" style="position:relative; top:1px; left:0px;" onMouseOver="this.parentNode.style.overflow='visible';" onMouseOut="this.parentNode.style.overflow='hidden';"> </div> </div> </td> <td> <table style="padding:0 0 0 10px;"> <tr> <td align="right" style="padding:0 7px 0 0">Price:</td> <td> <?php if (!in_array('price_sign', $pobj->disableModelFields())) { ?> <select name="model_price_sign[]"> <option value="+">+</option> <option value="-">-</option> </select> <?php } ?> <input type="text" name="model_price[]" field="model_price" size="7"> <input type="hidden" name="model_pricing_list[]" value=""> <a href="javascript:void(0);" onclick="showPricingBox(this); return false;"><img src="images/add-icon.jpg" alt="" title="Edit model price breaks and pricing Groups" width="14" height="14" hspace="10" border="0"></a></td> <?php if (!in_array('quantity', $pobj->disableModelFields())) { ?> <td align="right" style="padding:0 7px 0 10px">Avail. Stock:</td><td><input type="text" name="model_quantity[]" field="model_quantity" size="6"></td> <?php } else { echo '<td> </td><td> </td>'; } ?> </tr> <tr> <td align="right" style="padding:0 7px 0 0">Model:</td> <td><input type="text" name="model_name[]" field="model_name"></td> <td align="right" style="padding:0 7px 0 0">SKU:</td> <td><input type="text" name="model_sku[]" field="model_sku"></td> </tr> <tr> <td align="right" style="padding:0 7px 0 0">Available on:</td> <td><input type="text" name="model_date_available[]" field="model_date_available" size="10" onClick="popUpCalendar(this,this,'mm/dd/yyyy',document);"></td> <td align="right" style="padding:0 7px 0 0">UPC:</td> <td><input type="text" name="model_upc[]" field="model_upc"></td> </tr> <tr> <td colspan="3"> </td> <td style="padding:5px 7px 5px 0;"> <div id="theFeed" onclick="setFeeds(this)"; return false;" style="line-height:15px; cursor:pointer;"> <img src="images/add-icon.jpg" alt="" title="Edit Marketplace Feeds" width="14" height="14" border="0"> Edit / Add Feeds </div> </td> </tr> <?php foreach ($pobj->getModelFields() as $xfld => $fdata) { ?> <tr> <td colspan="2"><?php echo $fdata['title']; ?> :</td> <td colspan="2"><input type="text" name="model_extra[<?php echo $xfld; ?> ][]" field="model_x_<?php echo $xfld; ?> " size="6"></td> </tr> <?php } ?> </table> </td> <td style="padding:0 10px 0 0" id="test"><a href="javascript:void(0)" onClick="window.theEvent=event; delThisModel(this);"><img src="images/delete.png" alt="" title="Delete this attribute combination" id="deleteicon"></a></td> </tr></table> <input type="hidden" name="model_attrs[]" value=""> <input type="hidden" name="model_image_ptr[]" value=""> <input type="hidden" name="model_childProducts_id[]" value=""> </div> <?php $last_bar = isset($prod) ? $prod : null; ?> <div id="modelSetFeeds_<?php echo $prod; ?> " class="modelSetFeeds" style="display:none; width:80%; padding: 10px;"> <?php // # Marketplace feeds // # check to make sure attributes exist by comparing products_id to master_producs_id $attributeFeed_query = tep_db_query("SELECT master_products_id, products_id \r\n\t\t\t\t\t\t\t\t\t\t FROM products \r\n\t\t\t\t\t\t\t\t\t\t WHERE master_products_id = '" . $products_id . "' \r\n\t\t\t\t\t\t\t\t\t\t AND products_id != master_products_id\r\n\t\t\t\t\t\t\t\t\t\t"); // # if attributes id's found, generate the Feed selectors if (tep_db_num_rows($attributeFeed_query) > 0) { $DBFeedMods = tep_module('dbfeed'); $DBFeedMods->adminProductEdit($theProducts_id); } //var_dump($theProducts_id); ?> <button type="button" onclick="returnPromptBox(this,null)">Cancel</button> </div> <div id="modelManager"> <div class="modelAccordion" id="modelAccordion" tabindex="0"></div> <div style="padding:15px 0 10px 2px;"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="23"><img src="images/add.png" title="Add attribute to model" width="22" height="23" alt=""></td><td style="padding:0 0 0 6px; font:bold 13px arial; text-align:left"> Add Models:</td><td align="right" style="padding:0 10px 0 0"> <div onmouseover="ShowContent('tips1'); return true;" onmouseout="HideContent('tips1'); return true;" class="helpicon" style="width:16px; height:16px;"><a href="javascript:ShowContent('tips1')"></a></div> <div id="tips1" style="display:none; position:absolute; border: 1px dashed #333; background-color: white; padding: 5px; text-align:left; width:300px;"> <font class="featuredpopName"><b style="white-space:nowrap;">Attributes & Models</b></font><br><br><b>#1 Add Attributes</b> - Add Attributes from the dashed box to the left. Example: Color, Size, Width, In-seam. After Adding Attributes, you must add Attribute Values.<br><br><b>#2 Attribute Values</b> - Example: Small (or SM), Large, 34B, 34C.<br><br><b>#3 Price</b> - The difference of price for this particular model. Uses price from your Prices Tab above. Default is no difference.<br><br><b>Model</b> - Arbitrary model number of product model.<br><br><b>Image</b> - Model Image. Hint: Assign different color photos for your different color attributes.<br><br><b>Avail. Stock</b> - Your available to sell stock. <u>Note:</u> If you\'ve activated an ERP module, this value will be dynamically fed from your ERP system.<br><br> <b>SKU</b> - 7 Digits typically. <br><br> <b>UPC</b> - 12 Digit Universal Identifer: <u>Note:</u> If you\'ve activated an ERP module, this value will be required to link your models to your ERP system. </div> </td></tr></table></div> <table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:#D4EAB7; border:dashed 1px #CCC;"> <tr> <td id="new_model_attrs"> </td> <td valign="top" style="padding:10px 0 0 0" valign="top"> <table width="100%"> <tr> <td valign="top"> <table cellpadding="5" cellspacing="0" border="0" style="margin: 0 0 0 35px;"> <tr> <td align="right">Price:</td> <td><?php if (!in_array('price_sign', $pobj->disableModelFields())) { ?> <select name="new_model_price_sign" id="new_model_price_sign"><option value="+">+</option> <option value="-">-</option></select> <?php } ?> <input type="text" name="new_model_price" id="new_model_price" size="7"> </td> </tr> <table> <table style="margin: 0 0 0 35px"> <tr> <?php if (!in_array('quantity', $pobj->disableModelFields())) { echo '<td align="right" style="padding-right:5px; width:30px;" nowrap>Qty:</td>'; ?> <td><input type="text" name="new_model_quantity" id="new_model_quantity" size="6"></td> <?php } else { echo '<td colspan="2"> </td>'; } ?> </td></tr> <tr> <td valign="bottom" colspan="2" style="padding: 5px 0 0 0">Select Attribute Image:</td> </tr> </table> </td> <td> <table> <tr> <td align="right" style="padding:5px 7px 5px 0">Model:</td><td><input type="text" name="new_model_name" id="new_model_name"></td> </tr> <td align="right" style="padding:0 7px 5px 0;">SKU:</td><td><input type="text" name="new_model_sku" id="new_model_sku"></td> </tr> <tr> <td align="right" style="padding:0 7px 5px 0;">UPC:</td><td><input type="text" name="new_model_upc" id="new_model_upc"></td> </tr> <?php foreach ($pobj->getModelFields() as $xfld => $fdata) { ?> <tr> <td colspan="2"><?php echo $fdata['title']; ?> :</td> <td><input type="text" name="new_model_extra[<?php echo $xfld; ?> ]" id="new_model_extra[<?php echo $xfld; ?> ]" field="model_x_<?php echo $xfld; ?> " size="6"></td> </tr> <?php } ?> </table> </td></tr> </table> <table style="margin: 0 0 5px 40px" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <input type="file" id="new_upload_model_image" name="new_upload_model_image" style="font:normal 11px verdana;"></td> </tr> </table> </td> <td style="padding:0 10px 0 10px;"><a href="javascript:void(0)" onClick="addNewModel('new')"><img src="images/add.png" alt="" border="0" title="Add model to product"></a></td> </tr></table> </div> <div id="models_populate" style="display:none;"> <table><tr> <td><?php echo tep_draw_pull_down_menu('models_populate_cat', tep_get_category_tree(), '', 'onChange="loadPopulateProducts(this.value)"'); ?> </td> <td id="models_populate_prod_box"></td> </tr></table> <script type="text/javascript"> function loadPopulateProducts(cat) { var blk=$('models_populate_prod_box'); blk.innerHTML=''; new ajax('attrctl_populate.php?cat='+cat,{update:blk}); } </script> </div> </div> <script type="text/javascript"> var modelAccordion = new Spry.Widget.Accordion("modelAccordion"); var currOptions=<?php echo tep_js_quote_array(array_keys($opts)); ?> ; var primaryOptions=[true]; var attrSort=<?php echo tep_js_quote($attrSort); ?> ; var modelFieldList=<?php echo tep_js_quote_array($modelFieldList); ?> ; //alert(currOptions.toSource()); <?php $modattrs = tep_get_product_models($products_id); $images = array(); //if($default_image) $images[]=$default_image; $savedImages = array('default:' => '[none]', 'multiple:' => '[****]'); $addmdl = array(); foreach ($modattrs as $mid => $attrs) { $modl = tep_get_product_model_fields($products_id, $mid); $model_price = $modl['products_price'] - $base_prices[0]; $img_ptr = array(); foreach ($modl['products_image_list'] as $idx => $pimg) { if ($pimg && !isset($images[$pimg])) { $images[$pimg] = $pimg; } $img_ptr[$idx] = $pimg ? 'file:' . $pimg : 'default:'; if ($img_ptr[$idx] && !isset($savedImages[$img_ptr[$idx]])) { $savedImages[$img_ptr[$idx]] = tep_image(DIR_WS_CATALOG_IMAGES . $pimg, $pimg, MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); } } $grp_price = array(0 => $modl['products_price']); $discnts = array(); $grp_qry = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_GROUPS . " WHERE products_id = '{$mid}'"); while ($row = tep_db_fetch_array($grp_qry)) { $grp_price[$row['customers_group_id']] = $row['customers_group_price']; } $dsc_qry = tep_db_query("SELECT * FROM products_discount WHERE products_id='{$mid}'"); while ($row = tep_db_fetch_array($dsc_qry)) { if (!isset($discnts[$row['customers_group_id']])) { $discnts[$row['customers_group_id']] = array(); } $discnts[$row['customers_group_id']][$row['discount_qty']] = $row['discount_qty'] . ':' . $row['discount_percent']; } $pr_grps = array(); foreach ($grp_price as $cgrp => $prc) { $pr_grps[] = $cgrp . ':' . ($prc - $base_prices[$cgrp]) . (isset($discnts[$cgrp]) ? ',' . join(',', $discnts[$cgrp]) : ''); } $pr_list = join(';', $pr_grps); $date_av_t = preg_match('/^[1-9]/', $modl['products_date_available']) ? strtotime($modl['products_date_available']) : 0; $date_av = $date_av_t > 0 ? date('m/d/Y', $date_av_t) : ''; $modflds = array('model_name[]' => $modl['products_model'], 'model_sku[]' => $modl['products_sku'], 'model_upc[]' => $modl['products_upc'], 'model_asin[]' => $modl['products_asin'], 'model_ship[]' => $modl['products_ship'], 'model_date_available[]' => $date_av, 'model_quantity[]' => $modl['products_quantity'], 'model_price_sign[]' => $model_price < 0 ? '-' : '+', 'model_price[]' => sprintf("%.2f", abs($model_price)), 'model_pricing_list[]' => $pr_list, 'model_image_ptr[]' => join('/', $img_ptr), 'model_childProducts_id[]' => $mid); foreach ($pobj->getModelFields() as $xfld => $fdata) { $modflds['model_extra[' . $xfld . '][]'] = tep_get_products_extra($mid, $xfld); } $addmdl[] = "addModel(" . tep_js_quote_array(array_keys($attrs)) . "," . tep_js_quote_array(array_values($attrs)) . "," . tep_js_quote($modflds) . ");"; } ?> var savedImages=<?php echo tep_js_quote($savedImages); ?> ; var savedAttrImages=<?php echo tep_js_quote($savedAttrImages); ?> ; function showAllModels() { showOptionSelectors('new_model_attrs'); <?php echo join("\n", $addattrimg); ?> <?php echo join("\n", $addmdl); ?> } </script> <div style="display:none"> <table id="listModelImages"> <tr> <td><input type="radio" name="select_model_image" value="default:"></td> <td colspan="2">None</td> </tr> <?php foreach ($images as $img) { ?> <tr> <td><input type="radio" name="select_model_image" value="file:<?php echo htmlspecialchars($img); ?> "></td> <td><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $img, $img, 40, 40); ?> </td> <td><?php echo htmlspecialchars($img); ?> </td> </tr> <?php } ?> </table> </div> <script type="text/javascript"> $('selectModelImageExisting').insertBefore($('listModelImages'),null); </script> <?php }
$bInfo->objectInfo($banner); } elseif (tep_not_null($HTTP_POST_VARS)) { $bInfo->objectInfo($HTTP_POST_VARS); } // $groups_array = array(); // $groups_query = tep_db_query("select distinct banners_group from " . TABLE_BANNERS . " order by banners_group"); // while ($groups = tep_db_fetch_array($groups_query)) { // $groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']); // } if (preg_match('/(\\w*?):(.*)/', $banner['banners_group'], $banners_group_split)) { $banners_group_section = $banners_group_split[1]; $banners_group_id = $banners_group_split[2]; } else { $banners_group_section = 'other'; } $categories_pull_down = tep_get_category_tree(); $categories_pull_down[0]['text'] = '--select--'; $products_pull_down = array(array(id => '', text => '--select--')); $products_query = tep_db_query("SELECT products_id,products_name FROM " . TABLE_PRODUCTS_DESCRIPTION . " WHERE language_id='{$languages_id}' ORDER BY products_name"); while ($products_row = tep_db_fetch_array($products_query)) { $products_pull_down[] = array(id => $products_row['products_id'], text => sprintf("%4d: %s", $products_row['products_id'], $products_row['products_name'])); } $manufacturers_pull_down = array(array(id => '', text => '--select--')); $manufacturers_query = tep_db_query("SELECT manufacturers_id,manufacturers_name FROM " . TABLE_MANUFACTURERS . " ORDER BY manufacturers_name"); while ($manufacturers_row = tep_db_fetch_array($manufacturers_query)) { $manufacturers_pull_down[] = array(id => $manufacturers_row['manufacturers_id'], text => sprintf("%4d: %s", $manufacturers_row['manufacturers_id'], $manufacturers_row['manufacturers_name'])); } $info_pull_down = array(array(id => '', text => '--select--')); $info_query = tep_db_query("SELECT information_id,info_title FROM " . TABLE_INFORMATION . " ORDER BY info_title"); while ($info_row = tep_db_fetch_array($info_query)) { $info_pull_down[] = array(id => $info_row['information_id'], text => sprintf("%4d: %s", $info_row['information_id'], $info_row['info_title']));
$heading[] = array('text' => '<b>' . TEXT_CROSS_SELL_ARTICLES . '</b>'); $contents[] = array('text' => TEXT_SELECT_A_CATEGORY); ?> <table border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="#999999"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" width="100%"><?php echo SELECT_CATEGORY; ?> </td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"> <?php echo tep_draw_form('goto', "articles_xsell.php", '', 'get') . tep_hide_session_id(); echo '<input type="hidden" name="add_related_article_ID" value="' . (int) $_GET['add_related_article_ID'] . '" />'; echo SELECT_CATEGORY . " :" . tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); echo '</form>'; ?> </td> </tr> </table> <?php if (isset($_GET['cPath'])) { $contents[] = array('text' => TEXT_SELECT_PRODUCT); ?> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><form action="<?php tep_href_link(FILENAME_ARTICLES_XSELL, '', 'NONSSL'); ?>
function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false, $products_types_id = 0) { global $languages_id; if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (sizeof($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); } if ($products_types_id == 0 && $parent_id == 0 && func_num_args() < 6) { $products_types_query = tep_db_query("select products_types_id, products_types_name from " . TABLE_PRODUCTS_TYPES . " where language_id = '" . (int) $languages_id . "' order by sort_order, products_types_name"); while ($products_types = tep_db_fetch_array($products_types_query)) { $category_tree_array[] = array('id' => $products_types['products_types_id'], 'text' => $products_types['products_types_name'], 'active' => false); $category_tree_array = tep_get_category_tree($parent_id, $spacing . ' ', $exclude, $category_tree_array, $include_itself, $products_types['products_types_id']); } } else { if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int) $languages_id . "' and cd.categories_id = '" . (int) $parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where 1" . ($products_types_id > 0 ? " and c.products_types_id = '" . (int) $products_types_id . "'" : "") . " and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); } $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array, $include_itself, $products_types_id); } } return $category_tree_array; }
?> <tr><?php echo tep_draw_form('specials', FILENAME_SPECIALS, '', 'get'); reset($HTTP_GET_VARS); while (list($k, $v) = each($HTTP_GET_VARS)) { echo "\n" . tep_draw_hidden_field($k, $v); } ?> <td><br><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_SPECIALS_CATEGORY; ?> </td> <td class="main"><?php echo tep_draw_pull_down_menu('categories_id', array_merge(array(array('id' => '', 'text' => TEXT_DEFAULT_SELECT)), tep_get_category_tree(0, ' ')), '', 'onchange="this.form.submit();"'); ?> </td> </tr> </table></td> </form> </tr> <?php } } else { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="2">