Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Populate & Products Attributes


VJ

Recommended Posts

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

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)

}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Hello Don,

 

1. This is not really a limitation of this code, but you could try my latest code update, which has this option to handle just the product models and attributes. That would probably save a few columns. If you still have excess columns, you could try to hack the code to make it handle 1 language or 1 attrib set, at a time (just a thought!).

 

2. Well, attributes are not actually assigned to every single product. Attributes are assigned to a product, only if the corresponding value price cell contains a "non-empty" value. Otherwise, the attribute options/values are listed beside each product, but are not assigned to them.

 

If you think your tab-delimited file is messed up in any way, you could email it to me (just make sure you zip or tgz it... I'm on a slow dial-up :().

 

HTH,

VJ

Link to comment
Share on other sites

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.

 

Well, it turned out to be quite easy, in the end. Just comment out this line in easypopulate.php, and it works just fine in MS1 :).

 

require(includes/database_tables.php); // comment this line

 

VJ

Link to comment
Share on other sites

I've been getting feedback from folks who have a lot of product attributes, that leads to the tab-delim file exceeding 256 columns (which is the max. column limit for most worksheet programs).

 

I've now added an option to download only selected product attribute options. For example, if you have the options - Colour, Size, Model, you'll now be able to select any particular option(s) to download (say, Colour and Model).

 

Look out for this configuration directive line, in easypopulate.php and make necessary changes:

 

global $attribute_options_select;
//$attribute_options_select = array('Size', 'Model');

 

You can download the latest easypopulate.php, here.

 

Keep your feedback coming, and thanks to all folks who've offered ideas/feedback :-).

 

VJ

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