Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Can I add a custom attribute form, without using built in attribute manager?

Can I add a custom attribute form, without using built in attribute manager?

Views: 5,897

Results 1 to 17 of 17
19 Feb 2010, 1:24 PM
#1
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Can I add a custom attribute form, without using built in attribute manager?

I have a product that has hundreds, maybe thousands of attributes for each product, then there are thousands of products. So the database is HUGE, and there are regular time outs when using attribute manager. Its becoming impossible to manage.

Sooooo... I am looking for idea to allow me to add in these extra fields as normal HTML form in my product info page (I can do that OK), and when the values are chosen, they are added to some text field for that product so the data carries through the checkout etc, but without having these as attributes managed in admin. So adding custom data to the product info options which get added to the product info on checkout. I wondered what may be the best way to do it.

I dont need pricing or anything for these thousands of attributes. The data can happily be stored in a text field rather than have an attribute for each one.

Thanks a lot

12 Mar 2010, 10:29 AM
#2
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

Hi

Just wondered if anyone has any ideas about this.

Thanks

23 Mar 2010, 10:38 AM
#3
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

Anyone? Anyone? Bueller?

23 Mar 2010, 11:19 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I add a custom attribute form, without using built in attribute manager?

infocom:

Anyone? Anyone? Bueller?
Rather than merely bumping your post, contrary to forum rules and just plain etiquette ...
http://www.zen-cart.com/forum/faq.php?faq=vb_faq#faq_do_and_dont

  • Don't Bump your post. If you have not gotten an answer in a reasonable amount of time. Post a reply to your own existing post with more details of what you have and haven't done to attempt to cure the problem or find answers to your questions. Try to explain it in a different way if maybe it's unclear.
    ... instead perhaps you might consider expanding on your post with some useful information?
    Ideas which may help you make your posts more meaninful: http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

Things like explaining what zany product has thousands of attributes, and anything else that could make your "need" make sense to those who have never seen your particular unique business model or situation ... those might go a long way to getting you a response which might be useful to you.

23 Mar 2010, 11:49 AM
#5
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

I dont know what else to say, I thought I explained it clearly, I did not see why knowing what attributes there are will change it... so I have explained the issue and am looking for a reply. If no one replies it is expected to ask again rather than forgot my issue, regardless of the rules. If you think there is missing info, then it is better to ask for it than ignore the question.

It is for an optical frame for a pair of glasses, in which you choose the following:-

