Jump to content
Sign in to follow this  
joeyjgarcia

Attribute Sets Contribution

Recommended Posts

It seems to me that the lines you specify all run together... you used CODE to layout your problem but it should look like this:

// Attribute Sets 5.5
 function jjg_db_attributeSets($arr_attributeSetID, $productID, $action, $arr_remove_sets = array(), $link = 'db_link'){

	 //remove all references to this product_id in these tables, and reinsert new ones
	 if( $action == 'update_product' || 'delete_product_confirm' ){
   $delete_query = "delete from products_attributes where products_id=".$productID;
   tep_db_query($delete_query, $link);
   $delete_query = "delete from products_attributes_sets_to_products where products_id=".$productID;
   tep_db_query($delete_query, $link);
	 }
//if you remove the product, then our work is done
	 if( $action == 'delete_product_confirm' ){
   return;
	 }


	 for($j=0; $j<count($arr_attributeSetID); $j++){

   if( empty($arr_attributeSetID[$j]) ){
       continue;
   }
 if( in_array($arr_attributeSetID[$j], $arr_remove_sets) ){
       continue;
 }


 $select_query = "select products_attributes_sets_value
       FROM ". TABLE_PRODUCTS_ATTRIBUTES_SETS .
 " WHERE products_attributes_sets_id=".$arr_attributeSetID[$j];

 $products_attributes_sets_query = tep_db_query($select_query, $link);

 $products_attributes_sets_resultset = tep_db_fetch_array($products_attributes_sets_query);
 $products_attributes_sets_value = $products_attributes_sets_resultset['products_attributes_sets_value'];

 $arrPASV = split("_",$products_attributes_sets_value);

 for($i=0; $i<count($arrPASV); $i++){
     $attribSet = $arrPASV[$i];
     $arrAtom = split("/",$attribSet);

     $valOptions_id = $arrAtom[0];
     $valOptions_values_id = $arrAtom[1];
     $valOptions_values_price = $arrAtom[3];
     $valPrice_prefix = $arrAtom[2];
     if( count($arrAtom)  == 5 ){
    	 $valSort_Order = $arrAtom[4];
     }else{
    	 $valSort_Order = "1";
     }
     //$valPrice_prefix = $action;

     $insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES .
     " (products_id, options_id, options_values_id, options_values_price, price_prefix, sort_order) values ".
     " (".$productID.",".$valOptions_id.",".$valOptions_values_id.",".$valOptions_values_price.",'".$valPrice_prefix."',".$valSort_Order.")";
     tep_db_query($insert_query, $link);
 }

 $insert_query = "insert into ".TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .
 " (products_attributes_sets_id, products_id) values (".$arr_attributeSetID[$j].",".$productID.")";
 tep_db_query($insert_query, $link);
       }
 }


 function jjg_db_getAttributeSetId($productID, $link = 'db_link'){
	 $arr_result = array();
	 if( !empty($productID) ){
    $select_query = "select products_attributes_sets_id from products_attributes_sets_to_products where products_id=".$productID;
    $products_attributes_sets_query = tep_db_query($select_query, $link);

        $i=0;
        while($rs = tep_db_fetch_array($products_attributes_sets_query) ){
         $arr_result[$i] = $rs['products_attributes_sets_id'];
         $i++;
        }
  	 }

  	 return $arr_result;
 }
// end Attribute Sets 5.5

I'm just taking a guess here but it looks like it is skipping over important lines because the comments run on the same line (eg - //if you remove the product, then our work is done if( $action == 'delete_product_confirm' ){ return; } for($j=0; $j) SO, the //'s are actually commenting out that entire line. They should only be commenting out "If you remove the product, then our work is done" and there should be a line break. Hope this gives you some help.

 

DRIVE

 

hey i have a huge error message that displays.....

 

function jjg_db_attributeSets($arr_attributeSetID, $productID, $action, $arr_remove_sets = array(), $link = 'db_link'){ //remove all references to this product_id in these tables, and reinsert new ones if( $action == 'update_product' || 'delete_product_confirm' ){ $delete_query = "delete from products_attributes_sets_to_products where products_id=".$productID; tep_db_query($delete_query, $link); } //if you remove the product, then our work is done if( $action == 'delete_product_confirm' ){ return; } for($j=0; $j
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/chronix/public_html/shop/admin/includes/functions/database.php:153) in /home/chronix/public_html/shop/admin/includes/functions/sessions.php on line 67

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/chronix/public_html/shop/admin/includes/functions/database.php:153) in /home/chronix/public_html/shop/admin/includes/functions/sessions.php on line 67

Then if you click to go into any of the admin sections you get this error in the section as well as the error above;

 

Parse error: parse error, unexpected '<' in /home/chronix/public_html/shop/admin/includes/boxes/catalog.php on line 28

 

How do i fix this problem?

Share this post


Link to post
Share on other sites

Wow... seems everyone's got their own issues... and out of 29 pages, I think I saw one person with my promblem, but got complety lost in the shuffle trying to keep up with the responses and the posts to the question.

 

So I'm sorry if this is a dup... and if you can point me to the solution, it would be greatly appreciated!

 

Here's the problem...

 

Trying to add NEW PRODUCTS. Everything is great until I enter INSERT and i get this:

 

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

 

