1. Picannick
  2. RO CSVI
  3. Sunday, 26 March 2023
  4.  Subscribe via email
I tried to limit the exported products based on conditions but was not able to manage it with the given settings.
So I made an override like it was explained here: https://rolandd.com/documentation/ro-csvi/override-import-export-routines

And I added the following line to exclude empty products (since VM doesn't change the in_stock number if a product has been ordered and the product is empty if the number ordered matches the number in stock.)

$query->where('#__virtuemart_products.product_in_stock > #__virtuemart_products.product_ordered');

This works fine.
And then I wanted to exclud all products, that are not available yet, so the product_available_date is in the future.

I tried the following:
$query->where('#__virtuemart_products.product_available_date > ' . date('YYYY-mm-dd')); -> all products are exported
and
$query->where('#__virtuemart_products.product_available_date > ' . date('YYYY-mm-dd 00:00:00')); -> gives back a sql error

How can I make this work? I'm sorry, but my knowledge of SQL is not that good.

It would be really nice to be able to exclude products based on conditions in the settings without making an override.

Thank you very much for your great component, the use is really intuitive. I appreciate.

Kind regards,
Tanja
Accepted Answer
Accepted Answer Pending Moderation
Hello Tanja,
I tried the following:
$query->where('#__virtuemart_products.product_available_date > ' . date('YYYY-mm-dd')); -> all products are exported
and
$query->where('#__virtuemart_products.product_available_date > ' . date('YYYY-mm-dd 00:00:00')); -> gives back a sql error

How can I make this work? I'm sorry, but my knowledge of SQL is not that good.

Try the below code and see if query works as expected.



$jdate = Factory::getDate('now', 'UTC');
$currentDate = $this->db->quote($jdate->format('Y-m-d'));
$query->where('#__virtuemart_products.product_available_date > ' . $currentDate;


It would be really nice to be able to exclude products based on conditions in the settings without making an override.

You can write your own query using Custom SQL export operation in RO CSVI. See attached screenshot. This way you can add all needed condition to the query without an override. But you need to write the whole of product export query here to run export like VirtueMart product export operation. You can copy the query from VirtueMart product export debug log and use it in this template.

Thank you very much for your great component, the use is really intuitive. I appreciate.

Thank you for your feedback. Would appreciate if you can post a review on Joomla Extension Directory.
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. # Permalink
Sorry, the discussion is currently locked. You will not be able to post a reply or a comment at the moment.