Post by aaron1988 » Thu Jan 17, 2013 12:21 am

Yes :) i can help you do this send me a PM

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by hostjars » Thu Feb 07, 2013 5:59 am

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 =)

Mods: Total Import PRO | Any Feed PRO | XML Input PRO |
CSV Import PRO
Image


New member

Posts

Joined
Mon Jul 23, 2012 4:14 pm

Post by aaron1988 » Thu Feb 07, 2013 5:05 pm

Hi i did same sort of mod myself for total import pro and worked

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by thegurge » Fri Jun 13, 2014 7:38 am

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?

Newbie

Posts

Joined
Fri Jun 13, 2014 7:30 am

Post by thegurge » Fri Jun 13, 2014 7:43 am

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.

Newbie

Posts

Joined
Fri Jun 13, 2014 7:30 am

Post by aaron1988 » Sat Jun 14, 2014 3:52 am

Hi if you send me a PM i can help you get this sorted :)

Thanks
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by marlin.nl » Tue Jul 15, 2014 3:12 am

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 ;)

Live store Opencart 2.3.0.2 modified on https://webshopmarlin.nl


New member

Posts

Joined
Thu Aug 25, 2011 11:22 pm

Post by intelcom » Sun Apr 05, 2015 1:40 am

@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.

User avatar
New member

Posts

Joined
Wed Apr 11, 2012 4:33 am
Location - Thessaloniki Greece
Who is online

Users browsing this forum: No registered users and 4 guests