delete from products_attributes where products_id=

 

[TEP STOP]

 

Thanks!

Share this post


Link to post
Share on other sites

Perhaps you made a mistake in admin/categories.php?

 

If you made a backup and you can try again. I thought I had the contrib installed correctly, but I ran into a problem deleting products. Re-doing categories.php fixed it.

Share this post


Link to post
Share on other sites
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

delete from products_attributes where products_id=

[TEP STOP]

 

I had a similar message on a couple different options in admin. It turns out it's related to the recent server change which changed versions of MYSQL. I don't know if this will help but it immediately fixed my troubles.

 

1064 Error

 

Lauren

Share this post


Link to post
Share on other sites

I am receiving this error even though I have installed the latest updated mod

 

Fatal error: Call to undefined function: jjg_db_getattributesetid() in /pathto/teststore/admin/categories.php on line 555

Share this post


Link to post
Share on other sites

Wow - this contrib is amazing!

 

I do have one question though: While you can easily change or delete an option from an attrib set, is there a way to add an extra option?

Share this post


Link to post
Share on other sites

Hi,

 

This contribution looks great but, probably I am stupid I don't understand how to install it :

 

Why is there to install file (look different ?)

 

How to create and alter table (I don't find attributesets.sgl) ?

 

I need some explanations ?

 

thanks for your help

 

Philippe

Share this post


Link to post
Share on other sites

Hi,

 

After some effort I understood everything and installed this contribution.

 

In the administration part, everything look OK. I set up some attribute set . works well. I can go to product and define some set to each product but unfortunatly, when I go to the shop, (to check if everything appears .... ) I don't see any option in the product info !

 

Does somebody could tell where I have to look to find my mistake ?

 

Hope to get some answer.

 

Thanks

 

Philippe

Share this post


Link to post
Share on other sites
check to make sure you made the correct edits in product_info.php

 

 

I did, it seems OK.

When I try to give attribute set for a product, at the end of the procedure, I get the seems with the 2 option

1- edit the product info (if I do it, i got a message "the file was not transfered)

2- going back to the catalog (if I do it it seems OK)

 

But after, going to the table I can see that (in the table product attribute) that no attribute was given to the porduct ... it seems that the problem is there but i don't know how to fix it !

 

Thanks for your help

 

Philippe

Share this post


Link to post
Share on other sites

I am totaly stuck now !

 

I study forums and look for a solution all the day ... and I see also that I don't get the button "add an AS " when I edit a product.

 

So, the attribute are not going in the table and I don't get the button add an AS !!

 

I look the code all the days but I didn't see any mystake.

 

Fews days ago, I download a contribution to fix the problem with "global register off".

 

i also used an other contribution to add some field in the product info

 

Is one of those uncompatible ?

 

In witch files I have to look to find my mistake ?

 

Please help !

Share this post


Link to post
Share on other sites

Hi, Joey Garcia

There have a Bug in Attribute Sets 5.5,I couldn't select Attribute Sets when I creat a new product,but I could select Attribute Sets when I edit old product.

Please help me !

 

Thanks!

:(

Share this post


Link to post
Share on other sites
--- Installation and Configuration Instructions ---

 

Step 1. Create the two new tables needed for this contribution and alter one table.

Two tables that will be created are: products_attributes_sets, products_attributes_sets_to_products

The one table that is altered is: products_attributes

 

Use the AttributeSets.sql file to create these two tables and alteration.

 

attributesets.sql was not included?

Share this post


Link to post
Share on other sites
does it fix the options sort issue for the product info page?

please be more specific with your question. What issue?

I don't think Joey's contribution sorts the options - or is that what you mean by an issue?

Share this post


Link to post
Share on other sites
Hi, Joey Garcia

There have a Bug in Attribute Sets 5.5,I couldn't select Attribute Sets when I creat a new product,but I could select Attribute Sets when I edit old product.

Please help me !

 

Thanks!

:(

 

The logic is as follows:

 

- create your option

- create your attributes set(s)

 

create your product

THEN

edit your product

 

Currently you cannot add sets to a product that does not yet exist. You must create it then edit to add the sets. This is true with Attributes Sets Plus as well.

 

regards

Chris

Share this post


Link to post
Share on other sites

 

Yes the sorting of the individual elements of an ATTRIBUTES SET is fully functional in Attributes Sets Plus. I was not aware it was a problem on the old version. It looks like a problem with the select, or it could be the old register_globals issue..?. Many bits were fixed in the new version but not documented during the development process.

 

There are NO reported issues with a correctly installed Attributes Sets Plus.

___________________

 

I would add the new version was created with Joey's agreement at every step (see some of my earlier posts to confirm this, although most of discussion was off line) - Joey apologies that he is no longer able to help support as he is too busy. I think with the new version support will be less required anyway.

 

I cannot help support the old version any longer (other than from memory) as I no longer have it.

 

 

regards

 

Chris.

Edited by Johnson

Share this post


Link to post
Share on other sites
attributesets.sql was not included?

 

 

nevermind this, i downloaded the wrong file.

 

when i tried installation, i got an error when it came to adding the set to an item, i don't have the particular error on hand, i had to restore the shop cause there were people waiting on me to add new stuff...

 

 

 

 

deleted, impropoer content. :blush:

Edited by Mibble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×