Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

categories.php til at skrive til databasen


rasmusmp

Recommended Posts

Hello Experts

 

I hvae installed osCommerce plus many contributionen. Now I'm at a point where I can't find a contributions that solves my problem.

 

What I want:

 

Two fields in the database pr. product that can be changed from the adminmodul. The costumers shouldn't see the fields.

 

What I have done:

 

I have figured it out, that I have to make some changes to "admin/categories.php" and make two rows in "products" in the database. I have done the last part but I don't know what I have to do to "categories.php". I have tried to insert the following part around line 988:

 

		  <tr> 
		<td class="main"><?php echo TEXT_MOBILPRISER_ABONNEMENTID; ?></td> 
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('mobilpriser_abonnementid', $pInfo->mobilpriser_abonnementid); ?></td> 
	  </tr> 
	  <tr> 
		<td class="main"><?php echo TEXT_MOBILPRISER_PRODUKTID; ?></td> 
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('mobilpriser_produktid', $pInfo->mobilpriser_produktid); ?></td> 
	  </tr>

 

It have made two fields at the page where I write the productinfo. However, when I'm writing something in the fields, it wouldn't be saved in the database. Of course. I have tried plenty of other thing but then I get syntax errors and so on. And now I'm stucked because I can make my own php code. Then I'm asking you.

 

What I want answered:

 

What does I have to do to categories.php?

Are there other files that I have to make changes to? And of so, what should I do?

 

Thanks to evorybody that can get me a bit closer to the answer.

 

Regards,

Rasmus Mark Pedersen

 

Ps. Sorry for my english.

Link to comment
Share on other sites

You will need to add these two fields in many more places. They need to be included in the database queries as well. You'll need to edit the following blocks of code:

 

Around line 215:

 $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
							  'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
							  'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
							  'products_date_available' => $products_date_available,
							  'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
							  'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
							  'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),
							  'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']),
'mobilpriser_abonnementid' => tep_db_prepare_input($HTTP_POST_VARS['mobilpriser_abonnementid']),
'mobilpriser_produktid' => tep_db_prepare_input($HTTP_POST_VARS['mobilpriser_produktid'])
);

 

Around line 289:

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id, mobilpriser_produktid, mobilpriser_abonnementid from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

 

Around line 292:

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, mobilpriser_produktid, mobilpriser_abonnementid) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "', '".$product['mobilpriser_produktid']."', '".$product['mobilpriser_abonnementid']."')");

 

Around line 358:

	$parameters = array('products_name' => '',
				   'products_description' => '',
				   'products_url' => '',
				   'products_id' => '',
				   'products_quantity' => '',
				   'products_model' => '',
				   'products_image' => '',
				   'products_price' => '',
				   'products_weight' => '',
				   'products_date_added' => '',
				   'products_last_modified' => '',
				   'products_date_available' => '',
				   'products_status' => '',
					   'products_tax_class_id' => '',
				   'manufacturers_id' => '',
'mobilpriser_produktid' => '',
'mobilpriser_abonnementid' => '');

 

Around line 377:

$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, p.mobilpriser_produktid, p.mobilpriser_abonnementid from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Please note that I have not tested this, so make sure you have a backup version of your code before you make changes!

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...