Page 2 of 2

Re: CSV Import Pro: importing additional columns?

Posted: Thu Jan 17, 2013 12:21 am
by aaron1988
Yes :) i can help you do this send me a PM

Re: CSV Import Pro: importing additional columns?

Posted: Thu Feb 07, 2013 5:59 am
by hostjars
Hey James,

Here is a brief rundown of what would be required for a new field (like cost).

In the controller/tool/total_import.php file.

Line 434 ish: $this->data['field_map'] = array(

Add a 'cost' entry with the appropriate string (can use language file load or just a flat string like 'Cost')

Line 493 ish: $this->data['tab_field'] = array(

Add 'cost' to the tab you want it to appear (e.g under 'Data' is most likely the tab it is in in the product edit/add screen).

Finally around line: 1227: $this->prod_data = array(

Add a 'cost' => '' entry to the array

Assuming 'cost' is the name of your field in the database that should be all that is required, I may be slightly off as I do not have a cost field install to test this on as I am writing but the above should basically do it =)

Re: CSV Import Pro: importing additional columns?

Posted: Thu Feb 07, 2013 5:05 pm
by aaron1988
Hi i did same sort of mod myself for total import pro and worked

Re: CSV Import Pro: importing additional columns?

Posted: Fri Jun 13, 2014 7:38 am
by thegurge
hostjars wrote:Hey James,

Here is a brief rundown of what would be required for a new field (like cost).

In the controller/tool/total_import.php file.

Line 434 ish: $this->data['field_map'] = array(

Add a 'cost' entry with the appropriate string (can use language file load or just a flat string like 'Cost')

Line 493 ish: $this->data['tab_field'] = array(

Add 'cost' to the tab you want it to appear (e.g under 'Data' is most likely the tab it is in in the product edit/add screen).

Finally around line: 1227: $this->prod_data = array(

Add a 'cost' => '' entry to the array

Assuming 'cost' is the name of your field in the database that should be all that is required, I may be slightly off as I do not have a cost field install to test this on as I am writing but the above should basically do it =)
Thanks for this but for some reason I can;t get it to work,

Everything is there up to Step 4. I can see the field and I can map it but it never imports the value into the database column.

Any suggestions?

Re: CSV Import Pro: importing additional columns?

Posted: Fri Jun 13, 2014 7:43 am
by thegurge
Thanks for that post hostjars. I still can't get the additional column to import. Everything works up to Step 4. I can see the field value in the sample feed, and can map it to the right column. But the value doesn't import into the database. Am I missing something? Has the process changed since this was posted.

Re: CSV Import Pro: importing additional columns?

Posted: Sat Jun 14, 2014 3:52 am
by aaron1988
Hi if you send me a PM i can help you get this sorted :)

Thanks
Aaron

Re: CSV Import Pro: importing additional columns?

Posted: Tue Jul 15, 2014 3:12 am
by marlin.nl
Handy help guys!

For those that need the following:

We needed to set the quantity of products with 1 till 5 on stock to zero.
With this code you can do that.
Place the code before "//ADMIN STEP 3: MODIFY DATA"

Code: Select all

//stocksetting
			foreach (array('quantity') as $quantity) {
				$raw_prod[$this->field_names[$quantity]] = str_replace('1', '0', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('2', '0', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('3', '0', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('4', '0', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('5', '0', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('yes', '6', $raw_prod[$this->field_names[$quantity]]);
				$raw_prod[$this->field_names[$quantity]] = str_replace('no', '0', $raw_prod[$this->field_names[$quantity]]);
			}
Now we try to do something with the price.
The multiplier aloows you to markup the price with only one markup %.
We are trying to do something like:

0 - 10 euro, add 5 euro
10-25 euro, add 6 euro
25-50 euro, add 7.50 euro
and so on.

We tried the code:

Code: Select all

if (($raw_prod[$this->field_names['price']]) <10) {
					$raw_prod[$this->field_names['price']] = ($raw_prod[$this->field_names['price']] + 5)*1.21;
				}
But with this code you can not set more then one markup.
We keep trying but help is always oke ;)

Re: CSV Import Pro: importing additional columns?

Posted: Sun Apr 05, 2015 1:40 am
by intelcom
@marlin.nl

Hello.

if (($raw_prod[$this->field_names['price']]) <10) {
$raw_prod[$this->field_names['price']] = ($raw_prod[$this->field_names['price']] + 5)*1.21;
}

Did you find the solution for that? Is something that we want it too.

Thanks.