예제 #1
0
 /**
  * get_module
  *
  * @param   integer  $layout_type  layout_type
  * @param   string   $ckout_text   ckout_text
  *
  * @return  html.
  *
  * @since   1.6
  */
 public function get_module($layout_type = "", $ckout_text = '')
 {
     $comquick2cartHelper = new comquick2cartHelper();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $modulePara = $comquick2cartHelper->getModuleParams('mod_quick2cart');
         $moduleParams = json_decode($modulePara);
     } else {
         $module = JModuleHelper::getModule('mod_quick2cart');
         $moduleParams = json_decode($module->params);
     }
     /* params will be added in #__modules only on saving module param
      * so if module params are not found in #__modules then take default param from  #_extention */
     if (empty($moduleParams)) {
         $module = $comquick2cartHelper->getExtentionparam('mod_quick2cart');
         $moduleParams = json_decode($module);
     }
     if (empty($layout_type)) {
         $layout_type = $moduleParams->viewtype;
     }
     if (empty($ckout_text)) {
         $ckout_text = $moduleParams->checkout_text;
     }
     $model = new Quick2cartModelcart();
     $cart = $model->getCartitems();
     if ($layout_type == "detail") {
         $layout = 'default_itemrow';
     } else {
         $layout = 'default_itemshort';
     }
     // Call the plugin and get the result
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('system');
     $result = $dispatcher->trigger('onAfterCartModule');
     if (!empty($result)) {
         $aftercartdisplay = $result[0];
     }
     $Itemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=cartcheckout');
     $app = JFactory::getApplication();
     $override = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/mod_quick2cart/' . $layout . '.php';
     if (JFile::exists($override)) {
         $mod_path = $override;
     } else {
         $mod_path = JPATH_SITE . '/modules/mod_quick2cart/tmpl/' . $layout . '.php';
     }
     ob_start();
     include $mod_path;
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }