2016-07-13 9 views
0

Mapquestは、2011年11月7日に直接タイルアクセスを停止しました。mapquest直接タイルアクセス交代/修正?

Error Page - Screenshot. Error page 私には次の機能があります。これを整理するために誰かが早急に修正を提案することができますか? これは、あなたがOSMを使用することができ、コード

<esi:remove> 
<div class="child" style="float:left;"> 
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/ZeroClipboard.js'); ?>"></script> 
<script type="text/javascript"> 
ZeroClipboard.setDefaults({ moviePath: '<?php echo $this->getSkinUrl("js/ZeroClipboard.swf"); ?>' }); 
</script> 
<?php 
    $clipboardicon = $this->getSkinUrl('images/clipboard.png'); 
    //Load required php libs 
    require_once('lib/Map/longilat.php'); 
    require_once('lib/Map/markermaker.php'); 
    require_once('lib/Map/popup.php'); 

    $orders = Mage::registry('mapOrders'); 
    $unsetorders = Mage::registry('mapUnbooked'); 
    $undeliveredorders = Mage::registry('mapUndelivered'); 
    $searchedorder = Mage::registry('searchedOrder'); 

    //Get home depo pin data 
    $ll = postCode2Geog('wv1'); 
    $long = $ll[0]; 
    $lat = $ll[1]; 
    $baseurl = stristr(Mage::getBaseUrl(), "index", TRUE); 

    $orderStock = Mage::registry('mapStock'); 

    if($_GET['postcode']) 
    { 
     $getPostcode = $_GET['postcode']; 
     $postcodeToMark = $_GET['postcode']; 
    } 
    ?> 
<div id="map"></div> 
<script type="text/javascript"> 
    /** 
    * OpenLayers Map Variables Setup 
    */ 
    var map; 
    var arrayOSM; 
    var arrayAerial; 
    var baseOSM; 
    var baseAerial; 
    var longHome = "<?php echo $long ?>"; 
    var latiHome = "<?php echo $lat ?>"; 
    var size = new OpenLayers.Size(21,25); 
    var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); 
    var iconHome = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/home-marker.png';?>", size, offset); 
    var iconBlueStar = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/bluestar-marker.png';?>", size, offset); 
    var iconStar = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/star-marker.png';?>", size, offset); 
    var iconLSW = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/lsw-marker.png';?>", size, offset); 
    var iconPallet = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/pallet-marker.png';?>", size, offset); 
    var iconInterlink = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/interlink-marker.png';?>", size, offset); 
    var iconEbay = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/ebay-marker.png';?>", size, offset); 
    var iconGreen = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/marker-green.png';?>", size, offset); 
    var iconRed = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/marker.png';?>", size, offset); 
    var iconMagnifier = new OpenLayers.Icon("<?php echo $baseurl.'js/openlayers/img/magnifier-marker.png';?>", size, offset); 
    var home = new OpenLayers.Layer.Markers("Home"); 
    var postcodemarkers = new OpenLayers.Layer.Markers("Entered Postcode"); 
    var markers = new OpenLayers.Layer.Markers("Unknown Markers"); 
    var lswmarkers = new OpenLayers.Layer.Markers("LSW Deliveries"); 
    var palletmarkers = new OpenLayers.Layer.Markers("Pallet Deliveries"); 
    var ebaymarkers = new OpenLayers.Layer.Markers("Ebay Deliveries"); 
    var interlinkmarkers = new OpenLayers.Layer.Markers("Interlink Deliveries"); 

    var unsetmarkers = new OpenLayers.Layer.Markers("Unreserved Without Delivery Dates"); 
    var undeliveredmarkers = new OpenLayers.Layer.Markers("Unreserved With Delivery Dates"); 
    unsetmarkers.setVisibility(false); 
    undeliveredmarkers.setVisibility(false); 

    var searchedorder = new OpenLayers.Layer.Markers("Entered Order Number"); 

    var unsetmarkersgreen = new OpenLayers.Layer.Markers("Reserved Without Delivery Dates"); 
    var undeliveredmarkersgreen = new OpenLayers.Layer.Markers("Reserved With Delivery Dates"); 
    /** 
    * End OpenLayers Map Variables Setup 
    */ 

    /** 
    * OpenLayers Pin Functions 
    */ 
    var markerHover = function(evt) 
    { 
     if (this.popup == null) 
     { 
      this.popup = this.createPopup(this.closeBox); 
      map.addPopup(this.popup); 
      this.popup.show(); 
     } 
     else 
     { 
      this.popup.toggle(); 
     } 
     OpenLayers.Event.stop(evt); 
    }; 

    var markerClick = function(evt) 
    { 
     <?php 
      // $baseurl = Mage::getBaseUrl()."/admin/sales_order/view/order_id/"; // Bad Url: directly references "admin" as opposed to getting url with adminhtml 
      $baseurl = Mage::helper("adminhtml")->getUrl("adminhtml/sales_order/view"); //"adminhtml/" gets automagically turned into the admin url 
      $url = stristr($baseurl, "/key/"); 
      $baseurl = str_replace($url, "/order_id/", $baseurl); 
     ?> 
     //window.location = '<?php echo $baseurl ?>'+this.id+'<?php echo $url ?>'; 
     if(this.id != null) 
     { 
      window.open('<?php echo $baseurl ?>'+this.id+'<?php echo $url ?>'); 
     } 
     // window.alert(this.id); 
    } 
    /** 
    * End OpenLayers Pin Functions 
    */ 

    // Function for setting pin data and location 
    function setMarker(lon, lat, pcode, orderno, layerI, iconI, id, productText, name) 
    { 
     var lonLatMarker = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()); 
     var feature = new OpenLayers.Feature(layerI, lonLatMarker); 
     feature.id = id; 
     feature.closeBox = true; 
     feature.popupClass = OpenLayers.Class(OpenLayers.Popup.AnchoredBubble, {autoSize:true }); 
     if(orderno) 
     { 
      ordertext = '<b>OrderNo:</b> '+orderno; 
     } 
     else 
     { 
      ordertext = ''; 
     } 
     feature.data.popupContentHTML = '<div id="idInfo"><p><b>Name:</b> '+name+'</p><p><b>PostCode:</b> '+pcode+ordertext+'</p></div><div id="prodInfo">'+productText+'</div>'; 
     feature.data.overflow = "hidden"; 

     var icon = iconI.clone(); 
     var marker = new OpenLayers.Marker(lonLatMarker, icon); 
     marker.feature = feature; 

     marker.events.register("mouseover", feature, markerHover); 
     marker.events.register("mouseout", feature, markerHover); 
     marker.events.register("mousedown", feature, markerClick); 

     layerI.addMarker(marker); 
    } 

    // Initialize OpenLayers Map 
    function init() 
    { 
     // Map Setup 
     map = new OpenLayers.Map('map'); 
     arrayOSM = ["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", 
        "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", 
        "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", 
        "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg"]; 

     baseOSM = new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM); 

     //Add Map Layers 
     map.addLayer(home); 
     // map.addLayer(markers); //Test layer 
     map.addLayer(postcodemarkers); 
     map.addLayer(lswmarkers); 
     map.addLayer(palletmarkers); 
     map.addLayer(ebaymarkers); 
     map.addLayer(interlinkmarkers); 
     map.addLayer(markers); 
     <?php 
     //Add Layer For Orders Without Delivery Dates 
     if($unsetorders) 
     { 
      ?> 
      map.addLayer(unsetmarkers); 
      map.addLayer(unsetmarkersgreen); 

      <?php 
     } 

     //Add Layer For Orders With Delivery Dates 
     if($undeliveredorders) 
     { 
      ?> 
      map.addLayer(undeliveredmarkers); 
      map.addLayer(undeliveredmarkersgreen); 
      <?php 
     } 

     //add layer for searched order 
     if($searchedorder != null) 
     { 
      ?> 
      map.addLayer(searchedorder); 
      <?php 
     } 
     ?> 
     //Add Map View 
     map.addLayer(baseOSM) 

     //Create Home Pin 
     var marker = new OpenLayers.Marker(new OpenLayers.LonLat(longHome,latiHome).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),iconHome); 
     marker.id = "LSW Warehouse"; 
     marker.events.register("mousedown", marker, function() {alert(this.id);}); 
     home.addMarker(marker); 

     //Add Map Controls 
     map.addControl(new OpenLayers.Control.LayerSwitcher()); 

     <?php 
     $postcodes_notfound = array(); 
     //Create Pins For Orders Matching Date Requirement 
     foreach ($orders as $order) 
     { 
      $additional = ""; 
      if($order['organization'] != null || $order['organization'] != "") 
      { 
       $temp = explode('|', $order['organization']); 
       $oddeven = "org-odd"; 
       foreach ($temp as $value) 
       { 
        $org = explode('@',$value); 
        $additional .= "<div class='org-block ".$oddeven."''><div class='org-recipient'>From: ".$org[6]." -> To: ".$org[7]."</div><div><b>".$org[1]."</b></div><div>".str_replace(array("\r\n", "\r", "\n"), "<br>", $org[2])."</div><div class='org-deadline'>Deadline: ".$org[3]."</div></div>"; 
        if($oddeven == "org-odd") 
        { 
         $oddeven = "org-even"; 
        } 
        else 
        { 
         $oddeven = "org-odd"; 
        } 
       } 
      } 
      $line = postCode2Feature($order['postcode'],$order['shipping_description'],$order['increment_id'],$order['parent_id'],$order,$additional,$order['city']); 
      echo $line."\r\n"; 
      if($line == null) 
      { 
       $postcodes_notfound[] = "Order Id: ".$order['increment_id']." | Postcode: ".$order['postcode']."<img class='clipboard' src='".$clipboardicon."' data-clipboard-text='".$order['postcode']."' />"; 
      } 
     } 

     //Create Pins For Orders Without Delivery Dates 
     if($unsetorders) 
     { 
      $csv = "Unbooked\r\nOrder No,Status,Order Date\r\n"; 
      foreach ($unsetorders as $unsetorder) 
      { 
       $additional = ""; 
       if($order['organization'] != null || $order['organization'] != "") 
       { 
        $temp = explode('|', $unsetorder['organization']); 
        $oddeven = "org-odd"; 
        foreach ($temp as $value) 
        { 
         $org = explode('@',$value); 
         $additional .= "<div class='org-block ".$oddeven."''><div class='org-recipient'>From: ".$org[6]." -> To: ".$org[7]."</div><div><b>".$org[1]."</b></div><div>".str_replace(array("\r\n", "\r", "\n"), "<br>", $org[2])."</div><div class='org-deadline'>Deadline: ".$org[3]."</div></div>"; 
         if($oddeven == "org-odd") 
         { 
          $oddeven = "org-even"; 
         } 
         else 
         { 
          $oddeven = "org-odd"; 
         } 
        } 
       } 
       $line = postCode2Feature($unsetorder['postcode'],"unset",$unsetorder['increment_id'],$unsetorder['parent_id'],$unsetorder,$additional,$unsetorder['city']); 
       echo $line."\r\n"; 
       if($line == null) 
       { 
        $csv .= $unsetorder['increment_id'].",".$unsetorder['status'].",".$unsetorder['psop_delivery_date']."," . $unsetorder['postcode'] ."Not Found\r\n"; 
        $postcodes_notfound[] = "Order Id: ".$unsetorder['increment_id']." | Postcode: ".$unsetorder['postcode']."<img class='clipboard' src='".$clipboardicon."' data-clipboard-text='".$order['postcode']."' />"; 
       } 
       else 
       { 
        $csv .= $unsetorder['increment_id'].",".$unsetorder['status'].",".$unsetorder['psop_delivery_date']."\r\n"; 
       } 
       $csv .= $unsetorder['increment_id'].",".$unsetorder['status'].",".$unsetorder['psop_delivery_date']."\r\n"; 
       $unbookedcounter++; 
      } 
     } 

     //Create Pins For Orders With Delivery Dates 
     if($undeliveredorders) 
     { 
      $csv .= "Undelivered\r\nOrder No,Status,Order Date\r\n"; 
      foreach ($undeliveredorders as $undeliveredorder) 
      { 
       $additional = ""; 
       if($order['organization'] != null || $order['organization'] != "") 
       { 
        $temp = explode('|', $undeliveredorder['organization']); 
        $oddeven = "org-odd"; 
        foreach ($temp as $value) 
        { 
         $org = explode('@',$value); 
         $additional .= "<div class='org-block ".$oddeven."''><div class='org-recipient'>From: ".$org[6]." -> To: ".$org[7]."</div><div><b>".$org[1]."</b></div><div>".str_replace(array("\r\n", "\r", "\n"), "<br>", $org[2])."</div><div class='org-deadline'>Deadline: ".$org[3]."</div></div>"; 
         if($oddeven == "org-odd") 
         { 
          $oddeven = "org-even"; 
         } 
         else 
         { 
          $oddeven = "org-odd"; 
         } 
        } 
       } 
       $line = postCode2Feature($undeliveredorder['postcode'],"undelivered",$undeliveredorder['increment_id'],$undeliveredorder['parent_id'],$undeliveredorder,$additional,$undeliveredorder['city']); 
       echo $line."\r\n"; 
       if($line == null) 
       { 
        $csv .= $undeliveredorder['increment_id'].",".$undeliveredorder['status'].",".$undeliveredorder['psop_delivery_date']."," . $undeliveredorder['postcode'] ." Not Found\r\n"; 
        $postcodes_notfound[] = "Order Id: ".$undeliveredorder['increment_id']." | Postcode: ".$undeliveredorder['postcode']."<img class='clipboard' src='".$clipboardicon."' data-clipboard-text='".$order['postcode']."' />"; 
       } 
       else 
       { 
        $csv .= $undeliveredorder['increment_id'].",".$undeliveredorder['status'].",".$undeliveredorder['psop_delivery_date']."\r\n"; 
       } 
       $undeliveredcounter++; 
      } 
     } 

     //Create Pins For Entered Postcode 
     if($postcodeToMark) 
     { 
      echo postCode2FeatureCustom($postcodeToMark,'postcodemarkers','iconBlueStar','Marked Postcode'); 
     } 

     //Create Pins For Searched Order 
     if($searchedorder) 
     { 
      $orderObj = Mage::getModel('sales/order')->load($searchedorder['parent_id']); 
      $inStock = $orderStock[$searchedorder['parent_id']]['stocked']; 

      if($inStock) 
      { 
       $stockStatus = "<div class='stock_status'><b>Stock: </b><div style='background-color: green; width: 20px; height: 20px; display: inline-block; vertical-align: middle;'></div></div>"; 
      } 
      else 
      { 
       $stockStatus = "<div class='stock_status'><b>Stock: </b><div style='background-color: red; width: 20px; height: 20px; display: inline-block; vertical-align: middle;'></div></div> "; 
      } 

      if($searchedorder['psop_delivery_date']) 
      { 
       $planning = '<p><b>Planning Date: ' . $searchedorder['psop_delivery_date'] .'</b></p>'; 
      } 
      else 
      { 
       $planning = ""; 
      } 

      $additional = products2Html($orderObj->getAllItems()) . $stockStatus . $planning; 

      echo postCode2FeatureCustom($searchedorder['postcode'],'searchedorder','iconMagnifier',$searchedorder['customer_name'],$searchedorder['parent_id'],$searchedorder['increment_id'],$additional,$searchedorder['city']); 
     } 
     ?> 

     //Center Map View To Warhouse Pin 
     map.setCenter(new OpenLayers.LonLat(longHome,latiHome).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()), 7); 
    } 
    init(); 
