Coder Social home page Coder Social logo

Comments (4)

paales avatar paales commented on August 23, 2024

@Joost24 Can you post an example of the file you are trying to import?

from magento1-ho_import.

JoostWan avatar JoostWan commented on August 23, 2024

@paales Yes. Here is the import file from the supplies: http://www.speeltoys.nl/import.csv

The CSV has no header in it. We used the first product.

The import module create the following CSV from it: www.speeltoys.nl/import_products.csv

from magento1-ho_import.

paales avatar paales commented on August 23, 2024

Import file seems to be generated correctly? The Zend_Json class isn't used in Ho_Import, any ideas why it throws an error on that file?

from magento1-ho_import.

tdgroot avatar tdgroot commented on August 23, 2024

Today I encountered this problem as well. I fixed it by "solving" the problem in higher level of the process at Csv.php.

I ended up with the following:

    /**
     * Return the current element.
     *
     * @return mixed
     */
    public function current()
    {
        $current = array_combine(
            $this->_colNames,
            count($this->_currentRow) != $this->_colQuantity
                ? array_pad($this->_currentRow, $this->_colQuantity, '')
                : $this->_currentRow
        );
        $this->utf8_encode_deep($current);
        return $current;
    }

    /**
     * UTF-8 Encode string, array or object
     * Credits to: http://php.net/manual/en/function.utf8-encode.php#109965
     * @param $input
     */
    public function utf8_encode_deep(&$input)
    {
        if (is_string($input)) {
            $input = utf8_encode($input);
        } else if (is_array($input)) {
            foreach ($input as &$value) {
                $this->utf8_encode_deep($value);
            }

            unset($value);
        } else if (is_object($input)) {
            $vars = array_keys(get_object_vars($input));

            foreach ($vars as $var) {
                $this->utf8_encode_deep($input->$var);
            }
        }
    }

Let me know if someone found it helpful, or instead an inappropriate way to fix this.

from magento1-ho_import.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.