1. eliotrayner
  2. RO CSVI
  3. Wednesday, 17 November 2021
  4.  Subscribe via email
Hi Support

I am trying to skip writeOutput for some records with a particular customfields4all value.

I created an override of the virtuemart product export using /csviaddon/virtuemart/com_virtuemart/model/export/product.php

Then added the following code


if ($field->column_header == 'column_name' && $fieldValue == 'value_searching_for') {
$export_line = false;
}


after the following around line 1959


// Store the field value
$this->fields->set($field->csvi_templatefield_id, $fieldValue);


Then I was hoping I could just skip the writeOutput by adding the following at the end of the foreach ($records as $record) loop:


if ($export_line) {
// Output the contents
$this->writeOutput();
}


However this doesn't work as I believe I need to replace the $contents in class CsviModelExports or/and add in "\r\n"

How do I do that?

regards
Eliot
Accepted Answer
Accepted Answer Pending Moderation
Hi Tharuna

I worked it out. Just need to enter '/^\s*$/' without enclosing single quotes,

regards
Eliot
Accepted Answer Pending Moderation
Hello Eliot,
Why not use RO CSVI Skip rule instead of override? You could have used the skip rule skip a record on export based on a particular customfields4all value. Did you try that?
Kind regards,

Tharuna

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

I didnt think of that.

What do I enter in 'Values to match' if I want to skip rows where customfields4all fieldname 'party' is blank/empty?

regards
Eliot
  1. 2 weeks ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello Eliot,
Glad to know your issue is fixed with RO CSVI Skip rule. Easy way instead of writing all that override code:D
Kind regards,

Tharuna

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


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