Example #1
0
    $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'));
    }
}
if (Tools::isSubmit('getCombinationSetting')) {