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

Quantity in Bundled Products with Checkbox, not all QTY is send to Cart
 
arve
Jr. Member
 
Total Posts:  25
Joined:  2009-05-18
 

I read some posts on the forum about it but there was no solution. :(

Here is what I did:
/app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option.phtml
I changed the function at line 143

if (element.value == 'multi' || element.value == 'checkbox'{
            
....
              
CHANGED FROM   elem.hide(); TO elem.show()
The same in /app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml at line 158.

I got this far, but it only takes the last QTY amount from the checkboxes for all selected options and it does not update the price if I change the qty.

/app/design/frontend/default/default/template/bundle/catalog/product/view/type/bundle/option/checkbox.html

<?php $_option $this->getOption() ?>
<?php $_selections 
$_option->getSelections() ?>
<?php $_showSingle 
= (count($_selections) == && $_option->getRequired()) ?>
<?php $_default 
$_option->getDefaultSelection() ?>
<dt><label><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<span class="required">&nbsp;*</span>' ?></label></dt>
<
dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
<?php if (count($_selections) == && $_option->getRequired()): ?>
    <?php 
echo $this->getSelectionQtyTitlePrice($_selections[0]?>
    
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>" />
<?php else:?>
    
<ul class="options-list">
        
<?php foreach($_selections as $_selection): ?>
                <?php 
   $_product 
Mage::getModel('catalog/product');
   
$_product->load($_selection->getProductId());
?> 
        
<li><span class="bundle_the_image"><a href="<?php echo $_selection->getProductUrl() ?>" target="_blank"><img src="<?php echo $_product->getThumbnailUrl(70,30); ?>"/></a> </span><input onclick="bundle.changeSelection(this)" class="checkbox bundle-option-<?php echo $_option->getId() ?> <?php echo $_option->getRequired() ? 'validate-one-required-by-name' : '' ?>" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" type="checkbox" name="bundle_option[<?php echo $_option->getId() ?>][]"<?php echo ($_selection->getIsDefault() && $_selection->isSaleable())?' checked="checked" ':'' ?><?php echo !$_selection->isSaleable()?' disabled="disabled" ':'' ?> value="<?php echo $_selection->getSelectionId() ?>" />
            <
span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php echo $this->getSelectionTitlePrice($_selection?></label></span>
            
<?php if($_option->getRequired()): ?>
                <?php 
echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container'?>
            <?php 
endif; ?> 
             
             
<span class="qty-holder">
        
<?php if ($_default): ?>
            <?php $_defaultQty 
$_default->getSelectionQty()*1 ?>
            <?php $_canChangeQty 
$_default->getSelectionCanChangeQty() ?>
        <?php 
else: ?>
            <?php 
if (!$_showSingle): ?>
                <?php $_defaultQty 
'0' ?>
                <?php $_canChangeQty 
true ?>
            <?php 
else: ?>
                <?php $_defaultQty 
$_selections[0]->getSelectionQty()*1 ?>
                <?php $_canChangeQty 
$_selections[0]->getSelectionCanChangeQty() ?>
            <?php 
endif; ?>
        <?php 
endif; ?>
        
<label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:'?>&nbsp;</label><input onblur="bundle.changeOptionQty(this, event)" <?php echo $_canChangeQty?'':'disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php echo $_canChangeQty?'':' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>" />
    </
span>

        </
li>
        
           
<?php endforeach;?>
    
</ul>
    <
span id="bundle-option-<?php echo $_option->getId() ?>-container"></span>
<?php endif; ?>

I think the problem is here with the $_option but how do I change it?  rolleyes

$_option->getId() ?>-qty-input
 
Magento Community Magento Community
Magento Community
Magento Community
 
ZismAce
Jr. Member
 
Total Posts:  1
Joined:  2009-02-02
 

What you’ve done so far is to display an input field for quantity and activate the option “selection_can_change_qty” in the backend.

We cannot simply copy the quantity input field from radio.phtml since this value is only designed for one product (selection). The name of the radio.phtml field looks like this bundle_option_qty[5] where 5 the bundle-option-id is.

we need a name like this bundle_selection_qty[###id_of_the_selected_product###]

However it would’ve been too easy, if this were enough. We also need to change the bundle logic to allow different quantities for different products.

As far as I can see, we need to change this in the bundle.js to properly update the quantity value (if you’re using ajax), you need the change the price calculation logic and also the add-to-basket process.

I haven’t found any useful clue so far. I’m afraid I have to work this out myself. But any help is appreciated.

Thank you very much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tridem GmbH
Jr. Member
 
Total Posts:  9
Joined:  2009-06-19
 

This is exactely what we need too. Have you found a solution / extension?

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