function tep_copy_template($old_headers_id, $parent_id, $customer_id) { // Create new category $categories_query = tep_db_query("select headers_type, headers_url, headers_class, headers_css_id, headers_fa_icon, sort_order, headers_status from " . TABLE_HEADERS_TEMP . " where headers_id = '" . (int) $old_headers_id . "'"); $record2 = tep_db_fetch_array($categories_query); tep_db_query("insert into " . TABLE_HEADERS . " (headers_type, headers_url, headers_class, headers_css_id, headers_fa_icon, parent_id, sort_order, date_added, last_modified, headers_status, customers_id) values ('" . tep_db_input($record2['headers_type']) . "', '" . tep_db_input($record2['headers_url']) . "', '" . tep_db_input($record2['headers_class']) . "', '" . tep_db_input($record2['headers_css_id']) . "', '" . tep_db_input($record2['headers_fa_icon']) . "', '" . (int) $parent_id . "', '" . tep_db_input($record2['sort_order']) . "', now(), now(), '" . tep_db_input($record2['headers_status']) . "', '" . (int) $customer_id . "')"); $new_headers_id = tep_db_insert_id(); // Create new category descriptions $categories_desc_query = tep_db_query("select headers_id, language_id, headers_name from " . TABLE_HEADERS_DESCRIPTION_TEMP . " where headers_id = '" . (int) $old_headers_id . "' order by headers_id, language_id"); while ($record1 = tep_db_fetch_array($categories_desc_query)) { tep_db_query("insert into " . TABLE_HEADERS_DESCRIPTION . " (headers_id, language_id, headers_name) values ('" . (int) $new_headers_id . "', '" . (int) $record1['language_id'] . "', '" . tep_db_input($record1['headers_name']) . "')"); } $child_category_query = tep_db_query("select headers_id from " . TABLE_HEADERS_TEMP . " where parent_id = '" . (int) $old_headers_id . "'"); if (tep_db_num_rows($child_category_query)) { while ($child_categories = tep_db_fetch_array($child_category_query)) { tep_copy_template($child_categories['headers_id'], $new_headers_id, (int) $customer_id); } } }
if ($HTTP_GET_VARS['action'] == 'buy_now') { $parameters = array('action', 'pid', 'products_id'); } else { $parameters = array('action', 'pid'); } } switch ($HTTP_GET_VARS['action']) { case 'copy_category_and_sub_confirm': if (tep_session_is_registered('customer_id')) { if (isset($HTTP_POST_VARS['headers_id']) && $HTTP_POST_VARS['headers_id'] != $HTTP_POST_VARS['copy_to_category_id']) { $old_headers_id = tep_db_prepare_input($HTTP_POST_VARS['headers_id']); $parent_id = tep_db_prepare_input($HTTP_POST_VARS['copy_to_category_id']); $old_css_id = tep_db_prepare_input($HTTP_POST_VARS['selectors_id']); $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); tep_db_query("insert into " . TABLE_TEMPLATES_TO_CUSTOMERS . " (template_id, customer_id) values ('" . (int) $products_id . "', '" . (int) $customer_id . "')"); tep_copy_template($old_headers_id, $parent_id, (int) $customer_id); tep_copy_css($old_css_id, $parent_id, (int) $customer_id); tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } } else { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } break; // customer wants to update the product quantity in their shopping cart // customer wants to update the product quantity in their shopping cart case 'update_product': for ($i = 0, $n = sizeof($HTTP_POST_VARS['products_id']); $i < $n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array())) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); $messageStack->add_session('product_action', sprintf(PRODUCT_REMOVED, tep_get_products_name($HTTP_POST_VARS['products_id'][$i])), 'warning');