Magneto 2: How to remove duplicate sku with images in each rows of CSVMySQL error and possible duplicates running bin/magento setup:upgrade after renaming moduleCan't remove or hide product images with CSV importAdd store_id to custom table Magento 2.2Custom dropdown attribute magento 2How to import Configurable product from csv with custom attributes using php scriptDeleting Duplicate Product ImagesMagento2: custom script for category product sort order positionload data into dynamic rows from database on edit actionMagento2 How to update product position (number) in specific category by custom script with csvInsert multiple records to multiple custom tables through install script in magento2

Confused by notation of atomic number Z and mass number A on periodic table of elements

Do I have to worry about players making “bad” choices on level up?

Past Perfect Tense

Help, my Death Star suffers from Kessler syndrome!

Do I have an "anti-research" personality?

Find the coordinate of two line segments that are perpendicular

Can a creature tell when it has been affected by a Divination wizard's Portent?

Python "triplet" dictionary?

Examples of non trivial equivalence relations , I mean equivalence relations without the expression " same ... as" in their definition?

Sci-fi novel series with instant travel between planets through gates. A river runs through the gates

How to stop co-workers from teasing me because I know Russian?

Cannot populate data in lightning data table

Why do TACANs not have a symbol for compulsory reporting?

Are Boeing 737-800’s grounded?

What's the polite way to say "I need to urinate"?

Minimum value of 4 digit number divided by sum of its digits

Why is the origin of “threshold” uncertain?

Does a creature that is immune to a condition still make a saving throw?

When India mathematicians did know Euclid's Elements?

When and why did journal article titles become descriptive, rather than creatively allusive?

Confusion about capacitors

Why does Bran Stark feel that Jon Snow "needs to know" about his lineage?

Reverse the word in a string with the same order in javascript

Weird result in complex limit



Magneto 2: How to remove duplicate sku with images in each rows of CSV


MySQL error and possible duplicates running bin/magento setup:upgrade after renaming moduleCan't remove or hide product images with CSV importAdd store_id to custom table Magento 2.2Custom dropdown attribute magento 2How to import Configurable product from csv with custom attributes using php scriptDeleting Duplicate Product ImagesMagento2: custom script for category product sort order positionload data into dynamic rows from database on edit actionMagento2 How to update product position (number) in specific category by custom script with csvInsert multiple records to multiple custom tables through install script in magento2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am using magento2x. I need to create custom script for removing duplicate sku's with images with multiple entries of sku's in each rows of csv.if anyone know reply me.










