Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Can Magento group grouped products in the shopping cart? 
 
shua
Jr. Member
 
Total Posts:  13
Joined:  2009-05-12
 

I am working on a custom magento theme for a B2B system. We use grouped products so that a retailer can add multiple sizes/colors to their shopping cart all at once.

My question is: Is there a way to keep the products grouped together in the shopping cart, so it will show as a single item with multiple quantity boxes, similar to the product view page?

For example say I have these simple products

T-Shirt Red Small
T-Shirt Blue Small
T-Shirt Blue Medium

Associated to the grouped product

T-Shirt

T-Shirt shows up as a single item in search and then has a form on the detail page for adding the simple items to the cart. However when you go to the cart, all the simple items have separated into their own individual rows. How can I make the cart display the grouped product as a single row in the cart with the grouped simpletons underneath it?

I found the code that loops the items in checkout/cart.phtml

<tbody>
<?php foreach($this->getItems() as $_item): ?>
<?php echo $this->getItemHtml($_item) ?>
<?php endforeach ?>
</tbody>

which is pulling the html from checkout/cart/item/default.phtml

I don’t see any code that looks like it would do a group layout.

What do I need to do to get group products to group together on the shopping cart page?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 

It seems that this functionality is not available

 
Magento Community Magento Community
Magento Community
Magento Community
 
shua
Jr. Member
 
Total Posts:  13
Joined:  2009-05-12
 

Hi Adjustware, thanks for your reply!

Quite unfortunate that this is the case, however it’s not a total loss.

I have been doing considerable customization on my Magento install via themes and custom extensions, and I figure I should be able to do it for this.

What I can’t seem to figure out is

1: where do I customize the MySQL queries that Magento uses?
2: if I need to rewrite some Core Magento code, and do it in a local branch ( eg: app/code/local/Mage ) what do I need to do to tell magento to use my local code instead of the core code?

Thanks again!

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedev
Sr. Member
 
Avatar
Total Posts:  117
Joined:  2009-06-01
 
shua - 07 July 2009 08:43 AM

Hi Adjustware, thanks for your reply!

1: where do I customize the MySQL queries that Magento uses?
2: if I need to rewrite some Core Magento code, and do it in a local branch ( eg: app/code/local/Mage ) what do I need to do to tell magento to use my local code instead of the core code?

1. You don’t run mysql queries directly but by using Magento db adapters. Most Magento models are using these adapters and available methods really depends on specific class - look for a code in modules Model directory.

2. Magento - rewriting model, block or helper

Hope that helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 

Magdev, thank you for the useful link.  Also feel free to read the following wiki article: http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

 
Magento Community Magento Community
Magento Community
Magento Community
 
shua
Jr. Member
 
Total Posts:  13
Joined:  2009-05-12
 

Magedev,

Thanks for your reply and link. The page was very helpful, however, there were a few things that were a bit unclear ( unclear to me that is, I only have about a months experience working with Magento )

First you mention that I need to edit config.xml to set up rewrites. Which config.xml file are you speaking of? app/etc/config.xml ? or the modules config.xml file, and if so, do you mean edit the file in the core mage code ? Will these changes persist after a magento core upgrade?

Second, you didn’t discuss what files need to be copied/created to make this rewrite work. I was able to get the entire checkout working with a local branch of the code by copying app/code/core/Mage/Checkout to app/code/local/Mage/Checkout and then point to codebase: local via the config file in app/etc/modules. Is this a proper way to go about doing things?

Thanks again for your help! You have a great site, it is much appreciated smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedev
Sr. Member
 
Avatar
Total Posts:  117
Joined:  2009-06-01
 

@shua Thank you for your comments - I changed the blog post and hope it’s now more clear. Basically you should avoid touching any of the core files (in fact any file existing after Magento installation).

I also recommend the link sent by Adjustware.

Please let me know if you have any problems with creating your custom rewrites.

 
Magento Community Magento Community
Magento Community
Magento Community
 
shua
Jr. Member
 
Total Posts:  13
Joined:  2009-05-12
 

Magedev,

after your blog updates, it is very clear now! Thanks!

Will this work with controllers as well? for example I want to change how redirecting works for when a customer logs in, this is handled in this file:

app/core/Mage/Customer/controllers/AccountController.php

I am trying to use the info in your blog post to make this happen… not too sure if I will succeed yet.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top