<input type="hidden" name="task" value="shipping_payment_method_validate" /> <input type="hidden" name="option" value="com_j2store" /> <input type="hidden" name="view" value="checkout" /> <div class="j2store-modal"> <div id="j2store-tos-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="j2store-tos-modal-label" aria-hidden="true" style="display:none;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <?php if (is_numeric($tos)) { ?> <p><?php echo J2Store::article()->display($tos); ?> </p> <?php } ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal" aria-hidden="true"><?php echo JText::_('J2STORE_CLOSE'); ?> </button> </div> </div>
public static function getArticleByAlias($segment) { $article = J2Store::article()->getArticleByAlias($segment); if (isset($article->id)) { $product = F0FTable::getAnInstance('Product', 'J2StoreTable'); $product->get_product_by_source('com_content', $article->id); return $product->j2store_product_id; } else { return false; } }
/** * This displays the content article * specified in the plugin's params * * @return unknown_type */ function _displayArticle() { $html = ''; $articleid = (int) $this->params->get('articleid'); if ($articleid && is_numeric($articleid)) { $html = J2Store::article()->display($articleid); } return $html; }
public function browse() { //first clear cache $utility = J2Store::utilities(); $utility->nocache(); $utility->clear_cache(); $app = JFactory::getApplication(); $session = JFactory::getSession(); $db = JFactory::getDbo(); $manufacturer_ids = $this->input->get('manufacturer_ids', array(), 'ARRAY'); $vendor_ids = $this->input->get('vendor_ids', array(), 'ARRAY'); $productfilter_ids = $this->input->get('productfilter_ids', array(), 'ARRAY'); $ns = 'com_j2store.' . $this->getName(); $params = F0FModel::getTmpInstance('Products', 'J2StoreModel')->getMergedParams(); if ($params->get('list_show_vote', 0)) { $params->set('show_vote', 1); } $view = $this->getThisView(); //$model = F0FModel::getTmpInstance('Products', 'J2StoreModel'); $model = $this->getModel('Products'); //$model->clearState(); $view->setModel($model); //$states = $this->getFilterStates(); $states = $this->getSFFilterStates(); if (!empty($manufacturer_ids)) { $session->set('manufacturer_ids', $manufacturer_ids, 'j2store'); $states['manufacturer_id'] = implode(',', $utility->cleanIntArray($manufacturer_ids, $db)); } else { $session->clear('manufacturer_ids', 'j2store'); $states['manufacturer_id'] = ''; } if (!empty($vendor_ids)) { $session->set('vendor_ids', $vendor_ids, 'j2store'); $states['vendor_id'] = implode(',', $utility->cleanIntArray($vendor_ids, $db)); //$model->setState('vendor_id' ,implode(',',$vendor_ids)); } else { $session->clear('vendor_ids', 'j2store'); $states['vendor_id'] = ''; } if (!empty($productfilter_ids)) { $session->set('productfilter_ids', $productfilter_ids, 'j2store'); //set filter search condition $session->set('list_product_filter_search_logic_rel', $params->get('list_product_filter_search_logic_rel', 'OR'), 'j2store'); $states['productfilter_id'] = implode(',', $utility->cleanIntArray($productfilter_ids, $db)); //$model->setState('productfilter_id' ,implode(',',$vendor_ids)); } else { $session->clear('productfilter_ids', 'j2store'); $session->clear('list_product_filter_search_logic_rel', 'j2store'); $states['productfilter_id'] = ''; } $itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int'); // Get the pagination request variables $limit = $params->get('page_limit'); $model->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'int'); // In case limit has been changed, adjust limitstart accordingly // $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); $model->setState('list.start', $limitstart); $orderCol = $app->getUserStateFromRequest('com_j2store.product.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); if (!in_array($orderCol, $model->get_filter_fields())) { $orderCol = 'a.ordering'; } $model->setState('list.ordering', $orderCol); $listOrder = $app->getUserStateFromRequest('com_j2store.product.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $model->setState('list.direction', $listOrder); foreach ($states as $key => $value) { $model->setState($key, $value); } /* $filter_catid = $this->input->getInt('filter_catid',0); */ $filter_catid = $app->input->getInt('filter_catid', $session->get('filter_catid', '', 'j2store')); $catids = $this->input->get('catid', array(), 'Array'); $this->_catids = $catids; if (!empty($filter_catid)) { $model->setState('catids', $filter_catid); } elseif (empty($filter_catid)) { $model->setState('catids', $this->_catids); } elseif ($params->get('list_show_filter_category_all', 1) && empty($filter_catid)) { $model->setState('catids', $this->_catids[0]); } // set the depth of the category query based on parameter $showSubcategories = $params->get('show_subcategory_content', '0'); if ($showSubcategories) { $model->setState('filter.max_category_levels', $params->get('show_subcategory_content', '1')); $model->setState('filter.subcategories', true); } $model->setState('filter.language', JLanguageMultilang::isEnabled()); $model->setState('enabled', 1); $model->setState('visible', 1); //set product ids $items = $model->getSFProducts(); $filter_items = $model->getSFAllProducts(); $filters = array(); //$filters = $this->getFilters($items); $filters = $this->getFilters($filter_items); if (count($items)) { foreach ($items as &$item) { //run the content plugins $model->executePlugins($item, $params, 'com_content.category.productlist'); } //process the raw items as products $this->processProducts($items); $pagination = $model->getSFPagination(); $view->assign('pagination', $pagination); } $filters['pricefilters'] = $this->getPriceRanges($items); //set up document // 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 $active = $app->getMenu()->getActive(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $params->def('page_heading', $params->get('page_title', $menu->title)); } $title = $params->get('page_title', ''); // 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')); } $document->setTitle($title); $meta_description = $params->get('menu-meta_description'); $document->setDescription($meta_description); $keywords = $params->get('menu-meta_keywords'); $document->setMetaData('keywords', $keywords); $robots = $params->get('robots'); $document->setMetaData('robots', $robots); // Set Facebook meta data $uri = JURI::getInstance(); $document->setMetaData('og:title', $document->getTitle()); $document->setMetaData('og:site_name', $app->get('sitename')); $document->setMetaData('og:description', strip_tags($document->getDescription())); $document->setMetaData('og:url', $uri->toString()); $document->setMetaData('og:type', 'product.group'); $catids = $model->getState('catids', array()); $category = false; if (is_array($catids)) { if (count($catids) == 1) { $category = $catids[0]; } } elseif (is_numeric($catids)) { $category = $catids; } if ($category) { // we have a single category. So we can add a breadcrumb $category_data = J2Store::article()->getCategoryById($category); if (isset($category_data->title)) { $pathway = $app->getPathway(); $path = array(array('title' => $category_data->title, 'link' => '')); $path = array_reverse($path); foreach ($path as $singlepath) { $pathway->addItem($singlepath['title'], $singlepath['link']); } } } //add custom styles $custom_css = $params->get('custom_css', ''); $document->addStyleDeclaration(strip_tags($custom_css)); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } // Look for template files in component folders $view->addTemplatePath(JPATH_COMPONENT . DS . 'templates'); $view->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (J2 template structure) $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates'); $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (Joomla! template structure) $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'default'); $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store'); // Look for specific J2 theme files if ($params->get('subtemplate')) { $view->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . $params->get('subtemplate')); $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates' . DS . $params->get('subtemplate')); $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . $params->get('subtemplate')); } //allow plugins to modify the data J2Store::plugin()->event('ViewProductList', array(&$items, &$view, $params, $model)); $view->assign('products', $items); $view->assign('state', $model->getState()); $view->assign('params', $params); $view->assign('filters', $filters); $view->assign('filter_catid', $filter_catid); $view->assign('currency', J2store::currency()); $this->display(in_array('browse', $this->cacheableTasks)); return true; }