share|improve this question






























    0















    I am using magento2x. I need to create custom script for removing duplicate sku's with images with multiple entries of sku's in each rows of csv.if anyone know reply me.










    share|improve this question


























      0












      0








      0








      I am using magento2x. I need to create custom script for removing duplicate sku's with images with multiple entries of sku's in each rows of csv.if anyone know reply me.










      share|improve this question
















      I am using magento2x. I need to create custom script for removing duplicate sku's with images with multiple entries of sku's in each rows of csv.if anyone know reply me.







      magento2 custom script






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 25 at 12:47







      Rv Singh

















      asked Apr 25 at 12:43









      Rv SinghRv Singh

      738418




      738418




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I find out solutions:



          <?php 
          $csvFile = file('remove_duplicates.csv');
          $data = [];
          foreach($csvFileas$line)
          $data[ = str_getcsv($line);
          unset($data[0]);



          foreach ($data as $key => $value)
          $skuArray[] = $value[0];
          $mediaImgs[$value[0]][] = $value[1];


          $uniqueSkus = array_unique($skuArray);
          $uniqueSkus = array_values($uniqueSkus);


          $fp = fopen("remove_duplicate_imgs.csv","w");
          fputcsv($fp, array('sku', 'M1 Media Images'));

          foreach ($mediaImgs as $skuArray => $imgs)
          $data = array();
          $imagesImploaded = implode(",", $imgs);

          $data[] = $skuArray;
          $data[] = $imagesImploaded;
          fputcsv($fp, $data);

          header("Content-type: text/csv");
          header("Content-disposition: attachment; filename = remove_duplicate_imgs.csv");
          readfile("remove_duplicate_imgs.csv");
          fclose($fp);





          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272444%2fmagneto-2-how-to-remove-duplicate-sku-with-images-in-each-rows-of-csv%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I find out solutions:



            <?php 
            $csvFile = file('remove_duplicates.csv');
            $data = [];
            foreach($csvFileas$line)
            $data[ = str_getcsv($line);
            unset($data[0]);



            foreach ($data as $key => $value)
            $skuArray[] = $value[0];
            $mediaImgs[$value[0]][] = $value[1];


            $uniqueSkus = array_unique($skuArray);
            $uniqueSkus = array_values($uniqueSkus);


            $fp = fopen("remove_duplicate_imgs.csv","w");
            fputcsv($fp, array('sku', 'M1 Media Images'));

            foreach ($mediaImgs as $skuArray => $imgs)
            $data = array();
            $imagesImploaded = implode(",", $imgs);

            $data[] = $skuArray;
            $data[] = $imagesImploaded;
            fputcsv($fp, $data);

            header("Content-type: text/csv");
            header("Content-disposition: attachment; filename = remove_duplicate_imgs.csv");
            readfile("remove_duplicate_imgs.csv");
            fclose($fp);





            share|improve this answer



























              0














              I find out solutions:



              <?php 
              $csvFile = file('remove_duplicates.csv');
              $data = [];
              foreach($csvFileas$line)
              $data[ = str_getcsv($line);
              unset($data[0]);



              foreach ($data as $key => $value)
              $skuArray[] = $value[0];
              $mediaImgs[$value[0]][] = $value[1];


              $uniqueSkus = array_unique($skuArray);
              $uniqueSkus = array_values($uniqueSkus);


              $fp = fopen("remove_duplicate_imgs.csv","w");
              fputcsv($fp, array('sku', 'M1 Media Images'));

              foreach ($mediaImgs as $skuArray => $imgs)
              $data = array();
              $imagesImploaded = implode(",", $imgs);

              $data[] = $skuArray;
              $data[] = $imagesImploaded;
              fputcsv($fp, $data);

              header("Content-type: text/csv");
              header("Content-disposition: attachment; filename = remove_duplicate_imgs.csv");
              readfile("remove_duplicate_imgs.csv");
              fclose($fp);





              share|improve this answer

























                0












                0








                0







                I find out solutions:



                <?php 
                $csvFile = file('remove_duplicates.csv');
                $data = [];
                foreach($csvFileas$line)
                $data[ = str_getcsv($line);
                unset($data[0]);



                foreach ($data as $key => $value)
                $skuArray[] = $value[0];
                $mediaImgs[$value[0]][] = $value[1];


                $uniqueSkus = array_unique($skuArray);
                $uniqueSkus = array_values($uniqueSkus);


                $fp = fopen("remove_duplicate_imgs.csv","w");
                fputcsv($fp, array('sku', 'M1 Media Images'));

                foreach ($mediaImgs as $skuArray => $imgs)
                $data = array();
                $imagesImploaded = implode(",", $imgs);

                $data[] = $skuArray;
                $data[] = $imagesImploaded;
                fputcsv($fp, $data);

                header("Content-type: text/csv");
                header("Content-disposition: attachment; filename = remove_duplicate_imgs.csv");
                readfile("remove_duplicate_imgs.csv");
                fclose($fp);





                share|improve this answer













                I find out solutions:



                <?php 
                $csvFile = file('remove_duplicates.csv');
                $data = [];
                foreach($csvFileas$line)
                $data[ = str_getcsv($line);
                unset($data[0]);



                foreach ($data as $key => $value)
                $skuArray[] = $value[0];
                $mediaImgs[$value[0]][] = $value[1];


                $uniqueSkus = array_unique($skuArray);
                $uniqueSkus = array_values($uniqueSkus);


                $fp = fopen("remove_duplicate_imgs.csv","w");
                fputcsv($fp, array('sku', 'M1 Media Images'));

                foreach ($mediaImgs as $skuArray => $imgs)
                $data = array();
                $imagesImploaded = implode(",", $imgs);

                $data[] = $skuArray;
                $data[] = $imagesImploaded;
                fputcsv($fp, $data);

                header("Content-type: text/csv");
                header("Content-disposition: attachment; filename = remove_duplicate_imgs.csv");
                readfile("remove_duplicate_imgs.csv");
                fclose($fp);






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 25 at 12:47









                Rv SinghRv Singh

                738418




                738418



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272444%2fmagneto-2-how-to-remove-duplicate-sku-with-images-in-each-rows-of-csv%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                    Log in Navigation menu

                    Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing