Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute Sets Contribution


Recommended Posts

  • Replies 659
  • Created
  • Last Reply

Top Posters In This Topic

Joey,

 

This looks like a fantastic contrib, but before I dive in I had a quick question. My site is register_globals off. The instructions on the contrib state:

 

ASSUMPTION: register_globals setting is enabled.

 

Are there additional steps I should include. I did read your preface on register_globals, but wasn't sure if I was required to make changes to the subsequent code.

 

Thank you

 

Tim

Link to comment
Share on other sites

Hi,

 

I've installed "Attribute Sets" but I'm getting the following error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ',,'',1)' at line 1

 

insert into products_attributes (products_id, options_id, options_values_id, options_values_price, price_prefix, sort_order) values (31,,,,'',1)

 

[TEP STOP]

Any ideas?

 

Thanks Rowie.

 

 

Can some please help me with this problem=)? i still cannot figure this out >.< forgive me i dont know much about computers~~ thank you :'(

Link to comment
Share on other sites

Can some please help me with this problem=)? i still cannot figure this out >.< forgive me i dont know much about computers~~ thank you :'(

When you created the attribute set, did you select all the "Remove set element"c heck marks to the right? If so, that is your problem, this feature removes the attribute when checked and if you check all of them you will get that UGLY

"1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

error.

I hope this helps!

Link to comment
Share on other sites

Please provide more specific information.

 

Thanks.

 

Joey

Dear Joe, just wanted to let you know that your application is working perfect after I figured out that I could not select all the "Remove Set Element" check boxes. If someone, like me, will select all of them because I missunderstud and thougth that I have to select them, then they will get the 1064 blah blah error. Perhaps it would be better to label the check boxes "Remove Element", the Set in "Remove Set Element" is missleading.

Thanks for your contribution!

Link to comment
Share on other sites

Thanks for the tip!

 

It is hard for me to find these bugs because I only use one Attribute Set per product, but most people seems to have more.

 

Thanks.

 

Joey

 

 

Dear Joe, just wanted to let you know that your application is working perfect after I figured out that I could not select all the "Remove Set Element" check boxes. If someone, like me, will select all of them because I missunderstud and thougth that I have to select them, then they will get the 1064 blah blah error. Perhaps it would be better to label the check boxes "Remove Element", the Set in "Remove Set Element" is missleading.

Thanks for your contribution!

Link to comment
Share on other sites

In the installation instructions I try to clarify what the big deal is with register_globals, I see that you read it but I need to have people use this with register_globals set to "off" so that I can perfect that fix.

 

If you see a URL that looks something like this: cPath=&pId=

Where the number is missing after the equal sign then that piece of code is assuming register_globals set to "on", but I think I changed them all. I could have easily missed something though.

 

Look at the URLs either in the address bar or when you hold your cursor over a link you'll see the URL on the status bar (lower left).

 

Good luck.

 

Joey

 

 

Joey,

 

This looks like a fantastic contrib, but before I dive in I had a quick question. My site is register_globals off. The instructions on the contrib state:

 

ASSUMPTION: register_globals setting is enabled.

 

Are there additional steps I should include. I did read your preface on register_globals, but wasn't sure if I was required to make changes to the subsequent code.

 

Thank you

 

Tim

Link to comment
Share on other sites

Alfred:

 

Why would you select "Remove Set Element" when you are creating an Attribute Set?

 

Joey

 

 

 

When you created the attribute set, did you select all the "Remove set element"c heck marks to the right? If so, that is your problem, this feature removes the attribute when checked and if you check all of them you will get that UGLY

"1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

error.

I hope this helps!

Link to comment
Share on other sites

Somehow the values from the form are not getting passed to the SQL statement. Which version of Attribute Set are you using? What is register_gloabls set to? "on" or "off"?

 

Joey

 

Can some please help me with this problem=)? i still cannot figure this out >.< forgive me i dont know much about computers~~ thank you :'(

Link to comment
Share on other sites

Joyce:

 

I'm sorry that you didn't get my contribution working. It helps of you can find yourself a PHP programmer that help you out when things get broken. I know exactly how you felt when you said you could just cry. I hate it when I get any errors!!

 

Much thanks to Chris for offering some help and encouragement, because I just can't be available all the time.

 

