$order_url = Tools::getValue('order_url', ''); $filter = Tools::getValue('filtering'); if ($filter) { foreach ($filter as $item => $value) { $item = explode('.', $item); Context::getContext()->smarty->assign('cookie_productsListFilter_' . $item[1], $value); } } $order_url = $order_url ? explode('/', $order_url) : ''; $order_by = $order_url ? $order_url[0] : ''; $order_way = $order_url ? $order_url[1] : ''; $page = (int) Tools::getValue('current_page', '1'); $per_page = (int) Tools::getValue('pagination'); $start = $per_page * $page - $per_page; $limit = ' LIMIT ' . $start . ', ' . $per_page . ' '; $configuration_view_obj = new GiveItConfigurationView(); $products_data = $configuration_view_obj->getProductsByCategory($id_category, $id_shop, $id_lang, $order_by, $order_way, $filter, $limit); $list_total = count($configuration_view_obj->getProductsByCategory($id_category, $id_shop, $id_lang, $order_by, $order_way, $filter, $limit, true)); $pagination = version_compare(_PS_VERSION_, '1.6', '>=') ? array(20, 50, 100, 300, 1000) : array(20, 50, 100, 300); $total_pages = ceil($list_total / $per_page); if (!$total_pages) { $total_pages = 1; } $selected_pagination = Tools::getValue('pagination', isset(Context::getContext()->cookie->{'project_pagination'}) ? Context::getContext()->cookie->{'project_pagination'} : null); Context::getContext()->smarty->assign(array('products' => $products_data, 'page' => $page, 'selected_pagination' => $selected_pagination, 'pagination' => $pagination, 'total_pages' => $total_pages, 'list_total' => $list_total, 'cookie_order_by' => $order_by, 'cookie_order_way' => $order_way)); if (version_compare(_PS_VERSION_, '1.6', '>=')) { die(Context::getContext()->smarty->fetch(_GIVEIT_TPL_DIR_ . 'admin/selected_category_ps16.tpl')); } else { die(Context::getContext()->smarty->fetch(_GIVEIT_TPL_DIR_ . 'admin/selected_category.tpl')); } }
/** * module configuration page * @return page HTML code */ public function getContent() { $this->checkConfigurationActions(); $this->checkConfigurationCategoryActions(); $this->displayFlashMessagesIfIsset(); $menu = Tools::getValue('menu'); if (!$this->testConnection()) { $menu = 'technical_settings'; $this->context->smarty->assign('base_dir', _PS_BASE_URL_ . __PS_BASE_URI__); $this->context->smarty->assign('shop_name', Configuration::get('PS_SHOP_NAME')); $this->context->smarty->assign('first_name', Context::getContext()->employee->firstname); $this->context->smarty->assign('last_name', Context::getContext()->employee->lastname); $this->context->smarty->assign('email', Context::getContext()->employee->email); $this->context->smarty->assign('shop_id', Context::getContext()->shop->id); $default_currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->smarty->assign('iso_code', $default_currency->iso_code); } $this->context->smarty->assign('menu', $menu); if (!version_compare(_PS_VERSION_, '1.5', '<')) { if (Shop::getContext() != Shop::CONTEXT_SHOP) { $this->addFlashWarning($this->l('It is not possible to manage module configuration when you are managing ALL SHOPS or a GROUP of shops. Please select a shop to configure the module.')); $this->displayFlashMessagesIfIsset(); return $this->html; } } switch ($menu) { case 'configuration': default: $this->context->smarty->assign('current_page_name', $this->l('Main settings')); $this->displayNavigation(); $give_it_configuration_view_obj = new GiveItConfigurationView(); $this->html .= $give_it_configuration_view_obj->getConfigurationForm(); break; case 'configuration_category': $this->context->smarty->assign('current_page_name', $this->l('Category settings')); $this->displayNavigation(); $give_it_configuration_view_obj = new GiveItConfigurationView(); $this->html .= $give_it_configuration_view_obj->getConfigurationCategoryForm(); break; case 'configuration_product': $this->context->smarty->assign('current_page_name', $this->l('Product settings')); $this->displayNavigation(); if (!version_compare(_PS_VERSION_, '1.5', '<')) { if (Shop::getContext() != Shop::CONTEXT_SHOP) { $this->addFlashWarning($this->l('It is not possible to manage product settings when You are currently managing all of your shops or group of shops.')); $this->displayFlashMessagesIfIsset(); break; } } $give_it_configuration_view_obj = new GiveItConfigurationView(); $this->html .= $give_it_configuration_view_obj->getConfigurationProductForm(); break; case 'shipping_prices': $this->context->smarty->assign('current_page_name', $this->l('Shipping prices')); $this->displayNavigation(); $this->displayShippingPricesPage(); break; case 'help': $this->context->smarty->assign('current_page_name', $this->l('Help')); $this->displayNavigation(); $this->html .= $this->display(__FILE__, 'views/templates/admin/help.tpl'); break; } return $this->html; }