示例#1
0
function tep_copy_css($old_css_id, $parent_id, $customer_id)
{
    // Create new category
    $categories_query = tep_db_query("select selectors_name, selectors_properties, selectors_type, sort_order from " . TABLE_BTS_CSS_SELECTORS_TEMP . "  where selectors_id = '" . (int) $old_css_id . "'");
    $record2 = tep_db_fetch_array($categories_query);
    tep_db_query("insert into " . TABLE_BTS_CSS_SELECTORS . " (selectors_name, selectors_properties, selectors_type, parent_id, date_added, last_modified, sort_order, customers_id) values ('" . tep_db_input($record2['selectors_name']) . "', '" . tep_db_input($record2['selectors_properties']) . "', '" . tep_db_input($record2['selectors_type']) . "',  '" . (int) $parent_id . "', now(), now(), '" . tep_db_input($record2['sort_order']) . "', '" . (int) $customer_id . "')");
    $new_selectors_id = tep_db_insert_id();
    $child_category_query = tep_db_query("select selectors_id from " . TABLE_BTS_CSS_SELECTORS_TEMP . " where parent_id = '" . (int) $old_css_id . "'");
    if (tep_db_num_rows($child_category_query)) {
        while ($child_categories = tep_db_fetch_array($child_category_query)) {
            tep_copy_css($child_categories['selectors_id'], $new_selectors_id, (int) $customer_id);
        }
    }
}
示例#2
0
         $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');
             } else {