Jump to content



* * * * - 16 votes

Easy Populate & Products Attributes


  • Please log in to reply
9009 replies to this topic

#1   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 07 November 2003 - 09:22 AM

Hello,

I'd been working on getting easypopulate to handle product attribs, and managed to achieve something functional. I haven't tested the code extensively yet, but it should theoretically be capable of handling any number of product options, option values, and languages.

This is still beta code, and I haven't put it up as a contribution yet. If anyone is interested in giving this a try (at their own risk!), you can download my easypopulate.php file, and a sample tab-limited file (from an 'out-of-the-box' osc product list), here.

Please try this on a test osc setup, before you even think about using it in your "live" store. And in any case, BACKUP your database.

This code was developed and tested with EP version '2.62-MS2' on oscommerce 2.2-MS2.

Here's an overview of the system. Hope its not confusing as it looks, and  makes some sense :).  


FIELD STRUCTURE
-----------------------

1. v_attribute_options_id_1
        v_attribute_options_name_1_1
        v_attribute_options_name_1_2
        .
        .
        .
        v_attribute_values_id_1_1
        v_attribute_values_price_1_1
            v_attribute_values_name_1_1_1
            v_attribute_values_name_1_1_2
            .
            .
            .
        v_attribute_values_id_1_2
        v_attribute_values_price_1_2
            v_attribute_values_name_1_2_1
            v_attribute_values_name_1_2_2
            .
            .
            .
        .
        .
        .

2. v_attribute_options_id_2
        v_attribute_options_name_2_1
        v_attribute_options_name_2_2
        .
        .
        .
        v_attribute_values_id_2_1
        v_attribute_values_price_2_1
            v_attribute_values_name_2_1_1
            v_attribute_values_name_2_1_2
            .
            .
            .
        v_attribute_values_id_2_2
        v_attribute_values_price_2_2
            v_attribute_values_name_2_2_1
            v_attribute_values_name_2_2_2
            .
            .
            .
        .
        .
        .
.
.
.    	

where, 

1. v_attribute_options_id_x

  x = a count, beginning from 1, and incrementing by 1

This column contains the options ID (each option ID must be unique).


2. v_attribute_options_name_x_y

  x = count (same as above)
  y = count and language id . This means, language id must correspond to the count, begin on 1, and increment by 1. 

For example, 

correct language id structures include, 

  English (ID = 1), German (ID = 2) and Spanish (ID = 3)
  English (ID = 1) and French (ID = 2)

and the system most likely won't work with the following language id structures, 

  English (ID = 2) and German (ID = 3)
  French (ID = 2)


So basically, if you're using 3 languages (say, English, German and French) make sure their language ids begin with 1, and increment by 1, without jumping values. 

This column contains the option name (in each language).
 

3. v_attribute_values_id_x_y

  x = corresponding option count
  y = option values count, beginning from 1, and incrementing by 1

This column contains the option value ID (each option value ID must be unique).


4. v_attribute_values_price_x_y

  x = corresponding option count
  y = option values count

This column contains the "signed" price. If non-empty, attribute value is added to the product. 


5. v_attribute_values_name_x_y_z

  x = corresponding option count
  y = corresponding option values count
  z = count and language id . This means, language id must correspond to the count, begin on 1, and increment by 1 (please see description for v_attribute_options_name_x_y).




HOW IT WORKS
--------------------

Basically, if the field "v_attribute_values_price_x_y" is not empty for a product row, the corresponding attribute is added to that product. Example non-empty values include,