</script> 
</div> 

<?php //Debug For Unbooked and Undelivered Orders ?> 
<div> 
    <form action="<?php echo Mage::getUrl('*/*/exportmap'); ?>" method="POST"> 
     <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" /> 
     <input type="hidden" id="csv" name="csv" value="<?php echo $csv; ?>"/> 
     <input type="submit" id="submit" name="submit" /> 
    </form> 
</div> 
<?php 
echo "<br>Unbooked Counter: ".$unbookedcounter."<br>"; 
echo "Undelivered Counter: ".$undeliveredcounter."<br>"; 
echo "<br><b>Postcodes Not Found</b><br>"; 
foreach ($postcodes_notfound as $line) 
{ 
    echo $line."<br>"; 
} 
?> 
<br> 
<div><b>This Dates Orders</b></div> 

<ul id="orderList" class="mapOrderList"> 
    <?php 
    $oddeven = "odd"; 
    foreach ($orders as $order) 
    { 
      $baseurl = Mage::helper("adminhtml")->getUrl("adminhtml/sales_order/view"); //"adminhtml/" gets automagically turned into the admin url 
      $url = stristr($baseurl, "/key/"); 
      $baseurl = str_replace($url, "/order_id/", $baseurl); 
      $link = $baseurl . $order['parent_id'] . $url; 
     ?> 
     <li class="mapOrder <?php echo $oddeven ?>"> 
      <div class="orderId"><?php echo "<a href='".$link."' target='_blank'>".$order['increment_id']."</a>" ?></div> 
      <div class="customerName"><?php echo $order['customer_name'] ?></div> 
      <?php 
      if($order['organization'] != null || $order['organization'] != "") 
      { 
      ?> 
      <div class="bulb"> 
       <div class="popup"> 
        <?php 
        $temp = explode('|', $order['organization']); 
        $oddeven = "org-odd"; 
        foreach ($temp as $value) 
        { 
         $org = explode('@',$value); 
         echo "<div class='org-block ".$oddeven."''><div class='org-recipient'>From: ".$org[6]." -> To: ".$org[7]."</div><div><b>".$org[1]."</b></div><div>".str_replace(array("\r\n", "\r", "\n"), "<br>", $org[2])."</div><div class='org-deadline'>Deadline: ".$org[3]."</div></div>"; 
         if($oddeven == "org-odd") 
         { 
          $oddeven = "org-even"; 
         } 
         else 
         { 
          $oddeven = "org-odd"; 
         } 
        } 
        ?> 
       </div> 
      </div> 
      <?php 
      } 
      ?> 
      <div class="products"> 
       <?php 
       $products = $orderStock[$order['parent_id']]['products']; 
       foreach ($products as $key => $productTemp) 
       { 
        $product = Mage::getModel('catalog/product')->load($key); 
        echo "<div class='productSku'>".$product['sku']."</div><div class='productInfo'>Qty: ".$productTemp['ordered_qty']."</div>"; 
       } 
       ?> 
      </div> 
     </li> 
     <?php 
     if($oddeven == "odd") 
     { 
      $oddeven = "even"; 
     } 
     else 
     { 
      $oddeven = "odd"; 
     } 
    } 
    ?> 
