New Zenner
- Join Date:
- Mar 2010
- Posts:
- 2
- Plugin Contributions:
- 0
Changing the way Zen Cart treats 'display_only' attributes
Hi All,
This is my first post on the Zen Cart Support forums but I have been using the community for about 6 months now so I'd like to thank you all for all of the efforts and shared knowledge you've provided - I'd be lost without you!
I must warn you, I'm going to go into a great deal of depth about the issue here because I'm hoping it will help you guys to understand my problem and also, I'm very probably not the only person suffering the same scenario so hopefully the more details I give, the more help this thread can be to similar poor souls.
Here is a little bit of background information about my setup and what I'm trying to achieve.
I'm currently running Zen Cart 1.3.8.
I manage an e-commerce site consisting of about 1000 products (90% of which have expansive size ranges) for a traditional 'bricks 'n' mortar' company who have expanded into the web. We have a couple of shops plus the website and, at the moment, the technological foundation is not consistent across the whole business. i.e we have an antiquated stock system that integrates with the tills in the shops but is not compatible with Zen Cart so any form of automated integration is out of the question. The e-commerce store does not have its own stock, instead it picks from a central warehouse and the shop stores (don't ask!) so, as you may already have guessed, keeping products and sizes up to date is a real issue as all updating of the website is a manual data inputting task using information from the bricks 'n' mortar stock system.
The current procedure involves deleting sizes from the product attributes if we have 2 or less of a particular product size (for fear of selling them in a shop and not being able to fulfill the web order) - and then adding them back on to the web when our stock is replenished. This is extremely time consuming (and mind-numbing) for a couple of the staff here so, as a stock system upgrade is sadly not an option, I am currently devising a fairly crude workaround. Here is what I have got so far, I don't claim that it's elegant in any way but tests have proved it works in principle and it will cut down hours of horrendous toil.
I tried to find a common element that could be used as a reference point for both databases. Our antiquated stock system does not have a nested structure for different sizes or variations of the same product, instead it treats every single product size as being its own separate entity - effectively swelling a product total of 1000 to about 6000. This can't be changed so one value on Zen Cart that enables me to treat each and every size as an individual entity is the product_attributes_id variable. I decided to use the product_attributes_id value as a reference and add a new field into our shop stock system to assign the product_attribute_id to the relevant product - a huge task at first but the lesser of two evils in the long-term.
Once this is place I can pull a report off the shops stock system with the overall stock quantities by 'product_attributes_id' and then merge the data into an excel sheet that creates a little mysql query for the web database. The MYSQL query sets the 'attributes_display_only' value to 1 if we have either no or very little stock of a particular size of product - this works great.
This is where my issue arises. I am not an experienced PHP developer and I don't claim to be a MYSQL guru either so I'm struggling to change the way Zen Cart treats attributes that are 'display only'.
At the moment, Zen Cart checks to see if a product is display only once a customer has selected their size and attempts to add it to the cart. If the attribute is 'display only' then it returns an 'invalid selection' message. This is not ideal.
I would like to be able to make attributes that are 'display only' (attributes_display_only =1) faded and non-selectable (maybe with 'out of stock' displaying after the attribute in the drop down lis) or not display at all. Either way, I would really like it if the customer could not attempt to add the product size to the cart and therefore avoid the ugly invalid selection message. Is there any way of doing this?
If not, is there another way to effectively switch attributes on and off without deleting them altogether?
I'm really sorry for the essay but, as I said, I hope it helps some people who might be in a similar situation to me.
Thanks in advance for any advice you can offer.