Magento: How to add a custom attribute while adding a product to cart? - magento

I have "Size" as a custom attribute for products. The question is, how can I add the size data while adding a product to the cart and checkout, so when the admin sees the order, he becomes aware of this information?
Thanks!

There are two possible ways.
Use custom options. For size this will not apply correctly (I'll explain why below), but for some kind of data it could be particularly useful (e.g. save logo placement or other attribute which can not be represented by a physical item). For custom option tutorial you can use this link.
Use Configurable product. For attributes like size or colour it's the best option. It has few benefits compared to custom options - automatic stock management for your options, ability to assign different pictures, and you don't need to recreate the whole set of options for different products. Here's the official tutorial -> tutorial.

Related

Magento custome option product in search result

I am uploading an product and product has different size available, Now if customer- who want to buy this, they have to select size then after they can buy. How to do this. I knew custom option is available in magento. But i want to allow customer to search product by size also, so what should i do to perform this type of things?. please help
You shouldn't use custom options for different sizes. This is why you have configurable products.
You make a configurable product and then link it to simple products which represent its sizes.
Then for the simple product you select visibility: search (to show it on search).
Custom product options are NOT used in search and there is nothing you can do to use them in search (apart from building a very complex module).
Another solution would be to put the values from the custom options inside an attribute which has Use in Advanced Search and Use in Quick Search to yes.
First of all for using the type you can use any(both configurable or custom options) but should know which is more suitable.If you have large variety of options than Configurable product is a good option but if there is less variety than you can also use custom option as your wish.
Now another part of the question you want to make it searchable according to size right? In your sense searching means filtering in layered navigation or what? For both searching or filtering doesnot have relation on the product type. If you want filtering of the product according to size than you have to create an attribute size.This could help.
Hope this will help.

Magento: Different sizes and colors under one simple product?

I’m setting up an online clothing store and have come across a huge problem:
When I make at product (a t-shirt for example), I want to be able to add the available sizes and colors, without having to create a product for every single option.
When I add a color or size, I need to be able to enter a SKU for each product, so I can tell which option the customer chose in the store. First I tried making 2 sets of attributes: “Color” and “Size”, so I could multi-select when adding a product. But the attributes didn’t show up as options in the store, as I had hoped.
I did a lot of searching, and found that some people used the “Costom Option” tab, to make fields for the available sizes, colors etc. - but I don’t want add those options every time I add a product. The multi-select feature I accomplished with the attributes, would have been perfect.
Also I found that someone was forced to pay for an extension to accomplish this - but as I am running on a very tight budget, so I really don’t want to pay anything to achieve this.
You can achieve this programmatically, observing the product save and generate all simple products of a configurable product. Unfortunately, you will have to manage stock for those items separately.
You can do this by creating a configurable products. For more information on how to create configurable products please refer to http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product. You can refer to http://www.srota.co for an example.

Magento - Uses and Benefits of getOptionsByCode

I have seen that Magento uses this method "getOptionsByCode()" in the class "Mage_Sales_Model_Quote_Item" a lot, for retrieving / fetching the Quote Item options by code. After printing each of the Options, for any item, I found these:-
info_buyRequest
option_ids
option_1843
attributes
product_qty_231
simple_product
Now here are my questions:-
What Magento is trying to achieve with the use of this method "getOptionsByCode()", or its benefits?
Is this only to be used for the Configurable Products, or for other composite Product Types also?
How to determine which option codes are for Custom Options of the corresponding Product Item?
What are the options "info_buyRequest" and "simple_product" specifically used for?
Are there any other uses of the Custom Options, like Configurable Attributes or something else?
Thanks to all in advance!
Let's answer one at a time:
The item's options are the values the user selected for adding that product to the cart (for instance, the different options and their selected values).
All of the products use at least the info_buyRequest option. I don't really know about the other ones.
I think they might be all inside of the "attributes" option, but I never really used custom options.
info_buyRequest is used to spec the qty, and all other options. It is the initial request (that later gets processed). The simple product probably is the real product you are adding to the cart (that is, the item might be a configurable product, but you add in the cart a simple product).
I don't really know. But, if what you need is to find out the options chosen for such product, my guess is you should check either the "attributes" option, or just get the simple_product and get it's options.

what type of products should be used to achieve the below mentioned functionality in magento?

I want to implement the functionality in magento, the link of this is below :
http://ledflashingwatch.com/clocker-watch-illuminati-series/
when you click on strips, it changes strips image but when click on dial, it changes separately. And also add to cart will differentiate the product on these two values.
Can anyone advise me on how to proceed towards approaching this idea. And which type of products to use for this.
You can ask me questions if it's still not clear to you. And do tell me if it is not possible.
This feature is not available in Magento out of the box.
There are several possible approaches, but the user interface component will have to be custom built by you.
If you want the selected products to appear separately in the cart (like in the example you linked) choose simple products.
You could also use a grouped product with a custom interface.
If you want them to be added to the cart as a single product, but internally they are separate, use a configurable product. This is the option I personally would prefer.
You could also use a bundled product - It all depends what exactly you need.
I suggest first getting a good idea of the differences between the product types. Then study how they are reflected in the quote as quote items, i.e. visibility, parent and child items etc.
Once you know that, the implementation will be rather straight forward.
Build the UI. Build the request parameters for the add to cart call. Done.

Magento: Configurable products without setting up each simple product?

I need to set up hundreds of products, each of which need an drop down that has from a few to twenty or thirty options so I refuse to use configurable products to set these up. I just want a product to use all the options in an attribute.
For example, I want to let customers pick from colors and sizes for a product, but I don't want to have to individually create products for each option. The pricing is the same for everyone and I don't need to track inventory for the options, so there's no benefits in using configurable products.
Is this possible?
Either use simple products and utilize the custom options tab (you will not be able to track inventory of each variant if you go this route). I have seen a number of ways to do this programatically via magento's product creation API or custom code. There is also a number of extensions that make it easier to to do but they do not fully automate the process. One of the automated ways to do it very fast can be found here.
The tutorial is setup exactly the way you want (color & size). Once you create this page make sure you are logged into the admin and open it with your browser. It will work it's magic.
Here are most of the extensions that do it, but they are not as automated as the custom coding methods such as the one linked above:
Product Creator
Automatic Configurables
Better Configurable Products
Perhaps instead of configurable products you could use simple products with custom options instead. There are even ways of importing products with options intact, most of the work is done by copy & paste in a spreadsheet which is much quicker.
If you're looking for a more programmatic way of doing things then you might think of making a custom product type which adds the same options every time so you never need to specify them again. Modifying the product type would modify all options at once too.
Yes, this is possible, just make attributes and note that this is a programming forum, for general questions head to magento forums
Simple product with custom option is not === configurable product as each option do not have Magento stock control, as you can never say Size "Small" sold out as there is no stock for options, that is the main reason why Magento has to use simple product to be the option of the configurable product as simple has stock.
If you have unlimited stock then using simple product plus custom option is the best solution for performance.

Resources