Total Posts: 22
Hello Magento Community,
I have a module which lists products based on a certain criteria (on a frontend script in the template folder).
I am stuck on the part which selects the correct price, normal or special price (depending if todays date is within the special to and from dates). Because the getPrice() function just seems to return the normal product price.
Please look at my code to see why it is not functioning correctly, or please suggest another magento function to always give the price its currently being sold at
// Code to get the correct price for today
$specialToDate = $_product->getResource()->getAttribute('special_to_date')->getFrontend()->getValue($_product);
$specialFromDate = $_product->getResource()->getAttribute('special_from_date')->getFrontend()->getValue($_product);
$currentDate = mktime(0,0,0,date("m"),date("d"),date("Y"));
$currentDate = date("Y/m/d h:m:s", $currentDate);
if ($currentDate >= $specialFromDate && $currentDate < $specialToDate && $_product->getSpecialPrice() != 0):
$price = $_product->getSpecialPrice();
$price = $_product->getPrice();