sistema paginazione
Moderatore: mod Generali
sistema paginazione
ciao,
all'interno di ogni categoria del mio negozio ho applicato la paginazione(numeretti a fondo pagina per dividere in più pagine i miei prodotti).
Quando clicco in una categoria la prima pagina che mi appare è quella con gli ultimi inserimenti e fin qui tutto bene.
Quando però ad esempio essendo nella quarta pagina clicco sul numeretto 1 per tornare alla prima, non mi rimanda alla pagina
con gli ultimi prodotti inseriti di cui sopra, ma bensì ad un altra pagina 1 che però ha altri prodotti e quindi è diverse dall'altra.
Questo avviene praticamente su tutte le pagine della paginazione.
Come si può risolvere questa cosa?
Grazie in anticipo x ogni aiuto.
all'interno di ogni categoria del mio negozio ho applicato la paginazione(numeretti a fondo pagina per dividere in più pagine i miei prodotti).
Quando clicco in una categoria la prima pagina che mi appare è quella con gli ultimi inserimenti e fin qui tutto bene.
Quando però ad esempio essendo nella quarta pagina clicco sul numeretto 1 per tornare alla prima, non mi rimanda alla pagina
con gli ultimi prodotti inseriti di cui sopra, ma bensì ad un altra pagina 1 che però ha altri prodotti e quindi è diverse dall'altra.
Questo avviene praticamente su tutte le pagine della paginazione.
Come si può risolvere questa cosa?
Grazie in anticipo x ogni aiuto.
Re: sistema paginazione
controlla la generazione dei link... perchè è strano come errore
Re: sistema paginazione
ciao dynamo e grazie innanzitutto per la pronta risposta
come e dove devo controllare esattamente? perdona la mia ignoranza in materia ma non sono un programmatore.
Grazie ancora

come e dove devo controllare esattamente? perdona la mia ignoranza in materia ma non sono un programmatore.
Grazie ancora

Re: sistema paginazione
nel file catalog/includes/modules/product_listing controlla magari con la versione base di osc così da poter notare eventuali differenze 

Re: sistema paginazione
OK grazie dynamo controllo e poi ti dico subito.
Grazie ancora.
Grazie ancora.
Re: sistema paginazione
ciao dynamo
ho controllato la pagina "product_listing" con una più recente, ho anche uplodato la pagina recente ma il problema
a livello di paginazione persiste ancora.
A dire il vero quando faccio l'upload della pagina dell'ultimo pacchetto di oscommerce mi da un messaggio di errore
questo perche immagino entra in conflitto con il mio pacchetto che è abbastanza datato (almeno 2 anni) e non è italiano.
La cosa che ho notato tuttavi a sono gli url: quello che appare la prima volta che clicco sulla categoria è il seguente:
http://www.myosito.com/index.php?cPath=22
mentre gli url quando clicco sugli altri numeretti della paginazione sono del tipo:
http://www.myosito.com/index.php?cPath= ... =2a&page=1
e quando rifaccio click sul numeretto 1 non mi da più: http://www.myosito.com/index.php?cPath=22
ma appunto url del secondo tipo: http://www.myosito.com/index.php?cPath= ... =2a&page=1
Come posso risolverla secondo te?...non ci capisco più niente!


ho controllato la pagina "product_listing" con una più recente, ho anche uplodato la pagina recente ma il problema
a livello di paginazione persiste ancora.
A dire il vero quando faccio l'upload della pagina dell'ultimo pacchetto di oscommerce mi da un messaggio di errore
questo perche immagino entra in conflitto con il mio pacchetto che è abbastanza datato (almeno 2 anni) e non è italiano.
La cosa che ho notato tuttavi a sono gli url: quello che appare la prima volta che clicco sulla categoria è il seguente:
http://www.myosito.com/index.php?cPath=22
mentre gli url quando clicco sugli altri numeretti della paginazione sono del tipo:
http://www.myosito.com/index.php?cPath= ... =2a&page=1
e quando rifaccio click sul numeretto 1 non mi da più: http://www.myosito.com/index.php?cPath=22
ma appunto url del secondo tipo: http://www.myosito.com/index.php?cPath= ... =2a&page=1
Come posso risolverla secondo te?...non ci capisco più niente!


