Support is online

category_path combined question #8328

Open jimmywiddle opened this topic Wednesday, 08 June 2016 ยท 32 replies
Author

Hi,
Id like your advice on setting up a category_path as follows;

It just needs to be 'a_set_folder_name/[field_from_import]', to clarify the parent folder will be the same for all k2 articles imported and the child will be a field from the import.

Im aware I have to use a combine, but im a little confused about exactly how to achieve this.

Many thanks in advance!

Support

Hello Jimmy,

It just needs to be 'a_set_folder_name/[field_from_import]', to clarify the parent folder will be the same for all k2 articles imported and the child will be a field from the import.

The rules you need to apply are based on the category_path field value, if your category_path field is empty in your import file and you are creating one with a field from import file then you need to apply two rules as explained below but if your category_path has a value and you are just trying to replace its value with a_set_folder_name then you need only rule 2 to be applied.
1.create a combine rule where source field will be category_path,[field_from_import] and target field is category_path with combine character /. Apply this rule on category_path field. So if your category_path is empty it would become /[field_from_import]
2. create a replace rule where you set the Find text as the one you need CSVI to find say for example product1, in the replace field you can say it as 'a_set_folder_name/product1' and apply this rule on to same category_path field.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi, Thanks for your response.

I have 1 problem with step (2) in your example you use 'product1' for my import this will be a unique code and in the future new codes will be added to the import by my client. Basically its far from ideal for my client or myself to have to setup a replacement rule each time.

Is there another solution to this?
Many thanks in advance!

Support

Hello,

Is there another solution to this?

The only option i can think of now is that you have one more field in your import file with the a_set_folder_name same for all the rows and use a combine rule. You can set the source fields to be field name having a_set_folder_name value and field name having your unique codes, target field will be category_path field and combine character /. Apply this rule on category_path field. You can set the set the field with a_set_folder_name to skip so it is not taken in import. Try it and let me know how it goes.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi, Thanks for your help/response.

Currently the CSV import file is minimal ideally I dont want to have to explain to my client why this extra column is in there, for such a relatively small detail, is there really no alternative, i see the 'default value' within the field settings, could i not somehow use this?

Support

Hello Jimmy,

What you call a minor detail is not what I consider a minor detail. This is actual data being imported, so it must be important.

There is going to be a place where someone will have to set this value to what you want. You can actually use the default value by adding that field to your import template and you can leave the column out from the import file.

Just when the value changes, you or your customer will have to update that default field. The advantage of having it in the import file is that you have maximum control over it and can see which value is used rather than having to find out where the value is and what it is set to.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Ok great thanks! Yes this value definetly wont change.

So, could you possibly please explain to me exactly how to setup the category_path using this method, I have tried but im not having much luck!

Or if you are happy to, i have a feeling it might be quicker all round if I can just send you access, I have the path perfect except its not putting all the subcategories in the set parent folder, I dont know if the issue is the field order of something I saw something about combine fields having to be in sequential order, but I have many other combine fields setup and didn't want to tamper with the order just incase.

Thanks again!

Support

Hello Jimmy,
You can try doing this, try with one combine field first, if it is good then you can add more

  1. Create a combine template field with default value which you said wont change.
  2. Create a combine rule with source fields combine,unique code field name and target field as category_path, combine character as /
  3. Apply the rule on category_path template field.
  4. Try doing the import. If everything is set correct you can see category_path in preview.

Try this and if you are still not able to fix it, send me a private message with Joomla administrator login details and the fields you need to be combined. I will take a look at it.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi, Thanks again for your reply and help!

It now importing into the correct subcategory, but when importing now of the k2 extra fields are being populated, and when i go into edit the k2 items extra fields in joomla it tells me 'Notice: Please select a category first to retrieve its related "Extra Fields"...' although the category is selected fine (and also showing correctly on the import preview), after looking I found this due to the subcategory when created didn't inherit the following options from the parent, and somehow I need to set the following to values when a subcategory is created on import.

  • Inherit parameter options from category
  • Associated "Extra Fields Group"
  • (Category item layout) Select template

Your assistance would once again be much appreciated!

Support

Hello Jimmy,

  • Inherit parameter options from category
  • Associated "Extra Fields Group"
  • (Category item layout) Select template

