on list page and view page just check whether your custom price is null nor not if it is null show original price and if it not null show custom price.

create a event in config file **checkout_cart_product_add_after** as given below

&lt;events&gt;
    &lt;checkout_cart_product_add_after&gt;
          &lt;observers&gt;
                &lt;unique_event_name&gt;
                  &lt;class&gt;modulename/observer&lt;/class&gt;
                  &lt;method&gt;modifyPrice&lt;/method&gt;
                  &lt;/unique_event_name&gt;
            &lt;/observers&gt;
      &lt;/checkout_cart_product_add_after&gt;
&lt;/events&gt;


create new file **Observer.php**


    class namespace_modulename_Model_Observer

      {

          public function modifyPrice(Varien_Event_Observer $obs)
             {
                 // Get the quote item

                 $item = $obs-&gt;getQuoteItem();

                 // Ensure we have the parent item, if it has one

                 $item = ( $item-&gt;getParentItem() ? $item-&gt;getParentItem() : $item );

                 // Load the custom price

                 $price = $this-&gt;_getPriceByItem($item);

                 // Set the custom price

                 $item-&gt;setCustomPrice($price);

                 $item-&gt;setOriginalCustomPrice($price);

                 // Enable super mode on the product.

                 $item-&gt;getProduct()-&gt;setIsSuperMode(true);

             }


             protected function _getPriceByItem(Mage_Sales_Model_Quote_Item $item)
             {
                 $price;

                 //use $item to determine your custom price.

                 return $price;
             }
                }


Magento: Display custom product price in product listing, view page and also set same price after adding product to cart
I've seen solutions that talk about adding control fields to allow for clever trigger branching in problems like this. I know that works, but it annoys me (feels architecturally wrong) to create such fields if it can be avoided. I've also seen solutions that have to do with using static variables for a similar purpose, but I have found occasions where one global flag is not good enough because I need the flag per record. I've tried both out and I think I want something in the middle. Something like this:

global without sharing class HeapControl {
    private static Map&lt;Id, Set&lt;String&gt;&gt; recordTags = new Map&lt;Id, Set&lt;String&gt;&gt;();
    public static void AddRecordTag(Id rowId, String tag) {
        if (recordTags.containsKey(rowId)) {
            Set&lt;String&gt; tagsForThisRow = recordTags.get(rowId);
            if (!tagsForThisRow.contains(tag)) {
                tagsForThisRow.add(tag);
            }
        } else {
            recordTags.put(rowId, new Set&lt;String&gt; { tag });
        }
    }
    public static boolean IsRecordTagged(Id rowId, String tag) {
        if (recordTags.containsKey(rowId)) {
            Set&lt;String&gt; tagsForThisRow = recordTags.get(rowId);
            if (tagsForThisRow.contains(tag)) {
                return true;
            }
        }
        return false;
    }

    @IsTest 
    public static void HeapDemo() {
        Account a = new Account(Name = 'Testing');
        insert a;
        HeapControl.AddRecordTag(a.Id, 'Control-Field-Name-1');
        a.Name = 'Testing2';
        update a;
        // A trigger that fired on Account Update could check the HeapControl for the record like this
        system.assert(HeapControl.IsRecordTagged(a.Id, 'Control-Field-Name-1'));
    }
}


I'd like a pro-con analysis of using real control fields vs mock control fields on the heap (doesn't have to be my code, anything along the lines of static Map&lt;Id, ...&gt;, if you know of a field-tested version of this code please share). 

In my not-yet-field-tested opinion, the control field concept evolved out of a workflow world, but once you decide to drop down to triggers the heap will serve you better--at least you don't have to create control fields for every little trigger branch.

I apologize this isn't standard Q&amp;A format--but this issue has been burning in my mind for months now and I think there are a lot of Salesforce developers (writing business process triggers in particular) that wrestle with this regularly. Thanks in advance for sharing your wisdom and experience!
