Last active
June 30, 2016 16:21
-
-
Save madismanni/cd506f942e90d8561033b2b503835802 to your computer and use it in GitHub Desktop.
Modification for TIG PostcodeNL for One Step Checkout 4.5.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ___________ __ __ | |
* \__ ___/____ _/ |_ _____ | | | |
* | | / _ \\ __\\__ \ | | | |
* | | | |_| || | / __ \_| |__ | |
* |____| \____/ |__| (____ /|____/ | |
* \/ | |
* ___ __ __ | |
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_ | |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\ | |
* | || | \| | \ ___/ | | \/| | \\ ___/ | | | |
* |___||___| /|__| \_____>|__| |___| / \_____>|__| | |
* \/ \/ | |
* ________ | |
* / _____/_______ ____ __ __ ______ | |
* / \ ___\_ __ \ / _ \ | | \\____ \ | |
* \ \_\ \| | \/| |_| || | /| |_| | | |
* \______ /|__| \____/ |____/ | __/ | |
* \/ |__| | |
* | |
* NOTICE OF LICENSE | |
* | |
* This source file is subject to the Creative Commons License. | |
* It is available through the world-wide-web at this URL: | |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | |
* If you are unable to obtain it through the world-wide-web, please send an email | |
* to servicedesk@tig.nl so we can send you a copy immediately. | |
* | |
* DISCLAIMER | |
* | |
* Do not edit or add to this file if you wish to upgrade this module to newer | |
* versions in the future. If you wish to customize this module for your | |
* needs please contact servicedesk@tig.nl for more information. | |
* | |
* @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl) | |
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | |
*/ | |
?> | |
<?php | |
$formErrors = $this->getParentBlock()->formErrors; | |
$formErrors = (!empty($formErrors['billing_errors'])) ? $formErrors['billing_errors'] : array(); | |
$helper = Mage::helper('onestepcheckout/checkout'); | |
$dataHelper = Mage::helper('onestepcheckout'); | |
$billingFields['firstname'] = ' | |
<div class="input-box input-firstname'.((in_array('firstname', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:firstname">'.$this->__('First Name').' <span class="required">*</span></label><br /> | |
<input class="required-entry input-text" type="text" name="billing[firstname]" id="billing:firstname" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getFirstname()).'" /> | |
</div>'; | |
$billingFields['lastname'] = ' | |
<div class="input-box input-lastname'.((in_array('lastname', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br /> | |
<input class="required-entry input-text" type="text" name="billing[lastname]" id="billing:lastname" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getLastname()).'" /> | |
</div>'; | |
?> | |
<?php if(!$this->isCustomerLoggedIn() || in_array('email_registered', $formErrors)): ?> | |
<?php $billingFields['email'] = ' | |
<div class="clearfix" id="onestepcheckout-email-error" '.((!in_array('email_registered', $formErrors)) ? 'style="display: none"' : '').'> | |
<div id="onestepcheckout-email-error-message" class="onestepcheckout-error">'. | |
((in_array('email_registered', $formErrors)) ? $this->__('Email address already registered. Please <a href="#" onclick="login_popup.show(); return false;">login now</a> or use a different email address.') : $this->__('Invalid email address.')) | |
.'</div> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->isCustomerLoggedIn()): ?> | |
<?php $billingFields['email'] = $billingFields['email'].' | |
<div class="input-box input-email'.((in_array('email', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:email">'.$this->__('Email Address').' <span class="required">*</span></label><br /> | |
<input type="text" name="billing[email]" id="billing:email" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getEmail()).'" title="'.$this->__('Email Address') .'" class="validate-email required-entry input-text" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_telephone']):?> | |
<?php $billingFields['telephone'] = ' | |
<div class="input-box input-telephone'.((in_array('telephone', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/> | |
<input type="text" name="billing[telephone]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="billing:telephone" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php $billingFields['street'] = $this->getChild('postnl_billing_postcodecheck') | |
->setAddressType('billing') | |
->setAddress($this->getQuote()->getBillingAddress()) | |
->setCountryHtmlSelect($this->getCountryHtmlSelect('billing')) | |
->toHtml(); | |
?> | |
<?php if(!$this->settings['exclude_region']): ?> | |
<?php $billingFields['region_id'] = ' | |
<div class="input-box input-region'.((in_array('region', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/> | |
<select id="billing:region_id" name="billing[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none"> | |
<option value="">'.$this->__('Please select region, state or province').'</option> | |
</select> | |
<script type="text/javascript"> | |
$("billing:region_id").setAttribute("defaultValue", "'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getRegionId()).'"); | |
</script> | |
<input type="text" id="billing:region" name="billing[region]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_company']): ?> | |
<?php $billingFields['company'] = ' | |
<div class="input-box input-company'.((in_array('company', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:company">'.$this->__('Company').'</label><br/> | |
<input type="text" name="billing[company]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="billing:company" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_fax']): ?> | |
<?php $billingFields['fax'] = ' | |
<div class="input-box input-fax'.((in_array('fax', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:fax">'.$this->__('Fax').'</label><br/> | |
<input type="text" name="billing[fax]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="billing:fax" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php | |
$_taxvat = false; | |
try { | |
if(Mage::getStoreConfig('onestepcheckout/exclude_fields/enable_pillwaxeuvat_support')){ | |
$_taxvat = $this->getLayout()->createBlock('euvat/widget_taxvat'); | |
} | |
} catch (Exception $e) { | |
} | |
if(!is_object($_taxvat)){ | |
$_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat'); | |
} | |
?> | |
<?php if(is_object($_taxvat) && $_taxvat->isEnabled() && !$this->isCustomerLoggedIn()): ?> | |
<?php $billingFields['taxvat'] = | |
$_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat()) | |
->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml(); | |
?> | |
<?php endif; ?> | |
<?php if (method_exists(Mage::helper('customer/address'), 'isVatAttributeVisible') && Mage::helper('customer/address')->isVatAttributeVisible()) : ?> | |
<?php $billingFields['taxvat'] = ' | |
<label for="billing:vat_id">'.$this->__('VAT Number').'</label> | |
<div class="input-box"> | |
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getVatId()).'" title="'.$this->__('VAT Number').'" class="input-text '.Mage::helper('customer/address')->getAttributeValidationClass('vat_id').'" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php | |
try { | |
$_dob = $this->getLayout()->createBlock('customer/widget_dob'); | |
} catch (Exception $e) { | |
$_dob = false; | |
} | |
?> | |
<?php | |
try { | |
$_gender = $this->getLayout()->createBlock('customer/widget_gender'); | |
} catch (Exception $e) { | |
$_gender = false; | |
} | |
?> | |
<?php if (is_object($_dob) && $_dob->isEnabled() && !$this->isCustomerLoggedIn()): ?> | |
<?php $billingFields['dob'] = ' | |
<div class="field"> | |
'.$_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().' | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if (is_object($_gender) && $_gender->isEnabled() && !$this->isCustomerLoggedIn()): ?> | |
<?php $billingFields['gender'] = ' | |
<div class="field"> | |
'.$_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().' | |
</div>'; | |
?> | |
<?php endif ?> | |
<?php if(!$this->isCustomerLoggedIn() && $helper->showCreateAccount()): ?> | |
<?php $billingFields['create_account'] = ' | |
<div class="input-box"> | |
<input id="id_create_account" type="checkbox" name="create_account" value="1" '.((isset($_POST['create_account']) && $_POST['create_account'] == '1') ? ' checked="checked"' : '').' /> | |
<label for="id_create_account">'.$this->__('Create an account for later use').'</label> | |
</div> | |
<script> | |
document.observe("dom:loaded", function() { | |
$("id_create_account").observe("click", function(e) { | |
var element = e.element(); | |
if(element.checked) { | |
$("onestepcheckout-li-password").show(); | |
} | |
else { | |
$("onestepcheckout-li-password").hide(); | |
} | |
}); | |
}); | |
</script>'; | |
?> | |
<?php endif; ?> | |
<?php if($helper->showPasswords() && !$this->isCustomerLoggedIn()): ?> | |
<?php | |
//id="onestepcheckout-li-password" | |
$billingFields['password'] = ' | |
<li id="onestepcheckout-li-password" '.(($helper->hidePasswords()) ? 'style="display: none;"':'').'> | |
<div class="input-box input-password'.((in_array('password', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:customer_password">'.$this->__('Password').'</label><br/> | |
<input type="password" class="input-text required-entry validate-password" value="'.((isset($_POST['billing']['customer_password'])) ? Mage::helper('core')->escapeHtml($_POST['billing']['customer_password']) : '').'" title="Password" id="billing:customer_password" name="billing[customer_password]"/> | |
</div> | |
<div class="input-box input-password'.((in_array('confirm_password', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:confirm_password">'.$this->__('Confirm password').'</label><br/> | |
<input type="password" class="input-text required-entry validate-cpassword" value="'.((isset($_POST['billing']['confirm_password'])) ? Mage::helper('core')->escapeHtml($_POST['billing']['confirm_password']) : '').'" id="billing:confirm_password" title="Confirm Password" name="billing[confirm_password]"/> | |
</div> | |
</li>'; | |
?> | |
<?php endif; ?> | |
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?> | |
<?php $billingFields['save_in_address_book'] = ' | |
<li class="control"> | |
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"'.(($dataHelper->clearDash($this->getQuote()->getBillingAddress()->getSaveInAddressBook())) ? 'checked="checked"':'').' class="checkbox" /><label for="billing:save_in_address_book">'.$this->__('Save in address book').'</label> | |
</li>'; | |
?> | |
<?php else:?> | |
<?php $billingFields['save_in_address_book'] = ' | |
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>'; | |
?> | |
<?php endif; ?> | |
<?php | |
$this->echoAddressFields ($billingFields); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /** | |
* ___________ __ __ | |
* \__ ___/____ _/ |_ _____ | | | |
* | | / _ \\ __\\__ \ | | | |
* | | | |_| || | / __ \_| |__ | |
* |____| \____/ |__| (____ /|____/ | |
* \/ | |
* ___ __ __ | |
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_ | |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\ | |
* | || | \| | \ ___/ | | \/| | \\ ___/ | | | |
* |___||___| /|__| \_____>|__| |___| / \_____>|__| | |
* \/ \/ | |
* ________ | |
* / _____/_______ ____ __ __ ______ | |
* / \ ___\_ __ \ / _ \ | | \\____ \ | |
* \ \_\ \| | \/| |_| || | /| |_| | | |
* \______ /|__| \____/ |____/ | __/ | |
* \/ |__| | |
* | |
* NOTICE OF LICENSE | |
* | |
* This source file is subject to the Creative Commons License. | |
* It is available through the world-wide-web at this URL: | |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | |
* If you are unable to obtain it through the world-wide-web, please send an email | |
* to servicedesk@tig.nl so we can send you a copy immediately. | |
* | |
* DISCLAIMER | |
* | |
* Do not edit or add to this file if you wish to upgrade this module to newer | |
* versions in the future. If you wish to customize this module for your | |
* needs please contact servicedesk@tig.nl for more information. | |
* | |
* @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl) | |
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | |
*/ | |
?> | |
<?php | |
$formErrors = $this->getParentBlock()->formErrors; | |
$formErrors = (!empty($formErrors['shipping_errors'])) ? $formErrors['shipping_errors'] : array(); | |
$helper = Mage::helper('onestepcheckout/checkout'); | |
$dataHelper = Mage::helper('onestepcheckout'); | |
$shippingFields['firstname'] = ' | |
<div class="input-box input-firstname'.((in_array('firstname', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:firstname">'.$this->__('First Name').' <span class="required">*</span></label><br /> | |
<input class="required-entry input-text" type="text" name="shipping[firstname]" id="shipping:firstname" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getFirstname()).'" /> | |
</div>'; | |
$shippingFields['lastname'] = ' | |
<div class="input-box input-lastname'.((in_array('lastname', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br /> | |
<input class="required-entry input-text" type="text" name="shipping[lastname]" id="shipping:lastname" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getLastname()).'" /> | |
</div>'; | |
?> | |
<?php $shippingFields['street'] = $this->getChild('postnl_shipping_postcodecheck') | |
->setAddressType('shipping') | |
->setAddress($this->getQuote()->getBillingAddress()) | |
->setCountryHtmlSelect($this->getCountryHtmlSelect('shipping')) | |
->toHtml(); | |
?> | |
<?php if(!$this->settings['exclude_region'] ): ?> | |
<?php $shippingFields['region_id'] = ' | |
<div class="input-box input-region'.((in_array('region', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/> | |
<select id="shipping:region_id" name="shipping[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none"> | |
<option value="">'.$this->__('Please select region, state or province').'</option> | |
</select> | |
<script type="text/javascript"> | |
$("shipping:region_id").setAttribute("defaultValue", "'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getRegionId()).'"); | |
</script> | |
<input type="text" id="shipping:region" name="shipping[region]" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_telephone']):?> | |
<?php $shippingFields['telephone'] = ' | |
<div class="input-box input-telephone'.((in_array('telephone', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/> | |
<input type="text" name="shipping[telephone]" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="shipping:telephone" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_company']): ?> | |
<?php $shippingFields['company'] = ' | |
<div class="input-box input-company'.((in_array('company', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:company">'.$this->__('Company').'</label><br/> | |
<input type="text" name="shipping[company]" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="shipping:company" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if(!$this->settings['exclude_fax']): ?> | |
<?php $shippingFields['fax'] = ' | |
<div class="input-box input-fax'.((in_array('fax', $formErrors)) ? ' input-error' : '').'"> | |
<label for="shipping:fax">'.$this->__('Fax').'</label><br/> | |
<input type="text" name="shipping[fax]" value="'.$dataHelper->clearDash($this->getQuote()->getShippingAddress()->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="shipping:fax" /> | |
</div>'; | |
?> | |
<?php endif; ?> | |
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?> | |
<?php $shippingFields['save_in_address_book'] = ' | |
<li class="control"> | |
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="shipping:save_in_address_book" '.(($this->getQuote()->getShippingAddress()->getSaveInAddressBook()) ? 'checked="checked"':'').' class="checkbox" /><label for="shipping:save_in_address_book">'.$this->__('Save in address book').'</label> | |
</li>'; | |
?> | |
<?php else:?> | |
<?php $shippingFields['save_in_address_book'] = ' | |
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>'; | |
?> | |
<?php endif; ?> | |
<?php | |
$this->echoAddressFields ($shippingFields); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment