Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1051249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:54:06+00:00 2026-05-16T16:54:06+00:00

Scenario: A new blank Magento with a category product and customer import with some

  • 0

Scenario:
A new blank Magento with a category product and customer import with some fixes to do.

Category structure:

Root
 L..Category_parent1 (0 products)
    L..Category_child1 (22)
    L..Category_child2 (34)
 L..Category_parent2 (0)
    L..Category_child1 (22)
    L..Category_child2 (34)
 L..Category_parent3 (0)
    L..Category_child1 (22)
    L..Category_child2 (0)
       L..Category_child2_child1 (22)
       L..Category_child2_child2 (34)
    L..Category_child3 (10)

I want to copy all products from a child category to its relative parent using a SQL query or a php script. (I don’t know if it’s possible to do this through the Magento admin).

Desired Result:

Root
 L..Category_parent1 (22 + 34 products)
    L..Category_child1 (22)
    L..Category_child2 (34)
 L..Category_parent2 (22 + 34)
    L..Category_child1 (22)
    L..Category_child2 (34)
 L..Category_parent3 (22 + 22 + 34 + 10)
    L..Category_child1 (22)
    L..Category_child2 (22 + 34)
       L..Category_child2_child1 (22)
       L..Category_child2_child2 (34)
    L..Category_child3 (10)

UPDATE!
Is there a way to do this only on show products?
See products in this way manteining relashionship with their own categories (simply do that in view layout in list…)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:54:07+00:00Added an answer on May 16, 2026 at 4:54 pm

    As a partial solution:

    insert into catalog_category_product_index (
        select cat.parent_id, prod.product_id, 1 
          from catalog_category_product_index prod, catalog_category_entity cat
          where prod.category_id = cat.entity_id and cat.level >= 1
    );
    

    This should select everything and bump it up a level (until we get to the root). A separate query would help the position column (currently hardcoded to 1). The big problem is, though, that your desired outcome actually bumps items more than one level, whereas this query only does one level. To really generalize properly, maybe drop this query into some code and repeat it starting at the lowest depth and move upwards.

    Hope that helps!

    Thanks,
    Joe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: Quite new to DI and Ninject but would love to master it so
Scenario: old legacy code in rpg have to consume data from a new web
Being new to OpenCL i would like to know if the following scenario is
I am new to RSpec and I have a test scenario in which I
I have a scenario where customers are asking to develop a new project on
I'm new to rails and cucumber and I'm trying to test the following scenario
I am new to Regexp. I am struck in writing regexp for below scenario.
I have a scenario where a value is declared as int[] rate = new
I have the following scenario, action in window Window A triggers new window to
I'm having trouble using the new async/await tools in c#. Here is my scenario:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.