Jump to content

csv file problems


Omega

Recommended Posts

Hi

 

I am able to import my cfv file and it shows up in my store, but there a few problems.

 

1. When I click on an image to to see the product, its says that there are no products in this catagory

 

2. For some reason, some catagories show and others do not.

 

I use open office to edit, but I dont know what the original format was.

 

Any help appriciated. I have seen the other threads, but I can not seem to make sense of the template.

Link to comment
Share on other sites

OK.

One of my client had a similar problem on 1.4.3, there was a bug in the import, categories where changes if not set in the csv file. I guess you have the same problem.

I don't know if it is exactly the same code in 1.4.4.1 but you can try these modifications in AdminImport.php

 

public function productImport()

{

global $cookie;

$this->receiveTab();

$handle = $this->openCsvFile();

$defaultLanguageId = (int)(Configuration::get('PS_LANG_DEFAULT'));

self::setLocale();

for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, Tools::getValue('separator')); $current_line++)

{

if (Tools::getValue('convert'))

$line = $this->utf8_encode_array($line);

$info = self::getMaskedRow($line);

if (array_key_exists('id', $info) AND (int)($info['id']) AND Product::existsInDatabase((int)($info['id'])))

{

$product = new Product((int)($info['id']));

$categoryData = Product::getProductCategories((int)($product->id));

//DEBUG_OPTIMINFO

// foreach ($categoryData as $tmp)

// $product->category[] = $tmp['id_category'];

//get default category : one product, one default cat

$def_sql = 'SELECT id_category_default FROM '._DB_PREFIX_.'product WHERE id_product='.$product->id;

$def_cat = Db::getInstance()->ExecuteS($def_sql);

$product->id_category_default = $def_cat[0]['id_category_default'];

$product->id_category[] = $def_cat[0]['id_category_default'];

 

 

$cat_sql = 'SELECT id_category FROM '._DB_PREFIX_.'category_product WHERE id_product='.$product->id;

$cat_order = Db::getInstance()->ExecuteS($cat_sql);

foreach($cat_order AS $cat){

$product->id_category[] = $cat['id_category'];

}

//END OPTIMINFO

}

else

$product = new Product();

 

I Hope this will help you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...