0

On load how to change the product price display this new price

$Ringprice = $goldprice18*$_product->getWeight()+$_product->getPrice();

enter image description here

0

You can try adding additional price via observer

Add This event in your module config xml file

app/code/local/Namespace/Modulename/etc/config.xml

<frontend>
    <events>
        <catalog_product_get_final_price>
            <observers>
                <update_price_on_the_fly>
                    <type>singleton</type>
                    <class>Namespace_Modulename_Model_Observer</class>
                    <method>addAdditionalPrice</method>
                </update_price_on_the_fly>
            </observers>
        </catalog_product_get_final_price>
    </events>
</frontend>

Create a Observer

app/code/local/Namespace/Modulename/Model/Observer.php

<?php

class Namespace_Modulename_Model_Observer 
{
    public function addAdditionalPrice(Varien_Event_Observer $observer)
    {
            $product = $observer->getProduct();
            $goldprice18 = 10;

            // Set Product original price.
            $productOriginalPrice = $product->getPrice();
            $productNewOriginalPrice = $goldprice18 * $product->getWeight() + $productOriginalPrice;

            $product->setPrice($productNewFinalPrice);

            // Set product final price.
            $productBasePrice = $product->getFinalPrice();
            $productNewFinalPrice = $goldprice18 * $product->getWeight() + $productBasePrice;

            $product->setFinalPrice($productNewFinalPrice);
    }
}
  • thanks its work. Now i need to check with attribute set and depend upon the gold purity i have to get the price. Eg: gold purity dropdown 18k admin will set. Admin can set any purity 22k,24k ect. – Suma J Aug 22 '17 at 9:51

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.