Cart item increases its quantity, when same product is added to cart again. But what if we need to add a custom option to cart item and show cart items in Shopping Cart separately. E.g. Customer needs to select Seller option while adding the product to cart and show same item with different sellers separately. Like shown in the below figure.

magento-cart

Simple Solution to show cart items separately

Hook catalog_product_load_after event to add you additional data to quote item.

Add below code in config.xml file of your custom module to hook

In observer.php.

This will add your additional data to items and show items separately. 🙂 Plus when user adds item with same custom options will increase quantity in same configurations.

Additionaly

Let me show you How I have done this.

Show custom product options
To show options in description section select/radio options in price.phtml or addtocart.phtml of your theme template.

To show in tab section
Add a custom .phtml file in your theme template and introduce your template file in local.xml file.
Add below to local.xml of your template.

Show Dropdown in list.phtml

Above script will get update the seller list on click on options (For configurable items).
In controller file, an HTML code is returned having updated seller list based on item quantities.

To add same customs in order items as well.

Hook sales_convert_quote_item_to_order_item event to add same additional data to order items.

In obsever.php, add below code

To know how to hook a magento event. click here

Let me know if you have any enquiries.

That’s all folks. Happy Coding 🙂