Jump to content

Edit History

Kaper

Kaper

 

WoW, that was quick :) Thanks, i have tried it, but stock is not updated  :/, isn't problem somwhere here? " !is_numeric($data[3])"

 

<?php

// MAIN CYCLE
$row_num = 0;
if (($handle = fopen($remote_csv_file, "r")) !== false) {
  while (($data = fgetcsv($handle, 100000, ";")) !== false) {
    $row_num++;
    if ($row_num == 1) {
      // SKIP FIRST LINE (HEADER)
      continue;
    }
    //quantity = EAN -->  STOCK
    if ($data[2] == '' || !is_numeric($data[3])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price = EAN -->  PRICE
    if ($data[2] == '' || !is_numeric($data[1])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price bezna = EAN --> PRICE BEZNA
    if ($data[2] == '' || !is_numeric($data[0])) {
      // SKIP EMPTY VALUES
      continue;
    }

    // INPUT SANITIZATION   
    $ean13         = trim($data[2]);    
      
    $qty = str_replace('>','',$data[3]); //  STOCK, QUANTITY
    $quantity = ($qty >= 0) ? $qty : 0;  

    $price         = ($data[1] >= 0) ? $data[1] : 0;  //  PRICE
    $price_bezna   = ($data[0] >= 0) ? $data[0] : 0;  //  PRICE BEZNA
Kaper

Kaper

 

WoW, that was quick :) Thanks, i have tried it, but stock is not updated  :/, isn't problem somwhere here? " !is_numeric($data[3])"

 

// MAIN CYCLE
$row_num = 0;
if (($handle = fopen($remote_csv_file, "r")) !== false) {
  while (($data = fgetcsv($handle, 100000, ";")) !== false) {
    $row_num++;
    if ($row_num == 1) {
      // SKIP FIRST LINE (HEADER)
      continue;
    }
    //quantity = EAN -->  STOCK
    if ($data[2] == '' || !is_numeric($data[3])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price = EAN -->  PRICE
    if ($data[2] == '' || !is_numeric($data[1])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price bezna = EAN --> PRICE BEZNA
    if ($data[2] == '' || !is_numeric($data[0])) {
      // SKIP EMPTY VALUES
      continue;
    }

    // INPUT SANITIZATION   
    $ean13         = trim($data[2]);    
      
    $qty = str_replace('>','',$data[3]); //  STOCK, QUANTITY
    $quantity = ($qty >= 0) ? $qty : 0;  

    $price         = ($data[1] >= 0) ? $data[1] : 0;  //  PRICE
    $price_bezna   = ($data[0] >= 0) ? $data[0] : 0;  //  PRICE BEZNA
Kaper

Kaper

WoW, that was quick :) Thanks, i have tried it, but stock is not updated  :/, isn't problem somwhere here? " !is_numeric($data[3])"

 

 

// MAIN CYCLE
$row_num = 0;
if (($handle = fopen($remote_csv_file, "r")) !== false) {
  while (($data = fgetcsv($handle, 100000, ";")) !== false) {
    $row_num++;
    if ($row_num == 1) {
      // SKIP FIRST LINE (HEADER)
      continue;
    }
    //quantity = EAN -->  STOCK
    if ($data[2] == '' || !is_numeric($data[3])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price = EAN -->  PRICE
    if ($data[2] == '' || !is_numeric($data[1])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price bezna = EAN --> PRICE BEZNA
    if ($data[2] == '' || !is_numeric($data[0])) {
      // SKIP EMPTY VALUES
      continue;
    }

    // INPUT SANITIZATION   
    $ean13         = trim($data[2]);    
      
    $qty = str_replace('>','',$data[3]); //  STOCK, QUANTITY
    $quantity = ($qty >= 0) ? $qty : 0;  

    $price         = ($data[1] >= 0) ? $data[1] : 0;  //  PRICE
    $price_bezna   = ($data[0] >= 0) ? $data[0] : 0;  //  PRICE BEZNA
Kaper

Kaper

WoW, that was quick :) Thanks, i have tried it, but stock is not updated  :/, isn't problem somwhere here? " !is_numeric($data[3])"

 

 

// MAIN CYCLE
$row_num = 0;
if (($handle = fopen($remote_csv_file, "r")) !== false) {
  while (($data = fgetcsv($handle, 100000, ";")) !== false) {
    $row_num++;
    if ($row_num == 1) {
      // SKIP FIRST LINE (HEADER)
      continue;
    }
    //quantity = EAN -->  STOCK
    if ($data[2] == '' || !is_numeric($data[3])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price = EAN -->  PRICE
    if ($data[2] == '' || !is_numeric($data[1])) {
      // SKIP EMPTY VALUES
      continue;
    }
    //price bezna = EAN --> PRICE BEZNA
    if ($data[2] == '' || !is_numeric($data[0])) {
      // SKIP EMPTY VALUES
      continue;
    }

    // INPUT SANITIZATION   
    $ean13         = trim($data[2]);
    
    $quantity      = ($data[3] >= 0) ? $data[3] : 0;  //  STOCK, QUNTITY
    $qty = str_replace('>','',$data[3]);
    $quantity = ($qty >= 0) ? $qty : 0;  

    $price         = ($data[1] >= 0) ? $data[1] : 0;  //  PRICE
    $price_bezna   = ($data[0] >= 0) ? $data[0] : 0;  //  PRICE BEZNA
×
×
  • Create New...