Exemple #1
0
                $tabs['product_tabs'] = array('title' => __('product_tabs'), 'href' => 'tabs.manage_in_tab?' . http_build_query($params), 'ajax' => true);
            }
        }
    }
    // [/Product tabs]
    Registry::set('navigation.tabs', $tabs);
    // [/Page sections]
    //
    // 'Mulitple products updating' page
    //
} elseif ($mode == 'm_update') {
    if (empty($_SESSION['product_ids']) || empty($_SESSION['selected_fields']) || empty($_SESSION['selected_fields']['object']) || $_SESSION['selected_fields']['object'] != 'product') {
        return array(CONTROLLER_STATUS_REDIRECT, 'products.manage');
    }
    $product_ids = $_SESSION['product_ids'];
    if (fn_allowed_for('MULTIVENDOR') && !fn_company_products_check($product_ids)) {
        return array(CONTROLLER_STATUS_DENIED);
    }
    $selected_fields = $_SESSION['selected_fields'];
    $field_groups = array('A' => array('product' => 'products_data', 'product_code' => 'products_data', 'page_title' => 'products_data'), 'B' => array('price' => 'products_data', 'list_price' => 'products_data', 'amount' => 'products_data', 'min_qty' => 'products_data', 'max_qty' => 'products_data', 'weight' => 'products_data', 'shipping_freight' => 'products_data', 'box_height' => 'products_data', 'box_length' => 'products_data', 'box_width' => 'products_data', 'min_items_in_box' => 'products_data', 'max_items_in_box' => 'products_data', 'qty_step' => 'products_data', 'list_qty_count' => 'products_data', 'popularity' => 'products_data'), 'C' => array('free_shipping' => 'products_data', 'feature_comparison' => 'products_data'), 'D' => array('short_description' => 'products_data', 'full_description' => 'products_data', 'meta_keywords' => 'products_data', 'meta_description' => 'products_data', 'search_words' => 'products_data', 'promo_text' => 'products_data'), 'T' => array('timestamp' => 'products_data', 'avail_since' => 'products_data'), 'S' => array('out_of_stock_actions' => array('name' => 'products_data', 'variants' => array('N' => 'none', 'B' => 'buy_in_advance', 'S' => 'sign_up_for_notification')), 'status' => array('name' => 'products_data', 'variants' => array('A' => 'active', 'D' => 'disabled', 'H' => 'hidden')), 'tracking' => array('name' => 'products_data', 'variants' => array(ProductTracking::TRACK_WITH_OPTIONS => 'track_with_options', ProductTracking::TRACK_WITHOUT_OPTIONS => 'track_without_options', ProductTracking::DO_NOT_TRACK => 'dont_track')), 'zero_price_action' => array('name' => 'products_data', 'variants' => array('R' => 'zpa_refuse', 'P' => 'zpa_permit', 'A' => 'zpa_ask_price'))), 'E' => array('categories' => 'products_data'), 'W' => array('details_layout' => 'products_data'));
    if (Registry::get('settings.General.enable_edp') == 'Y') {
        $field_groups['C']['is_edp'] = 'products_data';
        $field_groups['C']['edp_shipping'] = 'products_data';
    }
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        $field_groups['L'] = array('localization' => array('name' => 'localization'));
    }
    $data = array_keys($selected_fields['data']);
    $get_main_pair = false;
    $get_taxes = false;
    $get_features = false;
/**
 * Download product file
 *
 * @param int $file_id file ID
 * @param boolean $is_preview flag indicates that we download file itself or just preview
 * @param string $ekey temporary key to download file from customer area
 * @param string $area current working area
 * @return file starts to download on success, boolean false in case of fail
 */
function fn_get_product_file($file_id, $is_preview = false, $ekey = '', $area = AREA)
{
    if (!empty($file_id)) {
        $column = $is_preview ? 'preview_path' : 'file_path';
        $file_data = db_get_row("SELECT {$column}, product_id FROM ?:product_files WHERE file_id = ?i", $file_id);
        if (fn_allowed_for('MULTIVENDOR') && $area == 'A' && !fn_company_products_check($file_data['product_id'], true)) {
            return false;
        }
        if (!empty($ekey)) {
            $ekey_info = fn_get_product_edp_info($file_data['product_id'], $ekey);
            if (empty($ekey_info) || $ekey_info['file_id'] != $file_id) {
                return false;
            }
            // Increase downloads for this file
            $max_downloads = db_get_field("SELECT max_downloads FROM ?:product_files WHERE file_id = ?i", $file_id);
            $file_downloads = db_get_field("SELECT downloads FROM ?:product_file_ekeys WHERE ekey = ?s AND file_id = ?i", $ekey, $file_id);
            if (!empty($max_downloads)) {
                if ($file_downloads >= $max_downloads) {
                    return false;
                }
            }
            db_query('UPDATE ?:product_file_ekeys SET ?u WHERE file_id = ?i AND product_id = ?i AND order_id = ?i', array('downloads' => $file_downloads + 1), $file_id, $file_data['product_id'], $ekey_info['order_id']);
        }
        Storage::instance('downloads')->get($file_data['product_id'] . '/' . $file_data[$column]);
    }
    return false;
}