Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Release/1.2 (#87)
Browse files Browse the repository at this point in the history
* added postnumber to servicepoint data

* added postnumber to order, sales and quote table

* added postnumber functionality

* removed validation message after picking an service point

* fixed checkout styling for amasty checkout

* refactored less file

* changed version

* fix for disappearing validation in Onestepcheckout

* fixed merge issue

* check if there is an selected shipping method

* added a check if there is an selected shipping method

* added warning message and styling

* removed old notification handler and added an scroll in to view for the new one

* fixed 'use strict' tag

* added observable servicePointData

* added mixin for Mageplaza Osc

* changed version

* changed brand logo's and name

* removed logging

* added an extra check if the quote.shippingMethod() is available

* fixed setup issue

* changed version from 1.2 to 1.2.0

Co-authored-by: rick <[email protected]>
  • Loading branch information
aderik and rick authored May 18, 2020
1 parent e27b005 commit b1f5e80
Show file tree
Hide file tree
Showing 36 changed files with 277 additions and 99 deletions.
16 changes: 8 additions & 8 deletions Block/System/Config/Form/Branding.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class Branding extends Field
{
const SENDCLOUD_URL = 'https://www.sendcloud.nl';
const CREATIVEICT_URL = 'https://www.creative-ct.nl';
const SENDCLOUD_URL = 'https://www.sendcloud.com';
const CREATIVECT_URL = 'https://www.creative-ct.nl';

protected $_template = 'SendCloud_SendCloud::system/config/branding.phtml';

Expand All @@ -19,24 +19,24 @@ class Branding extends Field
*/
public function render(AbstractElement $element)
{
$element->addClass('creativeict');
$element->addClass('creative-ct');

return $this->toHtml();
}

public function getSendCloudLogo()
{
return $this->getViewFileUrl('SendCloud_SendCloud::images/sendcloud-logo.png');
return $this->getViewFileUrl('SendCloud_SendCloud::images/sendcloud-logo.svg');
}

public function getCreativeICTLogo()
public function getCreativeCTLogo()
{
return $this->getViewFileUrl('SendCloud_SendCloud::images/creativeict-logo.png');
return $this->getViewFileUrl('SendCloud_SendCloud::images/creative-ct-logo.svg');
}

public function getCreativeICTUrl()
public function getCreativeCTUrl()
{
return self::CREATIVEICT_URL;
return self::CREATIVECT_URL;
}

public function getSendCloudUrl()
Expand Down
1 change: 1 addition & 0 deletions Observer/SaveServicePointsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function execute(Observer $observer)
$order->setSendcloudServicePointZipCode($quote->getSendcloudServicePointZipCode());
$order->setSendcloudServicePointCity($quote->getSendcloudServicePointCity());
$order->setSendcloudServicePointCountry($quote->getSendcloudServicePointCountry());
$order->setSendcloudServicePointPostnumber($quote->getSendcloudServicePointPostnumber());

return $this;
}
Expand Down
1 change: 1 addition & 0 deletions Observer/SetOrderAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function execute(Observer $observer)
$order->setSendcloudServicePointZipCode($quote->getSendcloudServicePointZipCode());
$order->setSendcloudServicePointCity($quote->getSendcloudServicePointCity());
$order->setSendcloudServicePointCountry($quote->getSendcloudServicePointCountry());
$order->setSendcloudServicePointPostnumber($quote->getSendcloudServicePointPostnumber());

return $this;
}
Expand Down
2 changes: 2 additions & 0 deletions Plugin/BeforeSaveShippingInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function beforeSaveAddressInformation(ShippingInformationManagement $subj
$spZipCode = $extensionAttributes->getSendcloudServicePointZipCode();
$spCity = $extensionAttributes->getSendcloudServicePointCity();
$spCountry = $extensionAttributes->getSendcloudServicePointCountry();
$spPostnumber = $extensionAttributes->getSendcloudServicePointPostnumber();

$quote = $this->quoteRepository->getActive($cartId);
$quote->setSendcloudServicePointId($spId);
Expand All @@ -76,6 +77,7 @@ public function beforeSaveAddressInformation(ShippingInformationManagement $subj
$quote->setSendcloudServicePointZipCode($spZipCode);
$quote->setSendcloudServicePointCity($spCity);
$quote->setSendcloudServicePointCountry($spCountry);
$quote->setSendcloudServicePointPostnumber($spPostnumber);
}
}
}
3 changes: 2 additions & 1 deletion Plugin/Order/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ private function loadSendCloudExtensionAttributes(OrderInterface $order)
$extensionAttributes->setSendcloudServicePointZipCode($order->getSendcloudServicePointZipCode());
$extensionAttributes->setSendcloudServicePointCity($order->getSendcloudServicePointCity());
$extensionAttributes->setSendcloudServicePointCountry($order->getSendcloudServicePointCountry());
$extensionAttributes->setSendcloudServicePointPostnumber($order->getSendcloudServicePointPostnumber());
} catch (NoSuchEntityException $e) {
return $this;
}
}
}
}
31 changes: 31 additions & 0 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
$setup = $this->addColumns($setup, 'sales_order_grid');
$setup = $this->addColumns($setup, 'quote');
}
if (version_compare($context->getVersion(), '1.2.0', '<=')) {
$setup = $this->addPostnumber($setup, 'sales_order');
$setup = $this->addPostnumber($setup, 'sales_order_grid');
$setup = $this->addPostnumber($setup, 'quote');
}
$setup->endSetup();
}

