Add new payment and shipping parsers for various integrations

- Implemented Google Pay parser in bongooglepay.js
- Added Buckaroo 3 payment parser in buckaroo3.js
- Introduced DataTrans CW Mastercard parser in datatranscw.js
- Created DataTrans CW Credit Card parser in datatranscw_creditcard.js
- Developed DHL Assistant shipping parser in dhlassistant.js
- Added Estimated Delivery parser in estimateddelivery.js
- Implemented Floapay payment parser in floapay.js
- Created FS Pickup at Store shipping parser in fspickupatstore.js
- Developed Generic Iframe parser in generic_iframe_parser.js
- Added Geodis Officiel shipping parser in geodisofficiel.js
- Implemented Glob Kurier module shipping parser in globkuriermodule.js
- Created Latvija Post Express Pickup Terminal parser in latvijaspastsexpresspastspostterminalslv.js
- Developed LP Shipping parser in lpshipping.js
- Added Mijora Venipak parser in mijoravenipak.js
- Implemented Apple Pay parser in pm_applepay.js
- Created Przelewy24 payment parser in przelewy24.js
- Developed Pshugls shipping parser in pshugls.js
- Added Redsys Insite payment parser in redsysinsite.js
- Implemented Tpay payment parser in tpay.js
- Updated third-party integration documentation for FedEx DotCom
This commit is contained in:
2025-08-04 23:10:27 +02:00
parent 037a6c5551
commit d39433f0d4
125 changed files with 4986 additions and 1772 deletions

View File

