public static function getMapFields($flat = false, $extra_fields = false) { $fields = array('product' => array('name' => _w('Product name'), 'currency' => _w('Currency'), 'summary' => _w('Summary'), 'description' => _w('Description'), 'badge' => _w('Badge'), 'status' => _w('Status'), 'type_name' => _w('Product type'), 'tags' => _w('Tags'), 'tax_name' => _w('Taxable'), 'meta_title' => _w('Title'), 'meta_keywords' => _w('META Keyword'), 'meta_description' => _w('META Description'), 'url' => _w('Storefront link'), 'images' => _w('Product images')), 'sku' => array('skus:-1:name' => _w('SKU name'), 'skus:-1:sku' => _w('SKU code'), 'skus:-1:price' => _w('Price'), 'skus:-1:available' => _w('Available for purchase'), 'skus:-1:compare_price' => _w('Compare at price'), 'skus:-1:purchase_price' => _w('Purchase price'), 'skus:-1:stock:0' => _w('In stock'))); if ($extra_fields) { $product_model = new shopProductModel(); $sku_model = new shopProductSkusModel(); $meta_fields = array('product' => $product_model->getMetadata(), 'sku' => $sku_model->getMetadata()); $black_list = array('id', "contact_id", "create_datetime", "edit_datetime", "type_id", "image_id", "tax_id", "cross_selling", "upselling", "total_sales", "sku_type", "sku_count", 'sku_id', 'ext', 'price', 'compare_price', 'min_price', 'max_price', 'count', 'rating_count', 'category_id', 'base_price_selectable', 'rating'); $white_list = array('id_1c' => '1C'); foreach ($meta_fields['product'] as $field => $info) { if (!in_array($field, $black_list)) { $name = ifset($white_list[$field], $field); if (!empty($meta_fields['sku'][$field])) { if (!isset($fields['sku']['skus:-1:' . $field])) { $fields['sku']['skus:-1:' . $field] = $name; } } else { if (!isset($fields['product'][$field])) { $fields['product'][$field] = $name; } } } } } $stock_model = new shopStockModel(); if ($stocks = $stock_model->getAll('id')) { foreach ($stocks as $stock_id => $stock) { $fields['sku']['skus:-1:stock:' . $stock_id] = _w('In stock') . ' @' . $stock['name']; } } if ($flat) { $fields_ = $fields; $fields = array(); $flat_order = array('product:name', 'sku:skus:-1:name', 'sku:skus:-1:sku', 'product:currency'); foreach ($flat_order as $field) { list($type, $field) = explode(':', $field, 2); $fields[$field] = $fields_[$type][$field]; unset($fields_[$type][$field]); } $fields += $fields_['sku']; $fields += $fields_['product']; } return $fields; }