0

I want to change the price accordingly to custom conditions which i created in my custom module. I rewrote the price model file in my custom module like

<models>
    <catalog>
        <rewrite>
            <product_type_price>My_Module_Model_Price</product_type_price>
        </rewrite>
    </catalog>
</models>

Also I rewrote the function in my price model file

public function getPrice($product){ ... 
    My Conditions Logic.....
    return $new_price;
}

in price model file. $new_price is the price which I get from the calculations from my condition logic. My Problem is that in Product List Page, if my custom price is greater than The Default Price of Product then my custom price becomes regular price and Magento marks the default price as Special Price. While if my custom price is less than the default price then only default price is displayed while in Product View Page My Custom Price is Displaying correctly. I attach screen shot of list page. Can anyone tell me what I am missing.

enter image description here

1
  • If I understand correctly, your custom conditions for displaying the price are not permanent? Meaning, this custom price cannot be set when creating or editing the product from the admin; you want to keep the product's regular (default) price, but display something different. May I ask based on what? Is it discounts? Tax? You mention that the custom price can be higher or lower. Is this intended or was it just testing/debugging?
    – Vic
    Apr 19, 2015 at 5:10

2 Answers 2

1

Check your list.phtml file there is condtion which displays regular price and special price. it should give you direction on what is happening.

1
  • Thanks For Answer But I want to set the both prices same in my code... Jan 21, 2015 at 5:14
0

It is hard to put a condition about price related issues between two code lines.

If you will use that feature for all products with a fixed price- lets say you have 1000 products and you want to sell them for 100$"- you can create an attribute under the price tab from Magento Attribute Management area.

Once you creat a fixed price attribute you can select your all products from catalog and change the price from there.

1
  • i want to do it programmatically by using custom conditions. Not by creating any attribute Jun 29, 2015 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.