Re: How-To: Add new Properties to your Products
I was able to get text area to work by copying the Description code. You need to duplicate it all over the files and do a similar table in your db.
I tried to copy the manufacturers_id for a pull down, but it didn't work. I am thinking cause that code works differently. It pulls the manufacturers names form a table that is populated by the admin. I just want to do it myself one time with 6 values. I haven't been able to get a working pull down yet. and no one has yet to have answers for me on this forum. :unsure:
Re: How-To: Add new Properties to your Products
Still hoping for someone to cue in on how to get 6 options in a pull down menu as a new product property...
What I really don't understand about all this is why is it so hard to do? I used a different cart like 5 years ago, and it let you set these up really easily in the admin. I really think this should be a feature of the cart as it makes customizing product types and properties so easy. This is a pain for anyone needing specialized fields.
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
magneteye
I tried to copy the manufacturers_id for a pull down, but it didn't work. I am thinking cause that code works differently. It pulls the manufacturers names form a table that is populated by the admin.
yes, that works differently, although there are similarities.
Quote:
Originally Posted by
magneteye
I just want to do it myself one time with 6 values. I haven't been able to get a working pull down yet. and no one has yet to have answers for me on this forum. :unsure:
Somewhere in the top of your product type's collect_info.php script, put something like this:
Code:
$my_list_of_options = array();
$my_list_of_options[] = array('id' => 'Name of option 1', 'text' => 'Name of option 1');
$my_list_of_options[] = array('id' => 'Name of option 2', 'text' => 'Name of option 2');
$my_list_of_options[] = array('id' => 'Name of option 3', 'text' => 'Name of option 3');
$my_list_of_options[] = array('id' => 'Name of option 4', 'text' => 'Name of option 4');
$my_list_of_options[] = array('id' => 'Name of option 5', 'text' => 'Name of option 5');
$my_list_of_options[] = array('id' => 'Name of option 6', 'text' => 'Name of option 6');
Note the duplication of description in both the id and text sides.
Then, later where you want the pulldown to display, echo something like this:
Code:
zen_draw_pull_down_menu('my_selected_option_from_database', $my_list_of_options, $pInfo->my_selected_option_from_database)
where my_selected_option_from_database refers to the name of the database field which is storing the value selected, and which you've already retrieved earlier in the script.
Re: How-To: Add new Properties to your Products
Dr Byte. I really appreciate your response. I can kind of get what you have there. Any tips on setting up the tables in the database? I think I did that wrong when i first tried.
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
magneteye
Dr Byte. I really appreciate your response. I can kind of get what you have there. Any tips on setting up the tables in the database? I think I did that wrong when i first tried.
Sorry, I have no idea what you've done to get where you're at. The process of adding new fields is not something that is described in one page. It requires significant understanding of databases, database structures, coding methodologies, etc. It's not for the faint of heart.
I've not read all your posts in this thread, and I suspect that some steps are right, and others are not understanding.
The first post in this thread covers the "big picture" of the concepts, and probably worked great for the original poster's initial needs. That doesn't mean it necessarily meets "your" needs fully.
How many fields are you trying to add?
What is their purpose? What is the business need you're trying to solve?
How is each being used?
What fields have you created in the database?
Re: How-To: Add new Properties to your Products
Dr. Byte... to answer your questions:
Quote:
How many fields are you trying to add?
Six fields.
Quote:
What is their purpose?
Sizes of clothing.
Quote:
What is the business need you're trying to solve?
Consignment (used) clothing. Items sold only once, then removed from product database. See the link in my sig to see the site.
Quote:
What fields have you created in the database?
I created a table called products_sizes and added 6 fields, one for each size (small, medium, large, xlarge, petite, plus sizes). I think I may need to have a primary key setup?
I basically just want to be able to select the size in admin when adding a product. Then the size is displayed on the product page. Lastly, I want to add the sizes to the end of my categories menu so a user can shop by size.
Re: How-To: Add new Properties to your Products
Dr. Byte,
a quick question about the drop down menu, if i wanted to have a drop down of lets say 6 images to be placed in a product how would i link the image to what you have displayed:
$my_list_of_options = array();
$my_list_of_options[] = array('id' => 'Name of option 1', 'text' => 'Name of option 1');
$my_list_of_options[] = array('id' => 'Name of option 2', 'text' => 'Name of option 2');
$my_list_of_options[] = array('id' => 'Name of option 3', 'text' => 'Name of option 3');
$my_list_of_options[] = array('id' => 'Name of option 4', 'text' => 'Name of option 4');
$my_list_of_options[] = array('id' => 'Name of option 5', 'text' => 'Name of option 5');
$my_list_of_options[] = array('id' => 'Name of option 6', 'text' => 'Name of option 6');
the drop down would have text for the admin to chose from but the result would be an image displayed in the product display for the customer
any help i would be gratfull
thanks in advance
rich
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
hostmonster
Dr. Byte,
a quick question about the drop down menu, if i wanted to have a drop down of lets say 6 images to be placed in a product how would i link the image to what you have displayed:
$my_list_of_options = array();
$my_list_of_options[] = array('id' => 'Name of option 1', 'text' => 'Name of option 1');
$my_list_of_options[] = array('id' => 'Name of option 2', 'text' => 'Name of option 2');
$my_list_of_options[] = array('id' => 'Name of option 3', 'text' => 'Name of option 3');
$my_list_of_options[] = array('id' => 'Name of option 4', 'text' => 'Name of option 4');
$my_list_of_options[] = array('id' => 'Name of option 5', 'text' => 'Name of option 5');
$my_list_of_options[] = array('id' => 'Name of option 6', 'text' => 'Name of option 6');
the drop down would have text for the admin to chose from but the result would be an image displayed in the product display for the customer
any help i would be gratfull
thanks in advance
rich
The whole issue is a complex topic. The first post in this thread covers the overall concepts.
You'll need to create a database field to store the choice. Then create the forms for selecting the desired option when entering/editing the products, make sure the info gets saved, and then in the display template make sure the page displays the proper image based on the entry.
Re: How-To: Add new Properties to your Products
Dr Byte, did you see my reply up a couple from what you asked me last about what I was trying to do... my pulldown question got kinda hijacked here. I am still trying to figure it out.
Thanks!
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
magneteye
Six fields.
Sizes of clothing.
This would be a classic reason for using attributes.
Quote:
Originally Posted by
magneteye
I created a table called products_sizes and added 6 fields, one for each size (small, medium, large, xlarge, petite, plus sizes).
If I correctly read your proposed structure for the products_sizes table as being a reference table, your needs are more directly reflective of pulling data from the Manufacturers table and simply storing the selected choice into your new "product_size" field in your products table:
- query the table
- build an array of its entries
- display a pulldown
- store the selected entry
- then in the storefront, display information appropriately based on the selected setting
- and build your shop-by-size choices in the category menu
Quote:
Originally Posted by
magneteye
Lastly, I want to add the sizes to the end of my categories menu so a user can shop by size.
That's yet another kettle of fish ... and doing it by using normal attributes would be admittedly more difficult. Using a dedicated size table as you're considering may be a touch easier. Nevertheless, I recall a contribution floating around some time back that had code for shop-by-size in it. It should be in the downloads section if you want to use it as a reference. I think it was attribute-based.