Showing posts with label Price. Show all posts
Showing posts with label Price. Show all posts

Tuesday 26 December 2017

How to get product Tire / Final / Group price custom in Magento

How to get product Tire / Final / Group price custom order in Magento


$productid = 4108;
$qty = 3;
$customergroup = 1;
$_productB = Mage::getModel('catalog/product')->load($productid);
$_productB->setCustomerGroupId($customergroup);
echo $_productB->getPriceModel()->getFinalPrice($qty, $_productB);exit;

Tuesday 14 June 2016

Sort by price, quantity low-> high. 0 price get last


Here is the my result query. I have required result of sort by price low-> high but it gives me a result that starts with records that have the price 0. This is correct, but I don't want the 0 price records first. Result should start with prices greater than 0 and 0 price records should be displayed last.
Please help me to solve my this query.

For example, the result should start start with price 12.00, 15.00..... 0, 0, 0

SELECT
    product_id, quantity, price,
    CASE price WHEN 0
        THEN 1
        ELSE 0
    END
    as is_price_zero
FROM
    product
ORDER BY
    is_price_zero ASC,
    price ASC



Friday 19 July 2013

Get product price in Magento

<?php
// assuming that you have known product object, $_product
//get product price snippet
echo $this->getPriceHtml($_product, true);
//get $_product price
echo $_product->getPrice();
echo number_format($_product->getPrice(), '2', '.', ',');
//get $_product special price
echo $_product->getSpecialPrice();
echo number_format($_product->getSpecialPrice(), '2', '.', ',');
//get $_product final price
echo $_prodcut->getFinalPrice();
echo number_format($_product->getFinalPrice(), '2', '.', ',');
//get $_product Msrp
echo $_product->getMsrp();
echo number_format($_product->getMsrp(), '2', '.', ',');
?>