It would definitely be worth your while to get the Attribute Sets contribution installed becuase it will save you hours if you have to add 140 attributes to each product! It should take a savvy PHP person about 1 hour or less, but above all CREATE A BACK UP OF EVERY FILE FIRST! Too many newbies (and experienced people too) make that mistake then they ask for help (that is when they cry too) and that is the first question I ask, "Where is the back up?". If there is no backup, then I or anyone couldn't help. If they do have a backup, then all is good.

 

Good luck.

 

Joey

 

I'm so excited I just had to reply again!  I've only done the 10 scents individually so far, but all 10 show up in a dropdown box just like they're supposed to!

THANK YOU again for taking time to answer my plea for help!

Joyce

Link to comment
Share on other sites

In the installation instructions I try to clarify what the big deal is with register_globals, I see that you read it but I need to have people use this with register_globals set to "off" so that I can perfect that fix. 

 

If you see a URL that looks something like this: cPath=&pId=

Where the number is missing after the equal sign then that piece of code is assuming register_globals set to "on", but I think I changed them all.  I could have easily missed  something though.

 

Look at the URLs either in the address bar or when you hold your cursor over a link you'll see the URL on the status bar (lower left).

 

Good luck.

 

Joey

 

Joey,

 

I have this installed and all looks good. It writes the correct data to the database, no problems except on categories.php. It will not display the options. I have inserted the registerglobals debug code and got this:

 

GET

cPath -> '21_24'

pID -> '16394'

action -> 'new_product'

 

It looks like it's all there but not matching the product id with the attributes sets?

 

Maybe?

 

I have been trying to reconcile Chris's discussion about variables and wonder if there might be something with pid?

 

Thanks

 

Tim (clueless)

Link to comment
Share on other sites

Joey,

 

I have this installed and all looks good. It writes the correct data to the database, no problems except on categories.php. It will not display the options. I have inserted the registerglobals debug code and got this:

 

GET

cPath -> '21_24'

pID -> '16394'

action -> 'new_product'

 

It looks like it's all there but not matching the product id with the attributes sets?

 

Maybe?

 

I have been trying to reconcile Chris's discussion about variables and wonder if there might be something with pid?

 

Thanks

 

Tim (clueless)

 

 

Hi Tim

Your not that clueless (!!) - at least you have used the debug code - most folk don't seem to even find that!

 

For what it is worth here is my code from that file for this contrib. Bear in mind I use a 'customised' attribute sets and I also have other modifications in my code (so your line numbers are likely to be a lot less), but look for the same variables in your code and check the $POST and $GET usage. I'm thinking you will need a $_GET on the pID somewhere (maybe section 4 of 4 below?).

 

This may or may not help (I hope it doesn't confuse!). (NB The 'linkmatics' reference indicates comments by myself to delineate custom & contrib code from core osC - just ignore).

 

Hope this is some help - if it helps out do feedback to Joey in here. I did not manage to give him all the required fixes for register_globals and now my code is too different to help I'm afraid (although the basic structure is basically the same)

 

Good luck, Chris.

 

ps - Joey, I am running with something like 10 attribute sets per product, a number of which are 50 or more elements. Sets are used to created attributes automatically as around 150 products are loaded via easypopulate and results in around 40,000 products attributes. I can refresh at will - great stuff!

Thanks for the work you have put in.

cheers

Chris.

 

 

Starting Line 162 (my code)

// >>>> BOF Linkmatics attribute sets  (1 of 4) calling custom function - delete product - Begin
 jjg_db_attributeSets($_POST['products_attributes_sets_id'], $products_id, $action );
// <<<< EOF Linkmatics attribute sets calling custom function - delete product - End

Starting line 366 (my code)

// >>>> BOF Linkmatics attribute sets (2 of 4) calling custom function - update product - Begin
	 $arr_pas = array();
	 $arr_remove_sets = array();
	 for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){
       $arr_pas[$i] = $_POST["products_attributes_sets_id_".$i];
    if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){
      $arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];
          }
    else {
      $arr_remove_sets["remove_products_attributes_sets_id_".$i] = -1;
       }
        }
     jjg_db_attributeSets( $arr_pas, $products_id, $action, $arr_remove_sets );

// <<<< EOF Linkmatics attribute sets - calling custom function - update product - End

 