@@ -30,7 +30,7 @@ class TheCheckout extends Module
/**
* @var array $module_settings An array of settings provided on configuration page
*/
public $conf_prefix = "opc_";
// public $conf_prefix = "opc_"; // not used anymore, prefix is fixed to 'tc_'
/**
* @var Config
*/
@@ -44,13 +44,13 @@ class TheCheckout extends Module
{
$this->name = 'thecheckout';
$this->tab = 'checkout';
$this->version = '3.3.8';
$this->version = '3.3.10';
$this->author = 'PrestaDev.pl';
$this->module_key = "2e602e0a1021555e3d85311cd8ef756d";
$this->module_key = "2e602e0a1021555e3d85311cd8ef756d1";
//$this->moduleTHECHECKOUT_key = "2e602e0a1021555e3d85311cd8ef756d";
//$this->moduleOPC_key = "38254238bedae1ccc492a65148109fdd";
$this->need_instance = 1;
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => '9.1');
$this->bootstrap = true;
@@ -66,6 +66,16 @@ class TheCheckout extends Module
$this->initTheCheckout();
}
public function initPsKernel() {
// Uncomment if kernel is necessary for e.g. shipping modules
// global $kernel;
// if(!$kernel){
// require_once _PS_ROOT_DIR_.'/app/AppKernel.php';
// $kernel = new \AppKernel(_PS_MODE_DEV_ ? 'dev' : 'prod', _PS_MODE_DEV_);
// $kernel->boot();
// }
}
private function checkStripeNeedPatch()
{
return false; // Since checkout module v2.3.4, patch in Stripe is no more required.
@@ -143,26 +153,21 @@ class TheCheckout extends Module
}
if ($this->checkStripeNeedPatch()) {
return 'Detected <b>stripe_official</b> payment module - it <b>requires a patch</b> to work properly with
return 'Detected '.$this->tagIt('b', 'stripe_official').' payment module - it '.$this->tagIt('b', 'requires a patch').' to work properly with
TheCheckout, please contact us for more details or check our blog';
}
if ($this->checkMondialNeedPatch()) {
return 'Detected <b>mondialrelay</b> shipping module - it <b>requires a patch</b> to work properly with
return 'Detected '.$this->tagIt('b', 'mondialrelay').' shipping module - it '.$this->tagIt('b', 'requires a patch').' to work properly with
TheCheckout, please contact us for more details or check our blog';
}
if ($this->checkAmcPsShipItNeedPatch()) {
return 'Detected <b>amcpsshipit</b> shipping module - it <b>requires a patch</b> to work properly with
return 'Detected '.$this->tagIt('b', 'amcpsshipit').' shipping module - it '.$this->tagIt('b', 'requires a patch').' to work properly with
TheCheckout, please update amcpsshipit.php and extend condition if ($controllerClass !== \'OrderController\') with
&& $controllerClass !== \'TheCheckoutModuleFrontController\' and add this comment (thecheckout-patched) to remove this message';
}
// if ($this->checkBraintreeNeedsPatch()) {
// return 'Detected <b>braintreeofficial</b> payment module - it <b>requires a patch</b> to work properly with
// TheCheckout, please contact us for more details or check our blog';
// }
// $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM '. _DB_PREFIX_ .'required_field');
// print_r($result); exit;
@@ -248,9 +253,21 @@ class TheCheckout extends Module
// $this->l('PA');
// $this->l('Invalid DNI');
// $this->l('Probably a typo? Please try again.');
// $this->l('You already have an account with us. Sign in or continue as guest.');
// $this->l('Apple Pay');
return $this->l($key);
}
public function tagIt($tag, $content = '', $attr = '') {
$lt = '<';
$gt = '>';
$single = in_array($tag, ['br', 'input']);
$open = $lt.$tag.' '.$attr.$gt;
$close = $single ? '' : $lt.'/'.$tag.$gt;
$content = $single ? '' : $content;
return $open.$content.$close;
}
private function setConfigOptions()
{
$this->includeDependency('classes/Config.php');
@@ -321,20 +338,14 @@ class TheCheckout extends Module
$this->logger->error($msg);
}
private function flatten_array($input_array)
{
private function flatten_array($input_array) {
$result = array();
array_walk_recursive($input_array, function ($array, $key) use (&$result) {
$result[] = $key;
});
array_walk_recursive($input_array, function($array, $key) use (&$result) { $result[] = $key; });
return $result;
}
private function setTagsList($key, $array_input)
{
$input_json = json_encode(array_map(function ($a) {
return array('id' => $a, 'title' => $a);
}, array_values($array_input)));
private function setTagsList($key, $array_input) {
$input_json = json_encode(array_map(function ($a) { return array('id' => $a, 'title' => $a); }, array_values($array_input)));
Media::addJsDefL($key, $input_json);
}
@@ -353,7 +364,7 @@ class TheCheckout extends Module
Media::addJsDefL('thecheckout_init_html_editor', $this->l('Use HTML editor'));
$flattened = $this->flatten_array($this->config->blocks_layout);
$available_layout_blocks = array_diff(array_unique($flattened), ['size']);
$available_layout_blocks = array_diff( array_unique($flattened), ['size'] );
$this->setTagsList('thecheckout_available_layout_blocks', $available_layout_blocks);
$all_fields = array_keys(array_merge($this->config->invoice_fields, $this->config->delivery_fields));
@@ -393,26 +404,51 @@ class TheCheckout extends Module
$existing_step_label_3 = array();
$existing_step_validation_error_3 = array();
$reassurance_samples = array(
'en' => $this->tagIt('div',
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Security policy') . 'We use modern SSL to '. $this->tagIt('b', 'secure payment'),
'class="reassurance-section security"').
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Delivery policy') . 'Orders made on workdays, until 13:00 are '. $this->tagIt('b', 'shipped same day') . ' (if all goods are in stock)',
'class="reassurance-section delivery"').
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Return policy') . 'Purchases can be '. $this->tagIt('b', 'returned') . ' within 14 days, without any explanation',
'class="reassurance-section return"'),
'class="thecheckout-reassurance"').
$this->tagIt('p', '*please edit this in TheCheckout module configuration, Layout tab -> HTML Box No.1 for your language'),
'cs' => $this->tagIt('div',
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Bezpečnostní politika') . 'Používáme moderní SSL pro '. $this->tagIt('b', 'bezpeční platbu'),
'class="reassurance-section security"').
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Dodací podmínky') . 'Objednávky zadané v pracovní dny do 13:00 jsou '. $this->tagIt('b', 'odeslány v ten samý den') . ' (v případe, že všechno zboží je skladem)',
'class="reassurance-section delivery"').
$this->tagIt('div',
$this->tagIt('span', '', 'class="icon"') .
$this->tagIt('h3', 'Vrácení zboží') . 'Zboží můžete '. $this->tagIt('b', 'vrátit') . ' v lhůtě 14 dní bez uvedení důvodu.',
'class="reassurance-section return"'),
'class="thecheckout-reassurance"').
$this->tagIt('p', '*prosím upravte tento blok v nastavení modulu TheCheckout, záložka Rozvržení -> HTML pole č.1 pro jazyk [ Čeština (Czech) ]')
);
foreach (Language::getLanguages() as $language) {
$existingReassuranceHtml = Configuration::get('TC_html_box_1', $language['id_lang']);
if (!$existingReassuranceHtml || "" == trim($existingReassuranceHtml)) {
$reassurance_sample_html[$language['id_lang']] =
'<' . 'div class="thecheckout-reassurance"' . '>
<' . 'div class="reassurance-section security">' . '<' . 'span class="icon"' . '>' . '<' . '/' . 'span' . '>
<' . 'h3' . '>Polityka bezpieczeństwa<' . '/' . 'h3' . '>
Używamy certyfikatu SSL ' . '<' . 'b' . '>' . 'by zabezpieczyć proces zakupów.<' . '/' . 'b>' . '<' . '/' . 'div' . '>
<' . 'div class="reassurance-section delivery"' . '>' . '<' . 'span class="icon"' . '>' . '<' . '/' . 'span' . '>
<' . 'h3' . '>Polityka dostaw<' . '/' . 'h3' . '>
Zamówienia złożone w dni robocze przed 10.00 <' . 'b' . '>dostawa w następnym dniu roboczym<' . '/' . 'b' . '>' . ' (jeśli są na stanie).<' . '/' . 'div' . '>
<' . 'div class="reassurance-section return"' . '><' . 'span class="icon"' . '>' . '<' . '/' . 'span' . '>
<' . 'h3' . '>Polityka zwrotów<' . '/' . 'h3' . '>
Zamówione produkty <' . 'b' . '>zwrócone<' . '/' . 'b' . '> w ciągu 14 dni od daty zakupu.<' . '/' . 'div' . '>
<' . '/' . 'div' . '>';
if (array_key_exists($language['iso_code'], $reassurance_samples)) {
$reassurance_sample_html[$language['id_lang']] = $reassurance_samples[$language['iso_code']];
} else {
$reassurance_sample_html[$language['id_lang']] = $reassurance_samples['en'];
}
} else {
$reassurance_sample_html[$language['id_lang']] = Configuration::get(
'TC_html_box_1',
$language['id_lang']
);
$reassurance_sample_html[$language['id_lang']] = Configuration::get('TC_html_box_1',
$language['id_lang']);
}
$existing_step_label_1 = Configuration::get('TC_step_label_1', $language['id_lang']);
if (!$existing_step_label_1 || "" == trim($existing_step_label_1)) {
@@ -612,7 +648,7 @@ class TheCheckout extends Module
$iso = 'en_US';
}
$this->context->smarty->assign(array(
"tc_config" => $this->config,
"z_tc_config" => $this->config,
"iso" => $iso
));
@@ -623,30 +659,33 @@ class TheCheckout extends Module
('module-thecheckout-order' == $this->context->controller->page_name || 'checkout' == $this->context->controller->page_name);
$isLoginController = isset($this->context->controller->php_self) && ('authentication' == $this->context->controller->php_self) &&
$this->config->social_login_display_on_login_page;
$isAddressController = isset($this->context->controller->php_self) && ('address' == $this->context->controller->php_self);
$isOrderConfirmationController = isset($this->context->controller->php_self) && ('order-confirmation' == $this->context->controller->php_self);
if ($isOrderConfirmationController) {
if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/iframe-payment-confirmation.js")) {
$this->context->controller->registerJavascript('modules-thecheckout-iframe-payment-confirmation',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/iframe-payment-confirmation.js",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('position' => 'bottom', 'priority' => 200));
}
}
if (!$isDisabled && ($isCheckoutController || $isLoginController)) {
if (!$this->context->customer->isLogged()) {
if ($isLoginController) {
$this->context->controller->registerJavascript(
'modules-thecheckout-200',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/social-login-page.js",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
array('position' => 'bottom', 'priority' => 1140)
);
$this->context->controller->registerJavascript('modules-thecheckout-200',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/social-login-page.js",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('position' => 'bottom', 'priority' => 1140));
Media::addJsDefL('i18_signInWithFB', $this->l('Sign in with Facebook'));
$this->context->controller->registerStylesheet(
'modules-thecheckout-200',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/css/includes/social-login-page.css",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
$this->context->controller->registerStylesheet('modules-thecheckout-200',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/css/includes/social-login-page.css",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array(
'media' => 'all',
'priority' => 1200
)
);
));
}
if ($this->config->social_login_fb) {
@@ -656,7 +695,14 @@ class TheCheckout extends Module
$ret .= $this->context->smarty->fetch($this->local_path . 'views/templates/front/_partials/social-login-google.tpl');
}
}
}
if (!$isDisabled && ($isCheckoutController || $isAddressController)) {
if ($this->config->google_maps_api_key && strlen($this->config->google_maps_api_key) > 10) {
if ($isAddressController) {
$isoCodes = @Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_country, iso_code FROM ' . _DB_PREFIX_ . 'country where active = 1');
Media::addJsDefL('tc_countriesIsoCodes', json_encode($isoCodes));
}
$ret .= $this->context->smarty->fetch($this->local_path . 'views/templates/front/_partials/google-places-autocomplete.tpl');
}
}
@@ -666,14 +712,10 @@ class TheCheckout extends Module
Media::addJsDefL('dm_hash', '0');
if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/lib/secure-trial.js")) {
$this->context->controller->registerJavascript(
'modules-thecheckout-trial',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/lib/secure-trial.js",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
array('position' => 'bottom', 'priority' => 200)
);
$this->context->controller->registerJavascript('modules-thecheckout-trial',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/lib/secure-trial.js",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('position' => 'bottom', 'priority' => 200));
}
} else {
Media::addJsDefL('dm_mode', 0);
@@ -682,14 +724,10 @@ class TheCheckout extends Module
if (trim($this->config->smartform_client_id) !== '') {
if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/smartform.js")) {
$this->context->controller->registerJavascript(
'modules-thecheckout-smartform',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/smartform.js",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
array('position' => 'bottom', 'priority' => 500)
);
$this->context->controller->registerJavascript('modules-thecheckout-smartform',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/smartform.js",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('position' => 'bottom', 'priority' => 500));
Media::addJsDefL('tc_smartformClientId', trim($this->config->smartform_client_id));
}
}
@@ -697,37 +735,23 @@ class TheCheckout extends Module
// include assets to manipulate content on separate payment page
if (Tools::getIsset(Config::SEPARATE_PAYMENT_KEY_NAME)) {
if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/separate-payment.js")) {
$this->context->controller->registerJavascript(
'modules-thecheckout-separate-payment',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/separate-payment.js",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
array('position' => 'bottom', 'priority' => 200)
);
$this->context->controller->registerJavascript('modules-thecheckout-separate-payment',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/js/includes/separate-payment.js",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('position' => 'bottom', 'priority' => 200));
}
if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/css/includes/separate-payment.css")) {
$this->context->controller->registerStylesheet(
'modules-thecheckout-separate-payment',
Tools::substr(
_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/css/includes/separate-payment.css",
Tools::strlen(_PS_ROOT_DIR_) + 1
),
array('media' => 'all', 'priority' => 150)
);
$this->context->controller->registerStylesheet('modules-thecheckout-separate-payment',
Tools::substr(_PS_ROOT_DIR_ . '/modules/' . $this->name . "/views/css/includes/separate-payment.css",
Tools::strlen(_PS_ROOT_DIR_) + 1),
array('media' => 'all', 'priority' => 150));
}
$formatted_addresses = array(
'invoice' => AddressFormat::generateAddress(
new Address($this->context->cart->id_address_invoice),
array(),
'<br>'
),
'delivery' => AddressFormat::generateAddress(
new Address($this->context->cart->id_address_delivery),
array(),
'<br>'
),
'invoice' => AddressFormat::generateAddress(new Address($this->context->cart->id_address_invoice),
array(), $this->tagIt('br')),
'delivery' => AddressFormat::generateAddress(new Address($this->context->cart->id_address_delivery),
array(), $this->tagIt('br')),
);
if (version_compare(_PS_VERSION_, '1.7.3') >= 0) {
@@ -745,6 +769,7 @@ class TheCheckout extends Module
);
$delivery_message = html_entity_decode($session->getMessage());
} else {
$delivery_message = '';
}
@@ -774,8 +799,9 @@ class TheCheckout extends Module
public function hookActionDispatcher($params = null)
{
// Stop-by only for Order and Cart controllers
if ("OrderController" !== $params['controller_class']
&& "CartController" !== $params['controller_class']
if (
("OrderController" !== $params['controller_class'] && "CartController" !== $params['controller_class']) ||
(!$params['cookie']->id_cart && strpos(Tools::getValue('action'), 'socialLogin') !== 0)
) {
return false;
}
@@ -827,6 +853,8 @@ class TheCheckout extends Module
}
}
// $this->initPsKernel();
$checkoutController = new TheCheckoutModuleFrontController();
$checkoutController->run();
exit;
@@ -862,22 +890,21 @@ class TheCheckout extends Module
return $requiredCheckboxes;
}
public function hookActionBuildFrontEndObject($params)
{
public function hookActionBuildFrontEndObject($params) {
// $existingAddresses = $params['obj']['customer']['addresses'] ?? [];
// Probably we shall override JS's prestashop.customer.addresses always, regardless of being set or not by PS core
// if (!count($existingAddresses)) {
$deliveryAddressId = $this->context->cart->id_address_delivery;
$invoiceAddressId = $this->context->cart->id_address_invoice;
$newAddresses = [];
if ($deliveryAddressId > 0) {
$newAddresses[$deliveryAddressId] = new Address($deliveryAddressId);
}
if ($invoiceAddressId > 0 && $invoiceAddressId !== $deliveryAddressId) {
$newAddresses[$invoiceAddressId] = new Address($invoiceAddressId);
}
$params['obj']['customer']['addresses'] = $newAddresses;
$deliveryAddressId = $this->context->cart->id_address_delivery;
$invoiceAddressId = $this->context->cart->id_address_invoice;
$newAddresses = [];
if ($deliveryAddressId > 0) {
$newAddresses[$deliveryAddressId] = new Address($deliveryAddressId);
}
if ($invoiceAddressId > 0 && $invoiceAddressId !== $deliveryAddressId) {
$newAddresses[$invoiceAddressId] = new Address($invoiceAddressId);
}
$params['obj']['customer']['addresses'] = $newAddresses;
// }
}
@@ -950,13 +977,8 @@ class TheCheckout extends Module
'category' === $params['smarty']->tpl_vars['page']->value['page_name'] &&
file_exists($this->local_path . 'views/templates/front/_partials/secure-notice.tpl')) {
$baseIdx = 3;
$blocks_idxs = explode(',', Configuration::get(
'blocks_idxs',
null,
null,
null,
($baseIdx + 1) . ',' . ($baseIdx + 31) . ',' . ($baseIdx + 101) . ',' . ($baseIdx + 102)
));
$blocks_idxs = explode(',', Configuration::get('blocks_idxs', null, null, null,
($baseIdx + 1) . ',' . ($baseIdx + 31) . ',' . ($baseIdx + 101) . ',' . ($baseIdx + 102)));
$smarty_tpl_vars = $params['smarty']->tpl_vars;
if (isset($smarty_tpl_vars['category']) &&
in_array($smarty_tpl_vars['category']->value['id'], $blocks_idxs)) {
@@ -1056,26 +1078,20 @@ class TheCheckout extends Module
if ('alert' == Tools::getValue('postProcessResultCode')) {
$output .=
'<' . 'div style="margin-top: 35px" class="alert alert-danger"' . '>' .
'<' . 'button type="button" class="close" data-dismiss="alert"' . '>×<' . '/' . 'button' . '>' .
Tools::getValue('postProcessResult') .
'<' . '/' . 'div' . '>';
$this->tagIt('div',
$this->tagIt('button','x', 'type="button" class="close" data-dismiss="alert"') . Tools::getValue('postProcessResult'),
'style="margin-top: 35px" class="alert alert-danger"');
} elseif ('ok' == Tools::getValue('postProcessResultCode')) {
$output .= $this->displayConfirmation($this->trans(
'The settings have been updated.',
array(),
'Admin.Notifications.Success'
));
$output .= $this->displayConfirmation($this->trans('The settings have been updated.', array(),
'Admin.Notifications.Success'));
}
$this->context->smarty->assign('module_dir', $this->_path);
if (!empty($this->warning)) {
$output .=
'<' . 'div style="margin-top: 35px" class="alert alert-danger"' . '>' .
'<' . 'button type="button" class="close" data-dismiss="alert"' . '>×<' . '/' . 'button' . '>' .
$this->warning .
'<' . '/' . 'div' . '>';
$this->tagIt('div', $this->tagIt('button','x', 'type="button" class="close" data-dismiss="alert"') . $this->warning,
'style="margin-top: 35px" class="alert alert-danger"');
}
$this->context->smarty->assign(array(
@@ -1213,6 +1229,8 @@ class TheCheckout extends Module
$subst = '$0 ' . $blocksLayoutSortable;
$result = preg_replace($re, $subst, $result, 1);
$paypal_express_active = Module::isEnabled('paypal');
$result .= $this->tagIt('input', '','type="hidden" name="tc_paypal_express_checkout_active" value="'.$paypal_express_active);
return $result;
}
@@ -1328,12 +1346,8 @@ class TheCheckout extends Module
$this->l('Test mode'),
$this->l('Checkout module will be enabled only when using URL parameter:') . ' ' . Config::TEST_MODE_KEY_NAME,
array(),
$this->l('When enabled, Checkout is visible only using this URL: ') . ' ' . '<' . 'a href="' . $this->context->link->getPageLink(
'order',
true,
null,
Config::TEST_MODE_KEY_NAME
) . '">' . $this->l('Checkout-test-URL') . '<' . '/' . 'a>'
$this->l('When enabled, Checkout is visible only using this URL: ') . ' ' .
$this->tagIt('a', $this->l('Checkout-test-URL'), 'href='.$this->context->link->getPageLink('order', true, null, Config::TEST_MODE_KEY_NAME))
),
$this->generateSwitch(
'separate_cart_summary',
@@ -1362,18 +1376,18 @@ class TheCheckout extends Module
$this->generateSelect(
'font',
$this->l('Checkout form font') .
'<' . 'input type="hidden" name="font-weight-Montserrat" value="thin 100,extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800,black 900">' .
'<' . 'input type="hidden" name="font-weight-Open-Sans" value="light 300,regular 400,semi-bold 600,bold 700,extra-bold 800">' .
'<' . 'input type="hidden" name="font-weight-Open-Sans-Condensed" value="light 300,bold 700">' .
'<' . 'input type="hidden" name="font-weight-Playfair-Display" value="regular 400,bold 700,black 900">' .
'<' . 'input type="hidden" name="font-weight-Dosis" value="extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800">' .
'<' . 'input type="hidden" name="font-weight-Titillium-Web" value="extra-light 200,light 300,regular 400,semi-bold 600,bold 700,black 900">' .
'<' . 'input type="hidden" name="font-weight-Indie-Flower" value="regular 400">' .
'<' . 'input type="hidden" name="font-weight-Great-Vibes" value="regular 400">' .
'<' . 'input type="hidden" name="font-weight-Gloria-Hallelujah" value="regular 400">' .
'<' . 'input type="hidden" name="font-weight-Amatic-SC" value="regular 400,bold 700">' .
'<' . 'input type="hidden" name="font-weight-Exo-2" value="thin 100,extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800,black 900">' .
'<' . 'input type="hidden" name="font-weight-Yanone-Kaffeesatz" value="extra-light 200,light 300,regular 400,bold 700">',
$this->tagIt('input','', 'type="hidden" name="font-weight-Montserrat" value="thin 100,extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800,black 900"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Open-Sans" value="light 300,regular 400,semi-bold 600,bold 700,extra-bold 800"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Open-Sans-Condensed" value="light 300,bold 700"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Playfair-Display" value="regular 400,bold 700,black 900"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Dosis" value="extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Titillium-Web" value="extra-light 200,light 300,regular 400,semi-bold 600,bold 700,black 900"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Indie-Flower" value="regular 400"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Great-Vibes" value="regular 400"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Gloria-Hallelujah" value="regular 400"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Amatic-SC" value="regular 400,bold 700"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Exo-2" value="thin 100,extra-light 200,light 300,regular 400,medium 500,semi-bold 600,bold 700,extra-bold 800,black 900"') .
$this->tagIt('input','', 'type="hidden" name="font-weight-Yanone-Kaffeesatz" value="extra-light 200,light 300,regular 400,bold 700"'),
$this->l('Font-family used on checkout form'),
array(
array('id' => 'theme-default', 'name' => 'Theme default'),
@@ -1511,6 +1525,11 @@ class TheCheckout extends Module
$this->l('Inactive because "Show I am a private" is disabled.'),
'desc-visible-only-when-inactive'
),
$this->generateSwitch(
'use_other_field_for_business_private',
$this->l('Use "other" field for business/private'),
$this->l('Store status of "I am a business" and "I am a private" checkboxes in address "other" field.')
),
$this->generateSwitch(
'offer_second_address',
$this->l('Offer second address'),
@@ -1546,6 +1565,11 @@ class TheCheckout extends Module
$this->l('Show "Save" button in Personal Info'),
$this->l('Display button to save guest/account before showing shipping and payment methods')
),
$this->generateSwitch(
'use_old_address_on_reorder',
$this->l('Use old address on reorder'),
$this->l('When customer makes Re-order, use the same address as in original order - do not use his latest address')
),
$this->generateText(
'google_maps_api_key',
$this->l('Google maps API key'),
@@ -1647,6 +1671,12 @@ class TheCheckout extends Module
$this->l('When single payment method is selected, collapse remaining ones'),
array()
),
$this->generateSwitch(
'logos_on_the_right',
$this->l('Shipping/payment logos on the right'),
$this->l('Show shipping and payment logos on the right side in a listing'),
array()
),
),
'submit' => array(
'title' => $this->l('Save')
@@ -1705,11 +1735,8 @@ class TheCheckout extends Module
'autoload_rte' => '', //'rte' = enable TinyMCE editor, empty = not enabled
'class' => 'tinymce-on-demand',
'col' => 8,
'hint' => $this->trans(
'Invalid characters:',
array(),
'Admin.Notifications.Info'
) . ' &lt;&gt;;=#{}'
'hint' => $this->trans('Invalid characters:', array(),
'Admin.Notifications.Info') . ' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
@@ -1719,11 +1746,8 @@ class TheCheckout extends Module
'autoload_rte' => '', //'rte' = enable TinyMCE editor, empty = not enabled
'class' => 'tinymce-on-demand',
'col' => 8,
'hint' => $this->trans(
'Invalid characters:',
array(),
'Admin.Notifications.Info'
) . ' &lt;&gt;;=#{}'
'hint' => $this->trans('Invalid characters:', array(),
'Admin.Notifications.Info') . ' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
@@ -1733,11 +1757,8 @@ class TheCheckout extends Module
'autoload_rte' => '', //'rte' = enable TinyMCE editor, empty = not enabled
'class' => 'tinymce-on-demand',
'col' => 8,
'hint' => $this->trans(
'Invalid characters:',
array(),
'Admin.Notifications.Info'
) . ' &lt;&gt;;=#{}'
'hint' => $this->trans('Invalid characters:', array(),
'Admin.Notifications.Info') . ' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
@@ -1747,17 +1768,14 @@ class TheCheckout extends Module
'autoload_rte' => '', //'rte' = enable TinyMCE editor, empty = not enabled
'class' => 'tinymce-on-demand',
'col' => 8,
'hint' => $this->trans(
'Invalid characters:',
array(),
'Admin.Notifications.Info'
) . ' &lt;&gt;;=#{}'
'hint' => $this->trans('Invalid characters:', array(),
'Admin.Notifications.Info') . ' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
'label' => $this->l('Required Checkbox No.1'),
'name' => 'TC_required_checkbox_1',
'desc' => 'To enable a required checkbox in checkout page, fill-in the checkbox label here. You can add label also with link, for example: <' . 'br' . '><' . 'b' . '>' . 'I agree with &lt;a href="content/3-privacy-policy"&gt;privacy policy&lt;/a&gt;<' . '/b' . '>',
'desc' => 'To enable a required checkbox in checkout page, fill-in the checkbox label here. You can add label also with link, for example: ' . $this->tagIt('br') . $this->tagIt('b', 'I agree with &lt;a href="content/3-privacy-policy"&gt;privacy policy&lt;/a&gt;'),
'lang' => true,
'autoload_rte' => '', //'rte' = enable TinyMCE editor, empty = not enabled
'class' => 'tinymce-on-demand',
@@ -1800,47 +1818,37 @@ class TheCheckout extends Module
$this->generateSwitch(
'checkout_steps',
$this->l('Checkout steps'),
$this->l('Enable virtual steps'),
array(),
$this->l('Enable virtual steps'), array(),
$this->l('Leave \'Label\' empty if you wish to disable particular step below') .
'<div id="set-steps-sample"><a data-confirm-msg="'. $this->l('Are you sure? This will change blocks layout and also add custom CSS rules.') . '">' .
$this->l('Click to set Starting configuration sample') . "</a></div>"
$this->tagIt('div', $this->tagIt('a', $this->l('Click to set Starting configuration sample'),
'data-confirm-msg="'. $this->l('Are you sure? This will change blocks layout and also add custom CSS rules.').'"'),
'id="set-steps-sample"')
),
// Step 1
$this->generateText(
'step_label_1',
$this->l('Label'),
$this->l('Step 1 label, multi-language field'),
array(),
'',
'config-step-1',
true
array(), '', 'config-step-1', true
),
$this->generateText(
'step_blocks_1',
$this->l('Visible blocks'),
$this->l('Comma separated list of blocks visible in this step'),
array(),
'',
'config-step-1'
array(), '', 'config-step-1'
),
// Step 2
$this->generateText(
'step_label_2',
$this->l('Label'),
$this->l('Step 2 label, multi-language field'),
array(),
'',
'config-step-2',
true
array(), '', 'config-step-2', true
),
$this->generateText(
'step_blocks_2',
$this->l('Visible blocks'),
$this->l('Comma separated list of blocks visible in this step'),
array(),
'',
'config-step-2'
array(), '', 'config-step-2'
),
array(
'type' => 'textarea',
@@ -1859,29 +1867,20 @@ class TheCheckout extends Module
'step_validation_error_2',
$this->l('Error message'),
$this->l('Error shown to user when validation to reach this step fails'),
array(),
'',
'config-step-2',
true
array(), '', 'config-step-2', true
),
// Step 3
$this->generateText(
'step_label_3',
$this->l('Label'),
$this->l('Step 3 label, multi-language field'),
array(),
'',
'config-step-3',
true
array(), '', 'config-step-3', true
),
$this->generateText(
'step_blocks_3',
$this->l('Visible blocks'),
$this->l('Comma separated list of blocks visible in this step'),
array(),
'',
'config-step-3',
false
array(), '', 'config-step-3', false
),
array(
'type' => 'textarea',
@@ -1900,29 +1899,20 @@ class TheCheckout extends Module
'step_validation_error_3',
$this->l('Error message'),
$this->l('Error shown to user when validation to reach this step fails'),
array(),
'',
'config-step-3',
true
array(), '', 'config-step-3', true
),
// Step 4
$this->generateText(
'step_label_4',
$this->l('Label'),
$this->l('Step 4 label, multi-language field'),
array(),
'',
'config-step-4',
true
array(), '', 'config-step-4', true
),
$this->generateText(
'step_blocks_4',
$this->l('Visible blocks'),
$this->l('Comma separated list of blocks visible in this step'),
array(),
'',
'config-step-4',
false
array(), '', 'config-step-4', false
),
array(
'type' => 'textarea',
@@ -1941,10 +1931,7 @@ class TheCheckout extends Module
'step_validation_error_4',
$this->l('Error message'),
$this->l('Error shown to user when validation to reach this step fails'),
array(),
'',
'config-step-4',
true
array(), '', 'config-step-4', true
),
),
@@ -2005,6 +1992,14 @@ class TheCheckout extends Module
$this->l('Display also on PS login page'),
$this->l('Social login buttons will be shown also on Prestashop default login page')
)
// $this->generateSwitch(
// 'paypal_express_checkout',
// $this->l('Paypal express checkout'),
// $this->l('Show Paypal express checkout button in Sign-in area'),
// array(),
// $this->l('Inactive because Paypal module is NOT enabled.'),
// 'desc-visible-only-when-inactive'
// )
),
'submit' => array(
@@ -2030,6 +2025,11 @@ class TheCheckout extends Module
$this->l('Clean checkout session'),
$this->l('Clean remembered status of checkboxes (Terms & conditions, Customer privacy, ...) after order is confirmed')
),
$this->generateSwitch(
'assign_customer_id_asap',
$this->l('Assign Address to Customer ASAP'),
$this->l('Even when Address is not yet fully filled-in, assign it to Customer as soon as possible')
),
$this->generateText(
'ps_css_cache_version',
$this->l('PS CSS cache version'),
@@ -2070,8 +2070,8 @@ class TheCheckout extends Module
'hint' => $this->l('Custom JS, (!) consider that jQuery might be loaded later, use it only in plain JS DOMready handler!'),
'class' => 'max-size-lg',
// Generate reset link markup through description of this very last config element
'desc' => '<div id="reset-all-settings">'.
$this->l('Reset ALL SETTINGS to default values') .': <span class="reset-link" data-section="ALL SETTINGS" data-action="resetAllSettings"></span></div>'
'desc' => $this->tagIt('div',$this->l('Reset ALL SETTINGS to default values') . ': '. $this->tagIt('span', '', 'class="reset-link" data-section="ALL SETTINGS" data-action="resetAllSettings"'),
'id="reset-all-settings"')
),
),
@@ -2125,6 +2125,7 @@ class TheCheckout extends Module
Configuration::get($name, (int)$lang['id_lang'])
);
}
}
return array_merge($tc_options, $other_options, $fields_localized);
}
@@ -2135,7 +2136,7 @@ class TheCheckout extends Module
protected function postProcess()
{
//if ('demo@demo.com' == $this->context->employee->email) {
// return 'This is DEMO store, set in <' . 'b' . '>read-only mode<' . '/' . 'b' . '>, settings cannot be updated.';
// return 'This is DEMO store, set in read-only mode, settings cannot be updated.';
//}
$errors = '';
@@ -2144,6 +2145,7 @@ class TheCheckout extends Module
));
foreach (array_keys($form_values) as $key) {
$errors .= $this->config->updateByName($key);
//echo "updating $key with: ".Tools::getValue($key)."\n\n";
}