Skip to content

Commit

Permalink
hot fix 1.7.14
Browse files Browse the repository at this point in the history
  • Loading branch information
reindertvetter committed Oct 17, 2016
2 parents f6d6fec + 2524e2e commit 3ab589b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getCheckoutOptionsHtml()

if ($pgAddress && $this->_helper->shippingMethodIsPakjegemak($shippingMethod))
{
if($data){
if(key_exists('location', $data)){
$dateTime = date('d-m-Y H:i', strtotime($data['date'] . ' ' . $data['start_time']));
$html .= $this->__('PostNL location:') . ' ' . $dateTime;
if($data['price_comment'] != 'retail')
Expand All @@ -90,7 +90,7 @@ public function getCheckoutOptionsHtml()
if($totalWeight !== false){
$html .= $this->_helper->getPackageType($totalWeight, $this->_order->getShippingAddress()->getCountryId(), true) . ' ';

if($data){
if(key_exists('date', $data)){
$dateTime = date('d-m-Y H:i', strtotime($data['date']. ' ' . $data['time'][0]['start']));
$html .= $this->__('deliver:') .' ' . $dateTime;

Expand All @@ -106,6 +106,9 @@ public function getCheckoutOptionsHtml()
}
}

if (key_exists('browser', $data))
$html = ' <span title="'.$data['browser'].'"">'.$html.'</span>';

return $html !== false ? '<br>' . $html : '' ;
}

Expand Down
14 changes: 13 additions & 1 deletion app/code/community/TIG/MyParcel2014/Helper/AddressValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function getQuoteAddress(Mage_Sales_Model_Quote $quote)
) {
$address['full_street'] = $quote->getBillingAddress()->getStreetFull();
if($address['full_street']){
$this->removeAddressLines($address['full_street']);
$address['type'] = 'billing';
$address['country'] = $quote->getBillingAddress()->getCountry();
$address['postal_code'] = $quote->getBillingAddress()->getPostcode();
Expand All @@ -148,6 +149,7 @@ public function getQuoteAddress(Mage_Sales_Model_Quote $quote)
} else {
$address['full_street'] = $quote->getShippingAddress()->getStreetFull();
if($address['full_street']){
$this->removeAddressLines($address['full_street']);
$address['type'] = 'shipping';
$address['country'] = $quote->getShippingAddress()->getCountry();
$address['postal_code'] = $quote->getShippingAddress()->getPostcode();
Expand All @@ -167,6 +169,7 @@ public function getQuoteAddress(Mage_Sales_Model_Quote $quote)
$address['country'] = $tmpAddress->getCountry();
$address['postal_code'] = $tmpAddress->getPostcode();
$address['full_street'] = $tmpAddress->getStreetFull();
$this->removeAddressLines($address['full_street']);
if (!preg_match('/[0-9]/', $address['full_street'])) {
return false;
}
Expand All @@ -175,8 +178,17 @@ public function getQuoteAddress(Mage_Sales_Model_Quote $quote)
$address['number'] = $streetData['housenumber'];
}
}
$address['full_street'] = preg_replace("/[\n\r]/", " ", $address['full_street']);

return $address;
}

/**
* Remove multiple rows. For example, if the house number on a different row.
*
* @param $street
*/
private function removeAddressLines(&$street){

$street = preg_replace("/[\n\r]/", " ", $street);
}
}
8 changes: 4 additions & 4 deletions app/code/community/TIG/MyParcel2014/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,18 +1155,18 @@ public function calculatePrice()
}

if(
$data['home_address_only'] === true &&
key_exists('home_address_only', $data) &&
$priceComment != 'night' &&
$priceComment != 'morning' &&
$data['signed'] === true &&
key_exists('signed', $data) &&
$this->getConfig('signature_and_only_recipient', 'delivery') > 0
) {
$price += (float)$this->getConfig('signature_and_only_recipient', 'delivery');
} else {
if ($data['home_address_only'] === true && $priceComment != 'night' && $priceComment != 'morning')
if (key_exists('home_address_only', $data) && $priceComment != 'night' && $priceComment != 'morning')
$price += (float)$this->getConfig('only_recipient_fee', 'delivery');

if ($data['signed'] === true)
if (key_exists('signed', $data))
$price += (float)$this->getConfig('signature_fee', 'delivery');
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,17 @@ public function copyAddressToOrder(Varien_Event_Observer $observer)
* Set myparcel json data from checkout
*/
$myParcelData = $quote->getMyparcelData();
$order->setMyparcelData($myParcelData);
$myParcelData = $myParcelData == null ? [] : json_decode($myParcelData, true);
$myParcelData['browser'] = $_SERVER['HTTP_USER_AGENT'];
$order->setMyparcelData(json_encode($myParcelData));

if(json_decode($myParcelData) === null && json_decode($myParcelData)->location === null){
if(key_exists('location', $myParcelData)){
Mage::getModel('tig_myparcel/checkout_service')->removePgAddress($quote);
return $this;
}

$order->setShippingMethod('myparcel_pakjegemak');
$aMyParcelData = json_decode($myParcelData, true);
$aMyParcelData = $myParcelData;
if (key_exists('date', $aMyParcelData)) {
$dateTime = strtotime($aMyParcelData['date'] . ' 00:00:00');
$dropOffDate = $helper->getDropOffDay($dateTime);
Expand Down

0 comments on commit 3ab589b

Please sign in to comment.