1. zagorix
  2. RO CSVI
  3. Monday, 27 February 2017
  4.  Subscribe via email
Hi,
I use Csvi Improved to import in Virtuemart csv files exported from AS400, congratulations for the extraordinary work and fantastic component.
I have a little problem that I think can be solved by applying a rule.

In case of negative storage products As400 in product_in_stock field exports numbers with a minus sign "-" at the end (eg. 100- means that the stock is -100 pcs).
I want to import these values ​​in virtuemart product_in_stock as 0 (zero), at the moment they are imported as a positive value.
When a stock is negative on the csv file to import, in Virtuemart must be 0.

I think the plugin CSVI Replace can help me to solve this problem, I don't know how to set up the regex and find and replace fields in the rule to apply to product_in_stock field.

Thank you in advance for your support,
regards,
Alessandro.
Accepted Answer Pending Moderation
Hello Alessandro,
The attached image with regex rule should help you to replace the any number ending with - to 0. You need to add a rule using CSVI multireplace plugin and apply it on product_in_stock field. Try the rule and see if it helps.

findandreplace.png
Attachments (1)
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
Hi Tharuna,
thank you very much for your help. I had an old version of CSVI Improved (6.6.4), so I updated to new 7.1.0 to use multireplace plugin.
I uninstalled Csvi improved (6.6.4) and its addons, I installed the new version (7.1.0) and plg_csviaddon_virtuemart_csvi_7.1.0.zip.
Unfortunately I have some probles with template fields so I cannot try your solution.
I found my old templates with no fields assigned. When I try to add a field to a template nothing happens.

Best regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello Alessandro,
Did your update from CSVI 6.6.4 to 7.1.0 version had errors? Not sure why you had to uninstall CSVI and its addons to install a new version. Regarding the template fields, this could be something related to a missing field in #__csvi_templatefields table. The post discussing this issue is here. Can you check if the solution helps you?
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
Hello Tharuna,
also in my database there is no source_field in #__csvi_templatefields table, how can I fix it?
Thank you again for your precious support,
regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Hello,
Can you try to run the below query from your phpMyAdmin? Go to your phpMyAdmin >> select your database >> on SQL tab, copy the below query and click Go. Don't forget to replace #__ with your table prefix.

ALTER TABLE `#__csvi_templatefields`
ADD COLUMN `source_field` VARCHAR(255) NOT NULL COMMENT 'Field name of the source table' AFTER `xml_node`;
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. # 5
Accepted Answer Pending Moderation
Hi Taruna,
perfect! All works fine!
I have another little issue with thousand and decimal separators for product_in_stock field.
In my original csv thousand separator is a point, decimals are separated by a comma (eg 4.021,00).
After import Virtuemart displays 4 pieces in stock, can you please help me with multiple replace plugin to solve also this last issue?

Thank you for you support and your patience,
regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Hello,
The field product_in_stock in VirtueMart table takes only integers and so importing 4.021,00 has ignored all digits after decimal point. Instead of creating one more rule, you can edit the rule created for making 100- to 0, add another set of Find and replace in the same rule. Click on + button on the right side of the first set of rules to get next set of replacements. In the Find field use . and let replace field to be empty, leave other fields as it is and save the rule. You can then try to run the 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. # 7
Accepted Answer Pending Moderation
Hi Tharuna,

when in csv imput file quantity_in_stock is a number like -5 , 5- , -180.22 , 5.000- all works fine.

When quantity is 188.122,000 -, the value imported is 188122 .
When quantity is 5,000- , the value imported is 5 .

I think is shoud be a problem in the field find of rule: /[0-9\-]+$/
I tried to solve by myself, but I regex expressions are impossible for me.

Thank you for your help,
regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 8
Accepted Answer Pending Moderation
Hello Alessandro,
I tried to solve by myself, but I regex expressions are impossible for me.

Neither i am an expert with regex but looking at the values . and , are been ignored while searching for value. You can try adding these characters to the regex so the regex now becomes /[0-9.,\-]+$/. See if import works after this.
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
Accepted Answer Pending Moderation
Hi Tharuna,
now it is perfect, all quantities imported as 0.
Thank you very much, for your help and your patience with me.

Best regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 10
Accepted Answer Pending Moderation
Hello Alessandro,
Glad to know that your issue has been solved. Would appreciate if you can give us a review on Joomla extension directory.
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. # 11
Accepted Answer Pending Moderation
Hi Tharuna,
it me again, I was too hasty, now all the quantities are imported as 0.

It is not what I wanted, in the evening I try to do new tests.
I think I will have to study regex :)!

Anyway I will give you a positive review on JED.

Best regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 12
Accepted Answer Pending Moderation
Hello Alessandro,
it me again, I was too hasty, now all the quantities are imported as 0.

It is not what I wanted, in the evening I try to do new tests.

I modified regex a bit, can you try /[0-9.,]+-$/ regex? This should strictly act on values which ends with - and not on all. Let me know if it helps.

Anyway I will give you a positive review on JED.

Thank you so much.
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. # 13
Accepted Answer Pending Moderation
Hi Tharuna,
I tested and this one seems to be the right one, in the evening I will try again.
Thank you,
best regards,
Alessandro.
  1. more than a month ago
  2. RO CSVI
  3. # 14
  • Page :
  • 1


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