Starting line 847 (my code)

// >>>> BOF Linkmatics attributes sets (3 of 4) - building attributes array - Begin
   $attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE));
   $attribute_sets_names_array = array();
   $attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name");
   while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) {
     $attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'],
                                    'text' => $attribute_sets['products_attributes_sets_name']);
     $attribute_sets_names_array[ $attribute_sets['products_attributes_sets_id'] ] = $attribute_sets['products_attributes_sets_name'];
   }
// <<<< EOF Linkmatics attributes sets (3 of 4) - building attributes array - End

 

Starting line 962 (my code) -- I seem to remember a problem in here, maybe to do with needing a $_GET .... e.g: if( isset($_GET['pID']) ){

 

<?php // >>>> BOF Linkmatics attributes edit (4 of 4) - building list of Attribute Sets Used - Begin ?>
<?php


if( empty($pInfo->products_id) ){

    $iteration = 0;

}else{

           $getOptionsCount_query = tep_db_query('SELECT count(
           DISTINCT  products_attributes_sets_id ) as count
           FROM  '. TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .'
           WHERE  `products_id`  ='.$pInfo->products_id);


    $arr_getOptionsCount = tep_db_fetch_array($getOptionsCount_query);

    $arr_pas_id = jjg_db_getAttributeSetId($pInfo->products_id);
    if( !empty($arr_pas_id) ){

        $iteration = $arr_getOptionsCount['count'];

    }
}

for($i=0; $i <= $iteration; $i++){
?>
         <tr>
           <td class="main">
           <?php
          	 if( isset($_GET['pID']) ){
              	 if( $i == $iteration  ){
                 echo "Add An " . TEXT_PRODUCTS_ATTRIBUTES_SET;
                   }else{
                 echo "Using " . TEXT_PRODUCTS_ATTRIBUTES_SET;
                   }
          	 }

           ?>
           </td>
           <td class="main">
          	 <?php
          	 if(isset($_GET['pID']) ){
             if( $i == $iteration ){
            	 echo tep_draw_separator('pixel_trans.gif', '30', '1').
                       '<a href="' . tep_href_link(
                       FILENAME_PRODUCTS_ATTRIBUTES_SETS_EDIT, 'pID='.$_GET['pID']) .
                       '" >'. tep_image_button('button_add_as.gif',
                       '[Click To Add And A.S.]' )  .'</a>';
             }else{
            	 echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ';
            	 echo $attribute_sets_names_array[$arr_pas_id[$i]];
            	 echo tep_draw_separator('pixel_trans.gif', '24', '15');
            	 echo tep_draw_checkbox_field('remove_products_attributes_sets_id_'.$i);
            	 echo "<font size=-3>(Remove Set)</font>";
            	 echo tep_draw_hidden_field('products_attributes_sets_id_'.$i,
                       $arr_pas_id[$i]);
             }
               }
           ?>

           </td>
         </tr>
<?php
}
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?>
           <?php echo tep_draw_hidden_field('AttributeSetCount', $arr_getOptionsCount['count']+1); ?>
           </td>
         </tr>
<?php // >>>> EOF Linkmatics attributes edit (4 of 4) -  building list of Attribute Sets Used - End ?>

Link to comment
Share on other sites

Hi Tim

Your not that clueless (!!) - at least you have used the debug code - most folk don't seem to even find that!

 

For what it is worth here is my code from that file for this contrib. Bear in mind I use a 'customised' attribute sets and I also have other modifications in my code (so your line numbers are likely to be a lot less), but look for the same variables in your code and check the $POST and $GET usage. I'm thinking you will need a $_GET on the pID somewhere (maybe section 4 of 4 below?).

 

This may or may not help (I hope it doesn't confuse!). (NB The 'linkmatics' reference indicates comments by myself to delineate custom & contrib code from core osC - just ignore).

 

Hope this is some help - if it helps out do feedback to Joey in here. I did not manage to give him all the required fixes for register_globals and now my code is too different to help I'm afraid (although the basic structure is basically the same)

 

Good luck, Chris.

 

ps - Joey, I am running with something like 10 attribute sets per product, a number of which are 50 or more elements. Sets are used to created attributes automatically  as around 150 products are loaded via easypopulate and results in around 40,000 products attributes. I can refresh at will - great stuff!

Thanks for the work you have put in.

cheers

Chris.

Starting Line 162 (my code)

// >>>> BOF Linkmatics attribute sets ?(1 of 4) calling custom function - delete product - Begin
?jjg_db_attributeSets($_POST['products_attributes_sets_id'], $products_id, $action );
// <<<< EOF Linkmatics attribute sets calling custom function - delete product - End

Starting line 366 (my code)

// >>>> BOF Linkmatics attribute sets (2 of 4) calling custom function - update product - Begin
?	$arr_pas = array();
?	$arr_remove_sets = array();
?	for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){
? ? ? ?$arr_pas[$i] = $_POST["products_attributes_sets_id_".$i];
? ? if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){
? ? ? $arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];
? ? ? ? ? }
? ? else {
? ? ? $arr_remove_sets["remove_products_attributes_sets_id_".$i] = -1;
? ? ? ?}
? ? ? ? }
? ? ?jjg_db_attributeSets( $arr_pas, $products_id, $action, $arr_remove_sets );

