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

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?

Link to comment
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!

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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

Link to comment
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

Link to comment
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 !

Link to comment
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?

Link to comment
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?

Link to comment
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

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

Attributes Sets Plus v.1.0 re-released

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

 

Apologies for any confusion - I have responded by mail/message to any that contacted me about it.

 

The contribution can now be found here:

 

http://www.oscommerce.com/community/contributions,3610 with a link to a new support thread.

 

regards

Chris.

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...