Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method Mage_Core_Helper_Data::unEscapeCSVData() #411

Open
Triyugi opened this issue Oct 12, 2017 · 5 comments
Open

Call to undefined method Mage_Core_Helper_Data::unEscapeCSVData() #411

Triyugi opened this issue Oct 12, 2017 · 5 comments

Comments

@Triyugi
Copy link

Triyugi commented Oct 12, 2017

I am getting following error:

Call to undefined method Mage_Core_Helper_Data::unEscapeCSVData() in /var/www/html/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Category.php on line 1276.

How it can be resolved. Is it related to SUPEE-7405?

@Triyugi
Copy link
Author

Triyugi commented Oct 12, 2017

This issue I was getting on Magento 1.9.2.2 because there is no unEscapeCSVData method in app/code/core/Mage/Core/Helper/Data.php.

Create a local Data.php and add two methods from Magento 1.9.2.4 as below:

     public function getEscapedCSVData(array $data)
     {
         if (Mage::getStoreConfigFlag(Mage_ImportExport_Model_Export_Adapter_Csv::CONFIG_ESCAPING_FLAG)) {
             foreach ($data as $key => $value) {
                 $value = (string)$value;
 
                 $firstLetter = substr($value, 0, 1);
                 if ($firstLetter !== false and in_array($firstLetter, array("=", "+", "-"))) {
                     $data[$key] = ' ' . $value;
                 }
             }
         }
         return $data;
     }
 
    
     public function unEscapeCSVData($data)
     {
         if (is_array($data) and Mage::getStoreConfigFlag(Mage_ImportExport_Model_Export_Adapter_Csv::CONFIG_ESCAPING_FLAG)) {
 
             foreach ($data as $key => $value) {
                 $value = (string)$value;
 
                 if (preg_match("/^ [=\-+]/", $value)) {
                     $data[$key] = ltrim($value);
                 }
             }
         }
         return $data;
     }

And then I have to define CONFIG_ESCAPING_FLAG in app/code/local/ImportExport/Model/Import/Adapter/Csv.php and in app/code/local/ImportExport/Model/Export/Adapter/Csv.php as below:

class Mage_ImportExport_Model_Export_Adapter_Csv extends Mage_ImportExport_Model_Export_Adapter_Abstract
{
const CONFIG_ESCAPING_FLAG = 'system/export_csv/escaping';

@Triyugi Triyugi closed this as completed Oct 12, 2017
@avstudnitz
Copy link
Owner

This is not resolved as it is only solved locally.

@avstudnitz avstudnitz reopened this Oct 12, 2017
@Triyugi
Copy link
Author

Triyugi commented Oct 12, 2017

@avstudnitz Then, what should I do?

@avstudnitz
Copy link
Owner

Either provide a pull request, or do nothing and wait until someone else provides a fix which can be included in the module.

@hostep
Copy link
Contributor

hostep commented Oct 15, 2017

@Triyugi: you are correct, it is related to SUPEE-7405.
The code was introduced in this PR: #278

Have you installed SUPEE-7405 on your Magento 1.9.2.2 installation? If not, then please install it, it should fix the problem (and please install all the other security patches as well which you might not have installed yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants