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

I see a couple of general questions that I can offer some help to.

 

The contribution is a vehicle to bypas osC's normal (laborious) method for entering Product Attributes, once the attribute are added into the products_attributes table it all works the same therefore, if formulas did't work before (and they don't) they won't work after you install this contribution because this part is practically unchanged. That is, when displaying a product you still see the product's options just as before that is because I purposely left that as much as possible unchanged, I just "shunted" one step of the whole process.

 

In step 6, which is optional, all I did was add this "order by" clause at the end of the query.

 

order by pov.products_options_values_id

 

If you don't want it sorted by products_options_values_id then change it to whatever field you want, just make sure it is in the right table.

Link to comment
Share on other sites

Really great hack :) Am installing it at the moment.

 

Are you planning to put an 'edit' button in there in future?

 

Am working on a mobile phone shop and need to be able to change prices for each handset depending on tariff...

The prices for each handset seem to change very often.

 

Cheers!!

Edited by Tim|EVO
Link to comment
Share on other sites

Very useful contribution. However, in order to install version 3, you have to have version 2.1 installed and to upgrade to latest update, you have to install all the other versions first!!

 

My bro, the life is already too complicated, why try to make it even worse? Can you release a version upgrade which doesn't require all these pre-installations? Think of version 4 which will need version 2 and 3 to be installed first.

 

I don't want to sound disgraceful, but I guess it will be much easier if you put one full contribution together for each version rather than leaving it to hundreds of OSC users who like your contribution to take a chance and try to figure out the things themselves.

 

It is especially makes it too hard for those of us who want to install the contribution on a live and busy site and have to go through all these installation steps.

 

Keep up the good work.

Link to comment
Share on other sites

I noticed a typo in the AttributeSets_npe_update_v3.txt file that will prevent the proper installation of the update from working.

 

The code that is in question is:

CREATE TABLE `products_attributes_sets_values` (
 `products_attributes_sets_id` int(6) NOT NULL default '0',
 `products_attributes_languages` int(11) NOT NULL default '0',
 `products_attributes_sets_name` varchar(30) NOT NULL default '',
 KEY `products_attributes_sets_id` (`products_attributes_sets_id`),
 KEY `products_attributes_language` (`products_attributes_language`)
) TYPE=MyISAM;

 

When trying to execute this query in phpMyAdmin I received a key column error that products_attributes_language was not a column in this table. I payed careful attention and noticed that indeed the column is created as products_attributes_languages (notice the s at the end) but the line defining it as a key column refers to it as products_attributes_language. I double-checked queries later in the file and found they refer to this column as _languages, so here's how the code should appear in the file:

 

CREATE TABLE `products_attributes_sets_values` (
 `products_attributes_sets_id` int(6) NOT NULL default '0',
 `products_attributes_languages` int(11) NOT NULL default '0',
 `products_attributes_sets_name` varchar(30) NOT NULL default '',
 KEY `products_attributes_sets_id` (`products_attributes_sets_id`),
 KEY `products_attributes_languages` (`products_attributes_languages`)
) TYPE=MyISAM;

 

Hopefully this will help alleviate some frustration for others who stumbled upon this and help correct the error.

Edited by jamieC
Link to comment
Share on other sites

Has anyone tried to use "Attribute Sets" with the "Add Weight to Product Attribute" contribution? We need to add weight to our attributes and we need to use the attribute sets to make it easier for bulk product configuration, but as it stands we currently can only add weight to the attributes manually for each option on each product or use phpMyAdmin to update the products table. If anyone has merged these two contributions and would be willing to share, we would greatly appreciate it. Otherwise it looks like I will be trying to do the deed myself at some point.

Edited by jamieC
Link to comment
Share on other sites

Added this contribution today, V2.0, and when in the admin screen, and click Attribute Sets, I get this message:

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/empirewe/public_html/catalog/admin/includes/functions/database.php:13) in /home/empirewe/public_html/catalog/admin/includes/functions/database.php on line 13 I am not sure as to what went wrong with the install.... Will have to look over the file database.php and see what is up..... but anyone who had this come up, could ya point me in the right direction?

Empire Metal Art

Link to comment
Share on other sites

Hi webgoddess,

 

Check categories.php for syntax errors, especially around line 100. I use synEdit to edit/view source code (syn.sourceforge.net) which provides line numbers and color-coded syntax checking.

 

I remember I had a couple of similar errors, including categories.php, and it turned out to be the lines of code included in the installation instructions contained errant quotation marks or something to that effect. I wish I could remember exactly what I had to fix but I was in such a rush to meet a deadline that I just did it and that was that.

Edited by jamieC
Link to comment
Share on other sites

Added this contribution today, V2.0, and when in the admin screen, and click Attribute Sets, I get this message:

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/empirewe/public_html/catalog/admin/includes/functions/database.php:13) in /home/empirewe/public_html/catalog/admin/includes/functions/database.php on line 13 I am not sure as to what went wrong with the install.... Will have to look over the file database.php and see what is up..... but anyone who had this come up, could ya point me in the right direction?

Anyone able to help me out? I've been thru all the installation instructions and still haven't figured this out... It comes up when trying to load the products_attributes_sets.php file, when clicking the Attribute Sets link in the admin catalog area.... Any help will be appreciated....

 

Thanks

RJ

Empire Metal Art

Link to comment
Share on other sites

Well, I think I figured it out...... In the 2.0 installation, there was no products_attributes_sets.php file in the zip that was to go into the includes/laguages/english folder.... I d/l'ed the first version and put that file in and it worked... so far.... but cannot edit the attributes like I believe you were supposed to be able to do.... Not sure if there's something missing or what.... If anyone can give me the 2 files and where they are to go, I will give it a shot...

Empire Metal Art

Link to comment
Share on other sites

rjdj2000, there is yet another mistake in the latest update that might be causing you trouble here. The file that is supposed to go into admin/includes/languages/english is actually located in the unzipped file in admin/includes/english. I used that file and everything works fine for me.

Edited by jamieC
Link to comment
Share on other sites

Thanks Jamie,

 

I d/l'ed the earlier version before the last release of it and put the file it had in there. So far everything is working... The only thing with these contributions is that I wish when someone adds something that they would take the time to make the installation part of it a little bit easier for those of us who don't know php and other stuff. Like this one for instance, there is a bunch of changes and to follow everything right, you're better off starting with the first mod then going thru all of them to get it going.. lol.. RJ

Empire Metal Art

Link to comment
Share on other sites

Hi Joey ,

Thanks for the great mod .. I just found a small problem .

I created Attribute set and assigned it to product . After assigning I edited Attribute set to add more rows . it worked fine .. But its not showing the changes in drop down on product page . If I edit the product itself . the changes are appearing .. Is this a Bug or something wrong with my assumption that any changes in Attribute set should reflect the assigned product . Please advice

Many Thanks

Aali

Link to comment
Share on other sites

Followed the directions for version 2.0 of Jul 31 2004.

 

Everything ran fine until trying to add a new product. Then I get 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 ',,'')' at line 1

 

insert into products_attributes (products_id, options_id, options_values_id, options_values_price, price_prefix) values (3,,,,'')

 

[TEP STOP]

 

Anyone here who has an idea of where to look to fix the error?

 

Thank you in advance!!!

Link to comment
Share on other sites

