ubur Posted July 27, 2006 Share Posted July 27, 2006 I am using Mass Attributes and am having some trouble. I like the contribution, just need some help. The contribution automatically names the attribute set you create as just "Options" So I have about 130 items all with an attribute set of "Options". This gets really confusing. Here is the code for those not familiar with Mass Attributes (this is massattributes.php by he way) <? require('includes/application_top.php'); $languages = tep_get_languages(); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> </table></td> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <? //--- Did we submit the attribute changes? if(isset($_POST[updateattributes])){ //I think im going to just delete all the old crap and re-insert cause I don't know how this script works yet~! $deleteattributes=mysql_query("DELETE FROM products_attributes WHERE products_attributes.products_id='$_GET[current_product_id]'"); if(!$deleteattributes) die(mysql_error()); $deleteattributelinks=mysql_query("DELETE FROM products_attributes WHERE products_attributes.products_id='$_GET[current_product_id]'"); if(!$deleteattributelinks) die(mysql_error()); $addanewoption=mysql_query("INSERT INTO products_options (language_id,products_options_name) VALUES ('1','Options')"); $optionid=mysql_insert_id(); $attributes = explode("\n", $_POST[prod_attributes]); foreach($attributes AS $key => $value){ if($value!=""){ $addnewoptionvalue=mysql_query("INSERT INTO products_options_values (language_id,products_options_values_name) VALUES ('1','$value')"); if(!$addnewoptionvalue) die('Damn you suck at coding. Trying to add new option value.<br><br>'.mysql_error()); $optionvalueid=mysql_insert_id(); $linkvaluewithoption=mysql_query("INSERT INTO products_options_values_to_products_options (products_options_id,products_options_values_id) VALUES ('$optionid','$optionvalueid')"); if(!$linkvaluewithoption) die('Damn you suck at coding. Trying to add link value with option.<br><br>'.mysql_error()); $linkattributewithproduct=mysql_query("INSERT INTO products_attributes (products_id,options_id,options_values_id ) VALUES ('$_GET[current_product_id]','$optionid','$optionvalueid')"); if(!$linkattributewithproduct) die('Damn you suck at coding. Trying to link attribute with product.<br><br>'.mysql_error()); } } echo "You have successfully updated the attributes for this product.<br> <a href=\"java script:history.go(-2)\">Click here to return.</a>"; die(); } //--- First we see if we even have any attributes for this product yet $getattributes=mysql_query("SELECT * FROM products_attributes,products_options,products_options_values WHERE products_attributes.products_id='$_GET[current_product_id]' AND products_options.products_options_id=products_attributes.options_id AND products_options_values.products_options_values_id=products_attributes.options_v alues_id ORDER BY products_options_values.products_options_values_name"); $oldattributes=""; while($attribute=mysql_fetch_array($getattributes)){ $oldattributes="$oldattributes"."$attribute[products_options_values_name]"."\n"; } echo " <table cellspacing=0 cellpadding=4> <tr><td colspan=2><h2>Mass Attributes</h2></td></tr> <form action=massattributes.php?action=select¤t_product_id=$_GET[current_product_id]&cPath=$_GET[cPath] method=post> <tr><td colspan=2><textarea cols=30 rows=25 name=prod_attributes>$oldattributes</textarea></td></tr> <tr><td><input type=submit name=updateattributes value='Save Changes'></td> <td><a href=\"java script:history.back()\">Cancel</a></td></tr> </table></form>"; ?> </table></TD> </TR> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Is there a simple fix so that instead of naming it "Options" it uses the Products name??? This would be a huge help if it could be. I would think you could just do something where it tells it to name the new set "Options", that you could change that to say echo product_name, or something. I am not a programmer. Thank you so much in advance, I really appreciate any help anyone can provide. Cory Quote Link to comment Share on other sites More sharing options...
ubur Posted July 31, 2006 Author Share Posted July 31, 2006 Any ideas? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 31, 2006 Share Posted July 31, 2006 try changing $addanewoption=mysql_query("INSERT INTO products_options (language_id,products_options_name) VALUES ('1','Options')"); to $addanewoption=mysql_query("INSERT INTO products_options (language_id,products_options_name) VALUES ('1',tep_get_products_name($_GET['current_product_id']) )"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.