// <<<< EOF Linkmatics attribute sets - calling custom function - update product - End

 

Starting line 847 (my code)

// >>>> BOF Linkmatics attributes sets (3 of 4) - building attributes array - Begin
? ?$attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE));
? ?$attribute_sets_names_array = array();
? ?$attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name");
? ?while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) {
? ? ?$attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => $attribute_sets['products_attributes_sets_name']);
? ? ?$attribute_sets_names_array[ $attribute_sets['products_attributes_sets_id'] ] = $attribute_sets['products_attributes_sets_name'];
? ?}
// <<<< EOF Linkmatics attributes sets (3 of 4) - building attributes array - End

 

Starting line 962 (my code) -- I seem to remember a problem in here, maybe to do with needing a $_GET ....  e.g: if( isset($_GET['pID']) ){

 

<?php // >>>> BOF Linkmatics attributes edit (4 of 4) - building list of Attribute Sets Used - Begin ?>
<?php
if( empty($pInfo->products_id) ){

? ? $iteration = 0;

}else{

? ? ? ? ? ?$getOptionsCount_query = tep_db_query('SELECT count(
? ? ? ? ? ?DISTINCT ?products_attributes_sets_id ) as count
? ? ? ? ? ?FROM ?'. TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .'
? ? ? ? ? ?WHERE ?`products_id` ?='.$pInfo->products_id);
? ? $arr_getOptionsCount = tep_db_fetch_array($getOptionsCount_query);

? ? $arr_pas_id = jjg_db_getAttributeSetId($pInfo->products_id);
? ? if( !empty($arr_pas_id) ){

? ? ? ? $iteration = $arr_getOptionsCount['count'];

? ? }
}

for($i=0; $i <= $iteration; $i++){
?>
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="main">
? ? ? ? ? ?<?php
? ? ? ? ? ?	if( isset($_GET['pID']) ){
? ? ? ? ? ? ? ?	if( $i == $iteration ?){
? ? ? ? ? ? ? ? ?echo "Add An " . TEXT_PRODUCTS_ATTRIBUTES_SET;
? ? ? ? ? ? ? ? ? ?}else{
? ? ? ? ? ? ? ? ?echo "Using " . TEXT_PRODUCTS_ATTRIBUTES_SET;
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ?	}

? ? ? ? ? ??>
? ? ? ? ? ?</td>
? ? ? ? ? ?<td class="main">
? ? ? ? ? ?	<?php
? ? ? ? ? ?	if(isset($_GET['pID']) ){
? ? ? ? ? ? ?if( $i == $iteration ){
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '30', '1').
? ? ? ? ? ? ? ? ? ? ? ?'<a href="' . tep_href_link(
? ? ? ? ? ? ? ? ? ? ? ?FILENAME_PRODUCTS_ATTRIBUTES_SETS_EDIT, 'pID='.$_GET['pID']) .
? ? ? ? ? ? ? ? ? ? ? ?'" >'. tep_image_button('button_add_as.gif',
? ? ? ? ? ? ? ? ? ? ? ?'[Click To Add And A.S.]' ) ?.'</a>';
? ? ? ? ? ? ?}else{
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ';
? ? ? ? ? ? ?	echo $attribute_sets_names_array[$arr_pas_id[$i]];
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '24', '15');
? ? ? ? ? ? ?	echo tep_draw_checkbox_field('remove_products_attributes_sets_id_'.$i);
? ? ? ? ? ? ?	echo "<font size=-3>(Remove Set)</font>";
? ? ? ? ? ? ?	echo tep_draw_hidden_field('products_attributes_sets_id_'.$i,
? ? ? ? ? ? ? ? ? ? ? ?$arr_pas_id[$i]);
? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?}
? ? ? ? ? ??>

? ? ? ? ? ?</td>
? ? ? ? ?</tr>
<?php
}
?>
? ? ? ? ?<tr>
? ? ? ? ? ?<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?>
? ? ? ? ? ?<?php echo tep_draw_hidden_field('AttributeSetCount', $arr_getOptionsCount['count']+1); ?>
? ? ? ? ? ?</td>
? ? ? ? ?</tr>
<?php // >>>> EOF Linkmatics attributes edit (4 of 4) - ?building list of Attribute Sets Used - End ?>

 

Chris,

 

I can almost taste it

 

I changed 2 "isset($pID)" references to this

isset($HTTP_GET_VARS['pID'] (because this was the reference throughout) in the line around 962

 

I now get the Add An Attribute line on categories

 

When I hit the link, all okay, save okay, but does not update

Link to comment
Share on other sites

Hi Tim

Your not that clueless (!!) - at least you have used the debug code - most folk don't seem to even find that!

 

For what it is worth here is my code from that file for this contrib. Bear in mind I use a 'customised' attribute sets and I also have other modifications in my code (so your line numbers are likely to be a lot less), but look for the same variables in your code and check the $POST and $GET usage. I'm thinking you will need a $_GET on the pID somewhere (maybe section 4 of 4 below?).

 

This may or may not help (I hope it doesn't confuse!). (NB The 'linkmatics' reference indicates comments by myself to delineate custom & contrib code from core osC - just ignore).

 

Hope this is some help - if it helps out do feedback to Joey in here. I did not manage to give him all the required fixes for register_globals and now my code is too different to help I'm afraid (although the basic structure is basically the same)

 

Good luck, Chris.

 

ps - Joey, I am running with something like 10 attribute sets per product, a number of which are 50 or more elements. Sets are used to created attributes automatically  as around 150 products are loaded via easypopulate and results in around 40,000 products attributes. I can refresh at will - great stuff!

Thanks for the work you have put in.

cheers

Chris.

Starting Line 162 (my code)

// >>>> BOF Linkmatics attribute sets ?(1 of 4) calling custom function - delete product - Begin
?jjg_db_attributeSets($_POST['products_attributes_sets_id'], $products_id, $action );
// <<<< EOF Linkmatics attribute sets calling custom function - delete product - End

Starting line 366 (my code)

// >>>> BOF Linkmatics attribute sets (2 of 4) calling custom function - update product - Begin
?	$arr_pas = array();
?	$arr_remove_sets = array();
?	for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){
? ? ? ?$arr_pas[$i] = $_POST["products_attributes_sets_id_".$i];
? ? if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){
? ? ? $arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];
? ? ? ? ? }
? ? else {
? ? ? $arr_remove_sets["remove_products_attributes_sets_id_".$i] = -1;
? ? ? ?}
? ? ? ? }
? ? ?jjg_db_attributeSets( $arr_pas, $products_id, $action, $arr_remove_sets );

