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

  • 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 '15 at 5:10
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.

  • Thanks For Answer But I want to set the both prices same in my code... – Shaheer Ali Jan 21 '15 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.

  • i want to do it programmatically by using custom conditions. Not by creating any attribute – Shaheer Ali Jun 29 '15 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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