示例#1
0
 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();
 }
示例#2
0
 public function getEventPrice($event_id, $startDate)
 {
     $this->event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $event_id]))->getItem();
     $this->venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $this->event->venue_id]))->getItem();
     $this->getState()->set('event.rrule', Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem());
     $daysinbilling = $this->getNumDates(strftime('%Y%m%dT115959Z', $startDate), strftime('%Y%m%dT115959Z', strtotime('+30 days', $startDate)));
     $total = $daysinbilling * $this->getState()->get('pricing')->unit_price;
     return $total;
 }
示例#3
0
 /**
  * @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);
 }
示例#4
0
 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);
 }
示例#5
0
 private function setStartDateOptions()
 {
     $this->event_id = JFactory::$application->input->get('event_id');
     $this->event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $this->event_id]))->getItem();
     //get the event.rrule and calculate start dates for 30 days.
     //get the next viable date.
     //get the dates
     $firstDate = new \DateTime();
     $firstDateThirty = new \DateTime(strftime('%Y%m%d', strtotime('+30days')));
     /** @var Sp4kAppsRruleItem $rrule */
     $rrule = Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem();
     $dateStartCollection = $rrule->getDatesBetween($firstDate, $firstDateThirty);
     $dateStartCollection = $dateStartCollection->toArray();
     foreach ($dateStartCollection as $dateStartCollectionItem) {
         /** @var DateTime $startDateObject */
         $startDateObject = $dateStartCollectionItem->getStart();
         $this->dateStartOptions[] = $startDateObject->getTimeStamp();
     }
 }
示例#6
0
 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());
 }
示例#7
0
 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();
 }
示例#8
0
 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;
 }