Skip to main content
added 2 characters in body
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra PriceExtra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).

edited title
Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32

Add extra price on cart update for a custom field in cart

added 283 characters in body
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).

added 11 characters in body
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32
Loading
edited title
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32
Loading
deleted 18 characters in body
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32
Loading
added 1 character in body
Source Link
Manoj Deswal
  • 5.8k
  • 25
  • 28
  • 50
Loading
Source Link
Wasiq Shahrukh
  • 592
  • 1
  • 6
  • 32
Loading