Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Automatic Product Model #


BrandonTiesman

Recommended Posts

Hi,

 

Hope this is the right forum, if not im sorry.

 

I was wondering if someone could produce a quick mod to have product model #'s be automatic when adding new products. Reading the entries in the database and then giving the new product your adding the consecutive model number. We are silversmiths and sell hand-made jewelry, all our products are unique so giving each item its own number is what we are looking for. Its hard to keep track of what model # this ring will be when there are already X amount of items for sale in our shop. The first item you add would be given model #1 .. second automatically be given 2 instead of manually having to do this. Thanks

Link to comment
Share on other sites

If you created a function to select the last model number in the products table and add 1 to it, you could then default the model number to this when adding a new product.

 

Example:

 

If you created a new function: tep_get_new_model

 

You could edit /admin/categories.php and insert the value where I have it marked below:

   } elseif ($HTTP_GET_VARS['action'] == 'new_product') {

   if ( ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) {

     $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'");

     $product = tep_db_fetch_array($product_query);



     $pInfo = new objectInfo($product);



   } elseif ($HTTP_POST_VARS) {

     $pInfo = new objectInfo($HTTP_POST_VARS);

     $products_name = $HTTP_POST_VARS['products_name'];

     $products_description = $HTTP_POST_VARS['products_description'];

     $products_url = $HTTP_POST_VARS['products_url'];

   } else {

     $pInfo = new objectInfo(array());

     // WebMakers.com Added: Insert default values here

     $pInfo->products_model= tep_get_new_model();

   }

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...