I have installed the Attribute set contribution, it has been working just fine, until today i created a set with 69 diffrent selections in it. I added it to the product, and when i try to upload the product I get 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 ''')' at line 1

 

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

 

[TEP STOP]

 

Anu Ideas on how to fix this would be appreciated

Link to comment
Share on other sites

First of all, I'm sorry to see so many problems. I'll try to help out any way I can.

 

I saw the screen shots and I like the changes. I also took a look at the new instructions and I agree that they should have been re-written to stand alone. I was confused with all the commented out code.

 

Any way, this is what it is all about, a community help each other out so I'll try to help out but what will help is if you get an error on line ##, it would be helpful to post about 5 lines before that point and about 5 line after that point to see enough code to be useful. Please don't post the whole file, that is just too much code to look at.

 

Joey

Link to comment
Share on other sites

dredwiser :

 

If you are adding that many options to the attribute sets then you need to change the data type for the following field, products_attributes_sets_value. Instead of varchar(255) change the type to Text using a database interface tool such as phpMyAdmin. Select the right database, then select the products_attributes_sets table and show the structure for this table and change the data type for that field from varchar(255) to Text which has the ability to handle attributes with MANY options. The default, varchar(255) maxes out around 40, possibly sooner.

 

I hope this helps.

Link to comment
Share on other sites

Dear all!

 

I have gotten a couple of emails with suggestions to browse the forum for assistance. THAT DOESN'T HELP ME!

 

The error that I am getting (shown below) is DIFFERENT from all the other errors that LOOKS like 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 1

 

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

 

[TEP STOP]

 

As far as I understand though, the problem might relate to how many options are in the attribute set.

I have created an option for colors, and there are 23 colors in there as of now. More to come? I am not sure!

These are all put into one Attribute Set (one drop-down if you will), and it's here the SQL is making it's hickups according to posts on similar cases.

I am not a SQL-kinda-guy, but do have access to the SQL through phpMyAdmin - any suggestions on what to do in there to fix this problem?

 

I don't see the problem until trying to add a new product. Everything appears fine until I hit Insert - then the code above comes on the screen.

What's worse is that it actually ads the image to my site, but when you click on it, it doesn't exist. Furthermore, when attempting to locate it via the admin console, it doesn't exist in there either. BUT the picture is STILL on my front page of osCommerce...

 

H E L P P L E A S E

Edited by daniaw
Link to comment
Share on other sites

rjdj2000:

 

Ouch! You're right, the file catalog/admin/includes/languages/english/products_attributes_sets.php was missing.

 

If you installed this and see names like this:

HEADING_TITLE

TEXT_CHOOSE_OPTION

TEXT_CHOOSE_SET_SIZE, etc....

 

It is because this file is missing.

 

Since this file is small, I'll post the entire contents here. This file didn't change from my previous versions to my last so the immediate previous version should have the right file.

 

Here is the content of the file called "products_attributes_sets.php" in the above path.

 

<?php
/*
 $Id: mail.php,v 1.8 2002/01/18 17:28:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('HEADING_TITLE', 'Attribute Sets');
define('TEXT_CHOOSE_OPTION', 'Option Name:');
define('TEXT_CHOOSE_SET_SIZE', 'Set Size:');
define('TEXT_SELECT_OPTION', 'Select Option');
define('TEXT_ALL_OPTIONS', 'All Options');
define('ERROR_NO_OPTION_SELECTED', 'Error: No option has been selected.');
define('ERROR_NO_SET_SIZE', 'Error: A set size was not specified.');
define('ERROR_NO_ATTRIBUTE_SET_NAME', 'Error: Attribute Name was not assigned.');
define('NOTICE_ATTRIBUTE_CREATED', 'Attribute Set created successfully.');
?>

Link to comment
Share on other sites

daniaw:

 

Use phpMyAdmin and select the database that your store uses, it should have about 50+ tables in it.

 

What is the name of the Attribute Set that is giving you problems?

 

I'm not sure which version of phpMyAdmin you have but when you select the products_attributes_sets table then select the Browse link.

 

Post the value for that Attribute Set that is giving you problems, it should look something like this:

 

2/4/+/0_2/5/+/0_2/6/+/0_2/7/+/0_2/8/+/2_2/9/+/3_2/10/+/4

 

The underscores separate each option, so in this example there are 7 drop-down options, each separated by an underscore. As you can see how lon this values gets with just 7 options, can you imagine how long it gets with 70?

 

This is why you WILL have to change the data type for this field, products_attributes_sets_value, from varchar(255) to Text. To change this select the Structure link next to the Browse link and then select the Change link at the end of the row you want to change. From the drop-down list select Text where it shows VARCHAR.

 

 

 

Good luck.

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