Post by traceofwind » Wed Apr 06, 2011 11:25 pm

Hi,

I would like to add additional columns to the import process.

Many of my products feature fractions in their product names and do not display in the correct order. My spreadsheet factors this with an 'Order' column, which I would like to import via CSV Import PRO.

Does anyone know where I begin, or if there is any example code out there for adding additional columns to the import process?

Thanks in advance, best regards

Gary

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by traceofwind » Thu Apr 07, 2011 1:48 am

Hi again,

I managed to do it myself, CSV Import PRO now imports Sort Order and I am very happy with that! :)

I have posted the code snippets below so that others can learn how to add additional columns to their import pipeline. For reference, I am using OpenCart v1.4.9.3. There are 4 code additions to be made to the admin controller file, 2 additions to the admin language file and 1 addition to be made to the admin template file. I have listed the updated code snippets, I hope you find them helpful:

Here are the related files that we need to be aware of:
  • /admin/controller/view/template/tool/csv_import.tpl
  • /admin/language/english/tool/csv_import.tpl
  • /admin/model/tool/csv_import.tpl (I did not update this file)
  • /admin/view/template/tool/csv_import.tpl
In the controller file (/admin/controller/view/template/tool/csv_import.tpl), you need to add 4 additional pieces of code, at the following locations respectively:

Code: Select all

// GET HEADINGS INFO
		$headings_info = array(
			'csv_import_field_sort_order' => 'sort_order',

Code: Select all

// SPECIFY REQUIRED LANGUAGE TEXT
		$language_info = array(
			'text_field_sort_order',

Code: Select all

//required product data
		$prod_data = array(
			'sort_order' => 0,

Code: Select all

//Optional Import Fields:

				//SEO Keyword
				if (isset($this->field_names['keyword']) && isset($raw_prod[$this->field_names['keyword']])) {
					$product['keyword'] = $raw_prod[$this->field_names['keyword']];
				}
				//Sort Order
				if (isset($this->field_names['sort_order']) && isset($raw_prod[$this->field_names['sort_order']])) {
					$product['sort_order'] = $raw_prod[$this->field_names['sort_order']];
				}
The language file is quick and easy to update (/admin/language/english/tool/csv_import.tpl); the additions below should be added under the '// Entry' and '// Field Names' sections, respectively, as follows:

Code: Select all

$_['entry_sort_order']= 'Sort Order:';
$_['text_field_sort_order']     = 'Sort Order';
The fourth file (/admin/view/template/tool/csv_import.tpl) can also be easily modified; simply find the first <tr>...</tr> in the code below and add the second table row which includes our 'Sort order' text field:

Code: Select all

<tr><td style="width:200px;"><h2><?php echo $text_field_oc_title; ?></h2></td><td><h2><?php echo $text_field_csv_title; ?></h2></td>
				<tr><td style="width:200px;"><?php echo $text_field_name; ?></td><td><input type="text" name="csv_import_field_name" value="<?php if ($csv_import_field_name) {echo $csv_import_field_name; } ?>"></td></tr>
                <tr><td style="width:200px;"><?php echo $text_field_sort_order; ?></td><td><input type="text" name="csv_import_field_sort_order" value="<?php if ($csv_import_field_sort_order) {echo $csv_import_field_sort_order; } ?>"></td></tr>
All the best,

Gary

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by aaron1988 » Thu Apr 07, 2011 7:27 pm

Nice little modification Gary :)

I might right up 2 modifications i have made to it later on when got some time :)

As i have added Gender + Size

Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by traceofwind » Sun Apr 10, 2011 11:05 pm

Hi Aaron,

Please do share what modifications you have made! I remembered your other post today -and having read it -am glad to see resolved it. CSV Import Pro is a great extension, and all the better for people like you and the author posting on the forum to expand upon its uses!

Gary

PS,
if you decide to post your Gender/Size mod, could you also write about how you added those columns to the cart or the pipeline for doing so? I am looking to add additional data to my products and it would be great if you could touch on that, too.

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by aaron1988 » Mon Apr 11, 2011 4:43 am

Hi Gary,

Yes i will post modifcation tomorrow :)

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by dean0537 » Fri Sep 07, 2012 5:54 pm

