close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

eCart Store Summary not working how expected

Thread began 10/23/2016 11:49 am by Christopher West | Last modified 11/28/2016 11:15 am by Christopher West | 2175 views | 5 replies

Christopher WestCommunity Expert

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:
<?php

if (($handle fopen("../files/libra-products.csv""r")) !== FALSE) {
   
fgetcsv($handle);   
   while ((
$data fgetcsv($handle1000",")) !== 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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...