update
This commit is contained in:
129
modules/dpdpoland/services/configuration.php
Normal file
129
modules/dpdpoland/services/configuration.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace DpdPoland\Service;
|
||||
|
||||
use Address;
|
||||
use DpdPolandConfiguration;
|
||||
use Order;
|
||||
use Product;
|
||||
|
||||
class ConfigurationService
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects Ref1 parameter from order
|
||||
*
|
||||
* @param Order $order Order object
|
||||
* @param $products
|
||||
* @return int|string Ref1 parameter
|
||||
*/
|
||||
public function getDefaultRef1(Order $order, $products)
|
||||
{
|
||||
$configuration = new DpdPolandConfiguration();
|
||||
|
||||
if ($configuration->ref1 == DpdPolandConfiguration::ADDITIONAL_TYPE_NONE) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($configuration->ref1 == DpdPolandConfiguration::ADDITIONAL_TYPE_STATIC) {
|
||||
return $configuration->ref1_static;
|
||||
}
|
||||
if ($configuration->ref1 == DpdPolandConfiguration::ADDITIONAL_TYPE_DYNAMIC) {
|
||||
switch ($configuration->ref1_dynamic) {
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_ID:
|
||||
return (int)$order->id;
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_REFERENCE:
|
||||
return $order->reference;
|
||||
case DpdPolandConfiguration::DYNAMIC_INVOICE_ID:
|
||||
return (int)$order->invoice_number;
|
||||
case DpdPolandConfiguration::DYNAMIC_SHIPPING_ADDRESS:
|
||||
$shipping_address = new Address((int)$order->id_address_delivery);
|
||||
return $shipping_address->other;
|
||||
case DpdPolandConfiguration::DYNAMIC_PRODUCT_NAME:
|
||||
return count($products) > 0 ? $products[0]['name'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects Ref2 parameter from order
|
||||
*
|
||||
* @param Order $order Order object
|
||||
* @param $products
|
||||
* @return int|string Ref2 parameter
|
||||
*/
|
||||
public function getDefaultRef2(Order $order, $products)
|
||||
{
|
||||
$configuration = new DpdPolandConfiguration();
|
||||
|
||||
if ($configuration->ref2 == DpdPolandConfiguration::ADDITIONAL_TYPE_NONE) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($configuration->ref2 == DpdPolandConfiguration::ADDITIONAL_TYPE_STATIC) {
|
||||
return $configuration->ref2_static;
|
||||
}
|
||||
|
||||
if ($configuration->ref2 == DpdPolandConfiguration::ADDITIONAL_TYPE_DYNAMIC) {
|
||||
switch ($configuration->ref2_dynamic) {
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_ID:
|
||||
return (int)$order->id;
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_REFERENCE:
|
||||
return $order->reference;
|
||||
case DpdPolandConfiguration::DYNAMIC_INVOICE_ID:
|
||||
return (int)$order->invoice_number;
|
||||
case DpdPolandConfiguration::DYNAMIC_SHIPPING_ADDRESS:
|
||||
$shipping_address = new Address((int)$order->id_address_delivery);
|
||||
return $shipping_address->other;
|
||||
case DpdPolandConfiguration::DYNAMIC_PRODUCT_NAME:
|
||||
return count($products) > 0 ? $products[0]['name'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects Data1 parameter from order
|
||||
*
|
||||
* @param Order $order Order object
|
||||
* @param $products
|
||||
* @return int|string Data1 parameter
|
||||
*/
|
||||
public function getDefaultCustomerData1(Order $order, $products)
|
||||
{
|
||||
$configuration = new DpdPolandConfiguration();
|
||||
|
||||
if ($configuration->customer_data_1 == DpdPolandConfiguration::ADDITIONAL_TYPE_NONE) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($configuration->customer_data_1 == DpdPolandConfiguration::ADDITIONAL_TYPE_STATIC) {
|
||||
return $configuration->customer_data_static;
|
||||
}
|
||||
|
||||
if ($configuration->customer_data_1 == DpdPolandConfiguration::ADDITIONAL_TYPE_DYNAMIC) {
|
||||
switch ($configuration->customer_data_dynamic) {
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_ID:
|
||||
return (int)$order->id;
|
||||
case DpdPolandConfiguration::DYNAMIC_ORDER_REFERENCE:
|
||||
return $order->reference;
|
||||
case DpdPolandConfiguration::DYNAMIC_INVOICE_ID:
|
||||
return (int)$order->invoice_number;
|
||||
case DpdPolandConfiguration::DYNAMIC_SHIPPING_ADDRESS:
|
||||
$shipping_address = new Address((int)$order->id_address_delivery);
|
||||
return $shipping_address->other;
|
||||
case DpdPolandConfiguration::DYNAMIC_PRODUCT_NAME:
|
||||
return count($products) > 0 ? $products[0]['name'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
29
modules/dpdpoland/services/index.php
Normal file
29
modules/dpdpoland/services/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2022 DPD Polska Sp. z o.o.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* prestashop@dpd.com.pl so we can send you a copy immediately.
|
||||
*
|
||||
* @author DPD Polska Sp. z o.o.
|
||||
* @copyright 2022 DPD Polska Sp. z o.o.
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of DPD Polska Sp. z o.o.
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
212
modules/dpdpoland/services/label.php
Normal file
212
modules/dpdpoland/services/label.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
|
||||
class LabelService
|
||||
{
|
||||
|
||||
/** @var Context */
|
||||
private $context;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints multiple labels for selected orders
|
||||
*
|
||||
* @param string $printout_format Printout format (A4 or label)
|
||||
* @return array|null Error message
|
||||
*/
|
||||
public function printMultipleLabels($printout_format = DpdPolandConfiguration::PRINTOUT_FORMAT_A4, $orders = null)
|
||||
{
|
||||
$orders = $orders == null ? Tools::getValue('orderBox') : $orders;
|
||||
|
||||
if (empty($orders)) {
|
||||
return $this->displayControllerError($this->translate('No selected orders'));
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
foreach ($orders as $id_order) {
|
||||
$package = DpdPolandPackage::getInstanceByIdOrder((int)$id_order);
|
||||
|
||||
if (!$package->id_package_ws) {
|
||||
$errors[] = sprintf($this->translate('Label is not saved for #%d order'), (int)$id_order);
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
return $this->displayControllerError($errors);
|
||||
}
|
||||
|
||||
$waybills = DpdPolandParcel::getOrdersWaybills($orders);
|
||||
|
||||
if (empty($waybills)) {
|
||||
return $this->displayControllerError($this->translate('No available packages'));
|
||||
}
|
||||
|
||||
$domestic_waybills = array();
|
||||
$international_waybills = array();
|
||||
$pdf_directory = $pdf_directory = _PS_MODULE_DIR_ . 'dpdpoland/pdf/';
|
||||
|
||||
foreach ($waybills as $waybill) {
|
||||
if (!isset($waybill['sessionType']) || !isset($waybill['waybill'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($waybill['sessionType'] == 'domestic' || $waybill['sessionType'] == 'domestic_with_cod' || $waybill['sessionType'] == 'pudo') {
|
||||
$domestic_waybills[] = $waybill['waybill'];
|
||||
} elseif ($waybill['sessionType'] == 'international') {
|
||||
$international_waybills[] = $waybill['waybill'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($domestic_waybills) && empty($international_waybills)) {
|
||||
return $this->displayControllerError($this->translate('No available labels'));
|
||||
}
|
||||
|
||||
$package = new DpdPolandPackage();
|
||||
|
||||
if ($domestic_waybills) {
|
||||
$pdf_content = $package->generateMultipleLabels($domestic_waybills, $printout_format, 'DOMESTIC');
|
||||
|
||||
if ($pdf_content === false) {
|
||||
return $this->displayControllerError(reset(DpdPolandPackageWS::$errors));
|
||||
}
|
||||
|
||||
if (empty($international_waybills)) {
|
||||
$this->displayPDF($pdf_content, 'domestic_labels');
|
||||
}
|
||||
|
||||
if (!$this->savePDFFile($pdf_content, 'domestic')) {
|
||||
return $this->displayControllerError(
|
||||
$this->translate('Could not create PDF file. Please check module folder permissions')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($international_waybills) {
|
||||
$pdf_content = $package->generateMultipleLabels($international_waybills, $printout_format, 'INTERNATIONAL');
|
||||
|
||||
if ($pdf_content === false) {
|
||||
return $this->displayControllerError(reset(DpdPolandPackageWS::$errors));
|
||||
}
|
||||
|
||||
if (empty($domestic_waybills)) {
|
||||
$this->displayPDF($pdf_content, 'international_labels');
|
||||
}
|
||||
|
||||
if (!$this->savePDFFile($pdf_content, 'international')) {
|
||||
return $this->displayControllerError(
|
||||
$this->translate('Could not create PDF file. Please check module folder permissions')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($domestic_waybills && $international_waybills) {
|
||||
include_once(_PS_MODULE_DIR_ . 'dpdpoland/libraries/PDFMerger/PDFMerger.php');
|
||||
|
||||
$pdf = new PDFMerger;
|
||||
|
||||
$pdf->addPDF($pdf_directory . 'label_domestic.pdf', 'all');
|
||||
$pdf->addPDF($pdf_directory . 'label_international.pdf', 'all');
|
||||
$pdf->merge('file', $pdf_directory . 'multiple_label.pdf');
|
||||
|
||||
ob_end_clean();
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="multiple_label.pdf"');
|
||||
readfile($pdf_directory . 'multiple_label.pdf');
|
||||
|
||||
if (file_exists($pdf_directory . 'label_domestic.pdf') && is_writable($pdf_directory . 'label_domestic.pdf')) {
|
||||
unlink($pdf_directory . 'label_domestic.pdf');
|
||||
}
|
||||
|
||||
if (file_exists($pdf_directory . 'label_international.pdf') && is_writable($pdf_directory . 'label_international.pdf')) {
|
||||
unlink($pdf_directory . 'label_international.pdf');
|
||||
}
|
||||
|
||||
if (file_exists($pdf_directory . 'multiple_label.pdf') && is_writable($pdf_directory . 'multiple_label.pdf')) {
|
||||
unlink($pdf_directory . 'multiple_label.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
$url = $this->context->link->getAdminLink('AdminOrders');
|
||||
Tools::redirectAdmin($url);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays error message in module controller
|
||||
*
|
||||
* @param string|array $messages Error message(s)
|
||||
* @return array|null Error message(s)
|
||||
*/
|
||||
private function displayControllerError($messages)
|
||||
{
|
||||
if (!is_array($messages)) {
|
||||
$messages = array($messages);
|
||||
}
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.5', '<')) {
|
||||
return $messages;
|
||||
}
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$this->context->controller->errors[] = $message;
|
||||
}
|
||||
|
||||
DpdPolandLog::addError(json_encode($messages));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->context->controller->errors;
|
||||
}
|
||||
|
||||
private function translate($string)
|
||||
{
|
||||
return Translate::getModuleTranslation('dpdpoland', $string, 'dpdpoland');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes PDF file to be downloadable
|
||||
*
|
||||
* @param string $pdf_content PDF file content
|
||||
* @param $name PDF file name
|
||||
*/
|
||||
private function displayPDF($pdf_content, $name)
|
||||
{
|
||||
ob_end_clean();
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="' . pSQL($name) . '.pdf"');
|
||||
|
||||
echo $pdf_content;
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves PDF file in module directory
|
||||
*
|
||||
* @param string $pdf_content PDF content
|
||||
* @param string $type Shipment type (domestic, international)
|
||||
* @return bool PDF file saved successfully
|
||||
*/
|
||||
private function savePDFFile($pdf_content, $type = 'domestic')
|
||||
{
|
||||
$pdf_directory = $pdf_directory = _PS_MODULE_DIR_ . 'dpdpoland/pdf/';
|
||||
$fp = fopen($pdf_directory . 'label_' . pSQL($type) . '.pdf', 'a');
|
||||
|
||||
if (!$fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fwrite($fp, $pdf_content);
|
||||
fclose($fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
33
modules/dpdpoland/services/pickupIframe.php
Normal file
33
modules/dpdpoland/services/pickupIframe.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace DpdPoland\Service;
|
||||
|
||||
use Address;
|
||||
use Cart;
|
||||
use Country;
|
||||
use Exception;
|
||||
|
||||
class PickupIframeService
|
||||
{
|
||||
const PL_CONST = 'PL';
|
||||
const PUDO_BASE_URL = '//pudofinder.dpd.com.pl/widget?key=1ae3418e27627ab52bebdcc1a958fa04';
|
||||
|
||||
public static function getPickupIframeUrl($isCod, $isSwipbox, $idCart)
|
||||
{
|
||||
try {
|
||||
$cart = new Cart($idCart);
|
||||
$orderAddress = new Address((int)$cart->id_address_delivery);
|
||||
$countryIso = Country::getIsoById($orderAddress->id_country);
|
||||
} catch (Exception $e) {
|
||||
$countryIso = self::PL_CONST;
|
||||
}
|
||||
|
||||
if ($isCod)
|
||||
return self::PUDO_BASE_URL . '&direct_delivery_cod=1&query=' . $countryIso;
|
||||
|
||||
if ($isSwipbox)
|
||||
return self::PUDO_BASE_URL . '&swip_box=1&hideFilters=1&query=' . $countryIso;
|
||||
|
||||
return self::PUDO_BASE_URL . '&query=' . $countryIso;
|
||||
}
|
||||
}
|
||||
179
modules/dpdpoland/services/pudo.php
Normal file
179
modules/dpdpoland/services/pudo.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace DpdPoland\Service;
|
||||
|
||||
use Address;
|
||||
use Country;
|
||||
use Customer;
|
||||
use DpdPolandLog;
|
||||
use Exception;
|
||||
use SimpleXMLElement;
|
||||
use Translate;
|
||||
|
||||
class PudoService
|
||||
{
|
||||
|
||||
const PUDO_WS_URL = 'https://mypudo.dpd.com.pl/api/pudo/details?pudoId=%s&key=4444';
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pudo address as PrestaShop Address object from web service, when idCustomer has value save pickup address
|
||||
*
|
||||
* @param string $pudoCode
|
||||
* @param int $idCustomer
|
||||
*
|
||||
* @param string $phone
|
||||
* @return Address|null
|
||||
*/
|
||||
public function getPudoAddress($pudoCode, $idCustomer = null, $phone = '000000000')
|
||||
{
|
||||
if (false == $pudoCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
$url = sprintf(self::PUDO_WS_URL, $pudoCode);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, sdch, br');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Accept-Encoding: gzip, deflate, sdch, br',
|
||||
'Accept-Language: en-US,en;q=0.8',
|
||||
'Cache-Control: max-age=0',
|
||||
'Connection: keep-alive',
|
||||
'Host: mypudo.dpd.com.pl',
|
||||
'Upgrade-Insecure-Requests: 1',
|
||||
'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
||||
));
|
||||
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if (!$result) {
|
||||
DpdPolandLog::addError('Error in getPudoAddress curl_exec');
|
||||
return null;
|
||||
}
|
||||
|
||||
$xml = new SimpleXMLElement($result);
|
||||
|
||||
if (!isset($xml->PUDO_ITEMS) || !isset($xml->PUDO_ITEMS->PUDO_ITEM)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isset($xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS1) ||
|
||||
!isset($xml->PUDO_ITEMS->PUDO_ITEM->CITY) ||
|
||||
!isset($xml->PUDO_ITEMS->PUDO_ITEM->ZIPCODE)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$idCountry = $idCustomer != null ? Country::getByIso('PL') : null;
|
||||
|
||||
if (!$idCountry && $idCustomer != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$customer = $idCustomer != null ? new Customer($idCustomer) : null;
|
||||
|
||||
$company = array_filter([
|
||||
$pudoCode,
|
||||
$xml->PUDO_ITEMS->PUDO_ITEM->LOCATION_HINT
|
||||
]);
|
||||
|
||||
$address = new Address();
|
||||
$address->address1 = $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS1;
|
||||
$address->city = $xml->PUDO_ITEMS->PUDO_ITEM->CITY;
|
||||
$address->postcode = $xml->PUDO_ITEMS->PUDO_ITEM->ZIPCODE;
|
||||
$address->id_country = $idCountry;
|
||||
$address->id_state = 0;
|
||||
$address->id_manufacturer = 0;
|
||||
$address->id_supplier = 0;
|
||||
$address->id_warehouse = 0;
|
||||
$address->alias = $this->translate('Point Pick Up');
|
||||
$address->company = implode(', ', $company);
|
||||
$address->address2 = '';
|
||||
$address->other = '';
|
||||
$address->phone = $phone;
|
||||
$address->vat_number = '';
|
||||
$address->dni = '';
|
||||
$address->deleted = 1;
|
||||
|
||||
if ($customer != null) {
|
||||
$address->firstname = $customer->firstname;
|
||||
$address->lastname = $customer->lastname;
|
||||
$address->id_customer = (int)$customer->id;
|
||||
if (!empty($customer->company))
|
||||
$address->company = $customer->company;
|
||||
}
|
||||
try {
|
||||
if ($idCustomer != null && !$address->save()) {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if pudo has COD (101) service
|
||||
*
|
||||
* @param string $pudoCode
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function hasCodService($pudoCode)
|
||||
{
|
||||
if (false == $pudoCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
$url = sprintf(self::PUDO_WS_URL, $pudoCode);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, sdch, br');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Accept-Encoding: gzip, deflate, sdch, br',
|
||||
'Accept-Language: en-US,en;q=0.8',
|
||||
'Cache-Control: max-age=0',
|
||||
'Connection: keep-alive',
|
||||
'Host: mypudo.dpd.com.pl',
|
||||
'Upgrade-Insecure-Requests: 1',
|
||||
'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
||||
));
|
||||
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if (!$result) {
|
||||
DpdPolandLog::addError('Error in getPudoAddress curl_exec');
|
||||
return null;
|
||||
}
|
||||
|
||||
$xml = new SimpleXMLElement($result);
|
||||
|
||||
if (!isset($xml->PUDO_ITEMS) || !isset($xml->PUDO_ITEMS->PUDO_ITEM) || !isset($xml->PUDO_ITEMS->PUDO_ITEM->SERVICE_PUDO))
|
||||
return 0;
|
||||
|
||||
if (strpos($xml->PUDO_ITEMS->PUDO_ITEM->SERVICE_PUDO, "101") !== false)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function translate($string)
|
||||
{
|
||||
return Translate::getModuleTranslation('dpdpoland', $string, 'dpdpoland');
|
||||
}
|
||||
}
|
||||
1010
modules/dpdpoland/services/shipping.php
Normal file
1010
modules/dpdpoland/services/shipping.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user