示例#1
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $state = $this->get('State');
     $items = $this->get('Items');
     $parent = $this->get('Parent');
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     if ($items === false) {
         return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
     }
     if ($parent == false) {
         return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
     }
     $params =& $state->params;
     $items = array($parent->id => $items);
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->maxLevelcat = $params->get('maxLevelcat', 1);
     $this->params =& $params;
     $this->parent =& $parent;
     $this->items =& $items;
     $this->configs =& $configs;
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('categories');
     return parent::display($tpl);
 }
示例#2
0
 function display($tpl = null)
 {
     $customer = new DigiComSiteHelperSession();
     $app = JFactory::getApplication();
     $input = $app->input;
     $item = $app->getMenu()->getItems('link', 'index.php?option=com_digicom&view=orders', true);
     $Itemid = isset($item->id) ? '&Itemid=' . $item->id : '';
     $return = base64_encode(JURI::getInstance()->toString());
     if ($customer->_customer->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . $Itemid, false));
         return true;
     }
     $order = $this->_models['order']->getOrder();
     if ($order->id < 1) {
         return JError::raiseError(404, JText::_('COM_DIGICOM_ORDER_NOT_FOUND'));
     } elseif ($order->userid != $customer->_customer->id) {
         return JError::raiseError(203, JText::_('COM_DIGICOM_ORDER_NOT_OWN'));
     }
     $this->assign("order", $order);
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $this->assign("configs", $configs);
     $customer = new DigiComSiteHelperSession();
     $this->assign("customer", $customer);
     $this->assign("Itemid", $Itemid);
     //print_r(json_decode($order->params));die;
     $layout = $input->get('layout', 'order');
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander($layout);
     parent::display($tpl);
 }
示例#3
0
 function display($tpl = null)
 {
     $uri = JFactory::getURI();
     $this->assign('action', $uri->root());
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('login');
     parent::display($tpl);
 }
