9

I am working on a task to show Date Range on Dashboard chart. so data chart will display on custom date range selection. I have added calendar on chart but result is not coming properly. I know its very specific requirement. I am looking if someone has already done such modification and can provide me some guidence to achieve this.

I have added calendar from the following code in adminhtml/default/default/template/dashboard/graph.phtml:

<div class="field">
    <label for="startdate"><?php echo Mage::helper('contacts')->__('Start Date') ?></label>
    <div class="input-box">
        <input name="startdate" id="startdate" value="" type="text">
        <img title="Select date" id="startdate_trig" src="<?php echo 'http://192.168.0.32/pankgento/skin/adminhtml/default/default/images/grid-cal.gif'; ?>" class="v-middle">
    </div>
 </div>

 <div class="field">
    <label for="enddate"><?php echo Mage::helper('contacts')->__('End Date') ?></label>
    <div class="input-box">
        <input name="enddate" id="enddate" value="" type="text">
        <img title="Select date" id="enddate_trig" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif'; ?>" class="v-middle">
    </div>
 </div>

 <div class="field">
    <div class="input-box">
        <input type="button" name="btn" value="Search" onchange="changeDiagramsPeriod();" />
    </div>
 </div>

Already a function changeDiagramsPeriod created in adminhtml/default/default/template/dashboard/index.phtml. It is responsible for making the ajax request, its creating ajax request for every dynamic block.

8
  • I have not done this before, but you may get some idea how to do this by following this tutorial link
    – SIBHI S
    Commented Jul 5, 2014 at 14:08
  • Can you elaborate on "so data chart will display on custom date range selection" - do you mean "so data chart will display a custom date range selection"?
    – benmarks
    Commented Jul 5, 2014 at 14:32
  • yes I need to select start and end date. so all the sale done in that period will show in chart. like currently it happen when we select last 7days and current month option. Commented Jul 5, 2014 at 20:06
  • You say you alraedy added the calendar. Can you post your code?
    – Marius
    Commented Jul 5, 2014 at 20:23
  • @Marius .. Can you guide me little bit so that I will be able to achieve this. Commented Jul 9, 2014 at 14:01

2 Answers 2

2

Magento filter and search date in format ,Use date php as

    $fromDate = date('Y-m-d'. ' 00:00:00', strtotime($fromDate));
    $toDate = date('Y-m-d'. ' 23:59:00', strtotime($toDate));

or javascript set like as

var from = new Date(year, month, day, 00, 00, 00);
var toDate = new Date(year, month, day, 23, 59, 00);
1
  • Adrian's solution seems the one that is working for me. Can't seem to upvote his reply though because of my low reputation (am new here). Commented Dec 15, 2014 at 19:46
0

I have developped an extension to be able to have a 12 hours range in the dashboard. It's available here: http://www.magentocommerce.com/magento-connect/12-hours-range-dashboard.html

I suggest you download it and you can modify it to add another custom range that would fill your needs ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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