Commit 3ac84725 authored by ram4nd's avatar ram4nd
Browse files

Fix omniva locations url.

parent 74e9ce76
<?php <?php
/** /**
* Implements hook_field_schema(). * Implements hook_field_schema().
* *
......
...@@ -7,13 +7,14 @@ function commerce_omniva_locations() { ...@@ -7,13 +7,14 @@ function commerce_omniva_locations() {
$data = $cache->data; $data = $cache->data;
} }
else { else {
$request = drupal_http_request('https://www.omniva.ee/locations.csv');
$request = drupal_http_request('http://www.omniva.ee/locations.csv');
$rows = explode("\n", str_replace(';NULL', ';', $request->data)); $rows = explode("\n", str_replace(';NULL', ';', $request->data));
$data = array(); $data = array();
$keys = str_getcsv($rows[0], ';'); $keys = str_getcsv($rows[0], ';');
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
if ($key === 0 || empty($row)) continue; if ($key === 0 || empty($row)) {
continue;
}
$row_array = str_getcsv($row, ';'); $row_array = str_getcsv($row, ';');
$data[$row_array[0]] = array_combine($keys, $row_array); $data[$row_array[0]] = array_combine($keys, $row_array);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment