public function getAncestors($include_parent = false)
    {
        $ancestors = ArrayList::create();
        $object    = $this->Categories()->first();

        if($object) {
            if($include_parent) $ancestors->push($object);

            while ($object = $object->getParent()) {
                $ancestors->push($object);
            }
        }

        $this->extend('updateAncestors', $ancestors, $include_parent);

        return $ancestors;
    }
public function getAncestors($include_parent = false)
    {
        $ancestors = ArrayList::create();
        $object    = $this->Categories()->first();

        if($object) {
            if($include_parent) $ancestors->push($object);

            while ($object = $object->getParent()) {
                $ancestors->push($object);
            }
        }

        $this->extend('updateAncestors', $ancestors, $include_parent);

        return $ancestors;
    }
public function getAncestors ( $ include_parent = false ) { $ ancestors = ArrayList :: create ( ) ; $ object = $ this -> Categories ( ) -> first ( ) ; if ( $ object ) { if ( $ include_parent ) $ ancestors -> push ( $ object ) ; while ( $ object = $ object -> getParent ( ) ) { $ ancestors -> push ( $ object ) ; } } $ this -> extend ( 'updateAncestors' , $ ancestors , $ include_parent ) ; return $ ancestors ; }
We use this to tap into the categories "isSection" setup,
essentially adding the product's first category to the list

@param $include_parent Include the direct parent of this product
@return ArrayList
We use this to tap into the categories isSection setup essentially adding the product s first category to the list