1. andkit02
  2. RO CSVI
  3. Monday, 16 July 2018
  4.  Subscribe via email
Hi,

I just recently purchased CSVI Pro. I tried setting up a Virtuemart export template for product categories.

I currently have the following fields:
1. virtuemart_category_id
2. category_name
3. category_path
4. file_url
5. published

I use multi-level categories with parent/sub-categories. The csv export above lists all categories, including both parents and sub-categories. I need to get another field, which can be a simple Boolean or 1/0, which indicates whether a particular row represents a bottom-level category.

For example, suppose I have the following category structure:
Parent category 1: Stationary
Sub-category 1.1: Pens
Sub-category 1.2: Pencils
Sub-category 1.3: Papers
Sub-sub-category 1.3.1: Letter papers
Sub-sub-category 1.3.2: A4 papers
Sub-sub-category 1.3.3: Legal papers

Here, the bottom-level categories are: 1.1, 1.2, 1.3.1, 1.3.2, 1.3.3... so for these, the "bottom_level_cat" field could have value "1", whereas the rest have value "0".

Can you please advice how to achieve this?

Thanks!
Accepted Answer Pending Moderation
Sorry for the confusion, I simply meant we can create two categories with the exact same name, they will have non-unique names (and hence category paths), but will still have unique category_id
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hello,

Very nice extension btw!
Thank you.

I was thinking that strictly speaking category_path could be non-unique
I don't think so because if they are non-unique, they would point to the same location. Or do you mean something else?
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hi,
Thanks Roland! Very nice extension btw!
I was thinking that strictly speaking category_path could be non-unique, but practically should probably avoid this anyway. I have about ~100 multi-level categories now, I think I will go through and make sure that they are descriptive and unique. Assuming they are unique, I can compute the last-category check offline by doing some check on the category_path table, so this could avoid having to do the custom tables. I'll give this a try. Thanks all!
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
Hello,

The potential problem I have with the category_path is that the category_name is not necessarily unique whereas the category_id is.
Correct, the category_name does not have to be unique that is why CSV Improved uses the category_path to identify categories as this is unique.

The reason we discourage usage of _id fields is because they are controlled by the database and changing them by yourself might break the data integrity. We don't prohibit using them but just say that you better know what you are doing :)
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Hi Tharuna,

Thank you very much for the quick replies and the suggested solutions. The potential problem I have with the category_path is that the category_name is not necessarily unique whereas the category_id is. I think I may be able to do some combinations of your suggested solution to achieve what I need. Thanks!
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
Hello,
Is the parent_category_id field available? I couldn't find it on the CSVI category available fields, can you help how to get this field? It seems that this will be necessary for the code (rule) to determine whether a particular category is a bottom-level category?

No, this field is not available in category export. We do not recommend using fields with _id in import or export as database handles these id fields. category_path field is constructed using category_parent_id and category_child_id field and the export gets the parent child relation.

I'm also thinking of a possibility to do the check offline after the export, but would need the parent_category_id field or something similar too, which indicates the parent/sub-category relations...

If you are looking at exporting those field you can use Advanced Custom table export and join the VirtueMart category tables to get them on export but do remember that custom table export do not support category_path field.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Question- Is the parent_category_id field available? I couldn't find it on the CSVI category available fields, can you help how to get this field? It seems that this will be necessary for the code (rule) to determine whether a particular category is a bottom-level category? I'm also thinking of a possibility to do the check offline after the export, but would need the parent_category_id field or something similar too, which indicates the parent/sub-category relations...
  1. more than a month ago
  2. RO CSVI
  3. # 7
Accepted Answer Pending Moderation
Hello,
You can also write a rule plugin for checking the last level category and fill in values for bottom_level_cat field. With override you may need to check and compare the override file for every update but with rule plugin there will be no such issues.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 8
Accepted Answer Pending Moderation
Hello,
CSVI does not have an option to find if the exported category is a last level category to fill in values for bottom_level_cat field. The only way to do this is to write some custom code for VirtueMart category export and set it as Override for your export.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 9
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!