1. nebojsa
  2. RO CSVI
  3. Wednesday, 28 October 2020
  4.  Subscribe via email
Hi there.
I have an issue with related_prodcuts field.
It simply isn't importing anything. My CSV file is attached. Thank you for your help on this.

RO CSVI 7.17.0
VirtueMart 3.8.4 10335
Joomla! 3.9.20
Attachments (1)
Accepted Answer
Accepted Answer Pending Moderation
Hello Nebojsa,
Why selecting vendor ID is important for related products and not for other type of custom attributes?

This check was added for multi vendors scenarios but we see that it is really not necessary in case of related products or related categories. The attached patch file is the code without vendor_id check. Please load the attached patch file and run the import. Let me know if that solves the issue.
Attachments (1)
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # Permalink
Accepted Answer Pending Moderation
Hello,
Please also post the import debug log to check. To get the debug log check How to get debug information? document.
Kind regards,

Tharuna

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

Please find attached log file.

Friendly regards,
Nebojsa
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello Nebojsa,
Thank you for posting the debug log. As per the debug log related products are imported for 10 products from the import file. If you go to VirtueMart Product edit details page and on Custom fields tab for product with SKU CPRR17, do you see any products in related products section? Please post a screenshot of what you see on the tab.
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
No, I don't see any related products inside.
Capture.jpg
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Hello Nebojsa,
That is so strange, debug log query shows that related product has been inserted. See the query from the debug log which shows the row has been inserted. Please send me your administrator login details and (S)FTP details to check the issue. You can post the details on Site details tab under your reply.


INSERT INTO `1953_virtuemart_product_customfields` (`virtuemart_product_id`,`virtuemart_custom_id`,`customfield_value`,`disabler`,`override`,`noninheritable`,`customfield_params`,`published`,`created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`,`ordering`) VALUES ('199','1','206','0','0','0','','0','2020-10-29 12:37:54','516','2020-10-29 12:37:54','516','0000-00-00 00:00:00','0','0')
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
I agree it is very strange.
That's why I asked it here.
I have sent you login details in private message.
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Hello Nebojsa,
Thank you for sharing your site details. I tried to import for one product CPRR17 from your file in your site. I see debug log shows the row has been inserted but no related products is shown in Products edit page. That is really odd. Please run the below query in PHPMyAdmin and tell me if you see any records. Post a screenshot to check.


SELECT * FROM `1953_virtuemart_product_customfields` WHERE `virtuemart_product_id`=199 and `virtuemart_custom_id`=1
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 7
Accepted Answer Pending Moderation
OK, here it is ...
Capture.jpg
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 8
Accepted Answer Pending Moderation
Hello Nebojsa,
That shows that related products row is actually inserted in database. I really wonder why it does not show in VirtueMart. I tested that one product in my local site with the same VirtueMart version and the related product shows up. See attached screenshot. We need to find out what is different in your site that VirtueMart does not load the related product. Please send me (S)FTP access details so i can check.

You can also check the related product import on a fresh Joomla and VirtueMart installation. Just to know if this issue is something very specific to your site.
Attachments (1)
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 9
Accepted Answer Pending Moderation
I see ... that's indeed very strange.
I have sent you FTP credentials.
I will also inspect it with fresh install by my side.
  1. more than a month ago
  2. RO CSVI
  3. # 10
Accepted Answer Pending Moderation
Dear Tharuna,

I have investigated deeper and found the problem.
This is your SQL inquiry:

INSERT INTO `1953_virtuemart_product_customfields` (`virtuemart_product_id`,`virtuemart_custom_id`,`customfield_value`,`disabler`,`override`,`noninheritable`,`customfield_params`,`published`,`created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`,`ordering`) VALUES ('199','1','206','0','0','0','','0','2020-10-30 13:19:34','516','2020-10-30 13:19:34','516','0000-00-00 00:00:00','0','0')


And this is my inquiry that works:

INSERT INTO `1953_virtuemart_product_customfields` (`virtuemart_product_id`,`virtuemart_custom_id`,`customfield_value`,`disabler`,`override`,`noninheritable`,`customfield_params`,`published`,`created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`,`ordering`) VALUES ('199','29','206','0','0','0','','0','2020-10-30 13:19:34','516','2020-10-30 13:19:34','516','0000-00-00 00:00:00','0','0')


There is a column called

virtuemart_custom_id
(second column) which needs to be set to 29 in my particular case and in your inquiry is set to 1.
I am still not sure what virtuemart_custom_id represents. Do you have more info on this column and why is your set to 1?
Maybe if you have fresh installation of VM without any previously defined customfield values it can work with value 1 but if you already have some defined customfields you need to set a different number? This is just a theory.
  1. more than a month ago
  2. RO CSVI
  3. # 11
Accepted Answer Pending Moderation
Dear Tharuna,

OK, I have an answer.
Customfield ID is taken from Custom Fields definitions in VM.

