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 How can I get page property after page is loaded. public function onProductListBack(){ return $this->property('thanksMessage'); }

not working. also with page. need to get page property with ajax after page is loaded. tried to put into session. without luck. please help!!! thanks

pratyushpundir6424
pratyushpundir6424

$this->property('some-property') is what you would use inside your plugin controller to access the plugin properties. But if you need to access a page property, you might want to read more on what is available here http://octobercms.com/docs/markup/this-page.

If you could share some code, it might be easier to help.

AlexeiKo
AlexeiKo

Hey, I need to access from COMPONENT not the plugin. And i need to get the custom msg no the property itself. for some reason it not taking it.

<?php namespace Bbrand\Shop\Components;

use Cms\Classes\ComponentBase; use Jiri\JKShop\Components\Basket; use Jiri\JKShop\Models\Settings; use Session; use Event;

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

public function defineProperties()
{
    return [];
}

// public function onRun(){

//     return $this->page['idElementWrapperBasketComponent'];

// }

public function onProductListBack(){
    $temp = new Basket;
    $emp = Basket::property('idElementWrapperBasketComponent');
    $data = [];
    $data["basket"] = Basket::getSessionBasket();
    $data["jkshopSetting"] = Settings::instance();
    $contentback = Session::get('showID');
    return [ 
        $emp => $this->renderPartial('product_list', $data) 
    ];

}

} this will work, but since it makes new instance of the class it will take only the default value of id i need.

I need to get [myBasket basket] idElementTotalCartPrice = "#jkshop-total-basket" idElementWrapperBasketComponent = ".popup-content" productPage = "main"

from layout this custom id. (".popup-content")

Thanks

pratyushpundir6424
pratyushpundir6424

You should add something like a "welcomeMsg" property in the defineProperties() method. The syntax to follow is here http://octobercms.com/docs/plugin/components#component-properties

Then in your handler method onProductListBack() you can access the property like this: $this->property('wecomeMsg');

Hope this helps.

AlexeiKo
AlexeiKo

this is like welcome msg idElementWrapperBasketComponent = ".popup-content"

but i cannot get access to it ( from COMPONENT using ajax. since this is rendered once and dies. i want to put it into session.

1-5 of 5

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