eCart Store Summary not working how expected
Hi, as the question topic suggests, I am having problems.
I'm using the server behavior to import data from a CSV file. I decided to use this method so that the client can edit product details and add new ones then import the file into the database. I feel that somewhere my logic is wrong. It works with adding new product entries, but doesn't update any existing products that have been edited in the csv file.
if you were to look at the core code below, is there an obvious reason or where I have gone wrong? (NOTE: I removed some of the columns to keep the code small for this topic (but it doesnt alter the functionality).
NOTE: ProductSKU is the only field that will never change and is unique, hence why I used it as a filter.
<?php
if (($handle = fopen("../files/libra-products.csv", "r")) !== FALSE) {
fgetcsv($handle);
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
for ($c=0; $c < $num; $c++) {
$col[$c] = $data[$c];
}
$col1 = $col[0];
$col2 = $col[1];
$col3 = $col[2];
$col4 = $col[3];
$col5 = $col[4];
$col6 = $col[5];
$col7 = $col[6];
if ("" == "") {
$ConditionalQuery = new WA_MySQLi_Query($ecartdb);
$ConditionalQuery->Action = "conditional";
$ConditionalQuery->Table = "products";
$ConditionalQuery->saveInSession("ProductSKU");
$ConditionalGoTo = "";
if (function_exists("rel2abs")) $ConditionalGoTo = $ConditionalGoTo?rel2abs($ConditionalGoTo,dirname(__FILE__)):"";
$ConditionalQuery->redirect($ConditionalGoTo);
if (isset($_SESSION[$ConditionalQuery->SaveAs])) $ConditionalQuery->addFilter("ProductSKU", "=", "s", $_SESSION[$ConditionalQuery->SaveAs]);
$ConditionalQuery->bindColumn("ProductEnabled", "s", $col1, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductSKU", "s", $col2, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductName", "s", $col3, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductBrand", "s", $col4, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductPrice", "s", $col5, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductRRP", "s", $col6, "WA_DEFAULT");
$ConditionalQuery->bindColumn("ProductQuantity", "s", $col7, "WA_DEFAULT");
$ConditionalQuery->execute();
}
}
}
?>
Chris