// <<<< EOF Linkmatics attribute sets - calling custom function - update product - End

 

Starting line 847 (my code)

// >>>> BOF Linkmatics attributes sets (3 of 4) - building attributes array - Begin
? ?$attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE));
? ?$attribute_sets_names_array = array();
? ?$attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name");
? ?while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) {
? ? ?$attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => $attribute_sets['products_attributes_sets_name']);
? ? ?$attribute_sets_names_array[ $attribute_sets['products_attributes_sets_id'] ] = $attribute_sets['products_attributes_sets_name'];
? ?}
// <<<< EOF Linkmatics attributes sets (3 of 4) - building attributes array - End

 

Starting line 962 (my code) -- I seem to remember a problem in here, maybe to do with needing a $_GET ....  e.g: if( isset($_GET['pID']) ){

 

<?php // >>>> BOF Linkmatics attributes edit (4 of 4) - building list of Attribute Sets Used - Begin ?>
<?php
if( empty($pInfo->products_id) ){

? ? $iteration = 0;

}else{

? ? ? ? ? ?$getOptionsCount_query = tep_db_query('SELECT count(
? ? ? ? ? ?DISTINCT ?products_attributes_sets_id ) as count
? ? ? ? ? ?FROM ?'. TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .'
? ? ? ? ? ?WHERE ?`products_id` ?='.$pInfo->products_id);
? ? $arr_getOptionsCount = tep_db_fetch_array($getOptionsCount_query);

? ? $arr_pas_id = jjg_db_getAttributeSetId($pInfo->products_id);
? ? if( !empty($arr_pas_id) ){

? ? ? ? $iteration = $arr_getOptionsCount['count'];

? ? }
}

for($i=0; $i <= $iteration; $i++){
?>
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="main">
? ? ? ? ? ?<?php
? ? ? ? ? ?	if( isset($_GET['pID']) ){
? ? ? ? ? ? ? ?	if( $i == $iteration ?){
? ? ? ? ? ? ? ? ?echo "Add An " . TEXT_PRODUCTS_ATTRIBUTES_SET;
? ? ? ? ? ? ? ? ? ?}else{
? ? ? ? ? ? ? ? ?echo "Using " . TEXT_PRODUCTS_ATTRIBUTES_SET;
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ?	}

? ? ? ? ? ??>
? ? ? ? ? ?</td>
? ? ? ? ? ?<td class="main">
? ? ? ? ? ?	<?php
? ? ? ? ? ?	if(isset($_GET['pID']) ){
? ? ? ? ? ? ?if( $i == $iteration ){
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '30', '1').
? ? ? ? ? ? ? ? ? ? ? ?'<a href="' . tep_href_link(
? ? ? ? ? ? ? ? ? ? ? ?FILENAME_PRODUCTS_ATTRIBUTES_SETS_EDIT, 'pID='.$_GET['pID']) .
? ? ? ? ? ? ? ? ? ? ? ?'" >'. tep_image_button('button_add_as.gif',
? ? ? ? ? ? ? ? ? ? ? ?'[Click To Add And A.S.]' ) ?.'</a>';
? ? ? ? ? ? ?}else{
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ';
? ? ? ? ? ? ?	echo $attribute_sets_names_array[$arr_pas_id[$i]];
? ? ? ? ? ? ?	echo tep_draw_separator('pixel_trans.gif', '24', '15');
? ? ? ? ? ? ?	echo tep_draw_checkbox_field('remove_products_attributes_sets_id_'.$i);
? ? ? ? ? ? ?	echo "<font size=-3>(Remove Set)</font>";
? ? ? ? ? ? ?	echo tep_draw_hidden_field('products_attributes_sets_id_'.$i,
? ? ? ? ? ? ? ? ? ? ? ?$arr_pas_id[$i]);
? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?}
? ? ? ? ? ??>

? ? ? ? ? ?</td>
? ? ? ? ?</tr>
<?php
}
?>
? ? ? ? ?<tr>
? ? ? ? ? ?<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?>
? ? ? ? ? ?<?php echo tep_draw_hidden_field('AttributeSetCount', $arr_getOptionsCount['count']+1); ?>
? ? ? ? ? ?</td>
? ? ? ? ?</tr>
<?php // >>>> EOF Linkmatics attributes edit (4 of 4) - ?building list of Attribute Sets Used - End ?>

 

Chris,

 

I can almost taste it

 

I changed 2 "isset($pID)" references to this

isset($HTTP_GET_VARS['pID'] (because this was the reference throughout) in the line around 962

 

I now get the Add An Attribute line on categories

 

When I hit the link, all okay, save okay, but does not update

 

I get this on the success page ( my registerglobals info )

 

GET

action -> 'save'

products_id -> '16394'

cPath -> '21_24'

----------

POST

attSetId_0 -> '1'

attSetId_1 -> '2'

asRowCount -> '2'

x -> '35'

y -> '16'

 

Thinking I have to change some POST lines I go back

and add

$HTTP_POST_VARS to

 

if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){

$arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];

 

But no go. Any ideas?

Link to comment
Share on other sites

Alfred:

 

Why would you select "Remove Set Element" when you are creating an Attribute Set?

 

Joey

Good question! I selected them simply because....

1: the are there to be selected

2: I assumed that the checkmark has to be selected for the element to be set.

 

I think there is a slight language difference problem, if you'll label the checkmark as "Remove element" it would be absolutely clear that the checkmark is to be selected if you like to delete it, on the other hand "Set element" means to enable an element to be used.

Link to comment
Share on other sites

I made these two changes because I too am having the same issues. The Add A.S. button now shows up on the edit product page. But when I click the button I receive this error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

 

SELECT * FROM products_description where products_id=

 

So obviously the pID is getting sent as it shows in the navigation bar of IE:

http://mysite.com/admin/products_attribute...s_edit.php?pID=

 

Any ideas...I'll provide any help I can...just not sure where to look.

 

Thanks Ryan

 

 

Chris,

 

I can almost taste it

 

I changed 2 "isset($pID)" references to this

isset($HTTP_GET_VARS['pID']    (because this was the reference throughout) in the line around 962

 

I now get the  Add An Attribute line on categories

 

When I hit the link, all okay, save okay, but does not update

 

I get this on the success page ( my registerglobals info )

 

GET

action -> 'save'

products_id -> '16394'

cPath -> '21_24'

----------

POST

attSetId_0 -> '1'

attSetId_1 -> '2'

asRowCount -> '2'

x -> '35'

y -> '16'

 

Thinking I have to change some POST lines I go back

and add

$HTTP_POST_VARS  to

 

if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){

  $arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];

 

But no go. Any ideas?

rkoechel2004

Link to comment
Share on other sites

What I meant to say was the pID is NOT getting passed

 

 

 

So obviously the pID is getting sent as it shows in the navigation bar of IE:

http://mysite.com/admin/products_attribute...s_edit.php?pID=

 

Any ideas...I'll provide any help I can...just not sure where to look.

 

Thanks Ryan

rkoechel2004

Link to comment
Share on other sites

I made these two changes because I too am having the same issues.  The Add A.S. button now shows up on the edit product page.  But when I click the button I receive this error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

 

SELECT * FROM products_description where products_id=

 

So obviously the pID is getting sent as it shows in the navigation bar of IE:

http://mysite.com/admin/products_attribute...s_edit.php?pID=

 

Any ideas...I'll provide any help I can...just not sure where to look.

 

Thanks Ryan

 

Well, either you have not managed to post the pID - (which means you missed a $_POST addition [or need to change an HTTP_POST_VARS to a $_POST] in file categories.php, see previous post) OR you need a $_GET in the select shown in your error (in attributes_sets_edit.php). From your post I think it is most likely the former. (Hint - what do you see in your browser status bar when you hover over the AS icon?)

 

If you can't find it paste the register_globals debug code as instructed in the register_globals contribution fix file (can't remember what its called).

Uncomment the lines for the $_POST and $_GET functions [as instructed in file] so you can see what is going on. The values of these vars will be displayed at the top of your admin page.

 

You can then find out for sure if it is a GET or POST var you are missing that results in an empty string in your select (hence highly upset MySql).

 

Hope that's not too confusing - gotta run.

 

C.

Link to comment
Share on other sites

Ok-

 

So here is what I get from the debug code on categories.php when editing an existing product. with both get and post uncommented

----------

GET

cPath -> ''

pID -> '286'

action -> 'new_product'

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/u2/fontanasports/html/catalog/admin/includes/application_top.php:7) in /home/u2/fontanasports/html/catalog/admin/includes/functions/sessions.php on line 68

 