Expand Down Expand Up @@ -108,6 +113,32 @@ private function addColumns($setup, $tableName)
'comment' => 'service point country'
]
);
$connection->addColumn(
$setup->getTable($tableName),
'sendcloud_service_point_postnumber',
[
'type' => Table::TYPE_TEXT,
'length' => 255,
'nullable' => true,
'comment' => 'service point post number'
]
);

return $setup;
}

private function addPostnumber($setup, $tableName) {
$connection = $setup->getConnection();
$connection->addColumn(
$setup->getTable($tableName),
'sendcloud_service_point_postnumber',
[
'type' => Table::TYPE_TEXT,
'length' => 255,
'nullable' => true,
'comment' => 'service point post number'
]
);

return $setup;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "magento2-module",
"homepage": "https://www.sendcloud.com/",
"license": "Apache-2.0",
"version": "1.1.2",
"version": "1.2.0",
"require": {
"magento/module-backend": "^100.0|^101.0",
"magento/module-catalog-inventory": "^100.0",
Expand Down
3 changes: 2 additions & 1 deletion etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
<item name="sendcloud_service_point_zip_code" xsi:type="string">sales_order.sendcloud_service_point_zip_code</item>
<item name="sendcloud_service_point_city" xsi:type="string">sales_order.sendcloud_service_point_city</item>
<item name="sendcloud_service_point_country" xsi:type="string">sales_order.sendcloud_service_point_country</item>
<item name="sendcloud_service_point_postnumber" xsi:type="string">sales_order.sendcloud_service_point_postnumber</item>
</argument>
</arguments>
</virtualType>

</config>
</config>
4 changes: 3 additions & 1 deletion etc/extension_attributes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<attribute code="sendcloud_service_point_zip_code" type="string"/>
<attribute code="sendcloud_service_point_city" type="string"/>
<attribute code="sendcloud_service_point_country" type="string"/>
<attribute code="sendcloud_service_point_postnumber" type="string"/>
</extension_attributes>
<extension_attributes for="Magento\Checkout\Api\Data\ShippingInformationInterface">
<attribute code="sendcloud_service_point_id" type="int"/>
Expand All @@ -17,5 +18,6 @@
<attribute code="sendcloud_service_point_zip_code" type="string"/>
<attribute code="sendcloud_service_point_city" type="string"/>
<attribute code="sendcloud_service_point_country" type="string"/>
<attribute code="sendcloud_service_point_postnumber" type="string"/>
</extension_attributes>
</config>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="SendCloud_SendCloud" setup_version="1.1.2">
<module name="SendCloud_SendCloud" setup_version="1.2.0">
<sequence>
<module name="Magento_Shipping"/>
<module name="Magento_Checkout" />
Expand Down
3 changes: 2 additions & 1 deletion view/adminhtml/templates/order/view/info.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ endif; ?>
<address>
<?= /* @escapeNotVerified */ $order->getSendcloudServicePointName() ?><br>
<?= /* @escapeNotVerified */ $order->getSendcloudServicePointStreet() ?> <?= /* @escapeNotVerified */ $order->getSendcloudServicePointHouseNumber() ?><br>
<?= /* @escapeNotVerified */ $order->getSendcloudServicePointZipCode() ?> <?= /* @escapeNotVerified */ $order->getSendcloudServicePointCity() ?>
<?= /* @escapeNotVerified */ $order->getSendcloudServicePointZipCode() ?> <?= /* @escapeNotVerified */ $order->getSendcloudServicePointCity() ?><br>
<?= /* @escapeNotVerified */ $order->getSendcloudServicePointPostnumber()?>
</address>
</div>
<?php endif; ?>
Expand Down
8 changes: 4 additions & 4 deletions view/adminhtml/templates/system/config/branding.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<img width="123" src="<?= /* @escapeNotVerified */ $block->getSendCloudLogo() ?>"/>
</div>
<div class="logo-wrap">
<img style="position: relative; top:2px;" width="110" src="<?= $block->getCreativeICTLogo() ?>"/>
<img width="110" src="<?= $block->getCreativeCTLogo() ?>"/>
</div>
<div class="content">
<p>
<?=__('SendCloud | The Number 1 Shipping Tool | Contact ');?>
<a href="<?= /* @escapeNotVerified */ $block->getSendCloudUrl() ?>" target="_blank"><?=__('SendCloud');?></a> <?=__('for support and more information.');?>
<?=__('SendCloud Magento module developed by');?> <a href="<?= /* @escapeNotVerified */ $block->getCreativeICTUrl() ?>" target="_blank"><?=__('CreativeICT');?></a> <?=__('a Full Service Digital Agency.');?></p>
<a href="<?= /* @escapeNotVerified */ $block->getSendCloudUrl() ?>" target="_blank">SendCloud</a> <?=__('for support and more information.');?>
<?=__('SendCloud Magento module developed by');?> <a href="<?= /* @escapeNotVerified */ $block->getCreativeCTUrl() ?>" target="_blank">CreativeCT</a> Growth Driven E-commerce.</p>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion view/adminhtml/templates/view/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ $order = $block->getShipment()->getOrder();
<address>
<?= $order->getSendcloudServicePointName() ?><br>
<?= $order->getSendcloudServicePointStreet() ?> <?= $order->getSendcloudServicePointHouseNumber() ?><br>
<?= $order->getSendcloudServicePointZipCode() ?> <?= $order->getSendcloudServicePointCity() ?>
<?= $order->getSendcloudServicePointZipCode() ?> <?= $order->getSendcloudServicePointCity() ?><br>
<?= $order->getSendcloudServicePointPostnumber() ?>
</address>
</div>
<?php endif; ?>
Expand Down
5 changes: 3 additions & 2 deletions view/adminhtml/web/css/branding.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.sendcloud-branding {
margin: 20px 0;
display: flex;
}
.sendcloud-branding .logo-wrap {
width: 10%;
display: inline-block;
display: flex;
margin-right: 2%;
}
.sendcloud-branding .content {
Expand All @@ -13,4 +14,4 @@
line-height: 30px;
border-left: 1px solid #cccccc;
vertical-align: sub;
}
}
1 change: 1 addition & 0 deletions view/adminhtml/web/images/creative-ct-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed view/adminhtml/web/images/creativeict-logo.png
Binary file not shown.
Binary file removed view/adminhtml/web/images/sendcloud-logo.png
Binary file not shown.
Loading

0 comments on commit b1f5e80

Please sign in to comment.