Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute Sets Contribution


Recommended Posts

Tired of adding each Attribute for each Option Drop Down List? Yeah, me too! This is why I created this contribution.

 

Here is how it works:

Create an Attribute Set by clicking "Attribute Sets" in the Catalog are of your osCommerce Administration. Select an Option Name (e.g., Sizes, Colors, Memory, etc...). Then select how many item in the Option Drop Down list you need (e.g. if you list is for Sizes you may need a list size of 3 for Small, Medium, Large). Then you click Ok. The next page you will have three attribute rows that you can set values for, then give this Attribute Set a name. That's it.

 

Now when you edit an existing product or when you create a new product you just select which set you want this product to have.

 

You will have to create your own Options and Option Values, but you will never have to ever use that Product Attribute page again. :-)

 

All this contribution does is insert rows into the products_attributes table, so it is compatiable with your site now. The only thing you'll have to do is when you edit a product, set it to use an Attribute Set, if it needs a drop-down list in the online catalog, otherwise leave it set to "-- none --".

 

 

You can find this contribution at: http://www.oscommerce.com/community/contributions,2201

 

 

I developed this contribution with osCommerce 2.2 MS2.

 

I only use 1 language, English so I don't know how it would work with other languages but I'd be willing to work with someone if they want to improve on this first version to make it multi-language compatiable.

Edited by joeyjgarcia
Link to comment
Share on other sites

  • Replies 659
  • Created
  • Last Reply

Top Posters In This Topic

Hey Joey

 

Good to see the contrib online man.

 

It's really useful and thanks for asking me to test it out while you were playing around with the codes B)

 

You probably made a 10% programmer outta me :D

 

Cheese

--- DontheCat ---

 

Obviously the truth is what's so

Not so obviously, it's also so what.

Link to comment
Share on other sites

Parse error: parse error, unexpected T_ELSEIF in /mnt/web_g/d47/s36/b01f2394/www/store/nfoscomm/catalog/admin/categories.php on line 646

 

lines 640 to 650

 

      </tr>
     <tr>
       <td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
     </tr>
   </table></form>
<?php
 } elseif ($action == 'new_product_preview') {
   if (tep_not_null($HTTP_POST_VARS)) {
     $pInfo = new objectInfo($HTTP_POST_VARS);
     $products_name = $HTTP_POST_VARS['products_name'];
     $products_description = $HTTP_POST_VARS['products_description'];

 

 

Where did I go wrong.... Please help!

Link to comment
Share on other sites

I have managed to install this update. Ok so where is the delete attribute set button? I put in a test one and now I want to delete it! What if I make a set with 3 options in it but later on I want to change it to 5? What if I want to go beyond the initial 10?

Link to comment
Share on other sites

:blink: Good question! I didn't add in that feature (shoot!, just when I thought I was done. :( ). I'll have to think about that one and add it in, just give me some time to get it done.

 

Keep the feedback coming and I'll see what I can add in version 1.1 when it comes out.

 

Joey

Edited by joeyjgarcia
Link to comment
Share on other sites

The easiest way would be to select that row in the database's table for products_attributes_sets and select that row and click the "Delete" link to remove that Attribute Set.

 

Also, if you want a drop-down list that has many options then you may have to make your products_attributes_sets_value field in the products_attributes_sets table larger than varchar(100), otherwise it will chop off the end of the products_attributes_sets_value string.

 

Also, to add more values other than 10, you could do 2 things: 1) Make the Drop-Down list larger or 2) make it a text box.

 

If you want to see what I mean when I refer to the products_attributes_sets_value see the link of the screenshots which has a picture of my table.

 

Joey

Edited by joeyjgarcia
Link to comment
Share on other sites

Now I'm getting the same error but on line 648. As well, my products are getting errors as well, but I'm assuming that it's due to the parse error that I'm getting..... I hope I can get this all fixed!

Link to comment
Share on other sites

Most of my attributes will be for birthstones, how can I make it work for the 12 months? I know that Joey explained it, but I'm totally script dumb & I'm not sure what I need to modify to make it work.

 

I'm assuming that it's rather simple & this is why I can't figure it out! I hope someone can help me out rather quickly!

 

Thanks a lot!

Link to comment
Share on other sites

Thanks for Joey's help, I've been able to get everything figured out! I think this is a great contribution wish will help me out greatly!!!!

 

Thanks Joey!

Link to comment
Share on other sites

I submitted a version 1.1 that replaces the Set Size field from a drop down list to a text box, and I increased a field in the products_attributes_sets table from a varchar(100) to varchar(255) which is as large as a varchar can get. Each drop down list option requires 8 characters in the products_attributes_sets_values field. Therefore, a list with 5 items in the list will require at least 40 characters (8x5=40), thus 255 characters should be ample for most cases.

 

Joey

Link to comment
Share on other sites

I am planning on installing this but so I don't waste alot of time..... Does it affect product attributes that are already set? I have hundreds that I don't want to do over..

 

Also you can still increase the price of some options with this? Ex: +2 dollars for XXL

Link to comment
Share on other sites

That is a very good question! No, it doesn't effect your current products and their attributes, except if you edit a product and leave the Attribtue Set drop-down list set to "--none--". Therefore, when you edit a product set the Attribute Sets to whichever Attibute Set that product would normally use. When you add new products then you will need to set their attributes once when you initially insert the product.

 

 

Yes, you can add extra cost, and I suppose subtract costs too. All this does it it inserts the needed rows in the Product Attributes table for that product, so whatever that table does with that information is still the same, I don't touch the product_info.php page.

 

I hear your concern, I was my own guinea pig and installed it in my site when I already had a lot of products that I didn't want to re-insert.

Link to comment
Share on other sites

All you need to do is drop the sql file into your sql program. I use myphpadmin.

 

Once you do that, the tables are automatically created.

Link to comment
Share on other sites

I have a quick question - my date selection has disappeared, being replaced by the attributes section.

 

I was wondering if anyone else is having this problem & if they have fixed it.

 

Thanks a lot!

Link to comment
Share on other sites

Added an update today.

 

Description:

When editting a product that was added before this contribution the Attribute Set will be set to '--none--' because I used the original osCommerce method to make the product's attributes and if I forgot to set the Attribute Sets to some value I would end up losing the product's attributes, so I added a reminder message in the product preview so I wouldn't forget to set this value.

 

Changes from version 1.1:

Step 6 is the only new change from the previous version. This step adds a pink Warning at the top of the page when previewing a product if there is an Attribute Set left set to '--none--'. This message will also show the total number of Attribute Sets used for the current product.

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 3

 

SELECT count(DISTINCT options_id)as count

FROM products_attributes WHERE products_id =

 

This what I get when I want to edit a product after installing this contribution, and I don't have a clue wher to search for the cause of this error.

 

Can anybody help.

Link to comment
Share on other sites

It might the missing spaces.

 

You posted:

SELECT count(DISTINCT options_id)as count
FROM products_attributes WHERE products_id =

 

My contribution has it like this:

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

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