when hovering over the add a.s. button I get:

catalog/admin/products_attributes_sets_edit.php?pID=

 

On products_attributes_sets_edit.php I get from the debug code, with both get and post uncommented:

----------

GET

pID -> ''

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/u2/fontanasports/html/catalog/admin/includes/application_top.php:7) in /home/u2/fontanasports/html/catalog/admin/includes/functions/sessions.php on line 68

 

 

If I add or delete attribute sets from the small circle a.s icon everything works fine. The only time it doesn't save my attribute sets is when I try doing so by clicking the add a.s button when editing a product. The sets I select will not be saved.

 

Well, either you have not managed to post the pID - (which means you missed a $_POST addition [or need to change an HTTP_POST_VARS to a $_POST] in file categories.php, see previous post) OR you need a $_GET in the select shown in your error (in attributes_sets_edit.php). From your post I think it is most likely the former. (Hint - what do you see in your browser status bar when you hover over the AS icon?)

 

If you can't find it paste the register_globals debug code as instructed in the register_globals contribution fix file (can't remember what its called).

Uncomment the lines for the $_POST and $_GET functions [as instructed in file] so you can see what is going on. The values of these vars will be displayed at the top of your admin page.

 

You can then find out for sure if it is a GET or POST var you are missing that results in an empty string in your select (hence highly upset MySql).

 

