예제 #1
0
     // @@TODO where is update_product
     // attribute features
 // @@TODO where is move_product_confirm
 // @@TODO where is insert_product
 // @@TODO where is update_product
 // attribute features
 case 'delete_attributes':
     zen_delete_products_attributes($_GET['products_id']);
     $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED . ' ID#' . $_GET['products_id'], 'success');
     $action = '';
     // reset products_price_sorter for searches etc.
     zen_update_products_price_sorter($_GET['products_id']);
     zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['products_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
     break;
 case 'update_attributes_sort_order':
     zen_update_attributes_products_option_values_sort_order($_GET['products_id']);
     $messageStack->add_session(SUCCESS_ATTRIBUTES_UPDATE . ' ID#' . $_GET['products_id'], 'success');
     $action = '';
     zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['products_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
     break;
     // attributes copy to product
 // attributes copy to product
 case 'update_attributes_copy_to_product':
     $copy_attributes_delete_first = $_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0';
     $copy_attributes_duplicates_skipped = $_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0';
     $copy_attributes_duplicates_overwrite = $_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0';
     zen_copy_products_attributes($_POST['products_id'], $_POST['products_update_id']);
     //      die('I would copy Product ID#' . $_POST['products_id'] . ' to a Product ID#' . $_POST['products_update_id'] . ' - Existing attributes ' . $_POST['copy_attributes']);
     $_GET['action'] = '';
     zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['products_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
     break;
예제 #2
0
 //// EOF OF FLAGS
 /////////////////////////////////////////
 case 'set_products_filter':
     $_GET['products_filter'] = (int) $_POST['products_filter'];
     $_GET['current_category_id'] = (int) $_POST['current_category_id'];
     $action = '';
     zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
     break;
     // update by product
 // update by product
 case 'update_attribute_sort':
     if (isset($_POST['confirm']) && $_POST['confirm'] == 'y') {
         if (!zen_has_product_attributes($products_filter, 'false')) {
             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_NONE . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'error');
         } else {
             zen_update_attributes_products_option_values_sort_order($products_filter);
             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'success');
         }
         $action = '';
         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_GET['current_category_id']));
     }
     break;
 case 'add_product_attributes':
     $current_image_name = '';
     for ($i = 0; $i < sizeof($_POST['values_id']); $i++) {
         if (isset($_POST['values_id'][$i])) {
             $_POST['values_id'][$i] = (int) $_POST['values_id'][$i];
         }
         if (isset($_POST['options_id'])) {
             $_POST['options_id'] = (int) $_POST['options_id'];
         }
         // get all option_values
         $all_options_values = $db->Execute("select products_options_id, products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id='" . $_POST['options_id'] . "'");
         $updated = 'false';
         while (!$all_options_values->EOF) {
             $check_all_options_values = $db->Execute("select products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $all_update_products->fields['products_id'] . "' and options_id='" . $all_options_values->fields['products_options_id'] . "' and options_values_id='" . $all_options_values->fields['products_options_values_id'] . "'");
             if ($check_all_options_values->RecordCount() < 1) {
                 // add missing options_value_id
                 $updated = 'true';
                 $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id) values ('" . $all_update_products->fields['products_id'] . "', '" . $all_options_values->fields['products_options_id'] . "', '" . $all_options_values->fields['products_options_values_id'] . "')");
             } else {
                 // skip it the attribute is there
             }
             $all_options_values->MoveNext();
         }
         if ($updated == 'true') {
             zen_update_attributes_products_option_values_sort_order($all_update_products->fields['products_id']);
         }
         $all_update_products->MoveNext();
     }
     if ($updated = 'true') {
         $messageStack->add_session(SUCCESS_PRODUCTS_OPTIONS_VALUES, 'success');
     } else {
         $messageStack->add_session(ERROR_PRODUCTS_OPTIONS_VALUES, 'error');
     }
 } else {
     // action delete
     while (!$all_update_products->EOF) {
         // get all option_values
         $all_options_values = $db->Execute("select products_options_id, products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id='" . $_POST['options_id'] . "'");
         $updated = 'false';
         while (!$all_options_values->EOF) {
예제 #4
0
function ep_update_attributes_sort_order()
{
    global $gBitDb;
    $all_products_attributes = $gBitDb->Execute("select p.products_id, pa.products_attributes_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_ATTRIBUTES . " pa " . "\n\twhere p.products_id= pa.products_id");
    while (!$all_products_attributes->EOF) {
        $count++;
        //$product_id_updated .= ' - ' . $all_products_attributes->fields['products_id'] . ':' . $all_products_attributes->fields['products_attributes_id'];
        zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']);
        $all_products_attributes->MoveNext();
    }
}