Please take a look:
capture.jpg

In new versions of Virtuemart related products are defined in custom fields, otherwise they will not show up.
So my theory is right. If you have fresh VM install and create related product your custom ID for related products will be 1.
If you have it in another place then it can be any number.
So I believe your import engine needs another field called "virtuemart_custom_id" which will be related to particular related custom ID.
Or your engine needs to search for related products custom ID in another table and take it from there.
Otherwise, always putting values to 1 will make many problems.
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 12
Accepted Answer Pending Moderation
Hello Nebojsa,
I am still not sure what virtuemart_custom_id represents. Do you have more info on this column and why is your set to 1?

We do not set this value as 1, RO CSVI uses a query to fetch related products row and this query is based on virtuemart_vendor_id and field_type fields.

In new versions of Virtuemart related products are defined in custom fields, otherwise they will not show up.

Yes and so we collect related products id from VirtueMart customs table.

So my theory is right. If you have fresh VM install and create related product your custom ID for related products will be 1.
If you have it in another place then it can be any number.

There is one problem i see with your VirtueMart customs table. For related products row the value of virtuemart_vendor_id is 1 wheres it is supposed to be 0. This has been an issue with VirtueMart updates which does not update this field and causes trouble with related products and related categories. RO CSVI uses virtuemart_vendor_id as one of its field to select related products row. So can you please change the virtuemart_vendor_id row to 0 for related products in #__virtuemart_customs table and then run the import? Please check if the value 29 is inserted after that.

Otherwise, always putting values to 1 will make many problems.

I still could not figure out where this 1 is coming from but as requested please do the change to virtuemart_vendor_id field and run the import again. Let us see if that makes the difference with related products.
Kind regards,

Tharuna

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

I did as suggested, setting up virtuemart_vendor_id to 0 in virtuemart_customs.
Everything was working fine and import was successful until I found out that each new custom field I create sets vendor_id to 1 instead of 0.
Then I tried changing vendor user table and setting default vendor id to 0 but that caused lot of other problems.
Looks like I am stuck here. I will let you know if I find any solution on how to set default vendor id to 0.
  1. more than a month ago
  2. RO CSVI
  3. # 14
Accepted Answer Pending Moderation
A small update. I searched for vendor_id in VM forum and everyone suggests that it should be set to 1 instead of 0.
vendor_id with value 0 makes various issues.
Everything else works just fine in virtuemart_customs table except related products custom fields which needs to have vendor_id set to 0.
I find this very odd.
You mentioned that your import for related products is dependable of vendor_id.
From which table do you take that relationship?
I am trying to figure out is there something wrong with some table in my DB so your plugin is taking wrong values.
  1. more than a month ago
  2. RO CSVI
  3. # 15
Accepted Answer Pending Moderation
Hello Nebojsa,
A small update. I searched for vendor_id in VM forum and everyone suggests that it should be set to 1 instead of 0.
vendor_id with value 0 makes various issues.

The vendor_id value as 0 is based on the value VirtueMart uses in its installation package for #__virtuemart_customs table. You can check it in VirtueMart installation package and in the file install/install_required_data.sql for table #__virtuemart_customs.

Everything else works just fine in virtuemart_customs table except related products custom fields which needs to have vendor_id set to 0.
I find this very odd.

Yes it is odd. There has always been a confusion with vendor_id value to be 0 or 1.

You mentioned that your import for related products is dependable of vendor_id.
From which table do you take that relationship?
I am trying to figure out is there something wrong with some table in my DB so your plugin is taking wrong values.

RO CSVI query selects the related products row from #__virtuemart_customs table using virtuemart_vendor_id. See the query used by RO CSVI


SELECT virtuemart_custom_id FROM `#__virtuemart_customs` WHERE 'virtuemart_vendor_id' = 0 AND 'field_type' = 'R'
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 16
Accepted Answer Pending Moderation
OK, I understand but hypothetically speaking you can have multi-vendor shop with several vendor IDs and related products import function will work only for the one who has id = 0.
I am aware that multi-vendor shop is something rare to happen to you but chances still exists.
So, why do you use:

WHERE 'virtuemart_vendor_id' = 0

Why selecting vendor ID is important for related products and not for other type of custom attributes?
I am not really convinced that this cannot be flagged as a bug.
I have checked my other websites and all of them have vendor_id = 1, although all of them are installed from same template creators.
  1. more than a month ago
  2. RO CSVI
  3. # 17
Accepted Answer Pending Moderation
Dear Tharuna,

Yes, this patch works perfect. Thank you very much for this.
I hope it will help others with same issue.

Kind regards,
Nebojsa
  1. more than a month ago
  2. RO CSVI
  3. # 18
Accepted Answer Pending Moderation
Hello Nebojsa,
Thank you for confirming the patch is working. This fix will be included in our upcoming RO CSVI release.
Kind regards,

Tharuna

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


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