Hope that's not too confusing - gotta run.

 

C.

Edited by rkoechel2004

rkoechel2004

Link to comment
Share on other sites

I recently installed Options as Images contribution. It seemed to be working fine with the Attribute Sets contribution. Now all of a sudden my options are displayed in the reverse order to what I am setting them as in the Attribute Sets manager.

 

This is really bizarre and I don't see what i can do to correct it. Any ideas?

Link to comment
Share on other sites

I thought everything was going fine, and all was working well until I got to: /catalog/checkout_shipping.php

 

Upon clicking "checkout" I received

 

Warning: Missing argument 2 for attributes_price() in /catalog/includes/classes/shopping_cart.php on line 251

 

Warning: Cannot modify header information - headers already sent by (output started at /catalog/includes/classes/shopping_cart.php:251) in /catalog/includes/functions/general.php on line 29

 

Line 251 of /includes/classes/shopping_cart.php begins with:

function attributes_price($products_id, $products_price) {
     $attributes_price = 0;

     if (isset($this->contents[$products_id]['attributes'])) {
       reset($this->contents[$products_id]['attributes']);
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
         $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
         $attribute_price = tep_db_fetch_array($attribute_price_query);
         if ($attribute_price['price_prefix'] == '+') {
             $attributes_price += $attribute_price['options_values_price'];
         } elseif ($attribute_price['price_prefix'] == '-') {
             $attributes_price -= $attribute_price['options_values_price'];
         } elseif ($attribute_price['price_prefix'] == '*') {
             $attributes_price = ($products_price * $attribute_price['options_values_price'])-$products_price;
         }
       }
     }

     return $attributes_price;
   }

 

