Add InPost Pay integration to admin templates

- Created a new template for the cart rule form with custom label, switch, and choice widgets.
- Implemented the InPost Pay block in the order details template for displaying delivery method, APM, and VAT invoice request.
- Added legacy support for the order details template to maintain compatibility with older PrestaShop versions.
This commit is contained in:
2025-09-14 14:38:09 +02:00
parent d895f86a03
commit 4066f6fa31
1086 changed files with 76598 additions and 6 deletions

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace izi\prestashop\Http\Util;
final class UriResolver
{
public static function resolve(string $uri, string $baseUri): string
{
$uriParts = parse_url($uri);
if (!empty($uriParts['host'])) {
return $uri;
}
$baseUriParts = parse_url($baseUri);
$uriParts['path'] = self::resolvePath($baseUriParts, $uriParts);
$uriParts += $baseUriParts;
return http_build_url($uriParts);
}
private static function resolvePath(array $baseUri, array $uri): string
{
$basePath = $baseUri['path'] ?? null;
$path = $uri['path'] ?? null;
if (null === $path) {
$path = $basePath;
} elseif ('/' !== $path[0]) {
if (null === $basePath) {
$path = '/' . $path;
} else {
$segments = explode('/', $basePath);
array_splice($segments, -1, 1, [$path]);
$path = implode('/', $segments);
}
}
return empty($path) ? '/' : $path;
}
}