0 (zero) = just the attribute is added (there's no special price)
11.50 = attribute is added, with price value 11.50, and price prefix '+'
-9.30 = attribute is added, with price value  9.30, and price prefix '-'

You'll also be able to add product options/option values, modify option/option value names.


VJ

Edited by VJ, 07 November 2003 - 09:24 AM.


#2   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 10 November 2003 - 05:47 PM

Hello,

I've added a code patch, that now enables removal of product attributes linked to a product. You can download the new code here.

Currently working on testing and improving language support. I'd be glad if anyone could help me test this code. You can email me at - vj (at) vjdom (dot) com. Remember, this is experimental code, and you'd need a dev store setup give it a try.

VJ

#3   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 11 November 2003 - 05:16 PM

Two more code fixes...

1. Now able to handle product attribute options/option values, that are not linked to any products. Earlier, only attrib options/option values that are linked to products were handled.

2. Redesigned the language specific sections of the code. Now able to handle language ids lot better. The language specific fields should now be,

v_attribute_options_name_x_y, where x = options count, and y = language id (earlier, this was a count beginning from 1)
v_attribute_values_name_x_y_z, where x = options count, y = option values count, and z = language_id (changes, same as above)

You can download the updated code, here.

If anyone has given this a try, I'd be happy to hear if this actually works! Today, I managed to test it with a set of 60 different attribute values, and it did handle it OK (the output file was huge, though) :).


VJ

#4   lango

lango
  • Members
  • 77 posts
  • Real Name:paul langford
  • Location:UK

Posted 11 November 2003 - 05:57 PM

VJ.

I have to say you deserve one BIG pat on the back.
I have been testing this for approx 4 days know and no problems.

Now with the ability to delete as well, Excellent.

Just one thing..
I have tried but failed on this
Can you advise or DO
Add a seperate link to just download model number and attributes  only.

I have done it for the mopics but can't figure out the attributes.

I can't Belive no one else has downloaded and installed this.
There are so many ltopics asking for this very thing

If you have.. Come on Guys give VJ some feedback.

#5   ryno267

ryno267
  • Members
  • 45 posts
  • Real Name:Chuck
  • Location:127.0.0.1

Posted 11 November 2003 - 06:28 PM

roger that....  I'm downloading but wont be able to install for a little while as I"m not starting this project yet.. but i'm tracking this topic and will respond back...

Thanks and great job VJ !!

#6   nfc2001

nfc2001
  • Members
  • 1 posts
  • Real Name:N F

Posted 12 November 2003 - 01:00 AM

Hello,

I want to test this, but I've already made changes to the original easypopulate.php. Can you create a diff for the changes you made, or something like that ?

Thanks,

NF

#7   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 12 November 2003 - 07:26 AM

Quote

Just one thing..
I have tried but failed on this
Can you advise or DO
Add a seperate link to just download model number and attributes only.

Yes, this is something I would like to work on. I'm sure it'd make things easier to maintain, especially with these new attribute fields, getting added.

Thanks so much for all your feedback and comments :).

VJ

#8   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 12 November 2003 - 07:29 AM

Quote

I want to test this, but I've already made changes to the original easypopulate.php. Can you create a diff for the changes you made, or something like that ?

I haven't worked on a diff file for the changes, as of yet. You can try this, though....

1. Download my easypopulate.php, here.
2. You can identify my code additions - they're all within these tags "// VJ product attribs begin" and "// VJ product attribs end" (there should be 3 sets of them).
3. Now, paste them exactly in their corresponding positions, in your already modified easypopulate.php file.

Please make sure if I have replaced any existing code. And in any case, BACKUP your existing file.

HTH,
VJ

#9   richlewt

richlewt
  • Members
  • 202 posts
  • Real Name:Rich Lewt
  • Location:UK

Posted 15 November 2003 - 07:32 AM

Hi
I wonder if someone could lend a little help. I have dowloaded the tab del file and all uploads ok but i am struggling to get it to work with my cart. Could someone please explain a simple example that uses 1 language, 1 option with say 2 values i.e. english, size, small and medium.
What fields do you have to use and what values needs to go in these fields? Given this simple example would help novices understand how this great contribution works.
Thanks for any help.
thanks
Rich
"May the seam be with you"

#10   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 15 November 2003 - 11:32 AM

Quote

I wonder if someone could lend a little help. I have dowloaded the tab del file and all uploads ok but i am struggling to get it to work with my cart. Could someone please explain a simple example that uses 1 language, 1 option with say 2 values i.e. english, size, small and medium.
What fields do you have to use and what values needs to go in these fields? Given this simple example would help novices understand how this great contribution works.

Yes. Here's a simple example.

These are the fields you would require, to add an option (Size), with 2 values (Small, Medium).

