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

Modify Sales/Model/Quote/Item.php to include a new attribute (Volume)
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

Hi,

Im just in need of some help to enhance the Item.php found in
/app/code/core/<age/Sales/Model/Quote/Item.php

What I would like to do below is add in a new attribute to help in factoring the product shipping volume.

For example. I would like to just take this line

>setWeight($this->getProduct()->getWeight())

and add a new attribute like this

>setWeight($this->getProduct()->getWeight() * $this->getProduct()->getVolume())

The problem is the new attribute ive already added to the system isnt recorgnised in the above code for some reason.

Can anyone suggest as to why?

Here is the orginal code

public function setProduct($product)
    
{
        
if ($this->getQuote()) {
            $product
->setStoreId($this->getQuote()->getStoreId());
        
}
        $this
->setData('product'$product)
            ->
setProductId($product->getId())
            ->
setProductType($product->getTypeId())
            ->
setSku($this->getProduct()->getSku())
            ->
setName($product->getName())
            >
setWeight($this->getProduct()->getWeight())    
            ->
setTaxClassId($product->getTaxClassId())
            ->
setCost($product->getCost())
            ->
setIsQtyDecimal($product->getIsQtyDecimal());

//        if ($options = $product->getCustomOptions()) {
//            foreach ($options as $option) {
//                $this->addOption($option);
//            }
//        }
        
return $this;
    
}

thanks
Brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

anyway, further to this

i can call the weight attribute like this

->setWeight($product->getData('weight'))

But the same cannot be done for my new attribute volume

->setVolume($product->getData('volume'))
 
Magento Community Magento Community
Magento Community
Magento Community
 
Flopy69
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-06-04
Lyon
 

no news ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

hey,

i ended up using a extension that has this ability ti use volumes. Ive then slightly changed the extension code to do what im after.

check out the auctionmaid shipping extension for details

cheers
brendan

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