示例#4
0
 function display($tpl = null)
 {
     $customer = new DigiComSiteHelperSession();
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     if ($customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $db = JFactory::getDBO();
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $this->askforbilling = $configs->get('askforbilling', 1);
     $this->askforcompany = $configs->get('askforcompany', 1);
     $country_option = DigiComSiteHelperDigiCom::get_country_options($customer->_customer, false, $configs);
     $lists['country_option'] = $country_option;
     $lists['customerlocation'] = DigiComSiteHelperDigiCom::get_store_province($customer->_customer, false);
     $sql = "select * from #__digicom_states where eumember='1'";
     $db->setQuery($sql);
     $eucs = $db->loadObjectList();
     $eu = array();
     foreach ($eucs as $euc) {
         $eu[] = $euc->country;
     }
     $this->assign("eu", $eu);
     $eulocated = isset($customer->country) && in_array($customer->country, $eu);
     $this->assign("eulocated", $eulocated);
     $cclasses = @explode("\n", $customer->taxclass);
     $data = $this->get('listCustomerClasses');
     $select = '<select name="taxclass" >';
     if (count($data) > 0) {
         foreach ($data as $i => $v) {
             $select .= '<option value="' . $v->id . '" ';
             if (in_array($v->id, $cclasses)) {
                 $select .= ' selected ';
             }
             $select .= ' > ' . $v->name . '</option>';
         }
     }
     $select .= '</select>';
     $lists['customer_class'] = $select;
     $this->assign("lists", $lists);
     $this->assign("customer", $customer);
     $this->assign("configs", $configs);
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('profile');
     parent::display($tpl);
 }
示例#5
0
 function display($tpl = null)
 {
     $customer = new DigiComSiteHelperSession();
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     if ($customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $orders = $this->get('listOrders');
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $database = JFactory::getDBO();
     $db = $database;
     $sql = "select params\n\t\t\t\tfrom #__modules\n\t\t\t\twhere `module`='mod_digicom_cart'";
     $db->setQuery($sql);
     $d = $db->loadResult();
     $d = explode("\n", $d);
     $categ_digicom = '';
     foreach ($d as $i => $v) {
         $x = explode("=", $v);
         if ($x[0] == "digicom_category") {
             $categ_digicom = $x[1];
             break;
         }
     }
     /* Get Cart items */
     $cart = JModelLegacy::getInstance('Cart', 'DigiComModel');
     $cartitems = $cart->getCartItems($customer, $configs);
     if ($categ_digicom != '') {
         $sql = "select id from #__digicom_categories where title like '" . $categ_digicom . "' or name like '" . $categ_digicom . "'";
         $database->setQuery($sql);
         $id = $database->loadResult();
         $cat_url = JRoute::_("index.php?option=com_digicom&view=categories&cid=" . $id . "&Itemid=" . $Itemid);
     } else {
         $cat_url = JRoute::_("index.php?option=com_digicom&view=categories&cid=0" . "&Itemid=" . $Itemid);
     }
     $this->assignRef('orders', $orders);
     $this->assign("configs", $configs);
     $this->assignRef('cartitems', $cartitems);
     $this->assign("caturl", $cat_url);
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('orders');
     parent::display($tpl);
 }
示例#6
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     $this->customer = new DigiComSiteHelperSession();
     if ($this->customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $this->items = $this->get('items');
     $this->configs = JComponentHelper::getComponent('com_digicom')->params;
     //print_r($items);die;
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('dashboard');
     parent::display($tpl);
 }
示例#7
0
 function display($tpl = null)
 {
     $customer = new DigiComSiteHelperSession();
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     if ($customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $mainframe = JFactory::getApplication();
     $Itemid = JRequest::getInt("Itemid", 0);
     $items = $this->get('Items');
     //print_r($items);die;
     $this->assign("items", $items);
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('downloads');
     parent::display($tpl);
 }
示例#8
0
 function display($tpl = null)
 {
     $model = $this->getModel('Cart');
     $this->configs = JComponentHelper::getComponent('com_digicom')->params;
     $this->Itemid = JRequest::getvar("Itemid", "0");
     $this->customer = new DigiComSiteHelperSession();
     $this->items = $model->getCartItems($this->customer, $this->configs);
     $this->plugins = $this->get('PluginList');
     $this->session = JFactory::getSession();
     $disc = 0;
     foreach ($this->items as $i => $item) {
         if ($i < 0) {
             continue;
         }
         if (isset($item->discounted_price) && $item->discounted_price && $item->discount > 0) {
             $disc = 1;
         }
     }
     $this->discount = $disc;
     $this->tax = $model->calc_price($this->items, $this->customer, $this->configs);
     $promo = $model->get_promo($this->customer, 1);
     if (isset($promo)) {
         $this->promocode = $promo->code;
         $this->promoerror = $promo->error;
     } else {
         $this->promocode = '';
         $this->promoerror = '';
     }
     $this->cat_url = $this->get('cat_url');
     $template = new DigiComSiteHelperTemplate($this);
     $input = JFactory::getApplication()->input;
     $layout = $input->get('layout', 'cart');
     $from = JRequest::getVar("from", "");
     if ($from == "ajax") {
         $template->rander('cart_popup');
     } else {
         $template->rander($layout);
     }
     parent::display($tpl);
 }
示例#9
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $dispatcher = JEventDispatcher::getInstance();
     $this->item = $this->get('Item');
     $this->print = $app->input->getBool('print');
     $this->state = $this->get('State');
     $this->user = $user;
     $this->configs = JComponentHelper::getComponent('com_digicom')->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Create a shortcut for $item.
     $item = $this->item;
     $item->tagLayout = new JLayoutFile('joomla.content.tags');
     // Add router helpers.
     $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
     $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
     $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
     // No link for ROOT category
     if ($item->parent_alias == 'root') {
         $item->parent_slug = null;
     }
     // TODO: Change based on shownoauth
     $item->readmore_link = JRoute::_(DigiComHelperRoute::getproductRoute($item->id, $item->catid, $item->language));
     // Merge product params. If this is single-product view, menu params override product params
     // Otherwise, product params override menu item params
     $this->params = $this->state->get('params');
     $active = $app->getMenu()->getActive();
     $temp = clone $this->params;
     // Check to see which parameters should take priority
     if ($active) {
         $currentLink = $active->link;
         // If the current view is the active item and an product view for this product, then the menu item params take priority
         if (strpos($currentLink, 'view=product') && strpos($currentLink, '&id=' . (string) $item->id)) {
             // Load layout from active query (in case it is an alternative menu item)
             if (isset($active->query['layout'])) {
                 $this->setLayout($active->query['layout']);
             } elseif ($layout = $item->params->get('product')) {
                 $this->setLayout($layout);
             }
             // $item->params are the product params, $temp are the menu item params
             // Merge so that the menu item params take priority
             $item->params->merge($temp);
         } else {
             // Current view is not a single product, so the product params take priority here
             // Merge the menu item params with the product params so that the product params take priority
             $temp->merge($item->params);
             $item->params = $temp;
             // Check for alternative layouts (since we are not in a single-product menu item)
             // Single-product menu item layout takes priority over alt layout for an product
             if ($layout = $item->params->get('product')) {
                 $this->setLayout($layout);
             }
         }
     } else {
         // Merge so that product params take priority
         $temp->merge($item->params);
         $item->params = $temp;
         // Check for alternative layouts (since we are not in a single-product menu item)
         // Single-product menu item layout takes priority over alt layout for an product
         if ($layout = $item->params->get('product')) {
             $this->setLayout($layout);
         }
     }
     $offset = $this->state->get('list.offset');
     // Check the view access to the product (the model has already computed the values).
     if ($item->params->get('access-view') == false && $item->params->get('show_noauth', '0') == '0') {
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return;
     }
     if ($item->params->get('show_intro', '1') == '1') {
         $item->text = $item->description . ' ' . $item->fulldescription;
     } elseif ($item->fulldescription) {
         $item->text = $item->fulldescription;
     } else {
         $item->text = $item->description;
     }
     $item->tags = new JHelperTags();
     $item->tags->getItemTags('com_digicom.product', $this->item->id);
     // Process the content plugins.
     JPluginHelper::importPlugin('content');
     $dispatcher->trigger('onContentPrepare', array('com_digicom.product', &$item, &$this->params, $offset));
     $item->event = new stdClass();
     $results = $dispatcher->trigger('onContentAfterTitle', array('com_digicom.product', &$item, &$this->params, $offset));
     $item->event->afterDisplayTitle = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_digicom.product', &$item, &$this->params, $offset));
     $item->event->beforeDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentAfterDisplay', array('com_digicom.product', &$item, &$this->params, $offset));
     $item->event->afterDisplayContent = trim(implode("\n", $results));
     // Increment the hit counter of the product.
     if (!$this->params->get('intro_only') && $offset == 0) {
         $model = $this->getModel();
         $model->hit();
     }
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('product');
     parent::display($tpl);
 }
示例#10
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     //parent::commonCategoryDisplay();
     $this->commonCategoryDisplay();
     $this->configs = JComponentHelper::getComponent('com_digicom')->params;
     // Prepare the data
     // Get the metrics for the structural page layout.
     $params = $this->params;
     $numLeading = 0;
     $numIntro = $params->def('num_products', 9);
     $numLinks = 0;
     // Compute the product slugs and prepare description (runs content plugins).
     foreach ($this->items as $item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->description;
         }
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_digicom.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as description
         $item->description = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $item->images = DigiComSiteHelperDigiCom::getThumbnail($item->images);
     }
     // Check for layout override only if this is not the active menu item
     // If it is the active menu item, then the view and category id will match
     $app = JFactory::getApplication();
     $active = $app->getMenu()->getActive();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     if (!$active || (strpos($active->link, 'view=category') === false || strpos($active->link, '&id=' . (string) $this->category->id) === false)) {
         // Get the layout from the merged category params
         if ($layout = $this->category->params->get('category_layout')) {
             $this->setLayout($layout);
         }
     } elseif (isset($active->query['layout'])) {
         // We need to set the layout from the query in case this is an alternative menu item (with an alternative layout)
         $this->setLayout($active->query['layout']);
     }
     // For blog layouts, preprocess the breakdown of leading, intro and linked products.
     foreach ($this->items as $i => $item) {
         if ($i < $numLeading) {
             $this->lead_items[] = $item;
         } elseif ($i >= $numLeading && $i < $numLeading + $numIntro) {
             $this->intro_items[] = $item;
         } elseif ($i < $numLeading + $numIntro + $numLinks) {
             $this->link_items[] = $item;
         } else {
             continue;
         }
     }
     $this->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $this->columns > 1) {
         // Call order down helper
         $this->intro_items = DigiComHelperQuery::orderDownColumns($this->intro_items, $this->columns);
     }
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     $id = (int) @$menu->query['id'];
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     if (empty($title)) {
         $title = $this->category->title;
     }
     $this->document->setTitle($title);
     if ($this->category->metadesc) {
         $this->document->setDescription($this->category->metadesc);
     } elseif (!$this->category->metadesc && $this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->category->metakey) {
         $this->document->setMetadata('keywords', $this->category->metakey);
     } elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     if (!is_object($this->category->metadata)) {
         $this->category->metadata = new Registry($this->category->metadata);
     }
     if ($app->get('MetaAuthor') == '1' && $this->category->get('author', '')) {
         $this->document->setMetaData('author', $this->category->get('author', ''));
     }
     $mdata = $this->category->metadata->toArray();
     foreach ($mdata as $k => $v) {
         if ($v) {
             $this->document->setMetadata($k, $v);
         }
     }
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('category');
     return parent::display($tpl);
 }
