1. RBoldt
  2. RO CSVI
  3. Monday, 10 July 2017
  4.  Subscribe via email
Hi,

I have a problem importing prices for default shopper groups of VirtueMart.

My scenario:
I export prices with empty column for the new prices. The shopper group column of the export file contains the translated strings for the default shopper groups. Then I fill the empty column with the new prices and import the file. Now I get an additional price for all, which did not exists previously. The further prices for this article are mixed up and are not assigned correctly to the remaining shopper groups. If I only import prices for self-created shopper groups, all works as expected. If I rename the translated string in the CSV file with the string variable, i.e. COM_VIRTUEMART_SHOPPERGROUP_DEFAULT, it works as expected.

As workaround I could rename the string variable with the translated string. Another workaround is not to use default shopper groups. Is there also a solution to not have to use these workarounds?

Kind regards
Romana
Accepted Answer Pending Moderation
Hello Romana,
I export prices with empty column for the new prices. The shopper group column of the export file contains the translated strings for the default shopper groups. Then I fill the empty column with the new prices and import the file. Now I get an additional price for all, which did not exists previously.

To update a price you need to have a column product_price_new in your import file with your new price and there are some required fields CSVI needs to find the matching price row in the database. This is explained in VirtueMart price import document with examples.

The further prices for this article are mixed up and are not assigned correctly to the remaining shopper groups. If I only import prices for self-created shopper groups, all works as expected. If I rename the translated string in the CSV file with the string variable, i.e. COM_VIRTUEMART_SHOPPERGROUP_DEFAULT, it works as expected.

As workaround I could rename the string variable with the translated string. Another workaround is not to use default shopper groups. Is there also a solution to not have to use these workarounds?

The problem is VirtueMart stores shoppergroup names as translated string in database tables so when finding for matching price CSVI checks for values as stored in database which makes COM_VIRTUEMART_SHOPPERGROUP_DEFAULT work. You can check this in #___virtuemart_shoppergroups table in your database. If you don't want to use these language strings then you can change these strings in your tables and use then them in import file.
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. # 1
Accepted Answer Pending Moderation
Hello tharuna,

To update a price you need to have a column product_price_new in your import file with your new price and there are some required fields CSVI needs to find the matching price row in the database. This is explained in VirtueMart price import document with examples.

Yes, I know and that works well as I have written.
The problem is VirtueMart stores shoppergroup names as translated string in database tables so when finding for matching price CSVI checks for values as stored in database which makes COM_VIRTUEMART_SHOPPERGROUP_DEFAULT work. You can check this in #___virtuemart_shoppergroups table in your database. If you don't want to use these language strings then you can change these strings in your tables and use then them in import file.

For a shop with only one language this is a workaround, but what is the solution for multi-language shops?
The problem here is, that the export of CSVI translates the language strings, but the import does not. I export prices with all needed columns plus a separate empty column for the new price and here the translation of the language string while export disturbs an easy flow on multi-language shops.
Kind regards
Romana
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello Romana,
I understand on the issue with translated strings. We cannot translate the language strings on import as the price row is selected by comparing the exact values from import file with the database. You can remove the language translation on export by going to /plugins/caviaddon/virtuemart/com_virtuemart/model/export/price.php and look for line case 'shopper_group_name': around line number 335, remove line $fieldValue = \JText::_($fieldValue); at line 342 and save the file. Run the export and then the import. This would solve your issue.

I would suggest you to make this change by creating an override file for export so you don't miss these changes with future updates of CSVI.
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. # 3
Accepted Answer Pending Moderation
Hi tharuna,

I'm sure this will solve my problem. Thank You very much.

What about using virtuemart_shoppergroup_id for identifying instead of shopper_group_name? This would not lead to a virtuemart_shoppergroup_id=0 at the query for translated language strings and there will be no need for an override file. For better UX one can also export shopper_group_name…

Just my 5 Cents.

Thanks a lot and kind regards
Romana
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
As a side note:

While editing the fist entry of this thread to mark it solved, I got an error 503 while submitting. The error page shows the version of Apache, SSL and some other modules. I think, showing versions is not really wanted/secure…

Best regards
Romana
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
Hello Romana,
Glad to know that your issue is solved. As of virtuemart_shoppergroup_id, we don't want users to play with any of _id fields as they are the primary key fields of database tables. These id fields are handled internally in CSVI code, for example virtuemart_shoppergroup_id is retrieved by using shopper_group_name provided by user.

As a side note:

While editing the fist entry of this thread to mark it solved, I got an error 503 while submitting. The error page shows the version of Apache, SSL and some other modules. I think, showing versions is not really wanted/secure…

Thank you so much. We will look into it.
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
Hello Romana,

I do want to comment on your question for using the virtuemart_shoppergroup_id. You can actually use this field as well but as Tharuna said we do not encourage using it. However we don't prevent you from using it, so you can use the virtuemart_shoppergroup_id field if you want to.
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. # 7
Accepted Answer Pending Moderation
Hello rolandd and tharuna,

the aspect, that a user is able to handle with the ID is a point I can not argue against.

In my own little world here this is not the point, but for clients the solution with override is the way far more secure, I see.

Best regards
Romana
  1. more than a month ago
  2. RO CSVI
  3. # 8
  • Page :
  • 1


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