Re: sistema paginazione
controlla questa funziona...
la trovi in catalog/includes/classes/split_page_results.php
la funzione serve per lo split delle pagine
Codice: Seleziona tutto
// display split-page-number-links
function display_links($max_page_links, $parameters = '') {
global $PHP_SELF, $request_type;
$display_links_string = '';
$class = 'class="pageResults"';
if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';
// previous button - not displayed on first page
if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a> ';
// check if number_of_pages > $max_page_links
$cur_window_num = intval($this->current_page_number / $max_page_links);
if ($this->current_page_number % $max_page_links) $cur_window_num++;
$max_window_num = intval($this->number_of_pages / $max_page_links);
if ($this->number_of_pages % $max_page_links) $max_window_num++;
// previous window of pages
if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';
// page nn button
for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
if ($jump_to_page == $this->current_page_number) {
$display_links_string .= ' <b>' . $jump_to_page . '</b> ';
} else {
$display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a> ';
}
}
// next window of pages
if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> ';
// next button
if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> ';
return $display_links_string;
}
la funzione serve per lo split delle pagine

Re: sistema paginazione
Grazie dynamo, stasera controllo e domattina ti faccio sapere se sono riuscito a risolvere
Grazie ancora.

Grazie ancora.
Re: sistema paginazione
Buongiorno dynamo
ho verificato con il codice che mi hai gentilmente postato ed è uguale a quello presente nella mia pagina.
Non so,..è come se la prima pagina di ogni categoria (1) sia una cosa a se stante rispetto a tutte le altre pagine (2,3,4 etc.)
e quindi la paginazione funziona bene dalla 2 in poi ma non tiene in considerazione la pagina 1 (o meglio per lei la pagina 1 è un altra, non è cioè quella che appare
quando si fa click sul nome della categoria) . A questo punto non so più a che santo votarmi. Hai qualche suggerimento dynamo?
Grazie ancora molto.

ho verificato con il codice che mi hai gentilmente postato ed è uguale a quello presente nella mia pagina.
Non so,..è come se la prima pagina di ogni categoria (1) sia una cosa a se stante rispetto a tutte le altre pagine (2,3,4 etc.)
e quindi la paginazione funziona bene dalla 2 in poi ma non tiene in considerazione la pagina 1 (o meglio per lei la pagina 1 è un altra, non è cioè quella che appare
quando si fa click sul nome della categoria) . A questo punto non so più a che santo votarmi. Hai qualche suggerimento dynamo?
Grazie ancora molto.

Re: sistema paginazione
questa è la parte in index.php che gestisce la pagina quando navighi tra le categorie...
prova un po' a vedere...
Codice: Seleziona tutto
// create column list
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
asort($define_list);
$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
if ($value > 0) $column_list[] = $key;
}
$select_column_list = '';
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
switch ($column_list[$i]) {
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_NAME':
$select_column_list .= 'pd.products_name, ';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$select_column_list .= 'm.manufacturers_name, ';
break;
case 'PRODUCT_LIST_QUANTITY':
$select_column_list .= 'p.products_quantity, ';
break;
case 'PRODUCT_LIST_IMAGE':
$select_column_list .= 'p.products_image, ';
break;
case 'PRODUCT_LIST_WEIGHT':
$select_column_list .= 'p.products_weight, ';
break;
}
}
// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
}
}
if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by pd.products_name";
break;
}
}
} else {
$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
$sort_order = substr($HTTP_GET_VARS['sort'], 1);
switch ($column_list[$sort_col-1]) {
case 'PRODUCT_LIST_MODEL':
$listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= " order by pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
}
}
?>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?php
// optional Product List Filter
if (PRODUCT_LIST_FILTER > 0) {
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
} else {
$filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
}
$filterlist_query = tep_db_query($filterlist_sql);
if (tep_db_num_rows($filterlist_query) > 1) {
echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
$options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
} else {
echo tep_draw_hidden_field('cPath', $cPath);
$options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
}
echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
while ($filterlist = tep_db_fetch_array($filterlist_query)) {
$options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
}
echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
echo tep_hide_session_id() . '</form></td>' . "\n";
}
}
// Get the right image for the top-right
$image = DIR_WS_IMAGES . 'table_background_list.gif';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
$image = tep_db_fetch_array($image);
$image = $image['manufacturers_image'];
} elseif ($current_category_id) {
$image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
$image = tep_db_fetch_array($image);
$image = $image['categories_image'];
}
?>
<td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
</tr>
</table></td>
<?php