示例#11
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $app = JFactory::getApplication();
     $input = $app->input;
     $customer = new DigiComSiteHelperSession();
     if ($customer->_user->id > 0) {
         $Itemid = $input->get("Itemid", 0);
         $app->Redirect(JRoute::_('index.php?option=com_digicom&view=dashboard&Itemid=' . $Itemid, false));
         return true;
     }
     $this->askforbilling = $configs->get('askforbilling', 1);
     $this->askforcompany = $configs->get('askforcompany', 1);
     $country_option = DigiComSiteHelperDigiCom::get_country_options($customer, false, $configs);
     $lists['country_option'] = $country_option;
     $profile = new StdClass();
     $profile->country = @$customer->country;
     $profile->state = @$customer->state;
     $shipcountry_option = DigiComSiteHelperDigiCom::get_country_options($profile, true, $configs);
     $lists['shipcountry_options'] = $shipcountry_option;
     $lists['customerlocation'] = DigiComSiteHelperDigiCom::get_store_province($profile, false);
     $profile = new StdClass();
     $profile->country = @$customer->country;
     $profile->state = @$customer->state;
     $lists['customershippinglocation'] = DigiComSiteHelperDigiCom::get_store_province($profile, true);
     $sql = "select * from #__digicom_states where eumember='1'";
     $db->setQuery($sql);
     $eucs = $db->loadObjectList();
     $eu = array();
     foreach ($eucs as $euc) {
         $eu[] = $euc->country;
     }
     $this->assign("eu", $eu);
     $eulocated = isset($customer->country) && in_array($customer->country, $eu);
     $this->assign("eulocated", $eulocated);
     $cclasses = @explode("\n", $customer->taxclass);
     $data = $this->get('listCustomerClasses');
     $select = '<select name="taxclass" >';
     if (count($data) > 0) {
         foreach ($data as $i => $v) {
             $select .= '<option value="' . $v->id . '" ';
             if (in_array($v->id, $cclasses)) {
                 $select .= ' selected ';
             }
             $select .= ' > ' . $v->name . '</option>';
         }
     }
     $select .= '</select>';
     $lists['customer_class'] = $select;
     $this->assign("lists", $lists);
     $this->assign("customer", $customer);
     $this->assign("configs", $configs);
     //prepare default and tmp value
     $old_values = array();
     if (isset($_SESSION["new_customer"])) {
         $old_values = $_SESSION["new_customer"];
     }
     $userinfo = new StdClass();
     $userinfo->firstname = "";
     $userinfo->lastname = "";
     $userinfo->company = "";
     $userinfo->email = "";
     $userinfo->username = "";
     $userinfo->password = "";
     $userinfo->password_confirm = "";
     $userinfo->address = "";
     $userinfo->city = "";
     $userinfo->zipcode = "";
     $userinfo->country = "";
     $userinfo->state = "";
     if (isset($old_values) && count($old_values) > 0) {
         $userinfo->firstname = $old_values["firstname"];
         $userinfo->lastname = $old_values["lastname"];
         $userinfo->company = $old_values["company"];
         $userinfo->email = $old_values["email"];
         $userinfo->username = $old_values["username"];
         $userinfo->password = $old_values["password"];
         $userinfo->password_confirm = $old_values["password_confirm"];
         $userinfo->address = $old_values["address"];
         $userinfo->city = $old_values["city"];
         $userinfo->zipcode = $old_values["zipcode"];
         $userinfo->country = $old_values["country"];
         $userinfo->state = $old_values["state"];
         unset($_SESSION["new_customer"]);
     }
     $this->assign("userinfo", $userinfo);
     $layout = $input->get('layout', 'register');
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander($layout);
     parent::display($tpl);
 }
