Beispiel #1
0
 /**
  * Displays item
  * @return void
  */
 function view($cachable = false, $urlparams = false)
 {
     $model = $this->getModel($this->get('suffix'));
     $model->getId();
     $row = $model->getItem();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         if (empty($row->enabled)) {
             $table = $model->getTable();
             $table->load($row->id);
             $table->enabled = 1;
             if ($table->save()) {
                 $redirect = "index.php?option=com_citruscart&view=" . $this->get('suffix') . "&task=view&id=" . $model->getId();
                 $redirect = JRoute::_($redirect, false);
                 $this->setRedirect($redirect);
                 return;
             }
         }
     } else {
         // Joomla! 1.5 code here
         if (empty($row->published)) {
             $table = $model->getTable();
             $table->load($row->id);
             $table->published = 1;
             if ($table->save()) {
                 $redirect = "index.php?option=com_citruscart&view=" . $this->get('suffix') . "&task=view&id=" . $model->getId();
                 $redirect = JRoute::_($redirect, false);
                 $this->setRedirect($redirect);
                 return;
             }
         }
     }
     parent::view($cachable, $urlparams);
 }
Beispiel #2
0
 /**
  * Displays item
  * @return void
  */
 function view($cachable = false, $urlparams = false)
 {
     Citruscart::load('CitruscartUrl', 'library.url');
     $model = $this->getModel($this->get('suffix'));
     $order = $model->getTable('orders');
     $order->load($model->getId());
     $orderitems = $order->getItems();
     $row = $model->getItem();
     // Get the shop country name
     $row->shop_country_name = "";
     $countryModel = JModelLegacy::getInstance('Countries', 'CitruscartModel');
     $countryModel->setId(Citruscart::getInstance()->get('shop_country'));
     $countryItem = $countryModel->getItem();
     if ($countryItem && Citruscart::getInstance()->get('shop_country')) {
         $row->shop_country_name = $countryItem->country_name;
     }
     // Get the shop zone name
     $row->shop_zone_name = "";
     $zoneModel = JModelLegacy::getInstance('Zones', 'CitruscartModel');
     $zoneModel->setId(Citruscart::getInstance()->get('shop_zone'));
     $zoneItem = $zoneModel->getItem();
     if ($zoneItem && Citruscart::getInstance()->get('shop_zone')) {
         $row->shop_zone_name = $zoneItem->zone_name;
     }
     //retrieve user information and make available to page
     if (!empty($row->user_id)) {
         //get the user information from jos_users and jos_Citruscart_userinfo
         $userModel = JModelLegacy::getInstance('Users', 'CitruscartModel');
         $userModel->setId($row->user_id);
         $userItem = $userModel->getItem();
         if ($userItem) {
             $row->userinfo = $userItem;
         }
     }
     $view = $this->getView('orders', 'html');
     $view->set('_controller', 'orders');
     $view->set('_view', 'orders');
     $view->setModel($model, true);
     $view->assign('state', $model->getState());
     $view->assign('row', $row);
     if ($this->getTask() == 'print') {
         $view->setLayout('print');
     } else {
         $view->setLayout('view');
     }
     $model->emptyState();
     $this->_setModelState();
     /* 		$surrounding = $model->getSurrounding( $model->getId() );
     		$view->assign( 'surrounding', $surrounding );
      */
     //START onDisplayOrderItem: trigger plugins for extra orderitem information
     if (!empty($orderitems)) {
         Citruscart::load('CitruscartHelperOrder', 'helpers.order');
         $onDisplayOrderItem = CitruscartHelperOrder::onDisplayOrderItems($orderitems);
         $view->assign('onDisplayOrderItem', $onDisplayOrderItem);
     }
     //END onDisplayOrderItem
     $config = Citruscart::getInstance();
     $show_tax = $config->get('display_prices_with_tax');
     $view->assign('show_tax', $show_tax);
     $view->assign('using_default_geozone', false);
     if ($show_tax) {
         $geozones = $order->getBillingGeoZones();
         if (empty($geozones)) {
             // use the default
             $view->assign('using_default_geozone', true);
             $table = JTable::getInstance('Geozones', 'CitruscartTable');
             $table->load(array('geozone_id' => $config->get('default_tax_geozone')));
             $geozones = array($table);
         }
         Citruscart::load("CitruscartHelperProduct", 'helpers.product');
         foreach ($orderitems as &$item) {
             $taxtotal = $item->orderitem_tax / $item->orderitem_quantity;
             $item->orderitem_price = $item->orderitem_price + floatval($item->orderitem_attributes_price) + $taxtotal;
             $item->orderitem_final_price = $item->orderitem_price * $item->orderitem_quantity;
             $order->order_subtotal += $taxtotal * $item->orderitem_quantity;
         }
     }
     $view->assign('order', $order);
     $view->setTask(true);
     parent::view($cachable, $urlparams);
 }