#StackBounty: #magento-1.9 #multistore #multicurrency #multi-website What is best approach to create 100+ stores in Magento?

Bounty: 50

Magento CE 1.9.x
Assume the case that we need to create 100+ stores having 10k products in each store.

  1. each store will have 100+ products.
  2. there are very high chances that each store can have their own root categories.
  3. some products can be unavailable in certain stores.
  4. language can vary across two stores (within the same Magento instance)
  5. currency may also vary if between two stores.
  6. product quantity may also vary between two stores and price too.

In this approach what will be the best method to be used?

  1. create a separate website for each 100+ stores (i.e 100 stores + 100 website + 100 store view )
  2. keep one main domain (website) and create 100+ stores and stores view. (i.e 100 stores + 1 website + 100 store view )

I heard that creating multiple websites may cause system performance issues. Please advice if this is true.


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doesn't show at the admin panel orders

Bounty: 50

I added an extra fee. It’s working well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How can I show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for the invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doen't show at the admin panel orders

Bounty: 50

I added extra fee. It’s work well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it’s doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How I can show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doen't show at the admin panel orders

Bounty: 50

I added extra fee. It’s work well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it’s doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How I can show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!

#StackBounty: #magento-1.9 Extra fee doen't show at the admin panel orders

Bounty: 50

I added extra fee. It’s work well at the checkout. enter image description here

But at the admin panel -> sales -> orders -> my order it’s doesn’t show.
enter image description here

But price is well.
At the invoice too

enter image description here

How I can show it?
I tried :

<fieldsets>
     <sales_convert_quote_address>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_order>*</to_order></insurance>
         <insurance><to_invoice_item>*</to_invoice_item></insurance>
     </sales_convert_quote_address>
</fieldsets>

But it doesn’t help. Thanks advance.

EDIT:

class Cart_InsuranceUpsell_Model_Paymentinsurance extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    protected $_code = 'Insurance Upsell';

    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (Mage::getSingleton('checkout/session')->getInsuranceUpsellApply()) {
        parent::collect($address);

        $this->_setAmount(0);

        $items = $this->_getAddressItems($address);
        if (!count($items)) {
            return $this;
        }

        $quote = $address->getQuote();

            $exist_amount = $quote->getFeeAmount();
            $fee = $address->getGrandTotal() * (Mage::getStoreConfig('cart_insurance_upsells/configuration/discount_rate',Mage::app()->getStore())/100);
            $balance = $fee - $exist_amount;
            $address->setInsurance($balance);
            $quote->setInsurance($balance);
            $address->setGrandTotal($address->getGrandTotal() + $address->getInsurance());
        }
    }

    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
            $amt = $address->getInsurance();
            if ($amt > 0){
                $address->addTotal(array(
                    'code' => $this->getCode(),
                    'title' => 'Insurance Upsell',
                    'value' => $amt
                ));
                return $this;
            }
        return true;
    }
}

Config.xml :

  <config>
       <global>

        <pdf>
            <totals>
                <insurance>
                    <title>Upsell Insurance</title>
                    <model>cart_insurance_upsell/pdf_earning</model>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>3</sort_order>
                </insurance>
            </totals>
        </pdf>

        <fieldsets>
            <sales_convert_quote_address>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_order>*</to_order></insurance>
                <insurance><to_invoice_item>*</to_invoice_item></insurance>
            </sales_convert_quote_address>
        </fieldsets>

        <sales>
            <quote>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/paymentinsurance</class>
                    </insurance>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <insurance>
                        <class>cart_insurance_upsell/earning</class>
                        <after>subtotal</after>
                    </insurance>
                </totals>
            </order_invoice>
        </sales>
 </global>
    </config>

And for invoice:

class  Cart_InsuranceUpsell_Model_Earning extends Mage_Sales_Model_Order_Invoice_Total_Abstract
{
    public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
        $order = $invoice->getOrder();
        $insurance = $order->getInsurance();

        $invoice->setInsurance($insurance);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $insurance);

        return $this;
    }
}

And can u explain pls, how to work in config.xml that:

   <order_invoice>
                     <totals>
                         <insurance>


Get this bounty!!!