示例#12
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     $customer = new DigiComSiteHelperSession();
     if ($customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $session = JFactory::getSession();
     $processor = JRequest::getVar("processor", "");
     if (empty($processor)) {
         $pg_plugin = $session->get('processor');
     } else {
         $pg_plugin = $processor;
     }
     $Itemid = JRequest::getInt("Itemid", "0");
     $order_id = JRequest::getInt("order_id", "0");
     $dispatcher = JDispatcher::getInstance();
     $plugin = JPluginHelper::importPlugin('digicom_pay', $pg_plugin);
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $order = $this->get('Order');
     //print_r($order);die;
     $params = json_decode($order->params, true);
     $items = $params['products'];
     /*
      * $items
      * [0]
      *	->name
      *	->discount
      *	->quantity
      *	->price
      *	->promo
      *	  amount = price - promo
      */
     $vars = new stdClass();
     $vars->items = $items;
     $vars->order_id = $params['order_id'];
     $vars->user_id = JFactory::getUser()->id;
     $vars->customer = $customer->_customer;
     $vars->item_name = '';
     for ($i = 0; $i < count($items) - 2; $i++) {
         $vars->item_name .= $items[$i]['name'] . ', ';
     }
     $vars->item_name = substr($vars->item_name, 0, strlen($vars->item_name) - 2);
     $vars->cancel_return = JRoute::_(JURI::root() . "index.php?option=com_digicom&Itemid=" . $Itemid . "&task=cart.cancel&processor={$pg_plugin}", true, 0);
     $vars->return = $vars->url = $vars->notify_url = JRoute::_(JURI::root() . "index.php?option=com_digicom&task=cart.processPayment&processor={$pg_plugin}&order_id=" . $params['order_id'] . "&sid=" . $customer->_sid, true, false);
     $vars->currency_code = $configs->get('currency', 'USD');
     $vars->amount = $items[-2]['taxed'];
     //+$items[-2]['shipping'];
     // Triggre plugin event
     JPluginHelper::importPlugin('digicom_pay', $pg_plugin);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onSendPayment', array(&$params));
     $html = $dispatcher->trigger('onTP_GetHTML', array($vars));
     if (!isset($html[0])) {
         $html[0] = '';
     }
     if ($pg_plugin == 'paypal') {
         $html[0] = $html[0] . '<script type="text/javascript">';
         $html[0] = $html[0] . 'jQuery(".akeeba-bootstrap").hide();';
         $html[0] = $html[0] . 'jQuery(window).load(function() {jQuery(".akeeba-bootstrap form").submit();});';
         $html[0] = $html[0] . '</script>';
     }
     $this->assign("pg_plugin", $pg_plugin);
     $this->assign("configs", $configs);
     $this->assign("data", $html);
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('checkout');
     parent::display($tpl);
 }