Visualizzare elenco articoli in admin con codice articolo

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

Rispondi
Goelom
membro Baby
membro Baby
Messaggi: 71
Iscritto il: 21/08/2006, 18:44

Visualizzare elenco articoli in admin con codice articolo

Messaggio da Goelom »

Come da oggetto, ho la necessità di visualizzare lato admin gli articoli presenti in catalogo non per titolo ma per codice articolo.
Come posso fare? Mi date una dritta?
Modificare un articolo già inserito e scovarlo tra centinaia con titolo più o meno simile non è mica facile...
Grazie
Goelom
membro Baby
membro Baby
Messaggi: 71
Iscritto il: 21/08/2006, 18:44

Messaggio da Goelom »

Nessuno mi sa aiutare?
:roll: Immagine
hsg26
membro Master
membro Master
Messaggi: 1677
Iscritto il: 07/04/2005, 0:00
Località: Svizzera
Contatta:

Messaggio da hsg26 »

http://www.oscommerce.com/community/contributions,938

perchè non cercare su oscommerce.com invece di aspettare? come ho fatto io...
Goelom
membro Baby
membro Baby
Messaggi: 71
Iscritto il: 21/08/2006, 18:44

Messaggio da Goelom »

Ti ringrazio per la segnalazione :D
perchè non cercare su oscommerce.com invece di aspettare? come ho fatto io...
Nel mio caso, inglese, arabo e ostrogoto pari sono... :oops:

Ho fatto le modifiche che chiede la contrib, ma mi sono bloccato qui:

Codice: Seleziona tutto

***********************************************************************


The following will alter the SQL queries, to grab the products_model, and to sort by it. If Variant 1 do not work for you try Variant 2.

===== Variant 1: =====

Find this:

    if ($HTTP_GET_VARS['search']) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by pd.products_name ");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by pd.products_name ");
    } 


Change to this:
// -----BOF - Added code for Admin Sort by products model-----
		/*
    if ($HTTP_GET_VARS['search']) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by pd.products_name ");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by pd.products_name ");
    } 
		*/
    if ($HTTP_GET_VARS['search']) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_model");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by p.Products_model");
    }
// -----EOF - Added code for Admin Sort by products model-----

-----------------------------------------------------------------

===== Variant 2 =====

Find this:

    if (isset($HTTP_GET_VARS['search'])) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by pd.products_name ");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name ");
    } 


Change to this:
// -----BOF - Added code for Admin Sort by products model-----
		/*
    if (isset($HTTP_GET_VARS['search'])) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by pd.products_name ");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name ");
    } 
		*/
    if (isset($HTTP_GET_VARS['search'])) {
  	  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_model");
    } else {
      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by p.Products_model");
    }
// -----EOF - Added code for Admin Sort by products model-----

***********************************************************************

Su quale file devo intervenire?
by Carmelo
Muppet Traslator Team
hsg26
membro Master
membro Master
Messaggi: 1677
Iscritto il: 07/04/2005, 0:00
Località: Svizzera
Contatta:

Messaggio da hsg26 »

sono quasi sicuro che lo dica sopra la parte di codice che hai copiato qui.
Goelom
membro Baby
membro Baby
Messaggi: 71
Iscritto il: 21/08/2006, 18:44

Messaggio da Goelom »

hsg26 ha scritto:sono quasi sicuro che lo dica sopra la parte di codice che hai copiato qui.
Questa è tutta la prima parte, quella che ho tralasciato nel mio post precedente:

Codice: Seleziona tutto

Admin Sort by products_model 1.2


Description
-----------
This is a very minor contribution, but something that I find useful. 
Basically it allows you to see the product model numbers in the admin 
category/product listing, and also sorts by model number. 
I work on a site that sells women’s clothing, and has many products 
by different vendors that have very similar names. 
The changes in this contribution just saves me time while looking for 
a specific product to edit. This should work with most snapshots. 
I have tested it with one from mid August 2002, November 2002, and January 16, 2003. 

Changes since v1.2
***********************************************************************
Fixed mistake in location products_model is displayed
***********************************************************************

Changes since v1.1
***********************************************************************
Fixed comment type from php to html style in 3 sections
Added comments to sql query change
***********************************************************************


INSTALLATION INSTRUCTIONS (After you backup you original files of course)
***********************************************************************


In Admin /admin/includes/languages/english/categories.php
***********************************************************************


Add this line:
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model'); //Addition from Admin Sort by products_model

I added to the bottom of the file, but it shouldn’t matter where


***********************************************************************


In Admin /admin/includes/languages/german/categories.php  === German Translation ===
***********************************************************************


Add this line:
define('TABLE_HEADING_PRODUCTS_MODEL', 'Modell'); //Addition from Admin Sort by products_model

I added to the bottom of the file, but it shouldn’t matter where


***********************************************************************



In /admin/categories.php
These next 3 steps add the new column that displays the products_model
**********************************************************************



Find this line:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>

Insert this 1 line above it:
<!--BOF - Added code for Admin Sort by products model---->
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
<!--EOF - Added code for Admin Sort by products model---->



***********************************************************************




Find this line:
<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a> <b>' . $categories['categories_name'] . '</b>'; ?></td>
             
Insert this right 1 line above it:
<!--BOF - Added code for Admin Sort by products model---->
<td class="dataTableContent" width="5%" nowrap></td>
<!--EOF - Added code for Admin Sort by products model---->



***********************************************************************




Find this line:
<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $products['products_name']; ?></td>
                                
Insert this right 1 line above it:
<!--BOF - Added code for Admin Sort by products model---->
<td class="dataTableContent" width="5%" nowrap><?php echo ' ' . $products['products_model']; ?></td>
<!--EOF - Added code for Admin Sort by products model---->



***********************************************************************
hsg26
membro Master
membro Master
Messaggi: 1677
Iscritto il: 07/04/2005, 0:00
Località: Svizzera
Contatta:

Messaggio da hsg26 »

dovrebbe essere sempre in admin/categories.php

occhio che probabilmente il tuo sarà già modificato... quindi stai attento a quello che sostituisci. Fai un cerca/sostituisci con l'editor che usi.
Goelom
membro Baby
membro Baby
Messaggi: 71
Iscritto il: 21/08/2006, 18:44

Messaggio da Goelom »

hsg26 ha scritto:dovrebbe essere sempre in admin/categories.php

occhio che probabilmente il tuo sarà già modificato... quindi stai attento a quello che sostituisci. Fai un cerca/sostituisci con l'editor che usi.
Effettivamente bisognava modificare solo le parti differenti, intervenendo a manina.
Risultato:

Codice: Seleziona tutto

Error Message - 1054 - Unknown column 'p.products_id' in 'on clause'
Qualche alternativa compatibile con MySql5? :roll:
hsg26
membro Master
membro Master
Messaggi: 1677
Iscritto il: 07/04/2005, 0:00
Località: Svizzera
Contatta:

Messaggio da hsg26 »

Goelom ha scritto:
hsg26 ha scritto:dovrebbe essere sempre in admin/categories.php

occhio che probabilmente il tuo sarà già modificato... quindi stai attento a quello che sostituisci. Fai un cerca/sostituisci con l'editor che usi.
Effettivamente bisognava modificare solo le parti differenti, intervenendo a manina.
Risultato:

Codice: Seleziona tutto

Error Message - 1054 - Unknown column 'p.products_id' in 'on clause'
Qualche alternativa compatibile con MySql5? :roll:
qui trovi la soluzione... http://www.oscommerce.com/community/contributions,4654
Rispondi