1. v_attribute_options_id_1 -> this field contains the attribute option id (make sure you don't use an id that already exists in the database)

where, "1" is a count, which starts from 1 and increments by 1.

2. v_attribute_options_name_1_1 -> contains the option name (eg: Size)

where, the first "1" is the corresponding options count (you would use v_attribute_options_name_2_1, for v_attribute_options_id_2)
and, the second "1" is the language id

3. v_attribute_values_id_1_1 -> contains attribute option value id (again make sure you don't use an existing id)

where, first "1" is the option id, this value is linked with
and, second "1" is a count (starting from 1, and incrementing by 1)

4. v_attribute_values_price_1_1 -> contains price difference for option value with suffix 1_1 (this is a signed value, you may use '-' or '+' before the price value)

5. v_attribute_values_name_1_1_1 -> contains attrib option value name (eg: Small)

where, first and second 1's are the corresponding option value suffixes
and, third "1" is the language id


So, basically this is how your table would look:

v_attribute_options_id_1 => 1

v_attribute_options_name_1_1 => Size (assuming "1" is the language id for English, in your store)

v_attribute_values_id_1_1 => 1

v_attribute_values_price_1_1 => -20.00

v_attribute_values_name_1_1_1 => Small

v_attribute_values_id_1_2 => 2

v_attribute_values_price_1_2 => 0.00

v_attribute_values_name_1_2_1 => Medium (again, assuming "1" for English)


HTH,
VJ

#11   richlewt

richlewt
  • Members
  • 202 posts
  • Real Name:Rich Lewt
  • Location:UK

Posted 15 November 2003 - 06:25 PM

Hi VJ
Many thanks for that example and demo, I can now see how it goes together and have a working copy :-)
Great contribution, probably one of the biggest time savers yet released!!
thanks
Rich
"May the seam be with you"

#12   niknakgroup

niknakgroup
  • Members
  • 686 posts
  • Real Name:Tony Blacker
  • Location:Ipswich, UK

Posted 17 November 2003 - 11:28 PM

Hi VJ

Just to let you know, have tried your add on extensively, and am happy to report that in a beta site with 3000 products, running 42 different attributes (took a little while to set up!!), with up to 25 active on any given product, this works flawlessly!! Just need to remind the peeps using it that obviously the database output is quite a bit heavier - I had to cut all of my files down to 80 products at a time to get them uploaded.

As you have sussed this one so completely, could I pick your brains, as mine are a bit muddled from looking at computer scripting that I dont really understand that well! I have added the X-Sell mod, is there a simple way of adding this into the easypopulate function as well? would be another massive timesaver, and I am certain there must be other peeps out there who would appreciate this too.

Once again though, amazing add on to the excellent easypopulate contribution, cannot thank you enough! :D  :D  :D  :D
Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....
Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....
if (stumped == true) {
return(square_one($start_over)
} else {
$random_query = tep_fetch_answer($forum_query)
}

#13   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 18 November 2003 - 02:04 PM

I've now added an option to download and handle just the product model/attributes. You can download the updated easypopulate.php file, here.

The code is almost out of beta stage now, and should be ready to be added in the contribs section, in a few days (just needs a bit more cleaning up and testing).

Thanks for all your feedback and comments :).

VJ

#14   chfields

chfields
  • Members
  • 1,272 posts
  • Real Name:Craig
  • Location:Florida,USA

Posted 18 November 2003 - 02:20 PM

I have a question....If i install this on an existing site and then download will it include the attributes already assigned to my products??

#15   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 18 November 2003 - 05:10 PM

Quote

I have a question....If i install this on an existing site and then download will it include the attributes already assigned to my products??

Yes, it will.

VJ

#16   ruta

ruta
  • Members
  • 31 posts
  • Real Name:ruta

Posted 19 November 2003 - 12:24 PM

What about this mod+Linda's SEC?

#17   chfields

chfields
  • Members
  • 1,272 posts
  • Real Name:Craig
  • Location:Florida,USA

Posted 20 November 2003 - 02:18 AM

I like this new mod, however, I have one problem. My products and their attributes are running on MS1 and while I managed to get all the products moved from MS1 to MS2 using EP, your new one is not MS1 compatible. Any chance of you making one that is compatible with both MS1&2. I would like to be able to download the attributes from MS1 and upload to MS2.

Thanks

#18   VJ

VJ
  • Members
  • 173 posts
  • Real Name:VJ
  • Gender:Male

Posted 20 November 2003 - 12:25 PM

Quote

I like this new mod, however, I have one problem. My products and their attributes are running on MS1 and while I managed to get all the products moved from MS1 to MS2 using EP, your new one is not MS1 compatible. Any chance of you making one that is compatible with both MS1&2. I would like to be able to download the attributes from MS1 and upload to MS2.

Yes, I'm working towards acheiving something similar... download products from MS1, and upload to MS2.

I'll post my progress on this thread.... stay tuned!

VJ

#19   chfields

chfields
  • Members
  • 1,272 posts
  • Real Name:Craig
  • Location:Florida,USA

Posted 20 November 2003 - 12:37 PM

Thanks, your great work is appreciated!!

#20   chique

chique
  • Members
  • 23 posts
  • Real Name:Don
  • Location:Netherlands

Posted 21 November 2003 - 12:09 PM

Thank you VJ for this great contribution, i have implented your EP file in my own, and it's working !! I only have one great problem. When I Create a Complete tab-delimited .txt file in temp dir, and open it in excel there are 2 problems.

1) The file is to large to import in excel, not all the atributes and catagories are showed.

2)All the atributes are assigned to every single product,  so say I have a dress in small, medium and large. Now all the other atributes are there as well in the excel file, so now I have a dress with S,M,L,XL,RED,BLUE,WHITE,34,36,38, S/M,M/L,L/XL ......and it go's on. So now I have reached the maximum imported column in excel. (256 pc).

Fore your information: I have EP version '2.62-MS2' on oscommerce 2.2-MS2. I also have installed the contribution new_attributes_v4b (that's the contribution witch I used to add atributes so far.


My question: are there some counts or something else witch I should adjust ??
When you want to check my Ep file, I will be glad to send it to you.


Thank you fot this great contribution, I can't wait to see this work properly!

Greetings Don.
My Webpage