<th>Sku</th>
              <th>Old CV Price</th>
              <th>New CV Price</th>
              <th>New OC Price</th>
              <th>Link</th>
            </tr>
          </thead>
          <tbody>
            <?php 
    foreach ($result as $value) {
        echo '<tr>';
        echo "<td>" . $i++ . "</td>";
        echo "<td>" . $value[0] . "</td>";
        echo "<td>" . $value[1] . "</td>";
        echo "<td class='text-danger'>" . $value[2] . "</td>";
        echo "<td class='text-success'>" . mysellprice($value[2]) . "</td>";
        echo "<td><a href='" . $value[3] . "' target='_blank'>" . $value[3] . "</a></td>";
        echo '</tr>';
    }
    ?>
          </tbody>
        </table>
        <hr />
        <p>Download <a href="<?php 
    echo base_url();
    ?>
upload/opencart/<?php 
    echo $downloadcsv;
    ?>
" title="csv new price update">new price update</a>.</p>
        <?php 
 function csvProdCommonData($new = 'no', $newarray = '', $folder = '')
 {
     // statuses: In Stock | Out of Stock
     // continuity: Normal Product | Soon Discontinued
     $csv_file = '"PRODUCT_ID";"MODEL";"SKU";"UPC";"EAN";"JAN";"ISBN";"MPN";"LOCATION";"QUANTITY";"STOCK_STATUS_ID";"IMAGE";"MANUFACTURER_ID";"SHIPPING";"PRICE";"POINTS";"TAX_CLASS_ID";"DATE_AVAILABLE";"WEIGHT";"WEIGHT_CLASS_ID";"LENGTH";"WIDTH";"HEIGHT";"LENGTH_CLASS_ID";"SUBTRACT";"MINIMUM";"SORT_ORDER";"STATUS";"VIEWED";"DATE_ADDED";"DATE_MODIFIED";"CHINAVASION_PRICE"' . "\r\n";
     if ($new == 'yes') {
         $query = $this->db->query("SELECT product_id, model_code, ean, main_picture, price, status, continuity FROM cv_products WHERE product_id IN ({$newarray})");
     } else {
         $query = $this->db->query("SELECT product_id, model_code, ean, main_picture, price, status, continuity FROM cv_products");
     }
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             // check quantity of products
             $quantity = 9999;
             if ($row->status == 'Out of Stock') {
                 $quantity = 0;
             } elseif ($row->continuity == 'Soon Discontinued') {
                 $quantity = 0;
             }
             $csv_file .= '"' . $row->product_id . '";"' . $row->model_code . '";"' . $row->model_code . '";"";"' . $row->ean . '";"";"";"";"";"' . $quantity . '";"7";"' . $row->main_picture . '";"0";"1";"' . mysellprice($row->price) . '";"0";"0";"' . date('Y-m-d') . '";"0";"1";"0";"0";"0";"1";"0";"1";"1";"1";"0";"' . date('Y-m-d H:m:s') . '";"' . date('Y-m-d H:m:s') . '";"' . $row->price . '"' . "\r\n";
         }
         // $csv_file .= 'FINISH'."\r\n";
         $file_name = 'oc__product.csv';
         $file_path = $_SERVER["DOCUMENT_ROOT"] . '/upload/opencart/' . $folder;
         $file_path_name = $file_path . $file_name;
         array_map("unlink", glob($_SERVER["DOCUMENT_ROOT"] . "/upload/opencart/*.csv"));
         $file = fopen($file_path_name, "w");
         fwrite($file, trim($csv_file));
         fclose($file);
         return $file_name;
     }
 }