Skip to content

Commit

Permalink
PES-2607: updated descriptions for advanced carrier settings and admi…
Browse files Browse the repository at this point in the history
…n UI
  • Loading branch information
jan-potuznik-z committed Feb 12, 2025
1 parent a04b544 commit e4d1e74
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 16 deletions.
3 changes: 2 additions & 1 deletion config/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parameters:
url: https://pes-features-prod-pes.prod.packeta-com.codenow.com/v1/wp
wsdlUrl: http://www.zasilkovna.cz/api/soap-php-bugfix.wsdl
trackingUrl: https://tracking.app.packeta.com/Z%s
supportEmailAddress: e-commerce.support@packeta.com

services:
- Packetery\Module\Framework\WpAdapter
Expand Down Expand Up @@ -41,7 +42,7 @@ services:
- Packetery\Module\Plugin
latteEngineFactory: Packetery\Module\LatteEngineFactory
latteEngine: @latteEngineFactory::create(%latteTempFolder%)
- Packetery\Module\Options\Page
- Packetery\Module\Options\Page(supportEmailAddress: %supportEmailAddress%)
optionsProvider: Packetery\Module\Options\OptionsProvider
- Packetery\Module\Carrier\Downloader
- Packetery\Module\Carrier\Updater
Expand Down
5 changes: 4 additions & 1 deletion public/css/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/css/admin.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion public/scss/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
padding-top: 20px;
padding-bottom: 15px;
vertical-align: top;
min-width: 200px;
min-width: 240px;
}

input[type="text"] {
Expand Down Expand Up @@ -726,6 +726,12 @@ tbody .packetery-log-column-note {
border-right: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
box-shadow: 0 0 40px rgba(0, 0, 0, .1);

.form-table {
th {
width: 360px;
}
}
}

.packeta_log {
Expand Down
38 changes: 26 additions & 12 deletions src/Packetery/Module/Options/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ class Page {
*/
private $urlBuilder;

/**
* @var string
*/
private $supportEmailAddress;

public function __construct(
Engine $latteEngine,
OptionsProvider $optionsProvider,
Expand All @@ -118,17 +123,19 @@ public function __construct(
MessageManager $messageManager,
Http\Request $httpRequest,
ModuleHelper $moduleHelper,
UrlBuilder $urlBuilder
UrlBuilder $urlBuilder,
string $supportEmailAddress
) {
$this->latteEngine = $latteEngine;
$this->optionsProvider = $optionsProvider;
$this->formFactory = $formFactory;
$this->packetaClient = $packetaClient;
$this->logger = $logger;
$this->messageManager = $messageManager;
$this->httpRequest = $httpRequest;
$this->moduleHelper = $moduleHelper;
$this->urlBuilder = $urlBuilder;
$this->latteEngine = $latteEngine;
$this->optionsProvider = $optionsProvider;
$this->formFactory = $formFactory;
$this->packetaClient = $packetaClient;
$this->logger = $logger;
$this->messageManager = $messageManager;
$this->httpRequest = $httpRequest;
$this->moduleHelper = $moduleHelper;
$this->urlBuilder = $urlBuilder;
$this->supportEmailAddress = $supportEmailAddress;
}

/**
Expand Down Expand Up @@ -432,7 +439,7 @@ public function createAdvancedForm(): Form {
$form = $this->formFactory->create( 'packetery_advanced_form' );
$defaults = $this->optionsProvider->getOptionsByName( OptionsProvider::OPTION_NAME_PACKETERY_ADVANCED );

$form->addCheckbox( 'new_carrier_settings_enabled', __( 'Allow new carrier settings', 'packeta' ) )
$form->addCheckbox( 'new_carrier_settings_enabled', __( 'Advanced carrier settings', 'packeta' ) )
->setRequired( false )
->setDefaultValue( OptionsProvider::DEFAULT_VALUE_CARRIER_SETTINGS );

Expand Down Expand Up @@ -900,7 +907,13 @@ public function render(): void {
$latteParams['isCzechLocale'] = $this->moduleHelper->isCzechLocale();
$latteParams['logoZasilkovna'] = $this->urlBuilder->buildAssetUrl( 'public/images/logo-zasilkovna.svg' );
$latteParams['logoPacketa'] = $this->urlBuilder->buildAssetUrl( 'public/images/logo-packeta.svg' );
$latteParams['translations'] = [
$advancedCarrierSettingsDescription = sprintf(
// translators: first %s is line break, second one is e-mail address
__( 'BETA: Once enabled, Packeta carriers will appear as separate shipping methods in WooCommerce - Settings - Shipping. After enabling this feature, you will need to set up shipping methods in WooCommerce again.%1$sThis is an experimental feature. If you experience any issues, please email us at %2$s with a description of the issue.', 'packeta' ),
'<br>',
'<a href="mailto:' . $this->supportEmailAddress . '">' . $this->supportEmailAddress . '</a>'
);
$latteParams['translations'] = [
'packeta' => __( 'Packeta', 'packeta' ),
'title' => __( 'Options', 'packeta' ),
'general' => __( 'General', 'packeta' ),
Expand Down Expand Up @@ -932,6 +945,7 @@ public function render(): void {
'<a href="https://client.packeta.com/senders" target="_blank">',
'</a>'
),
'advancedCarrierSettingsDescription' => $advancedCarrierSettingsDescription,
'packagingWeightDescription' => __( 'This parameter is used to determine the weight of the packaging material. This value is automatically added to the total weight of each order that contains products with non-zero weight. This value is also taken into account when evaluating the weight rules in the cart.', 'packeta' ),
'defaultWeightDescription' => __( 'This value is automatically added to the total weight of each order that contains products with zero weight.', 'packeta' ),
'defaultDimensionsDescription' => __( 'These dimensions will be applied to the packet by default, if required by the carrier.', 'packeta' ),
Expand Down
5 changes: 5 additions & 0 deletions template/options/page-tabs/advanced.latte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
</th>
<td>
<input n:name=new_carrier_settings_enabled>
<div class="packetery-help-block">
<p>
{$translations['advancedCarrierSettingsDescription']|noescape}
</p>
</div>
</td>
</tr>
</table>
Expand Down

0 comments on commit e4d1e74

Please sign in to comment.