first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
class BaseLinkerOrder extends Order {
public $bl_delivery_point_name;
public $bl_delivery_point_address;
public $bl_delivery_point_city;
public $bl_delivery_point_postcode;
public function __construct($id = null, $idLang = null) {
self::$definition = parent::$definition;
self::$definition['fields']['bl_delivery_point_name'] = array('type' => self::TYPE_STRING);
self::$definition['fields']['bl_delivery_point_address'] = array('type' => self::TYPE_STRING);
self::$definition['fields']['bl_delivery_point_city'] = array('type' => self::TYPE_STRING);
self::$definition['fields']['bl_delivery_point_postcode'] = array('type' => self::TYPE_STRING);
parent::__construct($id, $idLang);
if ($id) {
if (!$idLang) {
$idLang = Configuration::get('PS_LANG_DEFAULT');
}
$carrier = new Carrier($this->id_carrier);
if ($carrier->external_module_name == 'gmparcellocker') {
$m = Module::getInstanceByName('gmparcellocker');
$parcel = $m->getParcelAddressForCart((int) $this->id_cart);
$this->bl_delivery_point_name = $parcel['parcel_name'];
$this->bl_delivery_point_address = $parcel['address'];
$this->bl_delivery_point_postcode = $parcel['postcode'];
$this->bl_delivery_point_city = $parcel['city'];
}
if ($carrier->external_module_name == 'gmpickup') {
$m = Module::getInstanceByName('gmpickup');
$storeId = $m->getSelectedStoreIdForCart((int) $this->id_cart);
$store = new Store($storeId, $idLang);
$this->bl_delivery_point_name = $store->name;
$this->bl_delivery_point_address = $store->address1.' '.$store->address2;
$this->bl_delivery_point_postcode = $store->postcode;
$this->bl_delivery_point_city = $store->city;
}
}
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>gmparcellocker</name>
<displayName><![CDATA[Parcel locker]]></displayName>
<version><![CDATA[1.4.0]]></version>
<description><![CDATA[Allows the customer to chose a parcel locker in the cart]]></description>
<author><![CDATA[GreenMouseStudio.com]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>gmparcellocker</name>
<displayName><![CDATA[Paczkomaty 24/7]]></displayName>
<version><![CDATA[1.4.0]]></version>
<description><![CDATA[Umożliwia wyb&oacute;r paczkomatu w koszyku]]></description>
<author><![CDATA[GreenMouseStudio.com]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,28 @@
<?php
class GmParcelLockerAjaxModuleFrontController extends ModuleFrontController {
public function initContent() {
ob_end_clean();
header('Content-Type: application/json');
$cartId = (int) Tools::getValue('cartId');
$pointData = trim(Tools::getValue('pointData'));
$db = Db::getInstance();
$storedPoint = $db->getValue('SELECT `parcel` FROM `' . _DB_PREFIX_ . 'gmparcellocker` WHERE `id_cart` = ' . $cartId);
if ($storedPoint !== false) {
$res = $db->update('gmparcellocker', ['parcel' => pSQL($pointData)], 'id_cart = ' . $cartId);
} else {
$res = $db->insert('gmparcellocker', ['parcel' => pSQL($pointData), 'id_cart' => $cartId]);
}
if ($res) {
$msg = 'OK';
} else {
$msg = 'Error';
}
die(json_encode([
'msg' => $msg
]));
}
}

View File

@@ -0,0 +1,368 @@
<?php
/**
* Parcel Locker Module
*
* @package gmparcellocker
* @author Dariusz Tryba (contact@greenmousestudio.com)
* @copyright Copyright (c) Green Mouse Studio (http://www.greenmousestudio.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
if (!class_exists('BaseLinkerOrder')) {
require_once(_PS_MODULE_DIR_ . 'gmparcellocker/classes/BaseLinkerOrder.php');
}
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
class GmParcelLocker extends Module implements WidgetInterface {
public function __construct() {
$this->name = 'gmparcellocker';
$this->prefix = strtoupper($this->name);
$this->tab = 'shipping_logistics';
$this->version = '1.4.0';
$this->author = 'GreenMouseStudio.com';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Parcel locker');
$this->description = $this->l('Allows the customer to chose a parcel locker in the cart');
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
$this->templateFile = 'module:gmparcellocker/views/templates/choice.tpl';
}
public function install() {
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
if (!parent::install() || !$this->registerHook('displayCarrierExtraContent') || !$this->installDb() || !$this->createCarriers() || !$this->registerHook('header') || !$this->registerHook('actionValidateOrder') || !$this->registerHook('sendMailAlterTemplateVars') || !$this->registerHook('addWebserviceResources')
) {
Configuration::updateValue('GMPARCELLOCKER_REPLACE', false);
Configuration::updateValue('GMPARCELLOCKER_DISPLAY', 'modal');
return false;
}
return true;
}
public function getContent() {
$content = '';
$content .= '<p class="alert alert-warning">' . $this->l('Remember to configure and activate the new Parcel Locker carrier created by the module') . '</p>';
if (Tools::isSubmit('submit' . $this->name)) {
Configuration::updateValue('GMPARCELLOCKER_REPLACE', (int) Tools::getValue('GMPARCELLOCKER_REPLACE'));
Configuration::updateValue('GMPARCELLOCKER_DISPLAY', Tools::getValue('GMPARCELLOCKER_DISPLAY'));
$content .= $this->displayConfirmation($this->l('Settings updated'));
}
$content .= $this->renderForm();
return $content . $this->context->smarty->fetch($this->local_path . 'views/templates/admin/gms.tpl');
}
public function renderForm() {
$displays = array(
array(
'id' => 'modal',
'name' => $this->l('Modal')
),
array(
'id' => 'dropdown',
'name' => $this->l('Dropdown')
),
);
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs',
),
'input' => array(
array(
'type' => 'switch',
'label' => $this->l('Replace delivery address with parcel locker address'),
'name' => 'GMPARCELLOCKER_REPLACE',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('No'),
),
),
),
array(
'type' => 'select',
'label' => $this->l('Display type'),
'name' => 'GMPARCELLOCKER_DISPLAY',
'options' => array(
'query' => $displays,
'id' => 'id',
'name' => 'name'
),
),
),
'submit' => array(
'title' => $this->l('Save'),
),
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$this->fields_form = array();
$helper->identifier = $this->identifier;
$helper->submit_action = 'submit' . $this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab
. '&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
);
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues() {
return array(
'GMPARCELLOCKER_REPLACE' => (bool) Tools::getValue('GMPARCELLOCKER_REPLACE', Configuration::get('GMPARCELLOCKER_REPLACE')),
'GMPARCELLOCKER_DISPLAY' => Tools::getValue('GMPARCELLOCKER_DISPLAY', Configuration::get('GMPARCELLOCKER_DISPLAY')),
);
}
public function displayInfoByCart($cartId) {
$pointData = $this->getPointDataForCart($cartId);
$this->context->smarty->assign('gmChosenParcel', $pointData);
return $this->context->smarty->fetch($this->local_path . 'views/templates/admin/parcel.tpl');
}
protected function createCarriers() {
$carrier = new Carrier();
$carrier->name = $this->l('Parcel Locker');
$carrier->active = 0;
$carrier->is_free = 0;
$carrier->shipping_handling = 1;
$carrier->shipping_external = 0;
$carrier->shipping_method = 1;
$carrier->max_width = 0;
$carrier->max_height = 0;
$carrier->max_depth = 0;
$carrier->max_weight = 0;
$carrier->grade = 0;
$carrier->is_module = 1;
$carrier->need_range = 1;
$carrier->range_behavior = 1;
$carrier->external_module_name = $this->name;
$carrier->url = 'https://inpost.pl/sledzenie-przesylek?number=@';
$delay = array();
foreach (Language::getLanguages(false) as $language) {
$delay[$language['id_lang']] = $this->l('Parcel Locker');
}
$carrier->delay = $delay;
if (!$carrier->save()) {
return false;
}
$groups = [];
foreach (Group::getGroups((int) Context::getContext()->language->id) as $group) {
$groups[] = $group['id_group'];
}
if (!$carrier->setGroups($groups)) {
return false;
}
return true;
}
protected function installDb() {
return Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'gmparcellocker` (
`id_cart` int(10) unsigned NOT NULL,
`parcel` varchar(128),
PRIMARY KEY (`id_cart`)
) ENGINE=' . _MYSQL_ENGINE_ . ' default CHARSET=utf8');
}
public function uninstall() {
Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'gmparcellocker`');
Configuration::deleteByName('GMPARCELLOCKER_REPLACE');
Configuration::deleteByName('GMPARCELLOCKER_DISPLAY');
return parent::uninstall();
}
public function hookDisplayCarrierExtraContent($params) {
$cart = $this->context->cart;
//$deliveryAddress = new Address($cart->id_address_delivery);
//$searchAddress = $deliveryAddress->address1 . ' ' . $deliveryAddress->postcode . ' ' . $deliveryAddress->city;
$pointData = $this->getPointDataForCart($cart->id);
$this->context->smarty->assign([
'gmChosenParcel' => $pointData,
//'gmSearchAddress' => $searchAddress
]);
$displayOption = Configuration::get('GMPARCELLOCKER_DISPLAY');
if ($displayOption == 'dropdown') {
return $this->context->smarty->fetch($this->local_path . 'views/templates/dropdown.tpl');
} else {
return $this->context->smarty->fetch($this->local_path . 'views/templates/button.tpl');
}
}
public function getParcelAddressForCart($cartId) {
$pointData = $this->getPointDataForCart($cartId, true);
$parts = explode('|', $pointData);
$address = [
'parcel_name' => $parts[0],
'address' => $parts[1],
'postcode' => substr(trim($parts[2]), 0, 6),
'city' => trim(substr($parts[2], 7))
];
return $address;
}
public function getPointDataForCart($cartId, $raw = false) {
$pointData = Db::getInstance()->getValue('SELECT `parcel` FROM `' . _DB_PREFIX_ . 'gmparcellocker` WHERE `id_cart` = ' . $cartId);
if ($pointData) {
if (!$raw) {
$pointData = str_replace('|', ',', $pointData);
}
return $pointData;
}
return '---';
}
public function hookHeader() {
if ($this->context->controller->php_self === 'order' || Tools::getValue('controller') == 'supercheckout' || Tools::getValue('controller') == 'checkout') {
$cartId = Context::getContext()->cart->id;
Media::addJsDef(['gmCartId' => $cartId,
'gmParcelLockerAjaxUrl' => $this->context->link->getModuleLink('gmparcellocker', 'ajax', array(), null,
null, null, true),]);
$this->context->controller->registerStylesheet('gmparcellocker-css',
'modules/' . $this->name . '/views/css/gmparcellocker.css',
[
'media' => 'all',
'priority' => 200,
]);
$displayOption = Configuration::get('GMPARCELLOCKER_DISPLAY');
if ($displayOption == 'dropdown') {
$this->context->controller->registerJavascript('gmparcellocker-js130-dropdown',
'modules/' . $this->name . '/views/js/gmparcellocker-dropdown.js',
[
'position' => 'bottom',
'priority' => 150
]);
} else {
$this->context->controller->registerJavascript('gmparcellocker-js130',
'modules/' . $this->name . '/views/js/gmparcellocker.js',
[
'position' => 'bottom',
'priority' => 150
]);
}
return '<script src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
<link rel="stylesheet" href="https://geowidget.easypack24.net/css/easypack.css"/>';
}
}
public function hookActionValidateOrder($params) {
if ((bool) Configuration::get('GMPARCELLOCKER_REPLACE')) {
$order = $params['order'];
$cart = $params['cart'];
$carrier = new Carrier($order->id_carrier);
if ($carrier->external_module_name == $this->name) {
try {
$current = new Address($order->id_address_delivery);
$a = new Address();
$parcelAddress = $this->getParcelAddressForCart($cart->id);
$a->alias = $parcelAddress['parcel_name'];
$a->id_customer = $current->id_customer;
$a->id_country = $current->id_country;
$a->firstname = $this->l('Parcel');
$a->lastname = '.';
$a->address1 = $parcelAddress['address'];
if (strlen($current->address2) > 0) {
$a->address2 = '.';
}
$a->city = $parcelAddress['city'];
$a->postcode = $parcelAddress['postcode'];
$a->phone = $current->phone;
$a->phone_mobile = $current->phone_mobile;
$a->deleted = true;
$a->save();
$this->forceParcelName($a->id, $parcelAddress['parcel_name']);
$order->id_address_delivery = $a->id;
$order->update();
} catch (Exception $e) {
PrestaShopLogger::addLog($e->getMessage(), 3);
}
}
}
}
protected function forceParcelName($addressId, $parcelName) {
Db::getInstance()->update('address', ['lastname' => $parcelName], 'id_address = ' . (int) $addressId);
}
public function hookSendMailAlterTemplateVars($params) {
$template = $params['template'];
$vars = &$params['template_vars'];
$vars['{gmparcellocker}'] = '';
if (in_array($template, ['order_conf', 'new_order'])) {
if (stripos($vars['{carrier}'], 'paczkomat') !== false) {
$cartId = $this->context->cart->id;
$chosenParcel = $this->getPointDataForCart($cartId);
$vars['{gmparcellocker}'] = $chosenParcel;
}
}
}
public function hookAddWebserviceResources() {
return array(
'bl_order' => array('description' => 'Extended order data for use by BaseLinker', 'class' => 'BaseLinkerOrder'),
);
}
public function getWidgetVariables($hookName, array $configuration) {
$cartId = $this->context->cart->id;
if (!$cartId) {
$cartId = Tools::getValue('id_cart');
}
if (!$cartId) {
return false;
}
$cart = new Cart($cartId);
$carrier = new Carrier($cart->id_carrier);
if ($carrier->external_module_name == $this->name) {
return array(
'gmChosenParcel' => $this->getPointDataForCart($cartId)
);
}
return false;
}
public function renderWidget($hookName, array $configuration) {
$variables = $this->getWidgetVariables($hookName, $configuration);
if (empty($variables)) {
return false;
}
$this->smarty->assign($variables);
return $this->fetch($this->templateFile);
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,22 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_c5824aabdfcfe98d5950818bab0260e6'] = 'Paczkomaty 24/7';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_81f5ab314898589259232be18d0c96de'] = 'Umożliwia wybór paczkomatu w koszyku';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_24d11524546e70303f21a814b7b2388d'] = 'Pamiętaj, aby skonfigurować i aktywować nowego przewoźnika Paczkomaty 24/7, utworzonego przez ten moduł';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_c888438d14855d7d96a2724ee9c306bd'] = 'Zapisano ustawienia';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_c59d6df802c32f037c2a15ff75faec17'] = 'Okienko modal';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_7498c445a737312f3678aa1494e01a38'] = 'Lista rozwijana';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_f4f70727dc34561dfde1a3c529b6205c'] = 'Ustawienia';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_955c8f1a0a5b569d549874531a6d2223'] = 'Zamień adres dostawy na adres paczkomatu';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_93cba07454f06a4a960172bbd6e2a435'] = 'Tak';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Nie';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_365119d429fc230c8e9b5c3c94842c19'] = 'Sposób wyświetlania';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_c9cc8cce247e49bae79f15173ce97354'] = 'Zapisz';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_39b6fda48dbec22f92c82517456047c2'] = 'Paczkomaty 24/7';
$_MODULE['<{gmparcellocker}prestashop>gmparcellocker_f38e9081d395bb971dd1bf81f65f22e6'] = 'Paczkomat';
$_MODULE['<{gmparcellocker}prestashop>button_04f689478e79ad944c1893dc7e713810'] = 'Wybrany paczkomat:';
$_MODULE['<{gmparcellocker}prestashop>button_494bd131a34e4dc02be773266700e935'] = 'Wybierz paczkomat';
$_MODULE['<{gmparcellocker}prestashop>dropdown_04f689478e79ad944c1893dc7e713810'] = 'Wybrany paczkomat';
$_MODULE['<{gmparcellocker}prestashop>choice_04f689478e79ad944c1893dc7e713810'] = 'Wybrany Paczkomat:';

View File

@@ -0,0 +1,11 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_1_0($object) {
return ($object->registerHook('actionValidateOrder') &&
$object->registerHook('sendMailAlterTemplateVars')
);
}

View File

@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_2_0($object) {
return ($object->registerHook('addWebserviceResources'));
}

View File

@@ -0,0 +1,10 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_3_0($object) {
Configuration::updateValue('GMPARCELLOCKER_DISPLAY', 'modal');
return true;
}

View File

@@ -0,0 +1,12 @@
.gmparcellocker-button {
text-align: center;
margin-bottom: 15px;
}
.gmparcellocker-button .chosen-parcel {
font-weight: bold;
}
.gmparcellocker-button #parcel-search-address {
display: none;
}

View File

@@ -0,0 +1,56 @@
(function ($) {
"use strict";
$(document).ready(function () {
window.easyPack.init({
instance: 'pl',
mapType: 'osm',
searchType: 'osm',
points: {
types: ['parcel_locker'],
},
map: {
useGeolocation: true,
initialTypes: ['parcel_locker']
}
});
window.onload = function () {
window.easyPack.dropdownWidget('easypack-widget', function (point) {
var pointData = point.name + '| ' + point.address.line1 + '| ' + point.address.line2;
$.ajax({
url: gmParcelLockerAjaxUrl,
type: 'POST',
crossDomain: true,
data: {cartId: gmCartId, pointData: pointData},
async: true,
dataType: "json",
headers: {"cache-control": "no-cache"},
success: function (data) {
//console.log(data);
if (data.msg == 'OK') {
$('.chosen-parcel').html(pointData.split('|').join(','));
}
},
error: function (jqXHR, textStatus) {
console.log(jqXHR.responseText);
}
});
});
}
window.setInterval(function () {
if ($('.gmparcellocker-button').is(':visible')) {
window.checkGmParcellocker = true;
if ($('.chosen-parcel').text().length > 3) {
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
} else {
$('button[name="confirmDeliveryOption"]').attr('disabled', true);
}
} else {
if (window.checkGmParcellocker) {
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
window.checkGmParcellocker = false;
}
}
}, 500);
});
})(jQuery);

View File

@@ -0,0 +1,56 @@
(function ($) {
"use strict";
$(document).ready(function () {
window.gmParcelLockerChoose = function () {
var modalMap = window.easyPack.modalMap(function (point, modal) {
var pointData = point.name + '| ' + point.address.line1 + '| ' + point.address.line2;
$.ajax({
url: gmParcelLockerAjaxUrl,
type: 'POST',
crossDomain: true,
data: {cartId: gmCartId, pointData: pointData},
async: true,
dataType: "json",
headers: {"cache-control": "no-cache"},
success: function (data) {
//console.log(data);
if (data.msg == 'OK') {
modal.closeModal();
$('.chosen-parcel').html(pointData.split('|').join(','));
}
},
error: function (jqXHR, textStatus) {
console.log(jqXHR.responseText);
}
});
}, {width: 1200, height: 600});
return false;
};
window.easyPackAsyncInit = function () {
window.easyPack.init({
points: {
types: ['parcel_locker_only']
},
map: {
initialTypes: ['parcel_locker_only'],
}
});
};
window.setInterval(function () {
if ($('.gmparcellocker-button').is(':visible')) {
window.checkGmParcellocker = true;
if ($('.chosen-parcel').text().length > 3) {
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
} else {
$('button[name="confirmDeliveryOption"]').attr('disabled', true);
}
} else {
if (window.checkGmParcellocker) {
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
window.checkGmParcellocker = false;
}
}
}, 500);
});
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{$gmChosenParcel}

View File

@@ -0,0 +1,7 @@
<div class="gmparcellocker-button col-sm-12">
{*<span id="parcel-search-address">{$gmSearchAddress}</span>*}
<p>{l s='Chosen Parcel Locker:' mod='gmparcellocker'} <span class="chosen-parcel">{$gmChosenParcel}</span></p>
<button class="btn btn-default btn-primary" id="parcel-choose" onclick="gmParcelLockerChoose();return false;">
{l s='Choose Parcel Locker' mod='gmparcellocker'}
</button>
</div>

View File

@@ -0,0 +1,3 @@
{if $gmChosenParcel}
<b>{l s='Chosen Parcel Locker:' mod='gmparcellocker'}</b> {$gmChosenParcel}
{/if}

View File

@@ -0,0 +1,4 @@
<div class="gmparcellocker-button col-sm-12">
<p>{l s='Chosen Parcel Locker:' mod='gmparcellocker'} <span class="chosen-parcel">{$gmChosenParcel}</span></p>
<div id="easypack-widget"></div>
</div>