You cannot import these fields when creating a subcategory during k2 item import since these fields are related to category but you can do a k2 category import and update these by adding category_path,params and extraFieldsGroup fields, params field value would be like {"inheritFrom":"","theme":""} where inheritFrom is parent category id and theme is for select template, extraFieldsGroup is for extra fields group. You can do a K2 category export with these fields, update the values and import them back.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Support

Hello Jimmy,
To make your work more easy we have added theme as a normal available fields and the patch is attached with this message. You need to apply the patch file and Instead of params explained in my previous post you can add inheritFrom field which is already an available field along with extraFieldsGroup to your import and CSVI will convert inheritFrom and theme values to params field automatically. It is the same with export, you can try to export inheritFrom and theme directly instead of params field. Try it and let me know how it goes.

patch-k2-2016_06_09.zip

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Many thanks for this much appreciated, I applied/uploaded the patch but I have to say Im slightly confused as to where I set this inheritFrom and the params field? I looked within the template fields but I couldn't spot anything related to inheritFrom, any help would be very much appreciated thanks!

Support

Hello,

I applied/uploaded the patch but I have to say Im slightly confused as to where I set this inheritFrom and the params field?

As i said earlier it is a available field for K2 category import and export and not for K2 item. To update these fields for a category, do a category export with category_path, inheritFrom,theme and extraFieldsGroup fields, edit them and import them back. You need to also update your available fields after applying the patch if you don't see these fields.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Thanks again, trying this but getting confused again, im getting to the 'Select fields' section of the export, i select Group fields I can see inheritFrom but there seems only a facility to add this fields, I see nowhere to add settings inherit from theme etc.

Also can I ask my client will be adding new categories via the main import file, will this process be necessary everytime new categories are added.

Once again your help is much appreciated, many thanks!

Support

Hello,

Hi Thanks again, trying this but getting confused again, im getting to the 'Select fields' section of the export, i select Group fields I can see inheritFrom but there seems only a facility to add this fields, I see nowhere to add settings inherit from theme etc.

Check the K2 category params export and K2 category params import tutorial to know how to do import and export process.

Also can I ask my client will be adding new categories via the main import file, will this process be necessary everytime new categories are added.

Yes because these are category settings and cannot be edited or updated while doing item import. You need to do it with category import only.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

I think UNFORTUNETLY it will be easier to have my client add the category and set the parameters manually in the admin (which they will not be happy about!).

As your method will mean, running the item import (which creates the new category) then running the k2 category params import, and then running the item import again (which will populate the extra fields etc) right?

This 100% cant be done on the same import? As all the parameters will remain the same for all subcategories added and will be the same as the parent category.

Once again many thanks!

Support

Jimmy,

I think UNFORTUNETLY it will be easier to have my client add the category and set the parameters manually in the admin (which they will not be happy about!).

You simply can't update your complete website with 1 import. You can of course put all the fields into 1 file and use this 1 file for both imports.

Your logic is the wrong way around. First you run the category import (if you have any new categories) and then you run the item import.

Just the templates you configure you will need to add all the fields and set the ones you don't want to use to skip.
Your customer, will have to enter the category details somewhere.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi, Im back on this task again and getting there. Thanks again for your help, great support!

So ive made the export, and have created the import template, im just preparing the import file (im using 1 import file for both the k2 item and categories as you advised), just 1 question please...

The category_path currently (on my item import) this is made up from a 1 field (not named category_path) the import copys it to category_path and adds a rule which places a_root_folder/ (a folder and a slash) at the begining. Ideally id like to keep it like this for the category import, but just looking at the category import available fields, im not sure its possible to use the other fields on my import file although i spotted custom field?

(I really want to avoid having to ask my client to enter data for this column also, i need to keep the process as simple as possible)

Once again your help is very much appreciated, thanks again!

Support

Hello,

I am not sure I understand the question so I am going to guess. The field category_path is the same for both the product and category import.

Can you give me a clearer example of the problem you see?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi, Thanks again for your reply, sorry if im confusing!

Ok so for the item import; the category_path is made up from a field on the import file 'id_field' with the import this field is copied (rule) and a root directory and slash added 'example_dir/' (rule) before being placed in category_path field.

Can the same thing be done with the category import? If so how as my id_field does not appear in the list (like it does for the item import).

Hope thats makes sense, sorry!

Support

Hey Jimmy,