</ul> 
<script type="text/javascript"> 
var elems = document.getElementsByTagName('*'), i; 
for(i in elems) 
{ 
    if((' ' + elems[i].className + ' ').indexOf(' clipboard ') > -1) 
    { 
     var target = elems[i]; 
     var clip = new ZeroClipboard(target); 
    } 
} 
</script> 
</esi:remove> 

答えて

0

のコピーです:

var osmLayer = new ol.layer.Tile({ 
    source: new ol.source.OSM() 
}); 

マップクエストは、マップクエストのAPIから除き、使用できなくなります。また、新しいTOSによれば、キャッシングや格納は許可されません。詳細はhereを参照してください。

EDIT:によってあなたのinitメソッドの始まりを更新:

function init() 
{ 
    // Map Setup 
    map = new OpenLayers.Map('map'); 

    // Create a layer with OSM map: 
    var osmLayer = new ol.layer.Tile({ 
     source: new ol.source.OSM() 
    }); 

    //Add Map Layers 
    map.addLayer(home); 
    // map.addLayer(markers); //Test layer 
    map.addLayer(postcodemarkers); 
    map.addLayer(lswmarkers); 
    map.addLayer(palletmarkers); 
    map.addLayer(ebaymarkers); 
    map.addLayer(interlinkmarkers); 
    map.addLayer(markers); 
    <?php 
    //Add Layer For Orders Without Delivery Dates 
    if($unsetorders) 
    { 
     ?> 
     map.addLayer(unsetmarkers); 
     map.addLayer(unsetmarkersgreen); 

     <?php 
    } 

    //Add Layer For Orders With Delivery Dates 
    if($undeliveredorders) 
    { 
     ?> 
     map.addLayer(undeliveredmarkers); 
     map.addLayer(undeliveredmarkersgreen); 
     <?php 
    } 

    //add layer for searched order 
    if($searchedorder != null) 
    { 
     ?> 
     map.addLayer(searchedorder); 
     <?php 
    } 
    ?> 

    //Add the OSM layer: 
    map.addLayer(osmLayer) 
+0

私はその修正プログラムを使用する方法を見つけることができませんか?私はデザイナーです、絶対にMapquestには初めてです。休日にいる開発者のためにこれをカバーしてください。私はコードを更新しました。あなたが何かを提案できるなら、感謝します。 –

+0

確かに、私の編集を参照してください。 –

関連する問題