This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

AlexeiKo
AlexeiKo

Hey, I made extended component and trying to use it's properties But i'm getting properties only of the child, and not its fathers properties. What i'm doing wrong? chilid:

class Shopextend extends Basket {

public function componentDetails()
{
    return [
        'name'        => 'Products By Category',
        'description' => 'Display list of products by category'
    ];
}

public function defineProperties()
{
    return [
        'myWrapper' => [
            'title'       => 'Wrapper for content',
            'description' => 'Wrapper for rendered content',
            'default'     => '.popup-content',
            'type'        => 'string'
        ],
    ];
}

father:

class Basket extends ComponentBase {

public function componentDetails()
{
    return [
        'name'        => 'Basket',
        'description' => 'All operation from add to basket to finish order'
    ];
}

public function defineProperties()
{
    return [
        'idElementTotalCartPrice' => [
            'title'       => 'ID Element Total Cart Price',
            'description' => 'This Element will be refresh after ajax call - add product, etc..  (start with #)',
            'default'     => '#jkshop-total-basket',
            'type'        => 'string'
        ],
        'idElementWrapperBasketComponent' => [
            'title'       => 'ID Element Wrapper Basket Component',
            'description' => 'This Element will be refresh after ajax call - change quantity, etc..  (start with #)',
            'default'     => '#jkshop-basket-component-wrapper',
            'type'        => 'string'
        ],
        'productPage' => [
            'title'       => 'Product page',
            'description' => 'Product detail page',
            'type'        => 'dropdown',
            'default'     => 'product',
            'group'       => 'Links',
        ],               
    ];
}

getting only one property. Please advice. Thanks

Last updated

AlexeiKo
AlexeiKo

public function defineProperties() { $parentProps = parent::defineProperties(); $properties = array_merge( $parentProps, [ 'myWrapper' => [ 'title' => 'Wrapper for content', 'description' => 'Wrapper for rendered content', 'default' => '.popup-content', 'type' => 'string' ],
] );

    return is_array($properties) ? $properties : $parentProps;
}

this extedns properties, but parent is dead now. now returning any data now if i change extends Basket to componentBase it back ((

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.