Have you configured the id_field the same for the category import as it is configured for the product import? If it is your own type of field you can use the combine field. In your rule you would use this field to combine the category path.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Whatever I try I cannot get the category_path column to show on the preview.

Its difficult to set it up the same as different fields are available I tried with the combine but no joy im afraid, heres what I got:

TEMPLATE FIELDS:
Field name: category_path
Rules: category_path-category-import

Field name: combine
Your field: categorypath_Properties
Default value: Properties
Rules: category_path-category-import

Field name: combine
Your field: Properties_PropertyID (this is the name of the column containing the ID in the import file)
Rules: category_path-category-import

RULES:
Name: category_path-category-import
Action: import
Plugin: combine
Source fields: categorypath_Properties,Properties_PropertyID
Target field: category_path
Combine character: /

To clarify the category_path needs to be:
Property/[Properties_PropertyID]

(Property/ will be the same for all items imported)

Please tell me what im doing wrong, call me an idiot if you want lol :)
Thanks again!

Support

Jimmy,

The problem is you had set your template to Use file for configuration instead of using the fields you assigned to the template. I changed that, you can check the preview now.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Thanks again for your reply/help!

Good news the category_path is now appearing on the preview although all the preview data makes absolutely no sense to me at all (it has all changed and replaced with random data from the import file), ive been trying to work out some relation between the data and setting/import file, but cant, as i say, it all seems random?

Sorry about this, your help would (as usual) very much appreciated and thanks again!

Support

Hello Jimmy,

I can tell you for sure that CSVI isn't randomizing the data by itself, it simply shows how you configured the template.

Check the fields you have assigned to your template if they are in the same order as the fields are in your import file.

If needed start removing all the assigned rules to the fields of your import template. Look at what you have and assign rules as you need them.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Thanks again for your reply/help!

Ive checked the fields and removed all the rules, its not random now and is importing the first 4 columns.
Im attempting to use the same import file for k2 items and k2 category params (as I believe, you said previously I could).

Basically for the 4 fields required 3 of them will have the same data for all categories therefore I was hoping i could use default values in the field settings and only the category_path will change, which will be made up of properties/[the-id-taken-from-import-file] the other fields.

K2 Category import category_path properties/[id-of-field-from-import]
K2 Category import inheritFrom Properties
K2 Category import theme properties
K2 Category import extraFieldsGroup 1

But yes currently the import just pulls the first 4 columns ignoring the default values set for 3 fields.

And the rule seems to be ignored or doesn't make sense to me for the category_path

Your help would be once again very much appreciated, many thanks in advance!!!

Support

Hello,

What you are doing wrong is not specifying all the fields in your import file. You now have only 4 fields defined in your import template. Basically what you are saying is that the import file only has 4 fields. That is not the case is it? How would CSVI know which columns to pull in? You added 4 fields, so CSVI pulls in the first 4 columns.

You must add all the columns in your import file. The ones you don't want to import you choose the fields skip so that CSVI will skip them.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

At last, I got it perfect many many thanks for your help!

BUT I have an issue when adding this to the menu to run on the frontend, unfortunetly it only shows me export templates in the 'Select template' dropdown although i have selected 'COM_CSVI_IMPORT_FRONTEND' on the menu type dropdown, also the language is missing for import but not export (and only the export templates show no matter if import or export menu types are selected).

Ive completed this job if I can add this menu item, so im very keenly awaiting your help.

Many thanks in advance!!!!

Support

Hey Jimmy,

Front-end import is not part of the current release, this will come in the next release version 6.6.0. You can find the patch for front-end import in this thread.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Once again many thanks, I applied the patch but it hasn't made any difference with regards to trying to setup the import as an menu item, still the same problem im afraid.

Thanks again for your help Roland, hoping its a quick one for you as im desperate to finish this project, thanks!!!!!

Support

Hey Jimmy,

Before applying the patch I linked, did you also apply the patch posted in the thread at the top of the page? This is the main patch, the second one is a fix to that. Give that a try.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Cant thankyou enough, such fast and efficient support, it puts others to absolute shame!!!

Many thanks again Roland!!! Legend!!! :)

Support

Hello Jimmy,

Glad to hear all is finally solved. You are fast becoming a CSVI Expert ;)

Perhaps you can help me out and post a review at the Joomla! Extension Directory

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Log in to reply to this topic.