Mass action: Issue and requirement

  • Posts: 205
  • Thank you received: 12
3 years 8 months ago #331631

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.4.14

Hello

I am trying to set a Mass action for updating the products quantity with values taken from a csv. Unfortunately i am stack to a...

20 Joomla\CMS\Filesystem\Path::check() - Snooping out of bounds @ https:/my_domain.com/new/tmp/Elecreonics_1_test_1_csv2.csv

The csv file exists and it is accessible if called from browser.

issue when i click on "Verify the file" button. (Please check screenshot)



Our goal is to update only the stock value of the products from the csv. Here we also need some help as we can not find any documentation anywhere. Everything we find either does not contain a solution or is general about the csv import.

Please advise about the settings of the Mass action in order to periodicaly update the values of product_quantity column.

Thank you.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
3 years 8 months ago #331639

Hi,

That means that there is an error in the CSV file. I can't say what though. Could you provide a copy of that file ?

Please Log in or Create an account to join the conversation.

  • Posts: 205
  • Thank you received: 12
3 years 8 months ago #331661

Yes Nicolas you are right!

It was not a csv problem but a problem with the csv path that we were writing like... http://...

When we changed it to /home/account/.../csv_file.csv everything worked fine. So here comes another question now.

If the csv file is online at the server of our provider, how can we set the Mass Action to get the data from the csv? How can we use a file location like... https://url_of_provider.com/csv_file.csv?

Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
3 years 8 months ago #331667

Hi,

The CSv import in the mass actions system doesn't support getting files from URLs, only local files.

What you could do is create a small PHP file with such content:

<?php
    // set url "http://
           curl_setopt($ch, CURLOPT_URL, "<your url>"); 

          //return the transfer as a string 
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

         // $output contains the output string 
         $output = curl_exec($ch); 

         // close curl resource to free up system resources 
          curl_close($ch); 

    file_put_contents($output,"<file>";
    ?>
and then, you could run that file periodically with a cron (from your hosting or a service like that: cron-job.org/en/ ) so that your PHP file would periodically download the external file from your URL to your local server so that the mass action would be able to use the new version of the file.

The following user(s) said Thank You: liaskas

Please Log in or Create an account to join the conversation.

  • Posts: 205
  • Thank you received: 12
3 years 8 months ago #331685

Thank you Nicolas!

This is exactly what we need. We will test it soon.

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum