public function execute() { $this->state->set('plugins', false); $app = new Sp4kAppsProductApp(new Joomla\Registry\Registry($this->state->toObject())); $this->item = $app->getItem(); //$this->item->config = $this->item->config; }
protected function execute() { $this->state->set('plugins', $this->state->get('plugins', false)); $app = new Sp4kAppsProductApp(new Joomla\Registry\Registry($this->state->toObject())); $items = new Registry($app->getItems()); if ($this->state->get('nest', false)) { $this->items[] = (array) $this->create_tree($items->toArray()); } else { $this->items = $items->toArray(); } }
protected function load() { $this->event = $event = Sp4kAppsEventApp::getInstance(new Joomla\Registry\Registry(['id' => $this->getState()->get('event_id')]))->getItem(); $this->venue = $venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $event->venue_id]))->getItem(); //how to get venue modifiers? $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $event->product_id]))->getItem(); }
public function execute() { $unit_price = $this->_state->get('options.unit_price'); /** @var Sp4kAppsEventItem event */ $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $this->_state->get('product_id')]))->getItem(); $selectedDates = explode($this->_state->get('dates')); }
public function execute() { $unit_price = $this->_state->get('options.unit_price'); /** @var Sp4kAppsEventItem event */ $this->_product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $this->_state->get('product_id')]))->getItem(); $this->setNumDates(); $this->cost_now = $this->numDatesNow * $unit_price; $this->cost_next = $this->numDatesNext * $unit_price; }
/** * @param \Joomla\Registry\Registry | null $state * * @return \Sp4kAppsCartItem * */ public function getItemInstance(Joomla\Registry\Registry $state = null) { //figure out what kind of item first. $this->event = $event = Sp4kAppsEventApp::getInstance(new Joomla\Registry\Registry(['id' => $this->getState()->get('event_id')]))->getItem(); $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $event->product_id]))->getItem(); $pricing_type = json_decode($this->product->config)->booking->type; $cartPluginsEventPricingItemClassName = 'Sp4kAppsCartPluginsEventPlugins' . ucfirst($pricing_type); return new $cartPluginsEventPricingItemClassName($state); }
public function execute() { $filters = new stdClass(); if ($product_id = $this->state->get('product_id', false)) { $filters->product_id = $product_id; } if ($venue_id = $this->state->get('venue_id', false)) { $filters->venue_id = $venue_id; } if ($category_id = $this->state->get('vategory_id', false)) { $filters->category_id = $category_id; } $model = new Sp4kModulesEventModelsItems(new Joomla\Registry\Registry(['filters' => $filters])); $this->items = $model->items; foreach ($this->items as &$event) { $productApp = new Sp4kAppsProductApp(new Joomla\Registry\Registry(['id' => $event->product_id])); $venueApp = new Sp4kAppsVenueApp(new Joomla\Registry\Registry(['id' => $event->venue_id])); $event->product_title = $productApp->getItem()->title; $event->venue_title = $venueApp->getItem()->title; } }
protected function load() { $this->event = $event = Sp4kAppsEventApp::getInstance(new Joomla\Registry\Registry(['id' => $this->getState()->get('event_id')]))->getItem(); $this->venue = $venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $event->venue_id]))->getItem(); //how to get venue modifiers? $this->product = Sp4kAppsProductApp::getInstance(['id' => $event->product_id])->getItem(); $this->datestart = $this->getState()->get('datestart'); //get the rate based on the event venue and the product. $rate = Sp4kAppsCartPricingApp::getInstance(new Registry($this))->process(); $this->qty = $qty = count($this->getState()->get('children')); $this->lineTotal = $rate * $qty; // set the state to the table data so // that any empty variables in the incoming data are populated with table data. $this->getState()->loadArray(get_object_vars($this->_table), true); }
protected function bind() { $stateProperties = $this->getState()->toArray(); foreach (get_object_vars($this) as $index => $property) { //get the defined properties for this class. if (array_key_exists($index, $stateProperties)) { //if the state contains an index of the same name if (in_array($index, $this->_toJson) && is_string($stateProperties[$index])) { $stateProperties[$index] = (array) json_decode($stateProperties[$index]); } $this->{$index} = $stateProperties[$index]; //assign its value to this instance. } } if (isset($this->data['product_id'])) { $this->product = Sp4kAppsProductApp::getInstance(new Joomla\Registry\Registry(['id' => $this->data['product_id']]))->getItem(); } }
protected function execute() { if ($this->state->get('paging', false)) { $limit = $this->state->get('limit'); $filters = $this->state->get('filters'); $count = $this->state->get('count', false); $appState = new Joomla\Registry\Registry(['limit' => $limit, 'count' => $count, 'filters' => $filters]); /** @var Sp4kAppsSubscriptionApp $registrationApp */ $app = Sp4kAppsSubscriptionApp::getInstance($appState); $appCollection = $app->getCollection(); $this->count = $appCollection->count; $this->items = $appCollection->items; foreach ($this->items as $item) { $item->child = Sp4kAppsChildApp::getInstance(new Registry(['id' => $item->child_id]))->getItem(); $item->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $item->product_id, 'plugins' => false]))->getItem(); } } else { $this->items = Sp4kAppsSubscriptionApp::getInstance(new Joomla\Registry\Registry($this->state->toObject()))->getItems(); } }
protected function load() { //the cart is in the session, or in state. //We start with getting the cart items, then enumerating them to get each cart item type, so we can process //it through its plugin. $this->product = Sp4kAppsProductApp::getInstance(new Joomla\Registry\Registry(['id' => $this->getState()->get('product_id')]))->getItem(); $config = $this->product->config; foreach (get_object_vars($config) as $index => $configopt) { $state = new Registry(['options' => $configopt]); $state->merge($this->getState()); $cartPluginClassName = 'Sp4kAppsCartPlugins' . ucfirst($index) . 'Plg'; if (class_exists($cartPluginClassName)) { $this->plugins[$index] = $cartPluginClassName::getInstance($state); } } //$this->plugins['summary'] = Sp4kAppsCartPluginsSummaryPlg::getInstance($this->getState()); $this->cart_key = md5($this->getState()->get('event_id') . '.' . $this->getState()->get('product_id') . '.' . $this->getState()->get('child_id')); // set the state to the table data so // that any empty variables in the incoming data are populated with table data. //$this->getState()->loadArray(get_object_vars($this->_table),true); }
public function getItem() { //the cart is in the session, or in state. //We start with getting the cart items, then enumerating them to get each cart item type, so we can process //it through its plugin. $cart = $this->getState()->toObject(); $this->event = $event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $this->getState()->get('event_id')]))->getItem(); $this->venue = $venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $event->venue_id]))->getItem(); //how to get venue modifiers? $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $event->product_id]))->getItem(); $this->datestart = $this->getState()->get('datestart'); //get the rate based on the event venue and the product. //$rate = Sp4kAppsCartPricingApp::getInstance( // new Registry($this) //)->process(); //$this->qty = $qty = count($this->getState()->get('children')); //$this->lineTotal = $rate * $qty; // set the state to the table data so // that any empty variables in the incoming data are populated with table data. //$this->getState()->loadArray(get_object_vars($this->_table),true); return $this->item = $this->getItemInstance($this->getState()); }
private function init() { $this->event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $this->getState()->get('event_id')]))->getItem(); $this->venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $this->event->venue_id]))->getItem(); $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => $this->event->product_id]))->getItem(); }
private function getType() { return Sp4kAppsProductApp::getInstance(new Registry(['id' => Sp4kAppsEventApp::getInstance(new Registry(['id' => $this->state->get('event_id')]))->getItem()->product_id]))->getItem()->pricing->type; }
public function load() { parent::load(); $this->child = Sp4kAppsChildApp::getInstance(new Registry(['id' => (int) $this->getState()->get('child_id')]))->getItem(); $this->product = Sp4kAppsProductApp::getInstance(new Registry(['id' => (int) $this->getState()->get('product_id')]))->getItem(); }
/** * Show the child products for the selected venue */ private function setVenueItems() { $this->products = Sp4kAppsProductApp::getInstance(new Registry(['filters' => ['parent_id' => (int) $this->state->get('id'), 'venue_id' => (int) $this->state->get('venue_id')]]))->getItems(); $this->layout = 'children'; }