Line 29 of /includes/functions/general.php begins with:

header('Location: ' . $url);

   tep_exit();

 

What am I missing?

Link to comment
Share on other sites

I forgot also that I am using

=================================

Product Accessory Multiplier v1.0

=================================

 

which modified the code above from:

vi catalog/includes/classes/shopping_cart.php

find: // attributes price
replace:
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }
with:
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } elseif ($attribute_price['price_prefix'] == '-') {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } elseif ($attribute_price['price_prefix'] == '*') {
             $this->total = $this->total * $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }

find: function attributes_price
replace:
   function attributes_price($products_id) {
     $attributes_price = 0;

     if (isset($this->contents[$products_id]['attributes'])) {
       reset($this->contents[$products_id]['attributes']);
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
         $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
         $attribute_price = tep_db_fetch_array($attribute_price_query);
         if ($attribute_price['price_prefix'] == '+') {
           $attributes_price += $attribute_price['options_values_price'];
         } else {
           $attributes_price -= $attribute_price['options_values_price'];
         }
with:

   function attributes_price($products_id, $products_price) {
     $attributes_price = 0;

     if (isset($this->contents[$products_id]['attributes'])) {
       reset($this->contents[$products_id]['attributes']);
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
         $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
         $attribute_price = tep_db_fetch_array($attribute_price_query);
         if ($attribute_price['price_prefix'] == '+') {
             $attributes_price += $attribute_price['options_values_price'];
         } elseif ($attribute_price['price_prefix'] == '-') {
             $attributes_price -= $attribute_price['options_values_price'];
         } elseif ($attribute_price['price_prefix'] == '*') {
             $attributes_price = ($products_price * $attribute_price['options_values_price'])-$products_price;
         }

find:         $products_array[] = array('id' => $products_id,
replace: 
 'final_price' => ($products_price + $this->attributes_price($products_id)),
with:
'final_price' => ($products_price + $this->attributes_price($products_id, $products_price)),

 

I am not sure if this is causing the problem??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...