Jump to content

Bug: moving pages with children will make them not findable


Recommended Posts

Posted
I found a nasty bug when moving pages in the page tree in the admin.
 
I have a setup where I have created a new category page and moved all the product pages on the same level into the newly created category. But then the find() I used to get all products from a parent above the category page fails. The product pages have children, which seems to be the key to reproduce this. I also have multilanguage installed but I don't think that does anything. I tried and was abel to reproduce this in my local test install with complete unreleated templates or fields.
 
This is the on second level
...
 
/shop/
    /category1/ 
        /newparentpage/
        /product1/ (product template)
             /product-var1/
        /product2/ (product template)
             /product-var1/
 
When I move "product1" and "product2" inside the "newparentpage"
 
/shop/
    /category1/ 
        /newparentpage/
            /product1/
            /product2/
 
 
I can't use following to get all products under "category1"
$pages->find("has_parent=category1, template=product"); // returns nothing

$pages->get("/shop/category1/")->find("template=product"); // returns nothing

$pages->find("has_parent=category1_ID, template=product, include=all"); // returns nothing

This got me, as I never experiences something like this. The page tree works and also finding the product with

$pages->find("template=product"); // will find all still 

Also this doesn't happen if the moved product pages have no children. So there's something wrong with the page_parents table I guess, but haven't investigated futher as I'm in a hurry to finish the website. And always then such things happens. :D

  • Like 4
Posted

Thanks Soma, I was able to reproduce it here too. Can you try out the fix I posted to the dev branch? You'll have to undo the page move you did before, and move it back again in order to get it to rebuild its index. 

  • Like 6
Posted

Whow, that could really explain nearly all the trouble I had with find() in the past (where the source tree worked with find and the cloned trees worked not).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...