Could anyone help me please as i simply cannot get the sub cats to show and i cant get the products to go into the sub cats, pulling my hair out now and im sure its so simple

such a newbie


Newbie

Posts

Joined
Tue Aug 21, 2012 2:30 pm
Location - Kent, England

Post by aaron1988 » Fri Sep 07, 2012 6:43 pm

sorry i not uploaded the Gender / Size modification yet i totally forgot about this thread i will try an gather it up later on today.

What do you mean you cant do the sub cats? etc.

First create a column called Main Category then create another Column Called Sub Categories and then you put main cats in main cats and sub cats in sub cats then in the csv import pro you will use the category more with the right arrow so it adds it like Main Category > Sub Categories

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Tue Oct 09, 2012 6:19 am

Have you manged to find time to gather up the gender size mod yet??

Thanks in advance.

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Tue Oct 09, 2012 5:26 pm

I have a look later today i totally forgot so i would need to redownload the module and re-implement it in.

are you using the latest version of opencart?

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Wed Oct 10, 2012 7:02 am

aaron1988 wrote:I have a look later today i totally forgot so i would need to redownload the module and re-implement it in.

are you using the latest version of opencart?

yes I am running the latest version.

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Thu Oct 11, 2012 6:47 am

Ok i just about to install the latest version :) will have a go at doing the gender and size just so i know where is the best place for them to go for you?

like where abouts on the product page?

Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Sat Oct 13, 2012 5:15 am

I am not fussed mate its all I can do to get my head round total upload pro to be honest. :)

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Sat Oct 13, 2012 8:50 pm

Ok mate so you using Total Import Pro or CSV Import Pro?

Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Sat Oct 13, 2012 10:02 pm

aaron1988 wrote:Ok mate so you using Total Import Pro or CSV Import Pro?

Aaron
Total Import PRO, but finding it really hard going to get my head round it all. Although I do have rather a lot of projects on the go currently. lol

What I really need a a video of someone who has total import pro and a website where I can see what is actually uploaded to the store.

I guess I am going to have to create a dummy store and start adding stuff myself, although I purchased the module as I saw a video for CSV import pro and thought there would be one for total as well but sadly not yet. My problem is I learn 99% of my stuff visually rather than from a manual....

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Sun Oct 14, 2012 12:25 am

Hey do you have skype or an email address i could contact you on? if so PM me on here :) and i can help

Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Sun Oct 14, 2012 4:25 am

aaron1988 wrote:Hey do you have skype or an email address i could contact you on? if so PM me on here :) and i can help

Aaron
Pm sent mate

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Sun Oct 14, 2012 8:21 am

This issue has now been resolved via PM and skype

Thanks
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by ukracer » Sun Oct 14, 2012 3:42 pm

aaron1988 wrote:This issue has now been resolved via PM and skype

Thanks
Aaron
Thanks Aaron much appreciated.

Active Member

Posts

Joined
Wed Oct 03, 2012 6:36 am

Post by aaron1988 » Sun Oct 14, 2012 5:27 pm

Your welcome mate, anytime if you need anymore help on anything please let me know

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by captainahab » Tue Jan 15, 2013 3:31 pm

Hi there,

it looks like you guys may be able to help me, I'm a very happy user of Total Import PRO, but I've come up with an issue where I've added an additional field/column in the "product" table called "cost" which is all fine and working, however I need to modify/hack Total Import PRO to allow me to import that additional field from the CSV file and I'm not sure where to begin, I'm running 1.5.4 of Opencart and (I think) the latest Total Import PRO, can you guys point me in the right direction as I'm getting desperate.

Cheers

James.

Newbie

Posts

Joined
Tue Jan 15, 2013 3:26 pm
Who is online

Users browsing this forum: No registered users and 4 guests