Friday, July 30, 2010

virtuemart toolbar, removing and adding items to it

to change the items like suppose you create a custom new page in virtuemart and you are confused about the toolbar it can be handled from the file toolbar.virtuemart.php this file lie in the root folder of the administratorc/components/com_virtuemart
if you dont want the new button in the toolbar then add ur page to this array
$noNewItem = array( 'order.order_list',
'store.shipping_module_list','report.report_list' );

Thursday, July 29, 2010

get consecutive dates between any two dates

function getDays($sStartDate, $sEndDate){
// Firstly, format the provided dates.
// This function works best with YYYY-MM-DD
// but other date formats will work thanks
// to strtotime().
$sStartDate = gmdate("Y-m-d", strtotime($sStartDate));
$sEndDate = gmdate("Y-m-d", strtotime($sEndDate)); //Y-m-d
// Start the variable off with the start date
//$aDays[] = $sStartDate;
$ex = explode("-",$sStartDate);

$aDays[] = $ex[1] ."/" .$ex[2] . "/" . $ex[0];

// Set a 'temp' variable, sCurrentDate, with
// the start date - before beginning the loop
$sCurrentDate = $sStartDate;

// While the current date is less than the end date
while($sCurrentDate < $sEndDate){
// Add a day to the current date
$sCurrentDate = gmdate("Y-m-d", strtotime("+1 day", strtotime($sCurrentDate)));

// Add this new day to the aDays array
$ex = explode("-",$sCurrentDate);

$aDays[] = $ex[1] ."/" .$ex[2] . "/" . $ex[0]; //$sCurrentDate;
}

for ($i=0;$i<4;$i++){

// print_r($aDays[$i]);

}

// Once the loop has finished, return the
// array of days.
return $aDays;
}