Right Eye Sphere: ranges from -20.00 to +10.00 in 0.25 increments (so about **100 **options in the drop down)
Right Eye Axis: ranges from -8.00 to +8.00 in 0.25 increments (so about **64 **options in the drop down
Right Eye Cylinder: ranges from 0 to **180 **in increments of 1 (so 180 options in the drop down)
Left Eye Sphere: ranges from -20.00 to +10.00 in 0.25 increments (so about **100 **options in the drop down)
Left Eye Axis: ranges from -8.00 to +8.00 in 0.25 increments (so about **64 **options in the drop down
Left Eye Cylinder: ranges from 0 to **180 **in increments of 1 (so 180 options in the drop down)
Pupillery Distance: ranges from 47 to 80 in increments of 1 (so **34 **options in the drop down)
Reading Add: ranges from 0.5 to 4 in increments of 0.25 (so **15 **options in the drop down)

So that's hundreds of attributes for this product. It makes managing the attributes in Admin impossible. Then because the site sells hundreds of different optical glasses, the attributes database is huge.

It stems from the fact that even though every product needs the same attributes, the attributes are defined for each product, instead of some sort of link between a product and the attribute.

So if I can just take these options out of the Zencart Attribute manager, put in a custom HTML form in the product info page, which then adds the selected values into the product details in the shopping cart, then the other attributes we have that do affect the price becomes possible to manage.

Thanks

23 Mar 2010, 1:37 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I add a custom attribute form, without using built in attribute manager?

The only way to run a contact site is to be sure that you are on a very fast server to start with ...

Then, it helps to go through and customize the code based on pricing with the attributes in mind to turn off anything that is not really used ...

If you are having issues in the Admin, I have to wonder if the hosting provider has you on a server that is really optimized for your needs ...

I have worked on contact sites in the past, and the server is the first issue that has to be addressed as many hosting providers simply cannot handle the needs of your site ...

23 Mar 2010, 2:06 PM
#7
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

Our server is quite good actually... but its wrong to get a better server at more cost, to run a zencart site that would run just fine if we can take these attributes out of the Zwencart system and replace with a hard coded form.

Having hundreds of attributes means there are too many option name pages in Admin to manage, then when adding attributes to new products there are too many to add, the list is huge, it would take days, maybe weeks to add the attributes in Admin using the traditional method.

So I setup a "dummy" product to use with all these attrubutes so we can copy them to a new product. But there are hundreds of products without them at the momment. Using the Copy to Category to copy the attributes to a new product does not work, it timesout due to number of attributes its copying, so we have to copy to individual products so it will still take time.

I have also tried the stock by attributes add on gives an out of memory too, and becomes MASSIVE because it lists all products, and assigns each attribute a quantity, so you can image the size. But thats not a core zencart feature so not expecing you to help with that.

The problem is each product has each individual attribute assigned to it, when in theory it would be better if Zencart links a set of attributes to a product, for situations where every product has the same attributes. The DB would be small then, and quicker. But thats probably a huge change.

So having a custom form hard coded to take all these attributes out of the system and DB is probably the best option.

I will probably give it a go. All I need to do is intercept the POST values of this custom form and assign them to the "Additional Instructions" textarea. I think it should be easy, but wanted to know if anyone has any ideas before I spend time on it. If not then I will give it a go.

Thanks

23 Mar 2010, 2:26 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I add a custom attribute form, without using built in attribute manager?

infocom:

... there are too many to add, the list is huge, it would take days, maybe weeks to add the attributes in Admin using the traditional method.It could take that long to write custom coding too.
infocom:

So I setup a "dummy" product to use with all these attrubutes so we can copy them to a new product. But there are hundreds of products without them at the momment. Using the Copy to Category to copy the attributes to a new product does not work, it timesout due to number of attributes its copying, so we have to copy to individual products so it will still take time.I wouldn't be surprised that there could be some optimizing done to that section of code, since it certainly wasn't tested using several thousand attributes per product to copy at once.
infocom:

The problem is each product has each individual attribute assigned to it, when in theory it would be better if Zencart links a set of attributes to a product, for situations where every product has the same attributes. The DB would be small then, and quicker. But thats probably a huge change.Yes, a pretty big change, but perhaps the development costs are warranted in your case.

infocom:

All I need to do is intercept the POST values of this custom form and assign them to the "Additional Instructions" textarea.
Well ... putting them into the order-comments field is fine if you have only ONE product in your order. But, if you have multiple products, then you'll have a mess on your hands.
It would be better to assign a multi-line text attribute to each product, and stuff the values from your custom form into that attribute during add-to-cart. That way the information is kept with the product all the way through the order.
Just a thought.

23 Mar 2010, 2:32 PM
#9
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Can I add a custom attribute form, without using built in attribute manager?

I guess I'm not clear as to why, assuming the customer knows the value of each of those 8 parameters (and it seems she must, to choose from a dropdown) you wouldn't just have 8 attributes, each a text input box ?

23 Mar 2010, 2:35 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I add a custom attribute form, without using built in attribute manager?

I was actually wondering the same thing ... ;)

23 Mar 2010, 3:01 PM
#11
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

We could use a textbox, but it opens up error so the client wanted a drop down. I will re-suggest this option to him again as things have moved on since we built the site, hence this issue.

It would be better to assign a multi-line text attribute to each product, and stuff the values from your custom form into that attribute during add-to-cart.

Yes this would be better, I forgot the addtional info box is per checkout not product.

So either I use JQuery to replace this text box with the form I need (I just did something similar for another site) OR I need to intercept the POST and replace the textbox option with my custom form values perhaps that will work.

It wont take as long as you think for the JQuery option, but I just dont know about intercepting the form submission to replace the textbox values with the custom form values, this is the bit I am unsure of hence the question.

23 Mar 2010, 4:19 PM
#12
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Can I add a custom attribute form, without using built in attribute manager?

I'm no programmer, but it seems like it might be easier to write something that checked for invalid entries in the input box. Wouldn't stop the customer from entering a wrong value within a proper range, but neither do dropdowns.

What really surprises me is that the optical industry hasn't come up with some kind of file (XML, maybe) the doctor could email to the patient and she could send to you that contains all the required info in a standard format.

11 Apr 2010, 6:11 PM
#13
juggernaught avatar

juggernaught

New Zenner

Join Date:
Apr 2010
Posts:
8
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

How did you resolve this problem. I have a client looking for the same feature for there optical store and need a solution. Can you share what you did with me please?

11 Apr 2010, 7:47 PM
#14
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

Sorry I have not done it yet... if the client wants to try it, I will do it, then I can post what I did. But it may not be anytime soon sorry.

Although I did a similar thing with another field using JQuery. I needed a simple Date Selector to insert a date, but without having to create the options as attributes (nightmare!) so I added in a Textfield, then using JQuery I replaced this Textfield with a Date Selector. So the field name was still the same, so when the product was added to the cart, the date chosen was added as the value for the text field.

So I think I may do something similar. Create a textfield that will store the custom form data, then using JQuery OR using PHP in the attributes.php file, replace the textfield with the form fields you need, keeping the same name for it. BUt if you have multiple form fields to insert then you may need post processing on the next page (perhaps in the header.php file in the /page/ folder for the page (not sure what page)) to combine the multiple form fields.

I used JQuery on mine because I thought it easier than modifying the attributes.php file. But then a small percentage of poeple may not have Javascript enabled so may not work. I also have not done any post processing because I have only one field I am inserting.

11 Apr 2010, 8:31 PM
#15
juggernaught avatar

juggernaught

New Zenner

Join Date:
Apr 2010
Posts:
8
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

How do you suppose this site did it? Its powered by Zen Cart and pulls it off the prescription selection very nicely.

http://www.theinternetglassescompany.co.uk/index.php?main_page=product_info&cPath=92_86&products_id=785

Also if I did put in all the attributes for this and did it the "long way" how do I get it to display the attributes in a table horizontally using drop downs for both left and right eyes?

Any insight would help out immensely.

Thanks for getting back to me.

11 Apr 2010, 8:57 PM
#16
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

I read this post with some interest, because I have an aquaintance who runs a similar site (not zencart) where the customers must provide the optic parameters from their prescriptions.

They did not use ZC, but spent tens of thousands on a bespoke system.

It worked beautifully... except...

... They forgot to factor in "customer stupidity"... In more than 80% of orders, customers hade made incorrect choices for their optics.

After 6 months (and lots of returns, angry customers, etc) they abandoned the sophisticated attributes and had a simple "file upload" where the customer was required to send the prescription as a jpg, doc, pdf, rtf, gif, tif, png ... or basically ANY format that would display what the testing optometrist had written down!

12 Apr 2010, 9:17 AM
#17
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Re: Can I add a custom attribute form, without using built in attribute manager?

@juggernaught

That site has a nice way of choosiong the prescription... although I thought it a little more involved than the one I did. It seems they use Javascript to show the form and run through the options. I cannot tell if these options are taken from the Attributes system in Zencart or added as a custom field. It may be possible they added the option name and left the value to be populated by the Javascript, although not sure if thats possible. Or they added all attributes in the normal way, and just override the standard Zencart form with a custom Javascript one.

This is a product on the site I did with prescriptions (Click the Add Prescription button to show the form):
http://www.fashioneyewear.co.uk/dg/dgdd1103b-p-148.html?cPath=2_24

So the way I did it is adding all options names/values/attribiutes in the Zencart admin, then I overrode the attributes.php file with a custom one which produces the form in this columnar way. So my page is completely Zencart for functionality, but just customised HTML output.

But as stated, the shear numbers of prescription attributes make it extremely difficult and time consuming to manage, so removing all these options/attributes from Zencart, and adding into a custom form, whos values are then added to a Zencart option field, in my opinion would be the best way to go.

P.S. That is of course if you want to collect customer data this way. As a couple of others have pointed out, this may cause errors so you could have the file upload or something like schoolboy mentioned.