Skip to content

Instantly share code, notes, and snippets.

@madismanni
Last active May 17, 2018 04:59
Show Gist options
  • Save madismanni/7c9902e855a6a1869f3a592ca7a8bc78 to your computer and use it in GitHub Desktop.
Save madismanni/7c9902e855a6a1869f3a592ca7a8bc78 to your computer and use it in GitHub Desktop.
One Step Checkout 4.5.8 compatibility with dhl_versenden.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--
/**
* Dhl Versenden
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to
* newer versions in the future.
*
* PHP version 5
*
* @category design
* @package base_default
* @author Christoph Aßmann <christoph.assmann@netresearch.de>
* @copyright 2016 Netresearch GmbH & Co. KG
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @link http://www.netresearch.de/
*/
-->
<layout version="0.1.0">
<checkout_onepage_index>
<reference name="head">
<action method="addItem" ifconfig="carriers/dhlversenden/active">
<type>skin_js</type>
<script>js/dhl_versenden/opcheckout.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/service_preferredlocation_enabled">
<type>skin_js</type>
<script>js/dhl_versenden/validationLocation.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/service_preferredneighbour_enabled">
<type>skin_js</type>
<script>js/dhl_versenden/validationNeightbour.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/active">
<type>skin_css</type>
<script>css/dhl_versenden/styles.css</script>
</action>
</reference>
</checkout_onepage_index>
<onestepcheckout_index_index>
<reference name="head">
<action method="addItem" ifconfig="carriers/dhlversenden/active">
<type>skin_js</type>
<script>js/dhl_versenden/opcheckout.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/service_preferredlocation_enabled">
<type>skin_js</type>
<script>js/dhl_versenden/validationLocation.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/service_preferredneighbour_enabled">
<type>skin_js</type>
<script>js/dhl_versenden/validationNeightbour.js</script>
</action>
<action method="addItem" ifconfig="carriers/dhlversenden/active">
<type>skin_css</type>
<script>css/dhl_versenden/styles.css</script>
</action>
</reference>
</onestepcheckout_index_index>
</layout>
###### FULL FILE NAME: app/design/frontend/base/default/template/dhl_versenden/checkout/shipping_services.phtml
<?php
/**
* Dhl Versenden
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to
* newer versions in the future.
*
* PHP version 5
*
* @category design
* @package base_default
* @author Christoph Aßmann <christoph.assmann@netresearch.de>
* @copyright 2016 Netresearch GmbH & Co. KG
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @link http://www.netresearch.de/
*/
?>
<?php /** @var Dhl_Versenden_Block_Checkout_Onepage_Shipping_Method_Service $this */
$services = $this->getServices();
?>
<?php if (!$this->isShippingAddressDHLLocation() || !empty($services)): ?>
<div id="checkout-dhlversenden-services" style="display: none;">
<img
src="<?php echo $this->escapeUrl($this->getSkinUrl('images/dhl_versenden/logo.png')) ?>"
alt="<?php echo $this->escapeHtml($this->__('DHL Additional Services')) ?>"
title="<?php echo $this->escapeHtml($this->__('DHL Additional Services')) ?>"
/>
<?php if (!empty($services)): ?>
<span>
<?php echo $this->escapeHtml($this->__('Your shipping services')) ?><br/>
<?php echo $this->escapeHtml($this->__('Delivered as desired')) ?>
</span>
<p>
<?php echo $this->escapeHtml($this->__('You decide when and where you want to receive your parcels with the recipient services of DHL.')) ?><br/>
<?php echo $this->escapeHtml($this->__('Please choose your preferred delivery option:')) ?>
</p>
<dl>
<?php /** @var \Dhl\Versenden\Bcs\Api\Shipment\Service\Type\Generic $service */ ?>
<?php foreach ($services as $service): ?>
<dt class="service-<?php echo $this->escapeHtml($service->getFrontendInputType() . ' ' . $service::CODE) ?>">
<?php echo $service->getSelectorHtml() ?>
<?php
$tooltip = $this->getServiceHint($service->getCode());
$labelHtml = $service->getLabelHtml();
if ($tooltip !== '') {
$labelHtml = str_replace(
'</label>',
"<i class=\"tooltip-inner\" data-tooltip=\"$tooltip\">?</i></label>",
$labelHtml
);
}
?>
<?php /* @noEscape */ echo $labelHtml; ?>
</dt>
<dd><p><?php echo $this->getServiceFeeText($service->getCode()) ?></p></dd>
<dd class="service-<?php echo $this->escapeHtml($service->getFrontendInputType() . ' ' . $service::CODE) ?>">
<?php echo $service->getValueHtml(); ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
<?php if (!$this->isShippingAddressDHLLocation()): ?>
<span>
<a id="locationfinder-link" href="javascript:void(0)">
<?php echo $this->escapeHtml($this->__('Or as an alternative choose a shipment to a Parcelstation or a Post Office.')) ?>
</a>
</span>
<?php endif; ?>
<script type="text/javascript">
//<![CDATA[
var serviceContainer = new DhlServiceContainer(
'checkout-dhlversenden-services',
'<?php /* @noEscape */ echo $this->getDhlMethods(); ?>'
);
serviceContainer.toggleServiceContainer();
serviceContainer.registerMethodChange();
serviceContainer.registerServiceDetailsChange();
serviceContainer.registerCalendarChange();
var locationLink = $('locationfinder-link');
if (locationLink) {
locationLink.observe('click', function () {
// OSC Support >>
var checkoutUrl = window.location.pathname.split('/').pop();
if (checkoutUrl=="onestepcheckout") {
var diffShipEl = $('billing:use_for_shipping_yes');
// if is checked "Versenden an diese Adresse", uncheck it and show shipping address section
if (diffShipEl&&diffShipEl.checked) {
diffShipEl.checked = false;
diffShipEl.dispatchEvent(new Event('click'));
}
}
else {
checkout.gotoSection('shipping');
document.getElementById('opc-shipping').scrollIntoView();
}
// << OSC Support
// Case: customer with saved addresses
var addressSelection = $$('#shipping-address-select option[value=""]').first();
if (addressSelection) {
addressSelection.selected = true;
$('shipping-new-address-form').show();
}
var locationFinderCheckbox = $('shipping:useLocationFinder');
if (locationFinderCheckbox) {
locationFinderCheckbox.checked = true;
locationFinder.showLocationData(locationFinderCheckbox.checked);
}
});
}
//]]>
</script>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment