Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add model_number to new specials drop-down


Guest

Recommended Posts

Posted

In admin/specials.php, in the New Specials product drop-down box, I want to change from the default display:

 

Product: "product_name (product_price)"

 

to:

 

Product: "product_model -- product_name (product_price)"

 

...and sort on product_model, but it's much tricker that it looks! :-"

 

Thanks.

 

- Scott

Posted
In admin/specials.php, in the New Specials product drop-down box, I want to change from the default display:

 

Product: "product_name (product_price)"

 

to:

 

Product: "product_model -- product_name (product_price)"

 

...and sort on product_model, but it's much tricker that it looks! :-"

 

Thanks.

 

- Scott

 

lol nah it's not! I just did it in a similar way for a client on Friday :-)

 

find this function in admin/includes/functions/general.php

function tep_draw_products_pull_down

 

comment the whole function out to have as a backup

 

and replace it by this

  function tep_draw_products_pull_down($name, $parameters = '', $exclude = '') {
global $currencies, $languages_id;

if ($exclude == '') {
  $exclude = array();
}

$select_string = '<select name="' . $name . '"';

if ($parameters) {
  $select_string .= ' ' . $parameters;
}

$select_string .= '>';

$products_query = tep_db_query("select p.products_id, p.products_model, pd.products_name, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
  if (!in_array($products['products_id'], $exclude)) {
	$select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_model'] . ' -- ' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>';
  }
}

$select_string .= '</select>';

return $select_string;
 }

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
find this function in admin/includes/functions/general.php

function tep_draw_products_pull_down

You're right, Monika -- that was easy! I just didn't know where to look, and recognizing that function was key.

 

Danke schon! - Scott

Posted
You're right, Monika -- that was easy! I just didn't know where to look, and recognizing that function was key.

 

Danke schon! - Scott

 

scott, just as a hint ... for next time

 

view the source code of the drop down or any other field you want to change ... it will have a name

 

search for the name in your php code ... if it's a function you are finding like in this case for the pull down, use Textpad or a similar editor to find it (while it will normally be in general.php, either admin or catalog where you are working).

 

The search tool is important as you can quickly see if other pages are using the same function. If they are, you need to decide if the change is ok for both. If yes, just make the change, if not, create a new function with a similar name and call that on the page you want to have the mod on.

 

Voil? instant success!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...